Skip to content

Commit

Permalink
Release 18.6.0 (#3161)
Browse files Browse the repository at this point in the history
* Update coding key instead of introducing new required key

* Update CHANGELOG

* Update versions

* Add onReady callbacks

* Comments

---------

Co-authored-by: crow <[email protected]>
  • Loading branch information
crow and crow authored Jul 16, 2024
1 parent e7ac436 commit 066bfeb
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Airship.podspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AIRSHIP_VERSION="18.5.0"
AIRSHIP_VERSION="18.6.0"

Pod::Spec.new do |s|
s.version = AIRSHIP_VERSION
Expand Down
2 changes: 1 addition & 1 deletion Airship/AirshipConfig.xcconfig
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions Airship/AirshipCore/Source/Airship.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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) {

Expand Down Expand Up @@ -336,6 +358,7 @@ public class Airship: NSObject {
onReady?()

self.shared.airshipInstance.airshipReady()
executeOnReady()

if self.shared.airshipInstance.config.isExtendedBroadcastsEnabled {
var userInfo: [String: Any] = [:]
Expand Down
2 changes: 1 addition & 1 deletion Airship/AirshipCore/Source/AirshipVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,42 +539,35 @@ 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

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"
}

public init(
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
}

static let none = SMSSenderInfo(
senderId: "none",
placeholderText: "none",
countryCode: "none",
countryCallingCode: "none",
displayName: "none"
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion AirshipContentExtension.podspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AIRSHIP_VERSION="18.5.0"
AIRSHIP_VERSION="18.6.0"

Pod::Spec.new do |s|
s.version = AIRSHIP_VERSION
Expand Down
2 changes: 1 addition & 1 deletion AirshipDebug.podspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AIRSHIP_VERSION="18.5.0"
AIRSHIP_VERSION="18.6.0"

Pod::Spec.new do |s|
s.version = AIRSHIP_VERSION
Expand Down
2 changes: 1 addition & 1 deletion AirshipServiceExtension.podspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AIRSHIP_VERSION="18.5.0"
AIRSHIP_VERSION="18.6.0"

Pod::Spec.new do |s|
s.version = AIRSHIP_VERSION
Expand Down
39 changes: 25 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit 066bfeb

Please sign in to comment.