forked from nextcloud/android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tealium, Adjust and MoEngage SDKs added from following branches: feat…
…ure/NMCLOUD-339 feature/NMCLOUD-177 feature/NMCLOUD-428
- Loading branch information
1 parent
028c308
commit 2514ffa
Showing
22 changed files
with
445 additions
and
2 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
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
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
67 changes: 67 additions & 0 deletions
67
app/src/main/java/com/nmc/android/marketTracking/AdjustSdkUtils.kt
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,67 @@ | ||
package com.nmc.android.marketTracking | ||
|
||
import android.app.Application | ||
import com.adjust.sdk.Adjust | ||
import com.adjust.sdk.AdjustConfig | ||
import com.adjust.sdk.AdjustEvent | ||
import com.nextcloud.client.preferences.AppPreferences | ||
import com.owncloud.android.BuildConfig | ||
|
||
object AdjustSdkUtils { | ||
private val TAG = AdjustSdkUtils::class.java.simpleName | ||
|
||
const val EVENT_TOKEN_LOGIN = "gb97gb" | ||
const val EVENT_TOKEN_SUCCESSFUL_LOGIN = "gx6g7g" | ||
const val EVENT_TOKEN_FILE_BROWSER_SHARING = "fqtiu7" | ||
const val EVENT_TOKEN_CREATE_SHARING_LINK = "qeyql3" | ||
|
||
/* event names to be tracked on clicking of FAB button which opens BottomSheet to select options */ | ||
const val EVENT_TOKEN_FAB_BOTTOM_FILE_UPLOAD = "4rd8r4" | ||
const val EVENT_TOKEN_FAB_BOTTOM_PHOTO_VIDEO_UPLOAD = "v1g6ly" | ||
const val EVENT_TOKEN_FAB_BOTTOM_DOCUMENT_SCAN = "7fec8n" | ||
const val EVENT_TOKEN_FAB_BOTTOM_CAMERA_UPLOAD = "3czack" | ||
|
||
/* events for settings screen */ | ||
const val EVENT_TOKEN_SETTINGS_LOGOUT = "g6mj9y" | ||
const val EVENT_TOKEN_SETTINGS_RESET = "zi18r0" | ||
const val EVENT_TOKEN_SETTINGS_AUTO_UPLOAD_ON = "vwd9yk" | ||
const val EVENT_TOKEN_SETTINGS_AUTO_UPLOAD_OFF = "e95w5t" | ||
|
||
const val EVENT_TOKEN_BACKUP_MANUAL = "oojr4y" | ||
const val EVENT_TOKEN_BACKUP_AUTO = "7dkhkx" | ||
|
||
@JvmStatic | ||
fun initialiseAdjustSDK(application: Application) { | ||
val config = AdjustConfig( | ||
application, BuildConfig.ADJUST_APP_TOKEN, | ||
getAdjustEnvironment() | ||
) | ||
Adjust.onCreate(config) | ||
} | ||
|
||
/** | ||
* method to return the sdk environment for Adjust | ||
*/ | ||
@JvmStatic | ||
fun getAdjustEnvironment(): String { | ||
//for qa, beta, debug apk we have to use Sandbox env | ||
if (BuildConfig.APPLICATION_ID.contains(".beta") || BuildConfig.DEBUG) { | ||
return AdjustConfig.ENVIRONMENT_SANDBOX | ||
} | ||
|
||
//for release build apart from qa, beta flavours Prod env is used | ||
return AdjustConfig.ENVIRONMENT_PRODUCTION | ||
} | ||
|
||
/** | ||
* method to track events | ||
* tracking event only if data analysis is enabled else don't track it | ||
*/ | ||
@JvmStatic | ||
fun trackEvent(eventToken: String, appPreferences: AppPreferences?) { | ||
if (appPreferences?.isDataAnalysisEnabled == true) { | ||
val adjustEvent = AdjustEvent(eventToken) | ||
Adjust.trackEvent(adjustEvent) | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
app/src/main/java/com/nmc/android/marketTracking/MoEngageSdkUtils.kt
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 @@ | ||
package com.nmc.android.marketTracking | ||
|
||
import android.app.Application | ||
import com.moengage.core.MoEngage | ||
import com.owncloud.android.BuildConfig | ||
import com.owncloud.android.R | ||
|
||
object MoEngageSdkUtils { | ||
|
||
//enable/disable moengage as we are not using it right now due to no proper firebase api key | ||
private const val MOENGAGE_ENABLED = false | ||
|
||
@JvmStatic | ||
fun initMoEngageSDK(application: Application) { | ||
if (MOENGAGE_ENABLED) { | ||
val moEngage = MoEngage.Builder(application, BuildConfig.MOENGAGE_APP_ID) | ||
.build() | ||
MoEngage.initialise(moEngage) | ||
} | ||
} | ||
} |
107 changes: 107 additions & 0 deletions
107
app/src/main/java/com/nmc/android/marketTracking/TealiumSdkUtils.kt
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,107 @@ | ||
package com.nmc.android.marketTracking | ||
|
||
import android.app.Application | ||
import com.nextcloud.client.preferences.AppPreferences | ||
import com.owncloud.android.BuildConfig | ||
import com.tealium.library.Tealium | ||
|
||
object TealiumSdkUtils { | ||
|
||
//Pre-defined values for Tealium | ||
//** DO NOT CHANGE THE VALUES **// | ||
private const val INSTANCE_NAME = "tealium_main" | ||
private const val ACCOUNT_NAME = "telekom" | ||
private const val PROFILE_NAME = "magentacloud-app" | ||
|
||
//Live Version of the app (published in app stores) | ||
private const val PROD_ENV = "prod" | ||
|
||
//Quality System | ||
private const val QA_ENV = "qa" | ||
|
||
//Staging System (Development System) | ||
private const val DEV_ENV = "dev" | ||
|
||
const val EVENT_SUCCESSFUL_LOGIN = "magentacloud-app.login.successful" | ||
const val EVENT_FILE_BROWSER_SHARING = "magentacloud-app.filebrowser.sharing" | ||
const val EVENT_CREATE_SHARING_LINK = "magentacloud-app.sharing.create" | ||
|
||
/* event names to be tracked on clicking of FAB button which opens BottomSheet to select options */ | ||
const val EVENT_FAB_BOTTOM_DOCUMENT_SCAN = "magentacloud-app.plus.documentscan" | ||
const val EVENT_FAB_BOTTOM_PHOTO_VIDEO_UPLOAD = "magentacloud-app.plus.fotovideoupload" | ||
const val EVENT_FAB_BOTTOM_FILE_UPLOAD = "magentacloud-app.plus.fileupload" | ||
const val EVENT_FAB_BOTTOM_CAMERA_UPLOAD = "magentacloud-app.plus.cameraupload" | ||
|
||
/* events for settings screen */ | ||
const val EVENT_SETTINGS_LOGOUT = "magentacloud-app.settings.logout" | ||
const val EVENT_SETTINGS_RESET = "magentacloud-app.settings.reset" | ||
const val EVENT_SETTINGS_AUTO_UPLOAD_ON = "magentacloud-app.settings.autoupload-on" | ||
const val EVENT_SETTINGS_AUTO_UPLOAD_OFF = "magentacloud-app.settings.autoupload-off" | ||
|
||
const val EVENT_BACKUP_MANUAL = "magentacloud-app.backup.manual" | ||
const val EVENT_BACKUP_AUTO = "magentacloud-app.backup.auto" | ||
|
||
/* Screen View Names to be tracked */ | ||
const val SCREEN_VIEW_LOGIN = "magentacloud-app.login" | ||
const val SCREEN_VIEW_FILE_BROWSER = "magentacloud-app.filebrowser" | ||
const val SCREEN_VIEW_FAB_PLUS = "magentacloud-app.plus" | ||
const val SCREEN_VIEW_SHARING = "magentacloud-app.sharing" | ||
const val SCREEN_VIEW_SETTINGS = "magentacloud-app.settings" | ||
const val SCREEN_VIEW_BACKUP = "magentacloud-app.backup" | ||
|
||
@JvmStatic | ||
fun initialiseTealiumSDK(application: Application) { | ||
val tealConfig = Tealium.Config.create( | ||
application, | ||
ACCOUNT_NAME, | ||
PROFILE_NAME, | ||
getTealiumEnvironment() | ||
) | ||
|
||
// Override for the tag management webview URL (mobile.html) | ||
//tealConfig.setOverrideTagManagementUrl("https://tags-eu.tiqcdn.com/utag/telekom/magentacloudapp/prod/mobile" +".html"); | ||
// Override for the tag management publish URL (compare to https://tealium.github.io/tealiumandroid/) | ||
//tealConfig.setOverrideTagManagementUrl("https://tags-eu.tiqcdn.com/utag/telekom/magentacloudapp/prod"); | ||
Tealium.createInstance(INSTANCE_NAME, tealConfig) | ||
} | ||
|
||
/** | ||
* method to return the tealium sdk environment | ||
*/ | ||
private fun getTealiumEnvironment(): String { | ||
//if flavour is qa then return the qa environment | ||
if (BuildConfig.FLAVOR == "qa") { | ||
return QA_ENV | ||
} | ||
|
||
//if flavour is versionDev or the build has debug mode then return dev environment | ||
if (BuildConfig.FLAVOR == "versionDev" || BuildConfig.DEBUG) { | ||
return DEV_ENV | ||
} | ||
|
||
//for release build to play store return prod environment | ||
return PROD_ENV | ||
} | ||
|
||
/** | ||
* method to track events | ||
* tracking event only if data analysis is enabled else don't track it | ||
*/ | ||
@JvmStatic | ||
fun trackEvent(eventName: String, appPreferences: AppPreferences?) { | ||
if (appPreferences?.isDataAnalysisEnabled == true) { | ||
Tealium.getInstance(INSTANCE_NAME).trackEvent(eventName, null) | ||
} | ||
} | ||
|
||
/** | ||
* method to track view | ||
* tracking view only if data analysis is enabled else don't track it | ||
*/ | ||
@JvmStatic | ||
fun trackView(viewName: String, appPreferences: AppPreferences?) { | ||
if (appPreferences?.isDataAnalysisEnabled == true) { | ||
Tealium.getInstance(INSTANCE_NAME).trackView(viewName, null) | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/nmc/android/marketTracking/TrackingScanInterface.kt
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,14 @@ | ||
package com.nmc.android.marketTracking | ||
|
||
import com.nextcloud.client.preferences.AppPreferences | ||
|
||
/** | ||
* interface to track the scanning events from nmc/1867-scanbot branch | ||
* for implementation look nmc/1925-market_tracking branch | ||
* this class will have the declaration for it since it has the tracking SDK's in place | ||
* since we don't have scanning functionality in this branch so to handle the event we have used interface | ||
*/ | ||
interface TrackingScanInterface { | ||
|
||
fun sendScanEvent(appPreferences: AppPreferences) | ||
} |
18 changes: 18 additions & 0 deletions
18
app/src/main/java/com/nmc/android/marketTracking/TrackingScanInterfaceImpl.kt
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 @@ | ||
package com.nmc.android.marketTracking | ||
|
||
import com.nextcloud.client.preferences.AppPreferences | ||
|
||
/** | ||
* interface impl to send the scanning events to tealium and adjust | ||
* this class will have the implementation for it since it has the tracking SDK's in place | ||
* since we don't have scanning functionality in this branch so to handle the event we have used interface | ||
* calling of this method will be done from nmc/1867-scanbot | ||
*/ | ||
class TrackingScanInterfaceImpl : TrackingScanInterface { | ||
|
||
override fun sendScanEvent(appPreferences: AppPreferences) { | ||
//track event on Scan Document button click | ||
AdjustSdkUtils.trackEvent(AdjustSdkUtils.EVENT_TOKEN_FAB_BOTTOM_DOCUMENT_SCAN, appPreferences) | ||
TealiumSdkUtils.trackEvent(TealiumSdkUtils.EVENT_FAB_BOTTOM_DOCUMENT_SCAN, appPreferences) | ||
} | ||
} |
Oops, something went wrong.