更新代码
This commit is contained in:
@@ -6,6 +6,8 @@ import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.icu.util.Calendar
|
||||
import android.icu.util.TimeZone
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
@@ -28,6 +30,7 @@ import com.aiosman.riderpro.data.AccountService
|
||||
import com.aiosman.riderpro.data.AccountServiceImpl
|
||||
import com.aiosman.riderpro.ui.Navigation
|
||||
import com.aiosman.riderpro.ui.NavigationRoute
|
||||
import com.aiosman.riderpro.ui.navigateToPost
|
||||
import com.aiosman.riderpro.ui.post.NewPostViewModel
|
||||
import com.aiosman.riderpro.utils.Utils
|
||||
import com.google.android.libraries.places.api.Places
|
||||
@@ -59,8 +62,14 @@ class MainActivity : ComponentActivity() {
|
||||
val accountService: AccountService = AccountServiceImpl()
|
||||
try {
|
||||
val resp = accountService.getMyAccount()
|
||||
accountService.updateUserLanguage(
|
||||
Utils.getCurrentLanguage()
|
||||
val calendar: Calendar = Calendar.getInstance()
|
||||
val tz: TimeZone = calendar.timeZone
|
||||
val offsetInMillis: Int = tz.rawOffset
|
||||
accountService.updateUserExtra(
|
||||
Utils.getCurrentLanguage(),
|
||||
// 时区偏移量单位是秒
|
||||
offsetInMillis / 1000,
|
||||
tz.displayName
|
||||
)
|
||||
// 设置当前登录用户 ID
|
||||
AppState.UserId = resp.id
|
||||
@@ -122,19 +131,20 @@ class MainActivity : ComponentActivity() {
|
||||
navController.navigate(NavigationRoute.Followers.route)
|
||||
return@Navigation
|
||||
}
|
||||
if (action == "followCount") {
|
||||
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
|
||||
)
|
||||
.replace("{highlightCommentId}", commentId)
|
||||
navController.navigateToPost(
|
||||
id = postId.toInt(),
|
||||
highlightCommentId = commentId.toInt(),
|
||||
initImagePagerIndex = 0
|
||||
)
|
||||
}
|
||||
// 处理分享过来的图片
|
||||
|
||||
Reference in New Issue
Block a user