更新代码
@@ -423,12 +423,16 @@ class AccountServiceImpl : AccountService {
|
|||||||
override suspend fun loginUserWithGoogle(googleId: String): UserAuth {
|
override suspend fun loginUserWithGoogle(googleId: String): UserAuth {
|
||||||
val resp = ApiClient.api.login(LoginUserRequestBody(googleId = googleId))
|
val resp = ApiClient.api.login(LoginUserRequestBody(googleId = googleId))
|
||||||
val body = resp.body() ?: throw ServiceException("Failed to login")
|
val body = resp.body() ?: throw ServiceException("Failed to login")
|
||||||
|
|
||||||
return UserAuth(0, body.token)
|
return UserAuth(0, body.token)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun regiterUserWithGoogleAccount(idToken: String) {
|
override suspend fun regiterUserWithGoogleAccount(idToken: String) {
|
||||||
val resp = ApiClient.api.registerWithGoogle(GoogleRegisterRequestBody(idToken))
|
val resp = ApiClient.api.registerWithGoogle(GoogleRegisterRequestBody(idToken))
|
||||||
if (resp.code() != 200) {
|
if (!resp.isSuccessful) {
|
||||||
|
parseErrorResponse(resp.errorBody())?.let {
|
||||||
|
throw it.toServiceException()
|
||||||
|
}
|
||||||
throw ServiceException("Failed to register")
|
throw ServiceException("Failed to register")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -472,7 +476,13 @@ class AccountServiceImpl : AccountService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun changeAccountPassword(oldPassword: String, newPassword: String) {
|
override suspend fun changeAccountPassword(oldPassword: String, newPassword: String) {
|
||||||
ApiClient.api.changePassword(ChangePasswordRequestBody(oldPassword, newPassword))
|
val resp = ApiClient.api.changePassword(ChangePasswordRequestBody(oldPassword, newPassword))
|
||||||
|
if (!resp.isSuccessful) {
|
||||||
|
parseErrorResponse(resp.errorBody())?.let {
|
||||||
|
throw it.toServiceException()
|
||||||
|
}
|
||||||
|
throw ServiceException("Failed to change password")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getMyLikeNotice(page: Int, pageSize: Int): ListContainer<AccountLike> {
|
override suspend fun getMyLikeNotice(page: Int, pageSize: Int): ListContainer<AccountLike> {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.aiosman.riderpro.data
|
package com.aiosman.riderpro.data
|
||||||
|
|
||||||
|
import com.aiosman.riderpro.data.api.ErrorCode
|
||||||
|
import com.aiosman.riderpro.data.api.toErrorCode
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
import okhttp3.ResponseBody
|
import okhttp3.ResponseBody
|
||||||
@@ -13,6 +15,7 @@ class ServiceException(
|
|||||||
val data: Any? = null,
|
val data: Any? = null,
|
||||||
val error: String? = null,
|
val error: String? = null,
|
||||||
val name: String? = null,
|
val name: String? = null,
|
||||||
|
val errorType: ErrorCode = ErrorCode.UNKNOWN
|
||||||
) : Exception(
|
) : Exception(
|
||||||
message
|
message
|
||||||
)
|
)
|
||||||
@@ -30,7 +33,8 @@ data class ApiErrorResponse(
|
|||||||
message = error ?: name ?: "",
|
message = error ?: name ?: "",
|
||||||
code = code,
|
code = code,
|
||||||
error = error,
|
error = error,
|
||||||
name = name
|
name = name,
|
||||||
|
errorType = (code ?: 0).toErrorCode()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
42
app/src/main/java/com/aiosman/riderpro/data/api/Error.kt
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package com.aiosman.riderpro.data.api
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.widget.Toast
|
||||||
|
import com.aiosman.riderpro.R
|
||||||
|
|
||||||
|
//
|
||||||
|
enum class ErrorCode(val code: Int) {
|
||||||
|
USER_EXIST(40001),
|
||||||
|
USER_NOT_EXIST(40002),
|
||||||
|
InvalidateCaptcha(40004),
|
||||||
|
IncorrectOldPassword(40005),
|
||||||
|
// 未知错误
|
||||||
|
UNKNOWN(99999)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ErrorCode.toErrorMessage(context: Context): String {
|
||||||
|
return context.getErrorMessageCode(code)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ErrorCode.showToast(context: Context) {
|
||||||
|
Toast.makeText(context, toErrorMessage(context), Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
|
||||||
|
// code to ErrorCode
|
||||||
|
fun Int.toErrorCode(): ErrorCode {
|
||||||
|
return when (this) {
|
||||||
|
40001 -> ErrorCode.USER_EXIST
|
||||||
|
40002 -> ErrorCode.USER_NOT_EXIST
|
||||||
|
40004 -> ErrorCode.InvalidateCaptcha
|
||||||
|
40005 -> ErrorCode.IncorrectOldPassword
|
||||||
|
else -> ErrorCode.UNKNOWN
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Context.getErrorMessageCode(code: Int?): String {
|
||||||
|
return when (code) {
|
||||||
|
40001 -> getString(R.string.error_10001_user_exist)
|
||||||
|
ErrorCode.IncorrectOldPassword.code -> getString(R.string.error_incorrect_old_password)
|
||||||
|
else -> getString(R.string.error_unknown)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ import androidx.compose.ui.text.font.FontWeight
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.aiosman.riderpro.ConstVars
|
import com.aiosman.riderpro.ConstVars
|
||||||
import com.aiosman.riderpro.ErrorCode
|
import com.aiosman.riderpro.data.api.ErrorCode
|
||||||
import com.aiosman.riderpro.LocalAppTheme
|
import com.aiosman.riderpro.LocalAppTheme
|
||||||
import com.aiosman.riderpro.LocalNavController
|
import com.aiosman.riderpro.LocalNavController
|
||||||
import com.aiosman.riderpro.R
|
import com.aiosman.riderpro.R
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.compose.ui.viewinterop.AndroidView
|
import androidx.compose.ui.viewinterop.AndroidView
|
||||||
import com.aiosman.riderpro.ConstVars
|
import com.aiosman.riderpro.ConstVars
|
||||||
|
import com.aiosman.riderpro.LocalAppTheme
|
||||||
import com.aiosman.riderpro.R
|
import com.aiosman.riderpro.R
|
||||||
import com.aiosman.riderpro.data.DictService
|
import com.aiosman.riderpro.data.DictService
|
||||||
import com.aiosman.riderpro.data.DictServiceImpl
|
import com.aiosman.riderpro.data.DictServiceImpl
|
||||||
@@ -51,6 +52,7 @@ fun PolicyCheckbox(
|
|||||||
var scope = rememberCoroutineScope()
|
var scope = rememberCoroutineScope()
|
||||||
val dictService: DictService = DictServiceImpl()
|
val dictService: DictService = DictServiceImpl()
|
||||||
var policyUrl by remember { mutableStateOf("") }
|
var policyUrl by remember { mutableStateOf("") }
|
||||||
|
val appColor = LocalAppTheme.current
|
||||||
fun openPolicyModel() {
|
fun openPolicyModel() {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
try {
|
try {
|
||||||
@@ -91,13 +93,13 @@ fun PolicyCheckbox(
|
|||||||
val template = stringResource(R.string.private_policy_template)
|
val template = stringResource(R.string.private_policy_template)
|
||||||
append(template)
|
append(template)
|
||||||
append(" ")
|
append(" ")
|
||||||
withStyle(style = SpanStyle(color = if (error) Color.Red else Color.Black)) {
|
withStyle(style = SpanStyle(color = if (error) appColor.error else appColor.text)) {
|
||||||
append(keyword)
|
append(keyword)
|
||||||
}
|
}
|
||||||
|
|
||||||
addStyle(
|
addStyle(
|
||||||
style = SpanStyle(
|
style = SpanStyle(
|
||||||
color = Color.Red,
|
color = appColor.main,
|
||||||
textDecoration = TextDecoration.Underline
|
textDecoration = TextDecoration.Underline
|
||||||
),
|
),
|
||||||
start = template.length + 1,
|
start = template.length + 1,
|
||||||
@@ -113,7 +115,7 @@ fun PolicyCheckbox(
|
|||||||
},
|
},
|
||||||
style = TextStyle(
|
style = TextStyle(
|
||||||
fontSize = 12.sp,
|
fontSize = 12.sp,
|
||||||
color = if (error) Color.Red else Color.Black
|
color = if (error) appColor.error else appColor.text
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.aiosman.riderpro.ui.follower
|
package com.aiosman.riderpro.ui.follower
|
||||||
|
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
@@ -19,6 +21,7 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -62,6 +65,38 @@ fun FollowerNoticeScreen() {
|
|||||||
model.reload()
|
model.reload()
|
||||||
model.updateNotice()
|
model.updateNotice()
|
||||||
}
|
}
|
||||||
|
if (followers.itemCount == 0) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize(),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.rider_pro_followers_empty),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(140.dp)
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.size(32.dp))
|
||||||
|
androidx.compose.material.Text(
|
||||||
|
text = "No followers yet",
|
||||||
|
color = AppColors.text,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
fontWeight = FontWeight.W600
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.size(16.dp))
|
||||||
|
androidx.compose.material.Text(
|
||||||
|
text = "Share your life and get more followers.",
|
||||||
|
color = AppColors.text,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
fontWeight = FontWeight.W400
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
.background(color = AppColors.background)
|
.background(color = AppColors.background)
|
||||||
@@ -82,6 +117,9 @@ fun FollowerNoticeScreen() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -125,44 +163,6 @@ fun FollowItem(
|
|||||||
) {
|
) {
|
||||||
Text(nickname, fontWeight = FontWeight.Bold, fontSize = 16.sp, color = AppColors.text)
|
Text(nickname, fontWeight = FontWeight.Bold, fontSize = 16.sp, color = AppColors.text)
|
||||||
}
|
}
|
||||||
// if (userId != AppState.UserId) {
|
|
||||||
// FollowButton(
|
|
||||||
// isFollowing = isFollowing,
|
|
||||||
// onFollowClick = onFollow,
|
|
||||||
// fontSize = 14.sp,
|
|
||||||
// imageModifier = Modifier
|
|
||||||
// .width(100.dp)
|
|
||||||
// .height(24.dp)
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Box(
|
|
||||||
// modifier = Modifier.noRippleClickable {
|
|
||||||
// onFollow()
|
|
||||||
// }
|
|
||||||
// ) {
|
|
||||||
// Image(
|
|
||||||
// painter = painterResource(id = R.drawable.follow_bg),
|
|
||||||
// contentDescription = "Follow",
|
|
||||||
// modifier = Modifier
|
|
||||||
// .width(79.dp)
|
|
||||||
// .height(24.dp)
|
|
||||||
// )
|
|
||||||
// Text(
|
|
||||||
// text = if (isFollowing) {
|
|
||||||
// stringResource(R.string.following_upper)
|
|
||||||
// } else {
|
|
||||||
// stringResource(R.string.follow_upper)
|
|
||||||
// },
|
|
||||||
// fontSize = 14.sp,
|
|
||||||
// color = Color(0xFFFFFFFF),
|
|
||||||
// modifier = Modifier.align(
|
|
||||||
// Alignment.Center
|
|
||||||
// )
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
package com.aiosman.riderpro.ui.follower
|
package com.aiosman.riderpro.ui.follower
|
||||||
|
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.material.ExperimentalMaterialApi
|
import androidx.compose.material.ExperimentalMaterialApi
|
||||||
import androidx.compose.material.pullrefresh.PullRefreshIndicator
|
import androidx.compose.material.pullrefresh.PullRefreshIndicator
|
||||||
@@ -15,8 +19,11 @@ import androidx.compose.runtime.LaunchedEffect
|
|||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.paging.compose.collectAsLazyPagingItems
|
import androidx.paging.compose.collectAsLazyPagingItems
|
||||||
import com.aiosman.riderpro.LocalAppTheme
|
import com.aiosman.riderpro.LocalAppTheme
|
||||||
import com.aiosman.riderpro.R
|
import com.aiosman.riderpro.R
|
||||||
@@ -51,6 +58,38 @@ fun FollowingListScreen(userId: Int) {
|
|||||||
) {
|
) {
|
||||||
NoticeScreenHeader(stringResource(R.string.following_upper), moreIcon = false)
|
NoticeScreenHeader(stringResource(R.string.following_upper), moreIcon = false)
|
||||||
}
|
}
|
||||||
|
if(users.itemCount == 0) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize(),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.rider_pro_following_empty),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(140.dp)
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.size(32.dp))
|
||||||
|
androidx.compose.material.Text(
|
||||||
|
text = "You haven't followed anyone yet",
|
||||||
|
color = AppColors.text,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
fontWeight = FontWeight.W600
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.size(16.dp))
|
||||||
|
androidx.compose.material.Text(
|
||||||
|
text = "Click start your social journey.",
|
||||||
|
color = AppColors.text,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
fontWeight = FontWeight.W400
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@@ -86,4 +125,6 @@ fun FollowingListScreen(userId: Int) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.aiosman.riderpro.ui.like
|
package com.aiosman.riderpro.ui.like
|
||||||
|
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@@ -23,6 +25,7 @@ import androidx.compose.ui.draw.clip
|
|||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.layout.ContentScale
|
import androidx.compose.ui.layout.ContentScale
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
@@ -81,6 +84,30 @@ fun LikeNoticeScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Spacer(modifier = Modifier.height(28.dp))
|
// Spacer(modifier = Modifier.height(28.dp))
|
||||||
|
if (likes.itemCount == 0) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.rider_pro_like_empty),
|
||||||
|
contentDescription = "No Notice",
|
||||||
|
modifier = Modifier.size(140.dp)
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(32.dp))
|
||||||
|
Text(
|
||||||
|
text = "Your like notification box is feeling lonely",
|
||||||
|
color = AppColors.text,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
fontWeight = FontWeight.W500,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
state = listState,
|
state = listState,
|
||||||
@@ -109,6 +136,8 @@ fun LikeNoticeScreen() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,13 +24,13 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.aiosman.riderpro.AppState
|
import com.aiosman.riderpro.AppState
|
||||||
import com.aiosman.riderpro.AppStore
|
import com.aiosman.riderpro.AppStore
|
||||||
import com.aiosman.riderpro.ErrorCode
|
import com.aiosman.riderpro.data.api.ErrorCode
|
||||||
import com.aiosman.riderpro.LocalNavController
|
import com.aiosman.riderpro.LocalNavController
|
||||||
import com.aiosman.riderpro.R
|
import com.aiosman.riderpro.R
|
||||||
import com.aiosman.riderpro.data.AccountService
|
import com.aiosman.riderpro.data.AccountService
|
||||||
import com.aiosman.riderpro.data.ServiceException
|
import com.aiosman.riderpro.data.ServiceException
|
||||||
import com.aiosman.riderpro.data.AccountServiceImpl
|
import com.aiosman.riderpro.data.AccountServiceImpl
|
||||||
import com.aiosman.riderpro.getErrorMessageCode
|
import com.aiosman.riderpro.data.api.getErrorMessageCode
|
||||||
import com.aiosman.riderpro.ui.NavigationRoute
|
import com.aiosman.riderpro.ui.NavigationRoute
|
||||||
import com.aiosman.riderpro.ui.comment.NoticeScreenHeader
|
import com.aiosman.riderpro.ui.comment.NoticeScreenHeader
|
||||||
import com.aiosman.riderpro.ui.composables.ActionButton
|
import com.aiosman.riderpro.ui.composables.ActionButton
|
||||||
|
|||||||
@@ -50,11 +50,14 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.aiosman.riderpro.AppState
|
import com.aiosman.riderpro.AppState
|
||||||
import com.aiosman.riderpro.AppStore
|
import com.aiosman.riderpro.AppStore
|
||||||
|
import com.aiosman.riderpro.data.api.ErrorCode
|
||||||
import com.aiosman.riderpro.LocalAppTheme
|
import com.aiosman.riderpro.LocalAppTheme
|
||||||
import com.aiosman.riderpro.LocalNavController
|
import com.aiosman.riderpro.LocalNavController
|
||||||
import com.aiosman.riderpro.R
|
import com.aiosman.riderpro.R
|
||||||
import com.aiosman.riderpro.data.AccountServiceImpl
|
import com.aiosman.riderpro.data.AccountServiceImpl
|
||||||
import com.aiosman.riderpro.data.ServiceException
|
import com.aiosman.riderpro.data.ServiceException
|
||||||
|
import com.aiosman.riderpro.data.api.getErrorMessageCode
|
||||||
|
import com.aiosman.riderpro.data.api.showToast
|
||||||
import com.aiosman.riderpro.ui.NavigationRoute
|
import com.aiosman.riderpro.ui.NavigationRoute
|
||||||
import com.aiosman.riderpro.ui.composables.ActionButton
|
import com.aiosman.riderpro.ui.composables.ActionButton
|
||||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||||
@@ -83,6 +86,20 @@ fun LoginPage() {
|
|||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
try {
|
try {
|
||||||
accountService.regiterUserWithGoogleAccount(it)
|
accountService.regiterUserWithGoogleAccount(it)
|
||||||
|
}catch (e : ServiceException) {
|
||||||
|
when (e.errorType) {
|
||||||
|
ErrorCode.USER_EXIST ->
|
||||||
|
Toast.makeText(
|
||||||
|
context,
|
||||||
|
context.getErrorMessageCode(e.errorType.code),
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
else -> {
|
||||||
|
e.errorType.showToast(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Log.e(TAG, "Failed to register with google", e)
|
||||||
|
return@launch
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(TAG, "Failed to register with google", e)
|
Log.e(TAG, "Failed to register with google", e)
|
||||||
return@launch
|
return@launch
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.aiosman.riderpro.AppState
|
import com.aiosman.riderpro.AppState
|
||||||
import com.aiosman.riderpro.AppStore
|
import com.aiosman.riderpro.AppStore
|
||||||
|
import com.aiosman.riderpro.LocalAppTheme
|
||||||
import com.aiosman.riderpro.LocalNavController
|
import com.aiosman.riderpro.LocalNavController
|
||||||
import com.aiosman.riderpro.Messaging
|
import com.aiosman.riderpro.Messaging
|
||||||
import com.aiosman.riderpro.R
|
import com.aiosman.riderpro.R
|
||||||
@@ -53,7 +54,7 @@ fun SignupScreen() {
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val coroutineScope = rememberCoroutineScope()
|
val coroutineScope = rememberCoroutineScope()
|
||||||
val accountService: AccountService = AccountServiceImpl()
|
val accountService: AccountService = AccountServiceImpl()
|
||||||
|
val appColor = LocalAppTheme.current
|
||||||
fun googleLogin() {
|
fun googleLogin() {
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
try {
|
try {
|
||||||
@@ -114,7 +115,7 @@ fun SignupScreen() {
|
|||||||
Scaffold(
|
Scaffold(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(Color(0xFFECECEC))
|
.background(appColor.background)
|
||||||
) {
|
) {
|
||||||
it
|
it
|
||||||
Box(
|
Box(
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.aiosman.riderpro.AppState
|
import com.aiosman.riderpro.AppState
|
||||||
import com.aiosman.riderpro.AppStore
|
import com.aiosman.riderpro.AppStore
|
||||||
import com.aiosman.riderpro.ErrorCode
|
import com.aiosman.riderpro.data.api.ErrorCode
|
||||||
import com.aiosman.riderpro.LocalAppTheme
|
import com.aiosman.riderpro.LocalAppTheme
|
||||||
import com.aiosman.riderpro.LocalNavController
|
import com.aiosman.riderpro.LocalNavController
|
||||||
import com.aiosman.riderpro.R
|
import com.aiosman.riderpro.R
|
||||||
|
|||||||
BIN
app/src/main/res/mipmap-hdpi/rider_pro_followers_empty.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/mipmap-hdpi/rider_pro_following_empty.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
app/src/main/res/mipmap-hdpi/rider_pro_like_empty.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
app/src/main/res/mipmap-mdpi/rider_pro_followers_empty.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
app/src/main/res/mipmap-mdpi/rider_pro_following_empty.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
app/src/main/res/mipmap-mdpi/rider_pro_like_empty.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/rider_pro_followers_empty.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
app/src/main/res/mipmap-xhdpi/rider_pro_following_empty.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
app/src/main/res/mipmap-xhdpi/rider_pro_like_empty.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/rider_pro_followers_empty.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/rider_pro_following_empty.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/rider_pro_like_empty.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/rider_pro_followers_empty.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/rider_pro_following_empty.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/rider_pro_like_empty.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
@@ -93,4 +93,5 @@
|
|||||||
<string name="clear">清除</string>
|
<string name="clear">清除</string>
|
||||||
<string name="incorrect_captcha_please_try_again">验证码错误,请重试</string>
|
<string name="incorrect_captcha_please_try_again">验证码错误,请重试</string>
|
||||||
<string name="search_user_item_follower_count">%d 粉丝</string>
|
<string name="search_user_item_follower_count">%d 粉丝</string>
|
||||||
|
<string name="error_incorrect_old_password">旧密码不正确</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -92,4 +92,5 @@
|
|||||||
<string name="clear">Clear</string>
|
<string name="clear">Clear</string>
|
||||||
<string name="incorrect_captcha_please_try_again">incorrect captcha,please try again</string>
|
<string name="incorrect_captcha_please_try_again">incorrect captcha,please try again</string>
|
||||||
<string name="search_user_item_follower_count">%d followers</string>
|
<string name="search_user_item_follower_count">%d followers</string>
|
||||||
|
<string name="error_incorrect_old_password">Incorrect old password</string>
|
||||||
</resources>
|
</resources>
|
||||||