Commit graph

279 commits

Author SHA1 Message Date
Christian Sadilek
4fcc97ab8d Revert "Bug 1799679 - Preserve search terms for search engine result pages"
This reverts commit bf984d2d9a1d6db4452393e0b4421e9b808f0bdf.
2022-12-13 12:39:05 -05:00
Gabriel Luong
386c363b22 Bug 1804594 - Differentiate search engines between "general" and "topic specific" when they are loaded 2022-12-12 21:51:07 +00:00
Alexandru2909
a8dc241789 Bug 1799679 - Preserve search terms for search engine result pages 2022-12-12 19:55:08 +00:00
Christian Sadilek
4091b14a33 Fix android lint in composite builds 2022-11-21 13:40:53 -05:00
DreVla
1b6e0def7e Bug 1800209 - Support for refreshing search engines when language is changed 2022-11-18 08:35:10 +00:00
Jonathan Almeida
11592be959 Bug 1799056 - Update onSaveToPdfError to onSaveToPdfException 2022-11-08 17:05:50 +00:00
Jonathan Almeida
61a134090e Bug 1795105 - Don't store thumbnails in BrowserState
Co-authored-by: ohall-m <93344309+ohall-m@users.noreply.github.com>
Co-authored-by: kycn <35106533+kycn@users.noreply.github.com>
2022-11-08 02:44:05 +00:00
Jonathan Almeida
7c764c6501 Revert "Bug 1795105 - Don't store thumbnails in BrowserState"
This reverts commit d9028ef2b230a03459fe20ab56bdce0acdce3aea.
2022-11-04 14:24:55 -04:00
Jonathan Almeida
bcc34f349e Bug 1795105 - Don't store thumbnails in BrowserState
Co-authored-by: ohall-m <93344309+ohall-m@users.noreply.github.com>
Co-authored-by: kycn <35106533+kycn@users.noreply.github.com>
2022-11-04 04:58:11 +00:00
Arturo Mejia
496f1135fc Bug 1796482 - Allow for notifying consumers on unsuccessful Save to PDF requests 2022-11-01 20:38:10 +00:00
mcarare
4ad330adbc [components] For https://github.com/mozilla-mobile/android-components/issues/12489: Upgrade kotlin, coroutines, compose compiler to latest versions.
Upgrade kotlin to 1.7.20, coroutines to 1.6.4 and compose compiler to 1.3.2.
Replace deprecated Xopt-in with op-in.
Replace deprecated Xjvm-default=enable with Xjvm-default=all.
Remove useIR property that is now default true.
2022-10-18 08:20:59 +00:00
Gabriel Luong
d9d783b698 [components] Issue https://github.com/mozilla-mobile/android-components/issues/12939: Address all ktlint issues 2022-10-17 17:07:40 -04:00
mcarare
92fe0c0234 [components] For https://github.com/mozilla-mobile/android-components/issues/12724: Upgrade compose to 1.2.1 version.
Split versioning of compose compiler.
Enable Xjvm-default to allow inheriting from interfaces with '@JvmDefault' members
like RememberObserver.
2022-09-08 08:22:09 +00:00
Jonathan Almeida
7bb88450b5 [components] Close https://github.com/mozilla-mobile/android-components/issues/12267: Add support for Save to PDF in GeckoEngineSession
Adds support for Save to PDF from the GeckoSession by plugging the
API into `onExternalResponse` to provide the same flow as a typical
file download experience would be.

Co-authored-by: Olivia Hall <ohall@mozilla.com>
2022-08-15 14:29:34 +00:00
mcarare
30e5a6f476 [components] For https://github.com/mozilla-mobile/android-components/issues/12402: Run Robolectric with SDK 32. 2022-06-29 16:31:33 +00:00
mcarare
2a1c468edc [components] For https://github.com/mozilla-mobile/android-components/issues/12376: Run Robolectric with SDK 31.
Current Robolectric version does not support SDK 32.
2022-06-28 13:42:14 +00:00
Alexandru2909
9096d03439 [components] For https://github.com/mozilla-mobile/android-components/issues/12217 - Add support for onPromptUpdate
- Handle ChoicePrompt updates
2022-06-02 15:01:29 +00:00
Arturo Mejia
b6b2484fcd [components] Closes https://github.com/mozilla-mobile/android-components/issues/12190: Create a middleware that allows to change tabs priority. 2022-05-26 13:38:30 +00:00
Roger Yang
09dd0c3e07 [components] Issue https://github.com/mozilla-mobile/android-components/issues/12149: Add support for application search engine type 2022-05-16 19:02:13 +00:00
Mugurell
d78b06b6bf [components] For https://github.com/mozilla-mobile/android-components/pull/11175 - Migrate runBlocking and runBlockingTest to runTest in unit tests
Used `runTestOnMain` where `MainCoroutineRule` was used or needed to be used,
`runTest` elsewhere.

Extra effort for removing all `runBlocking` occurrences in unit tests.
`kotlinx.coroutines.test.runTest` is a test specific API that seems like a more
appropriate way for running tests in a coroutine than the general
`kotlinx.coroutines.runBlocking` api.
2022-05-10 13:45:03 +00:00
Mugurell
2963708053 [components] For https://github.com/mozilla-mobile/android-components/issues/11755 - Replace TestCoroutineDispatcher with UnconfinedTestDispatcher
- Refactor out all usages of TestCoroutineDispatcher and TestCoroutineScope
- Refactor MainCoroutineRule to now use UnconfinedTestDispatcher by default.
This dispatcher will eagerly enter all launch or async blocks being more suited
to our codebase.
2022-05-10 13:45:03 +00:00
mcarare
2275e49731 [components] For https://github.com/mozilla-mobile/android-components/issues/9684: Run tests on sdk 30. 2022-04-28 08:33:29 +00:00
Mugurell
f91cb8abe1 [components] For https://github.com/mozilla-mobile/android-components/issues/11753 - Update compose to 1.1.1 and Kotlin to 1.6.10
This also required updating room to >= 2.4.0.
This new version adds a deprecation of the `MigrationTestHelper` api used in
`LoginExceptionStorageTest` that is to be later fixed in https://github.com/mozilla-mobile/android-components/issues/11765.

`activity_compose` was also update to the latest stable version to ensure a
better match with the latest stable version for compose.

Used 1.6.10 for Kotlin although 1.6.20 is available to prevent any issues with
Compose 1.1.1 reported as an error at compile time:
"e: This version (1.1.1) of the Compose Compiler requires Kotlin version 1.6.10
but you appear to be using Kotlin version 1.6.20 which is not known to be
compatible.  Please fix your configuration (or
`suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!)."
2022-04-18 17:28:25 +00:00
Mugurell
f04e8b683c [components] Revert "For https://github.com/mozilla-mobile/android-components/issues/11753 - Update compose to 1.1.0 and Kotlin to 1.6.10"
This reverts commit 3feac3db3901ef73efcd0e14c04b47cbdab2e7ff.
2022-02-28 22:27:21 +00:00
Mugurell
97b77729c7 [components] For https://github.com/mozilla-mobile/android-components/issues/11753 - Update compose to 1.1.0 and Kotlin to 1.6.10
This also required updating room to >= 2.4.0.
This new version adds a deprecation of the `MigrationTestHelper` api used in
`LoginExceptionStorageTest` that is to be later fixed in https://github.com/mozilla-mobile/android-components/issues/11765.

activity_compose was also update to the latest stable version to ensure a
better match with the latest stable version for compose.
2022-02-24 10:12:43 +00:00
Grigory Kruglov
03794ddc5b [components] Avoid eagerly rehydrating EngineSessionState for recently closed tabs
This change splits out tab-specific data from RecoverableTab data class
into a separate TabState (so, it doesn't have the EngineSessionState).

Then, once we have the simplified TabState, everything that touches RecentlyClosedTabs
is converted to use that instead of its more expensive sibling.

This way we avoid having to eagerly process EngineSessionState simply to populate BrowserState.closedTabs.
This saves us from having to hit disk (where the EngineSessionState is persisted) on initializing BrowserState (so, startup in most cases).
It also saves us from having to parse/rehydrate that persisted state.

At the point we actually need the EngineSessionState for a tab we'd like to restore, we can read/process it.
2022-02-14 14:54:00 -08:00
Roger Yang
5fd04be267 [components] No issue: Add TabPartition tests 2022-01-19 23:43:56 +00:00
Roger Yang
5ebbe97126 [components] Close https://github.com/mozilla-mobile/android-components/issues/11383: Ensure each tab group does not have duplicate tab IDs 2022-01-12 23:18:58 +00:00
Roger Yang
fdd23e4a5f [components] Close https://github.com/mozilla-mobile/android-components/issues/11383: Add tabstray support for search term tab grouping logic with middleware 2022-01-12 15:27:26 +00:00
Jonathan Almeida
2916c0a537 [components] Close https://github.com/mozilla-mobile/android-components/issues/11444: Add optional user interaction param to goBack/goForward 2021-12-31 02:47:38 +00:00
Sebastian Kaspari
e2a4af5cf6 [components] Issue https://github.com/mozilla-mobile/android-components/issues/11300: EngineMiddleware: Add option for disabling TrimMemoryMiddleware 2021-11-23 18:43:44 +00:00
Christian Sadilek
e2b56538db [components] Closes https://github.com/mozilla-mobile/android-components/issues/11208: Add tab partitions and groups to BrowserState 2021-11-22 21:49:21 +00:00
Christian Sadilek
57173a94e0 [components] Closes https://github.com/mozilla-mobile/android-components/issues/11241: TabSessionState.lastAccess not updated when application resumes 2021-11-09 13:57:57 -05:00
Gabriel Luong
7fe5c17265 [components] Issue https://github.com/mozilla-mobile/android-components/issues/11155 - Integrate onPreviewImage API from GeckoView 2021-10-25 20:46:09 +00:00
Sebastian Kaspari
90ec41fc3a [components] Update Kotlin and Jetpack Compose versions. 2021-10-25 10:58:07 +00:00
Grisha Kruglov
b356d9275a [components] Add DisbandSearchGroupAction to allow removing search groups from tab state 2021-10-13 10:13:39 -07:00
Christian Sadilek
743fcdaa5c [components] Issue https://github.com/mozilla-mobile/android-components/issues/11066: Make optimized load url case observable in middlewares 2021-10-13 15:42:38 +00:00
codrut.topliceanu
ef9c198245 [components] For https://github.com/mozilla-mobile/android-components/issues/10867 - Dismisses user prompt when GV calls onPromptDismiss 2021-10-06 14:47:52 +00:00
ssk97
6e1133eacf [components] Support Moving/Reordering Tabs (https://github.com/mozilla-mobile/android-components/pull/10936)
* Add MoveTabsAction and tests for it

* Add MoveTabsUseCase and a test

* Add getFilter to TabsFeature

* ktlint/detekt formating pass

* Changelog entry

* Fix cut off comment

* Remove action reference comment

* Remove unneeded setting of selectedTabId in copy

* Replace filter getter with just making the variable public
It's simpler and I can't see why it shouldn't be modifiable.

* API change from position+filter to target+placeAfter.
Also added a "tab not found" check.

* Add another test, clean up changelog

* Animate moving tabs via movement rather than add+delete.

* Put Private modifier back, improve documentation.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-09-22 15:16:29 +00:00
Roger Yang
f92d25401a [components] Close https://github.com/mozilla-mobile/android-components/issues/10984: Persist search term in content state 2021-09-15 15:56:34 +00:00
Sebastian Kaspari
0a59c1785a [components] RemoveAllPrivateTabsAction: Clear selectedTabId if no new selection is available. 2021-09-06 12:49:36 +00:00
Noah Bond
6d21d293b6 [components] Undo tab position fix - fix for https://github.com/mozilla-mobile/fenix/issues/18210 (https://github.com/mozilla-mobile/android-components/pull/10777)
* Refactored the tab restoration flow to support restoring tabs at their original index.

* Lint check fixes

* Refactored the index class variable name and made it non-null

* Refactored RestoreAction to take an ENUM for a restoration location.

* Cleaned up tests and lint errors

* Fixed broken test after restore tab refactor

* Refactored the location of RestoreLocation and revised instances of "removalIndex"

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-08-31 19:06:48 +00:00
Noah Bond
ae756f53a9 [components] For https://github.com/mozilla-mobile/android-components/issues/10560: Fixed bug causing external links to open tabs irrespective of the session's private status (https://github.com/mozilla-mobile/android-components/pull/10857)
* For https://github.com/mozilla-mobile/android-components/issues/10560: Fixed bug causing external links to open tabs irrespective of the session's private status

* Updated findTabByUrl function names and comments for better clarity

* Fixed import detekt issue

* Refactored selectors test for better clarity

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-08-31 18:53:52 +00:00
Mugurell
e277dd03f0 [components] For https://github.com/mozilla-mobile/android-components/issues/10803 - Force expanding the toolbar if requested by GeckoView 2021-08-16 07:46:15 +00:00
Jonathan Almeida
e7d3f34077 [components] Close https://github.com/mozilla-mobile/android-components/issues/10769: Add DebugAction.UpdateCreatedAtAction with reducer
We wanted to introduce this action for testing purposes in client apps
that want to "turn back time" for a certain tab.

The difficulty is in ensuring clients do not misuse these actions, and
we thought of a few strategies:

- Option 1: Make a separate grouping called `DebugAction` and document
that these are special actions.

- Option 2: Using a middleware, we only allow changes to the store
depending on some dynmamic logic in the client app. This is a bit
complicated and requries the user to restart the app to add this
special middleware.

- Option 3: Add an annotation that requires the client to opt into using
the action.

In this patch, I decided to go with a combination of options 1 and 3
which gave us the right about of warning and flexibility.

With option 2, we were still required to add new actions to the store
and the middleware would not have prevented misuse in those cases.
2021-08-12 03:56:04 +00:00
Grisha Kruglov
47a5196e6a [components] Make sure to preserve private state when recreating a RecoverableTab
regression from https://github.com/mozilla-mobile/android-components/pull/10711/files
2021-08-05 15:53:27 -07:00
Grisha Kruglov
2cb270feed [components] Introduced 'restored' content state for tracking tab restoration 2021-08-05 11:47:54 -07:00
Grisha Kruglov
14a116801f [components] Support for tracking external sources
Mainly, does two things:
- refactors SessionState.Source into a richer form (splitting sources
  into Internal and External, where External ones track information
  about originating package)
- adds persistence of External sources into tab session state; we don't
  want to persist Internal sources as that was explicitly removed before
  for causing various issues (e.g. UI behaving incorrectly after
  restoring tabs with various internal sources set)
2021-08-05 11:47:54 -07:00
codrut.topliceanu
3bd5ddb4a0 [components] For https://github.com/mozilla-mobile/android-components/issues/10603 - Adds createdAt to TabSessionState 2021-08-02 10:07:38 +00:00
Sebastian Kaspari
ce323400dd [components] Run ktlintFormat to fix new ktlint errors. 2021-07-28 12:03:23 +00:00
Arturo Mejia
e4d539f111 [components] Closes https://github.com/mozilla-mobile/android-components/issues/10448 show toolbar permissions indicator when permissions change from their default. 2021-07-27 17:25:23 +00:00
Mugurell
d67a681ba6 [components] For https://github.com/mozilla-mobile/android-components/issues/10632 - Add a new mediaSessionActive property to LastMediaAccessState
This new property helps with separating the current responsibilities of
lastMediaAccess such that after this:
- lastMediaAccess is only updated when media starts playing allowing clients to
order media tabs and find the first / last tab with in progress media.
- lastHadMediaSessionActive indicates whether a MediaSession should be active
for this tab and serves as a backup for lastMediaUrl for the situations where a
website might allow media to continue playing even when the users accesses
another page (with another URL) in that same HTML document.
2021-07-21 19:10:46 +00:00
Mugurell
58cf65e681 [components] For https://github.com/mozilla-mobile/android-components/issues/10632 - Persist and restore tab LastMediaAccessState 2021-07-21 19:10:46 +00:00
Mugurell
097eeb01e2 [components] For https://github.com/mozilla-mobile/android-components/issues/10632 - Try to update mediaState only for TabSessionState
Renamed "BrowserState.updateTabState" to a more appropriate
"BrowserState.updateTabOrCustomTabState" signaling that it can be used to
update any tab or custom tab.

Created two new "BrowserState.updateTabState" and
"BrowserState.updateCustomTabState" extension methods to allow updating the
state of either tabs or custom tabs depending on the properties needing update.

By this we are forcing the clients to choose what type of SessionState they
want updated and in so limiting the situations in which the old API would try
to update any SessionState and could throw a ClassCastException if in the
"update" lambda parameter callers would try to update a property not existing
in one SessionState implementation but available in other.
2021-07-21 19:10:46 +00:00
Mugurell
0c7b4d7866 [components] For https://github.com/mozilla-mobile/android-components/issues/10632 - Migrate TabSessionState's lastMediaAccess to LastMediaAccessState
LastMediaAccessState contains both
- lastMediaAccess - timestamp for the last time media started playing
(which is reset to 0 when GV deactivates the MediaSession)
- lastMediaUrl - tab url when media started playing

By combining this two properties we'll know that a tab has in progress media
even when:
- the user navigates to another page in the same document
but media continues to play, MediaSession exists, lastMediaAccess is not reset,
- media starts playing in another tab
but the previous media tab has the same url as lastMediaUrl.

After media starting to play in a tab only if
- user navigated to another website and
- MediaSession is deactivated (happens when navigating to another website or
when media starts playing in another tab)
will we consider that this tab doesn't anymore have in progress media.
2021-07-21 19:10:46 +00:00
Sebastian Kaspari
f14b267388 [components] Issue https://github.com/mozilla-mobile/android-components/issues/10335: Update dependencies to support Jetpack Compose and add first prototype components.
* Issue https://github.com/mozilla-mobile/android-components/issues/10335: Upgrade to Gradle 7.
* Update Android Gradle Plugin to 7.0.0 Beta 2.
* Issue https://github.com/mozilla-mobile/android-components/issues/10335: Generate BuildConfig with VERSION_CODE and VERSION_NAME fields in library modules (for Glean).
* Issue https://github.com/mozilla-mobile/android-components/issues/10335: Add first component using Jetpack Compose: compose-browser-toolbar.
* Issue https://github.com/mozilla-mobile/android-components/issues/10335: Introduce Jetpack Compose bindings for lib-state.
* Issue https://github.com/mozilla-mobile/android-components/issues/10335: Upstream Jetpack Compose toolbar prototype from Reference Browser.
* Issue https://github.com/mozilla-mobile/android-components/issues/10335: Add TargetTab helper for observing specific tabs.
* Issue https://github.com/mozilla-mobile/android-components/issues/10335: Add compose-engine component for adding Jetpack Compose bindings to a concept-engine implementation.
* Issue https://github.com/mozilla-mobile/android-components/issues/10335: Add new sample app (samples-compose-browser) for prototyping browser UI using Jetpack Compose.
* Issue https://github.com/mozilla-mobile/android-components/issues/10335: Update to Beta 3 of the Android Gradle plugin.
* Issue https://github.com/mozilla-mobile/android-components/issues/10335: Allow usage of http when substituting maven repositories in CI.
* Issue https://github.com/mozilla-mobile/android-components/issues/10335: Rename TabTarget helper to just Target.
* Issue https://github.com/mozilla-mobile/android-components/issues/10335: Make BrowserToolbar follow target tab too.
* Add awesomebar prototype using Jetpack Compose.
* Update to Gradle 7.0.2.
2021-07-20 16:22:26 +00:00
codrut.topliceanu
1e510d2772 [components] For https://github.com/mozilla-mobile/android-components/issues/10624 - Adds recoverable param to RemoveAllTabsAction
...to be used by UndoMiddleware.kt to prevent closed tabs from being recoverable
2021-07-19 14:49:23 +00:00
Mugurell
4e14471fa6 [components] For https://github.com/mozilla-mobile/android-components/issues/10470 - Persist and restore lastMediaAccess of TabSessionState 2021-07-08 17:08:25 +00:00
Mugurell
11b0ca6e98 [components] For https://github.com/mozilla-mobile/android-components/issues/10470 - Add a new lastMediaAccess property for TabSessionState
This new property will be a timestamp of the last time media started playing in
the current page or be 0 if media hadn't started playing or another page loaded
in this tab so media was stopped.

To observe the media changes and update this property LastMediaAccessMiddleware
will have to be set on BrowserStore.
2021-07-08 17:08:25 +00:00
Grisha Kruglov
ccb0a5014b [components] Extension functions for converting URLs to search terms 2021-06-17 19:36:48 +00:00
Christian Sadilek
ad14e1fdd2 [components] Add findNormalTab and selectedNormalTab extensions 2021-06-16 14:14:46 +00:00
mcarare
636adaf2a9 [components] For https://github.com/mozilla-mobile/android-components/issues/10404: Remove deprecated kotlin-android-extensions plugin
(cherry picked from commit d99621583ceb11e7d91ebe284e40aec145793e48)
2021-06-15 08:32:26 +00:00
Christian Sadilek
4dfb6d92c1 [components] Revert "For https://github.com/mozilla-mobile/android-components/issues/10404: Remove deprecated kotlin-android-extensions plugin"
This reverts commit d99621583ceb11e7d91ebe284e40aec145793e48.
2021-06-14 18:09:24 +00:00
mcarare
17c2336fde [components] For https://github.com/mozilla-mobile/android-components/issues/10404: Remove deprecated kotlin-android-extensions plugin 2021-06-14 10:05:57 +00:00
Sebastian Kaspari
b16e52cecb [components] CreateEngineSessionMiddleware: Lookup custom tabs too. 2021-06-10 16:34:36 +02:00
Christian Sadilek
f8a8f07f81 [components] Make sure crash state is updated before unlinking engine state
This makes sure observers see the crashed state of a tab update
before the engine session is set to null. This is important so
observers can react to crashes and won't immediately request a
new engine session.
2021-06-09 14:45:57 +00:00
Sebastian Kaspari
b7d77a521d [components] Complete migration from browser-session to browser-state.
* Issue https://github.com/mozilla-mobile/android-components/issues/10197: Move EngineObserver and EngineMiddleware to browser-state and refactor SessionManager dependency away.
* Issue https://github.com/mozilla-mobile/android-components/issues/3532: Migrate TabsUseCases to use BrowserStore exclusively.
* Issue https://github.com/mozilla-mobile/android-components/issues/10209: Migrate SessionUseCases to use BrowserStore exclusively.
* Issue https://github.com/mozilla-mobile/android-components/issues/3532, https://github.com/mozilla-mobile/android-components/issues/10209: Migrate components to use new UseCase APIs.
* Issue https://github.com/mozilla-mobile/android-components/issues/10209: Migrate UndoMiddleware to use BrowserStore.
* Issue https://github.com/mozilla-mobile/android-components/issues/3532: Migrate CustomTabsUseCases to use BrowserStore.
* Issue https://github.com/mozilla-mobile/android-components/issues/10211: Migrate sample-browser to not depend on browser-session.
* Issue https://github.com/mozilla-mobile/android-components/issues/10209: Remove browser-session dependency.
* Issue https://github.com/mozilla-mobile/android-components/issues/3532: feature-tabs: Remove browser-session dependency.
* Issue https://github.com/mozilla-mobile/android-components/issues/10209: Fix UndoMiddlewareTest
* Issue https://github.com/mozilla-mobile/android-components/issues/10209: Refactor SessionUseCasesTest to not use SessionManager.
* Issue https://github.com/mozilla-mobile/android-components/issues/10209: Fix SessionFeatureTest.
* Refactor support-migration tests to not use SessionManager.
* Fix tests in feature-contextmenu.
* Refactor feature-recentlyclosed tests to not use SessionManager
* Refactor browser-session-storage tests to not use SessionManager
* Refactor feature-intent tests to not use SessionManager
* Refactor feature-tabs tests to not use SessionManager pt. 1
* Refactor feature-customtabs tests to not depend on browser-session.
* Make sure initial load url flags are correct
* Refactor feature-tabs tests to not use SessionManager pt. 2
* Refactor browser-state tests to not depend on browser-session.
* SearchUseCasesTest: Use addTab use case instead of addPrivateTab.
* Samples Browser: Remove unused drawable.
* Fix feature-pwa tests
* Remove browser-session.
* Make sure engine session is linked for window requests
* Make sure engine session is linked when provided with tab
* Make sure engine session is linked when provided with tab pt. 2
* Prevent engine session from being created multiple times
* Prevent engine session from being created multiple times pt. 2
* Prevent engine session from being created multiple times pt. 3
* Part 4: REFACTOR ALL THE THINGS
* Update tests.
* Add additional test for multiple CreateEngineSessionAction dispatching.
* Refactor, some docs and tests
* Fix CustomTabs tests...
2021-06-08 14:44:09 +00:00
Sebastian Kaspari
ff784931ec [components] Revert "Complete migration from browser-session to browser-state."
This reverts commit c5474f00085cf5011e06e3826f611831c50c95b0.
2021-06-07 13:14:34 -04:00
Sebastian Kaspari
230c3e8a4b [components] Complete migration from browser-session to browser-state.
* Issue https://github.com/mozilla-mobile/android-components/issues/10197: Move EngineObserver and EngineMiddleware to browser-state and refactor SessionManager dependency away.
* Issue https://github.com/mozilla-mobile/android-components/issues/3532: Migrate TabsUseCases to use BrowserStore exclusively.
* Issue https://github.com/mozilla-mobile/android-components/issues/10209: Migrate SessionUseCases to use BrowserStore exclusively.
* Issue https://github.com/mozilla-mobile/android-components/issues/3532, https://github.com/mozilla-mobile/android-components/issues/10209: Migrate components to use new UseCase APIs.
* Issue https://github.com/mozilla-mobile/android-components/issues/10209: Migrate UndoMiddleware to use BrowserStore.
* Issue https://github.com/mozilla-mobile/android-components/issues/3532: Migrate CustomTabsUseCases to use BrowserStore.
* Issue https://github.com/mozilla-mobile/android-components/issues/10211: Migrate sample-browser to not depend on browser-session.
* Issue https://github.com/mozilla-mobile/android-components/issues/10209: Remove browser-session dependency.
* Issue https://github.com/mozilla-mobile/android-components/issues/3532: feature-tabs: Remove browser-session dependency.
* Issue https://github.com/mozilla-mobile/android-components/issues/10209: Fix UndoMiddlewareTest
* Issue https://github.com/mozilla-mobile/android-components/issues/10209: Refactor SessionUseCasesTest to not use SessionManager.
* Issue https://github.com/mozilla-mobile/android-components/issues/10209: Fix SessionFeatureTest.
* Refactor support-migration tests to not use SessionManager.
* Fix tests in feature-contextmenu.
* Refactor feature-recentlyclosed tests to not use SessionManager
* Refactor browser-session-storage tests to not use SessionManager
* Refactor feature-intent tests to not use SessionManager
* Refactor feature-tabs tests to not use SessionManager pt. 1
* Refactor feature-customtabs tests to not depend on browser-session.
* Make sure initial load url flags are correct
* Refactor feature-tabs tests to not use SessionManager pt. 2
* Refactor browser-state tests to not depend on browser-session.
* SearchUseCasesTest: Use addTab use case instead of addPrivateTab.
* Samples Browser: Remove unused drawable.
* Fix feature-pwa tests
* Remove browser-session.
* Make sure engine session is linked for window requests
* Make sure engine session is linked when provided with tab
* Make sure engine session is linked when provided with tab pt. 2
* Prevent engine session from being created multiple times
* Prevent engine session from being created multiple times pt. 2
* Prevent engine session from being created multiple times pt. 3
* Part 4: REFACTOR ALL THE THINGS
* Update tests.
* Add additional test for multiple CreateEngineSessionAction dispatching.
* Refactor, some docs and tests
* Fix CustomTabs tests...
2021-06-07 15:29:14 +00:00
Mugurell
5fc28020ea [components] For https://github.com/mozilla-mobile/android-components/issues/8989 - Support multiple prompts in the same Session
Following crash reports it was seen that it is possible for multiple prompts to
be shown at the same time with an edgecase being that one prompt request comes
after the user interacted with a previous prompt but before the consume call
completing in AC / GV time at which this code will try to use the new prompt,
not the one the user interacted with.

Having support for multiple prompt requests in ContentState and tightly
coupling a PromptDialogFragment with it's PromptRequest ensures any action
consuming a PromptDialogFragment will always consume the PromptRequest for
which that dialog was shown irrespective of the number of prompts or which is
currently shown on top.
2021-06-02 12:04:17 +00:00
Christian Sadilek
5e611f396b [components] Persist history metadata tab state 2021-06-01 21:02:36 +00:00
Christian Sadilek
8d7180a53b [components] Add HistoryMetadata state, action, and reducer
Co-authored-by: Grisha Kruglov <gkruglov@mozilla.com>
2021-06-01 21:02:36 +00:00
Sebastian Kaspari
98ab7b1b5f [components] Fix or suppress warnings from new detekt version. 2021-05-25 15:22:17 +00:00
Christian Sadilek
431a1d1ce6 [components] Allow setting initial load flags when creating tabs 2021-05-06 15:39:49 +00:00
Christian Sadilek
d826836562 [components] Update KDocs for crashed engine state 2021-04-21 15:20:33 +00:00
Elise Richards
2a94964ca4 [components] Closes https://github.com/mozilla-mobile/android-components/issues/9754: add locale to browser state (https://github.com/mozilla-mobile/android-components/pull/9779)
* Add locale to our browser state. Create an action for updating this state.

* Observe changes to locale in the service and dispatch changes in the locale manager

* Separate the building of the notification so it can be reused

* Create a use case for local updates to be used in the locale manager

Add channel id so that the existing notification can be accessed and updated

Send notification id instead of tag

Locale use cases test

Put locale action in sealed action class

Test locale scope

* Add refresh functionality to the service

Add locale actions and reducer for restoring state

Restore state for locale use case. Make getters for ids in notification service

Test locale use case notification in the locale manager

Test covering all locale use cases

* Add locale middleware to handle restore from disk

* Middleware tests for locale

* Locale action tests

* Locale state reducer tests

* Changelog

* Lint and cleanup

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-03-22 16:59:29 +00:00
Arturo Mejia
72635c4665 [components] Closes https://github.com/mozilla-mobile/android-components/issues/9806 Refactor close download response to be in the DownloadMiddleware 2021-03-08 21:19:09 +00:00
Arturo Mejia
971a797bb5 [components] Closes https://github.com/mozilla-mobile/android-components/issues/9757 Remove downloads notification when private tabs are closed 2021-02-25 01:51:58 +00:00
Sebastian Kaspari
3601d384d0 [components] Search: Remember and restore order of search engine list for user's region. 2021-02-22 14:52:09 +00:00
Sebastian Kaspari
282f5e3aef [components] Remove old media APIs. 2021-02-10 13:02:22 +00:00
Michael Comella
84d0339bb2 [components] For https://github.com/mozilla-mobile/android-components/issues/9638: name Store threads.
I omitted naming the MigrationStore to avoid touching the migration code but
that code is touched indirectly by inheriting from the Store super-class.
2021-02-10 00:35:59 +00:00
Sebastian Kaspari
e9b345e5a8 [components] Issue https://github.com/mozilla-mobile/android-components/issues/9366: Create dedicated BrowserAction for "engine session killed" and track engine session lifetime.
* Once we link an `EngineSession` to a `Session` we track the time.
* The separate `BrowserAction` allows us to write a Middleware for this event.
* I was unhappy with SystemClock requiring the Android stdlib and therefore making mocking a pain, or
  requiring the slow Robolectric test runner. I ended up with this wrapper class, that seems to work
  well in Fenix when writing unit tests.

The next step is to write a Middleware in Fenix that looks at those events and records metrics in Glean.
I will open a PR for that soon.
2021-02-09 09:56:17 +00:00
Mugurell
b55384ba67 [components] For https://github.com/mozilla-mobile/android-components/pull/9417 - Add support for sharing actual website images (https://github.com/mozilla-mobile/android-components/pull/9420)
Prior to this when the user selected to share an image from the contextual menu
the apps would only share the URL, not the actual resource.

This patch adds a new `ShareDownloadFeature` that will listen for
`AddShareAction` and download, cache locally and then share the Internet
resource contained in Action's state.

Giving the time needed to actually download these resources this feature is
only used for image sharing, not for other types of potentially bigger
resource types.

This is a breaking change with clients expected to create and register a new
instance of the this new feature otherwise the "Share image" from the
browser contextual menu will do nothing.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-01 15:43:51 +00:00
Christian Sadilek
fd0f335c4f [components] Fix KDocs of AllowedInPrivateBrowsingAction 2021-01-15 14:57:03 +00:00
Christian Sadilek
d314d0e375 [components] Closes https://github.com/mozilla-mobile/android-components/issues/7884: Move active web extension tab state to store 2021-01-15 14:57:03 +00:00
Sebastian Kaspari
370f706a6a [components] Closes https://github.com/mozilla-mobile/android-components/issues/4257: Migrate feature-customtabs from browser-session to browser-state. 2021-01-14 17:37:15 +00:00
Arturo Mejia
f48f395695 [components] Closes https://github.com/mozilla-mobile/android-components/issues/9176 Add support for site specific autoplay permissions. 2021-01-12 16:27:55 +00:00
Sebastian Kaspari
13adbd833c [components] Migrate feature-recentlyclosed to use BrowserStore exclusively and replace ClosedTab with RecoverableTab. 2021-01-11 14:37:04 +00:00
Christian Sadilek
a6cbe64761 [components] Closes https://github.com/mozilla-mobile/android-components/issues/8913: Migrate feature-app-links to browser-state 2021-01-08 17:22:48 +00:00
mawen7
202c403aa8 [components] Use file separator 2020-12-14 15:41:05 +00:00
Arturo Mejia
c89fa9273f [components] Closes https://github.com/mozilla-mobile/android-components/issues/9131: Add site permission indicators
in the toolbar.
2020-12-10 10:46:28 +00:00
Sebastian Kaspari
2191eda94e [components] Closes https://github.com/mozilla-mobile/android-components/issues/4571: Introduce API to purge (back/forward) history of tabs.
* For `PurgeHistoryUseCase` I decided to not introduce a "tab ID" parameter and instead have
  it purge the history of all tabs. It seems like this is what we need and individual tab
  history removal is not needed for now.
* Some tabs may not have an `EngineSession` assigned. Creating one just to call purgeHistory()
  seems excessive. Instead I am dropping an attached `EngineSessionState` which will cause
  those tabs to just reload the URL with not back/forward history when they get restored.
2020-12-08 19:43:08 +00:00
Christian Sadilek
de36351126 [components] Closes https://github.com/mozilla-mobile/android-components/issues/9157: Move desktopMode state from Session to Store 2020-12-08 17:14:59 +00:00
Sebastian Kaspari
d2600f3328 [components] Closes https://github.com/mozilla-mobile/android-components/issues/9151: Refactor feature-pwa to not depend on browser-session anymore.
Again, multiple things in this PR:

* Migrated WebAppIntentProcessor and TrustedWebActivityIntentProcessor to use TabsUseCases instead of
  SessionManager directly.
* Migrated one LoadUrlUseCase to take a session ID instead of a `Session` instance as parameter
* Extended TabsUseCases to optionally accept a CustomTabConfig and/or WebAppManifest

I think with that we may even be able to remove WebAppManifest from `Session`. I'll look into this next.
2020-12-08 15:47:51 +00:00
Emilio Cobos Álvarez
41d375b7d9 [components] ktlint: Add missing newlines.
Running ./gradlew ktlint locally reports a lot of stuff like:

/home/emilio/src/moz/android-components/components/support/migration/src/test/java/mozilla/components/support/migration/MigrationIntentProcessorTest.kt:1:1: File must end with a newline (\n)

This fixes it with:

    for f in $(cat files | cut -d : -f 1); do echo "" >> $f; done

Making ./gradlew ktlint pass.
2020-12-03 17:24:44 +00:00
Sebastian Kaspari
7b8f79a1b3 [components] Closes https://github.com/mozilla-mobile/android-components/issues/9096: Move recording devices from Session to ContentState and turn RecordingDevicesNotificationFeature into middleware. 2020-12-03 16:45:02 +00:00
Sebastian Kaspari
300e7440ba [components] Issue https://github.com/mozilla-mobile/android-components/issues/8879: feature-recentlyclosed: Replace InitializeRecentlyClosedState with generic init action. 2020-12-03 10:41:33 +00:00
Sebastian Kaspari
4772e5b779 [components] Issue https://github.com/mozilla-mobile/android-components/issues/8879: feature-containers: Replace InitializeContainerState with generic init action. 2020-12-02 10:25:57 +00:00
Roger Yang
d5392af1e7 [components] Closes https://github.com/mozilla-mobile/android-components/issues/8743, closes https://github.com/mozilla-mobile/android-components/issues/8886: Use MediaSesssion API in Media Notification 2020-11-18 11:09:19 +00:00
Arturo Mejia
f04a6913d5 [components] Closes https://github.com/mozilla-mobile/android-components/issues/8943 refactor SwipeRefreshFeature to not use EngineSession.Observer 2020-11-12 19:36:50 +00:00