Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Commit

Permalink
Fixed donation check double triggering and a snackbar related race co…
Browse files Browse the repository at this point in the history
…ndition.
  • Loading branch information
d4rken committed Apr 12, 2018
1 parent e451bf0 commit a44222e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bugsnag {
}

def versionMajor = 3
def versionMinor = 0
def versionMinor = 1
def versionTag = ""

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@AppComponent.Scope
public class IAPHelper implements PurchasesUpdatedListener, BillingClientStateListener {
static final String SKU_UPGRADE_DONATE = "upgrade.donate";
private final BehaviorSubject<List<Upgrade>> upgradesPublisher = BehaviorSubject.createDefault(new ArrayList<>());
private final BehaviorSubject<List<Upgrade>> upgradesPublisher = BehaviorSubject.create();
private final BillingClient billingClient;

public static class Upgrade {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ public void showWorking() {

@Override
public void showNagBar(boolean show) {
if (getView() == null) return;
if (show) {
Snackbar.make(getView(), R.string.donate_description, Snackbar.LENGTH_INDEFINITE)
if (getView() == null) return;
upgradeBar = Snackbar.make(getView(), R.string.donate_description, Snackbar.LENGTH_INDEFINITE)
.setAction(R.string.action_donate, v -> presenter.onDonateClicked(getActivity()))
.addCallback(new Snackbar.Callback() {
@Override
Expand All @@ -229,17 +229,17 @@ public void onDismissed(Snackbar transientBottomBar, int event) {
upgradeBar = null;
super.onDismissed(transientBottomBar, event);
}
})
.show();
});
upgradeBar.show();
} else {
if (upgradeBar != null) upgradeBar.dismiss();
}
}

@Override
public void showDonate(boolean showDonate) {
if (getActivity() == null) return;

This comment has been minimized.

Copy link
@x3-4to-3decb

x3-4to-3decb May 7, 2021

app/src/main/java/eu/thedarken/rootvalidator/main/ui/validator/ValidatorFragment.java

this.showDonate = showDonate;
if (getActivity() == null) return;
getActivity().invalidateOptionsMenu();
}
}

0 comments on commit a44222e

Please sign in to comment.