更改推送
This commit is contained in:
@@ -29,6 +29,7 @@ import com.aiosman.riderpro.data.AccountServiceImpl
|
||||
import com.aiosman.riderpro.ui.Navigation
|
||||
import com.aiosman.riderpro.ui.NavigationRoute
|
||||
import com.aiosman.riderpro.ui.post.NewPostViewModel
|
||||
import com.aiosman.riderpro.utils.Utils
|
||||
import com.google.android.libraries.places.api.Places
|
||||
import com.google.firebase.analytics.FirebaseAnalytics
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@@ -58,6 +59,9 @@ class MainActivity : ComponentActivity() {
|
||||
val accountService: AccountService = AccountServiceImpl()
|
||||
try {
|
||||
val resp = accountService.getMyAccount()
|
||||
accountService.updateUserLanguage(
|
||||
Utils.getCurrentLanguage()
|
||||
)
|
||||
// 设置当前登录用户 ID
|
||||
AppState.UserId = resp.id
|
||||
return true
|
||||
@@ -105,20 +109,32 @@ class MainActivity : ComponentActivity() {
|
||||
var startDestination = NavigationRoute.Login.route
|
||||
// 如果有登录态,且记住登录状态,且账号有效,则初始化 FCM,下一步进入首页
|
||||
if (AppStore.token != null && AppStore.rememberMe && isAccountValidate) {
|
||||
Messaging.RegistDevice(scope,this@MainActivity)
|
||||
Messaging.RegistDevice(scope, this@MainActivity)
|
||||
startDestination = NavigationRoute.Index.route
|
||||
}
|
||||
setContent {
|
||||
Navigation(startDestination) { navController ->
|
||||
// 处理带有 postId 的通知点击
|
||||
val postId = intent.getStringExtra("POST_ID")
|
||||
var commentId = intent.getStringExtra("COMMENT_ID")
|
||||
var action = intent.getStringExtra("ACTION")
|
||||
if (action == "newFollow") {
|
||||
navController.navigate(NavigationRoute.Followers.route)
|
||||
return@Navigation
|
||||
}
|
||||
if (commentId == null) {
|
||||
commentId = "0"
|
||||
}
|
||||
|
||||
if (postId != null) {
|
||||
Log.d("MainActivity", "Navigation to Post$postId")
|
||||
navController.navigate(
|
||||
NavigationRoute.Post.route.replace(
|
||||
"{id}",
|
||||
postId
|
||||
)
|
||||
NavigationRoute.Post.route
|
||||
.replace(
|
||||
"{id}",
|
||||
postId
|
||||
)
|
||||
.replace("{highlightCommentId}", commentId)
|
||||
)
|
||||
}
|
||||
// 处理分享过来的图片
|
||||
|
||||
Reference in New Issue
Block a user