From 8079b5da5173c683b10c93b67cf8089613fb8b93 Mon Sep 17 00:00:00 2001 From: Mikunj Varsani Date: Fri, 13 Mar 2020 13:49:39 +1100 Subject: [PATCH] Clean --- .../loki/redesign/activities/JoinPublicChatActivity.kt | 3 +-- .../loki/redesign/activities/LinkedDevicesActivity.kt | 10 ++-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/org/thoughtcrime/securesms/loki/redesign/activities/JoinPublicChatActivity.kt b/src/org/thoughtcrime/securesms/loki/redesign/activities/JoinPublicChatActivity.kt index b293977cd5..fe94c3bb2f 100644 --- a/src/org/thoughtcrime/securesms/loki/redesign/activities/JoinPublicChatActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/redesign/activities/JoinPublicChatActivity.kt @@ -63,8 +63,7 @@ class JoinPublicChatActivity : PassphraseRequiredActionBarActivity(), ScanQRCode fun joinPublicChatIfPossible(url: String) { if (!Patterns.WEB_URL.matcher(url).matches() || !url.startsWith("https://")) { - Toast.makeText(this, "Invalid URL", Toast.LENGTH_SHORT).show() - return + return Toast.makeText(this, "Invalid URL", Toast.LENGTH_SHORT).show() } showLoader() diff --git a/src/org/thoughtcrime/securesms/loki/redesign/activities/LinkedDevicesActivity.kt b/src/org/thoughtcrime/securesms/loki/redesign/activities/LinkedDevicesActivity.kt index 0c3e290556..d9147fbfdd 100644 --- a/src/org/thoughtcrime/securesms/loki/redesign/activities/LinkedDevicesActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/redesign/activities/LinkedDevicesActivity.kt @@ -12,9 +12,7 @@ import android.view.View import android.widget.Toast import kotlinx.android.synthetic.main.activity_linked_devices.* import network.loki.messenger.R -import nl.komponents.kovenant.Kovenant import nl.komponents.kovenant.functional.bind -import nl.komponents.kovenant.task import nl.komponents.kovenant.ui.failUi import nl.komponents.kovenant.ui.successUi import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity @@ -26,8 +24,8 @@ import org.thoughtcrime.securesms.loki.signAndSendDeviceLinkMessage import org.thoughtcrime.securesms.sms.MessageSender import org.thoughtcrime.securesms.util.TextSecurePreferences import org.whispersystems.signalservice.loki.api.DeviceLink +import org.whispersystems.signalservice.loki.api.LokiAPI import org.whispersystems.signalservice.loki.api.LokiFileServerAPI -import org.whispersystems.signalservice.loki.utilities.createContext import java.util.* import kotlin.concurrent.schedule @@ -147,11 +145,7 @@ class LinkedDevicesActivity : PassphraseRequiredActionBarActivity, LoaderManager } override fun onDeviceLinkRequestAuthorized(deviceLink: DeviceLink) { - val context = Kovenant.createContext("Multi-device") - LokiFileServerAPI.shared.addDeviceLink(deviceLink) - task(context) { - 1 - }.bind { + LokiFileServerAPI.shared.addDeviceLink(deviceLink).bind(LokiAPI.sharedWorkContext) { signAndSendDeviceLinkMessage(this, deviceLink) }.successUi { LoaderManager.getInstance(this).restartLoader(0, null, this)