This commit is contained in:
Mikunj Varsani 2020-03-13 13:49:39 +11:00
parent a256f59231
commit 8079b5da51
2 changed files with 3 additions and 10 deletions

View File

@ -63,8 +63,7 @@ class JoinPublicChatActivity : PassphraseRequiredActionBarActivity(), ScanQRCode
fun joinPublicChatIfPossible(url: String) { fun joinPublicChatIfPossible(url: String) {
if (!Patterns.WEB_URL.matcher(url).matches() || !url.startsWith("https://")) { if (!Patterns.WEB_URL.matcher(url).matches() || !url.startsWith("https://")) {
Toast.makeText(this, "Invalid URL", Toast.LENGTH_SHORT).show() return Toast.makeText(this, "Invalid URL", Toast.LENGTH_SHORT).show()
return
} }
showLoader() showLoader()

View File

@ -12,9 +12,7 @@ import android.view.View
import android.widget.Toast import android.widget.Toast
import kotlinx.android.synthetic.main.activity_linked_devices.* import kotlinx.android.synthetic.main.activity_linked_devices.*
import network.loki.messenger.R import network.loki.messenger.R
import nl.komponents.kovenant.Kovenant
import nl.komponents.kovenant.functional.bind import nl.komponents.kovenant.functional.bind
import nl.komponents.kovenant.task
import nl.komponents.kovenant.ui.failUi import nl.komponents.kovenant.ui.failUi
import nl.komponents.kovenant.ui.successUi import nl.komponents.kovenant.ui.successUi
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity 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.sms.MessageSender
import org.thoughtcrime.securesms.util.TextSecurePreferences import org.thoughtcrime.securesms.util.TextSecurePreferences
import org.whispersystems.signalservice.loki.api.DeviceLink 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.api.LokiFileServerAPI
import org.whispersystems.signalservice.loki.utilities.createContext
import java.util.* import java.util.*
import kotlin.concurrent.schedule import kotlin.concurrent.schedule
@ -147,11 +145,7 @@ class LinkedDevicesActivity : PassphraseRequiredActionBarActivity, LoaderManager
} }
override fun onDeviceLinkRequestAuthorized(deviceLink: DeviceLink) { override fun onDeviceLinkRequestAuthorized(deviceLink: DeviceLink) {
val context = Kovenant.createContext("Multi-device") LokiFileServerAPI.shared.addDeviceLink(deviceLink).bind(LokiAPI.sharedWorkContext) {
LokiFileServerAPI.shared.addDeviceLink(deviceLink)
task(context) {
1
}.bind {
signAndSendDeviceLinkMessage(this, deviceLink) signAndSendDeviceLinkMessage(this, deviceLink)
}.successUi { }.successUi {
LoaderManager.getInstance(this).restartLoader(0, null, this) LoaderManager.getInstance(this).restartLoader(0, null, this)