From 76965d3e1147a1fa4e05db6ead4438a04c20aaa6 Mon Sep 17 00:00:00 2001 From: p1gp1g Date: Mon, 28 Dec 2020 12:16:41 +0100 Subject: [PATCH] unregisterAck -> unregister --- .../java/com/github/gotify/service/PushNotification.kt | 7 ++----- .../com/github/gotify/service/RegisterBroadcastReceiver.kt | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) 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) } } }