Skip to content

Commit

Permalink
Merge pull request #1682 from oxen-io/release/1.20.1
Browse files Browse the repository at this point in the history
Release/1.20.1
  • Loading branch information
ThomasSession authored Oct 7, 2024
2 parents 56c4876 + b595475 commit cc67ea1
Show file tree
Hide file tree
Showing 37 changed files with 306 additions and 206 deletions.
59 changes: 44 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ configurations.forEach {
it.exclude module: "commons-logging"
}

def canonicalVersionCode = 382
def canonicalVersionName = "1.20.0"
def canonicalVersionCode = 383
def canonicalVersionName = "1.20.1"

def postFixSize = 10
def abiPostFix = ['armeabi-v7a' : 1,
Expand Down Expand Up @@ -56,7 +56,7 @@ android {

splits {
abi {
enable true
enable !project.hasProperty('huawei') // huawei builds do not need the split variants
reset()
include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
universalApk true
Expand All @@ -68,7 +68,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion '1.5.14'
kotlinCompilerExtensionVersion '1.5.15'
}

defaultConfig {
Expand Down Expand Up @@ -118,6 +118,25 @@ android {
}
}

signingConfigs {
play {
if (project.hasProperty('SESSION_STORE_FILE')) {
storeFile file(SESSION_STORE_FILE)
storePassword SESSION_STORE_PASSWORD
keyAlias SESSION_KEY_ALIAS
keyPassword SESSION_KEY_PASSWORD
}
}
huawei {
if (project.hasProperty('SESSION_HUAWEI_STORE_FILE')) {
storeFile file(SESSION_HUAWEI_STORE_FILE)
storePassword SESSION_HUAWEI_STORE_PASSWORD
keyAlias SESSION_HUAWEI_KEY_ALIAS
keyPassword SESSION_HUAWEI_KEY_PASSWORD
}
}
}

flavorDimensions "distribution"
productFlavors {
play {
Expand All @@ -129,6 +148,7 @@ android {
buildConfigField "org.session.libsession.utilities.Device", "DEVICE", "org.session.libsession.utilities.Device.ANDROID"
buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl"
buildConfigField 'String', 'PUSH_KEY_SUFFIX', '\"\"'
signingConfig signingConfigs.play
}

huawei {
Expand All @@ -138,6 +158,7 @@ android {
buildConfigField "org.session.libsession.utilities.Device", "DEVICE", "org.session.libsession.utilities.Device.HUAWEI"
buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl"
buildConfigField 'String', 'PUSH_KEY_SUFFIX', '\"_HUAWEI\"'
signingConfig signingConfigs.huawei
}

website {
Expand All @@ -150,13 +171,15 @@ android {
}
}

applicationVariants.forEach { variant ->
applicationVariants.configureEach { variant ->
variant.outputs.each { output ->
def abiName = output.getFilter("ABI") ?: 'universal'
def postFix = abiPostFix.get(abiName, 0)

def flavour = (variant.flavorName == 'huawei') ? "-huawei" : ""

if (postFix >= postFixSize) throw new AssertionError("postFix is too large")
output.outputFileName = output.outputFileName = "session-${variant.versionName}-${abiName}.apk"
output.outputFileName = output.outputFileName = "session-${variant.versionName}-${abiName}${flavour}.apk"
output.versionCodeOverride = canonicalVersionCode * postFixSize + postFix
}
}
Expand Down Expand Up @@ -353,15 +376,21 @@ dependencies {
testImplementation 'org.conscrypt:conscrypt-openjdk-uber:2.5.2' // For Robolectric
testImplementation 'app.cash.turbine:turbine:1.1.0'

implementation 'com.github.bumptech.glide:compose:1.0.0-alpha.5'
implementation "androidx.compose.ui:ui:$composeVersion"
implementation "androidx.compose.animation:animation:$composeVersion"
implementation "androidx.compose.ui:ui-tooling:$composeVersion"
implementation "androidx.compose.runtime:runtime-livedata:$composeVersion"
implementation "androidx.compose.foundation:foundation-layout:$composeVersion"
implementation "androidx.compose.material3:material3:1.2.1"
androidTestImplementation "androidx.compose.ui:ui-test-junit4-android:$composeVersion"
debugImplementation "androidx.compose.ui:ui-test-manifest:$composeVersion"
// compose
Dependency composeBom = platform('androidx.compose:compose-bom:2024.09.01')
implementation composeBom
testImplementation composeBom
androidTestImplementation composeBom

implementation "androidx.compose.ui:ui"
implementation "androidx.compose.animation:animation"
implementation "androidx.compose.ui:ui-tooling"
implementation "androidx.compose.runtime:runtime-livedata"
implementation "androidx.compose.foundation:foundation-layout"
implementation "androidx.compose.material3:material3"

androidTestImplementation "androidx.compose.ui:ui-test-junit4-android"
debugImplementation "androidx.compose.ui:ui-test-manifest"

implementation "com.google.accompanist:accompanist-themeadapter-appcompat:0.33.1-alpha"
implementation "com.google.accompanist:accompanist-permissions:0.36.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ class SessionDialogBuilder(val context: Context) {

// Main title entry point
fun title(text: String?) {
text(text, R.style.TextAppearance_Session_Dialog_Title) { setPadding(dp20, 0, dp20, 0) }
text(
text = text,
qaTag = context.getString(R.string.AccessibilityId_modalTitle),
style = R.style.TextAppearance_Session_Dialog_Title) { setPadding(dp20, 0, dp20, 0) }
}

// Convenience assessor for title that takes a string resource
Expand All @@ -74,18 +77,24 @@ class SessionDialogBuilder(val context: Context) {
fun text(@StringRes id: Int, style: Int? = null) = text(context.getString(id), style)

fun text(text: CharSequence?, @StyleRes style: Int? = null) {
text(text, style) {
text(text = text, style = style) {
layoutParams = LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT)
.apply { updateMargins(dp40, 0, dp40, 0) }
}
}

private fun text(text: CharSequence?, @StyleRes style: Int? = null, modify: TextView.() -> Unit) {
private fun text(
text: CharSequence?,
qaTag: String = context.getString(R.string.AccessibilityId_modalMessage),
@StyleRes style: Int? = null,
modify: TextView.() -> Unit
) {
text ?: return
TextView(context, null, 0, style ?: R.style.TextAppearance_Session_Dialog_Message)
.apply {
setText(text)
textAlignment = View.TEXT_ALIGNMENT_CENTER
contentDescription = qaTag
modify()
}.let(topView::addView)

Expand Down Expand Up @@ -166,7 +175,7 @@ class SessionDialogBuilder(val context: Context) {
textColor?.let{
setTextColor(it)
}
contentDescription = resources.getString(contentDescriptionRes)
contentDescription = resources.getString(text) // QA now wants the qa tag to mtch the button's text
layoutParams = LinearLayout.LayoutParams(WRAP_CONTENT, dp60, 1f)
setOnClickListener {
listener.invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,21 @@ internal fun StartConversationScreen(
icon = R.drawable.ic_message,
modifier = Modifier.contentDescription(R.string.AccessibilityId_messageNew),
onClick = delegate::onNewMessageSelected)
Divider(startIndent = LocalDimensions.current.dividerIndent)
Divider(startIndent = LocalDimensions.current.minItemButtonHeight)
ItemButton(
textId = R.string.groupCreate,
icon = R.drawable.ic_group,
modifier = Modifier.contentDescription(R.string.AccessibilityId_groupCreate),
onClick = delegate::onCreateGroupSelected
)
Divider(startIndent = LocalDimensions.current.dividerIndent)
Divider(startIndent = LocalDimensions.current.minItemButtonHeight)
ItemButton(
textId = R.string.communityJoin,
icon = R.drawable.ic_globe,
modifier = Modifier.contentDescription(R.string.AccessibilityId_communityJoin),
onClick = delegate::onJoinCommunitySelected
)
Divider(startIndent = LocalDimensions.current.dividerIndent)
Divider(startIndent = LocalDimensions.current.minItemButtonHeight)
ItemButton(
textId = R.string.sessionInviteAFriend,
icon = R.drawable.ic_invite_friend,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.core.content.ContextCompat
import androidx.core.view.drawToBitmap
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.fragment.app.DialogFragment
Expand All @@ -59,6 +58,7 @@ import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.receiveAsFlow
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -181,6 +181,7 @@ import org.thoughtcrime.securesms.util.DateUtils
import org.thoughtcrime.securesms.util.MediaUtil
import org.thoughtcrime.securesms.util.NetworkUtils
import org.thoughtcrime.securesms.util.SaveAttachmentTask
import org.thoughtcrime.securesms.util.drawToBitmap
import org.thoughtcrime.securesms.util.isScrolledToBottom
import org.thoughtcrime.securesms.util.isScrolledToWithin30dpOfBottom
import org.thoughtcrime.securesms.util.push
Expand Down Expand Up @@ -734,9 +735,10 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
private fun restoreDraftIfNeeded() {
val mediaURI = intent.data
val mediaType = AttachmentManager.MediaType.from(intent.type)
val mimeType = MediaUtil.getMimeType(this, mediaURI)
if (mediaURI != null && mediaType != null) {
if (AttachmentManager.MediaType.IMAGE == mediaType || AttachmentManager.MediaType.GIF == mediaType || AttachmentManager.MediaType.VIDEO == mediaType) {
val media = Media(mediaURI, MediaUtil.getMimeType(this, mediaURI)!!, 0, 0, 0, 0, Optional.absent(), Optional.absent())
if (mimeType != null && (AttachmentManager.MediaType.IMAGE == mediaType || AttachmentManager.MediaType.GIF == mediaType || AttachmentManager.MediaType.VIDEO == mediaType)) {
val media = Media(mediaURI, mimeType, 0, 0, 0, 0, Optional.absent(), Optional.absent())
startActivityForResult(MediaSendActivity.buildEditorIntent(this, listOf( media ), viewModel.recipient!!, ""), PICK_FROM_LIBRARY)
return
} else {
Expand Down Expand Up @@ -813,7 +815,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
if (shouldShowLegacy) {

val txt = Phrase.from(applicationContext, R.string.disappearingMessagesLegacy)
.put(NAME_KEY, legacyRecipient!!.name)
.put(NAME_KEY, legacyRecipient!!.toShortString())
.format()
binding?.outdatedBannerTextView?.text = txt
}
Expand Down Expand Up @@ -1191,14 +1193,14 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
title(R.string.block)
text(
Phrase.from(context, R.string.blockDescription)
.put(NAME_KEY, recipient.name)
.put(NAME_KEY, recipient.toShortString())
.format()
)
dangerButton(R.string.block, R.string.AccessibilityId_blockConfirm) {
viewModel.block()

// Block confirmation toast added as per SS-64
val txt = Phrase.from(context, R.string.blockBlockedUser).put(NAME_KEY, recipient.name).format().toString()
val txt = Phrase.from(context, R.string.blockBlockedUser).put(NAME_KEY, recipient.toShortString()).format().toString()
Toast.makeText(context, txt, Toast.LENGTH_LONG).show()

if (deleteThread) {
Expand Down Expand Up @@ -1249,7 +1251,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
title(R.string.blockUnblock)
text(
Phrase.from(context, R.string.blockUnblockName)
.put(NAME_KEY, recipient.name)
.put(NAME_KEY, recipient.toShortString())
.format()
)
dangerButton(R.string.blockUnblock, R.string.AccessibilityId_unblockConfirm) { viewModel.unblock() }
Expand Down Expand Up @@ -1737,10 +1739,19 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
binding.inputBar.text = ""
binding.inputBar.cancelQuoteDraft()
binding.inputBar.cancelLinkPreviewDraft()
// Put the message in the database
message.id = smsDb.insertMessageOutbox(viewModel.threadId, outgoingTextMessage, false, message.sentTimestamp!!, null, true)
// Send it
MessageSender.send(message, recipient.address)
lifecycleScope.launch(Dispatchers.Default) {
// Put the message in the database
message.id = smsDb.insertMessageOutbox(
viewModel.threadId,
outgoingTextMessage,
false,
message.sentTimestamp!!,
null,
true
)
// Send it
MessageSender.send(message, recipient.address)
}
// Send a typing stopped message
ApplicationContext.getInstance(this).typingStatusSender.onTypingStopped(viewModel.threadId)
return Pair(recipient.address, sentTimestamp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DownloadDialog(private val recipient: Recipient) : DialogFragment() {
title(getString(R.string.attachmentsAutoDownloadModalTitle))

val explanation = Phrase.from(context, R.string.attachmentsAutoDownloadModalDescription)
.put(CONVERSATION_NAME_KEY, recipient.name)
.put(CONVERSATION_NAME_KEY, recipient.toShortString())
.format()
val spannable = SpannableStringBuilder(explanation)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1583,6 +1583,7 @@ open class Storage(
if (recipient.isLocalNumber || !recipient.isContactRecipient) return
configFactory.contacts?.upsertContact(recipient.address.serialize()) {
this.approved = approved
this.priority = PRIORITY_VISIBLE
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,17 @@ public CharSequence getDisplayBody(@NonNull Context context) {
.format().toString();

} else if (MmsSmsColumns.Types.isMessageRequestResponse(type)) {
if (lastMessage.getRecipient().getAddress().serialize().equals(
TextSecurePreferences.getLocalNumber(context))) {
return UtilKt.getSubbedCharSequence(
context,
R.string.messageRequestYouHaveAccepted,
new Pair<>(NAME_KEY, getName())
);
try {
if (lastMessage.getRecipient().getAddress().serialize().equals(
TextSecurePreferences.getLocalNumber(context))) {
return UtilKt.getSubbedCharSequence(
context,
R.string.messageRequestYouHaveAccepted,
new Pair<>(NAME_KEY, getName())
);
}
}
catch (Exception e){} // the above can throw a null exception

return context.getString(R.string.messageRequestsAccepted);
} else if (getCount() == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,10 @@ fun DebugMenu(
buttons = listOf(
DialogButtonModel(
text = GetString(R.string.cancel),
contentDescription = GetString(R.string.cancel),
onClick = { sendCommand(HideEnvironmentWarningDialog) }
),
DialogButtonModel(
text = GetString(R.string.ok),
contentDescription = GetString(R.string.ok),
onClick = { sendCommand(ChangeEnvironment) }
)
)
Expand Down Expand Up @@ -149,9 +147,11 @@ fun ColumnScope.DebugCell(
) {
Spacer(modifier = Modifier.height(LocalDimensions.current.smallSpacing))

Cell {
Cell(
modifier = modifier
) {
Column(
modifier = modifier.padding(LocalDimensions.current.spacing)
modifier = Modifier.padding(LocalDimensions.current.spacing)
) {
Text(
text = title,
Expand Down
Loading

0 comments on commit cc67ea1

Please sign in to comment.