Skip to content

Commit

Permalink
Use Custom Chrome Tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
jkmassel committed Nov 18, 2024
1 parent 52733dd commit d93b1f8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ dependencies {
implementation(libs.google.mlkit.text.recognition)
implementation(libs.google.mlkit.barcode.scanning.main)

implementation(libs.androidx.browser)

// CameraX
implementation(libs.androidx.camera.camera2)
implementation(libs.androidx.camera.lifecycle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.ViewModelProvider;
Expand Down Expand Up @@ -465,9 +466,13 @@ private void startLogin() {

@Override
public void showEmailLoginScreen(@NonNull Context context) {
Intent loginWithWPcom = new Intent(Intent.ACTION_VIEW, mLoginHelper.loginUri());
mUnifiedLoginTracker.setFlowAndStep(Flow.WORDPRESS_COM_WEB, Step.START);
context.startActivity(loginWithWPcom);
CustomTabsIntent intent = new CustomTabsIntent.Builder()
.setShareState(CustomTabsIntent.SHARE_STATE_OFF)
.setStartAnimations(this, R.anim.activity_slide_up_from_bottom, R.anim.activity_slide_up_from_bottom)
.setExitAnimations(this, R.anim.activity_slide_out_to_bottom, R.anim.activity_slide_out_to_bottom)
.setUrlBarHidingEnabled(true)
.build();
intent.launchUrl(this, mLoginHelper.loginUri());
}

@Override
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ androidx-activity = '1.9.3'
androidx-annotation = '1.9.1'
androidx-appcompat = '1.7.0'
androidx-arch-core = '2.2.0'
androidx-browser = '1.5.0'
androidx-camera = '1.4.0'
androidx-cardview = '1.0.0'
androidx-compose-bom = '2024.11.00'
Expand Down Expand Up @@ -120,6 +121,7 @@ androidx-annotation = { group = "androidx.annotation", name = "annotation", vers
androidx-appcompat-main = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" }
androidx-appcompat-resources = { group = "androidx.appcompat", name = "appcompat-resources", version.ref = "androidx-appcompat" }
androidx-arch-core-testing = { group = "androidx.arch.core", name = "core-testing", version.ref = "androidx-arch-core" }
androidx-browser = { group="androidx.browser", "name" = "browser", version.ref = "androidx-browser" }
androidx-camera-camera2 = { group = "androidx.camera", name = "camera-camera2", version.ref = "androidx-camera" }
androidx-camera-lifecycle = { group = "androidx.camera", name = "camera-lifecycle", version.ref = "androidx-camera" }
androidx-camera-view = { group = "androidx.camera", name = "camera-view", version.ref = "androidx-camera" }
Expand Down

0 comments on commit d93b1f8

Please sign in to comment.