Merge branch 'develop_liuyf' into develop
This commit is contained in:
commit
b57a071ce9
@ -104,7 +104,7 @@ class StarLockLoginLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> oneClickLoginAction(BuildContext context) async {
|
Future<void> oneClickLoginAction(BuildContext context) async {
|
||||||
await JverifyOneClickLoginManage().loginAuth(context,(e) async {
|
await JverifyOneClickLoginManage().loginAuth(context, (e) async {
|
||||||
final int? code = e.code;
|
final int? code = e.code;
|
||||||
final String? content = e.message;
|
final String? content = e.message;
|
||||||
// final String operator = map['operator'];
|
// final String operator = map['operator'];
|
||||||
@ -199,10 +199,15 @@ class StarLockLoginLogic extends BaseGetXController {
|
|||||||
if (entity.data!.abbreviation?.toLowerCase() == 'cn' &&
|
if (entity.data!.abbreviation?.toLowerCase() == 'cn' &&
|
||||||
currentLanguage == 'zh_CN') {
|
currentLanguage == 'zh_CN') {
|
||||||
// 初始化一键登录服务
|
// 初始化一键登录服务
|
||||||
await JverifyOneClickLoginManage();
|
JverifyOneClickLoginManage.instance.initSDK().then((value) async {
|
||||||
state.isCheckVerifyEnable.value =
|
final bool isCheckVerifyEnable =
|
||||||
await JverifyOneClickLoginManage().checkVerifyEnable();
|
await JverifyOneClickLoginManage.instance.checkVerifyEnable();
|
||||||
AppLog.log('一键登录初始化认证结果:${state.isCheckVerifyEnable.value}');
|
state.isCheckVerifyEnable.value = isCheckVerifyEnable;
|
||||||
|
AppLog.log('一键登录初始化认证结果:${state.isCheckVerifyEnable.value}');
|
||||||
|
if (isCheckVerifyEnable) {
|
||||||
|
oneClickLoginAction(Get.context!);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,12 +25,18 @@ class StarLockLoginXHJPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
|
class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
|
||||||
final StarLockLoginLogic logic = Get.put(StarLockLoginLogic());
|
late StarLockLoginLogic logic ;
|
||||||
final StarLockLoginState state = Get.find<StarLockLoginLogic>().state;
|
late StarLockLoginState state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
if (Get.isRegistered<StarLockLoginLogic>()) {
|
||||||
|
logic = Get.find<StarLockLoginLogic>();
|
||||||
|
} else {
|
||||||
|
logic = Get.put(StarLockLoginLogic());
|
||||||
|
}
|
||||||
|
state = logic.state;
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
AppFirstEnterHandle().getAppFirstEnter(isAgreePrivacy);
|
AppFirstEnterHandle().getAppFirstEnter(isAgreePrivacy);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -115,10 +115,10 @@ Future<void> privacySDKInitialization() async {
|
|||||||
if (entity.data!.abbreviation?.toLowerCase() == 'cn' &&
|
if (entity.data!.abbreviation?.toLowerCase() == 'cn' &&
|
||||||
currentLanguage == 'zh_CN') {
|
currentLanguage == 'zh_CN') {
|
||||||
// 初始化一键登录服务
|
// 初始化一键登录服务
|
||||||
final StarLockLoginLogic loginLogic = Get.put(StarLockLoginLogic());
|
// final StarLockLoginLogic loginLogic = Get.put(StarLockLoginLogic());
|
||||||
await JverifyOneClickLoginManage();
|
// await JverifyOneClickLoginManage();
|
||||||
loginLogic.state.isCheckVerifyEnable.value =
|
// loginLogic.state.isCheckVerifyEnable.value =
|
||||||
await JverifyOneClickLoginManage().checkVerifyEnable();
|
// await JverifyOneClickLoginManage().checkVerifyEnable();
|
||||||
eventBus.fire(AgreePrivacyAgreement());
|
eventBus.fire(AgreePrivacyAgreement());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,20 +11,19 @@ import '../common/XSConstantMacro/XSConstantMacro.dart';
|
|||||||
import '../flavors.dart';
|
import '../flavors.dart';
|
||||||
|
|
||||||
class JverifyOneClickLoginManage {
|
class JverifyOneClickLoginManage {
|
||||||
factory JverifyOneClickLoginManage() => shareManager()!;
|
factory JverifyOneClickLoginManage() => _getInstance()!;
|
||||||
|
|
||||||
JverifyOneClickLoginManage._init() {
|
JverifyOneClickLoginManage._init() {}
|
||||||
_initSDK();
|
|
||||||
|
static JverifyOneClickLoginManage get instance => _getInstance();
|
||||||
|
static JverifyOneClickLoginManage? _instance;
|
||||||
|
|
||||||
|
static JverifyOneClickLoginManage _getInstance() {
|
||||||
|
_instance ??= JverifyOneClickLoginManage._init();
|
||||||
|
return _instance!;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JverifyOneClickLoginManage? _manager;
|
JverifyOneClickLoginManage? get manager => _getInstance();
|
||||||
|
|
||||||
static JverifyOneClickLoginManage? shareManager() {
|
|
||||||
_manager ??= JverifyOneClickLoginManage._init();
|
|
||||||
return _manager;
|
|
||||||
}
|
|
||||||
|
|
||||||
JverifyOneClickLoginManage? get manager => shareManager();
|
|
||||||
Jverify jverify = Jverify();
|
Jverify jverify = Jverify();
|
||||||
|
|
||||||
/// 统一 key
|
/// 统一 key
|
||||||
@ -39,15 +38,15 @@ class JverifyOneClickLoginManage {
|
|||||||
/// 运营商信息
|
/// 运营商信息
|
||||||
String f_opr_key = 'operator';
|
String f_opr_key = 'operator';
|
||||||
|
|
||||||
Future<void> _initSDK() async {
|
Future<void> initSDK() async {
|
||||||
try {
|
try {
|
||||||
await initPlatformState();
|
await initPlatformState();
|
||||||
|
|
||||||
isInitSuccess();
|
// isInitSuccess();
|
||||||
|
|
||||||
getToken();
|
// getToken();
|
||||||
|
|
||||||
preLogin();
|
// preLogin();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
AppLog.log('SDK 初始化错误: $e');
|
AppLog.log('SDK 初始化错误: $e');
|
||||||
}
|
}
|
||||||
@ -80,65 +79,60 @@ class JverifyOneClickLoginManage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// sdk 初始化是否完成
|
/// sdk 初始化是否完成
|
||||||
void isInitSuccess() {
|
Future<bool> isInitSuccess() async {
|
||||||
jverify.isInitSuccess().then((map) {
|
final Map<dynamic, dynamic> map = await jverify.isInitSuccess();
|
||||||
final bool result = map[f_result_key];
|
final bool result = map[f_result_key];
|
||||||
AppLog.log('sdk 初始化结果:$map');
|
AppLog.log('sdk 初始化结果:$map');
|
||||||
if (result) {
|
if (result) {
|
||||||
AppLog.log('sdk 初始化成功');
|
AppLog.log('sdk 初始化成功');
|
||||||
} else {
|
} else {
|
||||||
AppLog.log('sdk 初始化失败');
|
AppLog.log('sdk 初始化失败');
|
||||||
}
|
}
|
||||||
});
|
return Future.value(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 判断当前网络环境是否可以发起认证
|
/// 判断当前网络环境是否可以发起认证
|
||||||
Future<bool> checkVerifyEnable() async {
|
Future<bool> checkVerifyEnable() async {
|
||||||
|
final isInitSuccess = await this.isInitSuccess();
|
||||||
|
if (!isInitSuccess) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
final Map map = await jverify.checkVerifyEnable();
|
final Map map = await jverify.checkVerifyEnable();
|
||||||
AppLog.log('一家登录 sdk 初始化结果:$map');
|
print('一家登录 sdk 初始化结果:$map');
|
||||||
final bool result = map[f_result_key];
|
final bool result = map[f_result_key];
|
||||||
return result;
|
return result;
|
||||||
// state.jverify.checkVerifyEnable().then((map) {
|
|
||||||
// final bool result = map[f_result_key];
|
|
||||||
// if (result) {
|
|
||||||
// AppLog.log('当前网络环境【支持认证】!');
|
|
||||||
// } else {
|
|
||||||
// AppLog.log('当前网络环境【不支持认证】!');
|
|
||||||
// }
|
|
||||||
// return result;
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void getToken() {
|
// void getToken() {
|
||||||
jverify.checkVerifyEnable().then((map) {
|
// jverify.checkVerifyEnable().then((map) {
|
||||||
final bool result = map[f_result_key];
|
// final bool result = map[f_result_key];
|
||||||
if (result) {
|
// if (result) {
|
||||||
jverify.getToken().then((map) {
|
// jverify.getToken().then((map) {
|
||||||
final int code = map[f_code_key];
|
// final int code = map[f_code_key];
|
||||||
final String token = map[f_msg_key];
|
// final String token = map[f_msg_key];
|
||||||
final String operator = map[f_opr_key];
|
// final String operator = map[f_opr_key];
|
||||||
AppLog.log('getToken code:$code token:$token operator:$operator');
|
// AppLog.log('getToken code:$code token:$token operator:$operator');
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
AppLog.log('[2016],msg = 当前网络环境不支持认证');
|
// AppLog.log('[2016],msg = 当前网络环境不支持认证');
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// 登录预取号
|
/// 登录预取号
|
||||||
void preLogin() {
|
Future<bool> preLogin() async {
|
||||||
jverify.checkVerifyEnable().then((map) {
|
final networkSupportVerify = await this.checkVerifyEnable();
|
||||||
final bool result = map[f_result_key];
|
if (!networkSupportVerify) {
|
||||||
if (result) {
|
return false;
|
||||||
jverify.preLogin().then((map) {
|
}
|
||||||
AppLog.log('预取号接口回调:${map.toString()}');
|
final Map map = await jverify.preLogin();
|
||||||
final int code = map[f_code_key];
|
final int code = map[f_code_key];
|
||||||
final String message = map[f_msg_key];
|
final String message = map[f_msg_key];
|
||||||
});
|
if (code > 0) {
|
||||||
} else {
|
return true;
|
||||||
AppLog.log('[2016],msg = 当前网络环境不支持认证');
|
}
|
||||||
}
|
AppLog.log('[2016],msg = 当前网络环境不支持认证');
|
||||||
});
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SDK 请求授权一键登录
|
/// SDK 请求授权一键登录
|
||||||
|
|||||||
@ -62,7 +62,7 @@ class _LoginInputState extends State<LoginInput> {
|
|||||||
|
|
||||||
Widget androidView() {
|
Widget androidView() {
|
||||||
bool isPwd = widget.isPwd ?? false;
|
bool isPwd = widget.isPwd ?? false;
|
||||||
String pwd = (widget.controller?.text ?? '').replaceAll(RegExp(r'.'), '●');
|
// String pwd = (widget.controller?.text ?? '').replaceAll(RegExp(r'.'), '●');
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(bottom: BorderSide(width: 0.5.h, color: Colors.grey)),
|
border: Border(bottom: BorderSide(width: 0.5.h, color: Colors.grey)),
|
||||||
@ -95,14 +95,10 @@ class _LoginInputState extends State<LoginInput> {
|
|||||||
inputFormatters: widget.inputFormatters,
|
inputFormatters: widget.inputFormatters,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
keyboardType: isPwd ? TextInputType.emailAddress : null,
|
keyboardType: isPwd ? TextInputType.emailAddress : null,
|
||||||
style: isPwd
|
style: TextStyle(
|
||||||
? TextStyle(
|
|
||||||
fontSize: 22.sp,
|
fontSize: 22.sp,
|
||||||
color: Colors.transparent,
|
|
||||||
letterSpacing: 2.5,
|
letterSpacing: 2.5,
|
||||||
fontFamily: 'Monospace',
|
),
|
||||||
)
|
|
||||||
: null,
|
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
//输入里面输入文字内边距设置
|
//输入里面输入文字内边距设置
|
||||||
contentPadding: const EdgeInsets.only(
|
contentPadding: const EdgeInsets.only(
|
||||||
@ -122,20 +118,20 @@ class _LoginInputState extends State<LoginInput> {
|
|||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (isPwd)
|
// if (isPwd)
|
||||||
Padding(
|
// Padding(
|
||||||
padding: EdgeInsets.only(
|
// padding: EdgeInsets.only(
|
||||||
top: F.sw(skyCall: () => 27.h, xhjCall: () => widget.isLogin! ? 27.h : 39.h)),
|
// top: F.sw(skyCall: () => 27.h, xhjCall: () => widget.isLogin! ? 27.h : 39.h)),
|
||||||
child: Text(
|
// child: Text(
|
||||||
pwd,
|
// pwd,
|
||||||
style: TextStyle(
|
// style: TextStyle(
|
||||||
fontSize: 22.sp,
|
// fontSize: 22.sp,
|
||||||
color: AppColors.darkGrayTextColor,
|
// color: AppColors.darkGrayTextColor,
|
||||||
letterSpacing: 2.0,
|
// letterSpacing: 2.0,
|
||||||
fontFamily: 'Monospace',
|
// fontFamily: 'Monospace',
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user