Fix crash when opening debuglogs during registration.

master
Greyson Parrelli 2020-08-07 18:31:42 -04:00
parent b369b734ca
commit 99c0c2ff4c
1 changed files with 15 additions and 9 deletions

View File

@ -6,6 +6,7 @@ import androidx.annotation.NonNull;
import org.thoughtcrime.securesms.AppCapabilities;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.signalservice.api.profiles.SignalServiceProfile;
public final class LogSectionCapabilities implements LogSection {
@ -17,16 +18,21 @@ public final class LogSectionCapabilities implements LogSection {
@Override
public @NonNull CharSequence getContent(@NonNull Context context) {
Recipient self = Recipient.self();
if (!self.isRegistered()) {
if (!TextSecurePreferences.isPushRegistered(context)) {
return "Unregistered";
} else {
SignalServiceProfile.Capabilities capabilities = AppCapabilities.getCapabilities(false);
return new StringBuilder().append("Local device UUID : ").append(capabilities.isUuid()).append("\n")
.append("Global UUID : ").append(self.getUuidCapability()).append("\n")
.append("Local device GV2 : ").append(capabilities.isGv2()).append("\n")
.append("Global GV2 : ").append(self.getGroupsV2Capability()).append("\n");
}
if (TextSecurePreferences.getLocalNumber(context) == null || TextSecurePreferences.getLocalUuid(context) == null) {
return "Self not yet available!";
}
Recipient self = Recipient.self();
SignalServiceProfile.Capabilities capabilities = AppCapabilities.getCapabilities(false);
return new StringBuilder().append("Local device UUID : ").append(capabilities.isUuid()).append("\n")
.append("Global UUID : ").append(self.getUuidCapability()).append("\n")
.append("Local device GV2 : ").append(capabilities.isGv2()).append("\n")
.append("Global GV2 : ").append(self.getGroupsV2Capability()).append("\n");
}
}