diff --git a/BrazeKit.podspec b/BrazeKit.podspec index 264511a01..5a817827b 100644 --- a/BrazeKit.podspec +++ b/BrazeKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeKit' - s.version = '11.4.0' + s.version = '11.5.0' s.summary = 'Braze Main SDK library providing support for analytics and push notifications.' s.homepage = 'https://braze.com' @@ -9,8 +9,8 @@ Pod::Spec.new do |s| s.authors = 'Braze, Inc.' s.source = { - :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/11.4.0/BrazeKit.zip', - :sha256 => '809ce3973f8ebfc65ddf5b7aac8785fb9b1507c2e15e1e64dea9b3f583bb5fa7' + :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/11.5.0/BrazeKit.zip', + :sha256 => '6a1e4493f47a70147a4cf9d88aa47a85914b2ce0b85c4d27fd51c1b010c59604' } s.swift_version = '5.0' diff --git a/BrazeKitCompat.podspec b/BrazeKitCompat.podspec index 60422a2a1..8e825735b 100644 --- a/BrazeKitCompat.podspec +++ b/BrazeKitCompat.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeKitCompat' - s.version = '11.4.0' + s.version = '11.5.0' s.summary = 'Compatibility library for users migrating from AppboyKit.' s.homepage = 'https://braze.com' @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.license = { :type => 'Commercial' } s.authors = 'Braze, Inc.' - s.source = { :git => 'https://github.com/braze-inc/braze-swift-sdk.git', :tag => '11.4.0' } + s.source = { :git => 'https://github.com/braze-inc/braze-swift-sdk.git', :tag => '11.5.0' } s.swift_version = '5.0' s.ios.deployment_target = '12.0' @@ -18,8 +18,8 @@ Pod::Spec.new do |s| s.public_header_files = 'Sources/BrazeKitCompat/include/*.h' s.static_framework = true - s.dependency 'BrazeKit', '11.4.0' - s.dependency 'BrazeLocation', '11.4.0' + s.dependency 'BrazeKit', '11.5.0' + s.dependency 'BrazeLocation', '11.5.0' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } end diff --git a/BrazeLocation.podspec b/BrazeLocation.podspec index e9fa22600..998cf5189 100644 --- a/BrazeLocation.podspec +++ b/BrazeLocation.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeLocation' - s.version = '11.4.0' + s.version = '11.5.0' s.summary = 'Braze location library providing support for location analytics and geofence monitoring.' s.homepage = 'https://braze.com' @@ -9,8 +9,8 @@ Pod::Spec.new do |s| s.authors = 'Braze, Inc.' s.source = { - :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/11.4.0/BrazeLocation.zip', - :sha256 => 'f957e6fb75ded976f7de565b4be0420d3c2912d4261f436e87ce353fc0b6b752' + :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/11.5.0/BrazeLocation.zip', + :sha256 => 'b2aec021475e9c92979d1b77670d93b21b35898c8a5b6d65bf22586222340f40' } s.swift_version = '5.0' @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.vendored_framework = 'BrazeLocation.xcframework' s.resource_bundles = { 'BrazeLocation' => ['Sources/BrazeLocationResources/Resources/**/*'] } - s.dependency 'BrazeKit', '11.4.0' + s.dependency 'BrazeKit', '11.5.0' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } end diff --git a/BrazeNotificationService.podspec b/BrazeNotificationService.podspec index b76a7f96d..d0580e32f 100644 --- a/BrazeNotificationService.podspec +++ b/BrazeNotificationService.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeNotificationService' - s.version = '11.4.0' + s.version = '11.5.0' s.summary = 'Braze notification service extension library providing support for Rich Push notifications.' s.homepage = 'https://braze.com' @@ -9,8 +9,8 @@ Pod::Spec.new do |s| s.authors = 'Braze, Inc.' s.source = { - :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/11.4.0/BrazeNotificationService.zip', - :sha256 => '6804bfaf9c5efe55c109a6d63be264f9abc83acd8484718f9ddaef344f1371bf' + :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/11.5.0/BrazeNotificationService.zip', + :sha256 => '9008d433f56940a44709e40d42d0d74e710a60151e022e00108df38a7e8895f4' } s.swift_version = '5.0' diff --git a/BrazePushStory.podspec b/BrazePushStory.podspec index e6b898cea..452dfc1a2 100644 --- a/BrazePushStory.podspec +++ b/BrazePushStory.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazePushStory' - s.version = '11.4.0' + s.version = '11.5.0' s.summary = 'Braze notification content extension library providing support for Push Stories.' s.homepage = 'https://braze.com' @@ -9,8 +9,8 @@ Pod::Spec.new do |s| s.authors = 'Braze, Inc.' s.source = { - :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/11.4.0/BrazePushStory.zip', - :sha256 => '2e945d6f17812202a951a8598071c278acf6d2a9962e49abb27a8134a28e7ae0' + :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/11.5.0/BrazePushStory.zip', + :sha256 => 'd6eda8573576d887b3430a3e2d89293d2f0e94e4ac5ca118141559d54a0a1d6c' } s.swift_version = '5.0' diff --git a/BrazeUI.podspec b/BrazeUI.podspec index b530aba12..a327ca25a 100644 --- a/BrazeUI.podspec +++ b/BrazeUI.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeUI' - s.version = '11.4.0' + s.version = '11.5.0' s.summary = 'Braze-provided user interface library for In-App Messages and Content Cards.' s.homepage = 'https://braze.com' @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.license = { :type => 'Commercial' } s.authors = 'Braze, Inc.' - s.source = { :git => 'https://github.com/braze-inc/braze-swift-sdk.git', :tag => '11.4.0' } + s.source = { :git => 'https://github.com/braze-inc/braze-swift-sdk.git', :tag => '11.5.0' } s.swift_version = '5.0' s.ios.deployment_target = '12.0' @@ -18,7 +18,7 @@ Pod::Spec.new do |s| s.resource_bundles = { 'BrazeUI' => ['Sources/BrazeUI/Resources/**/*'] } s.static_framework = true - s.dependency 'BrazeKit', '11.4.0' + s.dependency 'BrazeKit', '11.5.0' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } end diff --git a/BrazeUICompat.podspec b/BrazeUICompat.podspec index 184a762fa..7739c4815 100644 --- a/BrazeUICompat.podspec +++ b/BrazeUICompat.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeUICompat' - s.version = '11.4.0' + s.version = '11.5.0' s.summary = 'Compatibility UI library for users migrating from AppboyUI.' s.homepage = 'https://braze.com' @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.license = { :type => 'Commercial' } s.authors = 'Braze, Inc.' - s.source = { :git => 'https://github.com/braze-inc/braze-swift-sdk.git', :tag => '11.4.0' } + s.source = { :git => 'https://github.com/braze-inc/braze-swift-sdk.git', :tag => '11.5.0' } s.swift_version = '5.0' s.ios.deployment_target = '12.0' @@ -18,7 +18,7 @@ Pod::Spec.new do |s| s.resource_bundles = { 'BrazeUICompat' => 'Sources/BrazeUICompat/*/Resources/**/*.*' } s.static_framework = true - s.dependency 'BrazeKitCompat', '11.4.0' + s.dependency 'BrazeKitCompat', '11.5.0' s.dependency 'SDWebImage', '>= 5.19.7', '< 6' s.user_target_xcconfig = { 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES' } diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ff762b4f..aa289adfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +## 11.5.0 + +##### Fixed +- `Braze.banners.getBanner(for:_:)` now successfully returns a cached `Banner` object for the requested placement ID as long as a Banner Cards sync has ever succeeded for the current user. + - Previously, it would log a warning and pass `nil` to the completion handler if a Banner Cards sync had not been completed for the current user during the current session specifically. + - This change aligns behavior with the Android SDK. +- Fixes an issue where images with the `"JPEG"` image type would sometimes not display in Push Stories. +- Fixes an issue where an in-app message in a Braze-provided UI can be displayed for an ineligible user under rare conditions. + - This may occur if the in-app message was in the process of being displayed in the UI at the same time that the user was changed to a different user. + +##### Added +- Adds [`Braze.User.id`](https://braze-inc.github.io/braze-swift-sdk/documentation/brazekit/braze/user/id) to access the current user identifier synchronously. + - Deprecates `Braze.User.id() async` and `Braze.User.id(queue:completion:)` in favor of `Braze.User.id`. + - These methods will be removed fully in a future update. +- Adds the optional parameter `userIDMatchBehavior` to the initializers of `Braze.InAppMessageRaw.Context`. This determines the behavior in the UI when the current identified user is different from the one that triggered the in-app message. + - The default for Braze-provided UIs (`.enforce`) will enforce that the user ID matches the user ID that triggered the in-app message. If there is a mismatch, the in-app message will not be displayed. + - For custom UIs, the default is `.ignore` and a mismatch will still display the in-app message. + ## 11.4.0 ##### Fixed diff --git a/Examples/ObjC/manual-integration-setup.sh b/Examples/ObjC/manual-integration-setup.sh index 4114697b9..05c8b8c08 100755 --- a/Examples/ObjC/manual-integration-setup.sh +++ b/Examples/ObjC/manual-integration-setup.sh @@ -20,7 +20,7 @@ if [ ! -f "manual-integration-setup.sh" ]; then fi # Constants -url="https://github.com/braze-inc/braze-swift-sdk/releases/download/11.4.0/braze-swift-sdk-prebuilt.zip" +url="https://github.com/braze-inc/braze-swift-sdk/releases/download/11.5.0/braze-swift-sdk-prebuilt.zip" echo "→" "Cleaning up" rm -rf braze-swift-sdk-prebuilt diff --git a/Examples/Swift/manual-integration-setup.sh b/Examples/Swift/manual-integration-setup.sh index 4114697b9..05c8b8c08 100755 --- a/Examples/Swift/manual-integration-setup.sh +++ b/Examples/Swift/manual-integration-setup.sh @@ -20,7 +20,7 @@ if [ ! -f "manual-integration-setup.sh" ]; then fi # Constants -url="https://github.com/braze-inc/braze-swift-sdk/releases/download/11.4.0/braze-swift-sdk-prebuilt.zip" +url="https://github.com/braze-inc/braze-swift-sdk/releases/download/11.5.0/braze-swift-sdk-prebuilt.zip" echo "→" "Cleaning up" rm -rf braze-swift-sdk-prebuilt diff --git a/Package.swift b/Package.swift index b98b79e50..9c101665e 100644 --- a/Package.swift +++ b/Package.swift @@ -49,8 +49,8 @@ let package = Package( targets: [ .binaryTarget( name: "BrazeKit", - url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/11.4.0/BrazeKit.zip", - checksum: "809ce3973f8ebfc65ddf5b7aac8785fb9b1507c2e15e1e64dea9b3f583bb5fa7" + url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/11.5.0/BrazeKit.zip", + checksum: "6a1e4493f47a70147a4cf9d88aa47a85914b2ce0b85c4d27fd51c1b010c59604" ), .target( name: "BrazeKitResources", @@ -67,8 +67,8 @@ let package = Package( ), .binaryTarget( name: "BrazeLocation", - url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/11.4.0/BrazeLocation.zip", - checksum: "f957e6fb75ded976f7de565b4be0420d3c2912d4261f436e87ce353fc0b6b752" + url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/11.5.0/BrazeLocation.zip", + checksum: "b2aec021475e9c92979d1b77670d93b21b35898c8a5b6d65bf22586222340f40" ), .target( name: "BrazeLocationResources", @@ -78,13 +78,13 @@ let package = Package( ), .binaryTarget( name: "BrazeNotificationService", - url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/11.4.0/BrazeNotificationService.zip", - checksum: "6804bfaf9c5efe55c109a6d63be264f9abc83acd8484718f9ddaef344f1371bf" + url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/11.5.0/BrazeNotificationService.zip", + checksum: "9008d433f56940a44709e40d42d0d74e710a60151e022e00108df38a7e8895f4" ), .binaryTarget( name: "BrazePushStory", - url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/11.4.0/BrazePushStory.zip", - checksum: "2e945d6f17812202a951a8598071c278acf6d2a9962e49abb27a8134a28e7ae0" + url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/11.5.0/BrazePushStory.zip", + checksum: "d6eda8573576d887b3430a3e2d89293d2f0e94e4ac5ca118141559d54a0a1d6c" ), .target( name: "BrazePushStoryResources", diff --git a/README.md b/README.md index fe93b9193..0d0fbf520 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

- Version: 11.4.0 + Version: 11.5.0 UIView /// Updates the passed view with a new image at `url`. - /// - Parameters: - /// - view: The view to update. - /// - url: The local file url for the image. + /// + /// This closure takes in the view to update and the local file url for the image as parameters. public var updateView: @MainActor @Sendable (_ view: UIView, _ url: URL?) -> Void /// Creates a GIF view provider. diff --git a/Sources/BrazeUI/InAppMessageUI/InAppMessageUI.swift b/Sources/BrazeUI/InAppMessageUI/InAppMessageUI.swift index cdc8e49d8..b3f503c43 100644 --- a/Sources/BrazeUI/InAppMessageUI/InAppMessageUI.swift +++ b/Sources/BrazeUI/InAppMessageUI/InAppMessageUI.swift @@ -213,6 +213,22 @@ open class BrazeInAppMessageUI: return } + // Verifies that the user that triggered the message matches the current identified user on the + // braze instance. The ID-matching behavior is enforced by default for in-app messages originating + // from Braze and ignored by default for local in-app messages. + if case .enforce(let messageUserId) = message.context?.userIDMatchBehavior, + let braze = message.context?.braze as? Braze, + messageUserId != braze.user.id + { + let error = Error.triggeredUserCurrentUserMismatch( + messageId: message.data.id, + currentUser: braze.user.id, + previousUser: messageUserId + ) + message.context?.logError(flattened: error.logDescription) + return + } + // - View controller let viewController = ViewController( ui: self, diff --git a/Sources/BrazeUI/InAppMessageUI/InAppMessageUIError.swift b/Sources/BrazeUI/InAppMessageUI/InAppMessageUIError.swift index 06905dffe..6115798f3 100644 --- a/Sources/BrazeUI/InAppMessageUI/InAppMessageUIError.swift +++ b/Sources/BrazeUI/InAppMessageUI/InAppMessageUIError.swift @@ -19,6 +19,8 @@ extension BrazeInAppMessageUI { case noWindowScene case assetsFailure(Braze.ErrorString) case invalidConstraints + case triggeredUserCurrentUserMismatch( + messageId: String?, currentUser: String?, previousUser: String?) case otherMessagePresented(push: Bool) case messageContextInvalid @@ -82,6 +84,14 @@ extension BrazeInAppMessageUI.Error { case .invalidConstraints: return "Unable to present message - constraints were invalid or nil." + case .triggeredUserCurrentUserMismatch(let messageId, let currentUser, let previousUser): + return + """ + Skipping message presentation - the current user is not the user who triggered the message. + - in-app message: \(messageId ?? "No message ID") + - current user: \(currentUser ?? "anonymous user") + - original user: \(previousUser ?? "anonymous user") + """ case .otherMessagePresented(let push): return