1,推送在登录后初始化
2,授权管理员页面更新时间格式
This commit is contained in:
parent
b47f8423df
commit
9e193f4e4a
@ -18,8 +18,8 @@
|
|||||||
- (BOOL)application:(UIApplication *)application
|
- (BOOL)application:(UIApplication *)application
|
||||||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||||
|
|
||||||
[self initCloudPush];
|
// [self initCloudPush];
|
||||||
[CloudPushSDK sendNotificationAck:launchOptions];
|
// [CloudPushSDK sendNotificationAck:launchOptions];
|
||||||
XSFlutterManager *VC = [[XSFlutterManager alloc] init];
|
XSFlutterManager *VC = [[XSFlutterManager alloc] init];
|
||||||
self.window.rootViewController = VC;
|
self.window.rootViewController = VC;
|
||||||
[self.window makeKeyAndVisible];
|
[self.window makeKeyAndVisible];
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'package:aliyun_push/aliyun_push.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
@ -8,8 +7,6 @@ import 'package:permission_handler/permission_handler.dart';
|
|||||||
import 'package:star_lock/tools/app_manager.dart';
|
import 'package:star_lock/tools/app_manager.dart';
|
||||||
import 'package:star_lock/tools/bindings/app_binding.dart';
|
import 'package:star_lock/tools/bindings/app_binding.dart';
|
||||||
|
|
||||||
import 'package:star_lock/tools/storage.dart';
|
|
||||||
import 'package:star_lock/tools/xs_aliyunPush.dart';
|
|
||||||
import 'package:star_lock/translations/app_dept.dart';
|
import 'package:star_lock/translations/app_dept.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
@ -17,7 +14,6 @@ import 'appRouters.dart';
|
|||||||
import 'baseWidget.dart';
|
import 'baseWidget.dart';
|
||||||
import 'tools/appRouteObserver.dart';
|
import 'tools/appRouteObserver.dart';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
|
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
const MyApp({GlobalKey? key}) : super(key: key);
|
const MyApp({GlobalKey? key}) : super(key: key);
|
||||||
@ -50,7 +46,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
|||||||
localeResolutionCallback: (locale, supportedLocales) {
|
localeResolutionCallback: (locale, supportedLocales) {
|
||||||
if (!supportedLocales.contains(locale)) {
|
if (!supportedLocales.contains(locale)) {
|
||||||
int idx = appSupportedLocales.indexWhere(
|
int idx = appSupportedLocales.indexWhere(
|
||||||
(element) => element.languageCode == locale!.languageCode);
|
(element) => element.languageCode == locale!.languageCode);
|
||||||
if (idx != -1) {
|
if (idx != -1) {
|
||||||
locale = appSupportedLocales[idx];
|
locale = appSupportedLocales[idx];
|
||||||
} else {
|
} else {
|
||||||
@ -70,12 +66,12 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
|||||||
backgroundColor: const Color(0xFFF6F6F6),
|
backgroundColor: const Color(0xFFF6F6F6),
|
||||||
primaryColor: const Color(0xFFFFFFFF),
|
primaryColor: const Color(0xFFFFFFFF),
|
||||||
textTheme: TextTheme(
|
textTheme: TextTheme(
|
||||||
//用在非Material组件上的文字显示,
|
//用在非Material组件上的文字显示,
|
||||||
bodyText1:
|
bodyText1:
|
||||||
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
|
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
|
||||||
//Material组件上的文字显示
|
//Material组件上的文字显示
|
||||||
bodyText2:
|
bodyText2:
|
||||||
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
|
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
|
||||||
button: TextStyle(fontSize: 28.sp)),
|
button: TextStyle(fontSize: 28.sp)),
|
||||||
iconTheme: IconThemeData(size: 28.sp, color: const Color(0xff2E2B2B)),
|
iconTheme: IconThemeData(size: 28.sp, color: const Color(0xff2E2B2B)),
|
||||||
appBarTheme: AppBarTheme(
|
appBarTheme: AppBarTheme(
|
||||||
@ -103,29 +99,6 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
|||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
|
||||||
// openBlueScan();
|
// openBlueScan();
|
||||||
|
|
||||||
initAliyunPush();
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化阿里云推送
|
|
||||||
void initAliyunPush() {
|
|
||||||
final aliyunPush = AliyunPush();
|
|
||||||
XSAliyunPushProvider().init(aliyunPush);
|
|
||||||
XSAliyunPushProvider().initAliyunPush();
|
|
||||||
|
|
||||||
if (Platform.isAndroid) {
|
|
||||||
XSAliyunPushProvider().initAliyunThirdPush();
|
|
||||||
}
|
|
||||||
|
|
||||||
//暂使用DeviceID推送
|
|
||||||
aliyunPush.getDeviceId().then((deviceId) async {
|
|
||||||
// print('得到的DeviceId$deviceId');
|
|
||||||
final data = await Storage.getString(saveUserLoginData);
|
|
||||||
if (data!.isNotEmpty && deviceId.isNotEmpty) {
|
|
||||||
XSAliyunPushProvider()
|
|
||||||
.pushBindDeviceID(deviceId, Platform.isAndroid ? 10 : 20);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -135,7 +108,6 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void openBlueScan() {
|
void openBlueScan() {
|
||||||
if (Platform.isIOS) {
|
if (Platform.isIOS) {
|
||||||
print("有蓝牙权限开始扫描");
|
print("有蓝牙权限开始扫描");
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:aliyun_push/aliyun_push.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
import 'package:star_lock/tools/submitBtn.dart';
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
|
import 'package:star_lock/tools/xs_aliyunPush.dart';
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
import '../../../baseWidget.dart';
|
import '../../../baseWidget.dart';
|
||||||
@ -29,8 +33,8 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
final logic = Get.put(LockMainLogic());
|
final logic = Get.put(LockMainLogic());
|
||||||
final state = Get.find<LockMainLogic>().state;
|
final state = Get.find<LockMainLogic>().state;
|
||||||
|
|
||||||
void getHttpData(){
|
void getHttpData() {
|
||||||
logic.getStarLockInfo().then((LockListInfoEntity value){
|
logic.getStarLockInfo().then((LockListInfoEntity value) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -40,6 +44,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
getHttpData();
|
getHttpData();
|
||||||
|
initAliyunPush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -92,12 +97,11 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
// },
|
// },
|
||||||
// ),
|
// ),
|
||||||
body: EasyRefreshTool(
|
body: EasyRefreshTool(
|
||||||
onRefresh: (){
|
onRefresh: () {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
getHttpData();
|
getHttpData();
|
||||||
},
|
},
|
||||||
child: Obx(() => getDataReturnUI(state.dataLength.value))
|
child: Obx(() => getDataReturnUI(state.dataLength.value))),
|
||||||
),
|
|
||||||
// body:smartRefresher(
|
// body:smartRefresher(
|
||||||
// logic.refreshController,
|
// logic.refreshController,
|
||||||
// onRefresh:logic.onRefresh,
|
// onRefresh:logic.onRefresh,
|
||||||
@ -118,12 +122,16 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
case 1:
|
case 1:
|
||||||
// 只有一条数据
|
// 只有一条数据
|
||||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||||
returnWidget = LockDetailPage(isOnlyOneData: true, lockListInfoItemEntity: state.lockListInfoEntity.value.data!.groupList![0].lockList![0]);
|
returnWidget = LockDetailPage(
|
||||||
|
isOnlyOneData: true,
|
||||||
|
lockListInfoItemEntity: state
|
||||||
|
.lockListInfoEntity.value.data!.groupList![0].lockList![0]);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// 有多条数据
|
// 有多条数据
|
||||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||||
returnWidget = LockListPage(lockListInfoGroupEntity: state.lockListInfoEntity.value.data!);
|
returnWidget = LockListPage(
|
||||||
|
lockListInfoGroupEntity: state.lockListInfoEntity.value.data!);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
returnWidget = NoData();
|
returnWidget = NoData();
|
||||||
@ -179,13 +187,13 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
Container(
|
Container(
|
||||||
// padding: EdgeInsets.all(30.w),
|
// padding: EdgeInsets.all(30.w),
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationLoader
|
TranslationLoader
|
||||||
.lanKeys!.whenAddingLockThePhoneMustBeNextToTheLock!.tr,
|
.lanKeys!.whenAddingLockThePhoneMustBeNextToTheLock!.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 26.sp,
|
fontSize: 26.sp,
|
||||||
// fontWeight: FontWeight.w800,
|
// fontWeight: FontWeight.w800,
|
||||||
color: Colors.black),
|
color: Colors.black),
|
||||||
)),
|
)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 160.h,
|
height: 160.h,
|
||||||
),
|
),
|
||||||
@ -204,4 +212,25 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
void onShow() {}
|
void onShow() {}
|
||||||
|
|
||||||
void onHide() {}
|
void onHide() {}
|
||||||
|
|
||||||
|
//初始化阿里云推送
|
||||||
|
void initAliyunPush() {
|
||||||
|
final aliyunPush = AliyunPush();
|
||||||
|
XSAliyunPushProvider().init(aliyunPush);
|
||||||
|
XSAliyunPushProvider().initAliyunPush();
|
||||||
|
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
XSAliyunPushProvider().initAliyunThirdPush();
|
||||||
|
}
|
||||||
|
|
||||||
|
//暂使用DeviceID推送
|
||||||
|
aliyunPush.getDeviceId().then((deviceId) async {
|
||||||
|
// print('得到的DeviceId$deviceId');
|
||||||
|
final data = await Storage.getString(saveUserLoginData);
|
||||||
|
if (data!.isNotEmpty && deviceId.isNotEmpty) {
|
||||||
|
XSAliyunPushProvider()
|
||||||
|
.pushBindDeviceID(deviceId, Platform.isAndroid ? 10 : 20);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,9 +16,9 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController {
|
|||||||
String getEffectiveDateTime = '0';
|
String getEffectiveDateTime = '0';
|
||||||
if (state.tabController!.index == 1) {
|
if (state.tabController!.index == 1) {
|
||||||
getFailureDateTime =
|
getFailureDateTime =
|
||||||
state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
state.failureDate.value.millisecondsSinceEpoch.toString();
|
||||||
getEffectiveDateTime =
|
getEffectiveDateTime =
|
||||||
state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
|
state.effectiveDate.value.millisecondsSinceEpoch.toString();
|
||||||
}
|
}
|
||||||
var entity = await ApiRepository.to.addAuthorizedAdmin(
|
var entity = await ApiRepository.to.addAuthorizedAdmin(
|
||||||
state.isCreateUser.value ? "1" : "0",
|
state.isCreateUser.value ? "1" : "0",
|
||||||
|
|||||||
@ -329,11 +329,11 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.effectiveDateTime.value = XSDateUtils.parseDateTime(
|
state.effectiveDate.value = XSDateUtils.parseDateTime(
|
||||||
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
||||||
'yyyy-mm-dd HH:mm');
|
'yyyy-mm-dd HH:mm');
|
||||||
state.selectEffectiveDate.value = XSDateUtils.formatDateTime(
|
state.selectEffectiveDate.value = XSDateUtils.formatDateTime(
|
||||||
state.effectiveDateTime.value, 'yyyy-mm-dd HH:mm');
|
state.effectiveDate.value, 'yyyy-mm-dd HH:mm');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -345,11 +345,11 @@ class _AddAuthorizedAdministratorPageState
|
|||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.failureDateTime.value = XSDateUtils.parseDateTime(
|
state.failureDate.value = XSDateUtils.parseDateTime(
|
||||||
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
|
||||||
'yyyy-mm-dd HH:mm');
|
'yyyy-mm-dd HH:mm');
|
||||||
state.selectFailureDate.value = XSDateUtils.formatDateTime(
|
state.selectFailureDate.value = XSDateUtils.formatDateTime(
|
||||||
state.failureDateTime.value, 'yyyy-mm-dd HH:mm');
|
state.failureDate.value, 'yyyy-mm-dd HH:mm');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user