Commit Graph

4052 Commits

Author SHA1 Message Date
Christophe Beyls 45d36a6a87
Update splash screen to properly use the Androidx SplashScreen library (#4413)
The Androidx SplashScreen library is added as a dependency to the
project but isn't properly enabled in the current code. This pull
request configures the splash screen properly.

- Remove `SplashScreenActivity` which is not needed and use
`MainActivity` as main entry point to the application. `MainActivity`
inherits from `BaseActivity` which already detects if no account is
configured and redirects to `LoginActivity` if needed, just like
`SplashScreenActivity`.
- Initialize the SplashScreen library in `MainActivity.onCreate()`.
- Instead of letting the SplashScreen library set the final theme from
the `postSplashScreenTheme` attribute in SplashTheme, let `BaseActivity`
set it according to the user settings.
- When no account is available in `MainActivity.onCreate()`, keep the
splash screen shown until `LoginActivity` appears.
- Disable the slide-in animation when launching `LoginActivity` when no
account is available because the detection happens in `onCreate()` and
an Activity that finishes itself in `onCreate()` will not be drawn, so
the slide-in animation will not be visible either and only
`LoginActivity` will appear.
- Upgrade `core-splashscreen` to 1.2.0-alpha01 which contains a fix for
corrupted app theme on API 31+.
2024-05-12 11:31:47 +02:00
Christophe Beyls f9221b3d75
Improve RequestBuilder.submitAsync() to ensure the coroutine continuation is resumed only once (#4436)
`RequestListener.onResourceReady()` may also be called to provide the
placeholder image when the request is starting or when it is cleared.

Check if the current request is complete (its status set to COMPLETE) to
determine if the Glide resource is for a thumbnail/placeholder or the
final image, and resume the coroutine only for the final image (or in
case of error).
This logic is [borrowed from the Glide Flow
API](a7351b0ecf/integration/ktx/src/main/java/com/bumptech/glide/integration/ktx/Flows.kt (L378)).
2024-05-12 11:25:49 +02:00
Christophe Beyls 11d18e1e70
Upgrade DrawerLayout to 1.2.0 and simplify code (#4412)
The main benefit of upgrading to version 1.2.0 of `DrawerLayout` is ~~to
properly support **predictive back animations**: when initiating a back
gesture on API 33+, the DrawerLayout will animate automatically~~ to
handle back navigation automatically. The predictive back animation of
the menu however depends on `NavigationView` which is not used in the
project.

In addition to the upgrade, simplify DrawerLayout integration:
- Forward key events to the DrawerLayout so it can intercept them and
close itself when needed.
- Don't handle the DrawerLayout closing manually using the
`OnBackPressedCallback` anymore. This is not necessary since the back
event will now be intercepted by the DrawerLayout when needed before
reaching the `OnBackPressedDispatcher`.
- Remove legacy fix for DrawerLayout staying open after Activity
recreation.
2024-05-10 17:14:26 +02:00
Mārtiņš Bruņenieks 1c48cc43e2 Translated using Weblate (Latvian)
Currently translated at 84.8% (544 of 641 strings)

Co-authored-by: Mārtiņš Bruņenieks <martinsb@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/lv/
Translation: Tusky/Tusky
2024-05-10 13:54:16 +00:00
Connyduck bb481cbe95 Translated using Weblate (German)
Currently translated at 99.5% (638 of 641 strings)

Co-authored-by: Connyduck <weblate@connyduck.at>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/de/
Translation: Tusky/Tusky
2024-05-10 13:54:16 +00:00
Ihor Hordiichuk 2bb234b7db Translated using Weblate (Ukrainian)
Currently translated at 100.0% (641 of 641 strings)

Co-authored-by: Ihor Hordiichuk <igor_ck@outlook.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/uk/
Translation: Tusky/Tusky
2024-05-10 13:54:16 +00:00
fin-w 0cc63d931e Translated using Weblate (Welsh)
Currently translated at 100.0% (641 of 641 strings)

Co-authored-by: fin-w <fin-w@tutanota.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/cy/
Translation: Tusky/Tusky
2024-05-10 13:54:16 +00:00
Stavros aad1431075 Translated using Weblate (Greek)
Currently translated at 26.6% (171 of 641 strings)

Co-authored-by: Stavros <stavros.daliakopoulos@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/el/
Translation: Tusky/Tusky
2024-05-10 13:54:16 +00:00
Ümit Solmaz f3f26091be Translated using Weblate (Turkish)
Currently translated at 100.0% (641 of 641 strings)

Co-authored-by: Ümit Solmaz <usnotv@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/tr/
Translation: Tusky/Tusky
2024-05-10 13:54:16 +00:00
Quentí 81ae9e612b Translated using Weblate (Occitan)
Currently translated at 97.8% (627 of 641 strings)

Co-authored-by: Quentí <quentinantonin@free.fr>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/oc/
Translation: Tusky/Tusky
2024-05-10 13:54:16 +00:00
Danial Behzadi 6568fd6748 Translated using Weblate (Persian)
Currently translated at 100.0% (641 of 641 strings)

Co-authored-by: Danial Behzadi <dani.behzi@ubuntu.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/fa/
Translation: Tusky/Tusky
2024-05-10 13:54:16 +00:00
Hồ Nhất Duy 86115375a3 Translated using Weblate (Vietnamese)
Currently translated at 100.0% (641 of 641 strings)

Translated using Weblate (Vietnamese)

Currently translated at 100.0% (639 of 639 strings)

Co-authored-by: Hồ Nhất Duy <mastoduy@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/vi/
Translation: Tusky/Tusky
2024-05-10 13:54:16 +00:00
Christophe Beyls dc4ca06551
Replace Dagger-Android with Hilt and remove Kapt (#4423)
Hilt is an annotation processor built on top of Dagger which allows to
remove all the Android dependency injection boilerplate code (currently
around 900 lines) by writing it for us.

Hilt can use KSP instead of Kapt so Kapt can be completely removed from
the project. Kapt is slow, deprecated and has a few compatibility
issues. Removing Kapt will improve build times since no Java stubs have
to be generated for Kotlin classes anymore (Note that KSP also processes
annotations in Java classes so it can completely replace Kapt).

- Remove all modules related to manual dependency injection
configuration.
- Rename `AppModule` to `StorageModule` since it now only contains
configuration to retrieve the DataBase and SharedPreferences.
- Annotate all entry points (Activities, Fragments, BroadcastReceivers
and Services) with `@AndroidEntryPoint`.
- Annotate all injected ViewModels with `@HiltViewModel` and replace the
custom ViewModel Factory with the default one (which integrates with the
one generated by Hilt).
- Add a public field to allow overriding the default
ViewModelProvider.Factory in `BaseActivity` in tests.
- Annotate tested Activities with `@OptionalInject` since Activity tests
currently rely on the Activities not being injected automatically.
- Annotate injected `Context` arguments with `@ApplicationContext`. Hilt
provides the `Context` binding automatically but requires to specify if
the Application or Activity Context is wanted.
- Add WorkManager Hilt integration so all Workers are injected by Hilt
automatically using `HiltWorkerFactory`.
- Lazily initialize WorkManager in `TuskyApplication`.
- Remove Kapt and Kapt workarounds.
- ~~Remove toolchain configuration for Java 21. Toolchains force the
Java bytecode to match the JDK version used to build the project, and
apparently Hilt doesn't run inside the toolchain so cannot process the
source code if the JDK version of the toolchain is higher than the JDK
used to run Gradle. [And configuring a toolchain for an older Java
version causes other
issues](https://jakewharton.com/gradle-toolchains-are-rarely-a-good-idea/).
**Removing toolchains configuration doesn't prevent the project from
being built using JDK 21** or more recent versions but allows to build
the project using older JDKs as well.~~
Added a fix to allow Hilt to properly use the JDK toolchain.
- ~~Set the Java and Kotlin bytecode target to Java 17. The standard
bytecode target for Android projects is usually Java 8 or 11 (any higher
version doesn't provide any benefit but may cause compatibility issues).
However, since the app currently uses a library built against Java 17
bytecode (`networkresult-calladapter`), it needs to target at least Java
17 bytecode as well.~~
- Update the Dagger 2 URL in the licenses screen. Hilt is part of Dagger
2 so the label wasn't changed.
2024-05-10 15:55:07 +02:00
Weblate c1fe58c48c
Translations update from Weblate (#4420)
Translations update from [Weblate](https://weblate.tusky.app) for
[Tusky/Tusky
description](https://weblate.tusky.app/projects/tusky/tusky-app/).



Current translation status:

![Weblate translation
status](https://weblate.tusky.app/widget/tusky/tusky-app/horizontal-auto.svg)

---------

Co-authored-by: Conny Duck <git@connyduck.at>
Co-authored-by: Danial Behzadi <dani.behzi@ubuntu.com>
2024-05-10 15:17:40 +02:00
UlrichKu b60e111144
3477 tweak colors for contrast (#3921)
Fixes: #3477

This tweaks two colors: 
* for the dark theme a new slightly darker (timeline) background is
used.
* for the light theme a darker shade of blue is used as highlight color
(`colorPrimary` and `colorSecondary`)

Additional change:
* Use green and red more consistent: use existing colors for the diff
display; move the new light variants to colors.xml like all colors
2024-05-10 14:39:08 +02:00
Christophe Beyls 84fda7bade
Re-enable options menu in NotificationsFragment (#4419)
The menu doesn't show up anymore after merging #4026.
I assume this was unintentional since the Fragment still implements
`MenuProvider`.
2024-05-10 14:26:29 +02:00
Christophe Beyls d1518956e1
Add backwards compatible implementation of overrideActivityTransition() (#4408)
This pull request adds `overrideActivityTransitionCompat()`, a
backwards-compatible version of `Activity.overrideActivityTransition()`
to be called in `Activity.onCreate()` in all Android versions.

This avoids duplicating the transition logic in different places of the
app to support older Android versions (in the activity launching code,
in `Activity.onCreate()` or in `Activity.finish()`).

- On API 34+, the implementation simply delegates to
`Activity.overrideActivityTransition()`.
- On API < 34, the implementation calls
`Activity.overridePendingTransition()` either immediately (opening
transition) or schedules it to be called later when the Activity is
finishing (closing transition).
- Rename `ActivityExensions.kt` to `ActivityExtensions.kt` (fix typo).
2024-05-10 13:59:35 +02:00
Conny Duck 0028ab79c3
Merge branch 'main' into develop
# Conflicts:
#	app/src/main/java/com/keylesspalace/tusky/components/notifications/ReportNotificationViewHolder.kt
2024-05-10 13:32:52 +02:00
Conny Duck bf9be47f0f
Release 121 2024-05-10 13:31:40 +02:00
Konrad Pozniak f2d7de0144
fix crash in AccountListFragment (#4430)
Steps to reproduce: When viewing an account list, very quickly rotate
the screen multiple times. I found this easier to do with an emulator,
just spam the rotation buttons.
```
java.lang.IllegalStateException: Fragment AccountListFragment{50bbc6c} (8a3e6922-e855-45a7-8a49-c9d16e21e438) did not return a View from onCreateView() or this was called before onCreateView().
	at androidx.fragment.app.Fragment.requireView(Fragment.java:2063)
	at com.keylesspalace.tusky.util.ViewLifecycleLazy.getValue(ViewBindingExtensions.kt:32)
	at com.keylesspalace.tusky.components.accountlist.AccountListFragment.getBinding(AccountListFragment.kt:75)
	at com.keylesspalace.tusky.components.accountlist.AccountListFragment.onFetchAccountsFailure(AccountListFragment.kt:390)
	at com.keylesspalace.tusky.components.accountlist.AccountListFragment.access$onFetchAccountsFailure(AccountListFragment.kt:63)
	at com.keylesspalace.tusky.components.accountlist.AccountListFragment$fetchAccounts$2.invokeSuspend(AccountListFragment.kt:333)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:230)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7872)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@260dcb1, Dispatchers.Main.immediate]
```
2024-05-10 12:57:54 +02:00
Konrad Pozniak 5137bbfade
fix another crash in ShareShortcutHelper (#4431)
Glide sometimes calls the callback more than once (for the placeholder,
then for the actual image), but a coroutine can only resume once.

```
Exception java.lang.IllegalStateException:
  at kotlinx.coroutines.CancellableContinuationImpl.alreadyResumedError (CancellableContinuationImpl.kt:555)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl (CancellableContinuationImpl.kt:520)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default (CancellableContinuationImpl.kt:493)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeWith (CancellableContinuationImpl.kt:364)
  at com.keylesspalace.tusky.util.GlideExtensionsKt$submitAsync$2$target$1.onResourceReady (GlideExtensions.kt:39)
  at com.bumptech.glide.request.SingleRequest.onResourceReady (SingleRequest.java:650)
  at com.bumptech.glide.request.SingleRequest.onResourceReady (SingleRequest.java:596)
  at com.bumptech.glide.request.SingleRequest.begin (SingleRequest.java:243)
  at com.bumptech.glide.manager.RequestTracker.resumeRequests (RequestTracker.java:115)
  at com.bumptech.glide.RequestManager.resumeRequests (RequestManager.java:339)
  at com.bumptech.glide.RequestManager.onStart (RequestManager.java:364)
  at com.bumptech.glide.manager.ApplicationLifecycle.addListener (ApplicationLifecycle.java:15)
  at com.bumptech.glide.RequestManager$1.run (RequestManager.java:84)
  at android.os.Handler.handleCallback (Handler.java:958)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:230)
  at android.os.Looper.loop (Looper.java:319)
  at android.app.ActivityThread.main (ActivityThread.java:8893)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:608)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)
```

While removing the placeholder fixes the problem here, we should
probably put some safeguards into `submitAsync` so that this can't
happen again elsewhere. Any ideas how to do that, @cbeyls?
2024-05-10 12:57:44 +02:00
Konrad Pozniak f483cf7f29
don't load custom emojis in their full size (#4429)
This should save quite some memory, but most importantly it gets rid of
this crash:

```
java.lang.RuntimeException: Canvas: trying to draw too large(121969936bytes) bitmap.
           at android.graphics.RecordingCanvas.throwIfCannotDraw(RecordingCanvas.java:266)
           at android.graphics.BaseRecordingCanvas.drawBitmap(BaseRecordingCanvas.java:94)
           at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:549)
           at com.keylesspalace.tusky.util.EmojiSpan.draw(CustomEmojiHelper.kt:131)
           ...
```
2024-05-10 12:57:27 +02:00
Konrad Pozniak ba575dbfc6
make Status.filtered nullable to make some weird api implementations work again (#4426)
closes https://github.com/tuskyapp/Tusky/issues/4424
2024-05-10 12:52:42 +02:00
Konrad Pozniak dc4fd8f1d0
add default value to Translation.mediaAttachments to fix translation on some servers (#4422)
see https://github.com/tuskyapp/Tusky/pull/4307#issuecomment-2093827027
2024-05-10 12:35:50 +02:00
Konrad Pozniak 401ab6d453
fix crash in AccountListFragment (#4430)
Steps to reproduce: When viewing an account list, very quickly rotate
the screen multiple times. I found this easier to do with an emulator,
just spam the rotation buttons.
```
java.lang.IllegalStateException: Fragment AccountListFragment{50bbc6c} (8a3e6922-e855-45a7-8a49-c9d16e21e438) did not return a View from onCreateView() or this was called before onCreateView().
	at androidx.fragment.app.Fragment.requireView(Fragment.java:2063)
	at com.keylesspalace.tusky.util.ViewLifecycleLazy.getValue(ViewBindingExtensions.kt:32)
	at com.keylesspalace.tusky.components.accountlist.AccountListFragment.getBinding(AccountListFragment.kt:75)
	at com.keylesspalace.tusky.components.accountlist.AccountListFragment.onFetchAccountsFailure(AccountListFragment.kt:390)
	at com.keylesspalace.tusky.components.accountlist.AccountListFragment.access$onFetchAccountsFailure(AccountListFragment.kt:63)
	at com.keylesspalace.tusky.components.accountlist.AccountListFragment$fetchAccounts$2.invokeSuspend(AccountListFragment.kt:333)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:230)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7872)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@260dcb1, Dispatchers.Main.immediate]
```
2024-05-10 12:33:55 +02:00
Konrad Pozniak 836c71b899
fix another crash in ShareShortcutHelper (#4431)
Glide sometimes calls the callback more than once (for the placeholder,
then for the actual image), but a coroutine can only resume once.

```
Exception java.lang.IllegalStateException:
  at kotlinx.coroutines.CancellableContinuationImpl.alreadyResumedError (CancellableContinuationImpl.kt:555)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl (CancellableContinuationImpl.kt:520)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default (CancellableContinuationImpl.kt:493)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeWith (CancellableContinuationImpl.kt:364)
  at com.keylesspalace.tusky.util.GlideExtensionsKt$submitAsync$2$target$1.onResourceReady (GlideExtensions.kt:39)
  at com.bumptech.glide.request.SingleRequest.onResourceReady (SingleRequest.java:650)
  at com.bumptech.glide.request.SingleRequest.onResourceReady (SingleRequest.java:596)
  at com.bumptech.glide.request.SingleRequest.begin (SingleRequest.java:243)
  at com.bumptech.glide.manager.RequestTracker.resumeRequests (RequestTracker.java:115)
  at com.bumptech.glide.RequestManager.resumeRequests (RequestManager.java:339)
  at com.bumptech.glide.RequestManager.onStart (RequestManager.java:364)
  at com.bumptech.glide.manager.ApplicationLifecycle.addListener (ApplicationLifecycle.java:15)
  at com.bumptech.glide.RequestManager$1.run (RequestManager.java:84)
  at android.os.Handler.handleCallback (Handler.java:958)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:230)
  at android.os.Looper.loop (Looper.java:319)
  at android.app.ActivityThread.main (ActivityThread.java:8893)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:608)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)
```

While removing the placeholder fixes the problem here, we should
probably put some safeguards into `submitAsync` so that this can't
happen again elsewhere. Any ideas how to do that, @cbeyls?
2024-05-10 12:26:03 +02:00
Konrad Pozniak 4dec228926
don't load custom emojis in their full size (#4429)
This should save quite some memory, but most importantly it gets rid of
this crash:

```
java.lang.RuntimeException: Canvas: trying to draw too large(121969936bytes) bitmap.
           at android.graphics.RecordingCanvas.throwIfCannotDraw(RecordingCanvas.java:266)
           at android.graphics.BaseRecordingCanvas.drawBitmap(BaseRecordingCanvas.java:94)
           at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:549)
           at com.keylesspalace.tusky.util.EmojiSpan.draw(CustomEmojiHelper.kt:131)
           ...
```
2024-05-10 12:22:07 +02:00
Konrad Pozniak 3736034952
make Status.filtered nullable to make some weird api implementations work again (#4426)
closes https://github.com/tuskyapp/Tusky/issues/4424
2024-05-10 12:21:48 +02:00
Konrad Pozniak 82817a089b
add default value to Translation.mediaAttachments to fix translation on some servers (#4422)
see https://github.com/tuskyapp/Tusky/pull/4307#issuecomment-2093827027
2024-05-10 12:21:37 +02:00
Christophe Beyls 05c7e7b806
Fix various lint warnings (#4409)
- Remove empty file `ExampleInstrumentedTest.java`.
- Replace deprecated `MigrationTestHelper` constructor call.
- Add reified inline extension methods for `Bundle` and `Intent` to
retrieve `Parcelable` and `Serializable` objects by calling the core
`BundleCompat` and `IntentCompat` methods, to allow shorter syntax and
removing the need to pass the class explicitly.
- Replace deprecated `drawable.setColorFilter()` with simpler
`drawable.setTint()` (uses blend mode `SRC_IN` by default, has the same
effect as `SRC_ATOP` when the source is a color).
- Rename shadowed variables (mostly caught exceptions).
- Remove unnecessary `.orEmpty()` on non-null fields.
- Replace `.size() == 0` with `.isEmpty()`.
- Prevent `NullPointerException` when `account.getDisplayName()` is
`null` in `StatusBaseViewHolder.setDisplayName()`.
- Declare `customEmojis` argument as non-null in
`StatusBaseViewHolder.setDisplayName()` because it calls
`CustomEmojiHelper.emojify()` which now requires it to be non-null.
- Prevent `NullPointerException` when no matching filter is found in
`StatusBaseViewHolder.setupFilterPlaceholder()`.
- Remove deprecated call to `setTargetFragment()` (target fragment is
not used anyway).
- Remove deprecated call to `isUserVisibleHint()` and test if the view
has been destroyed instead.
- Remove some unused imports.
- Remove unnecessary casts.
- Rename arguments to supertype names when a warning is shown.
- Prevent a potential memory leak by clearing the
`toolbarVisibilityDisposable` reference in `onDestroyView()`.
2024-05-05 08:34:41 +02:00
Konrad Pozniak 7dc71a5888
Translations update from Weblate (#4410)
Translations update from [Weblate](https://weblate.tusky.app) for
[Tusky/Tusky](https://weblate.tusky.app/projects/tusky/tusky/).



Current translation status:

![Weblate translation
status](https://weblate.tusky.app/widget/tusky/tusky/horizontal-auto.svg)
2024-05-05 08:33:52 +02:00
Conny Duck 1eca92a349
Merge branch 'main' into develop 2024-05-04 20:55:39 +02:00
Conny Duck 7e9e729331
Release 120 2024-05-04 20:20:36 +02:00
Konrad Pozniak c10f82ffa6
[v25.1] fix crash when glide fails to load avatar in ShareShortcutHelper (#4417)
🙄 
fixes #4416
2024-05-04 18:36:39 +02:00
Konrad Pozniak 056aaa7e0e
[v25.1] fix crash when exceeding max shortcut number (#4415)
I made a mistake in https://github.com/tuskyapp/Tusky/pull/4389 🙄 

With `addDynamicShortcuts` the limit can still be exceeded,
`setDynamicShortcuts` is what we want.

Also, `setLongLived` says:

> Sets if a shortcut would be valid even if it has been
unpublished/invisible by the app (as a dynamic or pinned shortcut). If
it is long lived, it can be cached by various system services even after
it has been unpublished as a dynamic shortcut.

I don't think we want that so I removed it.
2024-05-04 18:36:26 +02:00
Christophe Beyls ad1afdd241
Refactor permissions requests to use ActivityResultContract (#4391)
The app currently uses a custom callback system for requesting
permissions, located in `BaseActivity`.
This code doesn't work when the activity gets re-created before the
permission is granted: the callback will be lost with the Activity and
no action will be performed after the permission is granted.

To avoid these issues while still simplifying the code, Google
recommends to use the ActivityResultContract APIs to request
permissions, which allow to register persistent callbacks. This pull
request removes the legacy API and replaces the calls with
`registerForActivityResult(ActivityResultContracts.RequestPermission())`.

- `ActivityResultContracts.RequestPermission` will check if the
permission is already granted and call the callback synchronously when
possible. So this check doesn't need to be performed anymore.
- In `SearchStatusesFragment` and `SFragment`, the download action to
launch after granting the permission requires an argument (a list of
media URLs). This argument is temporarily stored in a Fragment field and
saved and restored as part of the instance state, so the action can
properly resume after an Activity re-creation.
2024-05-03 21:42:35 +02:00
Hồ Nhất Duy 65995e4492 Translated using Weblate (Vietnamese)
Currently translated at 100.0% (639 of 639 strings)

Co-authored-by: Hồ Nhất Duy <mastoduy@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/vi/
Translation: Tusky/Tusky
2024-05-03 19:42:14 +00:00
Manuel a1367037ba Translated using Weblate (Italian)
Currently translated at 100.0% (639 of 639 strings)

Co-authored-by: Manuel <mannivuwiki@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/it/
Translation: Tusky/Tusky
2024-05-03 19:42:14 +00:00
Anonymous 450fe72983 Translated using Weblate (Latvian)
Currently translated at 84.6% (541 of 639 strings)

Translated using Weblate (Belarusian)

Currently translated at 91.2% (583 of 639 strings)

Translated using Weblate (Portuguese (Portugal))

Currently translated at 98.5% (630 of 639 strings)

Translated using Weblate (Sinhala)

Currently translated at 35.8% (229 of 639 strings)

Translated using Weblate (Galician)

Currently translated at 99.8% (638 of 639 strings)

Translated using Weblate (Bulgarian)

Currently translated at 85.2% (545 of 639 strings)

Translated using Weblate (Kurdish (Central))

Currently translated at 60.0% (384 of 639 strings)

Translated using Weblate (Sanskrit)

Currently translated at 76.5% (489 of 639 strings)

Translated using Weblate (Bengali (Bangladesh))

Currently translated at 63.2% (404 of 639 strings)

Translated using Weblate (Irish)

Currently translated at 62.4% (399 of 639 strings)

Translated using Weblate (Gaelic)

Currently translated at 94.5% (604 of 639 strings)

Translated using Weblate (Vietnamese)

Currently translated at 99.8% (638 of 639 strings)

Translated using Weblate (Thai)

Currently translated at 62.9% (402 of 639 strings)

Translated using Weblate (Ukrainian)

Currently translated at 99.8% (638 of 639 strings)

Translated using Weblate (Kabyle)

Currently translated at 36.7% (235 of 639 strings)

Translated using Weblate (Icelandic)

Currently translated at 99.8% (638 of 639 strings)

Translated using Weblate (Hindi)

Currently translated at 53.2% (340 of 639 strings)

Translated using Weblate (Korean)

Currently translated at 54.6% (349 of 639 strings)

Translated using Weblate (Bengali (India))

Currently translated at 59.4% (380 of 639 strings)

Translated using Weblate (Slovenian)

Currently translated at 58.0% (371 of 639 strings)

Translated using Weblate (Norwegian Bokmål)

Currently translated at 92.6% (592 of 639 strings)

Translated using Weblate (Chinese (zh_MO))

Currently translated at 47.1% (301 of 639 strings)

Translated using Weblate (Chinese (Simplified))

Currently translated at 98.2% (628 of 639 strings)

Translated using Weblate (Turkish)

Currently translated at 99.8% (638 of 639 strings)

Translated using Weblate (Swedish)

Currently translated at 99.8% (638 of 639 strings)

Translated using Weblate (Russian)

Currently translated at 98.5% (630 of 639 strings)

Translated using Weblate (Portuguese (Brazil))

Currently translated at 86.0% (550 of 639 strings)

Translated using Weblate (Polish)

Currently translated at 84.0% (537 of 639 strings)

Translated using Weblate (Occitan)

Currently translated at 97.0% (620 of 639 strings)

Translated using Weblate (Dutch)

Currently translated at 92.8% (593 of 639 strings)

Translated using Weblate (Japanese)

Currently translated at 96.4% (616 of 639 strings)

Translated using Weblate (Italian)

Currently translated at 99.8% (638 of 639 strings)

Translated using Weblate (Hungarian)

Currently translated at 99.6% (637 of 639 strings)

Translated using Weblate (French)

Currently translated at 93.7% (599 of 639 strings)

Translated using Weblate (Persian)

Currently translated at 98.1% (627 of 639 strings)

Translated using Weblate (Basque)

Currently translated at 69.7% (446 of 639 strings)

Translated using Weblate (Spanish)

Currently translated at 91.8% (587 of 639 strings)

Translated using Weblate (Esperanto)

Currently translated at 72.4% (463 of 639 strings)

Translated using Weblate (German)

Currently translated at 99.8% (638 of 639 strings)

Translated using Weblate (Welsh)

Currently translated at 99.8% (638 of 639 strings)

Translated using Weblate (Czech)

Currently translated at 73.5% (470 of 639 strings)

Translated using Weblate (Catalan)

Currently translated at 86.5% (553 of 639 strings)

Translated using Weblate (Arabic)

Currently translated at 91.8% (587 of 639 strings)

Co-authored-by: Anonymous <noreply@weblate.org>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/ar/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/be/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/bg/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/bn_BD/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/bn_IN/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/ca/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/ckb/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/cs/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/cy/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/de/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/eo/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/es/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/eu/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/fa/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/fr/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/ga/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/gd/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/gl/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/hi/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/hu/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/is/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/it/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/ja/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/kab/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/ko/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/lv/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/nb_NO/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/nl/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/oc/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/pl/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/pt_BR/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/pt_PT/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/ru/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/sa/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/si/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/sl/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/sv/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/th/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/tr/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/uk/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/vi/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/zh_Hans/
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/zh_MO/
Translation: Tusky/Tusky
2024-05-03 19:42:14 +00:00
Konrad Pozniak b2c0b18c8e
Refactor notifications to Kotlin & paging (#4026)
This refactors the NotificationsFragment and related classes to Kotlin &
paging.
While trying to preserve as much of the original behavior as possible,
this adds the following improvements as well:
- The "show notifications filter" preference was added again
- The "load more" button now has a background ripple effect when clicked
- The "legal" report category of Mastodon 4.2 is now supported in report
notifications
- Unknown notifications now display "unknown notification type" instead
of an empty line

Other code quality improvements:
- All views from xml layouts are now referenced via ViewBindings
- the classes responsible for showing system notifications were moved to
a new package `systemnotifications` while the classes from this
refactoring are in `notifications`
- the id of the local Tusky account is now called `tuskyAccountId` in
all places I could find

closes https://github.com/tuskyapp/Tusky/issues/3429

---------

Co-authored-by: Zongle Wang <wangzongler@gmail.com>
2024-05-03 18:27:10 +02:00
Konrad Pozniak 71424401a1
switch all string placeholders to positional format (#4387)
closes #3297
2024-05-03 13:22:34 +02:00
Konrad Pozniak d5a01f671c
refactor accountUpdateSource from Call to coroutine (#4386)
It is the last place where we used a Call 🥳
2024-05-03 13:22:04 +02:00
Konrad Pozniak f8a25f896b
upgrade androidx-core to 1.13.0 (#4384)
https://developer.android.com/jetpack/androidx/releases/core#1.13.0
2024-05-03 13:21:49 +02:00
Konrad Pozniak 36d982a359
upgrade androidx-activity to 1.9.0 (#4383)
https://developer.android.com/jetpack/androidx/releases/activity#1.9.0
2024-05-03 13:21:37 +02:00
Christophe Beyls 76c6ec5510
Show tooltips instead of Toasts when long-pressing attachment images (#4382)
- Use `TooltipCompat.setTooltipText()` instead of setting an
`OnLongClickListener` showing a Toast, to show the attachment
description. This method will display native tooltips on API 26+, and
set an `OnLongClickListener` on older versions to display a special
Toast anchored to the view. In both cases this provides a better user
experience.
- Simplify `Attachment.getFormattedDescription()` by using Kotlin's
`Duration`. Since it's an inline class, no extra memory will be
allocated on the heap. Also, ensure that the calculation of minutes and
hours use the rounded number of seconds instead of the non-rounded one.
2024-05-03 13:21:02 +02:00
Conny Duck e96ca01dec
Release 119 2024-05-03 12:28:45 +02:00
Konrad Pozniak 88fbf33832
fix crash when quickly unfollowing hashtags (#4404)
Steps to reproduce: Quickly unfollow a bunch of hashtags, try clicking
unfollow buttons multiple times. If you are faster than the network, the
app crashes.

```
java.lang.ArrayIndexOutOfBoundsException: length=20; index=-1
       at java.util.ArrayList.remove(ArrayList.java:506)
       at com.keylesspalace.tusky.components.followedtags.FollowedTagsActivity$unfollow$1.invokeSuspend(FollowedTagsActivity.kt:152)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
       at android.os.Handler.handleCallback(Handler.java:942)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at android.app.ActivityThread.main(ActivityThread.java:7872)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
```
2024-05-01 18:43:45 +02:00
Konrad Pozniak b2547c5eef
fix crash in ViewThreadFragment (#4401)
Fragments don't necessarily have the same lifecycle as their views, so
their is a rare race condition when collecting a Flow from the
`lifecycleScope` of the Fragment where the view is already disposed but
the collect lambda is still executed. Accessing the view from such a
lambda can therefore led to a crash.
Collecting from the `viewLifecycleOwner.lifecycleScope` fixes the
problem.

```
Exception java.lang.IllegalStateException:
  at androidx.fragment.app.Fragment.requireView (Fragment.java:2062)
  at com.keylesspalace.tusky.util.ViewLifecycleLazy.getValue (ViewBindingExtensions.kt:32)
  at com.keylesspalace.tusky.components.viewthread.ViewThreadFragment.getBinding (ViewThreadFragment.kt:79)
  at com.keylesspalace.tusky.components.viewthread.ViewThreadFragment.access$getBinding (ViewThreadFragment.kt:67)
  at com.keylesspalace.tusky.components.viewthread.ViewThreadFragment$onViewCreated$3$1.emit (ViewThreadFragment.java:250)
  at com.keylesspalace.tusky.components.viewthread.ViewThreadFragment$onViewCreated$3$1.emit (ViewThreadFragment.java:248)
  at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl (SharedFlow.kt:392)
  at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend (SharedFlow.kt:13)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTaskKt.resume (DispatchedTask.kt:231)
  at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined (DispatchedTask.kt:187)
  at kotlinx.coroutines.DispatchedTaskKt.dispatch (DispatchedTask.kt:159)
  at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume (CancellableContinuationImpl.kt:470)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl (CancellableContinuationImpl.kt:504)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default (CancellableContinuationImpl.kt:493)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeWith (CancellableContinuationImpl.kt:364)
  at kotlinx.coroutines.flow.SharedFlowImpl.tryEmit (SharedFlow.kt:409)
  at kotlinx.coroutines.flow.SharedFlowImpl.emit$suspendImpl (SharedFlow.kt:414)
  at kotlinx.coroutines.flow.SharedFlowImpl.emit (SharedFlow.kt:1)
  at com.keylesspalace.tusky.components.viewthread.ViewThreadViewModel$loadThread$1.invokeSuspend (ViewThreadViewModel.kt:172)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:104)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:210)
  at android.os.Looper.loop (Looper.java:299)
  at android.app.ActivityThread.main (ActivityThread.java:8319)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:556)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1038)
```
2024-04-29 19:52:08 +02:00
Konrad Pozniak 05b78a2a00
add content description for bottom nav menu button (#4400) 2024-04-29 19:51:59 +02:00
Ümit Solmaz 389059da43 Translated using Weblate (Turkish)
Currently translated at 100.0% (639 of 639 strings)

Translated using Weblate (Turkish)

Currently translated at 100.0% (639 of 639 strings)

Co-authored-by: Ümit Solmaz <usnotv@gmail.com>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/tr/
Translation: Tusky/Tusky
2024-04-29 11:07:09 +00:00