Fixed up legacy group banner

This commit is contained in:
SessionHero01 2024-10-28 11:02:23 +11:00
parent ea714a60a2
commit 5cc57fc225
No known key found for this signature in database
3 changed files with 39 additions and 36 deletions

View File

@ -92,8 +92,11 @@ import org.session.libsession.utilities.GroupUtil
import org.session.libsession.utilities.MediaTypes
import org.session.libsession.utilities.StringSubstitutionConstants.APP_NAME_KEY
import org.session.libsession.utilities.StringSubstitutionConstants.CONVERSATION_NAME_KEY
import org.session.libsession.utilities.StringSubstitutionConstants.DATE_KEY
import org.session.libsession.utilities.StringSubstitutionConstants.DATE_TIME_KEY
import org.session.libsession.utilities.StringSubstitutionConstants.GROUP_NAME_KEY
import org.session.libsession.utilities.StringSubstitutionConstants.NAME_KEY
import org.session.libsession.utilities.StringSubstitutionConstants.URL_KEY
import org.session.libsession.utilities.Stub
import org.session.libsession.utilities.TextSecurePreferences
import org.session.libsession.utilities.concurrent.SimpleTask
@ -176,6 +179,7 @@ import org.thoughtcrime.securesms.mms.MediaConstraints
import org.thoughtcrime.securesms.mms.Slide
import org.thoughtcrime.securesms.mms.SlideDeck
import org.thoughtcrime.securesms.mms.VideoSlide
import org.thoughtcrime.securesms.openUrl
import org.thoughtcrime.securesms.permissions.Permissions
import org.thoughtcrime.securesms.reactions.ReactionsDialogFragment
import org.thoughtcrime.securesms.reactions.any.ReactWithAnyEmojiDialogFragment
@ -822,25 +826,38 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
binding.outdatedDisappearingBanner.isVisible = shouldShowLegacy
if (shouldShowLegacy) {
val txt = Phrase.from(applicationContext, R.string.disappearingMessagesLegacy)
val txt = Phrase.from(this, R.string.disappearingMessagesLegacy)
.put(NAME_KEY, legacyRecipient!!.toShortString())
.format()
binding.outdatedBannerTextView.text = txt
binding.outdatedDisappearingBannerTextView.text = txt
}
}
private fun setUpLegacyGroupBanner() {
val shouldDisplayBanner = viewModel.recipient?.isLegacyGroupRecipient ?: return
//TODO groupsv2, URL
val url = "https://getsession.org"
with(binding) {
outdatedGroupBanner.isVisible = shouldDisplayBanner
outdatedGroupBanner.text = Phrase.from(this@ConversationActivityV2, R.string.groupLegacyBanner)
//TODO groupsv2, date
.put(DATE_KEY, "")
.format()
outdatedGroupBanner.setOnClickListener {
showSessionDialog {
title(R.string.urlOpenBrowser)
text(R.string.urlOpenDescription)
text(Phrase.from(this@ConversationActivityV2, R.string.urlOpenDescription)
.put(URL_KEY, url)
.format())
cancelButton()
dangerButton(R.string.open) {
// open the URL (tbc)
try {
openUrl(url)
} catch (e: Exception) {
Log.e(TAG, "Error opening URL", e)
}
}
}
}

View File

@ -16,6 +16,7 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/conversationRecyclerView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintVertical_bias="0"
android:theme="@style/Widget.Session.ActionBar.Flat"
android:background="?colorPrimary"
app:contentInsetStart="0dp">
@ -39,7 +40,7 @@
app:layout_constraintVertical_weight="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@+id/typingIndicatorViewContainer"
app:layout_constraintTop_toBottomOf="@id/toolbar" />
app:layout_constraintTop_toBottomOf="@id/outdatedGroupBanner" />
<org.thoughtcrime.securesms.conversation.v2.components.TypingIndicatorViewContainer
android:focusable="false"
@ -270,38 +271,21 @@
</FrameLayout>
<FrameLayout
<TextView
android:id="@+id/outdatedGroupBanner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/blockedBanner"
android:layout_gravity="center"
app:layout_constraintTop_toBottomOf="@+id/outdatedDisappearingBanner"
android:background="@color/outdated_client_banner_background_color"
android:paddingHorizontal="2dp"
android:paddingVertical="@dimen/very_small_spacing"
android:gravity="center_horizontal"
android:textColor="@color/black"
android:paddingHorizontal="@dimen/medium_spacing"
android:contentDescription="@string/AccessibilityId_outdated_group_banner"
android:visibility="gone">
<TextView
android:id="@+id/outdatedBannerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginVertical="@dimen/very_small_spacing"
android:gravity="center_horizontal"
android:textColor="@color/black"
android:layout_marginHorizontal="@dimen/large_spacing"
android:textSize="@dimen/tiny_font_size"
android:text="@string/groupLegacyBanner"
/>
<ImageView
android:layout_gravity="end|center_vertical"
android:layout_margin="@dimen/small_spacing"
android:layout_width="@dimen/medium_spacing"
android:layout_height="wrap_content"
android:src="@drawable/ic_link_out"/>
</FrameLayout>
android:textSize="@dimen/tiny_font_size"
tools:text="@string/groupLegacyBanner"
app:drawableEndCompat="@drawable/ic_link_out" />
<TextView
android:padding="@dimen/medium_spacing"
@ -312,7 +296,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/large_spacing"
app:layout_constraintTop_toBottomOf="@+id/outdatedDisappearingBanner"
app:layout_constraintTop_toBottomOf="@+id/outdatedGroupBanner"
android:contentDescription="@string/AccessibilityId_control_message"
tools:text="Some Control Message Text"
/>
@ -383,10 +367,11 @@
<androidx.compose.ui.platform.ComposeView
android:id="@+id/dialog_open_url"
tools:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<RelativeLayout
<FrameLayout
android:id="@+id/loader"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -399,10 +384,10 @@
style="@style/SpinKitView.Large.ThreeBounce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:layout_marginTop="8dp"
app:SpinKit_Color="@android:color/white" />
</RelativeLayout>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -11,6 +11,7 @@ object StringSubstitutionConstants {
const val CONVERSATION_NAME_KEY = "conversation_name"
const val COUNT_KEY = "count"
const val DATE_TIME_KEY = "date_time"
const val DATE_KEY = "date"
const val DISAPPEARING_MESSAGES_TYPE_KEY = "disappearing_messages_type"
const val DOWNLOAD_URL_KEY = "session_download_url" // Used to invite people to download Session
const val EMOJI_KEY = "emoji"