Skip to content

Commit

Permalink
1.6.37
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Korney committed Aug 5, 2024
1 parent e4fa8df commit ebb3b18
Show file tree
Hide file tree
Showing 15 changed files with 141 additions and 53 deletions.
2 changes: 1 addition & 1 deletion AffiseAttributionLib.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Pod::Spec.new do |spec|
spec.name = "AffiseAttributionLib"
spec.version = ENV['LIB_VERSION'] || "1.6.36"
spec.version = ENV['LIB_VERSION'] || "1.6.37"
spec.summary = "Affise Attribution iOS library"
spec.description = "Affise SDK is a software you can use to collect app usage statistics, device identifiers, deeplink usage, track install referrer."
spec.homepage = "https://github.com/affise/sdk-ios"
Expand Down
8 changes: 0 additions & 8 deletions AffiseAttributionLib/Classes/Affise.swift
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,6 @@ public final class Affise: NSObject {
return api?.moduleManager.getModules() ?? []
}

/**
* Call deeplink handle manually
*/
@objc
public static func handleDeeplink(_ url: URL) {
api?.deeplinkManager.handleDeeplink(url: url)
}

internal static func getApi() -> AffiseApi? {
return api
}
Expand Down
2 changes: 1 addition & 1 deletion AffiseAttributionLib/Classes/internal/BuildConfig.swift
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.36"
static let AFFISE_VERSION = "1.6.37"
}
34 changes: 34 additions & 0 deletions AffiseAttributionLib/Classes/internal/InternalAffise.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import Foundation


extension Affise {

/**
* Call deeplink handle manually
*/
@objc
public static func handleDeeplink(_ url: URL?) {
Affise.getApi()?.deeplinkManager.handleDeeplink(url: url)
}

/**
* Handle referrer manually
*/
@objc
public static func handleReferrer(_ url: URL?) {
Affise.getApi()?.retrieveInstallReferrerUseCase.setReferrer(url)
}

/**
* Handle user activity deeplink and referrer manually
*/
@objc
public static func handleUserActivity(_ userActivity: NSUserActivity) {
if #available(iOS 11.0, *) {
Affise.handleReferrer(userActivity.referrerURL)
}

// Get URL components from the incoming user activity.
Affise.handleDeeplink(userActivity.webpageURL)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import Foundation

class RetrieveInstallReferrerUseCase {

let moduleManager: AffiseModuleManager
var referrerModule: ReferrerCallback?
private let moduleManager: AffiseModuleManager
private var referrerModule: ReferrerCallback?
private var referrerURL: URL?

init(
moduleManager: AffiseModuleManager
) {
self.moduleManager = moduleManager
}

func getReffererModule() -> ReferrerCallback? {
private func getReffererModule() -> ReferrerCallback? {
if self.referrerModule != nil {
return self.referrerModule
}
Expand All @@ -21,22 +22,44 @@ class RetrieveInstallReferrerUseCase {
return referrerModule
}

func getQueryStringParameter(_ url: String, _ param: String) -> String? {
private func getQueryStringParameter(_ url: String?, _ param: String) -> String? {
guard let url = url else {
return nil
}
guard let url = URLComponents(string: url) else { return nil }
return url.queryItems?.first(where: { $0.name == param })?.value
}
}

private func handleReferrer(_ callback: @escaping OnReferrerCallback) {
guard let referrer = referrerURL else {
getReffererModule()?.getReferrer(callback) ?? callback(nil)
return
}
callback(referrer.absoluteString)
}

/**
* Set referrerURL
*/
func setReferrer(_ url: URL?) {
referrerURL = url
}

/**
* Return referrerURL
*/
func getReferrer(_ callback: @escaping OnReferrerCallback) {
getReffererModule()?.getReferrer(callback) ?? callback(nil)
handleReferrer { value in
callback(value)
}
}

/**
* Return referrerURL parameter by key
*/
func getReferrerValue(_ key: ReferrerKey, _ callback: @escaping OnReferrerCallback) {
guard let module = getReffererModule() else {
callback(nil)
return
}
module.getReferrer { value in
callback(self.getQueryStringParameter("https://referrer/?\(value ?? "")", key.value()))
handleReferrer { value in
callback(self.getQueryStringParameter(value, key.value()))
}
}
}
2 changes: 1 addition & 1 deletion AffiseInternal.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |spec|
spec.name = "AffiseInternal"
spec.version = ENV['LIB_VERSION'] || "1.6.36"
spec.version = ENV['LIB_VERSION'] || "1.6.37"
spec.summary = "Affise Internal library"
spec.description = "Affise Internal wrapper library for crossplatform"
spec.homepage = "https://github.com/affise/sdk-ios"
Expand Down
2 changes: 1 addition & 1 deletion AffiseModule.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "AffiseModule"
s.version = ENV["LIB_VERSION"] || "1.6.36"
s.version = ENV["LIB_VERSION"] || "1.6.37"
s.summary = "Affise Modules"
s.description = "Affise module collection"
s.homepage = "https://github.com/affise/sdk-ios"
Expand Down
2 changes: 1 addition & 1 deletion AffiseModule/Advertising/Classes/AdvertisingModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Foundation
@objc(AffiseAdvertisingModule)
public final class AdvertisingModule: AffiseModule {

public override var version: String { "1.6.36" }
public override var version: String { "1.6.37" }

private lazy var advertisingIdManager: AdvertisingIdManager = AdvertisingIdManagerImpl()

Expand Down
2 changes: 1 addition & 1 deletion AffiseModule/Link/Classes/LinkModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import AffiseAttributionLib
@objc(AffiseLinkModule)
public final class LinkModule: AffiseModule {

public override var version: String { "1.6.36" }
public override var version: String { "1.6.37" }

private var useCase: LinkResolveUseCase? = nil

Expand Down
2 changes: 1 addition & 1 deletion AffiseModule/Status/Classes/StatusModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import AffiseAttributionLib
@objc(AffiseStatusModule)
public final class StatusModule: AffiseModule {

public override var version: String { "1.6.36" }
public override var version: String { "1.6.37" }

private var checkStatusUseCase: CheckStatusUseCase? = nil
private var referrerUseCase: ReferrerUseCase? = nil
Expand Down
2 changes: 1 addition & 1 deletion AffiseModule/Subscription/Classes/SubscriptionModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import AffiseAttributionLib
@objc(AffiseSubscriptionModule)
public final class SubscriptionModule: AffiseModule {

public override var version: String { "1.6.36" }
public override var version: String { "1.6.37" }

lazy var storeManager: StoreManager = StoreManager()

Expand Down
2 changes: 1 addition & 1 deletion AffiseSKAdNetwork.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Pod::Spec.new do |spec|
spec.name = "AffiseSKAdNetwork"
spec.version = ENV['LIB_VERSION'] || "1.6.36"
spec.version = ENV['LIB_VERSION'] || "1.6.37"
spec.summary = "AffiseSKAdNetwork iOS library"
spec.description = "Affise library for StoreKit Ad Network (SKAdNetwork)"
spec.homepage = "https://github.com/affise/sdk-ios"
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [1.6.37] - 2024-08-05

### Added

- Add `NSUserActivity.referrerURL` for `Affise.getReferrer` and `Affise.getReferrerValue`

## [1.6.36] - 2024-07-30

### Fixed
Expand Down Expand Up @@ -80,6 +86,7 @@
- Improve `AffiseModuleManager`
- Update for demo app

[1.6.37]: https://github.com/affise/sdk-ios/compare/1.6.36...1.6.37
[1.6.36]: https://github.com/affise/sdk-ios/compare/1.6.35...1.6.36
[1.6.35]: https://github.com/affise/sdk-ios/compare/1.6.34...1.6.35
[1.6.34]: https://github.com/affise/sdk-ios/compare/1.6.33...1.6.34
Expand Down
69 changes: 45 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

| Pod | Version |
| ---- |:-------:|
| `AffiseAttributionLib` | [`1.6.36`](https://github.com/CocoaPods/Specs/tree/master/Specs/a/9/3/AffiseAttributionLib) |
| `AffiseSKAdNetwork` | [`1.6.36`](https://github.com/CocoaPods/Specs/tree/master/Specs/3/6/f/AffiseSKAdNetwork) |
| `AffiseModule/Advertising` | [`1.6.36`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) |
| `AffiseModule/Link` | [`1.6.36`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) |
| `AffiseModule/Status` | [`1.6.36`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) |
| `AffiseAttributionLib` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/a/9/3/AffiseAttributionLib) |
| `AffiseSKAdNetwork` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/3/6/f/AffiseSKAdNetwork) |
| `AffiseModule/Advertising` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) |
| `AffiseModule/Link` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) |
| `AffiseModule/Status` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) |

- [Affise Attribution iOS Library](#affise-attribution-ios-library)
- [Description](#description)
Expand Down Expand Up @@ -80,22 +80,22 @@ To add the SDK using Cocoapods, specify the version you want to use in your Podf

```ruby
# Affise SDK library
pod 'AffiseAttributionLib', '~> 1.6.36'
pod 'AffiseAttributionLib', '~> 1.6.37'
# Affise modules
pod 'AffiseModule/Advertising', '~> 1.6.36'
pod 'AffiseModule/Link', '~> 1.6.36'
pod 'AffiseModule/Status', '~> 1.6.36'
pod 'AffiseModule/Advertising', '~> 1.6.37'
pod 'AffiseModule/Link', '~> 1.6.37'
pod 'AffiseModule/Status', '~> 1.6.37'
```

Get source directly from GitHub

```ruby
# Affise SDK library
pod 'AffiseAttributionLib', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.36'
pod 'AffiseAttributionLib', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.37'
# Affise modules
pod 'AffiseModule/Advertising', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.36'
pod 'AffiseModule/Link', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.36'
pod 'AffiseModule/Status', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.36'
pod 'AffiseModule/Advertising', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.37'
pod 'AffiseModule/Link', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.37'
pod 'AffiseModule/Status', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.37'
```

### Integrate as Swift Package Manager
Expand Down Expand Up @@ -197,9 +197,9 @@ Affise
| Module | Version | Start |
| ------------- |:------------------------------------------------------------------------------------:|----------|
| `Advertising` | [`1.6.36`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Manual` |
| `Link` | [`1.6.36`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` |
| `Status` | [`1.6.36`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` |
| `Advertising` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Manual` |
| `Link` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` |
| `Status` | [`1.6.37`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` |

If module start type is `manual`, then call:

Expand Down Expand Up @@ -263,14 +263,14 @@ To add the SDK using Cocoapods, specify the version you want to use in your Podf

```ruby
# Wrapper for StoreKit Ad Network
pod 'AffiseSKAdNetwork', '~> 1.6.36'
pod 'AffiseSKAdNetwork', '~> 1.6.37'
```

Get source directly from GitHub

```ruby
# Wrapper for StoreKit Ad Network
pod 'AffiseSKAdNetwork', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.36'
pod 'AffiseSKAdNetwork', :git => 'https://github.com/affise/sdk-ios.git', :tag => '1.6.37'
```

For `swift` use:
Expand Down Expand Up @@ -913,12 +913,7 @@ func application(
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
// Get URL components from the incoming user activity.
guard url == userActivity.webpageURL else {
return false
}

Affise.handleDeeplink(url)
Affise.handleUserActivity(userActivity)
return true
}
```
Expand Down Expand Up @@ -974,6 +969,19 @@ Affise.isFirstRun()
>
> Requires [Affise Status Module](#modules)
- Add referrer handler to `AppDelegate.swift`

```swift
func application(
_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
Affise.handleUserActivity(userActivity)
return true
}
```

Use the next public method of SDK

```swift
Expand All @@ -988,6 +996,19 @@ Affise.getReferrer { referrer in
>
> Requires [Affise Status Module](#modules)
- Add referrer handler to `AppDelegate.swift`

```swift
func application(
_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
Affise.handleUserActivity(userActivity)
return true
}
```

Use the next public method of SDK to get referrer parameter by

```swift
Expand Down
11 changes: 11 additions & 0 deletions example/app/app/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
) -> Bool {
// Handle Deeplink
Affise.handleDeeplink(url)
return true
}

func application(
_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
// Handle AppLinks
Affise.handleUserActivity(userActivity)
return true
}

func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
Expand Down

0 comments on commit ebb3b18

Please sign in to comment.