Improve logging and the naming of some fields.

This commit is contained in:
Greyson Parrelli
2024-01-12 14:43:22 -05:00
parent 64fff2adb2
commit e361795184
12 changed files with 65 additions and 63 deletions

View File

@@ -212,13 +212,13 @@ public class CreateProfileFragment extends LoggingFragment {
if (FeatureFlags.phoneNumberPrivacy()) {
getParentFragmentManager().setFragmentResultListener(WhoCanFindMeByPhoneNumberFragment.REQUEST_KEY, getViewLifecycleOwner(), (requestKey, result) -> {
if (WhoCanFindMeByPhoneNumberFragment.REQUEST_KEY.equals(requestKey)) {
presentWhoCanFindMeDescription(SignalStore.phoneNumberPrivacy().getPhoneNumberListingMode());
presentWhoCanFindMeDescription(SignalStore.phoneNumberPrivacy().getPhoneNumberDiscoverabilityMode());
}
});
binding.whoCanFindMeContainer.setVisibility(View.VISIBLE);
binding.whoCanFindMeContainer.setOnClickListener(v -> SafeNavigation.safeNavigate(Navigation.findNavController(v), CreateProfileFragmentDirections.actionCreateProfileFragmentToPhoneNumberPrivacy()));
presentWhoCanFindMeDescription(SignalStore.phoneNumberPrivacy().getPhoneNumberListingMode());
presentWhoCanFindMeDescription(SignalStore.phoneNumberPrivacy().getPhoneNumberDiscoverabilityMode());
}
}
@@ -285,12 +285,12 @@ public class CreateProfileFragment extends LoggingFragment {
}
}
private void presentWhoCanFindMeDescription(PhoneNumberPrivacyValues.PhoneNumberListingMode phoneNumberListingMode) {
private void presentWhoCanFindMeDescription(PhoneNumberPrivacyValues.PhoneNumberDiscoverabilityMode phoneNumberListingMode) {
switch (phoneNumberListingMode) {
case LISTED:
case DISCOVERABLE:
binding.whoCanFindMeDescription.setText(R.string.PhoneNumberPrivacy_everyone);
break;
case UNLISTED:
case NOT_DISCOVERABLE:
binding.whoCanFindMeDescription.setText(R.string.PhoneNumberPrivacy_nobody);
break;
}

View File

@@ -14,9 +14,9 @@ import org.thoughtcrime.securesms.storage.StorageSyncHelper
class WhoCanFindMeByPhoneNumberRepository {
fun getCurrentState(): WhoCanFindMeByPhoneNumberState {
return when (SignalStore.phoneNumberPrivacy().phoneNumberListingMode) {
PhoneNumberPrivacyValues.PhoneNumberListingMode.LISTED -> WhoCanFindMeByPhoneNumberState.EVERYONE
PhoneNumberPrivacyValues.PhoneNumberListingMode.UNLISTED -> WhoCanFindMeByPhoneNumberState.NOBODY
return when (SignalStore.phoneNumberPrivacy().phoneNumberDiscoverabilityMode) {
PhoneNumberPrivacyValues.PhoneNumberDiscoverabilityMode.DISCOVERABLE -> WhoCanFindMeByPhoneNumberState.EVERYONE
PhoneNumberPrivacyValues.PhoneNumberDiscoverabilityMode.NOT_DISCOVERABLE -> WhoCanFindMeByPhoneNumberState.NOBODY
}
}
@@ -24,11 +24,11 @@ class WhoCanFindMeByPhoneNumberRepository {
return Completable.fromAction {
when (whoCanFindMeByPhoneNumberState) {
WhoCanFindMeByPhoneNumberState.EVERYONE -> {
SignalStore.phoneNumberPrivacy().phoneNumberListingMode = PhoneNumberPrivacyValues.PhoneNumberListingMode.LISTED
SignalStore.phoneNumberPrivacy().phoneNumberDiscoverabilityMode = PhoneNumberPrivacyValues.PhoneNumberDiscoverabilityMode.DISCOVERABLE
}
WhoCanFindMeByPhoneNumberState.NOBODY -> {
SignalStore.phoneNumberPrivacy().phoneNumberSharingMode = PhoneNumberPrivacyValues.PhoneNumberSharingMode.NOBODY
SignalStore.phoneNumberPrivacy().phoneNumberListingMode = PhoneNumberPrivacyValues.PhoneNumberListingMode.UNLISTED
SignalStore.phoneNumberPrivacy().phoneNumberDiscoverabilityMode = PhoneNumberPrivacyValues.PhoneNumberDiscoverabilityMode.NOT_DISCOVERABLE
}
}