From cf94716059db6eb2a3b86c15bbed849f6c8fec81 Mon Sep 17 00:00:00 2001 From: Catfriend1 Date: Tue, 12 Feb 2019 02:02:42 +0100 Subject: [PATCH] Move notificationHandler shutdown from RestApi to SyncthingService --- .../java/com/nutomic/syncthingandroid/service/RestApi.java | 6 ------ .../nutomic/syncthingandroid/service/SyncthingService.java | 5 ++++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/nutomic/syncthingandroid/service/RestApi.java b/app/src/main/java/com/nutomic/syncthingandroid/service/RestApi.java index 23c5bb5e..a46f5382 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/service/RestApi.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/service/RestApi.java @@ -147,8 +147,6 @@ public class RestApi { private Gson mGson; - @Inject NotificationHandler mNotificationHandler; - public RestApi(Context context, URL url, String apiKey, OnApiAvailableListener apiListener, OnConfigChangedListener configListener) { ((SyncthingApp) context.getApplicationContext()).component().inject(this); @@ -412,10 +410,6 @@ public class RestApi { mOnConfigChangedListener.onConfigChanged(); } - public void shutdown() { - mNotificationHandler.cancelRestartNotification(); - } - /** * Returns the version name, or a (text) error message on failure. */ diff --git a/app/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java b/app/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java index 9c9f92e8..bdbce875 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java @@ -653,8 +653,11 @@ public class SyncthingService extends Service { mEventProcessor = null; } + if (mNotificationHandler != null) { + mNotificationHandler.cancelRestartNotification(); + } + if (mRestApi != null) { - mRestApi.shutdown(); mRestApi = null; }