Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev
This commit is contained in:
@ -11,7 +11,6 @@ class Corrector {
|
||||
|
||||
companion object {
|
||||
const val TIME_CORRECTOR_ADJUST_PERIOD: Long = 600000
|
||||
|
||||
}
|
||||
|
||||
var delta: Long = 0
|
||||
@ -22,12 +21,8 @@ class Corrector {
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(object : Response<TimeEntity>() {
|
||||
override fun onResponse(response: TimeEntity?) {
|
||||
try {
|
||||
val serverTime = response?.time!!
|
||||
delta = serverTime * 1000 - System.currentTimeMillis()
|
||||
} catch (e: NumberFormatException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
val serverTime = response?.time
|
||||
serverTime?.let { delta = it * 1000 - System.currentTimeMillis() }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -14,7 +14,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import java.io.File
|
||||
|
||||
|
||||
object DeviceTokenUtils {
|
||||
|
||||
const val DEVICE_ID = "uuid"
|
||||
@ -29,13 +28,11 @@ object DeviceTokenUtils {
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<TimeEntity>() {
|
||||
override fun onResponse(response: TimeEntity?) {
|
||||
try {
|
||||
val editor = sp.edit()
|
||||
editor.putLong("server_time", response?.time!!)
|
||||
val editor = sp.edit()
|
||||
response?.time?.let {
|
||||
editor.putLong("server_time", it)
|
||||
editor.putLong("client_time", System.currentTimeMillis() / 1000)
|
||||
editor.apply()
|
||||
} catch (e: NumberFormatException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -49,18 +46,18 @@ object DeviceTokenUtils {
|
||||
if (values.isNotEmpty()) {
|
||||
for (value in values) {
|
||||
if (value.key.contains("isNewFirstLaunchV")) {
|
||||
lunchType = LunchType.update
|
||||
lunchType = LunchType.UPDATE
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
// 再次重装
|
||||
if (lunchType == null && !getDeviceId().isNullOrEmpty()) {
|
||||
lunchType = LunchType.again
|
||||
lunchType = LunchType.AGAIN
|
||||
}
|
||||
// 首次安装
|
||||
if (lunchType == null) {
|
||||
lunchType = LunchType.first
|
||||
lunchType = LunchType.FIRST
|
||||
}
|
||||
// 保存deviceId
|
||||
var deviceId = Util_System_Phone_State.getDeviceId(HaloApp.getInstance().application)
|
||||
@ -131,7 +128,7 @@ object DeviceTokenUtils {
|
||||
}
|
||||
|
||||
enum class LunchType {
|
||||
first,
|
||||
update,
|
||||
again
|
||||
FIRST,
|
||||
UPDATE,
|
||||
AGAIN
|
||||
}
|
||||
|
||||
@ -102,10 +102,12 @@ class GameDetailViewModel(application: Application,
|
||||
concernLiveData.postValue(ConcernResponse(isConcern, false))
|
||||
}
|
||||
}
|
||||
if (isConcern) {
|
||||
ConcernUtils.postConcernGameId(getApplication(), game?.id!!, listener)
|
||||
} else {
|
||||
ConcernUtils.deleteConcernData(getApplication(), game?.id!!, listener)
|
||||
game?.id?.let {
|
||||
if (isConcern) {
|
||||
ConcernUtils.postConcernGameId(getApplication(), it, listener)
|
||||
} else {
|
||||
ConcernUtils.deleteConcernData(getApplication(), it, listener)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user