持久化通知+1

This commit is contained in:
renhaoting 2025-12-19 16:08:50 +08:00
parent d392527e4d
commit f54cb905f9
3 changed files with 18 additions and 24 deletions

View File

@ -69,6 +69,8 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
override fun ViewBinding.initViews() {
activityLauncher = ActivityLauncher(this@MainActivity)
navigatorAdapter = MainTabsAdapter(
this@MainActivity, viewPager2, fragmentStateAdapter, magicIndicator
)
@ -132,19 +134,7 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
}
override fun ViewBinding.initObservers() {
activityLauncher = ActivityLauncher(this@MainActivity)
NotificationController.requestNotificationPermissionAsAsync(
context = this@MainActivity,
lifecycleScope = lifecycleScope,
activityLauncher = activityLauncher!!,
position = "Appstart",
onGrantedOnlyUnauthorized = { isGranted->
if(isGranted){
NotificationKeepAliveServiceManager.startKeepAliveService(this@MainActivity)
}
})
checkNotifyPermissionAndStartService()
handleNotificationAction()
reportStatistics(intent, true)
}
@ -183,17 +173,6 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
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)
}
@ -215,6 +194,19 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
}
}
private fun checkNotifyPermissionAndStartService() {
NotificationController.requestNotificationPermissionAsAsync(
context = this,
lifecycleScope = lifecycleScope,
activityLauncher = activityLauncher!!,
position = "Appstart",
onGrantedOnlyUnauthorized = { isGranted->
if(isGranted){
NotificationKeepAliveServiceManager.startKeepAliveService(this)
}
})
}
private fun reportStatistics(intent: Intent, isFromNewIntent: Boolean) {
// AppOpen

View File

@ -53,6 +53,7 @@
android:layout_gravity="top"
android:scaleType="fitCenter"
android:src="@drawable/vidi_icon_close"
android:visibility="gone"
/>
</LinearLayout>

View File

@ -59,6 +59,7 @@
android:layout_gravity="top"
android:scaleType="fitCenter"
android:src="@drawable/vidi_icon_close"
android:visibility="gone"
/>
</LinearLayout>