Search in sources :

Example 1 with UnexpectedSubscriptionCancellation

use of org.thoughtcrime.securesms.components.settings.app.subscription.errors.UnexpectedSubscriptionCancellation in project Signal-Android by signalapp.

the class ConversationListFragment method onResume.

@Override
public void onResume() {
    super.onResume();
    updateReminders();
    EventBus.getDefault().register(this);
    itemAnimator.disable();
    if (Util.isDefaultSmsProvider(requireContext())) {
        InsightsLauncher.showInsightsModal(requireContext(), requireFragmentManager());
    }
    SimpleTask.run(getViewLifecycleOwner().getLifecycle(), Recipient::self, this::initializeProfileIcon);
    initializeSettingsTouchTarget();
    if ((!searchToolbar.resolved() || !searchToolbar.get().isVisible()) && list.getAdapter() != defaultAdapter) {
        list.removeItemDecoration(searchAdapterDecoration);
        setAdapter(defaultAdapter);
    }
    if (activeAdapter != null) {
        activeAdapter.notifyDataSetChanged();
    }
    SignalProxyUtil.startListeningToWebsocket();
    if (SignalStore.rateLimit().needsRecaptcha()) {
        Log.i(TAG, "Recaptcha required.");
        RecaptchaProofBottomSheetFragment.show(getChildFragmentManager());
    }
    Badge expiredBadge = SignalStore.donationsValues().getExpiredBadge();
    String subscriptionCancellationReason = SignalStore.donationsValues().getUnexpectedSubscriptionCancelationReason();
    UnexpectedSubscriptionCancellation unexpectedSubscriptionCancellation = UnexpectedSubscriptionCancellation.fromStatus(subscriptionCancellationReason);
    if (expiredBadge != null) {
        SignalStore.donationsValues().setExpiredBadge(null);
        if (expiredBadge.isBoost() || !SignalStore.donationsValues().isUserManuallyCancelled()) {
            Log.w(TAG, "Displaying bottom sheet for an expired badge", true);
            ExpiredBadgeBottomSheetDialogFragment.show(expiredBadge, unexpectedSubscriptionCancellation, getParentFragmentManager());
        }
    } else if (unexpectedSubscriptionCancellation != null && !SignalStore.donationsValues().isUserManuallyCancelled() && SignalStore.donationsValues().getShowCantProcessDialog()) {
        Log.w(TAG, "Displaying bottom sheet for unexpected cancellation: " + unexpectedSubscriptionCancellation, true);
        new CantProcessSubscriptionPaymentBottomSheetDialogFragment().show(getChildFragmentManager(), BottomSheetUtil.STANDARD_BOTTOM_SHEET_FRAGMENT_TAG);
    }
}
Also used : CantProcessSubscriptionPaymentBottomSheetDialogFragment(org.thoughtcrime.securesms.badges.self.expired.CantProcessSubscriptionPaymentBottomSheetDialogFragment) Recipient(org.thoughtcrime.securesms.recipients.Recipient) Badge(org.thoughtcrime.securesms.badges.models.Badge) UnexpectedSubscriptionCancellation(org.thoughtcrime.securesms.components.settings.app.subscription.errors.UnexpectedSubscriptionCancellation)

Example 2 with UnexpectedSubscriptionCancellation

use of org.thoughtcrime.securesms.components.settings.app.subscription.errors.UnexpectedSubscriptionCancellation in project Signal-Android by WhisperSystems.

the class ConversationListFragment method onResume.

@Override
public void onResume() {
    super.onResume();
    updateReminders();
    EventBus.getDefault().register(this);
    itemAnimator.disable();
    if (Util.isDefaultSmsProvider(requireContext())) {
        InsightsLauncher.showInsightsModal(requireContext(), requireFragmentManager());
    }
    SimpleTask.run(getViewLifecycleOwner().getLifecycle(), Recipient::self, this::initializeProfileIcon);
    initializeSettingsTouchTarget();
    if ((!searchToolbar.resolved() || !searchToolbar.get().isVisible()) && list.getAdapter() != defaultAdapter) {
        list.removeItemDecoration(searchAdapterDecoration);
        setAdapter(defaultAdapter);
    }
    if (activeAdapter != null) {
        activeAdapter.notifyDataSetChanged();
    }
    SignalProxyUtil.startListeningToWebsocket();
    if (SignalStore.rateLimit().needsRecaptcha()) {
        Log.i(TAG, "Recaptcha required.");
        RecaptchaProofBottomSheetFragment.show(getChildFragmentManager());
    }
    Badge expiredBadge = SignalStore.donationsValues().getExpiredBadge();
    String subscriptionCancellationReason = SignalStore.donationsValues().getUnexpectedSubscriptionCancelationReason();
    UnexpectedSubscriptionCancellation unexpectedSubscriptionCancellation = UnexpectedSubscriptionCancellation.fromStatus(subscriptionCancellationReason);
    if (expiredBadge != null) {
        SignalStore.donationsValues().setExpiredBadge(null);
        if (expiredBadge.isBoost() || !SignalStore.donationsValues().isUserManuallyCancelled()) {
            Log.w(TAG, "Displaying bottom sheet for an expired badge", true);
            ExpiredBadgeBottomSheetDialogFragment.show(expiredBadge, unexpectedSubscriptionCancellation, getParentFragmentManager());
        }
    } else if (unexpectedSubscriptionCancellation != null && !SignalStore.donationsValues().isUserManuallyCancelled() && SignalStore.donationsValues().getShowCantProcessDialog()) {
        Log.w(TAG, "Displaying bottom sheet for unexpected cancellation: " + unexpectedSubscriptionCancellation, true);
        new CantProcessSubscriptionPaymentBottomSheetDialogFragment().show(getChildFragmentManager(), BottomSheetUtil.STANDARD_BOTTOM_SHEET_FRAGMENT_TAG);
    }
}
Also used : CantProcessSubscriptionPaymentBottomSheetDialogFragment(org.thoughtcrime.securesms.badges.self.expired.CantProcessSubscriptionPaymentBottomSheetDialogFragment) Recipient(org.thoughtcrime.securesms.recipients.Recipient) Badge(org.thoughtcrime.securesms.badges.models.Badge) UnexpectedSubscriptionCancellation(org.thoughtcrime.securesms.components.settings.app.subscription.errors.UnexpectedSubscriptionCancellation)

Aggregations

Badge (org.thoughtcrime.securesms.badges.models.Badge)2 CantProcessSubscriptionPaymentBottomSheetDialogFragment (org.thoughtcrime.securesms.badges.self.expired.CantProcessSubscriptionPaymentBottomSheetDialogFragment)2 UnexpectedSubscriptionCancellation (org.thoughtcrime.securesms.components.settings.app.subscription.errors.UnexpectedSubscriptionCancellation)2 Recipient (org.thoughtcrime.securesms.recipients.Recipient)2