Skip to content

Commit 6075021

Browse files
denrasebuenaflor
andauthored
Testflight (#1938)
* Setup testflight against v8 branch * enable run on pr * run on push * make executable * fix beta version number * push on main, release and workflow update * bump xcode default version to 15.0.1 * add newline * Add ITSAppUsesNonExemptEncryption to info.plist * select with xcodes * fix file extension * fix warnings * use correct property to remove warning * Update ktlint --------- Co-authored-by: GIancarlo Buenaflor <[email protected]>
1 parent 8166d0c commit 6075021

File tree

11 files changed

+192
-40
lines changed

11 files changed

+192
-40
lines changed

.github/workflows/flutter.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ jobs:
188188
- uses: actions/checkout@v4
189189

190190
- name: ktlint
191-
uses: ScaCap/action-ktlint@0ff81efa49425bd0df46caabd8005aafdc8f2cf2 # [email protected].0
191+
uses: ScaCap/action-ktlint@38262d0fb8bff43ddafc8b3c04bce6e6c7263319 # [email protected].1
192192
with:
193193
github_token: ${{ secrets.github_token }}
194194
reporter: github-pr-review

.github/workflows/testflight.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Upload to Testflight
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- release/**
7+
pull_request:
8+
paths:
9+
- '.github/workflows/testflight.yml'
10+
11+
jobs:
12+
upload_to_testflight:
13+
name: Build and Upload to Testflight
14+
runs-on: macos-13
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # [email protected]
18+
- run: xcodes select 15.0.1
19+
- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # [email protected]
20+
with:
21+
ruby-version: '2.7.5'
22+
bundler-cache: true
23+
24+
- name: flutter
25+
working-directory: ./flutter/example
26+
run: |
27+
flutter upgrade
28+
flutter pub get
29+
flutter build ios --no-codesign
30+
31+
- name: Install Fastlane
32+
working-directory: ./flutter/example/ios
33+
run: bundle install
34+
35+
- name: Bump, Build & Upload App to TestFlight
36+
working-directory: ./flutter/example/ios
37+
env:
38+
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
39+
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
40+
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}
41+
FASTLANE_BUNDLE_VERSION: ${{ github.run_number }}
42+
FASTLANE_KEYCHAIN_PASSWORD: ${{ secrets.FASTLANE_KEYCHAIN_PASSWORD }}
43+
MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}
44+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
45+
MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }}
46+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
47+
SENTRY_LOG_LEVEL: DEBUG
48+
run: |
49+
bundle exec fastlane bump_build_number
50+
bundle exec fastlane build_release
51+
bundle exec fastlane upload_testflight
52+
53+
- name: Upload Symbols to Sentry
54+
working-directory: ./flutter/example
55+
env:
56+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
57+
run: flutter packages pub run sentry_dart_plugin

flutter/example/ios/Flutter/AppFrameworkInfo.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>11.0</string>
24+
<string>12.0</string>
2525
</dict>
2626
</plist>

flutter/example/ios/Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source "https://rubygems.org"
2+
3+
gem "fastlane"

flutter/example/ios/Podfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ post_install do |installer|
4444
installer.pods_project.targets.each do |target|
4545
flutter_additional_ios_build_settings(target)
4646
target.build_configurations.each do |config|
47-
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
47+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
4848
end
4949
end
5050
end

flutter/example/ios/Runner.xcodeproj/project.pbxproj

+12-9
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@
460460
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
461461
GCC_WARN_UNUSED_FUNCTION = YES;
462462
GCC_WARN_UNUSED_VARIABLE = YES;
463-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
463+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
464464
MTL_ENABLE_DEBUG_INFO = NO;
465465
SDKROOT = iphoneos;
466466
SUPPORTED_PLATFORMS = iphoneos;
@@ -483,6 +483,7 @@
483483
"$(PROJECT_DIR)/Flutter",
484484
);
485485
INFOPLIST_FILE = Runner/Info.plist;
486+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
486487
LD_RUNPATH_SEARCH_PATHS = (
487488
"$(inherited)",
488489
"@executable_path/Frameworks",
@@ -491,7 +492,7 @@
491492
"$(inherited)",
492493
"$(PROJECT_DIR)/Flutter",
493494
);
494-
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example;
495+
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.sample;
495496
PRODUCT_NAME = "$(TARGET_NAME)";
496497
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
497498
SWIFT_VERSION = 5.0;
@@ -518,7 +519,7 @@
518519
MARKETING_VERSION = 1.0;
519520
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
520521
MTL_FAST_MATH = YES;
521-
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example.RunnerTests;
522+
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.sample.RunnerTests;
522523
PRODUCT_NAME = "$(TARGET_NAME)";
523524
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
524525
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -547,7 +548,7 @@
547548
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
548549
MARKETING_VERSION = 1.0;
549550
MTL_FAST_MATH = YES;
550-
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example.RunnerTests;
551+
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.sample.RunnerTests;
551552
PRODUCT_NAME = "$(TARGET_NAME)";
552553
SWIFT_EMIT_LOC_STRINGS = NO;
553554
SWIFT_VERSION = 5.0;
@@ -574,7 +575,7 @@
574575
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
575576
MARKETING_VERSION = 1.0;
576577
MTL_FAST_MATH = YES;
577-
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example.RunnerTests;
578+
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.sample.RunnerTests;
578579
PRODUCT_NAME = "$(TARGET_NAME)";
579580
SWIFT_EMIT_LOC_STRINGS = NO;
580581
SWIFT_VERSION = 5.0;
@@ -631,7 +632,7 @@
631632
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
632633
GCC_WARN_UNUSED_FUNCTION = YES;
633634
GCC_WARN_UNUSED_VARIABLE = YES;
634-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
635+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
635636
MTL_ENABLE_DEBUG_INFO = YES;
636637
ONLY_ACTIVE_ARCH = YES;
637638
SDKROOT = iphoneos;
@@ -681,7 +682,7 @@
681682
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
682683
GCC_WARN_UNUSED_FUNCTION = YES;
683684
GCC_WARN_UNUSED_VARIABLE = YES;
684-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
685+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
685686
MTL_ENABLE_DEBUG_INFO = NO;
686687
SDKROOT = iphoneos;
687688
SUPPORTED_PLATFORMS = iphoneos;
@@ -706,6 +707,7 @@
706707
"$(PROJECT_DIR)/Flutter",
707708
);
708709
INFOPLIST_FILE = Runner/Info.plist;
710+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
709711
LD_RUNPATH_SEARCH_PATHS = (
710712
"$(inherited)",
711713
"@executable_path/Frameworks",
@@ -714,7 +716,7 @@
714716
"$(inherited)",
715717
"$(PROJECT_DIR)/Flutter",
716718
);
717-
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example;
719+
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.sample;
718720
PRODUCT_NAME = "$(TARGET_NAME)";
719721
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
720722
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -737,6 +739,7 @@
737739
"$(PROJECT_DIR)/Flutter",
738740
);
739741
INFOPLIST_FILE = Runner/Info.plist;
742+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
740743
LD_RUNPATH_SEARCH_PATHS = (
741744
"$(inherited)",
742745
"@executable_path/Frameworks",
@@ -745,7 +748,7 @@
745748
"$(inherited)",
746749
"$(PROJECT_DIR)/Flutter",
747750
);
748-
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.example;
751+
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.flutter.sample;
749752
PRODUCT_NAME = "$(TARGET_NAME)";
750753
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
751754
SWIFT_VERSION = 5.0;

flutter/example/ios/Runner/Info.plist

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>ITSAppUsesNonExemptEncryption</key>
6+
<false/>
7+
<key>CADisableMinimumFrameDurationOnPhone</key>
8+
<true/>
59
<key>CFBundleDevelopmentRegion</key>
610
<string>$(DEVELOPMENT_LANGUAGE)</string>
711
<key>CFBundleExecutable</key>
@@ -22,6 +26,8 @@
2226
<string>$(FLUTTER_BUILD_NUMBER)</string>
2327
<key>LSRequiresIPhoneOS</key>
2428
<true/>
29+
<key>UIApplicationSupportsIndirectInputEvents</key>
30+
<true/>
2531
<key>UILaunchStoryboardName</key>
2632
<string>LaunchScreen</string>
2733
<key>UIMainStoryboardFile</key>
@@ -41,9 +47,5 @@
4147
</array>
4248
<key>UIViewControllerBasedStatusBarAppearance</key>
4349
<false/>
44-
<key>CADisableMinimumFrameDurationOnPhone</key>
45-
<true/>
46-
<key>UIApplicationSupportsIndirectInputEvents</key>
47-
<true/>
4850
</dict>
4951
</plist>

flutter/example/ios/fastlane/Appfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
app_identifier("io.sentry.flutter.sample") # The bundle identifier of your app
2+
3+
itc_team_id("96157806") # App Store Connect Team ID
4+
team_id("97JCY7859U") # Developer Portal Team ID
5+
6+
# For more information about the Appfile, see:
7+
# https://docs.fastlane.tools/advanced/#appfile

flutter/example/ios/fastlane/Fastfile

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
default_platform(:ios)
2+
3+
platform :ios do
4+
5+
desc "Bump Build Number"
6+
lane :bump_build_number do
7+
fetch_api_key()
8+
9+
version_string = get_version_number(xcodeproj: "./Runner.xcodeproj")
10+
version_parts = version_string.split(".")
11+
12+
# Remove last digit if necessary
13+
if version_parts.length > 3
14+
version_parts.pop
15+
end
16+
17+
new_version = version_parts.join(".")
18+
19+
increment_version_number(
20+
version_number: new_version,
21+
xcodeproj: "./Runner.xcodeproj"
22+
)
23+
increment_build_number(
24+
build_number: latest_testflight_build_number + 1,
25+
xcodeproj: "./Runner.xcodeproj"
26+
)
27+
end
28+
29+
desc "Build Release"
30+
lane :build_release do
31+
32+
setup_ci
33+
34+
disable_automatic_code_signing
35+
36+
sync_code_signing(
37+
type: "development",
38+
readonly: true,
39+
app_identifier: ["io.sentry.flutter.sample"]
40+
)
41+
42+
sync_code_signing(
43+
type: "appstore",
44+
readonly: true,
45+
app_identifier: ["io.sentry.flutter.sample"]
46+
)
47+
48+
update_project_provisioning(
49+
xcodeproj: "Runner.xcodeproj",
50+
target_filter: "Runner",
51+
profile: ENV["sigh_io.sentry.flutter.sample_appstore_profile-path"],
52+
build_configuration: "Release"
53+
)
54+
55+
build_app(
56+
workspace: "Runner.xcworkspace",
57+
scheme: "Runner",
58+
configuration: "Release",
59+
clean: true,
60+
include_symbols: true,
61+
export_method: "app-store",
62+
output_directory:"./build/",
63+
export_options: {
64+
method: "app-store",
65+
provisioningProfiles: {
66+
"io.sentry.flutter.sample" => ENV["sigh_io.sentry.flutter.sample_appstore_profile-name"]
67+
}
68+
},
69+
codesigning_identity: ENV["sigh_io.sentry.flutter.sample_appstore_certificate-name"],
70+
output_name: "sentry_flutter_sample.ipa"
71+
)
72+
73+
delete_keychain(
74+
name: "fastlane_tmp_keychain"
75+
) unless is_ci
76+
end
77+
78+
desc "Upload to TestFlight"
79+
lane :upload_testflight do
80+
fetch_api_key()
81+
testflight(
82+
skip_waiting_for_build_processing: true,
83+
ipa: "./build/sentry_flutter_sample.ipa"
84+
)
85+
end
86+
87+
desc "Fetch ASC API Key"
88+
lane :fetch_api_key do
89+
app_store_connect_api_key(
90+
key_id: ENV["APP_STORE_CONNECT_KEY_ID"],
91+
issuer_id: ENV["APP_STORE_CONNECT_ISSUER_ID"],
92+
key_content: ENV["APP_STORE_CONNECT_KEY"]
93+
)
94+
end
95+
end
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
git_url("[email protected]:getsentry/codesigning.git")
2+
storage_mode("git")
3+
username("[email protected]") # Your Apple Developer Portal username
4+
5+
# The docs are available on https://docs.fastlane.tools/actions/match

flutter/example/lib/main.dart

+4-24
Original file line numberDiff line numberDiff line change
@@ -478,12 +478,7 @@ class MainScaffold extends StatelessWidget {
478478
TooltipButton(
479479
onPressed: () async {
480480
final id = await Sentry.captureMessage('UserFeedback');
481-
// ignore: use_build_context_synchronously
482-
if (!context.isMounted) {
483-
return;
484-
}
485-
486-
// ignore: use_build_context_synchronously
481+
if (!context.mounted) return;
487482
await showDialog(
488483
context: context,
489484
builder: (context) {
@@ -906,12 +901,7 @@ Future<void> makeWebRequest(BuildContext context) async {
906901

907902
await transaction.finish(status: const SpanStatus.ok());
908903

909-
// ignore: use_build_context_synchronously
910-
if (!context.isMounted) {
911-
return;
912-
}
913-
914-
// ignore: use_build_context_synchronously
904+
if (!context.mounted) return;
915905
await showDialog<void>(
916906
context: context,
917907
builder: (context) {
@@ -957,12 +947,7 @@ Future<void> makeWebRequestWithDio(BuildContext context) async {
957947
await span.finish();
958948
}
959949

960-
// ignore: use_build_context_synchronously
961-
if (!context.isMounted) {
962-
return;
963-
}
964-
965-
// ignore: use_build_context_synchronously
950+
if (!context.mounted) return;
966951
await showDialog<void>(
967952
context: context,
968953
builder: (context) {
@@ -992,12 +977,7 @@ Future<void> showDialogWithTextAndImage(BuildContext context) async {
992977
final text =
993978
await DefaultAssetBundle.of(context).loadString('assets/lorem-ipsum.txt');
994979

995-
// ignore: use_build_context_synchronously
996-
if (!context.isMounted) {
997-
return;
998-
}
999-
1000-
// ignore: use_build_context_synchronously
980+
if (!context.mounted) return;
1001981
await showDialog<void>(
1002982
context: context,
1003983
// gets tracked if using SentryNavigatorObserver

0 commit comments

Comments
 (0)