Skip to content

Commit 0094aaa

Browse files
authored
AppsFlyer integration (#326)
* initial appsflyer integration * Changed app id * now it compiles
1 parent d4ee433 commit 0094aaa

File tree

6 files changed

+21
-9
lines changed

6 files changed

+21
-9
lines changed

Podfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ def all_pods
3535

3636
pod 'Amplitude-iOS', '~> 4.0.4'
3737

38+
pod 'AppsFlyerFramework'
39+
3840
pod 'BEMCheckBox'
3941

4042
# actual version - 6.x, we should test it before update

Stepic/AnalyticsHelper.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import FirebaseCore
1212
import YandexMobileMetrica
1313
import Crashlytics
1414
import Amplitude_iOS
15+
import AppsFlyerLib
1516

1617
class AnalyticsHelper {
1718
static var sharedHelper = AnalyticsHelper()
@@ -26,5 +27,8 @@ class AnalyticsHelper {
2627
}
2728

2829
Amplitude.instance().initializeApiKey(Tokens.shared.amplitudeToken)
30+
31+
AppsFlyerTracker.shared().appsFlyerDevKey = Tokens.shared.appsFlyerDevKey
32+
AppsFlyerTracker.shared().appleAppID = "\(Tokens.shared.firebaseId)"
2933
}
3034
}

Stepic/AppDelegate.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import YandexMobileMetrica
2020
import Presentr
2121
import SwiftyJSON
2222
import PromiseKit
23+
import AppsFlyerLib
2324

2425
@UIApplicationMain
2526
class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -275,6 +276,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
275276
func applicationDidBecomeActive(_ application: UIApplication) {
276277
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
277278
NotificationsBadgesManager.shared.set(number: application.applicationIconBadgeNumber)
279+
AppsFlyerTracker.shared().trackAppLaunch()
278280
}
279281

280282
// @available(iOS 8.0, *)

Stepic/Base.lproj/Main.storyboard

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="0uJ-IX-W04">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="0uJ-IX-W04">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
7-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
7+
<deployment identifier="iOS"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
89
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
910
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
1011
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -294,11 +295,11 @@
294295
<objects>
295296
<viewController storyboardIdentifier="UnitsViewController" id="8ik-tt-HOc" customClass="UnitsViewController" customModule="Adaptive_1838" customModuleProvider="target" sceneMemberID="viewController">
296297
<view key="view" contentMode="scaleToFill" id="eEo-OZ-NVq">
297-
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
298+
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/>
298299
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
299300
<subviews>
300301
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Q7F-3H-ipp" customClass="StepikTableView" customModule="Adaptive_1838" customModuleProvider="target">
301-
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
302+
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/>
302303
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
303304
<connections>
304305
<outlet property="dataSource" destination="8ik-tt-HOc" id="d6o-oi-Nnu"/>
@@ -331,7 +332,7 @@
331332
<objects>
332333
<viewController storyboardIdentifier="LessonViewController" id="7LO-Mv-R4f" customClass="LessonViewController" customModule="Adaptive_1838" customModuleProvider="target" sceneMemberID="viewController">
333334
<view key="view" contentMode="scaleToFill" id="18x-Lc-xSo">
334-
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
335+
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/>
335336
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
336337
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
337338
<viewLayoutGuide key="safeArea" id="7Xi-cu-L5v"/>

Stepic/Tokens.plist

63 Bytes
Binary file not shown.

Stepic/Tokens.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@ class Tokens {
1313
var amplitudeToken: String = ""
1414
var appMetricaToken: String = ""
1515
var firebaseId: UInt = 0
16-
16+
var appsFlyerDevKey: String = ""
17+
1718
static let shared = Tokens()
1819

1920
private convenience init() {
2021
self.init(plist: "Tokens")!
2122
}
2223

23-
private init(amplitudeToken: String, appMetricaToken: String, firebaseId: UInt) {
24+
private init(amplitudeToken: String, appMetricaToken: String, firebaseId: UInt, appsFlyerDevKey: String) {
2425
self.amplitudeToken = amplitudeToken
2526
self.appMetricaToken = appMetricaToken
2627
self.firebaseId = firebaseId
28+
self.appsFlyerDevKey = appsFlyerDevKey
2729
}
2830

2931
private convenience init?(plist: String) {
@@ -36,10 +38,11 @@ class Tokens {
3638
}
3739
guard let amplitude = dic["Amplitude"] as? String,
3840
let appmetrica = dic["AppMetrica"] as? String,
39-
let firebase = dic["FirebaseAppID"] as? UInt else {
41+
let firebase = dic["FirebaseAppID"] as? UInt,
42+
let appsFlyer = dic["AppsFlyer"] as? String else {
4043
return nil
4144
}
42-
self.init(amplitudeToken: amplitude, appMetricaToken: appmetrica, firebaseId: firebase)
45+
self.init(amplitudeToken: amplitude, appMetricaToken: appmetrica, firebaseId: firebase, appsFlyerDevKey: appsFlyer)
4346
}
4447

4548
}

0 commit comments

Comments
 (0)