Commit Graph

49 Commits

Author SHA1 Message Date
Sebastian Kaspari
ce323400dd [components] Run ktlintFormat to fix new ktlint errors. 2021-07-28 12:03:23 +00:00
Michael Comella
06e80c6e10 [components] For https://github.com/mozilla-mobile/android-components/issues/10604: remove remaining unused imports automatically.
This commit was automatically generated with:
```sh
./gradlew ktlint --args="-F"
```
2021-07-27 19:39:04 +00:00
Michael Comella
56938c0849 [components] For https://github.com/mozilla-mobile/android-components/issues/10604: remove redundant constructor to MainCoroutineRule in tests.
The default argument is identical to the passed in argument.
2021-07-27 19:39:04 +00:00
Michael Comella
9f3e6f1a1b [components] For https://github.com/mozilla-mobile/android-components/issues/10604: reuse new TestCoroutineDispatcher in additional tests.
These follow a few more simple patterns I was able to find:
- the testDispatcher is not used anywhere else: remove it
- the testDispatcher is used to set a main dispatcher: this is redundant
to the test rule so remove it both the dispatcher & the main dispatcher
- the testDispatcher is actually used elsewhere: for simplicity, change
the reference to point at the MainCoroutineRule.
2021-07-27 19:39:04 +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
Sebastian Kaspari
9fb6953940 [components] Upgrade Android Gradle Plugin to 4.2.2 and Gradle to 6.7.1. 2021-07-19 09:32:44 +00:00
Sebastian Kaspari
28a76101be [components] Update Kotlin to 1.5.10 (and Coroutines to 1.5.0 and Room to 2.3.0). 2021-07-19 09:32:44 +00:00
Roger Yang
89cfe1df17 [components] Issue https://github.com/mozilla-mobile/android-components/issues/10335: Update appcompat and fragment dependencies to 1.3.x. 2021-06-21 23:05:50 +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
Roger Yang
fc3893f5c7 [components] Revert "Issue https://github.com/mozilla-mobile/android-components/issues/10335: Update appcompat and fragment dependencies to 1.3.x."
This reverts commit d4acb0a56642347150d07ed431a554c62bdf6353.
2021-06-14 16:31:52 +00:00
Sebastian Kaspari
753f7a0971 [components] Issue https://github.com/mozilla-mobile/android-components/issues/10335: Update appcompat and fragment dependencies to 1.3.x. 2021-06-14 15:02:37 +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
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
Jonathan Almeida
be025ecd12 [components] Close https://github.com/mozilla-mobile/android-components/issues/10050: Upstream AbstractBinding from consuming applications 2021-05-04 20:14:29 +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
d299aacf7b [components] Update Kotlin to 1.4.21 and Coroutines to 1.4.2. 2021-01-04 11:05:40 +00:00
Christian Sadilek
b4a18c1c06 [components] Add missing @MainThread to consumeFlow 2020-12-15 17:29:58 +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
Christian Sadilek
09f0874a2a [components] Closes https://github.com/mozilla-mobile/android-components/issues/9056: consumeFlow leaks fragment if removed before flow created 2020-11-30 09:00:42 +00:00
Christian Sadilek
f121d51454 [components] Closes https://github.com/mozilla-mobile/android-components/issues/9017: Memory leak in consumeFlow 2020-11-19 16:23:08 +00:00
Sebastian Kaspari
833ad720de [components] Fragment.consumeFrom()/consumeFlow(): Explicitly check for activity and view being available. 2020-10-26 16:10:11 +00:00
Sebastian Kaspari
ff4a8593d2 [components] Fragment.consumeFrom(), Fragment.consumeFlow(): Use isDetached instead of isAdded.
Using consumeFlow() in Fenix I noticed that in certain situations `isAdded` returns `false` even though
the `Fragment` is not detached and we have an `Activity` context. This problem goes away when we
explicitly check with `isDetached` - which also still works around the issue why we had this check
in the first place.
2020-10-23 15:35:43 +00:00
Christian Sadilek
ffee6e9713 [components] Issue https://github.com/mozilla-mobile/android-components/issues/8721: Use fragment as default lifecylceowner in consumeFlow 2020-10-21 16:15:23 +00:00
Sebastian Kaspari
2d3cddfe36 [components] Issue https://github.com/mozilla-mobile/android-components/issues/8721: Introduce Fragment.consumeFlow() extension function. 2020-10-19 09:15:30 +00:00
Sebastian Kaspari
212c7d73c1 [components] Issue https://github.com/mozilla-mobile/android-components/issues/7867: Move EngineSession from SessionManager to BrowserState.
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.
2020-08-26 10:50:47 -04:00
Tiger Oakes
97a49470bd [components] Remove roboletric runner for some lib tests 2020-07-01 10:10:30 -07:00
Tiger Oakes
c6c313f409 [components] Update lifecycle version 2020-05-20 13:46:06 -07:00
Jonathan Almeida
b86fa6dfb5 [components] Close https://github.com/mozilla-mobile/android-components/issues/6601: Update targetSdkVersion to 29 2020-04-28 03:16:54 -04:00
Sebastian
20a9a3bf3f [components] Issue https://github.com/mozilla-mobile/android-components/issues/6235: lib-state/browser-state: Add support for middleware. 2020-03-13 18:17:20 +01:00
Christian Sadilek
55df692652 [components] Closes https://github.com/mozilla-mobile/android-components/issues/5792: Potential deadlock between unsubscribe and dispatch 2020-02-19 16:00:23 -05:00
Christian Sadilek
5347ca064d [components] Closes https://github.com/mozilla-mobile/android-components/issues/5783: Deadlock when dispatching actions during lifecycle change 2020-02-03 11:25:38 -05:00
Tiger Oakes
1bdf8c8234 [components] Add JUnit coroutine test rule 2019-11-18 19:52:50 -08:00
Denys M
b95c932f81 [components] For https://github.com/mozilla-mobile/android-components/issues/4460. Fix detekt warning about license in project files. 2019-09-24 01:01:03 +04:00
Sebastian Kaspari
2c3b41aa37 [components] Update AndroidX dependencies.
Follow-up issues:
* https://github.com/mozilla-mobile/android-components/issues/4379
* https://github.com/mozilla-mobile/android-components/issues/4378
2019-09-11 14:25:23 +02:00
Sebastian Kaspari
32adde534b [components] Issue https://github.com/mozilla-mobile/android-components/issues/3786: Make LifecycleOwner parameter for Store.flow() and Store.flowScoped() optional (primarily for testing). 2019-09-03 14:17:55 +02:00
Sebastian Kaspari
a3a29954af [components] Issue https://github.com/mozilla-mobile/android-components/issues/3786, https://github.com/mozilla-mobile/android-components/issues/3530: Add Store extensions to observe State using the Flow API. 2019-08-30 15:54:07 +02:00
Sebastian Kaspari
8ccc74ddad [components] Closes https://github.com/mozilla-mobile/android-components/issues/4125: Fragment.consumeFrom(): Temporarily check whether fragment is added. 2019-08-19 11:08:24 +02:00
Sebastian Kaspari
bfbcbf95ea [components] Turn Store.broadcastChannel() into Store.channel() and return just a ReceiveChannel.
Broadcast channels have a complicated lifetime since they can have multiple subscribers. This
means a broadcast channel can stay alive longer than there are subscribers. Using a ReceiveChannel,
which can only have one receiver, simplifies this greatly. Also this guarantees that invokeOnClose()
gets invoked when the channel gets closed AND when the receiver is cancelled (from consume()).

On top of that we do not really need the broadcast functionality. As of now we always will only
have a single consumer of the channel. And if that ever changes we can either create multiple
channels or use Kotlin's ReceiveChannel.broadcast() extension method.
2019-07-25 10:05:09 -04:00
Sebastian Kaspari
e4db77e955 [components] Issue https://github.com/mozilla-mobile/android-components/pull/3083: lib-state: Add unit tests for consumeFrom helpers. 2019-07-24 11:54:20 +02:00
Sebastian Kaspari
244721135e [components] Issue https://github.com/mozilla-mobile/android-components/pull/3083: Do not close channel from consumeFrom() since that is handled internally.
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
2019-07-24 11:54:20 +02:00
Sebastian Kaspari
a87424b6d2 [components] Issue https://github.com/mozilla-mobile/android-components/issues/3803: Add helper methods to consume state from a store with fragment or view scope.
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
2019-07-24 11:54:20 +02:00
Sebastian Kaspari
275cd77618 [components] Issue https://github.com/mozilla-mobile/android-components/issues/3803: Add Store.broadcastChannel() extension method to observe state changes from a channel.
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
2019-07-24 11:54:20 +02:00
Sebastian Kaspari
76e88d170d [components] Issue https://github.com/mozilla-mobile/android-components/issues/3803: lib-state: Add ability to pause and resume store subscriptions and use it for View and Lifecycle binding.
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
2019-07-24 11:54:20 +02:00
Christian Sadilek
dab920cc5c [components] Issue https://github.com/mozilla-mobile/android-components/issues/3563: Introduce StoreException for errors caught in Store/Reducer 2019-07-05 17:22:38 +02:00
Sebastian Kaspari
0d867da2b0 [components] Closes https://github.com/mozilla-mobile/android-components/issues/3563: BrowserStore: Rethrow exceptions on the main thread. 2019-07-04 18:08:50 +02:00
Sebastian Kaspari
38f8ab1ce6 [components] Restructure (reduced) BrowserState and add tests. 2019-06-25 17:13:49 +02:00
Tiger Oakes
ef5601825e [components] Add documentation for lib-state 2019-06-25 10:35:42 +02:00
Sebastian Kaspari
234928260e [components] browser-state: Move state handling to generic lib-state component. 2019-06-24 07:57:54 -07:00