Skip to content

Commit

Permalink
Tweak build & notifications (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelrobert authored Jul 28, 2024
1 parent 4cd678e commit e27a2c4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
37 changes: 21 additions & 16 deletions prototype/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ platform :ios do
desc "Build app for TestFlight"
lane :beta_ios do |options|
# Set XCode version
xcversion(version: "15.4")
xcversion(version: "15.4")
xcodes(
version: '15.4',
select_for_current_build_only: true,
)

# Set up CI
setup_ci()

# Set parameters
key_id = ENV['APP_STORE_KEY_ID']
issuer_id = ENV['APP_STORE_ISSUER_ID']
Expand All @@ -39,7 +39,7 @@ platform :ios do
matchType = "appstore"
app_identifier = "im.phnx.prototype"
app_identifier_nse = "im.phnx.prototype.nse"

# Load the app store connect API key
api_key = app_store_connect_api_key(
key_id: key_id,
Expand All @@ -48,18 +48,23 @@ platform :ios do
is_key_content_base64: true,
in_house: false
)

# Fetch the latest TestFlight build number and increment it by 1
build_number = latest_testflight_build_number(
version: "1.0.0",
api_key: api_key,
app_identifier: app_identifier
)

# Determine build number
build_number = if options[:build_number]
options[:build_number].to_i
else
latest_testflight_build_number(
version: "1.0.0",
api_key: api_key,
app_identifier: app_identifier
) + 1
end

increment_build_number(
xcodeproj: "ios/Runner.xcodeproj",
build_number: build_number + 1,
build_number: build_number,
)

# Use match for code signing
["development", "appstore"].each do |i|
match(
Expand All @@ -73,10 +78,10 @@ platform :ios do
readonly: is_ci,
)
end

# Install flutter dependencies
sh "flutter pub get"

# Install CocoaPods dependencies
cocoapods(
clean: true,
Expand All @@ -89,7 +94,7 @@ platform :ios do
scheme: "Runner",
export_method: "app-store",
)

# Upload the app to TestFlight if the parameter is set
if options[:upload_to_test_flight]
upload_to_testflight(
Expand Down
5 changes: 4 additions & 1 deletion prototype/ios/NotificationService/NotificationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ class NotificationService: UNNotificationServiceExtension {
bestAttemptContent.body = lastNotification.body
contentHandler(bestAttemptContent)
} else {
contentHandler(UNNotificationContent())
// Delay the callback by .1 seconds so that the notifications can be removed
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
contentHandler(UNNotificationContent())
}
}
}
}
Expand Down

0 comments on commit e27a2c4

Please sign in to comment.