持久化通知+1
This commit is contained in:
parent
d392527e4d
commit
f54cb905f9
|
|
@ -69,6 +69,8 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
|
||||||
|
|
||||||
|
|
||||||
override fun ViewBinding.initViews() {
|
override fun ViewBinding.initViews() {
|
||||||
|
activityLauncher = ActivityLauncher(this@MainActivity)
|
||||||
|
|
||||||
navigatorAdapter = MainTabsAdapter(
|
navigatorAdapter = MainTabsAdapter(
|
||||||
this@MainActivity, viewPager2, fragmentStateAdapter, magicIndicator
|
this@MainActivity, viewPager2, fragmentStateAdapter, magicIndicator
|
||||||
)
|
)
|
||||||
|
|
@ -132,19 +134,7 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun ViewBinding.initObservers() {
|
override fun ViewBinding.initObservers() {
|
||||||
activityLauncher = ActivityLauncher(this@MainActivity)
|
checkNotifyPermissionAndStartService()
|
||||||
|
|
||||||
NotificationController.requestNotificationPermissionAsAsync(
|
|
||||||
context = this@MainActivity,
|
|
||||||
lifecycleScope = lifecycleScope,
|
|
||||||
activityLauncher = activityLauncher!!,
|
|
||||||
position = "Appstart",
|
|
||||||
onGrantedOnlyUnauthorized = { isGranted->
|
|
||||||
if(isGranted){
|
|
||||||
NotificationKeepAliveServiceManager.startKeepAliveService(this@MainActivity)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
handleNotificationAction()
|
handleNotificationAction()
|
||||||
reportStatistics(intent, true)
|
reportStatistics(intent, true)
|
||||||
}
|
}
|
||||||
|
|
@ -183,17 +173,6 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
|
||||||
private fun handleNotificationAction() {
|
private fun handleNotificationAction() {
|
||||||
if (NotificationLandingController.isFromNotification(intent)) {
|
if (NotificationLandingController.isFromNotification(intent)) {
|
||||||
when (intent.getIntExtra(LANDING_NOTIFICATION_ACTION, -1)) {
|
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 -> {
|
PushContent.ACTION_TYPE_GAME -> {
|
||||||
AndroidUtil.openUrl(VidiConst.URL_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) {
|
private fun reportStatistics(intent: Intent, isFromNewIntent: Boolean) {
|
||||||
// AppOpen
|
// AppOpen
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@
|
||||||
android:layout_gravity="top"
|
android:layout_gravity="top"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:src="@drawable/vidi_icon_close"
|
android:src="@drawable/vidi_icon_close"
|
||||||
|
android:visibility="gone"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
android:layout_gravity="top"
|
android:layout_gravity="top"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:src="@drawable/vidi_icon_close"
|
android:src="@drawable/vidi_icon_close"
|
||||||
|
android:visibility="gone"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue