Skip to content

Commit

Permalink
NMC 1998 Tracking tealium adjust setup
Browse files Browse the repository at this point in the history
  • Loading branch information
TSI-shwetawaikar authored and TSI-amrutwaghmare committed Aug 27, 2024
1 parent 7a4bb44 commit f59ae0c
Show file tree
Hide file tree
Showing 9 changed files with 1,266 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Expand Down
19 changes: 19 additions & 0 deletions iOSClient/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
var timerErrorNetworking: Timer?
var timerErrorNetworkingDisabled: Bool = false
var taskAutoUploadDate: Date = Date()
@objc let adjust = AdjustHelper()
var isUiTestingEnabled: Bool {
return ProcessInfo.processInfo.arguments.contains("UI_TESTING")
}
Expand Down Expand Up @@ -148,6 +149,24 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
self.handleProcessingTask(task)
}

if account.isEmpty {
if NCBrandOptions.shared.disable_intro {
openLogin(viewController: nil, selector: NCGlobal.shared.introLogin, openLoginWeb: false)
} else {
if let viewController = UIStoryboard(name: "NCIntro", bundle: nil).instantiateInitialViewController() {
let navigationController = NCLoginNavigationController(rootViewController: viewController)
window?.rootViewController = navigationController
window?.makeKeyAndVisible()
}
}
} else {
NCPasscode.shared.presentPasscode(delegate: self) {
NCPasscode.shared.enableTouchFaceID()
}
}
adjust.configAdjust()
adjust.subsessionStart()
TealiumHelper.shared.start()
return true
}

Expand Down
47 changes: 47 additions & 0 deletions iOSClient/Helper/AdjustHelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// AdjustHelper.h
// Nextcloud
//
// Created by A200073704 on 17/05/23.
// Copyright © 2023 Marino Faggiana. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Adjust.h>

NS_ASSUME_NONNULL_BEGIN

typedef enum : NSUInteger {
Login,
LoginSuccessful,
Sharing,
CreateLink,
DocumentScan,
CameraUpload,
FileUpload,
UseCamera,
Logout,
ResetsApp,
AutomaticUploadPhotosOn,
AutomaticUploadPhotosOff,
ManualBackup,
AutomaticBackup
} TriggerEvent;

@interface AdjustHelper : NSObject

@property (nonatomic, strong) NSString *yourAppToken;
@property (nonatomic, strong) NSString *environment;
@property (nonatomic, strong) ADJConfig *adjustConfig;
@property (nonatomic, strong) ADJEvent *eventLogin;
@property (nonatomic, strong) ADJEvent *event;
@property (nonatomic, assign) TriggerEvent triggerEvent;

-(void)configAdjust;
-(void)subsessionEnd;
-(void)subsessionStart;
-(void)trackLogin;
-(void)trackEvent:(TriggerEvent)event;

@end

NS_ASSUME_NONNULL_END
153 changes: 153 additions & 0 deletions iOSClient/Helper/AdjustHelper.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
//
// AdjustHelper.m
// Nextcloud
//
// Created by A200073704 on 17/05/23.
// Copyright © 2023 Marino Faggiana. All rights reserved.
//

#import "AdjustHelper.h"
//#import <AdjustSdk/AdjustSdk.h>

@implementation AdjustHelper

-(void)configAdjust {
self.yourAppToken = @"1zfaxn19pd7k";
self.environment = ADJEnvironmentProduction;
self.adjustConfig = [ADJConfig configWithAppToken:self.yourAppToken
environment:self.environment];
[self.adjustConfig setLogLevel:ADJLogLevelVerbose];
[Adjust appDidLaunch:self.adjustConfig];
}

-(void)subsessionEnd {
[Adjust trackSubsessionEnd];
}

-(void)subsessionStart {
[Adjust trackSubsessionStart];
}

- (void)trackLogin {
self.eventLogin = [ADJEvent eventWithEventToken:@"p8hl78"];
[Adjust trackEvent: self.eventLogin];
}

-(void)trackEvent:(TriggerEvent)event {
// self.event = [ADJEvent eventWithEventToken:@"gb97gb"];
BOOL track = [[NSUserDefaults standardUserDefaults] valueForKey:@"isAnalysisDataCollectionSwitchOn"];
if (!track) {
return;
}

switch(event){
case Login:
{
ADJEvent *event = [ADJEvent eventWithEventToken:@"p8hl78"];
// event = [ADJEvent eventWithEventToken:@"gb97gb"];
// self.event = [ADJEvent eventWithEventToken:@"gb97gb"];
[Adjust trackEvent:event];
}
break;
case LoginSuccessful:
{
ADJEvent *event = [ADJEvent eventWithEventToken:@"dowf81"];
// event = [ADJEvent eventWithEventToken:@"gb97gb"];
// self.event = [ADJEvent eventWithEventToken:@"gb97gb"];
[Adjust trackEvent:event];
}
break;
case Sharing:
{
ADJEvent *event = [ADJEvent eventWithEventToken:@"mbeoyd"];
[Adjust trackEvent:event];
NSLog(@"%@", [event debugDescription]);
}
// self.event = [ADJEvent eventWithEventToken:@"fqtiu7"];
break;
case CreateLink:
{
ADJEvent *event = [ADJEvent eventWithEventToken:@"29b333"];
[Adjust trackEvent:event];
}
// self.event = [ADJEvent eventWithEventToken:@"qeyql3"];
break;
case DocumentScan:
{
ADJEvent *event = [ADJEvent eventWithEventToken:@"im963g"];
[Adjust trackEvent:event];
}
// self.event = [ADJEvent eventWithEventToken:@"7fec8n"];
break;
case CameraUpload:
{
ADJEvent *event = [ADJEvent eventWithEventToken:@"hf9paq"];
[Adjust trackEvent:event];
}
// self.event = [ADJEvent eventWithEventToken:@"v1g6ly"];
break;
case FileUpload:
{
ADJEvent *event = [ADJEvent eventWithEventToken:@"hsbk2m"];
[Adjust trackEvent:event];
}
// self.event = [ADJEvent eventWithEventToken:@"4rd8r4"];
break;
case UseCamera:
{
ADJEvent *event = [ADJEvent eventWithEventToken:@"3czack"];
[Adjust trackEvent:event];
}
// self.event = [ADJEvent eventWithEventToken:@"3czack"];
break;
case Logout:
{
ADJEvent *event = [ADJEvent eventWithEventToken:@"n5q2qu"];
[Adjust trackEvent:event];
}
// self.event = [ADJEvent eventWithEventToken:@"g6mj9y"];
break;
case ResetsApp:
{
ADJEvent *event = [ADJEvent eventWithEventToken:@"3sj1xp"];
[Adjust trackEvent:event];
}
// self.event = [ADJEvent eventWithEventToken:@"zi18r0"];
break;
case AutomaticUploadPhotosOn:
{
ADJEvent *event = [ADJEvent eventWithEventToken:@"5lxz6h"];
[Adjust trackEvent:event];
}
// self.event = [ADJEvent eventWithEventToken:@"vwd9yk"];
break;
case AutomaticUploadPhotosOff:
{
ADJEvent *event = [ADJEvent eventWithEventToken:@"176496"];
[Adjust trackEvent:event];
}
// self.event = [ADJEvent eventWithEventToken:@"e95w5t"];
break;
case ManualBackup:
{
ADJEvent *event = [ADJEvent eventWithEventToken:@"oojr4y"];
[Adjust trackEvent:event];
}
// self.event = [ADJEvent eventWithEventToken:@"oojr4y"];
break;
case AutomaticBackup:
{
ADJEvent *event = [ADJEvent eventWithEventToken:@"7dkhkx"];
[Adjust trackEvent:event];
}
// self.event = [ADJEvent eventWithEventToken:@"7dkhkx"];
break;

default :
break;
}
// [Adjust trackEvent: self.event];
}

@end

56 changes: 56 additions & 0 deletions iOSClient/Helper/TealiumHelper.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// TealiumHelper.swift
// Nextcloud
//
// Created by A200073704 on 17/05/23.
// Copyright © 2023 Marino Faggiana. All rights reserved.
//
import TealiumCore
import TealiumLifecycle
import TealiumAutotracking
import TealiumLocation
import TealiumRemoteCommands
import TealiumTagManagement
import TealiumVisitorService
import Foundation

class TealiumHelper: NSObject {
static let shared = TealiumHelper()
let config = TealiumConfig(account: "telekom",
profile: "magentacloud-app",
environment: "dev")
var tealium: Tealium?

@objc override init() {

config.batchingEnabled = true
config.logLevel = .debug

config.collectors = [Collectors.Lifecycle,
Collectors.Location,
Collectors.VisitorService]

config.dispatchers = [Dispatchers.TagManagement,
Dispatchers.RemoteCommands]

tealium = Tealium(config: config, enableCompletion: {value in
print(value)
}
)
}

func start() {
_ = TealiumHelper.shared
}

@objc func trackView(title: String, data: [String: Any]?) {
let tealView = TealiumView(title, dataLayer: data)
TealiumHelper.shared.tealium?.track(tealView)
}

@objc func trackEvent(title: String, data: [String: Any]?) {
let tealEvent = TealiumEvent(title, dataLayer: data)
TealiumHelper.shared.tealium?.track(tealEvent)
}
}

1 change: 1 addition & 0 deletions iOSClient/Nextcloud-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
#import "NYMnemonic.h"
#import "UIImage+animatedGIF.h"
#import "NCPushNotificationEncryption.h"
#import "AdjustHelper.h"
Loading

0 comments on commit f59ae0c

Please sign in to comment.