diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 9c5e33d..86aa85c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -71,6 +71,7 @@ dependencies { implementation(project(":core")) implementation(project(":service")) implementation(project(":design")) + implementation(project(":component")) implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$gKotlinVersion") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$gKotlinCoroutineVersion") implementation("androidx.lifecycle:lifecycle-extensions:$gLifecycleVersion") diff --git a/app/src/main/java/com/github/kr328/clash/OnBootReceiver.kt b/app/src/main/java/com/github/kr328/clash/OnBootReceiver.kt index aa6dce8..0b14585 100644 --- a/app/src/main/java/com/github/kr328/clash/OnBootReceiver.kt +++ b/app/src/main/java/com/github/kr328/clash/OnBootReceiver.kt @@ -3,7 +3,7 @@ package com.github.kr328.clash import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import com.github.kr328.clash.service.Intents +import com.github.kr328.clash.component.ids.Intents import com.github.kr328.clash.service.ProfileBackgroundService import com.github.kr328.clash.service.util.componentName import com.github.kr328.clash.service.util.startForegroundServiceCompat diff --git a/app/src/main/java/com/github/kr328/clash/ProfilesActivity.kt b/app/src/main/java/com/github/kr328/clash/ProfilesActivity.kt index 6de2f8d..1ed675d 100644 --- a/app/src/main/java/com/github/kr328/clash/ProfilesActivity.kt +++ b/app/src/main/java/com/github/kr328/clash/ProfilesActivity.kt @@ -6,7 +6,7 @@ import android.os.Bundle import androidx.recyclerview.widget.LinearLayoutManager import com.github.kr328.clash.adapter.ProfileAdapter import com.github.kr328.clash.remote.withProfile -import com.github.kr328.clash.service.Intents +import com.github.kr328.clash.component.ids.Intents import com.github.kr328.clash.service.ProfileBackgroundService import com.github.kr328.clash.service.data.ClashProfileEntity import com.github.kr328.clash.service.transact.ProfileRequest diff --git a/app/src/main/java/com/github/kr328/clash/TileService.kt b/app/src/main/java/com/github/kr328/clash/TileService.kt index 15234f0..4cae6af 100644 --- a/app/src/main/java/com/github/kr328/clash/TileService.kt +++ b/app/src/main/java/com/github/kr328/clash/TileService.kt @@ -8,7 +8,7 @@ import android.graphics.drawable.Icon import android.service.quicksettings.Tile import android.service.quicksettings.TileService import com.github.kr328.clash.remote.RemoteUtils -import com.github.kr328.clash.service.Intents +import com.github.kr328.clash.component.ids.Intents import com.github.kr328.clash.utils.startClashService import com.github.kr328.clash.utils.stopClashService diff --git a/app/src/main/java/com/github/kr328/clash/remote/Broadcasts.kt b/app/src/main/java/com/github/kr328/clash/remote/Broadcasts.kt index 688297a..ca0c527 100644 --- a/app/src/main/java/com/github/kr328/clash/remote/Broadcasts.kt +++ b/app/src/main/java/com/github/kr328/clash/remote/Broadcasts.kt @@ -8,7 +8,7 @@ import android.content.IntentFilter import androidx.lifecycle.DefaultLifecycleObserver import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.ProcessLifecycleOwner -import com.github.kr328.clash.service.Intents +import com.github.kr328.clash.component.ids.Intents object Broadcasts { interface Receiver { diff --git a/app/src/main/java/com/github/kr328/clash/utils/ServiceUtils.kt b/app/src/main/java/com/github/kr328/clash/utils/ServiceUtils.kt index 7a77d30..861b6f4 100644 --- a/app/src/main/java/com/github/kr328/clash/utils/ServiceUtils.kt +++ b/app/src/main/java/com/github/kr328/clash/utils/ServiceUtils.kt @@ -5,7 +5,7 @@ import android.content.Intent import android.net.VpnService import com.github.kr328.clash.preference.UiSettings import com.github.kr328.clash.service.ClashService -import com.github.kr328.clash.service.Intents +import com.github.kr328.clash.component.ids.Intents import com.github.kr328.clash.service.TunService import com.github.kr328.clash.service.util.intent import com.github.kr328.clash.service.util.sendBroadcastSelf diff --git a/service/src/main/java/com/github/kr328/clash/service/Intents.kt b/component/src/main/java/com/github/kr328/clash/component/ids/Intents.kt similarity index 93% rename from service/src/main/java/com/github/kr328/clash/service/Intents.kt rename to component/src/main/java/com/github/kr328/clash/component/ids/Intents.kt index 64d0546..a727ba1 100644 --- a/service/src/main/java/com/github/kr328/clash/service/Intents.kt +++ b/component/src/main/java/com/github/kr328/clash/component/ids/Intents.kt @@ -1,4 +1,6 @@ -package com.github.kr328.clash.service +package com.github.kr328.clash.component.ids + +import com.github.kr328.clash.component.BuildConfig object Intents { const val INTENT_ACTION_CLASH_STARTED = diff --git a/component/src/main/java/com/github/kr328/clash/component/ids/NotificationChannels.kt b/component/src/main/java/com/github/kr328/clash/component/ids/NotificationChannels.kt new file mode 100644 index 0000000..69c8322 --- /dev/null +++ b/component/src/main/java/com/github/kr328/clash/component/ids/NotificationChannels.kt @@ -0,0 +1,5 @@ +package com.github.kr328.clash.component.ids + +object NotificationChannels { + const val CLASH_STATUS = "clash_status_channel" +} \ No newline at end of file diff --git a/component/src/main/java/com/github/kr328/clash/component/ids/NotificationIds.kt b/component/src/main/java/com/github/kr328/clash/component/ids/NotificationIds.kt new file mode 100644 index 0000000..8a9064b --- /dev/null +++ b/component/src/main/java/com/github/kr328/clash/component/ids/NotificationIds.kt @@ -0,0 +1,5 @@ +package com.github.kr328.clash.component.ids + +object NotificationIds { + const val CLASH_STATUS = 1 +} \ No newline at end of file diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 1369ced..067d9d5 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -65,6 +65,7 @@ android { } dependencies { + implementation(project(":component")) implementation("androidx.core:core-ktx:$gAndroidKtxVersion") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$gKotlinVersion") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$gKotlinCoroutineVersion") diff --git a/design/build.gradle.kts b/design/build.gradle.kts index d38a7e3..c26af87 100644 --- a/design/build.gradle.kts +++ b/design/build.gradle.kts @@ -52,6 +52,7 @@ android { } dependencies { + implementation(project(":component")) implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$gKotlinVersion") implementation("androidx.appcompat:appcompat:$gAppCompatVersion") implementation("androidx.core:core-ktx:$gAndroidKtxVersion") diff --git a/service/src/main/java/com/github/kr328/clash/service/ClashCore.kt b/service/src/main/java/com/github/kr328/clash/service/ClashCore.kt index e13c789..13316db 100644 --- a/service/src/main/java/com/github/kr328/clash/service/ClashCore.kt +++ b/service/src/main/java/com/github/kr328/clash/service/ClashCore.kt @@ -7,6 +7,7 @@ import android.content.Intent import android.content.IntentFilter import android.os.PowerManager import androidx.core.content.getSystemService +import com.github.kr328.clash.component.ids.Intents import com.github.kr328.clash.core.Clash import com.github.kr328.clash.core.utils.Log import com.github.kr328.clash.service.data.ClashDatabase 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 511c4ef..c3a946c 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 @@ -11,6 +11,7 @@ import android.os.Build import android.os.IBinder import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat +import com.github.kr328.clash.component.ids.Intents import com.github.kr328.clash.service.data.ClashDatabase import com.github.kr328.clash.service.data.ClashProfileDao import com.github.kr328.clash.service.ipc.IStreamCallback diff --git a/service/src/main/java/com/github/kr328/clash/service/ProfileDocumentProvider.kt b/service/src/main/java/com/github/kr328/clash/service/ProfileDocumentProvider.kt new file mode 100644 index 0000000..f6248b0 --- /dev/null +++ b/service/src/main/java/com/github/kr328/clash/service/ProfileDocumentProvider.kt @@ -0,0 +1,51 @@ +package com.github.kr328.clash.service + +import android.database.Cursor +import android.database.MatrixCursor +import android.os.CancellationSignal +import android.os.ParcelFileDescriptor +import android.provider.DocumentsContract +import android.provider.DocumentsProvider +import com.github.kr328.clash.core.Global +import com.github.kr328.clash.service.data.ClashDatabase + +class ProfileDocumentProvider : DocumentsProvider() { + companion object { + private const val DEFAULT_ROOT_ID = 0 + } + + val database = ClashDatabase.getInstance(Global.application) + + override fun openDocument( + documentId: String?, + mode: String?, + signal: CancellationSignal? + ): ParcelFileDescriptor { + TODO("Not yet implemented") + } + + override fun queryChildDocuments( + parentDocumentId: String?, + projection: Array?, + sortOrder: String? + ): Cursor { + TODO("Not yet implemented") + } + + override fun queryDocument(documentId: String?, projection: Array?): Cursor { + TODO("Not yet implemented") + } + + override fun onCreate(): Boolean { + return true + } + + override fun queryRoots(projection: Array?): Cursor { + return MatrixCursor(projection).apply { + newRow().apply { + add(DocumentsContract.Root.COLUMN_ROOT_ID, DEFAULT_ROOT_ID) + + } + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/github/kr328/clash/service/ProfileRequestReceiver.kt b/service/src/main/java/com/github/kr328/clash/service/ProfileRequestReceiver.kt index 74daef4..b093994 100644 --- a/service/src/main/java/com/github/kr328/clash/service/ProfileRequestReceiver.kt +++ b/service/src/main/java/com/github/kr328/clash/service/ProfileRequestReceiver.kt @@ -3,6 +3,7 @@ package com.github.kr328.clash.service import android.content.BroadcastReceiver import android.content.Context import android.content.Intent +import com.github.kr328.clash.component.ids.Intents import com.github.kr328.clash.service.transact.ProfileRequest import com.github.kr328.clash.service.util.componentName import com.github.kr328.clash.service.util.startForegroundServiceCompat 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 21a63ca..963d023 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 @@ -4,6 +4,7 @@ import android.content.Intent import android.net.Uri import android.os.IBinder import androidx.core.content.FileProvider +import com.github.kr328.clash.component.ids.Intents import com.github.kr328.clash.core.Global import com.github.kr328.clash.core.utils.Log import com.github.kr328.clash.service.data.ClashDatabase diff --git a/service/src/main/java/com/github/kr328/clash/service/clash/ClashRuntime.kt b/service/src/main/java/com/github/kr328/clash/service/clash/ClashRuntime.kt new file mode 100644 index 0000000..4984169 --- /dev/null +++ b/service/src/main/java/com/github/kr328/clash/service/clash/ClashRuntime.kt @@ -0,0 +1,57 @@ +package com.github.kr328.clash.service.clash + +import com.github.kr328.clash.service.clash.module.Module +import kotlinx.coroutines.sync.Mutex +import kotlinx.coroutines.sync.withLock + +class ClashRuntime { + companion object { + private val GIL = Mutex() + } + + private val modules: MutableList = mutableListOf() + private val mutex = Mutex() + private var started = false + private var stopped = false + + suspend fun start() = mutex.withLock { + if (!GIL.tryLock()) + throw IllegalStateException("ClashRuntime running") + + if (started || stopped) + return + + started = true + + modules.forEach { + it.onStart() + } + } + + suspend fun stop() = mutex.withLock { + if (!started || stopped) + return + + modules.forEach { + it.onStop() + it.onDestroy() + } + + GIL.unlock() + } + + suspend fun install(module: T, configure: T.() -> Unit = {}) = mutex.withLock { + if (stopped) + return + + stopped = true + + modules.add(module) + + module.onCreate() + module.configure() + + if (started) + module.onStart() + } +} \ No newline at end of file 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 new file mode 100644 index 0000000..5e7aba6 --- /dev/null +++ b/service/src/main/java/com/github/kr328/clash/service/clash/module/DynamicNotificationModule.kt @@ -0,0 +1,140 @@ +package com.github.kr328.clash.service.clash.module + +import android.app.PendingIntent +import android.app.Service +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.content.IntentFilter +import android.os.PowerManager +import androidx.core.app.NotificationCompat +import com.github.kr328.clash.component.ids.Intents +import com.github.kr328.clash.component.ids.NotificationChannels +import com.github.kr328.clash.component.ids.NotificationIds +import com.github.kr328.clash.core.Clash +import com.github.kr328.clash.core.utils.asBytesString +import com.github.kr328.clash.service.R +import com.github.kr328.clash.service.data.ClashDatabase +import kotlinx.coroutines.* +import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.selects.select + +class DynamicNotificationModule(private val service: Service) : NotificationModule { + private val contentIntent = Intent(Intent.ACTION_MAIN) + .addCategory(Intent.CATEGORY_DEFAULT) + .addCategory(Intent.CATEGORY_LAUNCHER) + .setPackage(service.packageName) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK) + private val builder = NotificationCompat.Builder(service, NotificationChannels.CLASH_STATUS) + .setSmallIcon(R.drawable.ic_notification) + .setOngoing(true) + .setColor(service.getColor(R.color.colorAccentService)) + .setOnlyAlertOnce(true) + .setShowWhen(false) + .setGroup(NotificationChannels.CLASH_STATUS) + .setContentIntent( + PendingIntent.getActivity( + service, + NotificationIds.CLASH_STATUS, + contentIntent, + PendingIntent.FLAG_UPDATE_CURRENT + ) + ) + private val reloadChannel = Channel(Channel.CONFLATED) + private val screenChannel = Channel(Channel.CONFLATED) + private val receiver = object : BroadcastReceiver() { + override fun onReceive(context: Context?, intent: Intent?) { + when (intent?.action) { + Intent.ACTION_SCREEN_ON -> + screenChannel.offer(true) + Intent.ACTION_SCREEN_OFF -> + screenChannel.offer(false) + Intents.INTENT_ACTION_PROFILE_CHANGED -> + reloadChannel.offer(Unit) + } + } + } + private lateinit var backgroundJob: Job + private var currentProfile = "Not selected" + + override suspend fun onCreate() { + withContext(Dispatchers.Unconfined) { + val database = ClashDatabase.getInstance(service).openClashProfileDao() + val tickerChannel = Channel() + + backgroundJob = launch { + launch { + while (isActive) { + tickerChannel.send(Unit) + delay(1000) + } + } + + var refreshEnabled = + service.getSystemService(PowerManager::class.java).isInteractive + + while (isActive) { + select { + reloadChannel.onReceive { + currentProfile = database.queryActiveProfile()?.name ?: "Not selected" + } + screenChannel.onReceive { + refreshEnabled = it + } + if (refreshEnabled) { + tickerChannel.onReceive { + update() + } + } + } + } + } + } + } + + override suspend fun onStart() { + reloadChannel.offer(Unit) + + service.registerReceiver(receiver, IntentFilter().apply { + addAction(Intents.INTENT_ACTION_PROFILE_CHANGED) + addAction(Intent.ACTION_SCREEN_OFF) + addAction(Intent.ACTION_SCREEN_ON) + }) + } + + override suspend fun onStop() { + service.unregisterReceiver(receiver) + } + + override suspend fun onDestroy() { + backgroundJob.cancel() + } + + override fun update() { + val traffic = Clash.queryTraffic() + val bandwidth = Clash.queryBandwidth() + + val uploading = traffic.upload.asBytesString() + val downloading = traffic.download.asBytesString() + val uploaded = bandwidth.upload.asBytesString() + val downloaded = bandwidth.download.asBytesString() + + val notification = builder + .setContentTitle(currentProfile) + .setContentText( + service.getString( + R.string.clash_notification_content, + uploading, downloading + ) + ) + .setSubText( + service.getString( + R.string.clash_notification_content, + uploaded, downloaded + ) + ) + .build() + + service.startForeground(NotificationIds.CLASH_STATUS, notification) + } +} \ No newline at end of file diff --git a/service/src/main/java/com/github/kr328/clash/service/clash/module/Module.kt b/service/src/main/java/com/github/kr328/clash/service/clash/module/Module.kt new file mode 100644 index 0000000..c62c6ff --- /dev/null +++ b/service/src/main/java/com/github/kr328/clash/service/clash/module/Module.kt @@ -0,0 +1,8 @@ +package com.github.kr328.clash.service.clash.module + +interface Module { + suspend fun onCreate() + suspend fun onStart() + suspend fun onStop() + suspend fun onDestroy() +} \ No newline at end of file diff --git a/service/src/main/java/com/github/kr328/clash/service/clash/module/NotificationModule.kt b/service/src/main/java/com/github/kr328/clash/service/clash/module/NotificationModule.kt new file mode 100644 index 0000000..18e4fdc --- /dev/null +++ b/service/src/main/java/com/github/kr328/clash/service/clash/module/NotificationModule.kt @@ -0,0 +1,5 @@ +package com.github.kr328.clash.service.clash.module + +interface NotificationModule : Module { + fun update() +} \ No newline at end of file diff --git a/service/src/main/java/com/github/kr328/clash/service/clash/module/ReloadModule.kt b/service/src/main/java/com/github/kr328/clash/service/clash/module/ReloadModule.kt new file mode 100644 index 0000000..4d8a753 --- /dev/null +++ b/service/src/main/java/com/github/kr328/clash/service/clash/module/ReloadModule.kt @@ -0,0 +1,61 @@ +package com.github.kr328.clash.service.clash.module + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.content.IntentFilter +import com.github.kr328.clash.component.ids.Intents +import com.github.kr328.clash.core.Clash +import com.github.kr328.clash.service.data.ClashDatabase +import com.github.kr328.clash.service.util.resolveBase +import com.github.kr328.clash.service.util.resolveProfile +import kotlinx.coroutines.* +import kotlinx.coroutines.channels.Channel + +class ReloadModule(private val context: Context) : Module { + private lateinit var backgroundJob: Job + private var emptyProfileCallback: () -> Unit = {} + private val reloadChannel = Channel(Channel.CONFLATED) + private val reloadBroadcastReceiver = object : BroadcastReceiver() { + override fun onReceive(context: Context?, intent: Intent?) { + reloadChannel.offer(Unit) + } + } + + override suspend fun onCreate() { + backgroundJob = withContext(Dispatchers.Unconfined) { + launch { + val database = ClashDatabase.getInstance(context).openClashProfileDao() + + while (isActive) { + val id = database.queryActiveProfile()?.id + if (id == null) { + emptyProfileCallback() + continue + } + + Clash.loadProfile(resolveProfile(id), resolveBase(id)) + } + } + } + } + + override suspend fun onStart() { + context.registerReceiver( + reloadBroadcastReceiver, + IntentFilter(Intents.INTENT_ACTION_PROFILE_CHANGED) + ) + } + + override suspend fun onStop() { + context.unregisterReceiver(reloadBroadcastReceiver) + } + + override suspend fun onDestroy() { + backgroundJob.cancel() + } + + fun onEmptyProfile(callback: () -> Unit) { + emptyProfileCallback = callback + } +} \ No newline at end of file diff --git a/service/src/main/java/com/github/kr328/clash/service/clash/module/StaticNotificationModule.kt b/service/src/main/java/com/github/kr328/clash/service/clash/module/StaticNotificationModule.kt new file mode 100644 index 0000000..3b81826 --- /dev/null +++ b/service/src/main/java/com/github/kr328/clash/service/clash/module/StaticNotificationModule.kt @@ -0,0 +1,89 @@ +package com.github.kr328.clash.service.clash.module + +import android.app.PendingIntent +import android.app.Service +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.content.IntentFilter +import androidx.core.app.NotificationCompat +import com.github.kr328.clash.component.ids.Intents +import com.github.kr328.clash.component.ids.NotificationChannels +import com.github.kr328.clash.component.ids.NotificationIds +import com.github.kr328.clash.service.R +import com.github.kr328.clash.service.data.ClashDatabase +import kotlinx.coroutines.* +import kotlinx.coroutines.channels.Channel + +class StaticNotificationModule(private val service: Service) : NotificationModule { + private val contentIntent = Intent(Intent.ACTION_MAIN) + .addCategory(Intent.CATEGORY_DEFAULT) + .addCategory(Intent.CATEGORY_LAUNCHER) + .setPackage(service.packageName) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK) + private val builder = NotificationCompat.Builder(service, NotificationChannels.CLASH_STATUS) + .setSmallIcon(R.drawable.ic_notification) + .setOngoing(true) + .setColor(service.getColor(R.color.colorAccentService)) + .setOnlyAlertOnce(true) + .setShowWhen(false) + .setGroup(NotificationChannels.CLASH_STATUS) + .setContentIntent( + PendingIntent.getActivity( + service, + NotificationIds.CLASH_STATUS, + contentIntent, + PendingIntent.FLAG_UPDATE_CURRENT + ) + ) + private val reloadChannel = Channel(Channel.CONFLATED) + private val receiver = object : BroadcastReceiver() { + override fun onReceive(context: Context?, intent: Intent?) { + when (intent?.action) { + Intents.INTENT_ACTION_PROFILE_CHANGED -> + reloadChannel.offer(Unit) + } + } + } + private var currentProfile: String = "Not selected" + private lateinit var backgroundJob: Job + + override fun update() { + val notification = builder + .setContentTitle(currentProfile) + .setContentText(service.getText(R.string.running)) + .build() + + service.startForeground(NotificationIds.CLASH_STATUS, notification) + } + + override suspend fun onCreate() { + withContext(Dispatchers.Unconfined) { + val database = ClashDatabase.getInstance(service).openClashProfileDao() + + backgroundJob = launch { + while (isActive) { + reloadChannel.receive() + + currentProfile = database.queryActiveProfile()?.name ?: "Not selected" + + update() + } + } + } + } + + override suspend fun onStart() { + service.registerReceiver(receiver, IntentFilter(Intents.INTENT_ACTION_PROFILE_CHANGED)) + + reloadChannel.offer(Unit) + } + + override suspend fun onStop() { + service.unregisterReceiver(receiver) + } + + override suspend fun onDestroy() { + backgroundJob.cancel() + } +} \ No newline at end of file diff --git a/service/src/main/java/com/github/kr328/clash/service/util/BroadcastUtils.kt b/service/src/main/java/com/github/kr328/clash/service/util/BroadcastUtils.kt index 64bcaab..83a1012 100644 --- a/service/src/main/java/com/github/kr328/clash/service/util/BroadcastUtils.kt +++ b/service/src/main/java/com/github/kr328/clash/service/util/BroadcastUtils.kt @@ -2,8 +2,8 @@ package com.github.kr328.clash.service.util import android.content.Context import android.content.Intent +import com.github.kr328.clash.component.ids.Intents import com.github.kr328.clash.core.Global -import com.github.kr328.clash.service.Intents fun Context.sendBroadcastSelf(intent: Intent) { this.sendBroadcast(intent.setPackage(this.packageName)) diff --git a/service/src/main/java/com/github/kr328/clash/service/util/UpdateUtils.kt b/service/src/main/java/com/github/kr328/clash/service/util/UpdateUtils.kt index 626a340..91f6a40 100644 --- a/service/src/main/java/com/github/kr328/clash/service/util/UpdateUtils.kt +++ b/service/src/main/java/com/github/kr328/clash/service/util/UpdateUtils.kt @@ -4,7 +4,7 @@ import android.app.AlarmManager import android.app.PendingIntent import android.content.Context import android.content.Intent -import com.github.kr328.clash.service.Intents +import com.github.kr328.clash.component.ids.Intents import com.github.kr328.clash.service.ProfileRequestReceiver import com.github.kr328.clash.service.data.ClashProfileEntity