Commit graph

76 commits

Author SHA1 Message Date
mcarare
7562dc8765 Bug 1880077 - Switch to using Compose BOM instead of individual versioning 2024-02-22 08:51:53 +00:00
Jonathan Almeida
4b19e55ee5 Bug 1873302 - Update StoreThreadFactory exception message 2024-01-13 15:29:00 +00:00
mcarare
063c553913 Bug 1849833 - Replace deprecated compileSdkVersion.
This is replaced by defaultConfig compileSdk.
2023-09-11 06:36:20 +00:00
mcarare
d144b283c9 Bug 1849833 - Replace all with configureEach.
This avoids unnecessary configuration.
2023-09-11 06:36:20 +00:00
mcarare
5a7b24763d Bug 1849833 - Replace qualified name with import. 2023-09-11 06:36:20 +00:00
MatthewTighe
c87183c8b5 Bug 1843168 - Expose Mockito through test support component 2023-07-24 18:02:09 +00:00
mcarare
898e190e70 Bug 1826590 - Run test job on Main. 2023-06-12 20:54:19 +00:00
rahulsainani
a8c1d2b399 Bug 1830895 - observeAsState compose extension 2023-05-16 13:06:41 +00:00
Noah Bond
830d0e0cc1 Bug 1826457 - Update Compose version to 1.4.2 and Lifecycle version to 2.6.1 2023-04-27 03:17:17 +00:00
Geoff Brown
6561b2de2b Bug 1825116 - Resolve many black, isort, and file-whitespace lint issues 2023-04-12 14:04:29 +00:00
mcarare
278fa80cc2 Bug 1824717 - Remove unnecessary AndroidJUnit4 runner. 2023-04-05 12:44:13 +00:00
Ryan VanderMeulen
0e5e70291c Bug 1820233 - Remove unneeded kotlin_stdlib inclusions and re-enable Werror in detekt build.gradle 2023-03-07 00:12:18 +00:00
mcarare
1f589a2e0b Bug 1802817 - Set namespace via DSL in gradle build files.
See https://developer.android.com/studio/build/configure-app-module#set-namespace
and https://issuetracker.google.com/issues/172361895
2023-03-02 17:13:09 +00:00
mcarare
922b5f6643 Bug 1802817 - Rename AC Dependencies to ComponentsDependencies.
This change is needed in order to avoid clashes with Dependencies class introduced
in Gradle from 7.6 version.
2023-03-02 17:13:09 +00:00
Christian Sadilek
4091b14a33 Fix android lint in composite builds 2022-11-21 13:40:53 -05:00
Mihai Adrian Carare
e087b524a6 Bug 1796353 - Build with compileSdkVersion for Android 13 / API 33. (https://github.com/mozilla-mobile/firefox-android/pull/62)
* Bug 1796353 - Build with compileSdkVersion for Android 13 / API 33.

* Bug 1796353 - Update method signature for View.AccessibilityDelegate.

* Bug 1796353 - Handle AccessibilityNodeInfo.CollectionInfo.obtain deprecation.

* Bug 1796353 - Update method signature for View.OnAttachStateChangeListener.

* Bug 1796353 - Handle getParcelableExtra(String) deprecation.

* Bug 1796353 - Handle getParcelable(String) deprecation.

* Bug 1796353 - Handle getParcelableArrayListExtra(String) deprecation.

* Bug 1796353 - Move URLStringUtils to ktx package.

This is needed to avoid circular dependencies for some needed changes.

* Bug 1796353 - Suppress deprecation for get(String).

* Bug 1796353 - Replace removed method setAppCacheEnabled.

* Bug 1796353 - Handle PackageManager methods deprecations.

* Bug 1796353 - Handle getSerializable(String) deprecation.

* Bug 1796353 - Handle stopForeground deprecation.

* Bug 1796353 - Update method signature for GestureDetector.SimpleOnGestureListener.

* Bug 1796353 - Handle AccessibilityEvent.obtain deprecation.

* Bug 1796353 - Handle getParcelableArrayList(String) deprecation.

* Bug 1796353 - Handle getParcelableArray(String) deprecation.

* Bug 1796353 - Handle getSerializableExtra(String) deprecation.

* Bug 1796353 - Handle readParcelable(classLoader) deprecation.

* Bug 1796353 - Handle FillResponse.Builder setAuthentication deprecation.

* Bug 1796353 - Handle Dataset.Builder setValue deprecation.

* Bug 1796353 - Suppress get(String) deprecation.

We still need to use this method because we do not know the type beforehand.

* Bug 1796353 - Handle onBackPressed() deprecation.

* Bug 1796353 - Suppress queryBroadcastReceivers deprecation.

* Bug 1796353 - Suppress package manager methods deprecation.

* Bug 1796353 - Catch and report exceptions when handling touch event detection.

* Bug 1796353 - Suppress deprecation for getPackageInfo used in tests with SDK 28.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-11-16 00:35:40 -05: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
5039c5e30d [components] For https://github.com/mozilla-mobile/android-components/issues/12500: Fix ktlint issues.
Also remove issues from ktlint baseline.
2022-10-11 07:17:12 +00:00
mcarare
89c716d240 [components] For https://github.com/mozilla-mobile/android-components/issues/12500: Handle OnLifecycleEvent deprecations. 2022-10-11 07:17:12 +00: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
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
33d5df7988 [components] For https://github.com/mozilla-mobile/android-components/issues/11670: Use shadowOf(getMainLooper()).idle() to execute all posted tasks.
This is needed due to the new default Looper Mode - PAUSED in Robolectric.
2022-03-18 12:43:16 +00:00
Matt Tighe
320db82e76 [components] remove deprecated lifecycle usages 2022-01-13 21:27:08 +00:00
Sebastian Kaspari
90ec41fc3a [components] Update Kotlin and Jetpack Compose versions. 2021-10-25 10:58:07 +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
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