Skip to content

Commit

Permalink
Merge branch 'develop' into remove-foojay-resolver-convention
Browse files Browse the repository at this point in the history
  • Loading branch information
connyduck authored Dec 22, 2024
2 parents 9b0b0c7 + 3610b7a commit 38742d9
Show file tree
Hide file tree
Showing 20 changed files with 236 additions and 122 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@

### Significant bug fixes

- fixes a bug where Tusky would drop your draft when switching apps https://github.com/tuskyapp/Tusky/pull/4685
- fixes a bug where Tusky would drop your draft when switching apps https://github.com/tuskyapp/Tusky/pull/4685 https://github.com/tuskyapp/Tusky/pull/4813 https://github.com/tuskyapp/Tusky/pull/4818
- fixes a bug where Tusky would drop media that is being added to a post https://github.com/tuskyapp/Tusky/pull/4662
- fixes a bug that caused the login to fail in some cases https://github.com/tuskyapp/Tusky/pull/4704

## v26.2

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ android {
namespace "com.keylesspalace.tusky"
minSdk 24
targetSdk 34
versionCode 126
versionName "27.0 beta 1"
versionCode 127
versionName "27.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
<activity
android:name=".MainActivity"
android:exported="true"
android:alwaysRetainTaskState="true"
android:maxRecents="1"
android:theme="@style/SplashTheme">

<intent-filter>
Expand Down Expand Up @@ -105,6 +107,7 @@
<activity
android:name=".components.compose.ComposeActivity"
android:theme="@style/TuskyDialogActivityTheme"
android:alwaysRetainTaskState="true"
android:windowSoftInputMode="stateVisible|adjustResize" />
<activity
android:name=".components.viewthread.ViewThreadActivity"
Expand Down
11 changes: 10 additions & 1 deletion app/src/main/java/com/keylesspalace/tusky/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider {
}
super.onCreate(savedInstanceState)

// make sure MainActivity doesn't hide other activities when launcher icon is clicked again
if (!isTaskRoot &&
intent.hasCategory(Intent.CATEGORY_LAUNCHER) &&
intent.action == Intent.ACTION_MAIN
) {
finish()
return
}

// will be redirected to LoginActivity by BaseActivity
activeAccount = accountManager.activeAccount ?: return

Expand Down Expand Up @@ -576,7 +585,6 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider {
}
}
startActivity(composeIntent)
finish()
}

private fun setupDrawer(
Expand Down Expand Up @@ -1000,6 +1008,7 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider {
intent.action = forward.action
intent.putExtras(forward)
}
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
finish()
startActivity(intent)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -843,12 +843,8 @@ class ComposeActivity :
)
)

var oneMediaWithoutDescription = false
for (media in viewModel.media.value) {
if (media.description.isNullOrEmpty()) {
oneMediaWithoutDescription = true
break
}
val oneMediaWithoutDescription = viewModel.media.value.any { media ->
media.description.isNullOrEmpty()
}
binding.descriptionMissingWarningButton.visibility = if (oneMediaWithoutDescription) View.VISIBLE else View.GONE
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ AND
*/
@Query(
"""DELETE FROM NotificationEntity WHERE tuskyAccountId = :tuskyAccountId AND
statusId IN
(SELECT serverId FROM TimelineStatusEntity WHERE tuskyAccountId = :tuskyAccountId AND
(authorServerId == :userId OR accountId == :userId))
AND type != "admin.sign_up" AND type != "admin.report"
(accountId = :userId OR
statusId IN (SELECT serverId FROM TimelineStatusEntity WHERE tuskyAccountId = :tuskyAccountId AND authorServerId = :userId)
)
AND type != "SIGN_UP" AND type != "REPORT"
"""
)
abstract suspend fun removeAllByUser(tuskyAccountId: Long, userId: String)
Expand Down
17 changes: 12 additions & 5 deletions app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,33 @@ fun setClickableText(
trailingHashtagView == null || tags.isNullOrEmpty() -> Pair(spannableContent.length, emptyList())
else -> getTrailingHashtags(spannableContent)
}
var inlineHashtagSpanCount = 0
val inlineHashtags = mutableListOf<CharSequence>()

view.text = spannableContent.apply {
styleQuoteSpans(view)
getSpans(0, endOfContent, URLSpan::class.java).forEach { span ->
if (get(getSpanStart(span)) == '#') {
inlineHashtagSpanCount += 1
val start = getSpanStart(span)
if (get(start) == '#') {
inlineHashtags.add(subSequence(start + 1, getSpanEnd(span)))
}
setClickableText(span, this, mentions, tags, listener)
}
}.subSequence(0, endOfContent).trimEnd()

view.movementMethod = NoTrailingSpaceLinkMovementMethod

val showHashtagBar = (trailingHashtags.isNotEmpty() || inlineHashtagSpanCount != tags?.size)
val showHashtagBar = (trailingHashtags.isNotEmpty() || inlineHashtags.size != tags?.size)
// I don't _love_ setting the visibility here, but the alternative is to duplicate the logic in other places
trailingHashtagView?.visible(showHashtagBar)

if (showHashtagBar) {
trailingHashtagView?.apply { text = buildTrailingHashtagText(tags, trailingHashtags, listener) }
trailingHashtagView?.apply {
text = buildTrailingHashtagText(
tags?.filterNot { tag -> inlineHashtags.any { it.contentEquals(tag.name, ignoreCase = true) } },
trailingHashtags,
listener,
)
}
}
}

Expand Down
10 changes: 5 additions & 5 deletions app/src/main/res/layout/activity_compose.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
android:layout_width="52dp"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:padding="0dp"
android:contentDescription="@string/description_post_language"
android:padding="0dp"
android:textColor="?android:attr/textColorTertiary"
android:textSize="?attr/status_text_large"
android:textStyle="bold"
Expand Down Expand Up @@ -67,10 +67,10 @@
android:layout_gravity="end"
android:contentDescription="@string/hint_media_description_missing"
android:padding="8dp"
app:srcCompat="@drawable/ic_missing_description_24dp"
app:tint="@color/tusky_orange_light"
app:tooltipText="@string/hint_media_description_missing"
android:visibility="invisible" />
app:icon="@drawable/ic_missing_description_24dp"
app:iconTint="@color/tusky_orange_light"
app:tooltipText="@string/hint_media_description_missing" />

</com.google.android.material.appbar.MaterialToolbar>

<androidx.core.widget.NestedScrollView
Expand Down
Loading

0 comments on commit 38742d9

Please sign in to comment.