mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2026-05-09 18:11:26 +08:00
feat: show toast after profile updated
This commit is contained in:
@@ -15,6 +15,8 @@ import com.github.kr328.clash.common.id.UndefinedIds
|
||||
import com.github.kr328.clash.common.util.setUUID
|
||||
import com.github.kr328.clash.common.util.uuid
|
||||
import com.github.kr328.clash.service.data.ImportedDao
|
||||
import com.github.kr328.clash.service.util.sendProfileUpdateCompleted
|
||||
import com.github.kr328.clash.service.util.sendProfileUpdateFailed
|
||||
import kotlinx.coroutines.*
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
@@ -176,6 +178,8 @@ class ProfileWorker : BaseService() {
|
||||
|
||||
NotificationManagerCompat.from(this)
|
||||
.notify(id, notification)
|
||||
|
||||
sendProfileUpdateCompleted(uuid)
|
||||
}
|
||||
|
||||
private fun failed(uuid: UUID, name: String, reason: String) {
|
||||
@@ -191,6 +195,8 @@ class ProfileWorker : BaseService() {
|
||||
|
||||
NotificationManagerCompat.from(this)
|
||||
.notify(id, notification)
|
||||
|
||||
sendProfileUpdateFailed(uuid, reason)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -27,6 +27,21 @@ fun Context.sendProfileLoaded(uuid: UUID) {
|
||||
sendBroadcastSelf(intent)
|
||||
}
|
||||
|
||||
fun Context.sendProfileUpdateCompleted(uuid: UUID) {
|
||||
val intent = Intent(Intents.ACTION_PROFILE_UPDATE_COMPLETED)
|
||||
.putExtra(Intents.EXTRA_UUID, uuid.toString())
|
||||
|
||||
sendBroadcastSelf(intent)
|
||||
}
|
||||
|
||||
fun Context.sendProfileUpdateFailed(uuid: UUID, reason: String) {
|
||||
val intent = Intent(Intents.ACTION_PROFILE_UPDATE_FAILED)
|
||||
.putExtra(Intents.EXTRA_UUID, uuid.toString())
|
||||
.putExtra(Intents.EXTRA_FAIL_REASON, reason)
|
||||
|
||||
sendBroadcastSelf(intent)
|
||||
}
|
||||
|
||||
fun Context.sendOverrideChanged() {
|
||||
val intent = Intent(Intents.ACTION_OVERRIDE_CHANGED)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user