* 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>
* 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.
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>
* 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.
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.
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.
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.
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.
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.
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>
* 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.