Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
appframe
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit b9526f1e
authored
2026-03-11 10:53:43 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
首次打开时,显示个人信息收集提示
1 parent
a56a4bd5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
141 additions
and
2 deletions
lib/bloc/login_main_cubit.dart
lib/config/constant.dart
lib/ui/pages/login_main_page.dart
lib/bloc/login_main_cubit.dart
View file @
b9526f1
...
@@ -19,6 +19,7 @@ class LoginMainState extends Equatable {
...
@@ -19,6 +19,7 @@ class LoginMainState extends Equatable {
final
String
appleUserIdentifier
;
final
String
appleUserIdentifier
;
final
bool
loading
;
final
bool
loading
;
final
bool
wechatInstalled
;
final
bool
wechatInstalled
;
final
bool
showPrivacyFirstTime
;
const
LoginMainState
({
const
LoginMainState
({
this
.
agreed
=
false
,
this
.
agreed
=
false
,
...
@@ -28,6 +29,7 @@ class LoginMainState extends Equatable {
...
@@ -28,6 +29,7 @@ class LoginMainState extends Equatable {
this
.
appleUserIdentifier
=
''
,
this
.
appleUserIdentifier
=
''
,
this
.
loading
=
false
,
this
.
loading
=
false
,
this
.
wechatInstalled
=
false
,
this
.
wechatInstalled
=
false
,
this
.
showPrivacyFirstTime
=
false
,
});
});
LoginMainState
copyWith
({
LoginMainState
copyWith
({
...
@@ -38,6 +40,7 @@ class LoginMainState extends Equatable {
...
@@ -38,6 +40,7 @@ class LoginMainState extends Equatable {
String
?
appleUserIdentifier
,
String
?
appleUserIdentifier
,
bool
?
loading
,
bool
?
loading
,
bool
?
wechatInstalled
,
bool
?
wechatInstalled
,
bool
?
showPrivacyFirstTime
,
})
{
})
{
return
LoginMainState
(
return
LoginMainState
(
agreed:
agreed
??
this
.
agreed
,
agreed:
agreed
??
this
.
agreed
,
...
@@ -47,6 +50,7 @@ class LoginMainState extends Equatable {
...
@@ -47,6 +50,7 @@ class LoginMainState extends Equatable {
appleUserIdentifier:
appleUserIdentifier
??
this
.
appleUserIdentifier
,
appleUserIdentifier:
appleUserIdentifier
??
this
.
appleUserIdentifier
,
loading:
loading
??
this
.
loading
,
loading:
loading
??
this
.
loading
,
wechatInstalled:
wechatInstalled
??
this
.
wechatInstalled
,
wechatInstalled:
wechatInstalled
??
this
.
wechatInstalled
,
showPrivacyFirstTime:
showPrivacyFirstTime
??
this
.
showPrivacyFirstTime
,
);
);
}
}
...
@@ -59,6 +63,7 @@ class LoginMainState extends Equatable {
...
@@ -59,6 +63,7 @@ class LoginMainState extends Equatable {
appleUserIdentifier
,
appleUserIdentifier
,
loading
,
loading
,
wechatInstalled
,
wechatInstalled
,
showPrivacyFirstTime
,
];
];
}
}
...
@@ -79,6 +84,25 @@ class LoginMainCubit extends Cubit<LoginMainState> {
...
@@ -79,6 +84,25 @@ class LoginMainCubit extends Cubit<LoginMainState> {
_fluwxCancelable
=
_fluwx
.
addSubscriber
(
_responseListener
);
_fluwxCancelable
=
_fluwx
.
addSubscriber
(
_responseListener
);
_wechatAuthRepository
=
getIt
.
get
<
WechatAuthRepository
>();
_wechatAuthRepository
=
getIt
.
get
<
WechatAuthRepository
>();
_userAuthRepository
=
getIt
.
get
<
UserAuthRepository
>();
_userAuthRepository
=
getIt
.
get
<
UserAuthRepository
>();
// 检查是否首次打开登录页面,显示个人信息收集提示
_checkFirstTimePrivacy
();
}
// 检查是否首次打开,显示个人信息收集提示
void
_checkFirstTimePrivacy
()
async
{
var
sharedPreferences
=
getIt
.
get
<
SharedPreferences
>();
var
hasShownPrivacy
=
sharedPreferences
.
getBool
(
Constant
.
hasShownPrivacyFirstTimeKey
)
??
false
;
if
(!
hasShownPrivacy
)
{
emit
(
state
.
copyWith
(
showPrivacyFirstTime:
true
));
}
}
// 确认已显示个人信息收集提示
void
confirmPrivacyFirstTime
()
async
{
var
sharedPreferences
=
getIt
.
get
<
SharedPreferences
>();
await
sharedPreferences
.
setBool
(
Constant
.
hasShownPrivacyFirstTimeKey
,
true
);
emit
(
state
.
copyWith
(
showPrivacyFirstTime:
false
));
}
}
void
toggleAgreed
(
bool
value
)
{
void
toggleAgreed
(
bool
value
)
{
...
...
lib/config/constant.dart
View file @
b9526f1
...
@@ -109,6 +109,12 @@ class Constant {
...
@@ -109,6 +109,12 @@ class Constant {
///
///
static
const
String
classIdSetKey
=
'auth_class_ids'
;
static
const
String
classIdSetKey
=
'auth_class_ids'
;
/// 隐私政策相关
/// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// 首次打开登录页面时,是否已显示个人信息收集提示
static
const
String
hasShownPrivacyFirstTimeKey
=
'has_shown_privacy_first_time'
;
/// 测试阶段使用
/// 测试阶段使用
static
const
bool
needIM
=
true
;
static
const
bool
needIM
=
true
;
static
const
bool
needUpgrade
=
true
;
static
const
bool
needUpgrade
=
true
;
...
...
lib/ui/pages/login_main_page.dart
View file @
b9526f1
...
@@ -162,6 +162,8 @@ class LoginMainPage extends StatelessWidget {
...
@@ -162,6 +162,8 @@ class LoginMainPage extends StatelessWidget {
_showAgreementDialog
(
context
,
context
.
read
<
LoginMainCubit
>());
_showAgreementDialog
(
context
,
context
.
read
<
LoginMainCubit
>());
}
else
if
(
state
.
showNeedWechatForApple
)
{
}
else
if
(
state
.
showNeedWechatForApple
)
{
_showNeedWechatDialogForApple
(
context
,
context
.
read
<
LoginMainCubit
>());
_showNeedWechatDialogForApple
(
context
,
context
.
read
<
LoginMainCubit
>());
}
else
if
(
state
.
showPrivacyFirstTime
)
{
_showPrivacyFirstTimeDialog
(
context
,
context
.
read
<
LoginMainCubit
>());
}
}
},
},
),
),
...
@@ -236,7 +238,7 @@ class LoginMainPage extends StatelessWidget {
...
@@ -236,7 +238,7 @@ class LoginMainPage extends StatelessWidget {
style:
TextStyle
(
color:
Color
(
0xFF666666
),
fontSize:
14
),
style:
TextStyle
(
color:
Color
(
0xFF666666
),
fontSize:
14
),
),
),
TextSpan
(
TextSpan
(
text:
'《班小二数据
据
安全和隐私政策》'
,
text:
'《班小二数据安全和隐私政策》'
,
style:
TextStyle
(
color:
Color
(
0xFF7691FA
),
fontSize:
14
),
style:
TextStyle
(
color:
Color
(
0xFF7691FA
),
fontSize:
14
),
recognizer:
TapGestureRecognizer
()
recognizer:
TapGestureRecognizer
()
..
onTap
=
()
{
..
onTap
=
()
{
...
@@ -262,7 +264,7 @@ class LoginMainPage extends StatelessWidget {
...
@@ -262,7 +264,7 @@ class LoginMainPage extends StatelessWidget {
},
},
),
),
TextSpan
(
TextSpan
(
text:
'。如您同意上述文件的全部内容,请点击
“同意”
以继续。'
,
text:
'。如您同意上述文件的全部内容,请点击
"同意"
以继续。'
,
style:
TextStyle
(
color:
Color
(
0xFF666666
),
fontSize:
14
),
style:
TextStyle
(
color:
Color
(
0xFF666666
),
fontSize:
14
),
),
),
],
],
...
@@ -432,4 +434,111 @@ class LoginMainPage extends StatelessWidget {
...
@@ -432,4 +434,111 @@ class LoginMainPage extends StatelessWidget {
},
},
);
);
}
}
// 首次打开显示个人信息收集提示弹窗
Future
<
void
>
_showPrivacyFirstTimeDialog
(
BuildContext
context
,
LoginMainCubit
loginMainCubit
)
async
{
await
showDialog
(
context:
context
,
barrierDismissible:
false
,
builder:
(
BuildContext
context
)
{
return
AlertDialog
(
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
5
),
),
),
title:
Text
(
'重要提示'
,
style:
TextStyle
(
fontSize:
17
,
color:
Color
(
0xFF000000
),
),
textAlign:
TextAlign
.
center
,
),
content:
SingleChildScrollView
(
child:
Text
.
rich
(
TextSpan
(
children:
[
TextSpan
(
text:
'尊敬的用户,欢迎使用班小二APP!
\n\n
'
,
style:
TextStyle
(
color:
Color
(
0xFF666666
),
fontSize:
14
),
),
// TextSpan(
// text: '为了向您提供更好的服务,我们需要收集以下个人信息:\n\n',
// style: TextStyle(color: Color(0xFF666666), fontSize: 14),
// ),
// TextSpan(
// text: '• 收集目的:用于用户身份识别、登录验证、提供教育相关服务\n',
// style: TextStyle(color: Color(0xFF666666), fontSize: 14),
// ),
// TextSpan(
// text: '• 收集方式:通过微信授权、手机号验证等方式获取\n',
// style: TextStyle(color: Color(0xFF666666), fontSize: 14),
// ),
// TextSpan(
// text: '• 信息范围:包括您的微信昵称、头像、手机号、学生信息等\n\n',
// style: TextStyle(color: Color(0xFF666666), fontSize: 14),
// ),
TextSpan
(
text:
'我们将严格遵守'
,
style:
TextStyle
(
color:
Color
(
0xFF666666
),
fontSize:
14
),
),
TextSpan
(
text:
'《班小二数据安全和隐私政策》'
,
style:
TextStyle
(
color:
Color
(
0xFF7691FA
),
fontSize:
14
),
recognizer:
TapGestureRecognizer
()
..
onTap
=
()
{
router
.
push
(
'/link'
,
extra:
{
'url'
:
'https://bxr.banxiaoer.net/apps/privacysettings.html'
,
'title'
:
'隐私保障'
},
);
},
),
TextSpan
(
text:
'与'
,
style:
TextStyle
(
color:
Color
(
0xFF666666
),
fontSize:
14
),
),
TextSpan
(
text:
'《用户协议》'
,
style:
TextStyle
(
color:
Color
(
0xFF7691FA
),
fontSize:
14
),
recognizer:
TapGestureRecognizer
()
..
onTap
=
()
{
router
.
push
(
'/link'
,
extra:
{
'url'
:
'https://bxr.banxiaoer.net/apps/useragreement.html'
,
'title'
:
'用户协议'
},
);
},
),
TextSpan
(
text:
'保护您的个人信息安全。'
,
style:
TextStyle
(
color:
Color
(
0xFF666666
),
fontSize:
14
),
),
],
),
),
),
actions:
[
Center
(
child:
TextButton
(
onPressed:
()
{
Navigator
.
of
(
context
).
pop
();
loginMainCubit
.
confirmPrivacyFirstTime
();
},
style:
TextButton
.
styleFrom
(
foregroundColor:
Color
(
0xFF7691FA
),
textStyle:
TextStyle
(
fontSize:
17
),
minimumSize:
Size
.
fromHeight
(
40
),
padding:
EdgeInsets
.
zero
,
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
zero
,
),
),
child:
Text
(
'我知道了'
),
),
),
],
);
},
);
}
}
}
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment