-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MT-1133] Update to braze-swift library (#15)
* Test new all_events command mapping * trying to replace braze objc with the swift library * add more packages and some polish * Remove all notifications methods and expose braze instance and onReady * Remove useless public method to set the gender * apply onReady on all methods except the initialize * Make use of braze onReady for notifications in the example app * fix commands list * Update remaining keys and move int enums to strings * Add new commands and parameters Commands: setSdkAuthSignature, setAdTrackingEnabled Parameters: sdkAuthSignature, adTrackingEnabled * fix pre existing tests * Add more tests for extensions, converter and configuration * SPM and carthage Carthage is not supported by braze at the moment * Update to brazeKit 5.6 to have configuration as a class both in cocoapods and carthage * Fix local testing * Use our own json mapping to braze SDK for carthage * update version and config tests * Improve tests * Update dependencies and create build script
- Loading branch information
Showing
28 changed files
with
1,316 additions
and
1,420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
github "tealium/tealium-swift" ~> 2.6 | ||
binary "https://raw.githubusercontent.com/Appboy/appboy-ios-sdk/master/appboy_ios_sdk.json" ~> 4.4 | ||
github "SDWebImage/SDWebImage" ~> 5.12 | ||
github "tealium/tealium-swift" ~> 2.8 | ||
binary "https://raw.githubusercontent.com/Tealium/tealium-ios-braze-remote-command/mt-1133/braze.json" ~> 5.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
binary "https://raw.githubusercontent.com/Appboy/appboy-ios-sdk/master/appboy_ios_sdk.json" "4.4.1" | ||
github "SDWebImage/SDWebImage" "5.12.2" | ||
github "tealium/tealium-swift" "2.5.1" | ||
binary "https://raw.githubusercontent.com/Tealium/tealium-ios-braze-remote-command/mt-1133/braze.json" "5.6.2" | ||
github "tealium/tealium-swift" "2.8.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// | ||
// BrazeExtensions.swift | ||
// TealiumBraze | ||
// | ||
// Created by Enrico Zannini on 04/11/22. | ||
// | ||
|
||
import BrazeKit | ||
|
||
extension Braze.User.SubscriptionState { | ||
static func from(_ value: String) -> Self? { | ||
let lowercasedSubscription = value.lowercased() | ||
if lowercasedSubscription == "optedin" { | ||
return .optedIn | ||
} else if lowercasedSubscription == "subscribed" { | ||
return .subscribed | ||
} else if lowercasedSubscription == "unsubscribed" { | ||
return .unsubscribed | ||
} else { | ||
return Self(rawValue: value) | ||
} | ||
} | ||
} | ||
|
||
extension Braze.User.Gender { | ||
static func from(_ value: String) -> Self { | ||
let lowercasedGender = value.lowercased() | ||
if lowercasedGender == "male" { | ||
return .male | ||
} else if lowercasedGender == "female" { | ||
return .female | ||
} else if lowercasedGender == "other" { | ||
return .other | ||
} else if lowercasedGender == "unknown" { | ||
return .unknown | ||
} else if lowercasedGender == "notapplicable" || lowercasedGender == "not_applicable" { | ||
return .notApplicable | ||
} else { | ||
return Self(rawValue: value) ?? .preferNotToSay | ||
} | ||
} | ||
} | ||
|
||
extension Braze.Configuration.DeviceProperty { | ||
static func from(_ value: String) -> Self? { | ||
let lowercasedValue = value.lowercased() | ||
switch lowercasedValue { | ||
case "model": | ||
return .model | ||
case "osversion": | ||
return .osVersion | ||
case "resolution": | ||
return .resolution | ||
case "timezone": | ||
return .timeZone | ||
case "locale": | ||
return .locale | ||
case "carrier": | ||
return .carrier | ||
case "pushenabled": | ||
return .pushEnabled | ||
case "pushauthstatus": | ||
return .pushAuthStatus | ||
case "pushdisplayoptions": | ||
return .pushDisplayOptions | ||
default: | ||
return Self(rawValue: value) | ||
} | ||
} | ||
} | ||
|
||
extension Braze.Configuration.Api.RequestPolicy { | ||
static func from(_ value: String) -> Self? { | ||
let lowercasedValue = value.lowercased() | ||
switch lowercasedValue { | ||
case "manual": | ||
return .manual | ||
case "automatic": | ||
return .automatic | ||
default: | ||
return Self(rawValue: value) | ||
} | ||
} | ||
} |
Oops, something went wrong.