Add terms and privacy policy to LandingActivity

This commit is contained in:
andrew 2023-10-17 12:04:32 +10:30
parent fc3063140e
commit 88cfe41893
3 changed files with 26 additions and 2 deletions

View File

@ -1,5 +1,7 @@
package org.thoughtcrime.securesms.onboarding
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
@ -21,11 +23,13 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import network.loki.messenger.R
import org.session.libsession.utilities.TextSecurePreferences
import org.thoughtcrime.securesms.BaseActionBarActivity
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil
import org.thoughtcrime.securesms.onboarding.pickname.startPickDisplayNameActivity
import org.thoughtcrime.securesms.service.KeyCachingService
import org.thoughtcrime.securesms.showSessionDialog
import org.thoughtcrime.securesms.ui.AppTheme
import org.thoughtcrime.securesms.ui.BorderlessButton
import org.thoughtcrime.securesms.ui.FilledButton
@ -82,12 +86,25 @@ class LandingActivity : BaseActionBarActivity() {
.align(Alignment.CenterHorizontally),
fontSize = 11.sp,
lineHeight = 13.sp
) { }
) { openDialog() }
Spacer(modifier = Modifier.height(8.dp))
}
}
}
private fun openDialog() {
showSessionDialog {
title(R.string.activity_landing_open_url_title)
text(R.string.activity_landing_open_url_explanation)
button(R.string.activity_landing_terms_of_service) { open("https://getsession.org/terms-of-service") }
button(R.string.activity_landing_privacy_policy) { open("https://getsession.org/privacy-policy") }
}
}
private fun open(url: String) {
Intent(Intent.ACTION_VIEW, Uri.parse(url)).let(::startActivity)
}
@Composable
private fun IncomingText(text: String) {
ChatText(

View File

@ -37,6 +37,7 @@ import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp
@ -97,8 +98,10 @@ fun BorderlessButton(
) {
Text(
text = text,
textAlign = TextAlign.Center,
fontSize = fontSize,
lineHeight = lineHeight
lineHeight = lineHeight,
modifier = Modifier.padding(horizontal = 2.dp)
)
}
}

View File

@ -719,6 +719,10 @@
<string name="activity_landing_title_2">Your Session begins here...</string>
<string name="activity_landing_register_button_title">Create Session ID</string>
<string name="activity_landing_restore_button_title">Continue Your Session</string>
<string name="activity_landing_open_url_title">Open URL</string>
<string name="activity_landing_open_url_explanation">This will open in your browser.</string>
<string name="activity_landing_terms_of_service">Terms of Service</string>
<string name="activity_landing_privacy_policy">Privacy Policy</string>
<string name="view_fake_chat_bubble_1">What\'s Session?</string>
<string name="view_fake_chat_bubble_2">It\'s a decentralized, encrypted messaging app</string>
<string name="view_fake_chat_bubble_3">So it doesn\'t collect my personal information or my conversation metadata? How does it work?</string>