|
|
|
@ -209,6 +209,7 @@ import org.thoughtcrime.securesms.util.Dialogs;
|
|
|
|
|
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
|
|
|
|
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
|
|
|
|
import org.thoughtcrime.securesms.util.ExpirationUtil;
|
|
|
|
|
import org.thoughtcrime.securesms.util.GroupUtil;
|
|
|
|
|
import org.thoughtcrime.securesms.util.IdentityUtil;
|
|
|
|
|
import org.thoughtcrime.securesms.util.MediaUtil;
|
|
|
|
|
import org.thoughtcrime.securesms.util.ServiceUtil;
|
|
|
|
@ -227,6 +228,7 @@ import org.whispersystems.signalservice.loki.protocol.mentions.Mention;
|
|
|
|
|
import org.whispersystems.signalservice.loki.protocol.mentions.MentionsManager;
|
|
|
|
|
import org.whispersystems.signalservice.loki.protocol.meta.SessionMetaProtocol;
|
|
|
|
|
import org.whispersystems.signalservice.loki.protocol.shelved.multidevice.MultiDeviceProtocol;
|
|
|
|
|
import org.whispersystems.signalservice.loki.utilities.HexEncodingKt;
|
|
|
|
|
import org.whispersystems.signalservice.loki.utilities.PublicKeyValidation;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
@ -1165,10 +1167,19 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|
|
|
|
builder.setCancelable(true);
|
|
|
|
|
builder.setMessage(getString(R.string.ConversationActivity_are_you_sure_you_want_to_leave_this_group));
|
|
|
|
|
builder.setPositiveButton(R.string.yes, (dialog, which) -> {
|
|
|
|
|
Recipient groupRecipient = getRecipient();
|
|
|
|
|
if (ClosedGroupsProtocol.leaveLegacyGroup(this, groupRecipient)) {
|
|
|
|
|
initializeEnabledCheck();
|
|
|
|
|
} else {
|
|
|
|
|
Recipient groupRecipient = getRecipient();
|
|
|
|
|
try {
|
|
|
|
|
String groupPublicKey = HexEncodingKt.toHexString(GroupUtil.getDecodedId(groupRecipient.getAddress().toString()));
|
|
|
|
|
boolean isSSKBasedClosedGroup = DatabaseFactory.getSSKDatabase(this).isSSKBasedClosedGroup(groupPublicKey);
|
|
|
|
|
if (isSSKBasedClosedGroup) {
|
|
|
|
|
ClosedGroupsProtocol.leave(this, groupPublicKey);
|
|
|
|
|
initializeEnabledCheck();
|
|
|
|
|
} else if (ClosedGroupsProtocol.leaveLegacyGroup(this, groupRecipient)) {
|
|
|
|
|
initializeEnabledCheck();
|
|
|
|
|
} else {
|
|
|
|
|
Toast.makeText(this, R.string.ConversationActivity_error_leaving_group, Toast.LENGTH_LONG).show();
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
Toast.makeText(this, R.string.ConversationActivity_error_leaving_group, Toast.LENGTH_LONG).show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|