diff --git a/.github/assets/logo-dark.png b/.github/assets/logo-dark.png index b1aa7416a2..2c01e0b933 100644 Binary files a/.github/assets/logo-dark.png and b/.github/assets/logo-dark.png differ diff --git a/.github/assets/logo-light.png b/.github/assets/logo-light.png index 14b1b02e8d..dabfeecfcd 100644 Binary files a/.github/assets/logo-light.png and b/.github/assets/logo-light.png differ diff --git a/BrazeKit.podspec b/BrazeKit.podspec index 003e525a9b..a52aca0b9d 100644 --- a/BrazeKit.podspec +++ b/BrazeKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeKit' - s.version = '8.0.1' + s.version = '8.1.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/8.0.1/BrazeKit.zip', - :sha256 => '8ba73f7f193f4ea52d8673535b12c224cfb16bfcc1683e52a0c267addce2beb7' + :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/8.1.0/BrazeKit.zip', + :sha256 => 'd33cb483bb4ed954baaf61621efcb3aab48e41af21d11a4c04ac41575c22c567' } s.swift_version = '5.0' diff --git a/BrazeKitCompat.podspec b/BrazeKitCompat.podspec index bb875d9ca4..706c97a3bb 100644 --- a/BrazeKitCompat.podspec +++ b/BrazeKitCompat.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeKitCompat' - s.version = '8.0.1' + s.version = '8.1.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 => '8.0.1' } + s.source = { :git => 'https://github.com/braze-inc/braze-swift-sdk.git', :tag => '8.1.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', '8.0.1' - s.dependency 'BrazeLocation', '8.0.1' + s.dependency 'BrazeKit', '8.1.0' + s.dependency 'BrazeLocation', '8.1.0' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } end diff --git a/BrazeLocation.podspec b/BrazeLocation.podspec index 47cfa2d9cd..ccae4bbb69 100644 --- a/BrazeLocation.podspec +++ b/BrazeLocation.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeLocation' - s.version = '8.0.1' + s.version = '8.1.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/8.0.1/BrazeLocation.zip', - :sha256 => '22753521e3cebbd1ec0b0986339b10b03f00a3258ecf4c209066de575b98d630' + :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/8.1.0/BrazeLocation.zip', + :sha256 => '63b18e6ff1c579b0d8687181c6b6b82f2861cd4824a7f1d7df8e632a1e0fbb42' } 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', '8.0.1' + s.dependency 'BrazeKit', '8.1.0' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } end diff --git a/BrazeNotificationService.podspec b/BrazeNotificationService.podspec index b3e258bffe..a70e714c34 100644 --- a/BrazeNotificationService.podspec +++ b/BrazeNotificationService.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeNotificationService' - s.version = '8.0.1' + s.version = '8.1.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/8.0.1/BrazeNotificationService.zip', - :sha256 => '5c17a259982cea0aaa06ee59ef64f52f0fb0325bdd973d7ccfe954babd9179e2' + :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/8.1.0/BrazeNotificationService.zip', + :sha256 => 'fac7499f1baa938e4ea19fe18f5b13d3ab92369294bdf96c4738115bbcc09341' } s.swift_version = '5.0' diff --git a/BrazePushStory.podspec b/BrazePushStory.podspec index 20ddc96439..7b7611a0ee 100644 --- a/BrazePushStory.podspec +++ b/BrazePushStory.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazePushStory' - s.version = '8.0.1' + s.version = '8.1.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/8.0.1/BrazePushStory.zip', - :sha256 => 'ce056068074e29b218eda70c1dbf60d942905e48183384c530b408b9dbe2aee2' + :http => 'https://github.com/braze-inc/braze-swift-sdk/releases/download/8.1.0/BrazePushStory.zip', + :sha256 => '19332ac17475d6cd7394f48e3f8c6a4d3ad111c0f49c333e704dc22ab1b4f8d3' } s.swift_version = '5.0' diff --git a/BrazeUI.podspec b/BrazeUI.podspec index e405dab1c5..e6e912322f 100644 --- a/BrazeUI.podspec +++ b/BrazeUI.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeUI' - s.version = '8.0.1' + s.version = '8.1.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 => '8.0.1' } + s.source = { :git => 'https://github.com/braze-inc/braze-swift-sdk.git', :tag => '8.1.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', '8.0.1' + s.dependency 'BrazeKit', '8.1.0' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } end diff --git a/BrazeUICompat.podspec b/BrazeUICompat.podspec index 9a481ceadd..da52de556b 100644 --- a/BrazeUICompat.podspec +++ b/BrazeUICompat.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'BrazeUICompat' - s.version = '8.0.1' + s.version = '8.1.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 => '8.0.1' } + s.source = { :git => 'https://github.com/braze-inc/braze-swift-sdk.git', :tag => '8.1.0' } s.swift_version = '5.0' s.ios.deployment_target = '12.0' @@ -18,8 +18,8 @@ Pod::Spec.new do |s| s.resource_bundles = { 'BrazeUICompat' => 'Sources/BrazeUICompat/*/Resources/**/*.*' } s.static_framework = true - s.dependency 'BrazeKitCompat', '8.0.1' - s.dependency 'SDWebImage', '>= 5.18.7', '< 6' + s.dependency 'BrazeKitCompat', '8.1.0' + s.dependency 'SDWebImage', '>= 5.19.0', '< 6' s.user_target_xcconfig = { 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES' } s.pod_target_xcconfig = { diff --git a/CHANGELOG.md b/CHANGELOG.md index 80ee945e00..5401987222 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ +## 8.1.0 + +##### Added +- Adds the `is_test_send` boolean value in the in-app message JSON representation. +- Adds the [`Braze.subscribeToSessionUpdates(_:)`](https://braze-inc.github.io/braze-swift-sdk/documentation/brazekit/braze/subscribetosessionupdates(_:)) method and [`Braze.sessionUpdatesStream`](https://braze-inc.github.io/braze-swift-sdk/documentation/brazekit/braze/sessionupdatesstream) property to subscribe to the session updates events generated by the SDK. +- Adds public APIs to access `BrazeKit`, `BrazeLocation` and `BrazeUI` resources bundles: + - `Braze.Resources.bundle` + - `BrazeLocationResources.bundle` + - `BrazeUIResources.bundle` +- `BrazeKit.overrideResourceBundle` and `BrazeUI.overrideResourceBundle` have been deprecated in favor of `BrazeKit.overrideResourcesBundle` and `BrazeUI.overrideResourcesBundle`. +- Re-enables visionOS sample apps requiring SDWebImage in `Examples-CocoaPods.xcworkspace`. SDWebImage for visionOS is now supported when using CocoaPods. +- Updated SDWebImage dependency in `BrazeUICompat` to `5.19.0+`. + +##### Fixed +- Fixes multiple issues on visionOS: + - Sessions now properly start as expected. + - The click behavior _Open Web URL Inside App_ now properly opens the URL in a modal web view. Previously, the URL would always be opened using the default web browser. + - [Braze.Notifications.Payload.targetScene](https://braze-inc.github.io/braze-swift-sdk/documentation/brazekit/braze/notifications-swift.class/payload/targetscene) is now defined. + - [Braze.URLContext.targetScene](https://braze-inc.github.io/braze-swift-sdk/documentation/brazekit/braze/urlcontext/targetscene) is now properly set by the SDK for in-app messages click actions. + - [Braze.WebViewBridge.ScriptMessageHandler.init(logClick:logError:showNewsFeed:closeMessage:braze:)](https://braze-inc.github.io/braze-swift-sdk/documentation/brazekit/braze/webviewbridge/scriptmessagehandler/init(logclick:logerror:shownewsfeed:closemessage:braze:)-p2ki) is now defined. + - [BrazeDelegate.braze(_:willPresentModalWithContext:)](https://braze-inc.github.io/braze-swift-sdk/documentation/brazekit/brazedelegate/braze(_:willpresentmodalwithcontext:)-1fj41) now have a default implementation. + - Handling network requests and persisting data properly extend the lifetime of the application for processing. + ## 8.0.1 ##### Fixed diff --git a/Examples/ObjC/Examples-SwiftPM.xcodeproj/project.pbxproj b/Examples/ObjC/Examples-SwiftPM.xcodeproj/project.pbxproj index 3e0bfabaf3..65420c051a 100644 --- a/Examples/ObjC/Examples-SwiftPM.xcodeproj/project.pbxproj +++ b/Examples/ObjC/Examples-SwiftPM.xcodeproj/project.pbxproj @@ -1880,7 +1880,7 @@ repositoryURL = "https://github.com/SDWebImage/SDWebImage"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 5.18.7; + minimumVersion = 5.19.0; }; }; /* End XCRemoteSwiftPackageReference section */ diff --git a/Examples/ObjC/Podfile b/Examples/ObjC/Podfile index f58cd950b7..cd9f88bb0e 100644 --- a/Examples/ObjC/Podfile +++ b/Examples/ObjC/Podfile @@ -26,15 +26,14 @@ target 'InAppMessageUI-iOS' do pod 'SDWebImage', :modular_headers => true end -# Disabled until SDWebImage supports visionOS via CocoaPods -# target 'InAppMessageUI-visionOS' do -# platform :visionos, '1.0' -# pod 'BrazeKit' -# pod 'BrazeUI' -# # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. -# # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations -# pod 'SDWebImage', :modular_headers => true -# end +target 'InAppMessageUI-visionOS' do + platform :visionos, '1.0' + pod 'BrazeKit' + pod 'BrazeUI' + # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. + # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations + pod 'SDWebImage', :modular_headers => true +end target 'InAppMessageUI-Customization-iOS' do platform :ios, '11.0' @@ -45,15 +44,14 @@ target 'InAppMessageUI-Customization-iOS' do pod 'SDWebImage', :modular_headers => true end -# Disabled until SDWebImage supports visionOS via CocoaPods -# target 'InAppMessageUI-Customization-visionOS' do -# platform :visionos, '1.0' -# pod 'BrazeKit' -# pod 'BrazeUI' -# # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. -# # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations -# pod 'SDWebImage', :modular_headers => true -# end +target 'InAppMessageUI-Customization-visionOS' do + platform :visionos, '1.0' + pod 'BrazeKit' + pod 'BrazeUI' + # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. + # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations + pod 'SDWebImage', :modular_headers => true +end target 'InAppMessages-Custom-UI-iOS' do platform :ios, '11.0' @@ -79,15 +77,14 @@ target 'ContentCardUI-iOS' do pod 'SDWebImage', :modular_headers => true end -# Disabled until SDWebImage supports visionOS via CocoaPods -# target 'ContentCardUI-visionOS' do -# platform :visionos, '1.0' -# pod 'BrazeKit' -# pod 'BrazeUI' -# # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. -# # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations -# pod 'SDWebImage', :modular_headers => true -# end +target 'ContentCardUI-visionOS' do + platform :visionos, '1.0' + pod 'BrazeKit' + pod 'BrazeUI' + # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. + # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations + pod 'SDWebImage', :modular_headers => true +end target 'ContentCardUI-Customization-iOS' do platform :ios, '11.0' @@ -98,15 +95,14 @@ target 'ContentCardUI-Customization-iOS' do pod 'SDWebImage', :modular_headers => true end -# Disabled until SDWebImage supports visionOS via CocoaPods -# target 'ContentCardUI-Customization-visionOS' do -# platform :visionos, '1.0' -# pod 'BrazeKit' -# pod 'BrazeUI' -# # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. -# # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations -# pod 'SDWebImage', :modular_headers => true -# end +target 'ContentCardUI-Customization-visionOS' do + platform :visionos, '1.0' + pod 'BrazeKit' + pod 'BrazeUI' + # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. + # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations + pod 'SDWebImage', :modular_headers => true +end target 'ContentCards-Custom-UI-iOS' do platform :ios, '11.0' diff --git a/Examples/ObjC/manual-integration-setup.sh b/Examples/ObjC/manual-integration-setup.sh index 65ff7ca775..f433253238 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/8.0.1/braze-swift-sdk-prebuilt.zip" +url="https://github.com/braze-inc/braze-swift-sdk/releases/download/8.1.0/braze-swift-sdk-prebuilt.zip" echo "→" "Cleaning up" rm -rf braze-swift-sdk-prebuilt diff --git a/Examples/Swift/Examples-SwiftPM.xcodeproj/project.pbxproj b/Examples/Swift/Examples-SwiftPM.xcodeproj/project.pbxproj index cfb197ec93..83d4232e80 100644 --- a/Examples/Swift/Examples-SwiftPM.xcodeproj/project.pbxproj +++ b/Examples/Swift/Examples-SwiftPM.xcodeproj/project.pbxproj @@ -1872,7 +1872,7 @@ repositoryURL = "https://github.com/SDWebImage/SDWebImage"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 5.18.7; + minimumVersion = 5.19.0; }; }; /* End XCRemoteSwiftPackageReference section */ diff --git a/Examples/Swift/Podfile b/Examples/Swift/Podfile index f58cd950b7..cd9f88bb0e 100644 --- a/Examples/Swift/Podfile +++ b/Examples/Swift/Podfile @@ -26,15 +26,14 @@ target 'InAppMessageUI-iOS' do pod 'SDWebImage', :modular_headers => true end -# Disabled until SDWebImage supports visionOS via CocoaPods -# target 'InAppMessageUI-visionOS' do -# platform :visionos, '1.0' -# pod 'BrazeKit' -# pod 'BrazeUI' -# # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. -# # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations -# pod 'SDWebImage', :modular_headers => true -# end +target 'InAppMessageUI-visionOS' do + platform :visionos, '1.0' + pod 'BrazeKit' + pod 'BrazeUI' + # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. + # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations + pod 'SDWebImage', :modular_headers => true +end target 'InAppMessageUI-Customization-iOS' do platform :ios, '11.0' @@ -45,15 +44,14 @@ target 'InAppMessageUI-Customization-iOS' do pod 'SDWebImage', :modular_headers => true end -# Disabled until SDWebImage supports visionOS via CocoaPods -# target 'InAppMessageUI-Customization-visionOS' do -# platform :visionos, '1.0' -# pod 'BrazeKit' -# pod 'BrazeUI' -# # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. -# # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations -# pod 'SDWebImage', :modular_headers => true -# end +target 'InAppMessageUI-Customization-visionOS' do + platform :visionos, '1.0' + pod 'BrazeKit' + pod 'BrazeUI' + # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. + # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations + pod 'SDWebImage', :modular_headers => true +end target 'InAppMessages-Custom-UI-iOS' do platform :ios, '11.0' @@ -79,15 +77,14 @@ target 'ContentCardUI-iOS' do pod 'SDWebImage', :modular_headers => true end -# Disabled until SDWebImage supports visionOS via CocoaPods -# target 'ContentCardUI-visionOS' do -# platform :visionos, '1.0' -# pod 'BrazeKit' -# pod 'BrazeUI' -# # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. -# # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations -# pod 'SDWebImage', :modular_headers => true -# end +target 'ContentCardUI-visionOS' do + platform :visionos, '1.0' + pod 'BrazeKit' + pod 'BrazeUI' + # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. + # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations + pod 'SDWebImage', :modular_headers => true +end target 'ContentCardUI-Customization-iOS' do platform :ios, '11.0' @@ -98,15 +95,14 @@ target 'ContentCardUI-Customization-iOS' do pod 'SDWebImage', :modular_headers => true end -# Disabled until SDWebImage supports visionOS via CocoaPods -# target 'ContentCardUI-Customization-visionOS' do -# platform :visionos, '1.0' -# pod 'BrazeKit' -# pod 'BrazeUI' -# # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. -# # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations -# pod 'SDWebImage', :modular_headers => true -# end +target 'ContentCardUI-Customization-visionOS' do + platform :visionos, '1.0' + pod 'BrazeKit' + pod 'BrazeUI' + # SDWebImage is optional. BrazeUI requires a third party library to display GIF images. + # See https://braze-inc.github.io/braze-swift-sdk/documentation/braze/gif-support-integrations + pod 'SDWebImage', :modular_headers => true +end target 'ContentCards-Custom-UI-iOS' do platform :ios, '11.0' diff --git a/Examples/Swift/Sources/InAppMessages-Custom-UI/Extensions.swift b/Examples/Swift/Sources/InAppMessages-Custom-UI/Extensions.swift index 2d9c717aa2..c6d65f6064 100644 --- a/Examples/Swift/Sources/InAppMessages-Custom-UI/Extensions.swift +++ b/Examples/Swift/Sources/InAppMessages-Custom-UI/Extensions.swift @@ -19,9 +19,7 @@ extension Encodable { func prettyPrint() -> String { let encoder = JSONEncoder() encoder.outputFormatting = .prettyPrinted - if #available(iOS 11.0, tvOS 11.0, *) { - encoder.outputFormatting.insert(.sortedKeys) - } + encoder.outputFormatting.insert(.sortedKeys) if #available(iOS 13.0, tvOS 13.0, *) { encoder.outputFormatting.insert(.withoutEscapingSlashes) } @@ -41,9 +39,7 @@ extension Dictionary where Key == String, Value == Any { func prettyPrint() -> String { var options: JSONSerialization.WritingOptions = .prettyPrinted - if #available(iOS 11.0, tvOS 11.0, *) { - options.insert(.sortedKeys) - } + options.insert(.sortedKeys) if #available(iOS 13.0, tvOS 13.0, *) { options.insert(.withoutEscapingSlashes) } diff --git a/Examples/Swift/manual-integration-setup.sh b/Examples/Swift/manual-integration-setup.sh index 65ff7ca775..f433253238 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/8.0.1/braze-swift-sdk-prebuilt.zip" +url="https://github.com/braze-inc/braze-swift-sdk/releases/download/8.1.0/braze-swift-sdk-prebuilt.zip" echo "→" "Cleaning up" rm -rf braze-swift-sdk-prebuilt diff --git a/LICENSE b/LICENSE index 466b967fcc..540aa60b25 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2022 Braze, Inc. +Copyright (c) 2024 Braze, Inc. All rights reserved. * Use of source code or binaries contained within Braze’s SDKs is permitted only to enable use of the Braze platform by customers of Braze. diff --git a/Package.swift b/Package.swift index f88efb3f2f..c459640cef 100644 --- a/Package.swift +++ b/Package.swift @@ -42,15 +42,15 @@ let package = Package( ), ], dependencies: [ - .package(url: "https://github.com/SDWebImage/SDWebImage.git", from: "5.18.7"), + .package(url: "https://github.com/SDWebImage/SDWebImage.git", from: "5.19.0"), /* ${dependencies-start} */ /* ${dependencies-end} */ ], targets: [ .binaryTarget( name: "BrazeKit", - url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/8.0.1/BrazeKit.zip", - checksum: "8ba73f7f193f4ea52d8673535b12c224cfb16bfcc1683e52a0c267addce2beb7" + url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/8.1.0/BrazeKit.zip", + checksum: "d33cb483bb4ed954baaf61621efcb3aab48e41af21d11a4c04ac41575c22c567" ), .target( name: "BrazeKitResources", @@ -67,8 +67,8 @@ let package = Package( ), .binaryTarget( name: "BrazeLocation", - url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/8.0.1/BrazeLocation.zip", - checksum: "22753521e3cebbd1ec0b0986339b10b03f00a3258ecf4c209066de575b98d630" + url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/8.1.0/BrazeLocation.zip", + checksum: "63b18e6ff1c579b0d8687181c6b6b82f2861cd4824a7f1d7df8e632a1e0fbb42" ), .target( name: "BrazeLocationResources", @@ -78,13 +78,13 @@ let package = Package( ), .binaryTarget( name: "BrazeNotificationService", - url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/8.0.1/BrazeNotificationService.zip", - checksum: "5c17a259982cea0aaa06ee59ef64f52f0fb0325bdd973d7ccfe954babd9179e2" + url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/8.1.0/BrazeNotificationService.zip", + checksum: "fac7499f1baa938e4ea19fe18f5b13d3ab92369294bdf96c4738115bbcc09341" ), .binaryTarget( name: "BrazePushStory", - url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/8.0.1/BrazePushStory.zip", - checksum: "ce056068074e29b218eda70c1dbf60d942905e48183384c530b408b9dbe2aee2" + url: "https://github.com/braze-inc/braze-swift-sdk/releases/download/8.1.0/BrazePushStory.zip", + checksum: "19332ac17475d6cd7394f48e3f8c6a4d3ad111c0f49c333e704dc22ab1b4f8d3" ), .target( name: "BrazeKitCompat", diff --git a/README.md b/README.md index 3e9ecac22a..93ba56fa45 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

- Version: 8.0.1 + Version: 8.1.0 String { return override } - return resourcesBundle?.localizedString(forKey: key, value: nil, table: localizationSet.rawValue) + return BrazeUIResources.bundle?.localizedString( + forKey: key, value: nil, table: localizationSet.rawValue) ?? key } diff --git a/Sources/BrazeUI/Deprecations.swift b/Sources/BrazeUI/Deprecations.swift index 94c098d757..c98f57b21a 100644 --- a/Sources/BrazeUI/Deprecations.swift +++ b/Sources/BrazeUI/Deprecations.swift @@ -1,3 +1,5 @@ +import Foundation + // MARK: - Pre feature-parity // MARK: 08/25/2022 @@ -18,3 +20,11 @@ extension GIFViewProvider { public static let `default`: GIFViewProvider = .nonAnimating } + +// MARK: 02/23/2024 + +/// See ``overrideResourcesBundle``. +public var overrideResourceBundle: Bundle? { + get { overrideResourcesBundle } + set { overrideResourcesBundle = newValue } +} diff --git a/Sources/BrazeUI/InAppMessageUI/InAppMessageExt.swift b/Sources/BrazeUI/InAppMessageUI/InAppMessageExt.swift index 77f1a42c66..2944f76365 100644 --- a/Sources/BrazeUI/InAppMessageUI/InAppMessageExt.swift +++ b/Sources/BrazeUI/InAppMessageUI/InAppMessageExt.swift @@ -10,10 +10,6 @@ extension BrazeInAppMessageThemeable { /// /// [Dark Mode]: https://apple.co/2WBiaQ7 public func theme(for traits: UITraitCollection) -> Braze.InAppMessage.Theme { - guard #available(iOS 12.0, *) else { - return themes.light - } - switch traits.userInterfaceStyle { case .light, .unspecified: return themes.light @@ -35,10 +31,6 @@ extension Braze.InAppMessage.Button { /// /// [Dark Mode]: https://apple.co/2WBiaQ7 public func theme(for traits: UITraitCollection) -> Braze.InAppMessage.ButtonTheme { - guard #available(iOS 12.0, *) else { - return themes.light - } - switch traits.userInterfaceStyle { case .light, .unspecified: return themes.light diff --git a/Sources/BrazeUI/InAppMessageUI/InAppMessageUIViewController.swift b/Sources/BrazeUI/InAppMessageUI/InAppMessageUIViewController.swift index 163566d1f6..b4c7fe1328 100644 --- a/Sources/BrazeUI/InAppMessageUI/InAppMessageUIViewController.swift +++ b/Sources/BrazeUI/InAppMessageUI/InAppMessageUIViewController.swift @@ -203,12 +203,10 @@ extension BrazeInAppMessageUI { #endif } - @available(iOS 11.0, *) open override var prefersHomeIndicatorAutoHidden: Bool { preferencesProxy?.prefersHomeIndicatorAutoHidden ?? false } - @available(iOS 11.0, *) open override var preferredScreenEdgesDeferringSystemGestures: UIRectEdge { preferencesProxy?.preferredScreenEdgesDeferringSystemGestures ?? [] } diff --git a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIHtmlView.swift b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIHtmlView.swift index a5956ed369..0050354819 100644 --- a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIHtmlView.swift +++ b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIHtmlView.swift @@ -309,12 +309,10 @@ extension BrazeInAppMessageUI { // Disable this optimization for mac catalyst (force webview in window bounds) #if !targetEnvironment(macCatalyst) - if #available(iOS 11.0, *) { - // Make web view ignore the safe area allowing proper handling in html / css. See the usage - // section at https://developer.mozilla.org/en-US/docs/Web/CSS/env() (archived version: - // https://archive.is/EBSJD) for instructions. - webView.scrollView.contentInsetAdjustmentBehavior = .never - } + // Make web view ignore the safe area allowing proper handling in html / css. See the usage + // section at https://developer.mozilla.org/en-US/docs/Web/CSS/env() (archived version: + // https://archive.is/EBSJD) for instructions. + webView.scrollView.contentInsetAdjustmentBehavior = .never #endif webView.alpha = attributes.animation.initialAlpha(legacy: message.legacy) addSubview(webView) @@ -532,15 +530,12 @@ extension BrazeInAppMessageUI.HtmlView { extension WKWebView { fileprivate func disableDragAndDrop() { - if #available(iOS 11.0, *) { - self - .bfsSubviews - .lazy - .first { $0.interactions.contains(where: { $0 is UIDragInteraction }) }? - .interactions - .filter { $0 is UIDragInteraction } - .forEach { $0.view?.removeInteraction($0) } - } + bfsSubviews + .lazy + .first { $0.interactions.contains(where: { $0 is UIDragInteraction }) }? + .interactions + .filter { $0 is UIDragInteraction } + .forEach { $0.view?.removeInteraction($0) } } fileprivate func disableSelection() { diff --git a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIModalImageView.swift b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIModalImageView.swift index fbc468f5f2..b375c8bed8 100644 --- a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIModalImageView.swift +++ b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUIModalImageView.swift @@ -153,12 +153,7 @@ extension BrazeInAppMessageUI { public lazy var imageContainerView: UIScrollView = { let view = UIScrollView() view.addSubview(imageView) - if #available(iOS 11, *) { - view.contentInsetAdjustmentBehavior = .never - } else { - // No need for iOS 10 support. - // No devices supporting iOS 10 has a need for safe-area handling. - } + view.contentInsetAdjustmentBehavior = .never return view }() diff --git a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUISlideupView.swift b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUISlideupView.swift index 4e8a1dc7b9..82d5ce02ff 100644 --- a/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUISlideupView.swift +++ b/Sources/BrazeUI/InAppMessageUI/Views/InAppMessageUISlideupView.swift @@ -234,7 +234,7 @@ extension BrazeInAppMessageUI { open lazy var chevronView: UIImageView = { let image = UIImage( named: "InAppMessage/chevron", - in: resourcesBundle, + in: BrazeUIResources.bundle, compatibleWith: traitCollection )? .withRenderingMode(.alwaysTemplate) diff --git a/Sources/BrazeUI/InAppMessageUI/Views/Misc/IconView.swift b/Sources/BrazeUI/InAppMessageUI/Views/Misc/IconView.swift index 99210ba53b..15b9ac64a8 100644 --- a/Sources/BrazeUI/InAppMessageUI/Views/Misc/IconView.swift +++ b/Sources/BrazeUI/InAppMessageUI/Views/Misc/IconView.swift @@ -141,7 +141,8 @@ extension BrazeInAppMessageUI { guard UIFont(name: "FontAwesome", size: 30) == nil else { return true } - guard let url = resourcesBundle?.url(forResource: "FontAwesome", withExtension: "otf"), + guard + let url = BrazeUIResources.bundle?.url(forResource: "FontAwesome", withExtension: "otf"), let data = try? Data(contentsOf: url), let dataProvider = CGDataProvider(data: data as CFData), let font = CGFont(dataProvider) diff --git a/Sources/BrazeUI/Resources.swift b/Sources/BrazeUI/Resources.swift index 57b8c72778..98b6b4c0c7 100644 --- a/Sources/BrazeUI/Resources.swift +++ b/Sources/BrazeUI/Resources.swift @@ -6,54 +6,75 @@ import Foundation /// automatically include the resources (e.g. Tuist setup) /// /// - Important: This property needs to be set before the SDK initialization. -public var overrideResourceBundle: Bundle? +public var overrideResourcesBundle: Bundle? private class BundleFinder {} -/// UI resources bundle. -var resourcesBundle: Bundle? = { - // Use overriden resource bundle - if let overrideResourceBundle = overrideResourceBundle { - return overrideResourceBundle - } - - let bundleNames = [ - // SwiftPM source target resources - "braze-swift-sdk_BrazeUI", - // SwiftPM binary target resources - "braze-swift-sdk_BrazeUIResources", - // Cocoapods or prebuilt resources - "BrazeUI", - ] - - let candidates = [ - // Bundle should be present here when the package is linked into an App. - Bundle.main.resourceURL, - // Bundle should be present here when the package is linked into a framework. - Bundle(for: BundleFinder.self).resourceURL, - // For command-line tools. - Bundle.main.bundleURL, - ] - - for bundleName in bundleNames { - for candidate in candidates { - let bundlePath = candidate?.appendingPathComponent(bundleName + ".bundle") - if let bundle = bundlePath.flatMap(Bundle.init(url:)) { - return bundle +/// Resources related utilities. +@objc(BRZUIResources) +public class BrazeUIResources: NSObject { + + /// The resources bundle. + @objc + public static let bundle: Bundle? = { + // Use overriden resources bundle + if let overrideResourcesBundle = overrideResourcesBundle { + return overrideResourcesBundle + } + + let bundleNames = [ + // SwiftPM source target resources + "braze-swift-sdk_BrazeUI", + // SwiftPM binary target resources + "braze-swift-sdk_BrazeUIResources", + // Cocoapods or prebuilt resources + "BrazeUI", + ] + + let candidates = [ + // Bundle should be present here when the package is linked into an App. + Bundle.main.resourceURL, + // Bundle should be present here when the package is linked into a framework. + Bundle(for: BundleFinder.self).resourceURL, + // For command-line tools. + Bundle.main.bundleURL, + ] + + for bundleName in bundleNames { + for candidate in candidates { + let bundlePath = candidate?.appendingPathComponent(bundleName + ".bundle") + if let bundle = bundlePath.flatMap(Bundle.init(url:)) { + return bundle + } } } - } - - // Returns the framework bundle if available - let frameworkBundle = Bundle(for: BundleFinder.self) - if let name = frameworkBundle.infoDictionary?["CFBundleName"] as? String, - name.hasPrefix("BrazeUI") - { - return frameworkBundle - } - - print( - "[braze] Error: Unable to find UI resources bundle, cannot load localizations and acknowledgments" - ) - return nil -}() + + // Returns the framework bundle if available + let frameworkBundle = Bundle(for: BundleFinder.self) + if let name = frameworkBundle.infoDictionary?["CFBundleName"] as? String, + name.hasPrefix("BrazeUI") + { + return frameworkBundle + } + + print( + "[braze] Error: Unable to find UI resources bundle, cannot load localizations and acknowledgments" + ) + return nil + }() + + /// Acknowledgments for third-party open-source libraries used by BrazeUI. + /// + /// The dictionary maps the library name to the path to the license on the file system. + @objc + public static let acknowledgments: [String: URL] = { + var acknowledgments: [String: URL] = [:] + + if let align = bundle?.url(forResource: "align", withExtension: "license") { + acknowledgments["align"] = align + } + + return acknowledgments + }() + +}