diff --git a/app/src/main/java/com/github/gotify/service/PushNotification.kt b/app/src/main/java/com/github/gotify/service/PushNotification.kt index 8bf11bc..cb5dc0a 100644 --- a/app/src/main/java/com/github/gotify/service/PushNotification.kt +++ b/app/src/main/java/com/github/gotify/service/PushNotification.kt @@ -29,11 +29,8 @@ fun sendEndpoint(context: Context, application: String, endpoint: String) { context.sendBroadcast(broadcastIntent) } -fun sendUnregistered(context: Context, application: String, needToken: Boolean){ - val token = getToken(context,application).let{ - if(it.isNullOrEmpty() and needToken) return else it - } - +fun sendUnregistered(context: Context, application: String, _token: String?){ + val token = _token?: getToken(context,application)!! val broadcastIntent = Intent() broadcastIntent.`package` = application broadcastIntent.action = UNREGISTERED diff --git a/app/src/main/java/com/github/gotify/service/RegisterBroadcastReceiver.kt b/app/src/main/java/com/github/gotify/service/RegisterBroadcastReceiver.kt index 8c4cb6f..67021f3 100644 --- a/app/src/main/java/com/github/gotify/service/RegisterBroadcastReceiver.kt +++ b/app/src/main/java/com/github/gotify/service/RegisterBroadcastReceiver.kt @@ -111,7 +111,7 @@ class RegisterBroadcastReceiver: BroadcastReceiver() { db.close() Log.i("RegisterService","Unregistration is finished") } - sendUnregistered(context!!,application,false) + sendUnregistered(context!!,application,token) } } }