From 732a24692ebd23a10b670f2e4134ad92676bc186 Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Fri, 2 Nov 2018 03:53:23 +0100 Subject: [PATCH] Fix #339 and update jobs --- app/build.gradle | 6 +++--- .../com/nextcloud/talk/controllers/SettingsController.java | 4 ++++ .../java/com/nextcloud/talk/jobs/AccountRemovalWorker.java | 5 +++++ .../java/com/nextcloud/talk/jobs/CapabilitiesWorker.java | 7 +++++++ .../java/com/nextcloud/talk/jobs/NotificationWorker.java | 5 +++++ .../com/nextcloud/talk/jobs/PushRegistrationWorker.java | 7 +++++++ .../java/com/nextcloud/talk/jobs/SignalingSettingsJob.java | 6 ++++++ .../nextcloud/talk/jobs/WebsocketConnectionsWorker.java | 6 ++++++ 8 files changed, 43 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9d9a5d597..f9661b595 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -93,7 +93,7 @@ android { ext { supportLibraryVersion = '28.0.0' - workVersion = "1.0.0-alpha09" + workVersion = "1.0.0-alpha10" } @@ -155,8 +155,8 @@ dependencies { compileOnly "org.projectlombok:lombok:1.18.2" annotationProcessor "org.projectlombok:lombok:1.18.2" - implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT' - annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT' + implementation 'com.jakewharton:butterknife:9.0.0-rc1' + annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1' implementation 'com.github.HITGIF:TextFieldBoxes:1.4.3' diff --git a/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java b/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java index ec0923522..1064724ff 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java @@ -316,6 +316,10 @@ public class SettingsController extends BaseController { dispose(null); getCurrentUser(); + if (shouldVibrateSwitchPreference.getVisibility() == View.VISIBLE) { + shouldVibrateSwitchPreference.setActivated(appPreferences.getShouldVibrateSetting()); + } + if (!TextUtils.isEmpty(currentUser.getClientCertificate())) { certificateSetup.setTitle(R.string.nc_client_cert_change); } else { diff --git a/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java b/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java index d8fb351ca..3c07bd15b 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java @@ -47,6 +47,7 @@ import javax.inject.Inject; import androidx.annotation.NonNull; import androidx.work.Worker; +import androidx.work.WorkerParameters; import autodagger.AutoInjector; import io.reactivex.CompletableObserver; import io.reactivex.Observer; @@ -70,6 +71,10 @@ public class AccountRemovalWorker extends Worker { NcApi ncApi; + public AccountRemovalWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { + super(context, workerParams); + } + @NonNull @Override public Result doWork() { diff --git a/app/src/main/java/com/nextcloud/talk/jobs/CapabilitiesWorker.java b/app/src/main/java/com/nextcloud/talk/jobs/CapabilitiesWorker.java index 17214100d..66232ab13 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/CapabilitiesWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/CapabilitiesWorker.java @@ -20,6 +20,7 @@ package com.nextcloud.talk.jobs; +import android.content.Context; import android.util.Log; import com.bluelinelabs.logansquare.LoganSquare; @@ -44,6 +45,7 @@ import javax.inject.Inject; import androidx.annotation.NonNull; import androidx.work.Data; import androidx.work.Worker; +import androidx.work.WorkerParameters; import autodagger.AutoInjector; import io.reactivex.Observer; import io.reactivex.disposables.Disposable; @@ -69,6 +71,11 @@ public class CapabilitiesWorker extends Worker { NcApi ncApi; + public CapabilitiesWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { + super(context, workerParams); + + } + private void updateUser(CapabilitiesOverall capabilitiesOverall, UserEntity internalUserEntity) { try { userUtils.createOrUpdateUser(null, null, diff --git a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java index 39e84a214..76c6bd19d 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java @@ -78,6 +78,7 @@ import javax.inject.Inject; import androidx.annotation.NonNull; import androidx.work.Data; import androidx.work.Worker; +import androidx.work.WorkerParameters; import autodagger.AutoInjector; import io.reactivex.Observer; import io.reactivex.disposables.Disposable; @@ -107,6 +108,10 @@ public class NotificationWorker extends Worker { private String credentials; + public NotificationWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { + super(context, workerParams); + } + private void showNotificationForCallWithNoPing(Intent intent) { UserEntity userEntity = signatureVerification.getUserEntity(); ncApi.getRoom(credentials, ApiUtils.getRoom(userEntity.getBaseUrl(), diff --git a/app/src/main/java/com/nextcloud/talk/jobs/PushRegistrationWorker.java b/app/src/main/java/com/nextcloud/talk/jobs/PushRegistrationWorker.java index 625dda86a..b56c2ebde 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/PushRegistrationWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/PushRegistrationWorker.java @@ -20,14 +20,21 @@ package com.nextcloud.talk.jobs; +import android.content.Context; + import com.nextcloud.talk.utils.PushUtils; import androidx.annotation.NonNull; import androidx.work.Worker; +import androidx.work.WorkerParameters; public class PushRegistrationWorker extends Worker { public static final String TAG = "PushRegistrationWorker"; + public PushRegistrationWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { + super(context, workerParams); + } + @NonNull @Override public Result doWork() { diff --git a/app/src/main/java/com/nextcloud/talk/jobs/SignalingSettingsJob.java b/app/src/main/java/com/nextcloud/talk/jobs/SignalingSettingsJob.java index 2ca384297..d3a637813 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/SignalingSettingsJob.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/SignalingSettingsJob.java @@ -20,6 +20,7 @@ package com.nextcloud.talk.jobs; +import android.content.Context; import android.text.TextUtils; import android.util.Log; @@ -47,6 +48,7 @@ import androidx.work.Data; import androidx.work.OneTimeWorkRequest; import androidx.work.WorkManager; import androidx.work.Worker; +import androidx.work.WorkerParameters; import autodagger.AutoInjector; import io.reactivex.Observer; import io.reactivex.disposables.Disposable; @@ -64,6 +66,10 @@ public class SignalingSettingsJob extends Worker { @Inject EventBus eventBus; + public SignalingSettingsJob(@NonNull Context context, @NonNull WorkerParameters workerParams) { + super(context, workerParams); + } + @NonNull @Override public Result doWork() { diff --git a/app/src/main/java/com/nextcloud/talk/jobs/WebsocketConnectionsWorker.java b/app/src/main/java/com/nextcloud/talk/jobs/WebsocketConnectionsWorker.java index 5c14acbb5..128b68712 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/WebsocketConnectionsWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/WebsocketConnectionsWorker.java @@ -21,6 +21,7 @@ package com.nextcloud.talk.jobs; import android.annotation.SuppressLint; +import android.content.Context; import android.text.TextUtils; import android.util.Log; @@ -38,6 +39,7 @@ import javax.inject.Inject; import androidx.annotation.NonNull; import androidx.work.Worker; +import androidx.work.WorkerParameters; import autodagger.AutoInjector; @AutoInjector(NextcloudTalkApplication.class) @@ -48,6 +50,10 @@ public class WebsocketConnectionsWorker extends Worker { @Inject UserUtils userUtils; + public WebsocketConnectionsWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { + super(context, workerParams); + } + @SuppressLint("LongLogTag") @NonNull @Override