diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a82ca87..752ab30 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -39,7 +39,17 @@ - + + + + + + + + diff --git a/app/src/main/java/com/gamedog/vididin/VidiConst.kt b/app/src/main/java/com/gamedog/vididin/VidiConst.kt index a8f7ae3..88385cd 100644 --- a/app/src/main/java/com/gamedog/vididin/VidiConst.kt +++ b/app/src/main/java/com/gamedog/vididin/VidiConst.kt @@ -4,7 +4,6 @@ object VidiConst { - /** * Varous type for watching Ad */ @@ -64,6 +63,12 @@ object VidiConst { + //------------------------ Statistics ---------------------------- + const val STATISTICS_APP_OPEN = "app_open" + const val STATISTICS_NOTIFI_CLICK = "Notific_Click" + const val STATISTICS_NOTIFI_ENTER = "Notific_Enter" + + } diff --git a/app/src/main/java/com/gamedog/vididin/features/withdraw/WithDrawActivity.kt b/app/src/main/java/com/gamedog/vididin/features/withdraw/WithDrawActivity.kt index 2631492..00461f9 100644 --- a/app/src/main/java/com/gamedog/vididin/features/withdraw/WithDrawActivity.kt +++ b/app/src/main/java/com/gamedog/vididin/features/withdraw/WithDrawActivity.kt @@ -328,6 +328,9 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity() { SpUtil.instance().putInt(SpUtil.KEY_GUIDE_HAS_SHOW, 4) } + override fun onDestroy() { + super.onDestroy() + } private fun showGuide() { HighlightPro.with(this@WithDrawActivity) diff --git a/app/src/main/java/com/gamedog/vididin/main/MainActivity.kt b/app/src/main/java/com/gamedog/vididin/main/MainActivity.kt index 40bf468..b51e495 100644 --- a/app/src/main/java/com/gamedog/vididin/main/MainActivity.kt +++ b/app/src/main/java/com/gamedog/vididin/main/MainActivity.kt @@ -15,10 +15,12 @@ import androidx.lifecycle.lifecycleScope import com.ama.core.architecture.appBase.AppViewsActivity import com.ama.core.architecture.appBase.OnFragmentBackgroundListener import com.ama.core.architecture.ext.toast +import com.ama.core.architecture.util.AndroidUtil import com.ama.core.architecture.util.SpUtil import com.ama.core.architecture.util.bindViewPager2 import com.ama.core.architecture.util.setCommonNavigator import com.ama.core.architecture.util.setDataOrAdapter +import com.blankj.utilcode.util.ActivityUtils import com.vididin.real.money.game.R import com.gamedog.vididin.VidiConst import com.gamedog.vididin.VididinEvents @@ -28,7 +30,16 @@ import com.gamedog.vididin.main.fragments.task.DailySignSuccessDialog import com.gamedog.vididin.main.interfaces.OnTabStyleListener import com.gamedog.vididin.manager.DateChangeReceiver import com.gamedog.vididin.manager.NotificationController +import com.gamedog.vididin.router.Router +import com.remax.base.report.DataReportManager import com.remax.base.utils.ActivityLauncher +import com.remax.notification.builder.LANDING_NOTIFICATION_ACTION +import com.remax.notification.builder.LANDING_NOTIFICATION_CONTENT +import com.remax.notification.builder.LANDING_NOTIFICATION_FROM +import com.remax.notification.builder.LANDING_NOTIFICATION_TITLE +import com.remax.notification.check.NotificationCheckController +import com.remax.notification.config.PushContent +import com.remax.notification.controller.NotificationLandingController import com.remax.notification.service.NotificationKeepAliveServiceManager import dagger.hilt.android.AndroidEntryPoint import kotlin.getValue @@ -133,6 +144,9 @@ class MainActivity : AppViewsActivity(), OnTabS NotificationKeepAliveServiceManager.startKeepAliveService(this@MainActivity) } }) + + handleNotificationAction() + reportStatistics(intent, true) } @@ -155,10 +169,126 @@ class MainActivity : AppViewsActivity(), OnTabS navigatorAdapter.setIsDarkFont(isDarkFont) } + override fun onNewIntent(intent: Intent) { + super.onNewIntent(intent) + setIntent(intent) + handleNotificationAction() + reportStatistics(intent, true) + } + fun switchTab(itemIndex: Int) { binding.viewPager2.setCurrentItem(itemIndex, false) } + private fun handleNotificationAction() { + if (NotificationLandingController.isFromNotification(intent)) { + when (intent.getIntExtra(LANDING_NOTIFICATION_ACTION, -1)) { + PushContent.ACTION_TYPE_SCREENSHOT_CLEAN -> { + //TYPE_PHOTO_SHOT.jumpTo(this@HomeActivity) + } + + PushContent.ACTION_TYPE_RECOVERED_FILES -> { + /*checkPermissionAndExecute(activityLauncher!!) { + val intent = Intent(this, TabLayoutActivity::class.java) + startActivity(intent) + }*/ + } + + PushContent.ACTION_TYPE_GAME -> { + AndroidUtil.openUrl(VidiConst.URL_GAME) + } + + PushContent.ACTION_TYPE_GOLD -> { + switchTab(1) + } + + PushContent.ACTION_TYPE_WITHDRAW -> { + Router.Withdraw.startActivity(this) + } + + PushContent.ACTION_TYPE_BOX -> { + Router.Benefit.startActivity(this) + } + + } + NotificationLandingController.clearNotificationParameters(intent) + } + } + + + private fun reportStatistics(intent: Intent, isFromNewIntent: Boolean) { + // AppOpen + DataReportManager.reportData( + VidiConst.STATISTICS_APP_OPEN, + mapOf( + "type" to if (ActivityUtils.isActivityExistsInStack(MainActivity::class.java)) "hot_open" else "cold_open", + "position" to if (intent.hasExtra(LANDING_NOTIFICATION_FROM)) intent.getStringExtra( + LANDING_NOTIFICATION_FROM).orEmpty().ifBlank { "other" } else "other" + )) + + // Notific_Click + if (intent.hasExtra(LANDING_NOTIFICATION_FROM)) { + val notifyFrom = intent.getStringExtra(LANDING_NOTIFICATION_FROM).orEmpty() + + DataReportManager.reportData( + VidiConst.STATISTICS_NOTIFI_CLICK, mapOf( + "Notific_Type" to when (notifyFrom) { + NotificationCheckController.NotificationType.UNLOCK.string -> 1 + NotificationCheckController.NotificationType.BACKGROUND.string -> 1 + NotificationCheckController.NotificationType.KEEPALIVE.string -> 1 + NotificationCheckController.NotificationType.FCM.string -> 3 + NotificationCheckController.NotificationType.RESIDENT.string -> 4 + else -> 4 + }, + "Notific_Position" to when (intent.getStringExtra(LANDING_NOTIFICATION_FROM).orEmpty()) { + NotificationCheckController.NotificationType.RESIDENT.string -> 2 + else -> 1 + }, + "Notific_Priority" to when (intent.getStringExtra(LANDING_NOTIFICATION_FROM).orEmpty()) { + NotificationCheckController.NotificationType.RESIDENT.string -> "PRIORITY_DEFAULT" + else -> "PRIORITY_MAX" + }, + "event_id" to when (intent.getStringExtra(LANDING_NOTIFICATION_FROM).orEmpty()) { + NotificationCheckController.NotificationType.RESIDENT.string -> "permanent" + else -> "customer_general_style" + }, + "title" to intent.getStringExtra(LANDING_NOTIFICATION_TITLE).orEmpty(), + "text" to intent.getStringExtra(LANDING_NOTIFICATION_CONTENT).orEmpty(), + "from_background" to /*!ActivityUtils.isActivityExistsInStack(HomeActivity::class.java)*/isFromNewIntent + ) + ) + + + DataReportManager.reportData( + VidiConst.STATISTICS_NOTIFI_ENTER, mapOf( + "Notific_Type" to when (intent.getStringExtra(LANDING_NOTIFICATION_FROM).orEmpty()) { + NotificationCheckController.NotificationType.UNLOCK.string -> 1 + NotificationCheckController.NotificationType.BACKGROUND.string -> 1 + NotificationCheckController.NotificationType.KEEPALIVE.string -> 1 + NotificationCheckController.NotificationType.FCM.string -> 3 + NotificationCheckController.NotificationType.RESIDENT.string -> 4 + else -> 4 + }, + "Notific_Position" to when (intent.getStringExtra(LANDING_NOTIFICATION_FROM).orEmpty()) { + NotificationCheckController.NotificationType.RESIDENT.string -> 2 + else -> 1 + }, + "Notific_Priority" to when (intent.getStringExtra(LANDING_NOTIFICATION_FROM).orEmpty()) { + NotificationCheckController.NotificationType.RESIDENT.string -> "PRIORITY_DEFAULT" + else -> "PRIORITY_MAX" + }, + "event_id" to when (intent.getStringExtra(LANDING_NOTIFICATION_FROM).orEmpty()) { + NotificationCheckController.NotificationType.RESIDENT.string -> "permanent" + else -> "customer_general_style" + }, + "title" to intent.getStringExtra(LANDING_NOTIFICATION_TITLE).orEmpty(), + "text" to intent.getStringExtra(LANDING_NOTIFICATION_CONTENT).orEmpty(), + ) + ) + } + } + + companion object { internal fun startActivity(activity: Activity) { diff --git a/notification/src/main/java/com/remax/notification/builder/NotificationDataFactory.kt b/notification/src/main/java/com/remax/notification/builder/NotificationDataFactory.kt index 6b91949..35df83b 100644 --- a/notification/src/main/java/com/remax/notification/builder/NotificationDataFactory.kt +++ b/notification/src/main/java/com/remax/notification/builder/NotificationDataFactory.kt @@ -24,7 +24,9 @@ import kotlin.random.Random enum class NotificationType { GENERAL, RESIDENT, RESIDENT_RESTORED, RESIDENT_RESTORED_FILE, - WIDGET_SCREENSHOT_CLEAN,WIDGET_PHOTO_RECOVERY,WIDGET_PHOTO_DOCUMENT + WIDGET_SCREENSHOT_CLEAN,WIDGET_PHOTO_RECOVERY,WIDGET_PHOTO_DOCUMENT, + // new + RESIDENT_GOLD, RESIDENT_WITHDRAW, RESIDENT_BOX, RESIDENT_GAME, } val type2notificationId = mapOf( @@ -35,6 +37,13 @@ val type2notificationId = mapOf( NotificationType.WIDGET_SCREENSHOT_CLEAN to 10004, NotificationType.WIDGET_PHOTO_RECOVERY to 10005, NotificationType.WIDGET_PHOTO_DOCUMENT to 10006, + + + // new + NotificationType.RESIDENT_GOLD to 20001, + NotificationType.RESIDENT_WITHDRAW to 20002, + NotificationType.RESIDENT_BOX to 20003, + NotificationType.RESIDENT_GAME to 20004, ) val LANDING_NOTIFICATION_ID = "landing_notification_id" @@ -281,47 +290,33 @@ class ResidentModelManger { context.packageName, R.layout.layout_notification_resident_12, R.layout.layout_notification_resident - ) - .setViewVisible(R.id.ivPoint, shouldShowRedPoint(context)) - .setTextViewText( - R.id.files, - StringUtils.getString( - R.string.noti_restore_file_count, - getRecoveredFileCount(context).toString() - ) - ) - .setTextViewText( - R.id.restored, - StringUtils.getString( - R.string.noti_restored - ) - ) - .setTextViewText( - R.id.restore_file, - StringUtils.getString( - R.string.noti_restore_file - ) - ) + ).setOnClickPendingIntent( + R.id.resident_gold, entryPointPendingIntent(context, + type2notificationId[NotificationType.RESIDENT_GOLD] ?: 0 + ) { + it.putExtra(LANDING_NOTIFICATION_ACTION, PushContent.ACTION_TYPE_GOLD) + it.putExtra(LANDING_NOTIFICATION_FROM, NotificationCheckController.NotificationType.RESIDENT.string) + }) .setOnClickPendingIntent( - R.id.llRestored, entryPointPendingIntent( - context, - type2notificationId[NotificationType.RESIDENT_RESTORED] ?: 0 + R.id.resident_withdraw, entryPointPendingIntent(context, + type2notificationId[NotificationType.RESIDENT_WITHDRAW] ?: 0 ) { - it.putExtra( - LANDING_NOTIFICATION_ACTION, - PushContent.ACTION_TYPE_RECOVERED_FILES - ) + it.putExtra(LANDING_NOTIFICATION_ACTION, PushContent.ACTION_TYPE_WITHDRAW) it.putExtra(LANDING_NOTIFICATION_FROM, NotificationCheckController.NotificationType.RESIDENT.string) }) .setOnClickPendingIntent( - R.id.llRestoreFiles, entryPointPendingIntent( - context, - type2notificationId[NotificationType.RESIDENT_RESTORED_FILE] ?: 0 + R.id.resident_box, entryPointPendingIntent(context, + type2notificationId[NotificationType.RESIDENT_BOX] ?: 0 ) { - it.putExtra( - LANDING_NOTIFICATION_ACTION, - PushContent.ACTION_TYPE_DOCUMENT_RECOVERY - ) + it.putExtra(LANDING_NOTIFICATION_ACTION, PushContent.ACTION_TYPE_BOX) + it.putExtra(LANDING_NOTIFICATION_FROM, NotificationCheckController.NotificationType.RESIDENT.string) + }) + + .setOnClickPendingIntent( + R.id.resident_game, entryPointPendingIntent(context, + type2notificationId[NotificationType.RESIDENT_GAME] ?: 0 + ) { + it.putExtra(LANDING_NOTIFICATION_ACTION, PushContent.ACTION_TYPE_GAME) it.putExtra(LANDING_NOTIFICATION_FROM, NotificationCheckController.NotificationType.RESIDENT.string) }) .build() diff --git a/notification/src/main/java/com/remax/notification/config/PushContent.kt b/notification/src/main/java/com/remax/notification/config/PushContent.kt index 09aaeb1..3d0336f 100644 --- a/notification/src/main/java/com/remax/notification/config/PushContent.kt +++ b/notification/src/main/java/com/remax/notification/config/PushContent.kt @@ -56,6 +56,13 @@ data class PushContent( const val ACTION_TYPE_SCREENSHOT_CLEAN = 5 // 跳转截图清理 界面 const val ACTION_TYPE_RECOVERED_FILES = 6 // 跳转已恢复文件列表 界面 + // new --- + const val ACTION_TYPE_GOLD = 101 + const val ACTION_TYPE_WITHDRAW = 102 + const val ACTION_TYPE_BOX = 103 + const val ACTION_TYPE_GAME = 104 + + /** * 根据动作类型获取对应的图标类型 */ diff --git a/notification/src/main/java/com/remax/notification/provider/NotificationProvider.kt b/notification/src/main/java/com/remax/notification/provider/NotificationProvider.kt index cfaa844..84bae4d 100644 --- a/notification/src/main/java/com/remax/notification/provider/NotificationProvider.kt +++ b/notification/src/main/java/com/remax/notification/provider/NotificationProvider.kt @@ -11,7 +11,6 @@ import com.remax.notification.controller.NotificationTriggerController import com.remax.notification.timing.NotificationTimingController import com.remax.notification.check.NotificationCheckController import com.remax.notification.service.NotificationKeepAliveService -import com.remax.notification.service.NotificationKeepAliveServiceManager import com.remax.notification.utils.ResetAtMidnightController import com.remax.notification.utils.NotiLogger diff --git a/notification/src/main/java/com/remax/notification/utils/NotificationRemoteViewsBuilder.kt b/notification/src/main/java/com/remax/notification/utils/NotificationRemoteViewsBuilder.kt index 77279b2..f0286aa 100644 --- a/notification/src/main/java/com/remax/notification/utils/NotificationRemoteViewsBuilder.kt +++ b/notification/src/main/java/com/remax/notification/utils/NotificationRemoteViewsBuilder.kt @@ -40,28 +40,12 @@ class NotificationRemoteViewsBuilder( return this } - fun setImageViewBitmap(viewId: Int, bitmap: Bitmap): NotificationRemoteViewsBuilder { - remoteViews.setImageViewBitmap(viewId, bitmap) - return this - } - - fun setImageViewUri(viewId: Int, uri: Uri): NotificationRemoteViewsBuilder { - remoteViews.setImageViewUri(viewId, uri) - return this - } fun setOnClickPendingIntent(viewId: Int, pendingIntent: PendingIntent): NotificationRemoteViewsBuilder { remoteViews.setOnClickPendingIntent(viewId, pendingIntent) return this } - fun setProgressBar( - viewId: Int, max: Int, progress: Int, indeterminate: Boolean - ): NotificationRemoteViewsBuilder { - remoteViews.setProgressBar(viewId, max, progress, indeterminate) - return this - } - fun build(): RemoteViews { return remoteViews } diff --git a/notification/src/main/res/drawable/vidi_benefit_item_ongoing.webp b/notification/src/main/res/drawable/vidi_benefit_item_ongoing.webp new file mode 100644 index 0000000..826b187 Binary files /dev/null and b/notification/src/main/res/drawable/vidi_benefit_item_ongoing.webp differ diff --git a/notification/src/main/res/drawable/vidi_icon_close.webp b/notification/src/main/res/drawable/vidi_icon_close.webp new file mode 100644 index 0000000..082a489 Binary files /dev/null and b/notification/src/main/res/drawable/vidi_icon_close.webp differ diff --git a/notification/src/main/res/drawable/vidi_task_act_game.webp b/notification/src/main/res/drawable/vidi_task_act_game.webp new file mode 100644 index 0000000..91ae6bf Binary files /dev/null and b/notification/src/main/res/drawable/vidi_task_act_game.webp differ diff --git a/notification/src/main/res/drawable/vidi_task_cash.webp b/notification/src/main/res/drawable/vidi_task_cash.webp new file mode 100644 index 0000000..f93372c Binary files /dev/null and b/notification/src/main/res/drawable/vidi_task_cash.webp differ diff --git a/notification/src/main/res/drawable/vidi_task_gold.webp b/notification/src/main/res/drawable/vidi_task_gold.webp new file mode 100644 index 0000000..1775be7 Binary files /dev/null and b/notification/src/main/res/drawable/vidi_task_gold.webp differ diff --git a/notification/src/main/res/layout/layout_notification_resident.xml b/notification/src/main/res/layout/layout_notification_resident.xml index 6e66f50..f748b33 100644 --- a/notification/src/main/res/layout/layout_notification_resident.xml +++ b/notification/src/main/res/layout/layout_notification_resident.xml @@ -1,109 +1,59 @@ - + tools:ignore="ResourceName"> - + android:scaleType="fitCenter" + android:src="@drawable/vidi_task_gold" + /> - - - - - - - - - - - - - - - - + android:scaleType="fitCenter" + android:src="@drawable/vidi_task_cash" + /> - + - - - - - - - - - - - + + diff --git a/notification/src/main/res/layout/layout_notification_resident_12.xml b/notification/src/main/res/layout/layout_notification_resident_12.xml index 82a58a1..68de98f 100644 --- a/notification/src/main/res/layout/layout_notification_resident_12.xml +++ b/notification/src/main/res/layout/layout_notification_resident_12.xml @@ -3,106 +3,63 @@ + android:orientation="horizontal" + tools:ignore="ResourceName"> - + android:scaleType="fitCenter" + android:src="@drawable/vidi_task_gold" + /> - - - - - - - - - - - - - - - - + android:scaleType="fitCenter" + android:src="@drawable/vidi_task_cash" + /> - + - - - - - - - - - - - + + diff --git a/notification/src/main/res/mipmap-xxhdpi/benefit_item_ongoing.webp b/notification/src/main/res/mipmap-xxhdpi/benefit_item_ongoing.webp new file mode 100644 index 0000000..826b187 Binary files /dev/null and b/notification/src/main/res/mipmap-xxhdpi/benefit_item_ongoing.webp differ diff --git a/notification/src/main/res/mipmap-xxhdpi/icon_close.webp b/notification/src/main/res/mipmap-xxhdpi/icon_close.webp new file mode 100644 index 0000000..082a489 Binary files /dev/null and b/notification/src/main/res/mipmap-xxhdpi/icon_close.webp differ diff --git a/notification/src/main/res/mipmap-xxhdpi/task_act_game.webp b/notification/src/main/res/mipmap-xxhdpi/task_act_game.webp new file mode 100644 index 0000000..91ae6bf Binary files /dev/null and b/notification/src/main/res/mipmap-xxhdpi/task_act_game.webp differ diff --git a/notification/src/main/res/mipmap-xxhdpi/task_cash.webp b/notification/src/main/res/mipmap-xxhdpi/task_cash.webp new file mode 100644 index 0000000..f93372c Binary files /dev/null and b/notification/src/main/res/mipmap-xxhdpi/task_cash.webp differ diff --git a/notification/src/main/res/mipmap-xxhdpi/task_gold.webp b/notification/src/main/res/mipmap-xxhdpi/task_gold.webp new file mode 100644 index 0000000..1775be7 Binary files /dev/null and b/notification/src/main/res/mipmap-xxhdpi/task_gold.webp differ