diff --git a/service/src/main/java/com/github/kr328/clash/service/BaseService.kt b/service/src/main/java/com/github/kr328/clash/service/BaseService.kt index 671bafb..cdd5821 100644 --- a/service/src/main/java/com/github/kr328/clash/service/BaseService.kt +++ b/service/src/main/java/com/github/kr328/clash/service/BaseService.kt @@ -2,9 +2,9 @@ package com.github.kr328.clash.service import android.app.Service import android.content.Context +import com.github.kr328.clash.common.util.createLanguageConfigurationContext import com.github.kr328.clash.core.Clash import com.github.kr328.clash.service.settings.ServiceSettings -import com.github.kr328.clash.common.util.createLanguageConfigurationContext import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.MainScope import kotlinx.coroutines.cancel diff --git a/service/src/main/java/com/github/kr328/clash/service/ClashNotification.kt b/service/src/main/java/com/github/kr328/clash/service/ClashNotification.kt index 3e09b4d..a81dfb8 100644 --- a/service/src/main/java/com/github/kr328/clash/service/ClashNotification.kt +++ b/service/src/main/java/com/github/kr328/clash/service/ClashNotification.kt @@ -5,9 +5,9 @@ import android.content.Intent import android.os.Build import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat -import com.github.kr328.clash.core.Clash import com.github.kr328.clash.common.utils.asBytesString import com.github.kr328.clash.common.utils.asSpeedString +import com.github.kr328.clash.core.Clash import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext diff --git a/service/src/main/java/com/github/kr328/clash/service/ProfileBackgroundService.kt b/service/src/main/java/com/github/kr328/clash/service/ProfileBackgroundService.kt index 2c2e999..21ebc1f 100644 --- a/service/src/main/java/com/github/kr328/clash/service/ProfileBackgroundService.kt +++ b/service/src/main/java/com/github/kr328/clash/service/ProfileBackgroundService.kt @@ -15,15 +15,14 @@ import androidx.core.app.NotificationManagerCompat import com.github.kr328.clash.common.ids.Intents import com.github.kr328.clash.common.ids.NotificationChannels import com.github.kr328.clash.common.ids.NotificationIds +import com.github.kr328.clash.common.util.intent import com.github.kr328.clash.service.data.ProfileDao import com.github.kr328.clash.service.ipc.IStreamCallback import com.github.kr328.clash.service.ipc.ParcelableContainer -import com.github.kr328.clash.common.util.intent import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.delay import kotlinx.coroutines.launch import kotlinx.coroutines.selects.select -import kotlinx.coroutines.withTimeout class ProfileBackgroundService : BaseService() { private val self = this @@ -114,7 +113,7 @@ class ProfileBackgroundService : BaseService() { false } - if ( queue.isEmpty() ) { + if (queue.isEmpty()) { launch { delay(1000 * 10) }.onJoin { true } @@ -123,7 +122,7 @@ class ProfileBackgroundService : BaseService() { refreshStatusNotification(queue.size) - if ( stop ) break + if (stop) break } stopSelf() diff --git a/service/src/main/java/com/github/kr328/clash/service/ProfileReceiver.kt b/service/src/main/java/com/github/kr328/clash/service/ProfileReceiver.kt index 3c8e67c..03cab16 100644 --- a/service/src/main/java/com/github/kr328/clash/service/ProfileReceiver.kt +++ b/service/src/main/java/com/github/kr328/clash/service/ProfileReceiver.kt @@ -8,11 +8,11 @@ import android.content.Intent import androidx.core.content.getSystemService import com.github.kr328.clash.common.ids.Intents import com.github.kr328.clash.common.ids.PendingIds -import com.github.kr328.clash.service.data.ProfileDao -import com.github.kr328.clash.service.model.toProfileMetadata import com.github.kr328.clash.common.util.componentName import com.github.kr328.clash.common.util.intent import com.github.kr328.clash.common.util.startForegroundServiceCompat +import com.github.kr328.clash.service.data.ProfileDao +import com.github.kr328.clash.service.model.toProfileMetadata class ProfileReceiver : BroadcastReceiver() { override fun onReceive(context: Context?, intent: Intent?) { @@ -36,7 +36,7 @@ class ProfileReceiver : BroadcastReceiver() { @Synchronized fun tryInitialize(context: Context) { - if ( initialized ) + if (initialized) return initialized = true diff --git a/service/src/main/java/com/github/kr328/clash/service/ProfileService.kt b/service/src/main/java/com/github/kr328/clash/service/ProfileService.kt index c84585e..bf9e781 100644 --- a/service/src/main/java/com/github/kr328/clash/service/ProfileService.kt +++ b/service/src/main/java/com/github/kr328/clash/service/ProfileService.kt @@ -15,7 +15,6 @@ import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock -import java.util.* class ProfileService : BaseService() { private val service = this diff --git a/service/src/main/java/com/github/kr328/clash/service/clash/module/DynamicNotificationModule.kt b/service/src/main/java/com/github/kr328/clash/service/clash/module/DynamicNotificationModule.kt index d38060d..67ce1db 100644 --- a/service/src/main/java/com/github/kr328/clash/service/clash/module/DynamicNotificationModule.kt +++ b/service/src/main/java/com/github/kr328/clash/service/clash/module/DynamicNotificationModule.kt @@ -8,9 +8,9 @@ import androidx.core.app.NotificationCompat import com.github.kr328.clash.common.ids.Intents import com.github.kr328.clash.common.ids.NotificationChannels import com.github.kr328.clash.common.ids.NotificationIds -import com.github.kr328.clash.core.Clash import com.github.kr328.clash.common.utils.asBytesString import com.github.kr328.clash.common.utils.asSpeedString +import com.github.kr328.clash.core.Clash import com.github.kr328.clash.service.R import com.github.kr328.clash.service.ServiceStatusProvider import kotlinx.coroutines.Dispatchers