mirror of
https://github.com/bitfireAT/davx5-ose
synced 2024-07-23 19:50:18 +00:00
Google Login: add Limited Use policy (bitfireAT/davx5#327)
This commit is contained in:
parent
bb6ed7ec64
commit
ec34da1ace
|
@ -29,15 +29,32 @@ class App: Application(), Thread.UncaughtExceptionHandler, Configuration.Provide
|
|||
|
||||
companion object {
|
||||
|
||||
const val HOMEPAGE_PRIVACY = "privacy"
|
||||
|
||||
fun getLauncherBitmap(context: Context) =
|
||||
AppCompatResources.getDrawable(context, R.mipmap.ic_launcher)?.toBitmap()
|
||||
|
||||
fun homepageUrl(context: Context) =
|
||||
Uri.parse(context.getString(R.string.homepage_url)).buildUpon()
|
||||
.appendQueryParameter("pk_campaign", BuildConfig.APPLICATION_ID)
|
||||
.appendQueryParameter("pk_kwd", context::class.java.simpleName)
|
||||
.appendQueryParameter("app-version", BuildConfig.VERSION_NAME)
|
||||
.build()!!
|
||||
/**
|
||||
* Gets the DAVx5 Web site URL that should be used to open in the user's browser.
|
||||
* Package ID, version number and calling context name will be appended as arguments.
|
||||
*
|
||||
* @param context context name to use
|
||||
* @param page optional page segment to append (for instance: [HOMEPAGE_PRIVACY]])
|
||||
*
|
||||
* @return the Uri for the browser
|
||||
*/
|
||||
fun homepageUrl(context: Context, page: String? = null): Uri {
|
||||
val builder = Uri.parse(context.getString(R.string.homepage_url)).buildUpon()
|
||||
|
||||
if (page != null)
|
||||
builder.appendPath(page)
|
||||
|
||||
return builder
|
||||
.appendQueryParameter("pk_campaign", BuildConfig.APPLICATION_ID)
|
||||
.appendQueryParameter("pk_kwd", context::class.java.simpleName)
|
||||
.appendQueryParameter("app-version", BuildConfig.VERSION_NAME)
|
||||
.build()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -48,19 +48,19 @@ class OseAccountsDrawerHandler @Inject constructor(): BaseAccountsDrawerHandler(
|
|||
R.id.nav_faq ->
|
||||
UiUtils.launchUri(
|
||||
activity,
|
||||
App.homepageUrl(activity).buildUpon().appendPath("faq").build()
|
||||
App.homepageUrl(activity, "faq")
|
||||
)
|
||||
R.id.nav_community ->
|
||||
UiUtils.launchUri(activity, Uri.parse(COMMUNITY_URL))
|
||||
R.id.nav_donate ->
|
||||
UiUtils.launchUri(
|
||||
activity,
|
||||
App.homepageUrl(activity).buildUpon().appendPath("donate").build()
|
||||
App.homepageUrl(activity, "donate")
|
||||
)
|
||||
R.id.nav_privacy ->
|
||||
UiUtils.launchUri(
|
||||
activity,
|
||||
App.homepageUrl(activity).buildUpon().appendPath("privacy").build()
|
||||
App.homepageUrl(activity, App.HOMEPAGE_PRIVACY)
|
||||
)
|
||||
|
||||
else ->
|
||||
|
|
|
@ -10,9 +10,11 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.activity.result.contract.ActivityResultContract
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Column
|
||||
|
@ -42,12 +44,15 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import at.bitfire.davdroid.App
|
||||
import at.bitfire.davdroid.BuildConfig
|
||||
import at.bitfire.davdroid.R
|
||||
import at.bitfire.davdroid.db.Credentials
|
||||
|
@ -77,6 +82,9 @@ class GoogleLoginFragment(private val defaultEmail: String? = null): Fragment()
|
|||
|
||||
companion object {
|
||||
|
||||
// Google API Services User Data Policy
|
||||
val GOOGLE_POLICY_URL = "https://developers.google.com/terms/api-services-user-data-policy#additional_requirements_for_specific_api_scopes"
|
||||
|
||||
// Support site
|
||||
val URI_TESTED_WITH_GOOGLE: Uri = Uri.parse("https://www.davx5.com/tested-with/google")
|
||||
|
||||
|
@ -284,11 +292,25 @@ fun GoogleLogin(
|
|||
Text(stringResource(R.string.login_login))
|
||||
}
|
||||
|
||||
Text(
|
||||
stringResource(R.string.login_google_disclaimer, stringResource(R.string.app_name)),
|
||||
style = MaterialTheme.typography.body2,
|
||||
modifier = Modifier.padding(top = 24.dp))
|
||||
AndroidView({ context ->
|
||||
TextView(context, null, 0, com.google.accompanist.themeadapter.material.R.style.TextAppearance_MaterialComponents_Body2).apply {
|
||||
text = HtmlCompat.fromHtml(context.getString(R.string.login_google_client_privacy_policy,
|
||||
context.getString(R.string.app_name),
|
||||
App.homepageUrl(context, App.HOMEPAGE_PRIVACY)
|
||||
), 0)
|
||||
movementMethod = LinkMovementMethod.getInstance()
|
||||
}
|
||||
}, modifier = Modifier.padding(top = 12.dp))
|
||||
|
||||
AndroidView({ context ->
|
||||
TextView(context, null, 0, com.google.accompanist.themeadapter.material.R.style.TextAppearance_MaterialComponents_Body2).apply {
|
||||
text = HtmlCompat.fromHtml(context.getString(R.string.login_google_client_limited_use,
|
||||
context.getString(R.string.app_name),
|
||||
GoogleLoginFragment.GOOGLE_POLICY_URL
|
||||
), 0)
|
||||
movementMethod = LinkMovementMethod.getInstance()
|
||||
}
|
||||
}, modifier = Modifier.padding(top = 12.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -298,7 +298,8 @@
|
|||
<string name="login_google_client_id">Client ID (optional)</string>
|
||||
<string name="login_google_client_id_description">You may use your own client ID, in case our does not work.</string>
|
||||
<string name="login_google_client_id_description_link">Show me how!</string>
|
||||
<string name="login_google_disclaimer">%s is not affiliated to, nor has it been authorized, sponsored or otherwise approved by Google LLC.</string>
|
||||
<string name="login_google_client_privacy_policy"><![CDATA[%1s transfers your Google Contacts and Calendar data solely for synchronization with this device. See our <a href="%2s">Privacy policy</a> for details.]]></string>
|
||||
<string name="login_google_client_limited_use"><![CDATA[%1s complies with the <a href="%2s">Google API Services User Data Policy</a>, including the Limited Use requirements.]]></string>
|
||||
<string name="login_oauth_couldnt_obtain_auth_code">Couldn\'t obtain authorization code</string>
|
||||
|
||||
<string name="login_configuration_detection">Configuration detection</string>
|
||||
|
|
Loading…
Reference in a new issue