-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #291 from edx/test/segment_plus_firebase
Firebase and Segment integration
- Loading branch information
Showing
22 changed files
with
312 additions
and
198 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
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
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 @@ | ||
// | ||
// SegmentConfig.swift | ||
// Core | ||
// | ||
// Created by Anton Yarmolenka on 02/02/2024. | ||
// | ||
|
||
import Foundation | ||
|
||
private enum SegmentKeys: String, RawStringExtractable { | ||
case enabled = "ENABLED" | ||
case writeKey = "SEGMENT_IO_WRITE_KEY" | ||
} | ||
|
||
public final class SegmentConfig: NSObject { | ||
public var enabled: Bool = false | ||
public var writeKey: String = "" | ||
|
||
init(dictionary: [String: AnyObject]) { | ||
super.init() | ||
writeKey = dictionary[SegmentKeys.writeKey] as? String ?? "" | ||
enabled = dictionary[SegmentKeys.enabled] as? Bool == true && !writeKey.isEmpty | ||
} | ||
} | ||
|
||
private let segmentKey = "SEGMENT_IO" | ||
extension Config { | ||
public var segment: SegmentConfig { | ||
SegmentConfig(dictionary: self[segmentKey] 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
Oops, something went wrong.