推送通知适配多语言
This commit is contained in:
@@ -128,7 +128,8 @@ interface INetworkService {
|
||||
@FormUrlEncoded
|
||||
@POST("user/login")
|
||||
suspend fun login(
|
||||
@Field("email") email: String, @Field("password") password: String
|
||||
@Field("phone") phone: String, @Field("password") password: String,
|
||||
@Field("languageCode") languageCode: String
|
||||
): BaseResponse<UserBean>
|
||||
|
||||
/**
|
||||
@@ -142,7 +143,8 @@ interface INetworkService {
|
||||
@Field("password") password: String,
|
||||
@Field("userName") userName: String,
|
||||
@Field("countryCode") countryCode: String,
|
||||
@Field("openidIdentifier") openidIdentifier: String
|
||||
@Field("openidIdentifier") openidIdentifier: String,
|
||||
@Field("languageCode") languageCode: String
|
||||
): BaseResponse<UserBean>
|
||||
|
||||
|
||||
@@ -660,9 +662,8 @@ interface INetworkService {
|
||||
*/
|
||||
@GET("pet/bindPetList")
|
||||
suspend fun getHomeBindPetList(
|
||||
@Query(
|
||||
"userId"
|
||||
) userId: String
|
||||
@Query("userId") userId: String,
|
||||
@Query("languageCode") languageCode: String
|
||||
): BaseResponse<MutableList<PetBean>>
|
||||
|
||||
/**
|
||||
@@ -1444,7 +1445,8 @@ interface INetworkService {
|
||||
@FormUrlEncoded
|
||||
@POST("user/login")
|
||||
suspend fun accountPasswordLogin(
|
||||
@Field("phone") phone: String, @Field("password") password: String
|
||||
@Field("phone") phone: String, @Field("password") password: String,
|
||||
@Field("languageCode") languageCode: String
|
||||
): BaseResponse<UserBean>
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.abbidot.tracker.retrofit2
|
||||
|
||||
import com.abbidot.baselibrary.network.base.BaseNetworkApi
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.tracker.bean.FencesBean
|
||||
import com.abbidot.tracker.bean.PayResultBean
|
||||
import com.abbidot.tracker.bean.SetMealBean
|
||||
@@ -42,16 +43,23 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
||||
* 注册/创建用户
|
||||
*/
|
||||
suspend fun registerV2(
|
||||
email: String, phone: String, password: String, userName: String, countryCode: String, wxOpenidId: String
|
||||
email: String,
|
||||
phone: String,
|
||||
password: String,
|
||||
userName: String,
|
||||
countryCode: String,
|
||||
wxOpenidId: String
|
||||
) = getResult {
|
||||
service.registerV2(email, phone, password, userName, countryCode, wxOpenidId)
|
||||
service.registerV2(
|
||||
email, phone, password, userName, countryCode, wxOpenidId, AppUtils.getLanguage()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登陆
|
||||
*/
|
||||
suspend fun login(email: String, password: String) = getResult {
|
||||
service.login(email, password)
|
||||
service.login(email, password, AppUtils.getLanguage())
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -569,7 +577,7 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
||||
* 获取首页宠物列表
|
||||
*/
|
||||
suspend fun getHomeBindPetList(userId: String) = getResult {
|
||||
service.getHomeBindPetList(userId)
|
||||
service.getHomeBindPetList(userId, AppUtils.getLanguage())
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -807,8 +815,7 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
||||
/**
|
||||
* 蓝牙透传机制从TCP迁移到https
|
||||
*/
|
||||
suspend fun blePassThrough(url: String, body: RequestBody) =
|
||||
service.blePassThrough(url, body)
|
||||
suspend fun blePassThrough(url: String, body: RequestBody) = service.blePassThrough(url, body)
|
||||
|
||||
/**
|
||||
* 取消自动续费/自动订阅
|
||||
@@ -1327,7 +1334,7 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
||||
* 账号密码登录
|
||||
*/
|
||||
suspend fun accountPasswordLogin(phone: String, password: String) = getResult {
|
||||
service.accountPasswordLogin(phone, password)
|
||||
service.accountPasswordLogin(phone, password, AppUtils.getLanguage())
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -102,11 +102,26 @@ class AppUtils {
|
||||
}
|
||||
return MMKVUtil.getBoolean(MMKVKey.DebugIp, true)
|
||||
}
|
||||
val locale = Locale.getDefault()
|
||||
val lang = locale.country.uppercase() + "-" + locale.language.uppercase()
|
||||
val lang = getCountry().uppercase() + "-" + getLanguage().uppercase()
|
||||
return lang.contains("CN") || lang.contains("ZH")
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统国家地区
|
||||
*/
|
||||
fun getCountry(): String {
|
||||
val locale = Locale.getDefault()
|
||||
return locale.country
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统语言
|
||||
*/
|
||||
fun getLanguage(): String {
|
||||
val locale = Locale.getDefault()
|
||||
return locale.language
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是深色模式
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user