From 5b822f83c9337e7607a162abdc570e308eaffb38 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Fri, 21 Feb 2020 11:19:20 +0700 Subject: [PATCH] Enforce style convention --- .../securesms/jobs/PushDecryptJob.java | 18 +++++++++--------- .../securesms/loki/MultiDeviceUtilities.kt | 2 +- .../activities/LinkedDevicesActivity.kt | 6 ++---- .../messaging/LokiPreKeyBundleDatabase.kt | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java index 6da22c439c..6d7595b9b8 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java @@ -725,26 +725,26 @@ public class PushDecryptJob extends BaseJob implements InjectableType { private void handleGroupSyncMessage(@NonNull SignalServiceContent content, @NonNull SignalServiceAttachment groupMessage) { if (groupMessage.isStream()) { - Log.d("Loki", "Received group sync message"); + Log.d("Loki", "Received a group sync message."); try { InputStream in = groupMessage.asStream().getInputStream(); DeviceGroupsInputStream groupsInputStream = new DeviceGroupsInputStream(in); List groups = groupsInputStream.readAll(); for (DeviceGroup group : groups) { SignalServiceGroup serviceGroup = new SignalServiceGroup( - SignalServiceGroup.Type.UPDATE, - group.getId(), - SignalServiceGroup.GroupType.SIGNAL, - group.getName().orNull(), - group.getMembers(), - group.getAvatar().orNull(), - group.getAdmins() + SignalServiceGroup.Type.UPDATE, + group.getId(), + SignalServiceGroup.GroupType.SIGNAL, + group.getName().orNull(), + group.getMembers(), + group.getAvatar().orNull(), + group.getAdmins() ); SignalServiceDataMessage dataMessage = new SignalServiceDataMessage(content.getTimestamp(), serviceGroup, null, null); GroupMessageProcessor.process(context, content, dataMessage, false); } } catch (Exception e) { - Log.d("Loki", "Failed to sync group: " + e); + Log.d("Loki", "Failed to sync group due to error: " + e + "."); } } } diff --git a/src/org/thoughtcrime/securesms/loki/MultiDeviceUtilities.kt b/src/org/thoughtcrime/securesms/loki/MultiDeviceUtilities.kt index 116f2a8bd2..6afb77f165 100644 --- a/src/org/thoughtcrime/securesms/loki/MultiDeviceUtilities.kt +++ b/src/org/thoughtcrime/securesms/loki/MultiDeviceUtilities.kt @@ -128,7 +128,7 @@ fun sendDeviceLinkMessage(context: Context, hexEncodedPublicKey: String, deviceL } Promise.ofSuccess(Unit) } catch (e: Exception) { - Log.d("Loki", "Failed to send device link message to $hexEncodedPublicKey: $e") + Log.d("Loki", "Failed to send device link message to: $hexEncodedPublicKey due to error: $e.") Promise.ofFail(e) } } diff --git a/src/org/thoughtcrime/securesms/loki/redesign/activities/LinkedDevicesActivity.kt b/src/org/thoughtcrime/securesms/loki/redesign/activities/LinkedDevicesActivity.kt index 4061a03177..759362b91c 100644 --- a/src/org/thoughtcrime/securesms/loki/redesign/activities/LinkedDevicesActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/redesign/activities/LinkedDevicesActivity.kt @@ -22,7 +22,6 @@ import org.thoughtcrime.securesms.loki.redesign.dialogs.* import org.thoughtcrime.securesms.loki.signAndSendDeviceLinkMessage import org.thoughtcrime.securesms.sms.MessageSender import org.thoughtcrime.securesms.util.TextSecurePreferences -import org.thoughtcrime.securesms.util.Util import org.whispersystems.signalservice.loki.api.DeviceLink import org.whispersystems.signalservice.loki.api.LokiFileServerAPI import java.util.* @@ -153,12 +152,11 @@ class LinkedDevicesActivity : PassphraseRequiredActionBarActivity, LoaderManager MessageSender.syncAllGroups(this@LinkedDevicesActivity) MessageSender.syncAllContacts(this@LinkedDevicesActivity, Address.fromSerialized(deviceLink.slaveHexEncodedPublicKey)) } + }.failUi { + Toast.makeText(this, "Couldn't link device", Toast.LENGTH_LONG).show() }.fail { LokiFileServerAPI.shared.removeDeviceLink(deviceLink) // If this fails we have a problem DatabaseFactory.getLokiPreKeyBundleDatabase(this).removePreKeyBundle(deviceLink.slaveHexEncodedPublicKey) - Util.runOnMain { - Toast.makeText(this, "Couldn't link device", Toast.LENGTH_LONG).show() - } } }.failUi { DatabaseFactory.getLokiPreKeyBundleDatabase(this).removePreKeyBundle(deviceLink.slaveHexEncodedPublicKey) diff --git a/src/org/thoughtcrime/securesms/loki/redesign/messaging/LokiPreKeyBundleDatabase.kt b/src/org/thoughtcrime/securesms/loki/redesign/messaging/LokiPreKeyBundleDatabase.kt index ed464c7a82..caac819d34 100644 --- a/src/org/thoughtcrime/securesms/loki/redesign/messaging/LokiPreKeyBundleDatabase.kt +++ b/src/org/thoughtcrime/securesms/loki/redesign/messaging/LokiPreKeyBundleDatabase.kt @@ -55,7 +55,7 @@ class LokiPreKeyBundleDatabase(context: Context, helper: SQLCipherOpenHelper) : failureCount += 1 } } - Log.w("Loki", "Failed to generate a valid PreKeyBundle for $hexEncodedPublicKey") + Log.w("Loki", "Failed to generate a valid pre key bundle for: $hexEncodedPublicKey.") return null }