diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 51ba474..deaae93 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -380,10 +380,11 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.akucommunity.akuCommunityManager; + PRODUCT_BUNDLE_IDENTIFIER = com.akucommunity.manage; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; @@ -509,11 +510,12 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.akucommunity.akuCommunityManager; + PRODUCT_BUNDLE_IDENTIFIER = com.akucommunity.manage; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -532,10 +534,11 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.akucommunity.akuCommunityManager; + PRODUCT_BUNDLE_IDENTIFIER = com.akucommunity.manage; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 5674c24..3656f35 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -4,34 +4,6 @@ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) - NSContactsUsageDescription - we need contact access rights. - NSCalendarsUsageDescription - we need calendar access rights. - NSPhotoLibraryAddUsageDescription - we need photo access rights. - NSBluetoothPeripheralUsageDescription - we need bluetooth access rights - NSBluetoothAlwaysUsageDescription - we need bluetooth access rights - NSPhotoLibraryUsageDescription - we need photo access rights. - NSCameraUsageDescription - we need camera access rights. - NSAppleMusicUsageDescription - we need music access rights. - NSMotionUsageDescription - we need motion access rights. - NSSpeechRecognitionUsageDescription - we need speech recognition access rights. - NSLocationAlwaysUsageDescription - we need location access rights. - NSLocationAlwaysAndWhenInUseUsageDescription - we need location access rights. - NSLocationWhenInUseUsageDescription - we need location access rights. - CFBundleName - bee CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -50,6 +22,37 @@ $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + NSAppleMusicUsageDescription + we need music access rights. + NSBluetoothAlwaysUsageDescription + we need bluetooth access rights + NSBluetoothPeripheralUsageDescription + we need bluetooth access rights + NSCalendarsUsageDescription + we need calendar access rights. + NSCameraUsageDescription + we need camera access rights. + NSContactsUsageDescription + we need contact access rights. + NSLocationAlwaysAndWhenInUseUsageDescription + we need location access rights. + NSLocationAlwaysUsageDescription + we need location access rights. + NSLocationWhenInUseUsageDescription + we need location access rights. + NSMotionUsageDescription + we need motion access rights. + NSPhotoLibraryAddUsageDescription + we need photo access rights. + NSPhotoLibraryUsageDescription + we need photo access rights. + NSSpeechRecognitionUsageDescription + we need speech recognition access rights. UILaunchStoryboardName LaunchScreen UIMainStoryboardFile @@ -69,10 +72,5 @@ UIViewControllerBasedStatusBarAppearance - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index 3c65e37..19c983d 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -1,26 +1,24 @@ // Dart imports: import 'dart:io'; +// Project imports: +import 'package:aku_community_manager/const/api.dart'; // Flutter imports: import 'package:aku_community_manager/models/user/user_info_model.dart'; +import 'package:aku_community_manager/models/user/user_profile_model.dart'; import 'package:aku_community_manager/provider/message_provider.dart'; +import 'package:aku_community_manager/utils/hive_store.dart'; +import 'package:aku_community_manager/utils/network/base_file_model.dart'; +import 'package:aku_community_manager/utils/network/base_model.dart'; +import 'package:aku_community_manager/utils/network/net_util.dart'; import 'package:aku_community_manager/utils/websocket/web_socket_util.dart'; -import 'package:flutter/material.dart'; - // Package imports: import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:jpush_flutter/jpush_flutter.dart'; import 'package:provider/provider.dart'; -// Project imports: -import 'package:aku_community_manager/const/api.dart'; -import 'package:aku_community_manager/models/user/user_profile_model.dart'; -import 'package:aku_community_manager/utils/hive_store.dart'; -import 'package:aku_community_manager/utils/network/base_file_model.dart'; -import 'package:aku_community_manager/utils/network/base_model.dart'; -import 'package:aku_community_manager/utils/network/net_util.dart'; - //登录状态管理 class UserProvider extends ChangeNotifier { bool _isLogin = false; @@ -36,7 +34,7 @@ class UserProvider extends ChangeNotifier { _profileModel = await updateProfile(); _infoModel = await updateUserInfo(); if (isLogin) { - WebSocketUtil().setUser(infoModel!.id.toString()); + WebSocketUtil().setUser(_infoModel?.id.toString() ?? ''); WebSocketUtil().startWebSocket(); } // await setCurrentHouse((_userDetailModel?.estateNames?.isEmpty ?? true) @@ -46,8 +44,10 @@ class UserProvider extends ChangeNotifier { } UserProfileModel? _profileModel; + UserProfileModel? get profileModel => _profileModel; UserInfoModel? _infoModel; + UserInfoModel? get infoModel => _infoModel; ///更新用户profile diff --git a/lib/ui/login/login_page.dart b/lib/ui/login/login_page.dart index 6837bc7..b07030a 100644 --- a/lib/ui/login/login_page.dart +++ b/lib/ui/login/login_page.dart @@ -1,25 +1,20 @@ // Dart imports: import 'dart:ui'; -// Flutter imports: -import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:common_utils/common_utils.dart'; -import 'package:extended_text/extended_text.dart'; -import 'package:get/route_manager.dart'; - // Project imports: import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/tools/widget_tool.dart'; -import 'package:aku_community_manager/ui/agreements/agreement_page.dart'; -import 'package:aku_community_manager/ui/agreements/privacy_page.dart'; import 'package:aku_community_manager/ui/login/login_sms_page.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_back_button.dart'; +// Flutter imports: +import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +// Package imports: +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:get/route_manager.dart'; class LoginPage extends StatefulWidget { LoginPage({Key? key}) : super(key: key); @@ -139,58 +134,58 @@ class _LoginPageState extends State { ), ], ), - bottom: Container( - height: 110.w, - alignment: Alignment.center, - padding: EdgeInsets.symmetric(vertical: 40.w), - child: ExtendedText.rich( - TextSpan( - style: TextStyle( - color: AppStyle.minorTextColor, - fontSize: 22.sp, - ), - children: [ - TextSpan( - text: '登录即代表您已同意我们的', - ), - ExtendedWidgetSpan( - child: GestureDetector( - onTap: () { - Get.to(() => AgreementPage()); - }, - child: Text( - '《服务协议》', - style: TextStyle( - color: AppStyle.secondaryColor, - fontSize: 22.sp, - ), - ), - ), - ), - TextSpan( - text: '和', - ), - ExtendedWidgetSpan( - child: GestureDetector( - onTap: () { - Get.to(() => PrivacyPage()); - }, - child: Text( - '《隐私政策》', - style: TextStyle( - color: AppStyle.secondaryColor, - fontSize: 22.sp, - ), - ), - ), - ), - TextSpan( - text: '', - ), - ], - ), - ), - ), + // bottom: Container( + // height: 110.w, + // alignment: Alignment.center, + // padding: EdgeInsets.symmetric(vertical: 40.w), + // child: ExtendedText.rich( + // TextSpan( + // style: TextStyle( + // color: AppStyle.minorTextColor, + // fontSize: 22.sp, + // ), + // children: [ + // TextSpan( + // text: '登录即代表您已同意我们的', + // ), + // ExtendedWidgetSpan( + // child: GestureDetector( + // onTap: () { + // Get.to(() => AgreementPage()); + // }, + // child: Text( + // '《服务协议》', + // style: TextStyle( + // color: AppStyle.secondaryColor, + // fontSize: 22.sp, + // ), + // ), + // ), + // ), + // TextSpan( + // text: '和', + // ), + // ExtendedWidgetSpan( + // child: GestureDetector( + // onTap: () { + // Get.to(() => PrivacyPage()); + // }, + // child: Text( + // '《隐私政策》', + // style: TextStyle( + // color: AppStyle.secondaryColor, + // fontSize: 22.sp, + // ), + // ), + // ), + // ), + // TextSpan( + // text: '', + // ), + // ], + // ), + // ), + // ), ); } } diff --git a/lib/ui/manage_pages/engineer_repair/engineer_repair_card.dart b/lib/ui/manage_pages/engineer_repair/engineer_repair_card.dart index 3e82988..7a02336 100644 --- a/lib/ui/manage_pages/engineer_repair/engineer_repair_card.dart +++ b/lib/ui/manage_pages/engineer_repair/engineer_repair_card.dart @@ -213,6 +213,8 @@ class EngineerRepairCard extends StatelessWidget { AkuMaterialButton( height: 64.w, onPressed: () async { + await Get.to( + () => EngineerRepairDetailPage(repairEngineerId: model.id)); callRefresh(); }, radius: 4, @@ -301,6 +303,8 @@ class EngineerRepairCard extends StatelessWidget { AkuMaterialButton( height: 64.w, onPressed: () async { + await Get.to( + () => EngineerRepairDetailPage(repairEngineerId: model.id)); callRefresh(); }, radius: 4, diff --git a/lib/ui/manage_pages/facilities/facilities_page.dart b/lib/ui/manage_pages/facilities/facilities_page.dart index 79176e9..2284bda 100644 --- a/lib/ui/manage_pages/facilities/facilities_page.dart +++ b/lib/ui/manage_pages/facilities/facilities_page.dart @@ -1,16 +1,15 @@ // Flutter imports: import 'package:aku_community_manager/ui/manage_pages/facilities/facilities_view.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_screenutil/flutter_screenutil.dart'; - // Project imports: import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:flutter_screenutil/flutter_screenutil.dart'; class FacilitiesPage extends StatefulWidget { final int facilitiesType; + FacilitiesPage({Key? key, required this.facilitiesType}) : super(key: key); @override @@ -40,7 +39,7 @@ class _FacilitiesPageState extends State @override Widget build(BuildContext context) { return AkuScaffold( - title: '设施检查', + title: widget.facilitiesType == 1 ? '设施检查' : '设备检查', appBarBottom: PreferredSize( child: AkuTabBar(controller: _tabController!, tabs: _tabs), preferredSize: Size.fromHeight(88.w), diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_card.dart b/lib/ui/manage_pages/house_keeping/house_keeping_card.dart index 3c411d4..fc4b3a4 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_card.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_card.dart @@ -206,7 +206,17 @@ class HouseKeepingCard extends StatelessWidget { UserTool.userProvider.infoModel!.houseKeepingAuthority == HKAUTH.PICK ? AkuMaterialButton( height: 64.w, - onPressed: () async {}, + onPressed: () async { + List processModels = + await HouseKeepingFunc.getHouseKeepingProcess( + model.id, + ); + await Get.to(() => HouseKeepingDetailPage( + model: model, + processModels: processModels, + callRefresh: callRefresh, + )); + }, radius: 4, color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), @@ -243,7 +253,17 @@ class HouseKeepingCard extends StatelessWidget { return [ AkuMaterialButton( height: 64.w, - onPressed: () async {}, + onPressed: () async { + List processModels = + await HouseKeepingFunc.getHouseKeepingProcess( + model.id, + ); + await Get.to(() => HouseKeepingDetailPage( + model: model, + processModels: processModels, + callRefresh: callRefresh, + )); + }, radius: 4, color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), @@ -262,7 +282,17 @@ class HouseKeepingCard extends StatelessWidget { return [ AkuMaterialButton( height: 64.w, - onPressed: () async {}, + onPressed: () async { + List processModels = + await HouseKeepingFunc.getHouseKeepingProcess( + model.id, + ); + await Get.to(() => HouseKeepingDetailPage( + model: model, + processModels: processModels, + callRefresh: callRefresh, + )); + }, radius: 4, color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), @@ -281,7 +311,17 @@ class HouseKeepingCard extends StatelessWidget { return [ AkuMaterialButton( height: 64.w, - onPressed: () async {}, + onPressed: () async { + List processModels = + await HouseKeepingFunc.getHouseKeepingProcess( + model.id, + ); + await Get.to(() => HouseKeepingDetailPage( + model: model, + processModels: processModels, + callRefresh: callRefresh, + )); + }, radius: 4, color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), @@ -300,7 +340,17 @@ class HouseKeepingCard extends StatelessWidget { return [ AkuMaterialButton( height: 64.w, - onPressed: () async {}, + onPressed: () async { + List processModels = + await HouseKeepingFunc.getHouseKeepingProcess( + model.id, + ); + await Get.to(() => HouseKeepingDetailPage( + model: model, + processModels: processModels, + callRefresh: callRefresh, + )); + }, radius: 4, color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), @@ -319,7 +369,17 @@ class HouseKeepingCard extends StatelessWidget { return [ AkuMaterialButton( height: 64.w, - onPressed: () async {}, + onPressed: () async { + List processModels = + await HouseKeepingFunc.getHouseKeepingProcess( + model.id, + ); + await Get.to(() => HouseKeepingDetailPage( + model: model, + processModels: processModels, + callRefresh: callRefresh, + )); + }, radius: 4, color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), diff --git a/lib/ui/splash/splash_page.dart b/lib/ui/splash/splash_page.dart index 7f7f980..a9fc6c8 100644 --- a/lib/ui/splash/splash_page.dart +++ b/lib/ui/splash/splash_page.dart @@ -1,9 +1,20 @@ // Flutter imports: -import 'package:flutter/material.dart'; - +// Project imports: +import 'package:aku_community_manager/provider/app_provider.dart'; +import 'package:aku_community_manager/provider/user_provider.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/agreements/agreement_page.dart'; +import 'package:aku_community_manager/ui/agreements/privacy_page.dart'; +import 'package:aku_community_manager/ui/home/home_page.dart'; +import 'package:aku_community_manager/utils/dev_util.dart'; +import 'package:aku_community_manager/utils/hive_store.dart'; // Package imports: import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:get/get.dart' hide Response; import 'package:hive/hive.dart'; import 'package:hive_flutter/hive_flutter.dart'; @@ -11,14 +22,6 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:power_logger/power_logger.dart'; import 'package:provider/provider.dart'; -// Project imports: -import 'package:aku_community_manager/provider/app_provider.dart'; -import 'package:aku_community_manager/provider/user_provider.dart'; -import 'package:aku_community_manager/style/app_style.dart'; -import 'package:aku_community_manager/ui/home/home_page.dart'; -import 'package:aku_community_manager/utils/dev_util.dart'; -import 'package:aku_community_manager/utils/hive_store.dart'; - class SplashPage extends StatefulWidget { SplashPage({Key? key}) : super(key: key); @@ -27,19 +30,8 @@ class SplashPage extends StatefulWidget { } class _SplashPageState extends State { - Future _originOp() async { - final userProvider = Provider.of(context, listen: false); - //初始化HiveStore - await Hive.initFlutter(); - await HiveStore.init(); - if (HiveStore.appBox!.containsKey('token')) { - await userProvider.setLogin(HiveStore.appBox!.get('token')); - } - - //初始化AMap - // await AmapLocation.instance.init(iosKey: 'ios key'); - await Permission.locationWhenInUse.request(); - } + TapGestureRecognizer _agreementRecognizer = TapGestureRecognizer(); + TapGestureRecognizer _privacyRecognizer = TapGestureRecognizer(); Future _initialization() async { await Firebase.initializeApp(); @@ -50,21 +42,89 @@ class _SplashPageState extends State { } Future _initOp() async { - await _originOp(); + final userProvider = Provider.of(context, listen: false); + if (HiveStore.appBox!.containsKey('token')) { + await userProvider.setLogin(HiveStore.appBox!.get('token')); + } + //初始化AMap + // await AmapLocation.instance.init(iosKey: 'ios key'); + await Permission.locationWhenInUse.request(); final appProvider = Provider.of(context, listen: false); appProvider.startLocation(); } + Future _showLoginVerify() async { + return await showCupertinoDialog( + barrierDismissible: false, + context: context, + builder: (context) { + return CupertinoAlertDialog( + title: Text('隐私政策和用户协议'), + content: RichText( + text: TextSpan( + text: '点击登录即表示您已阅读并同意', + style: TextStyle(color: Colors.black), + children: [ + TextSpan( + text: '《用户协议》', + style: TextStyle(color: Colors.blue), + recognizer: _agreementRecognizer + ..onTap = () { + Get.to(() => AgreementPage()); + }), + TextSpan( + text: '《隐私政策》', + style: TextStyle(color: Colors.blue), + recognizer: _privacyRecognizer + ..onTap = () { + Get.to(() => PrivacyPage()); + }), + TextSpan( + style: TextStyle(color: Colors.black), + text: + '(特别是免除或限制责任、管辖等粗体下划线标注的条款)。如您不同意上述协议的任何条款,您应立即停止登录及使用本软件及服务。') + ]), + ), + + // ), + actions: [ + CupertinoDialogAction( + child: Text('同意'), + onPressed: () => Get.back(result: true), + ), + CupertinoDialogAction( + child: Text('拒绝'), + onPressed: () => Get.back(result: false), + ), + ], + ); + }, + ); + } + @override void initState() { super.initState(); - Future.delayed(Duration(milliseconds: 300), () { + Future.delayed(Duration(milliseconds: 1000), () async { + //初始化HiveStore + await Hive.initFlutter(); + await HiveStore.init(); + var agreement = false; + if (HiveStore.appBox!.containsKey('agreement')) { + agreement = await HiveStore.appBox!.get('agreement'); + } + if (!agreement) { + var result = await _showLoginVerify(); + if (result == null || !result) { + SystemNavigator.pop(); + HiveStore.appBox!.put('agreement', false); + } else { + HiveStore.appBox!.put('agreement', true); + } + } if (mounted) PowerLogger.start(context, debug: DevUtil.isDev); - }); - Future.delayed(Duration(milliseconds: 2000), () async { await _initOp(); - - Get.off(()=>HomePage()); + Get.off(() => HomePage()); }); } diff --git a/pubspec.yaml b/pubspec.yaml index edec107..6e3763f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A new Flutter application. publish_to: "none" -version: 1.7.0-dev+13 +version: 1.8.1-dev+15 environment: sdk: '>=2.12.0 <3.0.0'