1
0
Fork 0

Added BrowserDirection values for New Fragments

master
ekager 2019-05-14 21:44:28 -07:00 committed by Emily Kager
parent ffc8037a08
commit ecdbdda94e
4 changed files with 14 additions and 7 deletions

View File

@ -31,7 +31,9 @@ import org.mozilla.fenix.library.bookmarks.BookmarkFragmentDirections
import org.mozilla.fenix.library.bookmarks.selectfolder.SelectBookmarkFolderFragmentDirections import org.mozilla.fenix.library.bookmarks.selectfolder.SelectBookmarkFolderFragmentDirections
import org.mozilla.fenix.library.history.HistoryFragmentDirections import org.mozilla.fenix.library.history.HistoryFragmentDirections
import org.mozilla.fenix.search.SearchFragmentDirections import org.mozilla.fenix.search.SearchFragmentDirections
import org.mozilla.fenix.settings.PairFragmentDirections
import org.mozilla.fenix.settings.SettingsFragmentDirections import org.mozilla.fenix.settings.SettingsFragmentDirections
import org.mozilla.fenix.settings.TurnOnSyncFragmentDirections
import org.mozilla.fenix.utils.Settings import org.mozilla.fenix.utils.Settings
@SuppressWarnings("TooManyFunctions") @SuppressWarnings("TooManyFunctions")
@ -176,6 +178,10 @@ open class HomeActivity : AppCompatActivity() {
.actionBookmarkSelectFolderFragmentToBrowserFragment(customTabSessionId) .actionBookmarkSelectFolderFragmentToBrowserFragment(customTabSessionId)
BrowserDirection.FromHistory -> BrowserDirection.FromHistory ->
HistoryFragmentDirections.actionHistoryFragmentToBrowserFragment(customTabSessionId) HistoryFragmentDirections.actionHistoryFragmentToBrowserFragment(customTabSessionId)
BrowserDirection.FromPair -> PairFragmentDirections.actionPairFragmentToBrowserFragment(customTabSessionId)
BrowserDirection.FromTurnOnSync -> TurnOnSyncFragmentDirections.actionTurnOnSyncFragmentToBrowserFragment(
customTabSessionId
)
} }
if (sessionObserver == null) if (sessionObserver == null)
sessionObserver = subscribeToSessions() sessionObserver = subscribeToSessions()
@ -263,5 +269,6 @@ open class HomeActivity : AppCompatActivity() {
} }
enum class BrowserDirection { enum class BrowserDirection {
FromGlobal, FromHome, FromSearch, FromSettings, FromBookmarks, FromBookmarksFolderSelect, FromHistory FromGlobal, FromHome, FromSearch, FromSettings, FromBookmarks,
FromBookmarksFolderSelect, FromHistory, FromPair, FromTurnOnSync
} }

View File

@ -43,9 +43,7 @@ class PairFragment : Fragment(), BackHandler {
}, },
onScanResult = { pairingUrl -> onScanResult = { pairingUrl ->
requireComponents.services.accountsAuthFeature.beginPairingAuthentication(pairingUrl) requireComponents.services.accountsAuthFeature.beginPairingAuthentication(pairingUrl)
view?.let { (activity as HomeActivity).openToBrowser(BrowserDirection.FromPair)
(activity as HomeActivity).openToBrowser(BrowserDirection.FromSettings)
}
}), }),
owner = this, owner = this,
view = view view = view

View File

@ -46,7 +46,7 @@ class TurnOnSyncFragment : PreferenceFragmentCompat() {
// We could auto-close this tab once we get to the end of the authentication process? // We could auto-close this tab once we get to the end of the authentication process?
// Via an interceptor, perhaps. // Via an interceptor, perhaps.
view?.let { view?.let {
(activity as HomeActivity).openToBrowser(BrowserDirection.FromSettings) (activity as HomeActivity).openToBrowser(BrowserDirection.FromTurnOnSync)
} }
true true
} }

View File

@ -304,7 +304,8 @@
<action <action
android:id="@+id/action_turnOnSyncFragment_to_browserFragment" android:id="@+id/action_turnOnSyncFragment_to_browserFragment"
app:destination="@id/browserFragment" app:destination="@id/browserFragment"
app:popUpTo="@+id/settingsFragment" /> app:popUpTo="@+id/settingsFragment"
app:popUpToInclusive="true" />
<action <action
android:id="@+id/action_turnOnSyncFragment_to_pairInstructionsFragment" android:id="@+id/action_turnOnSyncFragment_to_pairInstructionsFragment"
app:destination="@id/pairInstructionsFragment" /> app:destination="@id/pairInstructionsFragment" />
@ -326,7 +327,8 @@
<action <action
android:id="@+id/action_pairFragment_to_browserFragment" android:id="@+id/action_pairFragment_to_browserFragment"
app:destination="@id/browserFragment" app:destination="@id/browserFragment"
app:popUpTo="@+id/settingsFragment" /> app:popUpTo="@+id/settingsFragment"
app:popUpToInclusive="true" />
</fragment> </fragment>
<fragment <fragment