1,推送在登录后初始化

2,授权管理员页面更新时间格式
This commit is contained in:
Daisy 2024-02-29 17:03:53 +08:00
parent b47f8423df
commit 9e193f4e4a
5 changed files with 55 additions and 54 deletions

View File

@ -18,8 +18,8 @@
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self initCloudPush];
[CloudPushSDK sendNotificationAck:launchOptions];
// [self initCloudPush];
// [CloudPushSDK sendNotificationAck:launchOptions];
XSFlutterManager *VC = [[XSFlutterManager alloc] init];
self.window.rootViewController = VC;
[self.window makeKeyAndVisible];

View File

@ -1,4 +1,3 @@
import 'package:aliyun_push/aliyun_push.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.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/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/trans_lib.dart';
@ -17,7 +14,6 @@ import 'appRouters.dart';
import 'baseWidget.dart';
import 'tools/appRouteObserver.dart';
import 'dart:io';
import 'package:flutter/services.dart';
class MyApp extends StatefulWidget {
const MyApp({GlobalKey? key}) : super(key: key);
@ -50,7 +46,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
localeResolutionCallback: (locale, supportedLocales) {
if (!supportedLocales.contains(locale)) {
int idx = appSupportedLocales.indexWhere(
(element) => element.languageCode == locale!.languageCode);
(element) => element.languageCode == locale!.languageCode);
if (idx != -1) {
locale = appSupportedLocales[idx];
} else {
@ -70,12 +66,12 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
backgroundColor: const Color(0xFFF6F6F6),
primaryColor: const Color(0xFFFFFFFF),
textTheme: TextTheme(
//Material组件上的文字显示,
//Material组件上的文字显示,
bodyText1:
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
//Material组件上的文字显示
bodyText2:
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
TextStyle(fontSize: 28.sp, color: const Color(0xff2E2B2B)),
button: TextStyle(fontSize: 28.sp)),
iconTheme: IconThemeData(size: 28.sp, color: const Color(0xff2E2B2B)),
appBarTheme: AppBarTheme(
@ -103,29 +99,6 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
WidgetsBinding.instance.addObserver(this);
// 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
@ -135,7 +108,6 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
}
}
void openBlueScan() {
if (Platform.isIOS) {
print("有蓝牙权限开始扫描");

View File

@ -1,9 +1,13 @@
import 'dart:io';
import 'package:aliyun_push/aliyun_push.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/tools/noData.dart';
import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/tools/xs_aliyunPush.dart';
import '../../../appRouters.dart';
import '../../../baseWidget.dart';
@ -29,8 +33,8 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
final logic = Get.put(LockMainLogic());
final state = Get.find<LockMainLogic>().state;
void getHttpData(){
logic.getStarLockInfo().then((LockListInfoEntity value){
void getHttpData() {
logic.getStarLockInfo().then((LockListInfoEntity value) {
setState(() {});
});
}
@ -40,6 +44,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
super.initState();
getHttpData();
initAliyunPush();
}
@override
@ -92,12 +97,11 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
// },
// ),
body: EasyRefreshTool(
onRefresh: (){
onRefresh: () {
logic.pageNo = 1;
getHttpData();
},
child: Obx(() => getDataReturnUI(state.dataLength.value))
),
child: Obx(() => getDataReturnUI(state.dataLength.value))),
// body:smartRefresher(
// logic.refreshController,
// onRefresh:logic.onRefresh,
@ -118,12 +122,16 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
case 1:
//
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;
case 2:
//
Storage.setBool(ifIsDemoModeOrNot, false);
returnWidget = LockListPage(lockListInfoGroupEntity: state.lockListInfoEntity.value.data!);
returnWidget = LockListPage(
lockListInfoGroupEntity: state.lockListInfoEntity.value.data!);
break;
default:
returnWidget = NoData();
@ -179,13 +187,13 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
Container(
// padding: EdgeInsets.all(30.w),
child: Text(
TranslationLoader
.lanKeys!.whenAddingLockThePhoneMustBeNextToTheLock!.tr,
style: TextStyle(
fontSize: 26.sp,
// fontWeight: FontWeight.w800,
color: Colors.black),
)),
TranslationLoader
.lanKeys!.whenAddingLockThePhoneMustBeNextToTheLock!.tr,
style: TextStyle(
fontSize: 26.sp,
// fontWeight: FontWeight.w800,
color: Colors.black),
)),
SizedBox(
height: 160.h,
),
@ -204,4 +212,25 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
void onShow() {}
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);
}
});
}
}

View File

@ -16,9 +16,9 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController {
String getEffectiveDateTime = '0';
if (state.tabController!.index == 1) {
getFailureDateTime =
state.failureDateTime.value.millisecondsSinceEpoch.toString();
state.failureDate.value.millisecondsSinceEpoch.toString();
getEffectiveDateTime =
state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
state.effectiveDate.value.millisecondsSinceEpoch.toString();
}
var entity = await ApiRepository.to.addAuthorizedAdmin(
state.isCreateUser.value ? "1" : "0",

View File

@ -329,11 +329,11 @@ class _AddAuthorizedAdministratorPageState
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
setState(() {
state.effectiveDateTime.value = XSDateUtils.parseDateTime(
state.effectiveDate.value = XSDateUtils.parseDateTime(
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
'yyyy-mm-dd HH:mm');
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,
onConfirm: (p) {
setState(() {
state.failureDateTime.value = XSDateUtils.parseDateTime(
state.failureDate.value = XSDateUtils.parseDateTime(
'${p.year}-${p.month!}-${p.day} ${p.hour!}:${p.minute!}',
'yyyy-mm-dd HH:mm');
state.selectFailureDate.value = XSDateUtils.formatDateTime(
state.failureDateTime.value, 'yyyy-mm-dd HH:mm');
state.failureDate.value, 'yyyy-mm-dd HH:mm');
});
});
}),