-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Abstract layer for Push Notifications and Deep Linking (#263)
* chore: added abstract layer for push notifications * chore: abstract layer for deep linking * chore: renamed some func * chore: small refactor * chore: added RawStringExtractable to configs * chore: address review feedback * chore: address review feedback
- Loading branch information
Showing
19 changed files
with
571 additions
and
17 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
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,31 @@ | ||
// | ||
// BranchConfig.swift | ||
// Core | ||
// | ||
// Created by Anton Yarmolenka on 24/01/2024. | ||
// | ||
|
||
import Foundation | ||
|
||
private enum BranchKeys: String, RawStringExtractable { | ||
case enabled = "ENABLED" | ||
case key = "KEY" | ||
} | ||
|
||
public final class BranchConfig: NSObject { | ||
public var enabled: Bool = false | ||
public var key: String? | ||
|
||
init(dictionary: [String: AnyObject]) { | ||
super.init() | ||
enabled = dictionary[BranchKeys.enabled] as? Bool == true | ||
key = dictionary[BranchKeys.key] as? String | ||
} | ||
} | ||
|
||
private let branchKey = "BRANCH" | ||
extension Config { | ||
public var branch: BranchConfig { | ||
BranchConfig(dictionary: self[branchKey] as? [String: AnyObject] ?? [:]) | ||
} | ||
} |
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,32 @@ | ||
// | ||
// BrazeConfig.swift | ||
// Core | ||
// | ||
// Created by Anton Yarmolenka on 24/01/2024. | ||
// | ||
|
||
import Foundation | ||
|
||
private enum BrazeKeys: String, RawStringExtractable { | ||
case enabled = "ENABLED" | ||
case pushNotificationsEnabled = "PUSH_NOTIFICATIONS_ENABLED" | ||
} | ||
|
||
public final class BrazeConfig: NSObject { | ||
public var enabled: Bool = false | ||
public var pushNotificationsEnabled: Bool = false | ||
|
||
init(dictionary: [String: AnyObject]) { | ||
super.init() | ||
enabled = dictionary[BrazeKeys.enabled] as? Bool == true | ||
let pushNotificationsEnabled = dictionary[BrazeKeys.pushNotificationsEnabled] as? Bool ?? false | ||
self.pushNotificationsEnabled = enabled && pushNotificationsEnabled | ||
} | ||
} | ||
|
||
private let brazeKey = "BRAZE" | ||
extension Config { | ||
public var braze: BrazeConfig { | ||
BrazeConfig(dictionary: self[brazeKey] as? [String: AnyObject] ?? [:]) | ||
} | ||
} |
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
Oops, something went wrong.