Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ val configProps = Properties().apply {
val ncTestServerUsername = configProps["NC_TEST_SERVER_USERNAME"]
val ncTestServerPassword = configProps["NC_TEST_SERVER_PASSWORD"]
val ncTestServerBaseUrl = configProps["NC_TEST_SERVER_BASEURL"]
val moengageAppId = project.properties["MOENGAGE_APP_ID"]

android {
// install this NDK version and Cmake to produce smaller APKs. Build will still work if not installed
Expand All @@ -98,6 +99,8 @@ android {
targetSdk = 36
compileSdk = 36

// NMC Customization
buildConfigField("String", "MOENGAGE_APP_ID", moengageAppId.toString())
buildConfigField("boolean", "CI", ciBuild.toString())
buildConfigField("boolean", "RUNTIME_PERF_ANALYSIS", perfAnalysis.toString())

Expand Down Expand Up @@ -486,6 +489,15 @@ dependencies {
testImplementation(libs.bundles.unit.test)
// endregion

// NMC region
// core moengage features
implementation(moengage.core)
// optionally add this to use the Push Templates feature
implementation(moengage.richNotification)
// optionally add this to use the InApp feature
implementation(moengage.inapp)
// endregion

// region Mocking support
androidTestImplementation(libs.bundles.mocking)
// endregion
Expand Down Expand Up @@ -520,4 +532,7 @@ dependencies {

// kotlinx.serialization
implementation(libs.kotlinx.serialization.json)

// NMC: dependency required to capture Advertising ID for Adjust & MoEngage SDK
implementation(libs.play.services.ads.identifier)
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ class InAppReviewHelperImpl(appPreferences: AppPreferences) : InAppReviewHelper

override fun showInAppReview(activity: AppCompatActivity) {
}

override fun performNativeReview(activity: AppCompatActivity){

}
}
6 changes: 6 additions & 0 deletions app/src/gplay/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@
</intent-filter>
</service>

<!-- NMC: MoEngage Activity to handle the Rich Landing page -->
<activity
android:name="com.moe.pushlibrary.activities.MoEActivity"
android:exported="false"
android:parentActivityName=".ui.activity.FileDisplayActivity" />

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ class InAppReviewHelperImpl(val appPreferences: AppPreferences) : InAppReviewHel
}
}

override fun performNativeReview(activity: AppCompatActivity) {
doAppReview(activity)
}

private fun doAppReview(activity: AppCompatActivity) {
val manager = ReviewManagerFactory.create(activity)
val request: Task<ReviewInfo> = manager.requestReviewFlow()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import com.google.firebase.messaging.Constants.MessageNotificationKeys;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.moengage.firebase.MoEFireBaseHelper;
import com.moengage.pushbase.MoEPushHelper;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.jobs.BackgroundJobManager;
import com.nextcloud.client.jobs.NotificationWork;
Expand Down Expand Up @@ -82,6 +84,12 @@ public void handleIntent(Intent intent) {
@Override
public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
Log_OC.d(TAG, "onMessageReceived");
// NMC: check and pass the Notification payload to MoEngage to handle it
if (MoEPushHelper.getInstance().isFromMoEngagePlatform(remoteMessage.getData())) {
MoEFireBaseHelper.getInstance().passPushPayload(getApplicationContext(), remoteMessage.getData());
return;
}

final Map<String, String> data = remoteMessage.getData();
final String subject = data.get(NotificationWork.KEY_NOTIFICATION_SUBJECT);
final String signature = data.get(NotificationWork.KEY_NOTIFICATION_SIGNATURE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ class InAppReviewHelperImpl(appPreferences: AppPreferences) : InAppReviewHelper

override fun showInAppReview(activity: AppCompatActivity) {
}

override fun performNativeReview(activity: AppCompatActivity){

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,12 @@ interface InAppReviewHelper {
* once all the conditions satisfies it will trigger In-App Review manager to show the flow
*/
fun showInAppReview(activity: AppCompatActivity)

/**
* NMC customization
* method to perform direct native review without the logic of app launch count
* this will be triggered when MoEngage push comes to show native rating
* === DO NOT CALL THIS FUNCTION DIRECTLY FOR ANY OTHER USE CASE ===
*/
fun performNativeReview(activity: AppCompatActivity)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.nextcloud.client.core.Clock
import com.nextcloud.client.preferences.AppPreferences
import com.nextcloud.common.NextcloudClient
import com.owncloud.android.MainApp
import com.nmc.android.marketTracking.MoEngageSdkUtils
import com.owncloud.android.R
import com.owncloud.android.datamodel.ArbitraryDataProvider
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl
Expand Down Expand Up @@ -142,6 +143,8 @@ class AccountRemovalWork(

if (userRemoved) {
eventBus.post(AccountRemovedEvent())
// NMC: track user logout
MoEngageSdkUtils.trackUserLogout(context)
}

return Result.success()
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/com/nextcloud/utils/ShortcutUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.core.graphics.drawable.IconCompat
import androidx.core.graphics.drawable.toBitmap
import androidx.core.graphics.drawable.toDrawable
import com.nextcloud.client.account.User
import com.nmc.android.marketTracking.MoEngageSdkUtils
import com.owncloud.android.R
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.datamodel.SyncedFolderProvider
Expand Down Expand Up @@ -75,6 +76,9 @@ class ShortcutUtil @Inject constructor(private val mContext: Context) {
)

ShortcutManagerCompat.requestPinShortcut(mContext, shortcutInfo, pendingIntent.intentSender)

// NMC: track pin to home screen event
MoEngageSdkUtils.trackPinHomeScreenEvent(mContext, file)
}

private fun createShortcutIcon(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2024 Your Name <your@email.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

package com.nmc.android.marketTracking

enum class EventFileType(val fileType: String) {
PHOTO("foto"),
SCAN("scan"),
VIDEO("video"),
AUDIO("audio"),
TEXT("text"),
PDF("pdf"),
DOCUMENT("docx"),
SPREADSHEET("xlsx"),
PRESENTATION("pptx"),
OTHER("other"), // default
}

enum class EventFolderType(val folderType: String) {
ENCRYPTED("encrypted"),
NOT_ENCRYPTED("not encrypted")
}
Loading