cleanup code

This commit is contained in:
Kr328 committed 2020-04-13 11:13:04 +08:00
1 parent a0026b1bb3
commit 12d76a2ad1
6 files changed
+9 -11

No files matched your search

@@ -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
@@ -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
@@ -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()
@@ -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
@@ -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
@@ -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