Skip to content

Commit

Permalink
Made background init conditional.
Browse files Browse the repository at this point in the history
  • Loading branch information
oldestlivingboy committed Apr 5, 2024
1 parent 9843dba commit f3e961b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void onCreate() {
initPrefs();
dumpPrefs();

initMassive(this);
if (Ruleset.isUpgraded()) initMassive(this);
OneSignal.initWithContext(this, BuildConfig.ONESIGNAL_APP_ID);
}

Expand Down Expand Up @@ -158,7 +158,7 @@ public static void initMassive(Context context) {
new InitCallback() {
@Override
public void onSuccess() {
if (Ruleset.isUpgraded()) client.start();
client.start();
Plausible.INSTANCE.event("Succeed", "/massive", "", null);
}

Expand All @@ -172,7 +172,7 @@ public void onFailure(@NonNull String message) {

return Unit.INSTANCE;
});
} else if (massiveClient.getState() != State.NotInitialized && Ruleset.isUpgraded()) {
} else if (massiveClient.getState() != State.NotInitialized) {
massiveClient.start();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,7 @@ protected void onCreate(Bundle savedInstanceState) {
protected void onResume() {
super.onResume();
detectSamsungBrowser();

if (AdblockFastApplication.massiveClient == null) {
AdblockFastApplication.initMassive(this);
} else if (
AdblockFastApplication.massiveClient.getState() != State.NotInitialized &&
Ruleset.isUpgraded()
) {
AdblockFastApplication.massiveClient.start();
}
if (Ruleset.isUpgraded()) AdblockFastApplication.initMassive(this);

if (Ruleset.isEnabled()) {
animateBlocking(this::onboardUser);
Expand Down Expand Up @@ -214,7 +206,7 @@ void onAboutPressed(View v) {

upgradeText.setOnClickListener((w) -> {
Ruleset.upgrade(this);
AdblockFastApplication.massiveClient.start();
AdblockFastApplication.initMassive(this);
upgradeText.setTypeface(emphasisFont);
defaultText.setTypeface(bodyFont);
Plausible.INSTANCE.event("Upgrade", "/about", "", null);
Expand Down Expand Up @@ -245,7 +237,7 @@ void presentModes(Runnable continuationHandler) {

upgradeButton.setOnClickListener((v) -> {
Ruleset.upgrade(this);
AdblockFastApplication.massiveClient.start();
AdblockFastApplication.initMassive(this);
modes.dismiss();
Plausible.INSTANCE.event("Upgrade", "/mode", "", null);
if (continuationHandler != null) continuationHandler.run();
Expand Down Expand Up @@ -356,7 +348,7 @@ void presentHelp(Runnable continuationHandler) {

upgradeText.setOnClickListener((w) -> {
Ruleset.upgrade(this);
AdblockFastApplication.massiveClient.start();
AdblockFastApplication.initMassive(this);
upgradeText.setTypeface(emphasisFont);
defaultText.setTypeface(bodyFont);
Plausible.INSTANCE.event("Upgrade", "/help", "", null);
Expand Down

0 comments on commit f3e961b

Please sign in to comment.