Skip to content

Commit

Permalink
Improve environment parameters handling
Browse files Browse the repository at this point in the history
  • Loading branch information
erikdrobne committed Oct 18, 2019
1 parent fb3fb28 commit afa86f3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Analytical/Classes/Provider/BranchProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ public class BranchProvider : BaseProvider<Branch>, AnalyticalProvider {
private var launchOptions = [UIApplication.LaunchOptionsKey: Any]?

public func setup(with properties: Properties?) {
launchOptions = properties?[Property.Launch.options.rawValue] as? [UIApplication.LaunchOptionsKey: Any]

guard let shouldUseTestKey = properties?[BranchProvider.ShouldUseTestKey] as? Bool, let isDebugEnabled = properties?[BranchProvider.IsDebugEnabled] as? Bool else {
return
if let shouldUseTestKey = properties?[BranchProvider.ShouldUseTestKey] as? Bool {
Branch.setUseTestBranchKey(shouldUseTestKey)
}

launchOptions = properties?[Property.Launch.options.rawValue] as? [UIApplication.LaunchOptionsKey: Any]

Branch.setUseTestBranchKey(shouldUseTestKey)
instance = Branch.getInstance()

if isDebugEnabled {
if properties?[BranchProvider.IsDebugEnabled] as? Bool ?? false {
instance.setDebug()
}

Expand Down

0 comments on commit afa86f3

Please sign in to comment.