Commit Graph

154 Commits

Author SHA1 Message Date
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
Sebastian Kaspari
39cb5fa192 [components] Issue https://github.com/mozilla-mobile/android-components/issues/8744: Save search engine ID and name when user selects search engine.
There are two reasons why we need the name in addition to the ID:
* When the user switches to a new "home" region then the previously selected search engine ID may no longer be in the
  list. However there may be a different version of that search engine with a different ID for this region. In this
  case we want to select that search engine - since for the user there's no visible difference. A famous example of
  that is "Google", which may have different IDs / search plugins depending on region.
* Fenix saves the search engine name and we need to import that.

Fenix (as well as Fennec) already used the name, so it should be safe to pick the selected search engine based on
the name of the search engine.
2020-11-03 08:45:55 +00:00
ekager
02a1023025 [components] For https://github.com/mozilla-mobile/android-components/issues/8831 - Adds ability to remove (and restore) a list of tabs 2020-11-02 22:46:29 +00:00
Sebastian Kaspari
5804da97e9 [components] Issue https://github.com/mozilla-mobile/android-components/issues/8744: Search: Add ability to load additional search engines that users can choose from. 2020-11-02 11:36:49 +00:00
codrut.topliceanu
c84123dfb8 [components] For https://github.com/mozilla-mobile/android-components/issues/8554 - Migrate permissionFeature to KotlinFlow 2020-10-28 19:47:01 +00:00
Sebastian Kaspari
529eab44fd [components] Issue https://github.com/mozilla-mobile/android-components/issues/8744: Update search terminology.
The term "default" is somewhat overloaded and can mean multiple things. With this patch I introduce the
term "selected search engine" (similar to tabs) to indicate a search engine that was explicitly selected
by the user as their default. This will hopefully make it less ambigious.
2020-10-28 11:01:15 +00:00
Arturo Mejia
bc2387d7bf [components] Closes https://github.com/mozilla-mobile/android-components/issues/8784 Create download directory when
it doesn't exists.
2020-10-26 18:30:47 +00:00
Sebastian Kaspari
b9af450479 [components] Issue https://github.com/mozilla-mobile/android-components/issues/8702: Add actions and storage for showing/hiding bundled search engines. 2020-10-22 10:11:14 +00:00
Sebastian Kaspari
d4ba7918c1 [components] Issue https://github.com/mozilla-mobile/android-components/issues/8744: SearchMiddleware: Load all data in one action and set 'complete' flag. 2020-10-20 18:13:25 +00:00
Christian Sadilek
6f338f2999 [components] Closes https://github.com/mozilla-mobile/android-components/issues/8697: Move Session.loadRequestMetadata to browser state 2020-10-15 13:41:06 +00:00
Sebastian Kaspari
9981f05aa2 [components] Issue https://github.com/mozilla-mobile/android-components/issues/7864: Add RegionMiddleware and SearchMiddleware to sample browser. 2020-10-12 12:44:05 +00:00
Sebastian Kaspari
292a3e87df [components] Issue https://github.com/mozilla-mobile/android-components/issues/7863: Reorganized SearchState to separate region and custom search engines. 2020-10-12 12:44:05 +00:00
Sebastian Kaspari
b95ccf4b23 [components] Issue https://github.com/mozilla-mobile/android-components/issues/7863: Introduce RegionManager for keeping track of the user's current and home region. 2020-10-08 13:39:22 +00:00
Sebastian Kaspari
30be5d0cdb [components] Issue https://github.com/mozilla-mobile/android-components/issues/7863: Add RegionState to SearchState. 2020-10-08 13:39:22 +00:00
Roger Yang
4391b4e2c8 [components] Closes https://github.com/mozilla-mobile/android-components/issues/8207: Add Delegate and Browser Session State for MediaSession API 2020-10-07 10:14:40 +00:00
Arturo Mejia
593c25629e [components] Closes https://github.com/mozilla-mobile/android-components/issues/8312:Adds support for ContentDelegate#onExternalResponse 2020-10-05 17:32:38 +00:00
Christian Sadilek
98a3db9ffc [components] Introduce state to indicate if restoring tabs is complete 2020-10-02 16:38:18 +00:00
Sebastian Kaspari
b5ba7558a2 [components] Closes https://github.com/mozilla-mobile/android-components/issues/8529: Dispatch a generic InitAction from BrowserStore
Co-authored-by: Christian Sadilek  <christian.sadilek@gmail.com>
2020-09-30 17:31:15 +00:00
Arturo Mejia
c5df5ad6d2 [components] Improve download flow 2020-09-25 20:22:57 +00:00
ekager
f20da349fd [components] Closes https://github.com/mozilla-mobile/android-components/issues/8493 - Add private param to RecoverableTab 2020-09-25 09:41:57 +00:00
Sebastian Kaspari
067e9782de [components] Issue https://github.com/mozilla-mobile/android-components/issues/3265: Add support for "undo" functionality.
This is not the fancy version yet since we still need to restore into SessionManager. Once it is gone and
we rely on BrowserStore only, then we can make this better.

However moving this functionality into AC now helps us:
- It will be easier to migrate to a better undo functionality since this code is already in AC.
- Other code can interact with the "undo" actions. For example "recently closed tabs" now will
  only contain a tab if the removal was not undone.
2020-09-22 17:59:34 +00:00
MozLando
2eb3cf6114 [components] Merge https://github.com/mozilla-mobile/android-components/pull/8049
8049: For https://github.com/mozilla-mobile/android-components/issues/6099 - Convert config to yaml r=pocmo a=NotWoods

In Gradle 6, buildSrc classes cannot be used inside settings.gradle. Inlining the `Config` class gets around this problem for us. The values inside the class have been moved to a YAML file so that it can be used by Taskcluster to check if data has changed, and used by the changelog to be a simple version overview.

We could also use a .properties file for this.

Co-authored-by: Tiger Oakes <toakes@mozilla.com>
2020-09-11 11:37:27 +00:00
ekager
d453dd86e6 [components] Closes https://github.com/mozilla-mobile/android-components/issues/8253 - Adds RecentlyClosedTabStorage 2020-09-09 09:04:48 -07:00
Sebastian Kaspari
c66d74ce23 [components] Issue https://github.com/mozilla-mobile/android-components/issues/8255: Lazily restore engine sessions after content process kill or crash.
* Instead of keeping the EngineSessionState inside EngineSession, we now always attach it to EngineState and also do not
  clear it anymore.
* If the content process gets killed we now just suspend affected EngineSession instances. They will automatically and
  lazily get restored from the last EngineSessionState once needed.
* On a content process crash we now mark the EngineState as crashed and suspend the EngineSession. We will not restore
  the EngineSession until explicitly restored by the application.
2020-09-07 13:30:04 +02:00
MozLando
f300cdae51 [components] Merge https://github.com/mozilla-mobile/android-components/pull/8250
8250: Close https://github.com/mozilla-mobile/android-components/issues/7476: Persists lastAccess to SnapshotSerializer  r=csadilek a=jonalmeida



Co-authored-by: Jonathan Almeida <jalmeida@mozilla.com>
2020-08-29 03:47:00 +00:00
Jonathan Almeida
a4d8824526 [components] Close https://github.com/mozilla-mobile/android-components/issues/7476: Persists lastAccess to SnapshotSerializer 2020-08-28 23:43:48 -04:00