From 05d8dae4e09e3bedcef5bae2b3e316a6803f32f4 Mon Sep 17 00:00:00 2001 From: Kr328 <39107975+Kr328@users.noreply.github.com> Date: Wed, 1 Apr 2020 00:52:36 +0800 Subject: [PATCH] fix notification not show profile --- .../src/main/java/com/github/kr328/clash/service/ClashCore.kt | 3 +++ .../java/com/github/kr328/clash/service/ClashNotification.kt | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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 50d5b8f..e13c789 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 @@ -143,6 +143,9 @@ class ClashCore(private val service: Service) : CoroutineScope by MainScope() { notification.setProfile(active.name) + if (!settings.get(ServiceSettings.NOTIFICATION_REFRESH)) + notification.updateBase() + broadcastProfileLoaded(service) } catch (e: Exception) { stopSelf(e.message ?: "Unknown") 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 f57a895..ce43c18 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 @@ -66,7 +66,7 @@ class ClashNotification( context.startForeground(CLASH_STATUS_NOTIFICATION_ID, notification) } - private fun updateBase() { + fun updateBase() { val notification = baseBuilder .setContentTitle(currentProfile) .setContentText(context.getText(R.string.running))