mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 00:37:47 +00:00
Move file
This commit is contained in:
parent
fb9567a61b
commit
597b7f157c
@ -73,7 +73,7 @@ import org.thoughtcrime.securesms.loki.LokiMessageDatabase;
|
||||
import org.thoughtcrime.securesms.loki.LokiSessionResetImplementation;
|
||||
import org.thoughtcrime.securesms.loki.LokiThreadDatabase;
|
||||
import org.thoughtcrime.securesms.loki.MultiDeviceUtilities;
|
||||
import org.thoughtcrime.securesms.loki.OpenGroupUtilities;
|
||||
import org.thoughtcrime.securesms.loki.redesign.utilities.OpenGroupUtilities;
|
||||
import org.thoughtcrime.securesms.loki.redesign.activities.HomeActivity;
|
||||
import org.thoughtcrime.securesms.loki.redesign.messaging.LokiAPIUtilities;
|
||||
import org.thoughtcrime.securesms.loki.redesign.messaging.LokiPreKeyBundleDatabase;
|
||||
@ -764,7 +764,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
String url = openGroup.getServer();
|
||||
long channel = openGroup.getChannel();
|
||||
OpenGroupUtilities.addGroup(context, url, channel).fail(e -> {
|
||||
Log.d("Loki", "Failed to sync open group " + url + " due to error: " + e + ".");
|
||||
Log.d("Loki", "Failed to sync open group: " + url + " due to error: " + e + ".");
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
|
||||
class MultiDeviceOpenGroupUpdateJob private constructor(parameters: Parameters) : BaseJob(parameters), InjectableType {
|
||||
|
||||
companion object {
|
||||
const val KEY = "MultiDeviceGroupUpdateJob"
|
||||
private val TAG = MultiDeviceOpenGroupUpdateJob::class.java.simpleName
|
||||
}
|
||||
|
||||
@Inject
|
||||
@ -32,18 +32,14 @@ class MultiDeviceOpenGroupUpdateJob private constructor(parameters: Parameters)
|
||||
.setMaxAttempts(Parameters.UNLIMITED)
|
||||
.build())
|
||||
|
||||
override fun getFactoryKey(): String {
|
||||
return KEY
|
||||
}
|
||||
override fun getFactoryKey(): String { return KEY }
|
||||
|
||||
override fun serialize(): Data {
|
||||
return Data.EMPTY
|
||||
}
|
||||
override fun serialize(): Data { return Data.EMPTY }
|
||||
|
||||
@Throws(Exception::class)
|
||||
public override fun onRun() {
|
||||
if (!TextSecurePreferences.isMultiDevice(context)) {
|
||||
Log.i(TAG, "Not multi device, aborting...")
|
||||
Log.d("Loki", "Not multi device; aborting...")
|
||||
return
|
||||
}
|
||||
|
||||
@ -65,7 +61,7 @@ class MultiDeviceOpenGroupUpdateJob private constructor(parameters: Parameters)
|
||||
messageSender.sendMessage(0, SignalServiceSyncMessage.forOpenGroups(openGroups),
|
||||
UnidentifiedAccessUtil.getAccessForSync(context))
|
||||
} else {
|
||||
Log.d(TAG, "No open groups to sync.")
|
||||
Log.d("Loki", "No open groups to sync.")
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,6 +72,7 @@ class MultiDeviceOpenGroupUpdateJob private constructor(parameters: Parameters)
|
||||
override fun onCanceled() { }
|
||||
|
||||
class Factory : Job.Factory<MultiDeviceOpenGroupUpdateJob> {
|
||||
|
||||
override fun create(parameters: Parameters, data: Data): MultiDeviceOpenGroupUpdateJob {
|
||||
return MultiDeviceOpenGroupUpdateJob(parameters)
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import nl.komponents.kovenant.ui.failUi
|
||||
import nl.komponents.kovenant.ui.successUi
|
||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||
import org.thoughtcrime.securesms.loki.OpenGroupUtilities
|
||||
import org.thoughtcrime.securesms.loki.redesign.utilities.OpenGroupUtilities
|
||||
import org.thoughtcrime.securesms.loki.redesign.fragments.ScanQRCodeWrapperFragment
|
||||
import org.thoughtcrime.securesms.loki.redesign.fragments.ScanQRCodeWrapperFragmentDelegate
|
||||
import org.thoughtcrime.securesms.sms.MessageSender
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.thoughtcrime.securesms.loki
|
||||
package org.thoughtcrime.securesms.loki.redesign.utilities
|
||||
|
||||
import android.content.Context
|
||||
import nl.komponents.kovenant.Promise
|
||||
@ -11,19 +11,17 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||
import org.whispersystems.signalservice.loki.api.LokiPublicChat
|
||||
|
||||
object OpenGroupUtilities {
|
||||
@JvmStatic fun addGroup(context: Context, url: String, channel: Long): Promise<LokiPublicChat, Exception> {
|
||||
// Check if we have an existing group
|
||||
val groupId = LokiPublicChat.getId(channel, url)
|
||||
val threadID = GroupManager.getPublicChatThreadId(groupId, context)
|
||||
val openGroup = DatabaseFactory.getLokiThreadDatabase(context).getPublicChat(threadID)
|
||||
if (openGroup != null) {
|
||||
return Promise.of(openGroup)
|
||||
}
|
||||
|
||||
@JvmStatic fun addGroup(context: Context, url: String, channel: Long): Promise<LokiPublicChat, Exception> {
|
||||
// Check for an existing group
|
||||
val groupID = LokiPublicChat.getId(channel, url)
|
||||
val threadID = GroupManager.getPublicChatThreadId(groupID, context)
|
||||
val openGroup = DatabaseFactory.getLokiThreadDatabase(context).getPublicChat(threadID)
|
||||
if (openGroup != null) { return Promise.of(openGroup) }
|
||||
// Add the new group
|
||||
val application = ApplicationContext.getInstance(context)
|
||||
val displayName = TextSecurePreferences.getProfileName(context)
|
||||
val lokiPublicChatAPI = application.lokiPublicChatAPI ?: throw Error("LokiPublicChatAPI is not initialized")
|
||||
val lokiPublicChatAPI = application.lokiPublicChatAPI ?: throw Error("LokiPublicChatAPI is not initialized.")
|
||||
return application.lokiPublicChatManager.addChat(url, channel).then { group ->
|
||||
DatabaseFactory.getLokiAPIDatabase(context).removeLastMessageServerID(channel, url)
|
||||
DatabaseFactory.getLokiAPIDatabase(context).removeLastDeletionServerID(channel, url)
|
Loading…
x
Reference in New Issue
Block a user