From 951d5e15529bca309ebdb3b29da4be26d77bb841 Mon Sep 17 00:00:00 2001 From: Jeriel Ng Date: Tue, 12 Dec 2023 12:54:45 -0500 Subject: [PATCH] Version 7.4.0 --- BrazeKit.podspec | 6 ++-- BrazeKitCompat.podspec | 10 +++---- BrazeLocation.podspec | 8 ++--- BrazeNotificationService.podspec | 6 ++-- BrazePushStory.podspec | 6 ++-- BrazeUI.podspec | 8 ++--- BrazeUICompat.podspec | 8 ++--- CHANGELOG.md | 25 ++++++++++++---- Examples/ObjC/manual-integration-setup.sh | 2 +- Examples/Swift/manual-integration-setup.sh | 2 +- Package.swift | 16 +++++----- README.md | 14 ++++++++- .../InAppMessageUI/InAppMessageUIExt.swift | 19 ++++++++++++ .../Views/InAppMessageUIControlView.swift | 12 ++++++-- .../Views/InAppMessageUIHtmlView.swift | 30 +++++++++++++++---- .../Views/InAppMessageUIModalImageView.swift | 12 ++++++-- .../Views/InAppMessageUIModalView.swift | 12 ++++++-- .../Views/InAppMessageUISlideupView.swift | 12 ++++++-- .../Views/Misc/ButtonView.swift | 14 +++++++-- .../InAppMessageUI/Views/Misc/IconView.swift | 13 ++++++-- 20 files changed, 175 insertions(+), 60 deletions(-) diff --git a/BrazeKit.podspec b/BrazeKit.podspec index 7dd623ac92..16a270e7af 100644 --- a/BrazeKit.podspec +++ b/BrazeKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeKit' - s.version = '7.3.0' + s.version = '7.4.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/7.3.0/BrazeKit.zip', - :sha256 => 'c98be52a7bfbb7ff4b122f532abd06676fe93b1935f91f9ca1e462765cc5cedf' + :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/7.4.0/BrazeKit.zip', + :sha256 => 'e820bcb3f8fc85402f51b705ae1494c1d73d341fc16213ddc19039ff0996dd40' } s.swift_version = '5.0' diff --git a/BrazeKitCompat.podspec b/BrazeKitCompat.podspec index 119a1b3b99..f4be953c8c 100644 --- a/BrazeKitCompat.podspec +++ b/BrazeKitCompat.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeKitCompat' - s.version = '7.3.0' + s.version = '7.4.0' s.summary = 'Compatibility library for users migrating from AppboyKit.' s.homepage = 'https://braze.com' @@ -8,18 +8,18 @@ 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 => '7.3.0' } + s.source = { :git => 'https://github.com/braze-inc/braze-swift-sdk.git', :tag => '7.4.0' } s.swift_version = '5.0' s.ios.deployment_target = '11.0' s.tvos.deployment_target = '11.0' - s.static_framework = true s.source_files = 'Sources/BrazeKitCompat/**/*.{h,m}' s.public_header_files = 'Sources/BrazeKitCompat/include/*.h' + s.static_framework = true - s.dependency 'BrazeKit', '7.3.0' - s.dependency 'BrazeLocation', '7.3.0' + s.dependency 'BrazeKit', '7.4.0' + s.dependency 'BrazeLocation', '7.4.0' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } end diff --git a/BrazeLocation.podspec b/BrazeLocation.podspec index 671dc95d1f..a32a541691 100644 --- a/BrazeLocation.podspec +++ b/BrazeLocation.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeLocation' - s.version = '7.3.0' + s.version = '7.4.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/7.3.0/BrazeLocation.zip', - :sha256 => '7ab0ecdcb7fededd45ea4ebdedc6edfece3e8e097f105ee7d5da6fc7e258bc6b' + :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/7.4.0/BrazeLocation.zip', + :sha256 => '233bf832190655a4e7e5ff19f7eddc98e872702ba20f7271eead268eef641425' } s.swift_version = '5.0' @@ -21,7 +21,7 @@ Pod::Spec.new do |s| # Depends on BrazeKit because BrazeKit includes the internal _BrazeLocationClient symbols required # for linking against BrazeLocation. - s.dependency 'BrazeKit', '7.3.0' + s.dependency 'BrazeKit', '7.4.0' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } end diff --git a/BrazeNotificationService.podspec b/BrazeNotificationService.podspec index 4c393548a6..6e65607dc7 100644 --- a/BrazeNotificationService.podspec +++ b/BrazeNotificationService.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeNotificationService' - s.version = '7.3.0' + s.version = '7.4.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/7.3.0/BrazeNotificationService.zip', - :sha256 => '80f1fe0afab3ebcebabe62c05db4fd444fc7a8c82f9b309e9217d02ab4aced98' + :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/7.4.0/BrazeNotificationService.zip', + :sha256 => '5b9c974c5ed0b48ab1ba59f49dbf98f1c8e3e49959e844a46e0591365cf275d0' } s.swift_version = '5.0' diff --git a/BrazePushStory.podspec b/BrazePushStory.podspec index 56e2f0e673..c549921cde 100644 --- a/BrazePushStory.podspec +++ b/BrazePushStory.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazePushStory' - s.version = '7.3.0' + s.version = '7.4.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/7.3.0/BrazePushStory.zip', - :sha256 => '0c37ca728ba0a5798efd412f254c26827f63f21044642993a004d80c9866d510' + :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/7.4.0/BrazePushStory.zip', + :sha256 => '3b1b1bf392284755f8b9b00857d9d70cf3c39912b72921617f6f8db910b113e7' } s.swift_version = '5.0' diff --git a/BrazeUI.podspec b/BrazeUI.podspec index 5ae692c1b5..96b2be9a46 100644 --- a/BrazeUI.podspec +++ b/BrazeUI.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeUI' - s.version = '7.3.0' + s.version = '7.4.0' s.summary = 'Braze-provided user interface library for In-App Messages and Content Cards.' s.homepage = 'https://braze.com' @@ -8,16 +8,16 @@ 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 => '7.3.0' } + s.source = { :git => 'https://github.com/braze-inc/braze-swift-sdk.git', :tag => '7.4.0' } s.swift_version = '5.0' s.ios.deployment_target = '11.0' - s.static_framework = true s.source_files = 'Sources/BrazeUI/**/*.swift' s.resource_bundles = { 'BrazeUI' => ['Sources/BrazeUI/Resources/**/*'] } + s.static_framework = true - s.dependency 'BrazeKit', '7.3.0' + s.dependency 'BrazeKit', '7.4.0' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } end diff --git a/BrazeUICompat.podspec b/BrazeUICompat.podspec index c89693bb87..d350d30aa3 100644 --- a/BrazeUICompat.podspec +++ b/BrazeUICompat.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeUICompat' - s.version = '7.3.0' + s.version = '7.4.0' s.summary = 'Compatibility UI library for users migrating from AppboyUI.' s.homepage = 'https://braze.com' @@ -8,17 +8,17 @@ 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 => '7.3.0' } + s.source = { :git => 'https://github.com/braze-inc/braze-swift-sdk.git', :tag => '7.4.0' } s.swift_version = '5.0' s.ios.deployment_target = '11.0' - s.static_framework = true s.source_files = 'Sources/BrazeUICompat/ABK*/**/*.{h,m}' s.public_header_files = 'Sources/BrazeUICompat/ABK*/**/*.h' s.resource_bundles = { 'BrazeUICompat' => 'Sources/BrazeUICompat/*/Resources/**/*.*' } + s.static_framework = true - s.dependency 'BrazeKitCompat', '7.3.0' + s.dependency 'BrazeKitCompat', '7.4.0' s.dependency 'SDWebImage', '>= 5.8.2', '< 6' s.user_target_xcconfig = { 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES' } diff --git a/CHANGELOG.md b/CHANGELOG.md index 02d7d3b094..1848ae5bca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,33 @@ +## 7.4.0 + +##### Added +- Adds two alternative repositories to support specialized integration options. For instructions on how to leverage them, refer to their respective READMEs: + - [braze-inc/braze-swift-sdk-prebuilt-static](https://github.com/braze-inc/braze-swift-sdk-prebuilt-static) which provides all Braze modules as static XCFrameworks. + - [braze-inc/braze-swift-sdk-prebuilt-dynamic](https://github.com/braze-inc/braze-swift-sdk-prebuilt-dynamic) which provides all Braze modules as dynamic XCFrameworks. +- In-App Message assets from URLs containing the query parameter `cache=false` will not be prefetched. + - Additionally, when presented as a part of In-App Messages or Content Cards, those URLs will be fetched using the [`URLRequest.CachePolicy.reloadIgnoringLocalAndRemoteCacheData`](https://developer.apple.com/documentation/foundation/nsurlrequest/cachepolicy/reloadignoringlocalandremotecachedata) caching policy, which always requests a fresh version from the source and ignores any cached versions. + +##### Fixed +- Fixes XCFrameworks headers to use the `#import` syntax instead of `@import` for compatibility with Objective-C++ contexts. +- Fixes the push token tag validation during Live Activity registration, accepting strings up to 256 bytes instead of 255 bytes. +- `Braze.ContentCards.unviewedCards` no longer includes Control cards to bring parity with Android and Web. +- Fixes an Objective-C metaclass crash that occurs when initializing a custom subclass of certain BrazeUI views. + ## 7.3.0 -#### Added +##### Added - Adds support for Expo Notifications [event listeners](https://docs.expo.dev/versions/latest/sdk/notifications/#notification-events-listeners) when using the automatic push integration. -#### Fixed +##### Fixed - Fixes a rare concurrency issue that might result in duplicated events when logging large amount of events. - Fixes an issue where `user.set(dateOfBirth:)` was not setting the date of birth accurately due to variations in the device's timezone. ## 7.2.0 -#### Added +##### Added - Exposes the `BrazePushStory.NotificationViewController.didReceive` methods for custom handling of push story notification events. -#### Fixed +##### Fixed - Resolves an issue for in-app messages with buttons where tapping on the body would incorrectly execute the button's click action. - Now, when you tap on the body of an in-app message with buttons, no event should occur. - Resolves a potential deadlock under rare circumstances in BrazeUI's In-App messages presentation. @@ -21,7 +36,7 @@ - Resolves an issue where `BrazeInAppMessageUI` could fail to detect the correct application window for presenting its post-click webview. - `BrazeInAppMessageUI` now prefers using the current key `UIWindow` instead of the first one in the application's window stack. -#### Removed +##### Removed - `Braze.Configuration.DeviceProperty.pushDisplayOptions` has been deprecated. Providing this value no longer has an effect. ## 7.1.0 diff --git a/Examples/ObjC/manual-integration-setup.sh b/Examples/ObjC/manual-integration-setup.sh index e5424068d6..399880dee4 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/7.3.0/braze-swift-sdk-prebuilt.zip" +url="https://github.com/braze-inc/braze-swift-sdk/releases/download/7.4.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 e5424068d6..399880dee4 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/7.3.0/braze-swift-sdk-prebuilt.zip" +url="https://github.com/braze-inc/braze-swift-sdk/releases/download/7.4.0/braze-swift-sdk-prebuilt.zip" echo "→" "Cleaning up" rm -rf braze-swift-sdk-prebuilt diff --git a/Package.swift b/Package.swift index f9bf0c913f..2aa7106e9c 100644 --- a/Package.swift +++ b/Package.swift @@ -47,8 +47,8 @@ let package = Package( targets: [ .binaryTarget( name: "BrazeKit", - url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/7.3.0/BrazeKit.zip", - checksum: "c98be52a7bfbb7ff4b122f532abd06676fe93b1935f91f9ca1e462765cc5cedf" + url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/7.4.0/BrazeKit.zip", + checksum: "e820bcb3f8fc85402f51b705ae1494c1d73d341fc16213ddc19039ff0996dd40" ), .target( name: "BrazeKitResources", @@ -65,18 +65,18 @@ let package = Package( ), .binaryTarget( name: "BrazeLocation", - url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/7.3.0/BrazeLocation.zip", - checksum: "7ab0ecdcb7fededd45ea4ebdedc6edfece3e8e097f105ee7d5da6fc7e258bc6b" + url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/7.4.0/BrazeLocation.zip", + checksum: "233bf832190655a4e7e5ff19f7eddc98e872702ba20f7271eead268eef641425" ), .binaryTarget( name: "BrazeNotificationService", - url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/7.3.0/BrazeNotificationService.zip", - checksum: "80f1fe0afab3ebcebabe62c05db4fd444fc7a8c82f9b309e9217d02ab4aced98" + url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/7.4.0/BrazeNotificationService.zip", + checksum: "5b9c974c5ed0b48ab1ba59f49dbf98f1c8e3e49959e844a46e0591365cf275d0" ), .binaryTarget( name: "BrazePushStory", - url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/7.3.0/BrazePushStory.zip", - checksum: "0c37ca728ba0a5798efd412f254c26827f63f21044642993a004d80c9866d510" + url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/7.4.0/BrazePushStory.zip", + checksum: "3b1b1bf392284755f8b9b00857d9d70cf3c39912b72921617f6f8db910b113e7" ), .target( name: "BrazeKitCompat", diff --git a/README.md b/README.md index 32eb27e253..fae9aa1e88 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

- Version: 7.3.0 + Version: 7.4.0 { + var wrappedValue: WrappedType + + /// Initializes the wrapper with the wrapped struct. + /// + /// - Parameter wrappedValue: The wrapped struct type. + init(wrappedValue: WrappedType) { + self.wrappedValue = wrappedValue + } + } + +} diff --git a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIControlView.swift b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIControlView.swift index c900133e9a..ef07e2966e 100644 --- a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIControlView.swift +++ b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIControlView.swift @@ -9,12 +9,20 @@ extension BrazeInAppMessageUI { open class ControlView: UIView, InAppMessageView { /// The control in-app message. - public var message: Braze.InAppMessage.Control + public var message: Braze.InAppMessage.Control { + get { messageWrapper.wrappedValue } + set { + messageWrapper.wrappedValue = newValue + } + } + + /// Internal wrapper for the control in-app message. + let messageWrapper: MessageWrapper /// Creates and returns a control in-app message view. /// - Parameter message: The message. public init(message: Braze.InAppMessage.Control) { - self.message = message + self.messageWrapper = .init(wrappedValue: message) super.init(frame: .zero) } diff --git a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIHtmlView.swift b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIHtmlView.swift index 430efce44d..c730ba4a99 100644 --- a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIHtmlView.swift +++ b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIHtmlView.swift @@ -10,7 +10,15 @@ extension BrazeInAppMessageUI { open class HtmlView: UIView, InAppMessageView { /// The html in-app message. - public var message: Braze.InAppMessage.Html + public var message: Braze.InAppMessage.Html { + get { messageWrapper.wrappedValue } + set { + messageWrapper.wrappedValue = newValue + } + } + + /// Internal wrapper for the html in-app message. + let messageWrapper: MessageWrapper // MARK: - Attributes @@ -112,7 +120,17 @@ extension BrazeInAppMessageUI { public lazy var scriptMessageHandler: Braze.WebViewBridge.ScriptMessageHandler = webViewScriptMessageHandler() public lazy var schemeHandler: Braze.WebViewBridge.SchemeHandler = webViewSchemeHandler() - public lazy var queryHandler: Braze.WebViewBridge.QueryHandler = webViewQueryHandler() + public var queryHandler: Braze.WebViewBridge.QueryHandler { + get { + queryHandlerWrapper.wrappedValue + } + set { + queryHandlerWrapper.wrappedValue = newValue + } + } + + lazy var queryHandlerWrapper: MessageWrapper = .init( + wrappedValue: webViewQueryHandler()) // MARK: - LifeCycle @@ -121,7 +139,7 @@ extension BrazeInAppMessageUI { attributes: Attributes = .defaults, presented: Bool = false ) { - self.message = message + self.messageWrapper = .init(wrappedValue: message) self.attributes = attributes self.presented = presented super.init(frame: .zero) @@ -286,7 +304,7 @@ extension BrazeInAppMessageUI { open func loadMessage() { guard let baseURL = message.baseURL else { logError(.htmlNoBaseURL) - message.animateOut = false + messageWrapper.wrappedValue.animateOut = false dismiss() return } @@ -300,7 +318,7 @@ extension BrazeInAppMessageUI { // Write index.html let index = baseURL.appendingPathComponent("index.html") - try? message.message.write(to: index, atomically: true, encoding: .utf8) + try? messageWrapper.wrappedValue.message.write(to: index, atomically: true, encoding: .utf8) // Load webView?.loadFileURL(index, allowingReadAccessTo: baseURL) @@ -400,7 +418,7 @@ extension BrazeInAppMessageUI.HtmlView: WKNavigationDelegate { withError error: Error ) { logError(.webViewNavigation(.init(error))) - message.animateOut = false + messageWrapper.wrappedValue.animateOut = false dismiss() } diff --git a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIModalImageView.swift b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIModalImageView.swift index 965048c301..8827d8a4c0 100644 --- a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIModalImageView.swift +++ b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIModalImageView.swift @@ -9,7 +9,15 @@ extension BrazeInAppMessageUI { open class ModalImageView: UIView, InAppMessageView { /// The modal image in-app message. - public var message: Braze.InAppMessage.ModalImage + public var message: Braze.InAppMessage.ModalImage { + get { messageWrapper.wrappedValue } + set { + messageWrapper.wrappedValue = newValue + } + } + + /// Internal wrapper for the modal image in-app message. + let messageWrapper: MessageWrapper // MARK: - Attributes @@ -208,7 +216,7 @@ extension BrazeInAppMessageUI { gifViewProvider: GIFViewProvider = .shared, presented: Bool = false ) { - self.message = message + self.messageWrapper = .init(wrappedValue: message) self.attributes = attributes self.gifViewProvider = gifViewProvider self.presented = presented diff --git a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIModalView.swift b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIModalView.swift index 80bd44d8ce..dd0de594ae 100644 --- a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIModalView.swift +++ b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIModalView.swift @@ -20,7 +20,15 @@ extension BrazeInAppMessageUI { open class ModalView: UIView, InAppMessageView { /// The modal in-app message. - public var message: Braze.InAppMessage.Modal + public var message: Braze.InAppMessage.Modal { + get { messageWrapper.wrappedValue } + set { + messageWrapper.wrappedValue = newValue + } + } + + /// Internal wrapper for the modal in-app message. + let messageWrapper: MessageWrapper // MARK: - Attributes @@ -272,7 +280,7 @@ extension BrazeInAppMessageUI { gifViewProvider: GIFViewProvider = .shared, presented: Bool = false ) { - self.message = message + self.messageWrapper = .init(wrappedValue: message) self.attributes = attributes self.gifViewProvider = gifViewProvider self.presented = presented diff --git a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUISlideupView.swift b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUISlideupView.swift index 4b5553cc2c..eb97121e87 100644 --- a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUISlideupView.swift +++ b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUISlideupView.swift @@ -9,7 +9,15 @@ extension BrazeInAppMessageUI { open class SlideupView: UIView, InAppMessageView { /// The slideup in-app message. - public let message: Braze.InAppMessage.Slideup + public var message: Braze.InAppMessage.Slideup { + get { messageWrapper.wrappedValue } + set { + messageWrapper.wrappedValue = newValue + } + } + + /// Internal wrapper for the slideup in-app message. + let messageWrapper: MessageWrapper // MARK: - Attributes @@ -257,7 +265,7 @@ extension BrazeInAppMessageUI { gifViewProvider: GIFViewProvider = .shared, presented: Bool = false ) { - self.message = message + self.messageWrapper = .init(wrappedValue: message) self.attributes = attributes self.gifViewProvider = gifViewProvider self.presented = presented diff --git a/Sources/BrazeUI/InAppMessageUI/Views/Misc/ButtonView.swift b/Sources/BrazeUI/InAppMessageUI/Views/Misc/ButtonView.swift index d79f295ced..503b10beab 100644 --- a/Sources/BrazeUI/InAppMessageUI/Views/Misc/ButtonView.swift +++ b/Sources/BrazeUI/InAppMessageUI/Views/Misc/ButtonView.swift @@ -7,7 +7,17 @@ extension BrazeInAppMessageUI { open class ButtonView: UIButton { /// The button definition. - public var button: Braze.InAppMessage.Button + public var button: Braze.InAppMessage.Button { + get { + buttonWrapper.wrappedValue + } + set { + buttonWrapper.wrappedValue = newValue + } + } + + /// Internal wrapper for the in-app message button. + let buttonWrapper: MessageWrapper /// Creates and returns a Braze in-app message compatible button. /// - Parameters: @@ -17,7 +27,7 @@ extension BrazeInAppMessageUI { button: Braze.InAppMessage.Button, attributes: Attributes = .defaults ) { - self.button = button + self.buttonWrapper = .init(wrappedValue: button) self.attributes = attributes super.init(frame: .zero) diff --git a/Sources/BrazeUI/InAppMessageUI/Views/Misc/IconView.swift b/Sources/BrazeUI/InAppMessageUI/Views/Misc/IconView.swift index 3c5f0f72bc..99210ba53b 100644 --- a/Sources/BrazeUI/InAppMessageUI/Views/Misc/IconView.swift +++ b/Sources/BrazeUI/InAppMessageUI/Views/Misc/IconView.swift @@ -35,7 +35,7 @@ extension BrazeInAppMessageUI { ) { self.symbol = symbol self.attributes = attributes - self.theme = theme + self.themeWrapper = .init(wrappedValue: theme) super.init(frame: .zero) addSubview(label) @@ -110,9 +110,18 @@ extension BrazeInAppMessageUI { /// The current theme. public var theme: Braze.InAppMessage.Theme { - didSet { applyTheme() } + get { + themeWrapper.wrappedValue + } + set { + themeWrapper.wrappedValue = newValue + applyTheme() + } } + /// Internal wrapper for the in-app message theme. + let themeWrapper: MessageWrapper + /// Apply the current ``theme`` to the view. /// /// This is called automatically whenever ``theme`` is updated.