-
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
Aug 6, 2024
1 parent
ebb3b18
commit 9bca540
Showing
24 changed files
with
279 additions
and
127 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import Foundation | ||
|
||
internal struct BuildConfig { | ||
static let AFFISE_VERSION = "1.6.37" | ||
static let AFFISE_VERSION = "1.6.38" | ||
} |
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
25 changes: 25 additions & 0 deletions
25
AffiseAttributionLib/Classes/parameters/providers/ReferrerProvider.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,25 @@ | ||
import Foundation | ||
|
||
/** | ||
* Provider for parameter [ProviderType.REFERRER] | ||
*/ | ||
class ReferrerProvider: StringPropertyProvider { | ||
|
||
private let useCase: RetrieveReferrerUseCase | ||
|
||
init(_ useCase: RetrieveReferrerUseCase) { | ||
self.useCase = useCase | ||
} | ||
|
||
override func provide() -> String? { | ||
return useCase.getReferrer() | ||
} | ||
|
||
public override func getOrder() -> Float { | ||
34.0 | ||
} | ||
|
||
public override func getKey() -> ProviderType? { | ||
ProviderType.REFERRER | ||
} | ||
} |
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
65 changes: 0 additions & 65 deletions
65
AffiseAttributionLib/Classes/referrer/RetrieveInstallReferrerUseCase.swift
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
AffiseAttributionLib/Classes/referrer/RetrieveReferrerOnServerUseCase.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,45 @@ | ||
import Foundation | ||
|
||
class RetrieveReferrerOnServerUseCase { | ||
|
||
private let moduleManager: AffiseModuleManager | ||
private var referrerModule: ReferrerCallback? | ||
|
||
init( | ||
moduleManager: AffiseModuleManager | ||
) { | ||
self.moduleManager = moduleManager | ||
} | ||
|
||
private func getReffererModule() -> ReferrerCallback? { | ||
if self.referrerModule != nil { | ||
return self.referrerModule | ||
} | ||
guard let module = moduleManager.getModule(.Status) else { return nil } | ||
guard let referrerModule = module as? ReferrerCallback else { return nil } | ||
self.referrerModule = referrerModule | ||
return referrerModule | ||
} | ||
|
||
private func handleReferrerOnServer(_ callback: @escaping OnReferrerCallback) { | ||
getReffererModule()?.getReferrer(callback) ?? callback(nil) | ||
} | ||
|
||
/** | ||
* Return referrer on server | ||
*/ | ||
func getReferrerOnServer(_ callback: @escaping OnReferrerCallback) { | ||
handleReferrerOnServer { value in | ||
callback(value) | ||
} | ||
} | ||
|
||
/** | ||
* Return referrer on server parameter by key | ||
*/ | ||
func getReferrerOnServerValue(_ key: ReferrerKey, _ callback: @escaping OnReferrerCallback) { | ||
handleReferrerOnServer { value in | ||
callback(value?.getQueryStringParameter(key.value())) | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
AffiseAttributionLib/Classes/referrer/RetrieveReferrerUseCase.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,31 @@ | ||
import Foundation | ||
|
||
class RetrieveReferrerUseCase { | ||
|
||
private var referrerURL: URL? | ||
|
||
/** | ||
* Set referrerURL | ||
*/ | ||
func setReferrer(_ url: URL?) { | ||
referrerURL = url | ||
} | ||
|
||
func getReferrer() -> String? { | ||
return referrerURL?.absoluteString | ||
} | ||
|
||
/** | ||
* Return referrer URL | ||
*/ | ||
func getReferrerUrl(_ callback: @escaping OnReferrerCallback) { | ||
callback(referrerURL?.absoluteString) | ||
} | ||
|
||
/** | ||
* Return referrer URL parameter by key | ||
*/ | ||
func getReferrerUrlValue(_ key: ReferrerKey, _ callback: @escaping OnReferrerCallback) { | ||
callback(referrerURL?.absoluteString.getQueryStringParameter(key.value())) | ||
} | ||
} |
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.