Improve logging around profile uploads.

fork-5.53.8
Greyson Parrelli 2022-02-22 10:19:37 -05:00
rodzic 1b404cef34
commit cbfa573d3d
2 zmienionych plików z 14 dodań i 7 usunięć

Wyświetl plik

@ -940,6 +940,7 @@ open class RecipientDatabase(context: Context, databaseHelper: SignalDatabase) :
} }
if (remoteKey != localKey) { if (remoteKey != localKey) {
Log.w(TAG, "Profile key changed during storage sync! Scheduling jobs to refresh things.")
ApplicationDependencies.getJobManager().add(RefreshAttributesJob()) ApplicationDependencies.getJobManager().add(RefreshAttributesJob())
} }

Wyświetl plik

@ -191,6 +191,7 @@ public final class ProfileUtil {
* successfully before persisting the change to disk. * successfully before persisting the change to disk.
*/ */
public static void uploadProfileWithBadges(@NonNull Context context, @NonNull List<Badge> badges) throws IOException { public static void uploadProfileWithBadges(@NonNull Context context, @NonNull List<Badge> badges) throws IOException {
Log.d(TAG, "uploadProfileWithBadges()");
try (StreamDetails avatar = AvatarHelper.getSelfProfileAvatarStream(context)) { try (StreamDetails avatar = AvatarHelper.getSelfProfileAvatarStream(context)) {
uploadProfile(context, uploadProfile(context,
Recipient.self().getProfileName(), Recipient.self().getProfileName(),
@ -208,6 +209,7 @@ public final class ProfileUtil {
* successfully before persisting the change to disk. * successfully before persisting the change to disk.
*/ */
public static void uploadProfileWithName(@NonNull Context context, @NonNull ProfileName profileName) throws IOException { public static void uploadProfileWithName(@NonNull Context context, @NonNull ProfileName profileName) throws IOException {
Log.d(TAG, "uploadProfileWithName()");
try (StreamDetails avatar = AvatarHelper.getSelfProfileAvatarStream(context)) { try (StreamDetails avatar = AvatarHelper.getSelfProfileAvatarStream(context)) {
uploadProfile(context, uploadProfile(context,
profileName, profileName,
@ -225,6 +227,7 @@ public final class ProfileUtil {
* successfully before persisting the change to disk. * successfully before persisting the change to disk.
*/ */
public static void uploadProfileWithAbout(@NonNull Context context, @NonNull String about, @NonNull String emoji) throws IOException { public static void uploadProfileWithAbout(@NonNull Context context, @NonNull String about, @NonNull String emoji) throws IOException {
Log.d(TAG, "uploadProfileWithAbout()");
try (StreamDetails avatar = AvatarHelper.getSelfProfileAvatarStream(context)) { try (StreamDetails avatar = AvatarHelper.getSelfProfileAvatarStream(context)) {
uploadProfile(context, uploadProfile(context,
Recipient.self().getProfileName(), Recipient.self().getProfileName(),
@ -240,6 +243,7 @@ public final class ProfileUtil {
* Uploads the profile based on all state that's already written to disk. * Uploads the profile based on all state that's already written to disk.
*/ */
public static void uploadProfile(@NonNull Context context) throws IOException { public static void uploadProfile(@NonNull Context context) throws IOException {
Log.d(TAG, "uploadProfile()");
try (StreamDetails avatar = AvatarHelper.getSelfProfileAvatarStream(context)) { try (StreamDetails avatar = AvatarHelper.getSelfProfileAvatarStream(context)) {
uploadProfileWithAvatar(context, avatar); uploadProfileWithAvatar(context, avatar);
} }
@ -251,13 +255,14 @@ public final class ProfileUtil {
* successfully before persisting the change to disk. * successfully before persisting the change to disk.
*/ */
public static void uploadProfileWithAvatar(@NonNull Context context, @Nullable StreamDetails avatar) throws IOException { public static void uploadProfileWithAvatar(@NonNull Context context, @Nullable StreamDetails avatar) throws IOException {
uploadProfile(context, Log.d(TAG, "uploadProfileWithAvatar()");
Recipient.self().getProfileName(), uploadProfile(context,
Optional.fromNullable(Recipient.self().getAbout()).or(""), Recipient.self().getProfileName(),
Optional.fromNullable(Recipient.self().getAboutEmoji()).or(""), Optional.fromNullable(Recipient.self().getAbout()).or(""),
getSelfPaymentsAddressProtobuf(), Optional.fromNullable(Recipient.self().getAboutEmoji()).or(""),
avatar, getSelfPaymentsAddressProtobuf(),
Recipient.self().getBadges()); avatar,
Recipient.self().getBadges());
} }
private static void uploadProfile(@NonNull Context context, private static void uploadProfile(@NonNull Context context,
@ -275,6 +280,7 @@ public final class ProfileUtil {
.map(Badge::getId) .map(Badge::getId)
.collect(Collectors.toList()); .collect(Collectors.toList());
Log.d(TAG, "Uploading " + (!profileName.isEmpty() ? "non-" : "") + "empty profile name.");
Log.d(TAG, "Uploading " + (!Util.isEmpty(about) ? "non-" : "") + "empty about."); Log.d(TAG, "Uploading " + (!Util.isEmpty(about) ? "non-" : "") + "empty about.");
Log.d(TAG, "Uploading " + (!Util.isEmpty(aboutEmoji) ? "non-" : "") + "empty emoji."); Log.d(TAG, "Uploading " + (!Util.isEmpty(aboutEmoji) ? "non-" : "") + "empty emoji.");
Log.d(TAG, "Uploading " + (paymentsAddress != null ? "non-" : "") + "empty payments address."); Log.d(TAG, "Uploading " + (paymentsAddress != null ? "non-" : "") + "empty payments address.");