mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-12 18:43:38 +00:00
[SES-1064] New Message Errors and Help Url
This commit is contained in:
parent
1f04a0f0ff
commit
d044a4090d
@ -140,6 +140,12 @@ class SessionDialogBuilder(val context: Context) {
|
|||||||
|
|
||||||
fun Context.showSessionDialog(build: SessionDialogBuilder.() -> Unit): AlertDialog =
|
fun Context.showSessionDialog(build: SessionDialogBuilder.() -> Unit): AlertDialog =
|
||||||
SessionDialogBuilder(this).apply { build() }.show()
|
SessionDialogBuilder(this).apply { build() }.show()
|
||||||
|
fun Context.showOpenUrlDialog(build: SessionDialogBuilder.() -> Unit): AlertDialog =
|
||||||
|
SessionDialogBuilder(this).apply {
|
||||||
|
title(R.string.urlOpen)
|
||||||
|
text(R.string.urlOpenBrowser)
|
||||||
|
build()
|
||||||
|
}.show()
|
||||||
|
|
||||||
fun Fragment.showSessionDialog(build: SessionDialogBuilder.() -> Unit): AlertDialog =
|
fun Fragment.showSessionDialog(build: SessionDialogBuilder.() -> Unit): AlertDialog =
|
||||||
SessionDialogBuilder(requireContext()).apply { build() }.show()
|
SessionDialogBuilder(requireContext()).apply { build() }.show()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.thoughtcrime.securesms.dms
|
package org.thoughtcrime.securesms.dms
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@ -22,6 +23,7 @@ import androidx.compose.runtime.getValue
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.ComposeView
|
import androidx.compose.ui.platform.ComposeView
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
@ -37,6 +39,7 @@ import org.session.libsession.utilities.recipients.Recipient
|
|||||||
import org.thoughtcrime.securesms.conversation.start.NewConversationDelegate
|
import org.thoughtcrime.securesms.conversation.start.NewConversationDelegate
|
||||||
import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2
|
import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2
|
||||||
import org.thoughtcrime.securesms.dependencies.DatabaseComponent
|
import org.thoughtcrime.securesms.dependencies.DatabaseComponent
|
||||||
|
import org.thoughtcrime.securesms.showOpenUrlDialog
|
||||||
import org.thoughtcrime.securesms.ui.AppTheme
|
import org.thoughtcrime.securesms.ui.AppTheme
|
||||||
import org.thoughtcrime.securesms.ui.BorderlessButtonSecondary
|
import org.thoughtcrime.securesms.ui.BorderlessButtonSecondary
|
||||||
import org.thoughtcrime.securesms.ui.OutlineButton
|
import org.thoughtcrime.securesms.ui.OutlineButton
|
||||||
@ -78,7 +81,12 @@ class NewMessageFragment : Fragment() {
|
|||||||
viewModel,
|
viewModel,
|
||||||
onClose = { delegate.onDialogClosePressed() },
|
onClose = { delegate.onDialogClosePressed() },
|
||||||
onBack = { delegate.onDialogBackPressed() },
|
onBack = { delegate.onDialogBackPressed() },
|
||||||
onHelp = { Toast.makeText(requireContext(), "todo, not implemented.", Toast.LENGTH_LONG).show() }
|
onHelp = {
|
||||||
|
requireContext().showOpenUrlDialog {
|
||||||
|
okButton { Intent(Intent.ACTION_VIEW, Uri.parse("https://sessionapp.zendesk.com/hc/en-us/articles/4439132747033-How-do-Session-ID-usernames-work")).let(::startActivity) }
|
||||||
|
cancelButton()
|
||||||
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -147,9 +155,10 @@ fun EnterAccountId(
|
|||||||
placeholder = stringResource(R.string.accountIdOrOnsEnter),
|
placeholder = stringResource(R.string.accountIdOrOnsEnter),
|
||||||
onChange = callbacks::onChange,
|
onChange = callbacks::onChange,
|
||||||
onContinue = callbacks::onContinue,
|
onContinue = callbacks::onContinue,
|
||||||
error = state.error?.string()
|
error = state.error?.string(),
|
||||||
)
|
)
|
||||||
BorderlessButtonSecondary(text = stringResource(R.string.messageNewDescription)) { onHelp() }
|
if (state.error == null) BorderlessButtonSecondary(text = stringResource(R.string.messageNewDescription)) { onHelp() }
|
||||||
|
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
|
||||||
OutlineButton(
|
OutlineButton(
|
||||||
|
@ -31,6 +31,7 @@ import org.thoughtcrime.securesms.BaseActionBarActivity
|
|||||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil
|
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil
|
||||||
import org.thoughtcrime.securesms.onboarding.pickname.startPickDisplayNameActivity
|
import org.thoughtcrime.securesms.onboarding.pickname.startPickDisplayNameActivity
|
||||||
import org.thoughtcrime.securesms.service.KeyCachingService
|
import org.thoughtcrime.securesms.service.KeyCachingService
|
||||||
|
import org.thoughtcrime.securesms.showOpenUrlDialog
|
||||||
import org.thoughtcrime.securesms.showSessionDialog
|
import org.thoughtcrime.securesms.showSessionDialog
|
||||||
import org.thoughtcrime.securesms.ui.AppTheme
|
import org.thoughtcrime.securesms.ui.AppTheme
|
||||||
import org.thoughtcrime.securesms.ui.BorderlessButton
|
import org.thoughtcrime.securesms.ui.BorderlessButton
|
||||||
@ -120,9 +121,7 @@ class LandingActivity : BaseActionBarActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun openDialog() {
|
private fun openDialog() {
|
||||||
showSessionDialog {
|
showOpenUrlDialog {
|
||||||
title(R.string.urlOpen)
|
|
||||||
text(R.string.urlOpenBrowser)
|
|
||||||
button(
|
button(
|
||||||
R.string.activity_landing_terms_of_service,
|
R.string.activity_landing_terms_of_service,
|
||||||
contentDescriptionRes = R.string.AccessibilityId_terms_of_service_link
|
contentDescriptionRes = R.string.AccessibilityId_terms_of_service_link
|
||||||
|
@ -9,6 +9,7 @@ import androidx.compose.material.OutlinedTextField
|
|||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import org.thoughtcrime.securesms.ui.baseBold
|
import org.thoughtcrime.securesms.ui.baseBold
|
||||||
import org.thoughtcrime.securesms.ui.outlinedTextFieldColors
|
import org.thoughtcrime.securesms.ui.outlinedTextFieldColors
|
||||||
@ -17,10 +18,10 @@ import org.thoughtcrime.securesms.ui.outlinedTextFieldColors
|
|||||||
fun SessionOutlinedTextField(
|
fun SessionOutlinedTextField(
|
||||||
text: String,
|
text: String,
|
||||||
placeholder: String,
|
placeholder: String,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
onChange: (String) -> Unit,
|
onChange: (String) -> Unit,
|
||||||
onContinue: () -> Unit,
|
onContinue: () -> Unit,
|
||||||
error: String? = null,
|
error: String? = null
|
||||||
modifier: Modifier
|
|
||||||
) {
|
) {
|
||||||
Column(modifier = modifier) {
|
Column(modifier = modifier) {
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
@ -42,6 +43,7 @@ fun SessionOutlinedTextField(
|
|||||||
Text(
|
Text(
|
||||||
it,
|
it,
|
||||||
modifier = Modifier.padding(top = 12.dp),
|
modifier = Modifier.padding(top = 12.dp),
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
style = MaterialTheme.typography.baseBold,
|
style = MaterialTheme.typography.baseBold,
|
||||||
color = MaterialTheme.colors.error
|
color = MaterialTheme.colors.error
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user