Commit graph

58 commits

Author SHA1 Message Date
t-p-white
01f1578630 Bug 1874861 - Removed redundant LongParameterList suppression's 2024-01-18 18:37:49 +00:00
mcarare
063c553913 Bug 1849833 - Replace deprecated compileSdkVersion.
This is replaced by defaultConfig compileSdk.
2023-09-11 06:36:20 +00:00
mcarare
235c47209f Bug 1849833 - Replace deprecated kotlinOptions method. 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
Gabriel Luong
cd6f5e0e77 Bug 1795140 - Enable AbsentOrWrongFileLicense detekt rule 2023-08-14 17:53:38 +00:00
MatthewTighe
c87183c8b5 Bug 1843168 - Expose Mockito through test support component 2023-07-24 18:02:09 +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
45f919de20 Bug 1802817 - Migrate packagingOptions DSL properties to resources sub-block.
exclude, pickFirst methods are deprecated.
2023-03-02 17:13:09 +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
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
Jonathan Almeida
f12f800930 [components] Close https://github.com/mozilla-mobile/android-components/issues/9829: Move IO work in FxaPushSupportFeature to a coroutine
The `FxaPushSupportFeature` needs to generate, read and write a push
scope (identifier) to disk. This work was meant to be done lazily and
not during app startup. However, if a Sync account is setup then the IO
work is done immediately during the initial account manager
initialization at startup.

In this patch, we delegate this IO work to a new `PushScopeProperty`
that retrieves the value from disk using a provided `CoroutineScope`.
2022-08-31 15:57:23 +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
Sammy Khamis
7c646ab805 [components] Don't allow fenix to send tabs with unsupported uris (https://github.com/mozilla-mobile/android-components/pull/11882)
* Don't allow fenix to send tabs with unsupported uris

* review nits

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-04-26 14:22:14 +00:00
jknair
dab5e6e10e [components] For https://github.com/mozilla-mobile/android-components/issues/11998 lowercase-ing the scheme added while Normalizing the Url 2022-04-14 10:43:18 +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
Sebastian Kaspari
90ec41fc3a [components] Update Kotlin and Jetpack Compose versions. 2021-10-25 10:58:07 +00:00
Mark Hammond
b489fa4e68 [components] remove unused import 2021-10-08 05:17:08 +00:00
Mark Hammond
4b00f53208 [components] Fix max line length 2021-10-08 05:17:08 +00:00
Mark Hammond
808ddc223f [components] Ensure we tell the autopush server about a new FCM token.
This should fix push for FxA.

I also made a number of other push cleanups - in particular,
we are far more aggressive about subscribing - we no longer
do it on login, but instead on every startup. Note that
the Rust component will not hit the server if a subscription
already exists, so this is still relatively fast, and will pick up
missing subscriptions)

This may not fix broken, non-FxA devices - they don't know they need a new
FCM token. It's not even clear if that's a thing though - but either
`renewRegistration` is not necessary, or it is and non FxA push
will remain broken.
2021-10-08 05:17:08 +00:00
Grisha Kruglov
dcadb73fee [components] Prepend 'http' to URLs in intents whith no schemes
We observed via Sentry that we were hitting a bunch of 'url without
base' exceptions coming out of metadata observation API. One of these
cases where we'll end-up trying to process a URL without a base (e.g.
without a scheme) is when we're processing external intent and see
something like "example.com", instead of "https://example.com".

In our toolbar, we use String.toNormalizedUrl to handle this case.

In this patch, we now do the same for URLs we encounter in external
intents, as well.
2021-10-06 15:16:04 +00:00
Mark Hammond
aceb6c3b30 [components] Ensure we notice and repair a missing or expired push endpoint. (https://github.com/mozilla-mobile/android-components/pull/10913)
* Ensure we notice and repair a missing or expired push endpoint.

The core problem is that the device constellation's observer is registered
after we've updated the devices, so the code that checks if re-subscribing is
necessary is never hit.

The easiest way of fixing this was to move the `refreshDevices` call to the
account state state-machine, rather than the authentication state-machine,
meaning we can ensure the `onAuthenticated` notification is delivered before
we refresh the devices.

Note that I also removed the special-case for "SEND_TAB" devices - push is
also used for account-related notifications, such as being disconnected.

* Address CI failures (hopefully!)

* Update comments about push renewal

* Tweak suggested by Grisha for when to call refreshDevices

* More CI failures

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-09-09 17:42:12 +00:00
Jonathan Almeida
478711a6bf [components] Close https://github.com/mozilla-mobile/android-components/issues/10677: Update Mockito to 3.11.2
Co-authored-by: Mugurell <Mugurell@users.noreply.github.com>
2021-08-12 02:25:56 +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
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
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
Grisha Kruglov
3a732afce5 [components] Closes https://github.com/mozilla-mobile/android-components/issues/9972: Invoke Push feature's registerDeviceObserver call on the main thread 2021-04-12 08:50:58 +00:00
Jonathan Almeida
8b3972f527 [components] Close https://github.com/mozilla-mobile/android-components/issues/9222: Revert un-subscribe on subscriptionExpired notification 2020-12-16 16:09:54 +00:00
Mark Hammond
fd01526bb3 [components] Treat no push subscription as though it had expired, and poll for missed commands in both cases 2020-12-10 01:44:45 +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
Jonathan Almeida
f7be84b506 [components] Issue https://github.com/mozilla-mobile/android-components/issues/9011: Submit exception on subscribe error 2020-11-30 22:12:06 +00:00
Jonathan Almeida
c5ff29bba5 [components] Close https://github.com/mozilla-mobile/android-components/issues/9011: Unsubscribe before subscribing to fix FxA push
Also redacts majority of the endpoint that we add to our crash reporter.
2020-11-18 21:05:31 +00:00
Jonathan Almeida
4a4923b1cc [components] Close https://github.com/mozilla-mobile/android-components/issues/8846: Re-subscribe FxA push subscription on subscriptionExpired
This is a workaround fix to re-enable Send Tab when we are notified
about the subscriptionExpired flag. Until https://github.com/mozilla-mobile/android-components/issues/7143 is fixed, we need to
avoid calling `registrationRenewal` to avoid going into an unfixable
state.

In the context of the FxaPushSupportFeature, we know that our end goal
is to call `push.subscribe(fxaPushScope)`, so we can by pass the
`verifyConnection` call **assuming** that our native push client is
always has the latest push token and knows how to invalidate the
endpoint with the Autopush server.
2020-11-17 16:49:14 +00:00
Stuart Gilbert
44fe25b41a [components] Closes https://github.com/mozilla-mobile/android-components/issues/8745 Remove OneTimeFxaPushReset from FxaPushSupportFeature 2020-11-03 21:51:15 +00:00
Jonathan Almeida
05f40ed912 [components] Close https://github.com/mozilla-mobile/android-components/issues/8776: Add rate-limit override to Push features
When debugging push, it can be quite tedious to manually reset the
state of our DDOS protection code. Here, we introduce an override flag
into the `PushConfig` that can be used by the `PushFeature` and
`FxaPushSupportFeature`.
2020-11-01 03:58:23 +00:00
Grisha Kruglov
a90d794cfa [components] Add debug logging for Send Tab and Push code 2020-10-27 20:29:34 +00:00
Grisha Kruglov
ee28f42d71 [components] Account manager state machine refactoring 2020-09-22 20:40:24 +00:00
Tiger Oakes
c6c313f409 [components] Update lifecycle version 2020-05-20 13:46:06 -07:00
Jonathan Almeida
a53f454005 [components] Close https://github.com/mozilla-mobile/android-components/issues/6847: Use constellation as receiver 2020-05-04 15:35:43 -04: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
Jonathan Almeida
3b9a5cd4a2 [components] Closes https://github.com/mozilla-mobile/android-components/issues/6194: Re-subscribe for push on subscription change events 2020-03-25 23:08:48 -04:00
Jonathan Almeida
b80d0fed3d [components] Closes https://github.com/mozilla-mobile/android-components/issues/6290: Do not remove FxA push scope on logout
We're caching the `fxaPushScope` in memory and also saving it to our
prefs. When we log out, we delete the pref, but the in-memory isn't
removed.

We could always fetch from the prefs instead of using an in-memory
caching, however this could be a bit expensive to always read from prefs
since we need to do this check when receiving any push message.

An easier solution would be to never remove the scope in prefs once
generated. It is safe to persist the push scope across different
accounts since the combination of scope + UAID is unique per install.
2020-03-23 13:47:57 -04:00
Jonathan Almeida
a487f91b3a [components] Closes https://github.com/mozilla-mobile/android-components/issues/6125: Reset FxA push subscriptions to new format 2020-02-28 16:50:53 -05:00