Skip to content

Commit

Permalink
Merge pull request #96 from AppsFlyerSDK/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
morisgateno-appsflyer authored Feb 7, 2023
2 parents 56d8e5f + 4a4e8ef commit 534fa7f
Show file tree
Hide file tree
Showing 20 changed files with 1,109 additions and 40 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/responseToSupportIssue.yml
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.
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
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]}
4 changes: 2 additions & 2 deletions Cartfile
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"
4 changes: 2 additions & 2 deletions Cartfile.resolved
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"
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/AppsFlyerSDK/AppsFlyerFramework.git",
"state": {
"branch": null,
"revision": "d1349c8fdd18a80a776298e4c5c3526e22feff78",
"version": "6.8.1"
"revision": "7a3cd712a77b30e487e53102b101c5e9ff96a95e",
"version": "6.9.1"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(name: "Segment", url: "https://github.com/segmentio/analytics-ios.git" , from: "4.0.0"),
.package(name: "AppsFlyerLib" , url: "https://github.com/AppsFlyerSDK/AppsFlyerFramework.git", from: "6.8.1"),
.package(name: "AppsFlyerLib" , url: "https://github.com/AppsFlyerSDK/AppsFlyerFramework.git", .exact("6.9.1")),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
21 changes: 21 additions & 0 deletions Podfile
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
35 changes: 17 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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).

Expand All @@ -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"
```


Expand Down Expand Up @@ -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"
```

Expand All @@ -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.
Expand All @@ -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];
```
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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"

Expand All @@ -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 ()
Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -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)
Expand All @@ -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]];
```

Expand Down
122 changes: 122 additions & 0 deletions SegmentAppsFlyeriOSTests/SEGAppsFlyerIntegrationFactoryTests.swift
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.
}
}

}
Loading

0 comments on commit 534fa7f

Please sign in to comment.