Skip to content

Commit cda3092

Browse files
committed
MoEngage functionality
1 parent 93fd21e commit cda3092

File tree

33 files changed

+952
-2
lines changed

33 files changed

+952
-2
lines changed

app/build.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ apply plugin: "com.google.devtools.ksp"
5353

5454

5555
println "Gradle uses Java ${Jvm.current()}"
56-
56+
// apply MoEngage SDK for NMC
57+
apply from: "$rootProject.projectDir/nmc_moengage-dependencies.gradle"
5758
configurations {
5859
configureEach {
5960
exclude group: "org.jetbrains", module: "annotations-java5" // via prism4j, already using annotations explicitly
@@ -118,6 +119,8 @@ android {
118119
targetSdk = 35
119120
compileSdk = 35
120121

122+
// NMC Customization
123+
buildConfigField "String", "MOENGAGE_APP_ID", "${MOENGAGE_APP_ID}"
121124
buildConfigField "boolean", "CI", ciBuild.toString()
122125
buildConfigField "boolean", "RUNTIME_PERF_ANALYSIS", perfAnalysis.toString()
123126

@@ -496,6 +499,9 @@ dependencies {
496499
// region Image loading
497500
implementation libs.coil
498501
// endregion
502+
503+
// NMC: dependency required to capture Advertising ID for Adjust & MoEngage SDK
504+
implementation "com.google.android.gms:play-services-ads-identifier:18.0.1"
499505
}
500506

501507

app/src/generic/java/com/nextcloud/android/appReview/InAppReviewHelperImpl.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ class InAppReviewHelperImpl(appPreferences: AppPreferences) : InAppReviewHelper
1717

1818
override fun showInAppReview(activity: AppCompatActivity) {
1919
}
20+
21+
override fun performNativeReview(activity: AppCompatActivity){
22+
23+
}
2024
}

app/src/gplay/AndroidManifest.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@
6565
</intent-filter>
6666
</service>
6767

68+
<!-- NMC: MoEngage Activity to handle the Rich Landing page -->
69+
<activity
70+
android:name="com.moe.pushlibrary.activities.MoEActivity"
71+
android:exported="false"
72+
android:parentActivityName=".ui.activity.FileDisplayActivity" />
73+
6874
</application>
6975

7076
</manifest>

app/src/gplay/java/com/nextcloud/android/appReview/InAppReviewHelperImpl.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ class InAppReviewHelperImpl(val appPreferences: AppPreferences) : InAppReviewHel
7070
}
7171
}
7272

73+
override fun performNativeReview(activity: AppCompatActivity) {
74+
doAppReview(activity)
75+
}
76+
7377
private fun doAppReview(activity: AppCompatActivity) {
7478
val manager = ReviewManagerFactory.create(activity)
7579
val request: Task<ReviewInfo> = manager.requestReviewFlow()

app/src/gplay/java/com/owncloud/android/services/firebase/NCFirebaseMessagingService.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import com.google.firebase.messaging.Constants.MessageNotificationKeys;
1414
import com.google.firebase.messaging.FirebaseMessagingService;
1515
import com.google.firebase.messaging.RemoteMessage;
16+
import com.moengage.firebase.MoEFireBaseHelper;
17+
import com.moengage.pushbase.MoEPushHelper;
1618
import com.nextcloud.client.account.UserAccountManager;
1719
import com.nextcloud.client.jobs.BackgroundJobManager;
1820
import com.nextcloud.client.jobs.NotificationWork;
@@ -82,6 +84,12 @@ public void handleIntent(Intent intent) {
8284
@Override
8385
public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
8486
Log_OC.d(TAG, "onMessageReceived");
87+
// NMC: check and pass the Notification payload to MoEngage to handle it
88+
if (MoEPushHelper.getInstance().isFromMoEngagePlatform(remoteMessage.getData())) {
89+
MoEFireBaseHelper.getInstance().passPushPayload(getApplicationContext(), remoteMessage.getData());
90+
return;
91+
}
92+
8593
final Map<String, String> data = remoteMessage.getData();
8694
final String subject = data.get(NotificationWork.KEY_NOTIFICATION_SUBJECT);
8795
final String signature = data.get(NotificationWork.KEY_NOTIFICATION_SIGNATURE);

app/src/huawei/java/com/nextcloud/android/appReview/InAppReviewHelperImpl.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ class InAppReviewHelperImpl(appPreferences: AppPreferences) : InAppReviewHelper
1717

1818
override fun showInAppReview(activity: AppCompatActivity) {
1919
}
20+
21+
override fun performNativeReview(activity: AppCompatActivity){
22+
23+
}
2024
}

app/src/main/java/com/nextcloud/appReview/InAppReviewHelper.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,12 @@ interface InAppReviewHelper {
3030
* once all the conditions satisfies it will trigger In-App Review manager to show the flow
3131
*/
3232
fun showInAppReview(activity: AppCompatActivity)
33+
34+
/**
35+
* NMC customization
36+
* method to perform direct native review without the logic of app launch count
37+
* this will be triggered when MoEngage push comes to show native rating
38+
* === DO NOT CALL THIS FUNCTION DIRECTLY FOR ANY OTHER USE CASE ===
39+
*/
40+
fun performNativeReview(activity: AppCompatActivity)
3341
}

app/src/main/java/com/nextcloud/client/jobs/AccountRemovalWork.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import com.nextcloud.client.core.Clock
2323
import com.nextcloud.client.preferences.AppPreferences
2424
import com.nextcloud.common.NextcloudClient
2525
import com.owncloud.android.MainApp
26+
import com.nmc.android.marketTracking.MoEngageSdkUtils
2627
import com.owncloud.android.R
2728
import com.owncloud.android.datamodel.ArbitraryDataProvider
2829
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl
@@ -142,6 +143,8 @@ class AccountRemovalWork(
142143

143144
if (userRemoved) {
144145
eventBus.post(AccountRemovedEvent())
146+
// NMC: track user logout
147+
MoEngageSdkUtils.trackUserLogout(context)
145148
}
146149

147150
return Result.success()

app/src/main/java/com/nextcloud/utils/ShortcutUtil.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import androidx.core.graphics.drawable.IconCompat
2222
import androidx.core.graphics.drawable.toBitmap
2323
import androidx.core.graphics.drawable.toDrawable
2424
import com.nextcloud.client.account.User
25+
import com.nmc.android.marketTracking.MoEngageSdkUtils
2526
import com.owncloud.android.R
2627
import com.owncloud.android.datamodel.OCFile
2728
import com.owncloud.android.datamodel.SyncedFolderProvider
@@ -92,6 +93,9 @@ class ShortcutUtil @Inject constructor(private val mContext: Context) {
9293
pinShortcutInfo,
9394
successCallback.intentSender
9495
)
96+
97+
// NMC: track pin to home screen event
98+
MoEngageSdkUtils.trackPinHomeScreenEvent(mContext, file)
9599
}
96100
}
97101

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Nextcloud - Android Client
3+
*
4+
* SPDX-FileCopyrightText: 2024 Your Name <your@email.com>
5+
* SPDX-License-Identifier: AGPL-3.0-or-later
6+
*/
7+
8+
package com.nmc.android.marketTracking
9+
10+
enum class EventFileType(val fileType: String) {
11+
PHOTO("foto"),
12+
SCAN("scan"),
13+
VIDEO("video"),
14+
AUDIO("audio"),
15+
TEXT("text"),
16+
PDF("pdf"),
17+
DOCUMENT("docx"),
18+
SPREADSHEET("xlsx"),
19+
PRESENTATION("pptx"),
20+
OTHER("other"), // default
21+
}
22+
23+
enum class EventFolderType(val folderType: String) {
24+
ENCRYPTED("encrypted"),
25+
NOT_ENCRYPTED("not encrypted")
26+
}

0 commit comments

Comments
 (0)