Merge branch 'optimized_startup_wei' into develop

# Conflicts:
#	lan/lan_en.json
#	lan/lan_keys.json
#	lan/lan_zh.json
This commit is contained in:
魏少阳 2024-09-13 14:59:55 +08:00
commit baad7fdea0
17 changed files with 175 additions and 87 deletions

View File

@ -912,4 +912,6 @@
"支持的国家值":"United States, Canada, United Kingdom, Germany, France, Italy, Spain, Australia, New Zealand, India, Japan",
"操作流程": "Operation process",
"操作流程值": "1. Open the Alexa app and search for the Skye Smart Lock skill\n2. Click Enable Skill and log in to your Skye account\n3. Say 'Alexa, discover devices' to Alexa\n4. After discovering the device, you can use the voice command to control the lock"
"秒内不可使用面容开锁": "Face unlocking cannot be used within seconds",
"密码需至少包含数字/字母/字符中的2种组合": "The password must contain at least 2 combinations of numbers/letters/characters"
}

View File

@ -948,4 +948,7 @@
"支持的国家值":"支持的国家值",
"操作流程":"操作流程",
"操作流程值":"操作流程值"
"秒内不可使用面容开锁": "秒内不可使用面容开锁",
"密码需至少包含数字/字母/字符中的2种组合": "密码需至少包含数字/字母/字符中的2种组合"
}

View File

@ -908,4 +908,8 @@
"支持的国家值": "美国、加拿大、英国、澳大利亚、印度、德国、法国、意大利、西班牙、日本",
"操作流程": "操作流程",
"操作流程值":"1 用智能锁APP添加锁和网关\n\n2 在APP里开启锁的远程开锁功能这个功能默认是关闭的。如果没有这个选项则锁不支持Alexa \n\n3 在Alexa中添加Skill并用智能锁APP的账号和密码进行授权。授权成功后就可以发现账号下的设备\n\n4 在Alexa app里找到锁开启语音开锁的功能并设置语言密码\n\n5 可以通过Alexa操作锁了"
"秒内不可使用面容开锁": "秒内不可使用面容开锁",
"密码需至少包含数字/字母/字符中的2种组合": "密码需至少包含数字/字母/字符中的2种组合"
}

View File

@ -2,12 +2,14 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_state.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/login/register/entity/SendValidationCodeEntity.dart';
import '../../network/api_repository.dart';
import '../../tools/baseGetXController.dart';
import '../../tools/regularExpression.dart';
import '../../tools/showTipView.dart';
import '../register/entity/checkIP_entity.dart';
@ -33,6 +35,16 @@ class StarLockForgetPasswordLogic extends BaseGetXController {
}
Future<void> resetPassword() async {
if(state.pwd.value != state.surePwd.value){
showToast('两次密码不一致哦'.tr);
return;
}
if(!RegularExpression().validateString(state.pwd.value)){
showToast('密码需至少包含数字/字母/字符中的2种组合'.tr);
return;
}
final LoginEntity entity = await ApiRepository.to.resetPassword(
state.countryCode.value,
state.phoneStr.value,
@ -82,7 +94,6 @@ class StarLockForgetPasswordLogic extends BaseGetXController {
}else{
state.codeType.value = '1';
}
state.phoneStrIsOK.value = state.phoneStr.value.isNotEmpty;
}
if (controller == state.pwdController) {
state.pwd.value = controller.text;
@ -93,10 +104,16 @@ class StarLockForgetPasswordLogic extends BaseGetXController {
if (controller == state.codeController) {
state.verificationCode.value = controller.text;
}
_resetCanSendCode();
_resetCanSub();
AppLog.log('state.canSub.value:${state.canSub.value} state.pwdIsOK:${state.pwdIsOK} state.codeIsOK:${state.codeIsOK} state.phoneStr.value:${state.phoneStr.value}');
}
void _resetCanSub() {
state.canSub.value = state.pwdIsOK && state.codeIsOK;
state.canSub.value = state.pwdIsOK && state.codeIsOK && state.phoneStr.value.isNotEmpty;
}
void _resetCanSendCode() {
state.canSendCode.value = state.pwdIsOK && state.phoneStr.value.isNotEmpty;
}
}

View File

@ -185,7 +185,7 @@ class _StarLockForgetPasswordPageState
width: 10.w,
),
Obx(() => GestureDetector(
onTap: (state.phoneStrIsOK.value && state.canResend.value)
onTap: (state.canSendCode.value && state.canResend.value)
? () async {
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
final Object? result = await Navigator.pushNamed(
@ -204,7 +204,7 @@ class _StarLockForgetPasswordPageState
// height: 60.h,
padding: EdgeInsets.all(10.h),
decoration: BoxDecoration(
color: state.phoneStrIsOK.value
color: (state.canSendCode.value && state.canResend.value)
? AppColors.mainColor
: AppColors.btnDisableColor,
borderRadius: BorderRadius.circular(5)),

View File

@ -1,10 +1,15 @@
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../translations/trans_lib.dart';
import '../selectCountryRegion/common/index.dart';
class StarLockForgetPasswordState {
StarLockForgetPasswordState() {
resetResend();
}
final TextEditingController phoneController = TextEditingController();
final TextEditingController pwdController = TextEditingController();
final TextEditingController sureController = TextEditingController();
@ -14,30 +19,27 @@ class StarLockForgetPasswordState {
return DateTime.now().millisecondsSinceEpoch;
}
var countryCode = "86".obs;
var countryName = '中国'.tr.obs;
var codeType = '2'.obs; // 1: 2:
var pwd = ''.obs;
var surePwd = ''.obs;
var verificationCode = ''.obs;
var xWidth = ''.obs; //
var canSub = false.obs;
var phoneStr = ''.obs;
var phoneStrIsOK = false.obs;
var date = currentTimeMillis().toString().obs;
RxString countryCode = '86'.obs;
RxString countryName = '中国'.tr.obs;
RxString codeType = '2'.obs; // 1: 2:
RxString pwd = ''.obs;
RxString surePwd = ''.obs;
RxString verificationCode = ''.obs;
RxString xWidth = ''.obs; //
RxString phoneStr = ''.obs;
RxBool canSub = false.obs;//
RxBool canSendCode = false.obs;//
RxString date = currentTimeMillis().toString().obs;
// bool get isEmail => RegexUtil.isEmail(phoneStr.value);
// bool get isIphone => RegexUtil.isMobileSimple(phoneStr.value);
bool get pwdIsOK => pwd.value.isNotEmpty && (pwd.value == surePwd.value);
bool get codeIsOK => verificationCode.value.isNotEmpty;
bool get pwdIsOK => pwd.value.isNotEmpty && surePwd.value.isNotEmpty && pwd.value.length >= 8 && surePwd.value.length >= 8;
bool get codeIsOK => verificationCode.value.isNotEmpty && verificationCode.value.length >= 6;
var canResend = false.obs;
var btnText = ''.obs;
var totalSeconds = 120;
var currentSecond = 120;
StarLockForgetPasswordState() {
resetResend();
}
RxBool canResend = false.obs;//
RxString btnText = ''.obs;
int totalSeconds = 120;
int currentSecond = 120;
void resetResend() {
canResend.value = totalSeconds == currentSecond;

View File

@ -143,7 +143,7 @@ class _StarLockForgetPasswordPageState
]),
),
Obx(() => GestureDetector(
onTap: (state.phoneStrIsOK.value && state.canResend.value)
onTap: (state.canSendCode.value && state.canResend.value)
? () async {
final Object? result = await Navigator.pushNamed(
context, Routers.safetyVerificationPage,
@ -159,11 +159,16 @@ class _StarLockForgetPasswordPageState
child: Container(
width: 180.w,
padding: EdgeInsets.all(10.h),
decoration: BoxDecoration(
color: (state.canSendCode.value && state.canResend.value)
? AppColors.mainColor
: AppColors.btnDisableColor,
borderRadius: BorderRadius.circular(5)),
child: Center(
child: Text(state.btnText.value,
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.mainColor,
color: Colors.white,
fontSize: 24.sp,
)),
),

View File

@ -1,19 +1,20 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/blue/blue_manage.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/login/register/entity/SendValidationCodeEntity.dart';
import 'package:star_lock/tools/eventBusEventManage.dart';
import 'package:star_lock/tools/storage.dart';
import 'package:star_lock/tools/push/xs_jPhush.dart';
import 'package:star_lock/tools/storage.dart';
import '../../network/api_repository.dart';
import '../../tools/baseGetXController.dart';
import '../../tools/regularExpression.dart';
import '../../tools/showTipView.dart';
import 'entity/checkIP_entity.dart';
import 'starLock_register_state.dart';
@ -40,12 +41,15 @@ class StarLockRegisterLogic extends BaseGetXController {
}
Future<void> register() async {
AppLog.log(
'state.pwd.value:${state.pwd.value} state.surePwd.value:${state.surePwd.value}');
if (state.pwd.value != state.surePwd.value) {
showToast('密码不一致哦'.tr);
return;
}
if(!RegularExpression().validateString(state.pwd.value)){
showToast('密码需至少包含数字/字母/字符中的2种组合'.tr);
return;
}
final LoginEntity entity = await ApiRepository.to.register(
receiverType: state.isIphoneType.value == true ? 1 : 2,
countryCode: int.parse(state.countryCode.value),
@ -101,7 +105,6 @@ class StarLockRegisterLogic extends BaseGetXController {
void changeInput(TextEditingController controller) {
if (controller == state.phoneOrEmailController) {
state.phoneOrEmailStr.value = controller.text;
state.phoneOrEmailStrIsOK.value = state.phoneOrEmailStr.value.isNotEmpty;
}
if (controller == state.pwdController) {
state.pwd.value = controller.text;
@ -113,12 +116,17 @@ class StarLockRegisterLogic extends BaseGetXController {
state.verificationCode.value = controller.text;
}
_resetCanSub();
_resetCanSendCode();
}
//
void _resetCanSub() {
state.canSub.value = state.pwdIsOK &&
state.codeIsOK &&
(state.isIphoneType.value ? state.isIphone : state.isEmail);
state.canSub.value = state.pwdIsOK && state.codeIsOK && state.phoneOrEmailStr.value.isNotEmpty;
}
//
void _resetCanSendCode() {
state.canSendCode.value = state.pwdIsOK && state.phoneOrEmailStr.value.isNotEmpty;
}
@override

View File

@ -295,7 +295,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
),
Obx(() => GestureDetector(
onTap:
state.phoneOrEmailStrIsOK.value && state.canResend.value
(state.canSendCode.value && state.canResend.value)
? () async {
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
final Object? result = await Navigator.pushNamed(
@ -314,7 +314,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
// height: 60.h,
padding: EdgeInsets.all(10.h),
decoration: BoxDecoration(
color: state.phoneOrEmailStrIsOK.value
color: (state.canSendCode.value && state.canResend.value)
? AppColors.mainColor
: Colors.grey,
borderRadius: BorderRadius.circular(5)),

View File

@ -18,21 +18,22 @@ class StarLockRegisterState {
RxString countryName = '中国'.tr.obs;
RxString phoneOrEmailStr = ''.obs;
RxBool phoneOrEmailStrIsOK = false.obs;
// RxBool phoneOrEmailStrIsOK = false.obs;
RxString pwd = ''.obs;
RxString surePwd = ''.obs;
RxString verificationCode = ''.obs;
RxString xWidth = ''.obs; //
RxBool isIphoneType = true.obs;
RxBool canSub = false.obs;
RxBool canSub = false.obs;//
RxBool agree = false.obs;
RxBool canSendCode = false.obs;//
bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value);
bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value);
bool get pwdIsOK => pwd.value.isNotEmpty && surePwd.value.isNotEmpty;
bool get codeIsOK => verificationCode.value.isNotEmpty;
// bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value);
// bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value);
bool get pwdIsOK => pwd.value.isNotEmpty && surePwd.value.isNotEmpty && pwd.value.length >= 8 && surePwd.value.length >= 8;
bool get codeIsOK => verificationCode.value.isNotEmpty && verificationCode.value.length >= 6 ;
RxBool canResend = false.obs;
RxBool canResend = false.obs;//
RxString btnText = ''.obs;
int totalSeconds = 120;
int currentSecond = 120;

View File

@ -195,7 +195,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
),
Obx(() => GestureDetector(
onTap:
state.phoneOrEmailStrIsOK.value && state.canResend.value
(state.canSendCode.value && state.canResend.value)
? () async {
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
if (state.pwd.value != state.surePwd.value) {
@ -214,13 +214,17 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
}
: null,
child: Container(
color: Colors.transparent,
padding: EdgeInsets.all(10.h),
decoration: BoxDecoration(
color: (state.canSendCode.value && state.canResend.value)
? AppColors.mainColor
: AppColors.btnDisableColor,
borderRadius: BorderRadius.circular(5)),
child: Center(
child: Text(state.btnText.value,
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.mainColor,
color: Colors.white,
fontSize: 22.sp,
)),
),

View File

@ -2,35 +2,48 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_state.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../tools/regularExpression.dart';
class MinePersonInfoResetPasswordLogic extends BaseGetXController {
final MinePersonInfoResetPasswordState state = MinePersonInfoResetPasswordState();
void changePasswordRequest() async {
if(state.newPwd.value.length < 8){
showToast("新密码长度不足8位");
Future<void> changePasswordRequest() async {
// if(state.newPwd.value.length < 8){
// showToast('新密码长度不足8位');
// return;
// }
//
// if(state.surePwd.value.length < 8){
// showToast('确认长度不足8位');
// return;
// }
//
// if(state.surePwd.value != state.newPwd.value){
// showToast('两次密码不一致');
// return;
// }
if(state.newPwd.value != state.surePwd.value){
showToast('两次密码不一致哦'.tr);
return;
}
if(state.surePwd.value.length < 8){
showToast("确认长度不足8位");
if(!RegularExpression().validateString(state.newPwd.value)){
showToast('密码需至少包含数字/字母/字符中的2种组合'.tr);
return;
}
if(state.surePwd.value != state.newPwd.value){
showToast("两次密码不一致");
return;
}
var entity = await ApiRepository.to.changePassword(
final LoginEntity entity = await ApiRepository.to.changePassword(
state.date.value,
state.surePwd.value,
state.oldPwd.value);
if (entity.errorCode!.codeIsSuccessful) {
showToast("重置成功");
showToast('重置成功');
Get.back();
}
}
@ -53,6 +66,6 @@ class MinePersonInfoResetPasswordLogic extends BaseGetXController {
}
void _resetCanSub() {
state.canSub.value = state.oldPwdIsOK && state.newPwdIsOK;
state.canSub.value = state.oldPwdIsOK && state.newPwdIsOK && state.surePwdIsOK;
}
}

View File

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_logic.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_state.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart';
@ -22,8 +23,8 @@ class MinePersonInfoResetPasswordPage extends StatefulWidget {
class _MinePersonInfoResetPasswordPageState
extends State<MinePersonInfoResetPasswordPage> {
final logic = Get.put(MinePersonInfoResetPasswordLogic());
final state = Get.find<MinePersonInfoResetPasswordLogic>().state;
final MinePersonInfoResetPasswordLogic logic = Get.put(MinePersonInfoResetPasswordLogic());
final MinePersonInfoResetPasswordState state = Get.find<MinePersonInfoResetPasswordLogic>().state;
@override
Widget build(BuildContext context) {
@ -46,7 +47,7 @@ class _MinePersonInfoResetPasswordPageState
body: Container(
margin: EdgeInsets.only(left: 30.w, right: 30.w),
child: Column(
children: [
children: <Widget>[
loginView(),
SizedBox(height: 50.w),
Obx(() => SubmitBtn(
@ -61,7 +62,7 @@ class _MinePersonInfoResetPasswordPageState
SizedBox(height: 40.w),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: <Widget>[
GestureDetector(
child: SizedBox(
// width: 150.w,
@ -87,7 +88,7 @@ class _MinePersonInfoResetPasswordPageState
Widget loginView() {
Widget view = Column(
children: [
children: <Widget>[
LoginInput(
controller: state.oldPwdController,
onchangeAction: (textStr) {
@ -99,7 +100,8 @@ class _MinePersonInfoResetPasswordPageState
style: TextStyle(fontSize: 22.sp),
),
hintText: '',
inputFormatters: [
isLogin: true,
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
LoginInput(
@ -113,7 +115,8 @@ class _MinePersonInfoResetPasswordPageState
style: TextStyle(fontSize: 22.sp),
),
hintText: '',
inputFormatters: [
isLogin: true,
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
LoginInput(
@ -128,7 +131,8 @@ class _MinePersonInfoResetPasswordPageState
style: TextStyle(fontSize: 22.sp),
),
hintText: '',
inputFormatters: [
isLogin: true,
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
Container(

View File

@ -10,15 +10,15 @@ class MinePersonInfoResetPasswordState {
return DateTime.now().millisecondsSinceEpoch;
}
var oldPwd = ''.obs;
var newPwd = ''.obs;
var surePwd = ''.obs;
var canSub = false.obs;
var date = currentTimeMillis().toString().obs;
RxString oldPwd = ''.obs;
RxString newPwd = ''.obs;
RxString surePwd = ''.obs;
RxBool canSub = false.obs;
RxString date = currentTimeMillis().toString().obs;
bool get oldPwdIsOK => oldPwd.value.isNotEmpty;
bool get newPwdIsOK =>
newPwd.value.isNotEmpty && (newPwd.value == surePwd.value);
bool get oldPwdIsOK => oldPwd.value.isNotEmpty && oldPwd.value.length >= 8;
bool get newPwdIsOK => newPwd.value.isNotEmpty && newPwd.value.length >= 8;
bool get surePwdIsOK => surePwd.value.isNotEmpty && surePwd.value.length >= 8;
void onClose() {}
}

View File

@ -321,15 +321,16 @@ class _MineSetPageState extends State<MineSetPage>
Navigator.pushNamed(
context, Routers.aPPUnlockNeedMobileNetworkingLockPage);
}),
CommonItem(
leftTitel: '增值服务'.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.valueAddedServicesPage);
},
),
if(!F.isSKY)
CommonItem(
leftTitel: '增值服务'.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.back();
Get.toNamed(Routers.valueAddedServicesPage);
},
),
SizedBox(
height: 10.h,
),

View File

@ -16,4 +16,26 @@ class RegularExpression {
r'https?:\/\/\S+',
caseSensitive: false,
);
//
bool validateString(String value) {
//
RegExp regExpNum = RegExp(r'\d'); //
RegExp regExpLetter = RegExp(r'[a-zA-Z]'); //
RegExp regExpSymbol = RegExp(r'[!@#\$&*~]'); //
//
bool hasNum = regExpNum.hasMatch(value);
bool hasLetter = regExpLetter.hasMatch(value);
bool hasSymbol = regExpSymbol.hasMatch(value);
//
int count = 0;
if (hasNum) count++;
if (hasLetter) count++;
if (hasSymbol) count++;
// 2true
return count >= 2;
}
}

View File

@ -28,6 +28,7 @@ class LoginInput extends StatefulWidget {
BlockStrCallback? onchangeAction;
BlockStrCallback? onSubmitted;
BlockClickCallback? onTapAction;
bool? isLogin;// false
LoginInput({
Key? key,
@ -46,6 +47,7 @@ class LoginInput extends StatefulWidget {
this.onchangeAction,
this.onTapAction,
this.onSubmitted,
this.isLogin = false,
}) : super(key: key);
@override
@ -123,7 +125,7 @@ class _LoginInputState extends State<LoginInput> {
if (isPwd)
Padding(
padding: EdgeInsets.only(
top: F.sw(skyCall: () => 27.h, xhjCall: () => 39.h)),
top: F.sw(skyCall: () => 27.h, xhjCall: () => widget.isLogin! ? 27.h : 39.h)),
child: Text(
pwd,
style: TextStyle(