Skip to content

Commit

Permalink
Merge lastest changes from upstream (#2)
Browse files Browse the repository at this point in the history
* Ensures AbsoluteTimeFormatterTest class is not locale-dependant (tuskyapp#3863)

As tests are run against locale JVM and test does not force
a locale to run, so some tests may fail due to a different result only
due to the locale of the JVM used.

Example here with test `same year formatting` in class
`AbsoluteTimeFormatterTest` line 30 on a French JVM. There may be other
lines to fail with other languages.

Fixes tuskyapp#3859

* Check for empty trending response (tuskyapp#3853)

Fixes tuskyapp#3852

* Update dagger to v2.47 (tuskyapp#3851)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.dagger:dagger](https://togithub.com/google/dagger) |
`2.46.1` -> `2.47` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.google.dagger:dagger/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.google.dagger:dagger/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.google.dagger:dagger/2.46.1/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.google.dagger:dagger/2.46.1/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[com.google.dagger:dagger-compiler](https://togithub.com/google/dagger)
| `2.46.1` -> `2.47` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.google.dagger:dagger-compiler/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.google.dagger:dagger-compiler/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.google.dagger:dagger-compiler/2.46.1/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.google.dagger:dagger-compiler/2.46.1/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[com.google.dagger:dagger-android-support](https://togithub.com/google/dagger)
| `2.46.1` -> `2.47` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.google.dagger:dagger-android-support/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.google.dagger:dagger-android-support/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.google.dagger:dagger-android-support/2.46.1/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.google.dagger:dagger-android-support/2.46.1/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[com.google.dagger:dagger-android-processor](https://togithub.com/google/dagger)
| `2.46.1` -> `2.47` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.google.dagger:dagger-android-processor/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.google.dagger:dagger-android-processor/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.google.dagger:dagger-android-processor/2.46.1/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.google.dagger:dagger-android-processor/2.46.1/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [com.google.dagger:dagger-android](https://togithub.com/google/dagger)
| `2.46.1` -> `2.47` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/com.google.dagger:dagger-android/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.google.dagger:dagger-android/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.google.dagger:dagger-android/2.46.1/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.google.dagger:dagger-android/2.46.1/2.47?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/tuskyapp/Tusky).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi41LjMiLCJ1cGRhdGVkSW5WZXIiOiIzNi44LjExIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Translated using Weblate (Gaelic)

Currently translated at 100.0% (609 of 609 strings)

Co-authored-by: GunChleoc <[email protected]>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/gd/
Translation: Tusky/Tusky

* Translated using Weblate (Welsh)

Currently translated at 100.0% (609 of 609 strings)

Co-authored-by: Rhoslyn Prys <[email protected]>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/cy/
Translation: Tusky/Tusky

* Translated using Weblate (Turkish)

Currently translated at 99.8% (608 of 609 strings)

Co-authored-by: Ümit Solmaz <[email protected]>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/tr/
Translation: Tusky/Tusky

* Translated using Weblate (Galician)

Currently translated at 100.0% (609 of 609 strings)

Co-authored-by: XoseM <[email protected]>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/gl/
Translation: Tusky/Tusky

* Retain text in search view when switching tabs before first search (tuskyapp#3540)

Fixes tuskyapp#3527

* Translated using Weblate (Icelandic)

Currently translated at 100.0% (609 of 609 strings)

Co-authored-by: Sveinn í Felli <[email protected]>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/is/
Translation: Tusky/Tusky

* Update coroutines to v1.7.3 (tuskyapp#3879)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[org.jetbrains.kotlinx:kotlinx-coroutines-test](https://togithub.com/Kotlin/kotlinx.coroutines)
| `1.7.2` -> `1.7.3` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/org.jetbrains.kotlinx:kotlinx-coroutines-test/1.7.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.jetbrains.kotlinx:kotlinx-coroutines-test/1.7.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.jetbrains.kotlinx:kotlinx-coroutines-test/1.7.2/1.7.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.jetbrains.kotlinx:kotlinx-coroutines-test/1.7.2/1.7.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[org.jetbrains.kotlinx:kotlinx-coroutines-rx3](https://togithub.com/Kotlin/kotlinx.coroutines)
| `1.7.2` -> `1.7.3` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/org.jetbrains.kotlinx:kotlinx-coroutines-rx3/1.7.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.jetbrains.kotlinx:kotlinx-coroutines-rx3/1.7.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.jetbrains.kotlinx:kotlinx-coroutines-rx3/1.7.2/1.7.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.jetbrains.kotlinx:kotlinx-coroutines-rx3/1.7.2/1.7.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[org.jetbrains.kotlinx:kotlinx-coroutines-android](https://togithub.com/Kotlin/kotlinx.coroutines)
| `1.7.2` -> `1.7.3` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/org.jetbrains.kotlinx:kotlinx-coroutines-android/1.7.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.jetbrains.kotlinx:kotlinx-coroutines-android/1.7.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.jetbrains.kotlinx:kotlinx-coroutines-android/1.7.2/1.7.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.jetbrains.kotlinx:kotlinx-coroutines-android/1.7.2/1.7.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>Kotlin/kotlinx.coroutines
(org.jetbrains.kotlinx:kotlinx-coroutines-test)</summary>

###
[`v1.7.3`](https://togithub.com/Kotlin/kotlinx.coroutines/blob/HEAD/CHANGES.md#Version-173)

[Compare
Source](https://togithub.com/Kotlin/kotlinx.coroutines/compare/1.7.2...1.7.3)

- Disabled the publication of the multiplatform library metadata for the
old (1.6 and earlier) KMP Gradle plugin
([#&#8203;3809](https://togithub.com/Kotlin/kotlinx.coroutines/issues/3809)).
- Fixed a bug introduced in 1.7.2 that disabled the coroutine debugger
in IDEA
([#&#8203;3822](https://togithub.com/Kotlin/kotlinx.coroutines/issues/3822)).

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/tuskyapp/Tusky).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6ImRldmVsb3AifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Clear listeners, hide icons when appropriate (tuskyapp#3870)

Preferences are shown using view holders.

The previous code did not clear the listeners or hide the icons if
necessary.

The practical upshot of this was that if you had two or more slider
preferences, *and* they were situated more than a screen's height apart,
the viewholder from the first one would get reused.

And if the first one enabled icons then the second one would show them.
And clicking on the second one would also call the listeners for the
first one.

* Enable gradle build cache for Bitrise builds (tuskyapp#3840)

Read/write to the cache for nightly / release builds, read from the
cache for other builds.

* Update dependency androidx.fragment:fragment-ktx to v1.6.1 (tuskyapp#3884)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[androidx.fragment:fragment-ktx](https://developer.android.com/jetpack/androidx/releases/fragment#1.6.1)
([source](https://cs.android.com/androidx/platform/frameworks/support))
| `1.6.0` -> `1.6.1` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/androidx.fragment:fragment-ktx/1.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/androidx.fragment:fragment-ktx/1.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/androidx.fragment:fragment-ktx/1.6.0/1.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/androidx.fragment:fragment-ktx/1.6.0/1.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/tuskyapp/Tusky).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6ImRldmVsb3AifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency androidx.paging:paging-runtime-ktx to v3.2.0 (tuskyapp#3887)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[androidx.paging:paging-runtime-ktx](https://developer.android.com/jetpack/androidx/releases/paging#3.2.0)
([source](https://cs.android.com/androidx/platform/frameworks/support))
| `3.1.1` -> `3.2.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/androidx.paging:paging-runtime-ktx/3.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/androidx.paging:paging-runtime-ktx/3.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/androidx.paging:paging-runtime-ktx/3.1.1/3.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/androidx.paging:paging-runtime-ktx/3.1.1/3.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/tuskyapp/Tusky).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6ImRldmVsb3AifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Show the throwable error message when an upload fails (tuskyapp#3838)

* Use org.gradle.configuration-cache flag (tuskyapp#3792)

Follow up tuskyapp#3528.

https://docs.gradle.org/8.1/userguide/upgrading_version_8.html#configuration_caching_options_renamed

* Cache locked state of connected accounts (tuskyapp#3790)

Small improvement to the behavior on bad/disconnected networks

Fixes tuskyapp#3773

* Translated using Weblate (Ukrainian)

Currently translated at 100.0% (609 of 609 strings)

Co-authored-by: Ihor Hordiichuk <[email protected]>
Translate-URL: https://weblate.tusky.app/projects/tusky/tusky/uk/
Translation: Tusky/Tusky

* Always update the filter display, even when the list is empty (tuskyapp#3880)

Fixes tuskyapp#3839, tuskyapp#3525

---------

Co-authored-by: Conny Duck <[email protected]>
Co-authored-by: Levi Bard <[email protected]>
Co-authored-by: SpaceFox <[email protected]>
Co-authored-by: Konrad Pozniak <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: GunChleoc <[email protected]>
Co-authored-by: Rhoslyn Prys <[email protected]>
Co-authored-by: Ümit Solmaz <[email protected]>
Co-authored-by: XoseM <[email protected]>
Co-authored-by: UlrichKu <[email protected]>
Co-authored-by: Sveinn í Felli <[email protected]>
Co-authored-by: Nik Clayton <[email protected]>
Co-authored-by: Goooler <[email protected]>
Co-authored-by: Ihor Hordiichuk <[email protected]>
  • Loading branch information
15 people authored Jul 28, 2023
1 parent 7b8c543 commit 9b41fee
Show file tree
Hide file tree
Showing 25 changed files with 1,156 additions and 63 deletions.
1,009 changes: 1,009 additions & 0 deletions app/schemas/com.keylesspalace.tusky.db.AppDatabase/52.json

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions app/src/main/java/com/keylesspalace/tusky/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,6 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje

private lateinit var glide: RequestManager

private var accountLocked: Boolean = false

// We need to know if the emoji pack has been changed
private var selectedEmojiPack: String? = null

Expand Down Expand Up @@ -236,7 +234,7 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje
// user clicked a notification, show follow requests for type FOLLOW_REQUEST,
// otherwise show notification tab
if (intent.getStringExtra(NotificationHelper.TYPE) == Notification.Type.FOLLOW_REQUEST.name) {
val intent = AccountListActivity.newIntent(this, AccountListActivity.Type.FOLLOW_REQUESTS, accountLocked = true)
val intent = AccountListActivity.newIntent(this, AccountListActivity.Type.FOLLOW_REQUESTS)
startActivityWithSlideInAnimation(intent)
} else {
showNotificationTab = true
Expand Down Expand Up @@ -538,7 +536,7 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje
nameRes = R.string.action_view_follow_requests
iconicsIcon = GoogleMaterial.Icon.gmd_person_add
onClick = {
val intent = AccountListActivity.newIntent(context, AccountListActivity.Type.FOLLOW_REQUESTS, accountLocked = accountLocked)
val intent = AccountListActivity.newIntent(context, AccountListActivity.Type.FOLLOW_REQUESTS)
startActivityWithSlideInAnimation(intent)
}
},
Expand Down Expand Up @@ -872,8 +870,6 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje
disableAllNotifications(this, accountManager)
}

accountLocked = me.locked

updateProfiles()
updateShortcut(this, accountManager.activeAccount!!)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class AccountListActivity : BottomSheetActivity(), HasAndroidInjector {

val type = intent.getSerializableExtra(EXTRA_TYPE) as Type
val id: String? = intent.getStringExtra(EXTRA_ID)
val accountLocked: Boolean = intent.getBooleanExtra(EXTRA_ACCOUNT_LOCKED, false)

setSupportActionBar(binding.includedToolbar.toolbar)
supportActionBar?.apply {
Expand All @@ -66,7 +65,7 @@ class AccountListActivity : BottomSheetActivity(), HasAndroidInjector {
}

supportFragmentManager.commit {
replace(R.id.fragment_container, AccountListFragment.newInstance(type, id, accountLocked))
replace(R.id.fragment_container, AccountListFragment.newInstance(type, id))
}
}

Expand All @@ -75,13 +74,11 @@ class AccountListActivity : BottomSheetActivity(), HasAndroidInjector {
companion object {
private const val EXTRA_TYPE = "type"
private const val EXTRA_ID = "id"
private const val EXTRA_ACCOUNT_LOCKED = "acc_locked"

fun newIntent(context: Context, type: Type, id: String? = null, accountLocked: Boolean = false): Intent {
fun newIntent(context: Context, type: Type, id: String? = null): Intent {
return Intent(context, AccountListActivity::class.java).apply {
putExtra(EXTRA_TYPE, type)
putExtra(EXTRA_ID, id)
putExtra(EXTRA_ACCOUNT_LOCKED, accountLocked)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,15 @@ class AccountListFragment :
val animateEmojis = pm.getBoolean(PrefKeys.ANIMATE_CUSTOM_EMOJIS, false)
val showBotOverlay = pm.getBoolean(PrefKeys.SHOW_BOT_OVERLAY, true)

val activeAccount = accountManager.activeAccount!!

adapter = when (type) {
Type.BLOCKS -> BlocksAdapter(this, animateAvatar, animateEmojis, showBotOverlay)
Type.MUTES -> MutesAdapter(this, animateAvatar, animateEmojis, showBotOverlay)
Type.FOLLOW_REQUESTS -> {
val headerAdapter = FollowRequestsHeaderAdapter(
instanceName = accountManager.activeAccount!!.domain,
accountLocked = arguments?.getBoolean(ARG_ACCOUNT_LOCKED) == true
instanceName = activeAccount.domain,
accountLocked = activeAccount.locked
)
val followRequestsAdapter = FollowRequestsAdapter(this, this, animateAvatar, animateEmojis, showBotOverlay)
binding.recyclerView.adapter = ConcatAdapter(headerAdapter, followRequestsAdapter)
Expand Down Expand Up @@ -404,14 +406,12 @@ class AccountListFragment :
private const val TAG = "AccountList" // logging tag
private const val ARG_TYPE = "type"
private const val ARG_ID = "id"
private const val ARG_ACCOUNT_LOCKED = "acc_locked"

fun newInstance(type: Type, id: String? = null, accountLocked: Boolean = false): AccountListFragment {
fun newInstance(type: Type, id: String? = null): AccountListFragment {
return AccountListFragment().apply {
arguments = Bundle(3).apply {
putSerializable(ARG_TYPE, type)
putString(ARG_ID, id)
putBoolean(ARG_ACCOUNT_LOCKED, accountLocked)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,12 @@ class ComposeActivity :
if (throwable is UploadServerError) {
displayTransientMessage(throwable.errorMessage)
} else {
displayTransientMessage(R.string.error_media_upload_sending)
displayTransientMessage(
getString(
R.string.error_media_upload_sending_fmt,
throwable.message
)
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class FiltersActivity : BaseActivity(), FiltersListener {
binding.messageView.show()
}
FiltersViewModel.LoadingState.LOADED -> {
binding.filtersList.adapter = FiltersAdapter(this@FiltersActivity, state.filters)
if (state.filters.isEmpty()) {
binding.messageView.setup(
R.drawable.elephant_friend_empty,
Expand All @@ -81,7 +82,6 @@ class FiltersActivity : BaseActivity(), FiltersListener {
binding.messageView.show()
} else {
binding.messageView.hide()
binding.filtersList.adapter = FiltersAdapter(this@FiltersActivity, state.filters)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import dagger.android.DispatchingAndroidInjector
import dagger.android.HasAndroidInjector
import javax.inject.Inject

class SearchActivity : BottomSheetActivity(), HasAndroidInjector, MenuProvider {
class SearchActivity : BottomSheetActivity(), HasAndroidInjector, MenuProvider, SearchView.OnQueryTextListener {
@Inject
lateinit var androidInjector: DispatchingAndroidInjector<Any>

Expand Down Expand Up @@ -91,8 +91,6 @@ class SearchActivity : BottomSheetActivity(), HasAndroidInjector, MenuProvider {
searchViewMenuItem.expandActionView()
val searchView = searchViewMenuItem.actionView as SearchView
setupSearchView(searchView)

searchView.setQuery(viewModel.currentQuery, false)
}

override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
Expand Down Expand Up @@ -150,9 +148,23 @@ class SearchActivity : BottomSheetActivity(), HasAndroidInjector, MenuProvider {
val pxBuffer = ((48 * 2) * resources.displayMetrics.density).toInt()
searchView.maxWidth = pxScreenWidth - pxBuffer

// Keep text that was entered also when switching to a different tab (before the search is executed)
searchView.setOnQueryTextListener(this)
searchView.setQuery(viewModel.currentSearchFieldContent ?: "", false)

searchView.requestFocus()
}

override fun onQueryTextSubmit(query: String?): Boolean {
return false
}

override fun onQueryTextChange(newText: String?): Boolean {
viewModel.currentSearchFieldContent = newText

return false
}

override fun androidInjector() = androidInjector

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class SearchViewModel @Inject constructor(
) : ViewModel() {

var currentQuery: String = ""
var currentSearchFieldContent: String? = null

val activeAccount: AccountEntity?
get() = accountManager.activeAccount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,26 @@ class TrendingViewModel @Inject constructor(

mastodonApi.trendingTags().fold(
{ tagResponse ->
val homeFilters = deferredFilters.await().getOrNull()?.filter { filter ->
filter.context.contains(Filter.Kind.HOME.kind)
}
val tags = tagResponse
.filter { tag ->
homeFilters?.none { filter ->
filter.keywords.any { keyword -> keyword.keyword.equals(tag.name, ignoreCase = true) }
} ?: false
}
.sortedByDescending { tag -> tag.history.sumOf { it.uses.toLongOrNull() ?: 0 } }
.toViewData()

val firstTag = tagResponse.first()
val header = TrendingViewData.Header(firstTag.start(), firstTag.end())
val firstTag = tagResponse.firstOrNull()
_uiState.value = if (firstTag == null) {
TrendingUiState(emptyList(), LoadingState.LOADED)
} else {
val homeFilters = deferredFilters.await().getOrNull()?.filter { filter ->
filter.context.contains(Filter.Kind.HOME.kind)
}
val tags = tagResponse
.filter { tag ->
homeFilters?.none { filter ->
filter.keywords.any { keyword -> keyword.keyword.equals(tag.name, ignoreCase = true) }
} ?: false
}
.sortedByDescending { tag -> tag.history.sumOf { it.uses.toLongOrNull() ?: 0 } }
.toViewData()

_uiState.value = TrendingUiState(listOf(header) + tags, LoadingState.LOADED)
val header = TrendingViewData.Header(firstTag.start(), firstTag.end())
TrendingUiState(listOf(header) + tags, LoadingState.LOADED)
}
},
{ error ->
Log.w(TAG, "failed loading trending tags", error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ data class AccountEntity(
* ID of the status at the top of the visible list in the home timeline when the
* user navigated away.
*/
var lastVisibleHomeTimelineStatusId: String? = null
var lastVisibleHomeTimelineStatusId: String? = null,

/** true if the connected Mastodon account is locked (has to manually approve all follow requests **/
@ColumnInfo(defaultValue = "0")
var locked: Boolean = false
) {

val identifier: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ class AccountManager @Inject constructor(db: AppDatabase) {
it.defaultPostLanguage = account.source?.language.orEmpty()
it.defaultMediaSensitivity = account.source?.sensitive ?: false
it.emojis = account.emojis.orEmpty()
it.locked = account.locked

Log.d(TAG, "updateActiveAccount: saving account with id " + it.id)
accountDao.insertOrReplace(it)
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/com/keylesspalace/tusky/db/AppDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@
TimelineAccountEntity.class,
ConversationEntity.class
},
version = 51,
version = 52,
autoMigrations = {
@AutoMigration(from = 48, to = 49),
@AutoMigration(from = 49, to = 50, spec = AppDatabase.MIGRATION_49_50.class),
@AutoMigration(from = 50, to = 51)
@AutoMigration(from = 50, to = 51),
@AutoMigration(from = 51, to = 52)
}
)
public abstract class AppDatabase extends RoomDatabase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import android.content.Context
import android.content.res.TypedArray
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import android.view.View.VISIBLE
import androidx.appcompat.content.res.AppCompatResources
import androidx.preference.Preference
import androidx.preference.PreferenceViewHolder
import com.google.android.material.slider.LabelFormatter.LABEL_GONE
import com.google.android.material.slider.Slider
import com.keylesspalace.tusky.R
import com.keylesspalace.tusky.databinding.PrefSliderBinding
import com.keylesspalace.tusky.util.hide
import com.keylesspalace.tusky.util.show
import java.lang.Float.max
import java.lang.Float.min

Expand Down Expand Up @@ -130,6 +131,8 @@ class SliderPreference @JvmOverloads constructor(

binding.root.isClickable = false

binding.slider.clearOnChangeListeners()
binding.slider.clearOnSliderTouchListeners()
binding.slider.addOnChangeListener(this)
binding.slider.addOnSliderTouchListener(this)
binding.slider.value = value // sliderValue
Expand All @@ -141,24 +144,24 @@ class SliderPreference @JvmOverloads constructor(
binding.slider.labelBehavior = LABEL_GONE
binding.slider.isEnabled = isEnabled

binding.summary.visibility = VISIBLE
binding.summary.show()
binding.summary.text = formatter(value)

decrementIcon?.let { icon ->
binding.decrement.icon = icon
binding.decrement.visibility = VISIBLE
binding.decrement.show()
binding.decrement.setOnClickListener {
value -= stepSize
}
}
} ?: binding.decrement.hide()

incrementIcon?.let { icon ->
binding.increment.icon = icon
binding.increment.visibility = VISIBLE
binding.increment.show()
binding.increment.setOnClickListener {
value += stepSize
}
}
} ?: binding.increment.hide()
}

override fun onValueChange(slider: Slider, value: Float, fromUser: Boolean) {
Expand Down
14 changes: 12 additions & 2 deletions app/src/main/res/values-cy/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<string name="action_compose">Creu</string>
<string name="action_login">Mewngofnodi â Tusky</string>
<string name="action_logout">Allgofnodi</string>
<string name="action_logout_confirm">Ydych chi\'n siŵr eich bod am allgofnodi o\'r cyfrif %1$s?</string>
<string name="action_logout_confirm">Ydych chi\'n siŵr eich bod am allgofnodi o\'r cyfrif %1$s\? Bydd hyn yn dileu\'r holl ddata lleol, gan gynnwys drafftiau a chyfeiriadau.</string>
<string name="action_follow">Dilyn</string>
<string name="action_unfollow">Dad-ddilyn</string>
<string name="action_block">Rhwystro</string>
Expand Down Expand Up @@ -712,4 +712,14 @@
\n
\nI archwilio cyfrifon gallwch un ai eu darganfod o fewn un o\'r llinellau amser eraill. Er enghraifft, mae llinell amser eich enghraifft chi [iconics gmd_group]. Neu gallwch eu chwilio yn ôl eu henw [iconics gmd_search]; er enghraifft, chwilio am Tusky i ganfod ein cyfrif Mastodon.</string>
<string name="pref_title_show_stat_inline">Dangos ystadegau postiadau mewn llinell amser</string>
</resources>
<string name="pref_ui_text_size">Maint testun rhyngwyneb</string>
<string name="notification_listenable_worker_name">Gweithgaredd cefndirol</string>
<string name="notification_listenable_worker_description">Hysbysiadau pan fydd Tusky\'n gweithio\'n y cefndir</string>
<string name="notification_notification_worker">Yn estyn hysbysiadau…</string>
<string name="notification_prune_cache">Cynnal a chadw\'r storfan…</string>
<string name="error_missing_edits">Mae\'r gweinydd yn gwybod fod y postiad wedi ei olygu, ond nid oes ganddo gopi o\'r golygiadau, felly nid oes modd eu dangos i chi.
\n
\nHwn yw <a href="https://github.com/mastodon/mastodon/issues/25398">mater Mastodon #25398</a>.</string>
<string name="load_newest_notifications">Llwytho\'r hysbys diweddaraf</string>
<string name="compose_delete_draft">Dileu\'r drafft\?</string>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values-gd/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@
<string name="action_view_mutes">Cleachdaichean mùchte</string>
<string name="action_view_bookmarks">Comharran-lìn</string>
<string name="action_view_profile">Pròifil</string>
<string name="action_logout_confirm">A bheil thu cinnteach gu bheil thu airson clàradh a-mach às a’ chunntas %1$s\?</string>
<string name="action_logout_confirm">A bheil thu cinnteach gu bheil thu airson clàradh a-mach à %1$s\? Thèid gach dàta ionadail a’ chunntais a sguabadh às, a’ gabhail a-staigh nan dreachdan is roghainnean.</string>
<string name="action_unfavourite">Thoir air falbh o na h-annsachdan</string>
<string name="action_bookmark">Cuir ris na comharran-lìn</string>
<string name="action_favourite">Cuir ris na h-annsachdan</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-gl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<string name="action_block">Bloquear</string>
<string name="action_unfollow">Deixar de seguir</string>
<string name="action_follow">Seguir</string>
<string name="action_logout_confirm">Tes a certeza de que queres pechar sesión da conta %1$s\?</string>
<string name="action_logout_confirm">Tes a certeza de querer pechar a sesión %1$s\? Isto eliminará todos os datos locais da conta, incluíndo borradores e preferencias.</string>
<string name="action_logout">Pechar sesión</string>
<string name="action_login">Acceder con Tusky</string>
<string name="action_compose">Redactar</string>
Expand Down
Loading

0 comments on commit 9b41fee

Please sign in to comment.