From 066bfeb612827b764b80a414173a9382bf9b9e4a Mon Sep 17 00:00:00 2001 From: David Date: Mon, 15 Jul 2024 17:23:52 -0700 Subject: [PATCH] Release 18.6.0 (#3161) * Update coding key instead of introducing new required key * Update CHANGELOG * Update versions * Add onReady callbacks * Comments --------- Co-authored-by: crow --- Airship.podspec | 2 +- Airship/AirshipConfig.xcconfig | 2 +- Airship/AirshipCore/Source/Airship.swift | 23 +++++++++++ .../AirshipCore/Source/AirshipVersion.swift | 2 +- ...erenceCenterConfig+ContactManagement.swift | 11 +----- .../AddChannelPromptViewModel.swift | 22 +++++++---- AirshipContentExtension.podspec | 2 +- AirshipDebug.podspec | 2 +- AirshipServiceExtension.podspec | 2 +- CHANGELOG.md | 39 ++++++++++++------- 10 files changed, 70 insertions(+), 37 deletions(-) diff --git a/Airship.podspec b/Airship.podspec index 22bd8c1fa..541e07f7e 100644 --- a/Airship.podspec +++ b/Airship.podspec @@ -1,4 +1,4 @@ -AIRSHIP_VERSION="18.5.0" +AIRSHIP_VERSION="18.6.0" Pod::Spec.new do |s| s.version = AIRSHIP_VERSION diff --git a/Airship/AirshipConfig.xcconfig b/Airship/AirshipConfig.xcconfig index 9e761039f..1695e4d80 100644 --- a/Airship/AirshipConfig.xcconfig +++ b/Airship/AirshipConfig.xcconfig @@ -1,6 +1,6 @@ //* Copyright Airship and Contributors */ -CURRENT_PROJECT_VERSION = 18.5.0 +CURRENT_PROJECT_VERSION = 18.6.0 // Uncomment to include the preview build warning // OTHER_CFLAGS = $(inherited) -DUA_PREVIEW=1 diff --git a/Airship/AirshipCore/Source/Airship.swift b/Airship/AirshipCore/Source/Airship.swift index 7f3dfd6e0..f4a8f93f5 100644 --- a/Airship/AirshipCore/Source/Airship.swift +++ b/Airship/AirshipCore/Source/Airship.swift @@ -163,6 +163,9 @@ public class Airship: NSObject { return requireComponent(ofType: AirshipBaseChannelProtocol.self) } + @MainActor + private static var onReadyCallbacks: [@MainActor @Sendable () -> Void] = [] + init(instance: AirshipInstanceProtocol) { self.airshipInstance = instance } @@ -292,6 +295,25 @@ public class Airship: NSObject { #endif + /// On ready callback gets called immediately when ready otherwise gets called immediately after takeoff + /// - Parameter callback: callback closure that's called when Airship is ready + @MainActor + public static func onReady(callback: @MainActor @Sendable @escaping () -> Void) { + onReadyCallbacks.append(callback) + + if isFlying { + executeOnReady() + } + } + + /// Helper method that executes any remaining onReady closures and resets the array + @MainActor + private static func executeOnReady() { + let toExecute = onReadyCallbacks + onReadyCallbacks.removeAll() + toExecute.forEach { $0() } + } + @MainActor private class func commonTakeOff(_ config: AirshipConfig?, onReady: (() -> Void)? = nil) { @@ -336,6 +358,7 @@ public class Airship: NSObject { onReady?() self.shared.airshipInstance.airshipReady() + executeOnReady() if self.shared.airshipInstance.config.isExtendedBroadcastsEnabled { var userInfo: [String: Any] = [:] diff --git a/Airship/AirshipCore/Source/AirshipVersion.swift b/Airship/AirshipCore/Source/AirshipVersion.swift index 92c107874..232930988 100644 --- a/Airship/AirshipCore/Source/AirshipVersion.swift +++ b/Airship/AirshipCore/Source/AirshipVersion.swift @@ -3,7 +3,7 @@ import Foundation public struct AirshipVersion { - public static let version = "18.5.0" + public static let version = "18.6.0" public static func get() -> String { return version } diff --git a/Airship/AirshipPreferenceCenter/Source/data/PreferenceCenterConfig+ContactManagement.swift b/Airship/AirshipPreferenceCenter/Source/data/PreferenceCenterConfig+ContactManagement.swift index 4b79c3810..a821bb9a4 100644 --- a/Airship/AirshipPreferenceCenter/Source/data/PreferenceCenterConfig+ContactManagement.swift +++ b/Airship/AirshipPreferenceCenter/Source/data/PreferenceCenterConfig+ContactManagement.swift @@ -539,11 +539,8 @@ public extension PreferenceCenterConfig { /// Placeholder text. public var placeholderText: String - /// Country code. Examples: (US, FR, UK). Not currently used on the mobile side. - public var countryCode: String - /// Country calling code. Examples: (1, 33, 44) - public var countryCallingCode: String + public var countryCode: String /// Country display name. public var displayName: String @@ -551,8 +548,7 @@ public extension PreferenceCenterConfig { enum CodingKeys: String, CodingKey { case senderId = "sender_id" case placeholderText = "placeholder_text" - case countryCode = "country_code" - case countryCallingCode = "country_calling_code" + case countryCode = "country_calling_code" case displayName = "display_name" } @@ -560,13 +556,11 @@ public extension PreferenceCenterConfig { senderId: String, placeholderText: String, countryCode: String, - countryCallingCode: String, displayName: String ) { self.senderId = senderId self.placeholderText = placeholderText self.countryCode = countryCode - self.countryCallingCode = countryCallingCode self.displayName = displayName } @@ -574,7 +568,6 @@ public extension PreferenceCenterConfig { senderId: "none", placeholderText: "none", countryCode: "none", - countryCallingCode: "none", displayName: "none" ) } diff --git a/Airship/AirshipPreferenceCenter/Source/view/Contact management/AddChannelPromptViewModel.swift b/Airship/AirshipPreferenceCenter/Source/view/Contact management/AddChannelPromptViewModel.swift index 6fcdf101e..4f75e2bb0 100644 --- a/Airship/AirshipPreferenceCenter/Source/view/Contact management/AddChannelPromptViewModel.swift +++ b/Airship/AirshipPreferenceCenter/Source/view/Contact management/AddChannelPromptViewModel.swift @@ -55,7 +55,7 @@ internal class AddChannelPromptViewModel: ObservableObject { @MainActor private func attemptSMSSubmission() async { do { - let formattedMSISDN = formattedMSISDN(countryCallingCode: selectedSender.countryCallingCode, number: inputText) + let formattedMSISDN = formattedMSISDN(countryCode: selectedSender.countryCode, number: inputText) /// Only start to load when we are sure it's not a duplicate failed request onStartLoading() @@ -96,7 +96,7 @@ internal class AddChannelPromptViewModel: ObservableObject { if let platform = platform { switch platform { case .sms(_): - let formattedNumber = formattedMSISDN(countryCallingCode: selectedSender.countryCallingCode, number: inputText) + let formattedNumber = formattedMSISDN(countryCode: selectedSender.countryCode, number: inputText) onRegisterSMS(formattedNumber, selectedSender.senderId) case .email(_): let formattedEmail = formattedEmail(email: inputText) @@ -157,11 +157,17 @@ extension AddChannelPromptViewModel { /// Format for MSISDN standards - including removing plus, dashes, spaces etc. /// Formatting behind the scenes like this makes sense because there are lots of valid ways to show /// Phone numbers like 1.503.867.5309 1-504-867-5309. This also allows us to strip the "+" from the country code - func formattedMSISDN(countryCallingCode: String, number: String) -> String { - let msisdn = countryCallingCode + number - let allowedCharacters = CharacterSet.decimalDigits - let formatted = msisdn.unicodeScalars.filter { allowedCharacters.contains($0) } - return String(formatted) + func formattedMSISDN(countryCode: String, number: String) -> String { + let cleanedCountryCode = countryCode.replacingOccurrences(of: "[^0-9]", with: "", options: .regularExpression) + var cleanedNumber = number.replacingOccurrences(of: "[^0-9]", with: "", options: .regularExpression) + + // Remove country code from the beginning of the number if it's already present + if cleanedNumber.hasPrefix(cleanedCountryCode) { + cleanedNumber = String(cleanedNumber.dropFirst(cleanedCountryCode.count)) + } + + let msisdn = cleanedCountryCode + cleanedNumber + return msisdn } /// Just trim spaces for emails to be helpful @@ -180,7 +186,7 @@ extension AddChannelPromptViewModel { let emailPredicate = NSPredicate(format: "SELF MATCHES %@", emailRegex) return emailPredicate.evaluate(with: self.inputText) case .sms(_): - let formatted = formattedMSISDN(countryCallingCode: self.selectedSender.countryCallingCode, number: self.inputText) + let formatted = formattedMSISDN(countryCode: self.selectedSender.countryCode, number: self.inputText) let msisdnRegex = "^[1-9]\\d{1,14}$" let msisdnPredicate = NSPredicate(format: "SELF MATCHES %@", msisdnRegex) return msisdnPredicate.evaluate(with: formatted) diff --git a/AirshipContentExtension.podspec b/AirshipContentExtension.podspec index 89939e473..18beabc0c 100644 --- a/AirshipContentExtension.podspec +++ b/AirshipContentExtension.podspec @@ -1,4 +1,4 @@ -AIRSHIP_VERSION="18.5.0" +AIRSHIP_VERSION="18.6.0" Pod::Spec.new do |s| s.version = AIRSHIP_VERSION diff --git a/AirshipDebug.podspec b/AirshipDebug.podspec index 359464398..74840e39d 100644 --- a/AirshipDebug.podspec +++ b/AirshipDebug.podspec @@ -1,4 +1,4 @@ -AIRSHIP_VERSION="18.5.0" +AIRSHIP_VERSION="18.6.0" Pod::Spec.new do |s| s.version = AIRSHIP_VERSION diff --git a/AirshipServiceExtension.podspec b/AirshipServiceExtension.podspec index 39669a5d6..03d3c5169 100644 --- a/AirshipServiceExtension.podspec +++ b/AirshipServiceExtension.podspec @@ -1,4 +1,4 @@ -AIRSHIP_VERSION="18.5.0" +AIRSHIP_VERSION="18.6.0" Pod::Spec.new do |s| s.version = AIRSHIP_VERSION diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fde318c0..02ff785ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,29 @@ # iOS Changelog +## Version 18.6.0 July 12, 2024 +Minor release with some improvements to preference center, a fix for in-app message veritcal sizing, accessibility improvements and markdown support in scenes. + +### Changes +- Added warning message to preference center email entry field. +- Updated preference center country_code. +- Fixed bug preventing preference center channel management from fully opting-out registered channels. +- Fixed padding bug preventing modal in-app messages from properly sizing to their content. +- Added accessibility improvements. +- Added markdown support to scenes. + ## Version 18.5.0 July 1, 2024 Minor release that includes cert pinning and various fixes and improvements for Preference Center, In-app Messages and Embedded Content. ### Changes -- Added ability to inject a custom certificate verification closure that applies to all API calls -- Added width and height parameters to in-app dismiss button theming -- Fixed bug that caused HTML in-app message backgrounds to default to clear instead of system background -- Fixed extra payload parsing in in-app messages -- Set default banner placement to bottom -- Increased impression interval for embedded in-app views -- Improved in-app banner view accessibility -- Preference center contact channel listing is now refreshed on foreground and from background pushes +- Added ability to inject a custom certificate verification closure that applies to all API calls. +- Added width and height parameters to in-app dismiss button theming. +- Fixed bug that caused HTML in-app message backgrounds to default to clear instead of system background. +- Fixed extra payload parsing in in-app messages. +- Set default banner placement to bottom. +- Increased impression interval for embedded in-app views. +- Improved in-app banner view accessibility. +- Preference center contact channel listing is now refreshed on foreground and from background pushes. ## Version 18.4.1 June 21, 2024 Patch release to fix a regression with IAX ignoring screen, version, and custom event triggers. Apps using those triggers that are on 18.4.0 should update. @@ -24,12 +35,12 @@ Patch release to fix a regression with IAX ignoring screen, version, and custom Minor release that adds contact management support to the preference center, support for anonymous channels, per-message in-app message theming, message center customization and logging improvements. Apps that use the message center or stories should update to this version. ### Changes -- Added support for anonymous channels -- Added contact management support in preference centers -- Added improved theme support and per message theming for in-app messages -- Added public logging functions -- Fixed bug in stories page indicator -- Fixed message center list view background theming +- Added support for anonymous channels. +- Added contact management support in preference centers. +- Added improved theme support and per message theming for in-app messages. +- Added public logging functions. +- Fixed bug in stories page indicator. +- Fixed message center list view background theming. ## Version 18.3.1, May 27, 2024 Patch release with bug fix for message center customization. Apps that use the message center should update to this version.