Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
app: Fix login toast show on custom rom
Browse files Browse the repository at this point in the history
  • Loading branch information
YuKongA committed May 12, 2024
1 parent 827f7a4 commit 67be271
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import android.content.Intent
import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.widget.Toast
import kotlinx.serialization.json.Json
import top.yukonga.miuiStringToast.data.IconParams
Expand All @@ -27,7 +29,9 @@ object MiuiStringToast {
@SuppressLint("WrongConstant")
fun showStringToast(context: Context, text: String?, colorType: Int) {
if ((!isMiPad() && isLandscape()) || !atLeast(Build.VERSION_CODES.TIRAMISU) || !isHyperOS()) {
Toast.makeText(context, text, Toast.LENGTH_SHORT).show()
Handler(Looper.getMainLooper()).post {
Toast.makeText(context, text, Toast.LENGTH_SHORT).show()
}
return
}
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package top.yukonga.update.logic.utils

import android.content.Context
import androidx.preference.PreferenceManager
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import okhttp3.MediaType.Companion.toMediaType
Expand Down Expand Up @@ -90,8 +88,8 @@ class LoginUtils {
}

fun logout(context: Context) {
deleteCookiesFile(context)
showStringToast(context, context.getString(R.string.logout_successful), 1)
deleteCookiesFile(context)
showStringToast(context, context.getString(R.string.logout_successful), 1)
}

private fun saveAccountAndPassword(context: Context, account: String, password: String) {
Expand Down

0 comments on commit 67be271

Please sign in to comment.