Skip to content

Commit

Permalink
Remove changes for new onboarding flag
Browse files Browse the repository at this point in the history
  • Loading branch information
deeppandya committed Jan 16, 2025
1 parent 7841631 commit 47a7ce3
Showing 1 changed file with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@

import static org.chromium.ui.base.ViewUtils.dpToPx;

import android.Manifest;
import android.animation.LayoutTransition;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
Expand All @@ -35,15 +33,13 @@
import com.android.installreferrer.api.InstallReferrerStateListener;
import com.android.installreferrer.api.ReferrerDetails;

import org.chromium.base.BraveFeatureList;
import org.chromium.base.BravePreferenceKeys;
import org.chromium.base.Log;
import org.chromium.base.ThreadUtils;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.BraveLocalState;
import org.chromium.chrome.browser.back_press.SecondaryActivityBackPressUma.SecondaryActivity;
import org.chromium.chrome.browser.customtabs.CustomTabActivity;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.metrics.ChangeMetricsReportingStateCalledFrom;
import org.chromium.chrome.browser.metrics.UmaSessionStats;
import org.chromium.chrome.browser.onboarding.OnboardingPrefManager;
Expand Down Expand Up @@ -232,11 +228,7 @@ private void onClickViews() {
}

private boolean shouldForceDefaultBrowserPrompt() {
return isNewOnboardingEnabled() && !isDefaultBrowser();
}

private boolean isNewOnboardingEnabled() {
return ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_NEW_ANDROID_ONBOARDING);
return !isDefaultBrowser();
}

private void setDefaultBrowserAndProceedToNextStep() {
Expand All @@ -251,8 +243,12 @@ private boolean isDefaultBrowser() {
return BraveSetDefaultBrowserUtils.isBraveSetAsDefaultBrowser(this);
}

ActivityResultLauncher<String> mRequestPermissionLauncher = registerForActivityResult(
new ActivityResultContracts.RequestPermission(), isGranted -> { nextOnboardingStep(); });
ActivityResultLauncher<String> mRequestPermissionLauncher =
registerForActivityResult(
new ActivityResultContracts.RequestPermission(),
isGranted -> {
nextOnboardingStep();
});

private void nextOnboardingStep() {
if (isActivityFinishingOrDestroyed()) return;
Expand All @@ -261,8 +257,7 @@ private void nextOnboardingStep() {
if (mCurrentStep == 0) {
showIntroPage();
} else if (mCurrentStep == 1) {
if (!isNewOnboardingEnabled()
|| !BraveSetDefaultBrowserUtils.supportsDefaultRoleManager()) {
if (!BraveSetDefaultBrowserUtils.supportsDefaultRoleManager()) {
showBrowserSelectionPage();
} else if (!isDefaultBrowser()) {
setDefaultBrowserAndProceedToNextStep();
Expand Down Expand Up @@ -318,11 +313,7 @@ public void run() {
},
200);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && !isNewOnboardingEnabled()) {
mRequestPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS);
} else {
nextOnboardingStep();
}
nextOnboardingStep();
}

private void showBrowserSelectionPage() {
Expand Down

0 comments on commit 47a7ce3

Please sign in to comment.