Revert "Bug 1810629 - Add an Android shortcut to go straight to the login and passwords" due to UI test failures.
This reverts commit 341fef9f30b4f215c2d6e62350455b0c75c660e0.fenix/115.2.0
parent
c8577335ee
commit
0df448b78d
@ -1,30 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.home.intent
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.navigation.NavController
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.NavGraphDirections
|
||||
import org.mozilla.fenix.ext.nav
|
||||
|
||||
/**
|
||||
* When the open password manager shortcut is tapped, Fenix should open to the password and login fragment.
|
||||
*/
|
||||
class OpenPasswordManagerIntentProcessor : HomeIntentProcessor {
|
||||
|
||||
override fun process(intent: Intent, navController: NavController, out: Intent): Boolean {
|
||||
val event = intent.extras?.getBoolean(HomeActivity.OPEN_PASSWORD_MANAGER)
|
||||
return if (event != null) {
|
||||
out.removeExtra(HomeActivity.OPEN_PASSWORD_MANAGER)
|
||||
|
||||
val directions = NavGraphDirections.actionGlobalSavedLoginsAuthFragment()
|
||||
navController.nav(null, directions)
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.shortcut
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
import mozilla.components.feature.intent.processing.IntentProcessor
|
||||
import mozilla.components.support.utils.SafeIntent
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
|
||||
/**
|
||||
* Intent processor that will handle intents for the password manager shortcut
|
||||
*/
|
||||
class PasswordManagerIntentProcessor : IntentProcessor {
|
||||
|
||||
/**
|
||||
* Processes the given [Intent].
|
||||
*
|
||||
* @param intent The intent to process.
|
||||
* @return True if the intent was processed, otherwise false.
|
||||
*/
|
||||
override fun process(intent: Intent): Boolean {
|
||||
val safeIntent = SafeIntent(intent)
|
||||
|
||||
if (!safeIntent.action.equals(ACTION_OPEN_PASSWORD_MANAGER)) {
|
||||
return false
|
||||
}
|
||||
|
||||
intent.putExtra(HomeActivity.OPEN_PASSWORD_MANAGER, true)
|
||||
intent.flags = intent.flags or FLAG_ACTIVITY_NEW_TASK or FLAG_ACTIVITY_CLEAR_TASK
|
||||
return true
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val ACTION_OPEN_PASSWORD_MANAGER = "org.mozilla.fenix.OPEN_PASSWORD_MANAGER"
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/static_shortcut_background"/>
|
||||
<foreground android:drawable="@drawable/ic_static_lock"/>
|
||||
</adaptive-icon>
|
@ -1,13 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="48dp"
|
||||
android:height="48dp"
|
||||
android:viewportWidth="48"
|
||||
android:viewportHeight="48">
|
||||
<group android:translateX="12"
|
||||
android:translateY="12">
|
||||
<path
|
||||
android:pathData="M7,11V7C7,4.239 9.239,2 12,2C14.761,2 17,4.239 17,7V11C18.38,11 19.5,12.12 19.5,13.5V19.5C19.5,20.88 18.38,22 17,22H7C5.62,22 4.5,20.88 4.5,19.5V13.5C4.5,12.12 5.62,11 7,11ZM8.75,7C8.75,5.205 10.205,3.75 12,3.75C13.795,3.75 15.25,5.205 15.25,7V11H8.75V7ZM6.25,13.5C6.25,13.086 6.586,12.75 7,12.75H17C17.414,12.75 17.75,13.086 17.75,13.5V19.5C17.75,19.914 17.414,20.25 17,20.25H7C6.586,20.25 6.25,19.914 6.25,19.5V13.5Z"
|
||||
android:fillColor="#000000"
|
||||
android:fillType="evenOdd"/>
|
||||
</group>
|
||||
</vector>
|
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_static_shortcut_background" />
|
||||
<item android:drawable="@drawable/ic_static_lock" />
|
||||
</layer-list>
|
@ -1,77 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.home.intent
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.navigation.NavController
|
||||
import io.mockk.Called
|
||||
import io.mockk.mockk
|
||||
import io.mockk.verify
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.NavGraphDirections
|
||||
import org.mozilla.fenix.ext.nav
|
||||
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
||||
import org.mozilla.fenix.shortcut.PasswordManagerIntentProcessor
|
||||
|
||||
@RunWith(FenixRobolectricTestRunner::class)
|
||||
class OpenPasswordManagerIntentProcessorTest {
|
||||
|
||||
private lateinit var activity: HomeActivity
|
||||
private lateinit var navController: NavController
|
||||
private lateinit var out: Intent
|
||||
private lateinit var processor: OpenPasswordManagerIntentProcessor
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
activity = mockk(relaxed = true)
|
||||
navController = mockk(relaxed = true)
|
||||
out = mockk(relaxed = true)
|
||||
processor = OpenPasswordManagerIntentProcessor()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN a blank intent WHEN it is processed THEN nothing should happen`() {
|
||||
assertFalse(processor.process(Intent(), navController, out))
|
||||
|
||||
verify { activity wasNot Called }
|
||||
verify { navController wasNot Called }
|
||||
verify { out wasNot Called }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN an intent with wrong action WHEN it is processed THEN nothing should happen`() {
|
||||
val intent = Intent().apply {
|
||||
action = TEST_WRONG_ACTION
|
||||
}
|
||||
|
||||
assertFalse(processor.process(intent, navController, out))
|
||||
|
||||
verify { activity wasNot Called }
|
||||
verify { navController wasNot Called }
|
||||
verify { out wasNot Called }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN an intent with correct action and extra boolean WHEN it is processed THEN navigate should be called`() {
|
||||
val intent = Intent().apply {
|
||||
action = PasswordManagerIntentProcessor.Companion.ACTION_OPEN_PASSWORD_MANAGER
|
||||
putExtra(HomeActivity.OPEN_PASSWORD_MANAGER, true)
|
||||
}
|
||||
|
||||
assertTrue(processor.process(intent, navController, out))
|
||||
|
||||
verify { navController.nav(null, NavGraphDirections.actionGlobalSavedLoginsAuthFragment()) }
|
||||
verify { out.removeExtra(HomeActivity.OPEN_PASSWORD_MANAGER) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TEST_WRONG_ACTION = "test-action"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue