-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sergey Korney
committed
Oct 24, 2023
1 parent
ca162d2
commit e929d14
Showing
20 changed files
with
307 additions
and
131 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,13 +1,37 @@ | ||
public struct CloudConfig { | ||
|
||
static internal let defaultDomain: String = "https://tracking.affattr.com/" | ||
static private let path: String = "postback" | ||
|
||
static private var domain: String = defaultDomain | ||
|
||
/** | ||
* Urls for send data | ||
*/ | ||
static let urls: Array<String> = [ | ||
"https://tracking.affattr.com/postback" | ||
static public private(set) var urls: [String] = [ | ||
"\(domain)\(path)" | ||
] | ||
|
||
public static let headers: [String:String] = [ | ||
static public let headers: [String:String] = [ | ||
"Content-Type" : "application/json; charset=utf-8" | ||
] | ||
|
||
static internal func setupDomain(_ domain: String?) { | ||
guard let domain = domain else { return } | ||
if domain.isEmpty { return } | ||
|
||
if domain.hasSuffix("/") { | ||
self.domain = domain | ||
} else { | ||
self.domain = "\(domain)/" | ||
} | ||
|
||
self.urls = [ | ||
getURL(path) | ||
] | ||
} | ||
|
||
static public func getURL(_ path: String) -> String { | ||
return "\(domain)\(path)" | ||
} | ||
} |
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
89 changes: 89 additions & 0 deletions
89
AffiseAttributionLib/Classes/settings/AffiseSettings.swift
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,89 @@ | ||
@objc | ||
public class AffiseSettings: NSObject { | ||
|
||
private let affiseAppId: String? | ||
private let secretKey: String? | ||
private var isProduction: Bool = true | ||
private var partParamName: String? | ||
private var partParamNameToken: String? | ||
private var appToken: String? | ||
private var domain: String? | ||
|
||
@objc | ||
internal init( | ||
affiseAppId: String, | ||
secretKey: String | ||
) { | ||
self.affiseAppId = affiseAppId | ||
self.secretKey = secretKey | ||
} | ||
|
||
/** | ||
* Set Affise SDK for SandBox / Production | ||
*/ | ||
@objc | ||
public func setProduction(_ production: Bool) -> AffiseSettings { | ||
self.isProduction = production | ||
return self | ||
} | ||
|
||
/** | ||
* Only for specific use case [partParamName] | ||
*/ | ||
@objc | ||
public func setPartParamName(_ partParamName: String) -> AffiseSettings { | ||
self.partParamName = partParamName | ||
return self | ||
} | ||
|
||
/** | ||
* Only for specific use case [partParamNameToken] | ||
*/ | ||
@objc | ||
public func setPartParamNameToken(_ partParamNameToken: String) -> AffiseSettings { | ||
self.partParamNameToken = partParamNameToken | ||
return self | ||
} | ||
|
||
/** | ||
* Set [appToken] | ||
*/ | ||
@objc | ||
public func setAppToken(_ appToken: String) -> AffiseSettings { | ||
self.appToken = appToken | ||
return self | ||
} | ||
|
||
/** | ||
* Set Affise SDK server [domain] | ||
* Triling slash is irrelivant | ||
*/ | ||
@objc | ||
public func setDomain(_ domain: String) -> AffiseSettings { | ||
self.domain = domain | ||
return self | ||
} | ||
|
||
private func getInitProperties() -> AffiseInitProperties { | ||
return AffiseInitProperties( | ||
affiseAppId: affiseAppId, | ||
partParamName: partParamName, | ||
partParamNameToken: partParamNameToken, | ||
appToken: appToken, | ||
isProduction: isProduction, | ||
secretKey: secretKey, | ||
domain: domain | ||
) | ||
} | ||
|
||
/** | ||
* Start Affise SDK using [app] and [launchOptions] | ||
*/ | ||
@objc | ||
public func start( | ||
app: UIApplication, | ||
launchOptions: [UIApplication.LaunchOptionsKey: Any]? | ||
) { | ||
Affise.start(initProperties: getInitProperties(), app: app, launchOptions: launchOptions) | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.