-
Notifications
You must be signed in to change notification settings - Fork 59
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 #96 from AppsFlyerSDK/development
Development
- Loading branch information
Showing
20 changed files
with
1,109 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This workflow creates new comment from template to an issue | ||
# if it was labled as 'support' | ||
|
||
name: Add comment | ||
on: | ||
issues: | ||
types: | ||
- labeled | ||
jobs: | ||
add-comment: | ||
if: github.event.label.name == 'support' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
issues: write | ||
steps: | ||
- name: Add comment | ||
uses: peter-evans/create-or-update-comment@a35cf36e5301d70b76f316e867e7788a55a31dae | ||
with: | ||
issue-number: ${{ github.event.issue.number }} | ||
body: | | ||
👋 Hi @${{ github.event.issue.user.login }} and Thank you for reaching out to us. | ||
In order for us to provide optimal support, please submit a ticket to our support team at [email protected]. | ||
When submitting the ticket, please specify: | ||
- ✅ your AppsFlyer sign-up (account) email | ||
- ✅ app ID | ||
- ✅ production steps | ||
- ✅ logs | ||
- ✅ code snippets | ||
- ✅ and any additional relevant information. |
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,18 @@ | ||
name: CI - Tests | ||
on: | ||
push: | ||
branches-ignore: | ||
- 'main' | ||
- 'releases/**' | ||
jobs: | ||
Tests: | ||
runs-on: macos-12 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: latest-stable | ||
- name: CocoaPod Install | ||
run: pod install | ||
- name: Test | ||
run: xcodebuild test -scheme segment-appsflyer-ios -workspace segment-appsflyer-ios.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 13' | xcpretty && exit ${PIPESTATUS[0]} |
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,2 +1,2 @@ | ||
binary "https://raw.githubusercontent.com/AppsFlyerSDK/AppsFlyerFramework/master/Carthage/appsflyer-ios.json" | ||
github "segmentio/analytics-ios" | ||
binary "https://raw.githubusercontent.com/AppsFlyerSDK/AppsFlyerFramework/master/Carthage/appsflyer-ios.json" == 6.9.1 | ||
github "segmentio/analytics-ios" |
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,2 +1,2 @@ | ||
binary "https://raw.githubusercontent.com/AppsFlyerSDK/AppsFlyerFramework/master/Carthage/appsflyer-ios.json" "6.8.1" | ||
github "segmentio/analytics-ios" "4.1.6" | ||
binary "https://raw.githubusercontent.com/AppsFlyerSDK/AppsFlyerFramework/master/Carthage/appsflyer-ios.json" "6.9.1" | ||
github "segmentio/analytics-ios" "4.1.8" |
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,21 @@ | ||
# Uncomment the next line to define a global platform for your project | ||
# platform :ios, '9.0' | ||
|
||
target 'segment-appsflyer-ios' do | ||
# Comment the next line if you don't want to use dynamic frameworks | ||
use_frameworks! | ||
|
||
# Pods for segment-appsflyer-ios | ||
pod 'Analytics' | ||
pod 'AppsFlyerFramework' | ||
|
||
end | ||
|
||
target 'SegmentAppsFlyeriOSTests' do | ||
# Comment the next line if you don't want to use dynamic frameworks | ||
use_frameworks! | ||
|
||
# Pods for SegmentAppsFlyeriOSTests | ||
pod 'OCMock' | ||
|
||
end |
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 |
---|---|---|
|
@@ -2,11 +2,11 @@ | |
|
||
# AppsFlyer integration for Segment. | ||
|
||
## This is a Segment wrapper for AppsFlyer SDK that is built with iOS SDK v6.8.1. | ||
## This is a Segment wrapper for AppsFlyer SDK that is built with iOS SDK v6.9.1. | ||
|
||
[![Version](https://img.shields.io/cocoapods/v/segment-appsflyer-ios.svg?style=flat)](http://cocoapods.org/pods/segment-appsflyer-ios) | ||
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) | ||
|
||
[![CI - Tests](https://github.com/AppsFlyerSDK/segment-appsflyer-ios/actions/workflows/test.yml/badge.svg?branch=dev%2FDELIVRY-17805%2Funit-tests&event=push)](https://github.com/AppsFlyerSDK/segment-appsflyer-ios/actions/workflows/test.yml) | ||
|
||
---------- | ||
🛠 In order for us to provide optimal support, we would kindly ask you to submit any issues to [email protected] | ||
|
@@ -48,12 +48,12 @@ To install the segment-appsflyer-ios integration: | |
|
||
**Production** version: | ||
```ruby | ||
pod 'segment-appsflyer-ios', '6.8.1' | ||
pod 'segment-appsflyer-ios', '6.9.1' | ||
``` | ||
|
||
**Strict mode SDK** version: | ||
```ruby | ||
pod 'segment-appsflyer-ios/Strict', '6.8.1' | ||
pod 'segment-appsflyer-ios/Strict', '6.9.1' | ||
``` | ||
Use the strict mode SDK to completely remove IDFA collection functionality and AdSupport framework dependencies (for example, when developing apps for kids). | ||
|
||
|
@@ -65,7 +65,7 @@ Use the strict mode SDK to completely remove IDFA collection functionality and A | |
|
||
**Production** version: | ||
```ogdl | ||
github "AppsFlyerSDK/segment-appsflyer-ios" "6.8.1" | ||
github "AppsFlyerSDK/segment-appsflyer-ios" "6.9.1" | ||
``` | ||
|
||
|
||
|
@@ -93,7 +93,7 @@ First of all, you must provide values for AppsFlyer Dev Key, Apple App ID (iTune | |
|
||
Open `AppDelegate.h` and add: | ||
|
||
``` | ||
```objective-c | ||
#import "SEGAppsFlyerIntegrationFactory.h" | ||
``` | ||
|
||
|
@@ -104,7 +104,7 @@ In `AppDelegate.m` ➜ `didFinishLaunchingWithOptions`: | |
// For ApsFlyer debug logs | ||
[AppsFlyerLib shared].isDebug = YES; | ||
|
||
[[AppsFlyerLib shared] waitForATTUserAuthorizationWithTimeoutInterval:60]; | ||
// [[AppsFlyerLib shared] waitForATTUserAuthorizationWithTimeoutInterval:60]; | ||
/* | ||
Based on your needs you can either pass a delegate to process deferred | ||
and direct deeplinking callbacks or disregard them. | ||
|
@@ -118,14 +118,13 @@ In `AppDelegate.m` ➜ `didFinishLaunchingWithOptions`: | |
// SEGAppsFlyerIntegrationFactory* factoryWithDelegate = [SEGAppsFlyerIntegrationFactory createWithLaunchDelegate:self andManualMode:YES]; | ||
|
||
|
||
SEGAnalyticsConfiguration *config = [SEGAnalyticsConfiguration configurationWithWriteKey:@"WYsuyFINOKZuQyQAGn5JQoCgIdhOI146"]; | ||
SEGAnalyticsConfiguration *config = [SEGAnalyticsConfiguration configurationWithWriteKey:@"SEGMENT_KEY"]; | ||
[config use:factoryNoDelegate]; | ||
// [config use:factoryWithDelegate]; // use this if you want to get conversion data in the app. Read more in the integration guide | ||
config.enableAdvertisingTracking = YES; //OPTIONAL | ||
config.trackApplicationLifecycleEvents = YES; //OPTIONAL | ||
config.trackDeepLinks = YES; //OPTIONAL | ||
config.trackPushNotifications = YES; //OPTIONAL | ||
config.trackAttributionData = YES; //OPTIONAL | ||
[SEGAnalytics debug:YES]; //OPTIONAL | ||
[SEGAnalytics setupWithConfiguration:config]; | ||
``` | ||
|
@@ -156,15 +155,16 @@ In `AppDelegate.m` ➜ `applicationDidBecomeActive`: | |
3. Open `AppDelegate.swift` and add: | ||
|
||
```swift | ||
import Analytics | ||
import Segment | ||
import AppsFlyerLib | ||
import segment_appsflyer_ios | ||
``` | ||
|
||
4. In `didFinishLaunchingWithOptions` add: | ||
```swift | ||
// For AppsFLyer debug logs uncomment the line below | ||
// AppsFlyerLib.shared().isDebug = true | ||
AppsFlyerLib.shared().waitForATTUserAuthorization(withTimeoutInterval: 60) | ||
// AppsFlyerLib.shared().waitForATTUserAuthorization(withTimeoutInterval: 60) | ||
|
||
/* | ||
Based on your needs you can either pass a delegate to process deferred | ||
|
@@ -188,7 +188,6 @@ import AppsFlyerLib | |
config.trackApplicationLifecycleEvents = true //OPTIONAL | ||
config.trackDeepLinks = true //OPTIONAL | ||
config.trackPushNotifications = true //OPTIONAL | ||
config.trackAttributionData = true //OPTIONAL | ||
|
||
Analytics.debug(false) | ||
Analytics.setup(with: config) | ||
|
@@ -220,7 +219,7 @@ In identify call ```traits``` dictionary ```setCustomerUserID``` and ```currenc | |
In order to get Conversion Data you need to: | ||
|
||
1. Add `SEGAppsFlyerLibDelegate` protocol to your AppDelegate.h (or other) class | ||
``` | ||
```objective-c | ||
#import <UIKit/UIKit.h> | ||
#import "SEGAppsFlyerIntegrationFactory.h" | ||
|
||
|
@@ -229,7 +228,7 @@ In identify call ```traits``` dictionary ```setCustomerUserID``` and ```currenc | |
2. Pass AppDelegate (or other) class when configuring Segment Analytics with AppsFlyer. Change line `[config use:[SEGAppsFlyerIntegrationFactory instance]];` to `[config use:[SEGAppsFlyerIntegrationFactory createWithLaunchDelegate:self]];` | ||
3. In the class passed to the method above (AppDelegate.m by default) implement methods of the `SEGAppsFlyerLibDelegate` protocol. See sample code below: | ||
``` | ||
```objective-c | ||
#import "AppDelegate.h" | ||
@interface AppDelegate () | ||
|
@@ -291,7 +290,7 @@ In identify call ```traits``` dictionary ```setCustomerUserID``` and ```currenc | |
2. Pass AppDelegate (or other) class when configuring Segment Analytics with AppsFlyer. If you use sample code from above, change line `config.use(factoryNoDelegate)` to `config.use(factoryWithDelegate)` | ||
3. Implement methods of the protocol in the class, passed as a delegate. See sample code below where AppDelegate is used for that: | ||
|
||
``` | ||
```swift | ||
class AppDelegate: UIResponder, UIApplicationDelegate, SEGAppsFlyerLibDelegate { | ||
|
||
var window: UIWindow? | ||
|
@@ -340,13 +339,13 @@ In order to use Unified Deep linking you need to: | |
|
||
1. Add `SEGAppsFlyerDeepLinkDelegate` protocol to your AppDelegate (or other) class | ||
2. Pass AppDelegate (or other) class when configuring Segment Analytics with AppsFlyer. From the sample code above, change factoryWithDelegate to : | ||
``` | ||
```swift | ||
let factoryWithDelegate: SEGAppsFlyerIntegrationFactory = SEGAppsFlyerIntegrationFactory.create(withLaunch: self, andDeepLinkDelegate: self) | ||
``` | ||
|
||
3. Implement methods of the protocol in the class, passed as a delegate. See sample code below where AppDelegate is used for that: | ||
|
||
``` | ||
```swift | ||
extension AppDelegate: SEGAppsFlyerDeepLinkDelegate { | ||
func didResolveDeepLink(_ result: DeepLinkResult) { | ||
print(result) | ||
|
@@ -359,7 +358,7 @@ extension AppDelegate: SEGAppsFlyerDeepLinkDelegate { | |
## <a id="install_attributed"> Install Attributed event | ||
|
||
If you are working with networks that don't allow passing user level data to 3rd parties, you will need to apply code to filter out these networks before calling | ||
``` | ||
```objective-c | ||
// [self.analytics track:@"Install Attributed" properties:[properties copy]]; | ||
``` | ||
|
||
|
122 changes: 122 additions & 0 deletions
122
SegmentAppsFlyeriOSTests/SEGAppsFlyerIntegrationFactoryTests.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,122 @@ | ||
// | ||
// SegmentAppsFlyeriOSTests.swift | ||
// SegmentAppsFlyeriOSTests | ||
// | ||
// Created by Moris Gateno on 27/12/2022. | ||
// Copyright © 2022 Andrii Hahan. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
import SegmentAppsFlyeriOS | ||
|
||
|
||
|
||
final class SegmentAppsFlyeriOSTests: XCTestCase , SEGAppsFlyerLibDelegate, SEGAppsFlyerDeepLinkDelegate { | ||
func onConversionDataSuccess(_ conversionInfo: [AnyHashable : Any]) { | ||
print("onConversionDataSuccess") | ||
} | ||
|
||
func onConversionDataFail(_ error: Error) { | ||
print("onConversionDataFail") | ||
} | ||
|
||
|
||
override func setUpWithError() throws { | ||
// Put setup code here. This method is called before the invocation of each test method in the class. | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
// Put teardown code here. This method is called after the invocation of each test method in the class. | ||
} | ||
|
||
// | ||
//instance | ||
// | ||
func testSEGAppsFlyerIntegrationFactory_instance_happyFlow() throws { | ||
let factoryObject = SEGAppsFlyerIntegrationFactory.instance() | ||
XCTAssertNil(factoryObject?.delegate) | ||
XCTAssertNil(factoryObject?.dlDelegate) | ||
XCTAssertEqual(factoryObject?.manualMode,false) | ||
} | ||
|
||
// | ||
//createWithLaunchDelegate | ||
// | ||
func testSEGAppsFlyerIntegrationFactory_createWithLaunchDelegate_happyFlow() throws { | ||
let factoryObject = SEGAppsFlyerIntegrationFactory.create(withLaunch:self) | ||
XCTAssertNotNil(factoryObject?.delegate) | ||
XCTAssertTrue(((factoryObject?.delegate.isEqual(self)) != nil)) | ||
XCTAssertNil(factoryObject?.dlDelegate) | ||
XCTAssertEqual(factoryObject?.manualMode,false) | ||
} | ||
|
||
func testSEGAppsFlyerIntegrationFactory_createWithLaunchDelegate_nilFlow() throws { | ||
let factoryObject = SEGAppsFlyerIntegrationFactory.create(withLaunch:nil) | ||
XCTAssertNil(factoryObject?.delegate) | ||
} | ||
|
||
// | ||
//createWithLaunchDelegate andDeepLinkDelegate | ||
// | ||
|
||
func testSEGAppsFlyerIntegrationFactory_createWithLaunchDelegateandDeepLinkDelegate_happyFlow() throws { | ||
let factoryObject = SEGAppsFlyerIntegrationFactory.create(withLaunch: self, andDeepLinkDelegate: self) | ||
XCTAssertNotNil(factoryObject?.delegate) | ||
XCTAssertNotNil(factoryObject?.dlDelegate) | ||
XCTAssertTrue(((factoryObject?.delegate.isEqual(self)) != nil)) | ||
XCTAssertTrue(((factoryObject?.dlDelegate.isEqual(self)) != nil)) | ||
XCTAssertEqual(factoryObject?.manualMode,false) | ||
} | ||
|
||
func testSEGAppsFlyerIntegrationFactory_createWithLaunchDelegateandDeepLinkDelegate_nilFlow() throws { | ||
let factoryObject = SEGAppsFlyerIntegrationFactory.create(withLaunch: nil, andDeepLinkDelegate: nil) | ||
XCTAssertNil(factoryObject?.delegate) | ||
XCTAssertNil(factoryObject?.dlDelegate) | ||
} | ||
|
||
// | ||
//createWithLaunchDelegate andManualMode | ||
// | ||
|
||
func testSEGAppsFlyerIntegrationFactory_createWithLaunchDelegateandManualMode_happyFlow() throws { | ||
var factoryObject = SEGAppsFlyerIntegrationFactory.create(withLaunch: self, andManualMode: true) | ||
XCTAssertNotNil(factoryObject?.delegate) | ||
XCTAssertNil(factoryObject?.dlDelegate) | ||
XCTAssertTrue(((factoryObject?.delegate.isEqual(self)) != nil)) | ||
XCTAssertEqual(factoryObject?.manualMode,true) | ||
factoryObject = SEGAppsFlyerIntegrationFactory.create(withLaunch: self, andManualMode: false) | ||
XCTAssertEqual(factoryObject?.manualMode,false) | ||
} | ||
|
||
// | ||
//createWithLaunchDelegate andDeepLinkDelegate andManualMode | ||
// | ||
func testSEGAppsFlyerIntegrationFactory_createWithLaunchDelegateandDeepLinkDelegateandManualMode_happyFlow() throws { | ||
let factoryObject = SEGAppsFlyerIntegrationFactory.create(withLaunch: self, andDeepLinkDelegate: self, andManualMode: true) | ||
XCTAssertNotNil(factoryObject?.delegate) | ||
XCTAssertNotNil(factoryObject?.dlDelegate) | ||
XCTAssertTrue(((factoryObject?.delegate.isEqual(self)) != nil)) | ||
XCTAssertTrue(((factoryObject?.dlDelegate.isEqual(self)) != nil)) | ||
XCTAssertEqual(factoryObject?.manualMode,true) | ||
} | ||
|
||
// | ||
//createWithSettings | ||
// | ||
func testSEGAppsFlyerIntegrationFactory_createWithSettings_happyFlow() throws { | ||
let factoryObject = SEGAppsFlyerIntegrationFactory.create(withLaunch: self, andDeepLinkDelegate: self, andManualMode: true) | ||
let integrationObject : SEGAppsFlyerIntegration = factoryObject?.create(withSettings: Dictionary(), for: Analytics()) as! SEGAppsFlyerIntegration | ||
XCTAssertNotNil(integrationObject) | ||
XCTAssertTrue(integrationObject.manualMode==true) | ||
XCTAssertTrue(integrationObject.segDelegate.isEqual(self)) | ||
XCTAssertTrue(integrationObject.segDLDelegate.isEqual(self)) | ||
} | ||
|
||
func testPerformanceExample() throws { | ||
// This is an example of a performance test case. | ||
measure { | ||
// Put the code you want to measure the time of here. | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.