* 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.
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
Issue https://github.com/mozilla-mobile/android-components/pull/8121: Replace MigrationStore with MigrationContext and prevent usage outside of a Middleware.
* Before executing the reducer chain we now verify that we are on the store thread and throw if we are on a different thread.
* MigrationContext now provides a store property that returns the underlying Store instance. This can be used to pass it to
other components and threads that are not part of the Middleware.
* Fixed existing Middleware implementations to use the MiddlewareContext or pass the actual Store instance around.