Commit 1b334810 authored by 小费同学阿's avatar 小费同学阿 💬

商户端隐私协议逻辑更改

parent 775355a2
......@@ -54,11 +54,11 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
viewModel.getProtocols()
SPUtils.getInstance().clear()
super.initData()
// 使用SharedPreferences检查是否是第一次打开应用
val preferences = getPreferences(Context.MODE_PRIVATE)
val isFirstRun = preferences.getBoolean("is_first_run", true)
if (isFirstRun) {
val isAgreeFlag = preferences.getBoolean("is_agree_flag", true)
if (isAgreeFlag) {
// 如果是第一次打开应用,执行相应的操作
// ToastUtils.showShort("第一次登录")
viewModel.agreeContent.observe(this) { agreeContent: String? ->
......@@ -66,14 +66,21 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
agreementContext = agreeContent
/*在这里加上隐私协议弹窗*/
showCommTextAgreeDialog(
RefuseDialogBean(agreementContext, "已知晓", null, "隐私条款"),
RefuseDialogBean(agreementContext, "同意", "不同意", "隐私条款"),
object : CommTextAgreeDialog.onAcceptCallBack {
override fun refuseBack() {
finish()
val intent = Intent(Intent.ACTION_MAIN)
intent.addCategory(Intent.CATEGORY_HOME)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
startActivity(intent)
}
override fun acceptBack() {
// 设置is_agree_flag标记为false,表示隐私协议已同意
val editor = preferences.edit()
editor.putBoolean("is_agree_flag", false)
editor.apply()
}
})
}
......@@ -81,10 +88,6 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
}
// 设置is_first_run标记为false,表示应用已经不是第一次运行
val editor = preferences.edit()
editor.putBoolean("is_first_run", false)
editor.apply()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if (!Environment.isExternalStorageManager()) {
......
package com.xx.hbhbcompany.ui.login
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.text.SpannableStringBuilder
import android.text.Spanned
......@@ -41,11 +42,11 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
viewModel.getProtocols()
SPUtils.getInstance().clear()
super.initData()
// 使用SharedPreferences检查是否是第一次打开应用
val preferences = getPreferences(Context.MODE_PRIVATE)
val isFirstRun = preferences.getBoolean("is_first_run", true)
if (isFirstRun) {
val isAgreeFlag = preferences.getBoolean("is_agree_flag", true)
if (isAgreeFlag) {
// 如果是第一次打开应用,执行相应的操作
// ToastUtils.showShort("第一次登录")
viewModel.agreeContent.observe(this) { agreeContent: String? ->
......@@ -53,14 +54,21 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
agreementContext = agreeContent
/*在这里加上隐私协议弹窗*/
showCommTextAgreeDialog(
RefuseDialogBean(agreementContext, "已知晓", null, "隐私条款"),
RefuseDialogBean(agreementContext, "同意", "不同意", "隐私条款"),
object : CommTextAgreeDialog.onAcceptCallBack {
override fun refuseBack() {
finish()
val intent = Intent(Intent.ACTION_MAIN)
intent.addCategory(Intent.CATEGORY_HOME)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
startActivity(intent)
}
override fun acceptBack() {
// 设置is_agree_flag标记为false,表示隐私协议已同意
val editor = preferences.edit()
editor.putBoolean("is_agree_flag", false)
editor.apply()
}
})
}
......@@ -68,10 +76,6 @@ class LoginActivity() : BaseActivity<ActivityLoginBinding, LoginViewModel>() {
}
// 设置is_first_run标记为false,表示应用已经不是第一次运行
val editor = preferences.edit()
editor.putBoolean("is_first_run", false)
editor.apply()
if (viewModel.isAgree)
{
......
......@@ -62,7 +62,7 @@
android:layout_weight="1"
android:background="#00000000"
android:onClick="@{dialog.refuseClick}"
android:text="@{model.sureTxt.toString()}"
android:text="@{model.refuseTxt.toString()}"
android:textColor="@color/text_grey"
android:textSize="16sp"
android:visibility="@{model.refuseTxt==null? View.GONE : View.VISIBLE}" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment