From b1e3574ea61b961457c2eafc74128c0651996207 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Thu, 5 Aug 2021 19:05:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9D=83=E9=99=90=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=20=E6=9B=B4=E6=96=B0=20jpush=20appkey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/src/main/AndroidManifest.xml | 27 +++++++++++++++++++++++- lib/main.dart | 4 ++-- lib/provider/app_provider.dart | 5 +++-- lib/provider/user_provider.dart | 7 ++++-- 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 029697b..8f25c10 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -5,7 +5,8 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/main.dart b/lib/main.dart index 05a59ec..f87b768 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -55,13 +55,13 @@ void main() async { }, ); jpush.setup( - appKey: "99067fe33fa04aad88c3acac", + appKey: "028adb7b9eda661fefdf3072", channel: "developer-default", production: false, debug: true, // 设置是否打印 debug 日志 ); String? id = await JPush().getRegistrationID(); - print(id); + print('jpush RegistrationID is $id'); LoggerData.addData(id); runApp(MyApp()); } diff --git a/lib/provider/app_provider.dart b/lib/provider/app_provider.dart index 1155195..132c4ae 100644 --- a/lib/provider/app_provider.dart +++ b/lib/provider/app_provider.dart @@ -8,6 +8,7 @@ import 'package:amap_flutter_location/amap_location_option.dart'; // Project imports: import 'package:aku_community_manager/ui/home/application/applications_page.dart'; +import 'package:power_logger/power_logger.dart'; enum WORKCLOCK { ///未上班打卡状态 @@ -51,6 +52,8 @@ class AppProvider extends ChangeNotifier { _flutterLocation = AMapFlutterLocation(); _flutterLocation.onLocationChanged().listen((event) { _location = event; + LoggerData.addData(_location.toString()); + print(_location.toString()); if (_location != null) { stopLocation(); } @@ -65,8 +68,6 @@ class AppProvider extends ChangeNotifier { _flutterLocation.destroy(); } - - WORKCLOCK _clockStatus = WORKCLOCK.NOTIN; DateTime? _clockInTime; DateTime? _clockOutTime; diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index 7bd66a3..3c65e37 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -35,8 +35,10 @@ class UserProvider extends ChangeNotifier { await HiveStore.appBox!.put('login', true); _profileModel = await updateProfile(); _infoModel = await updateUserInfo(); - WebSocketUtil().setUser(infoModel!.id.toString()); - WebSocketUtil().startWebSocket(); + if (isLogin) { + WebSocketUtil().setUser(infoModel!.id.toString()); + WebSocketUtil().startWebSocket(); + } // await setCurrentHouse((_userDetailModel?.estateNames?.isEmpty ?? true) // ? '' // : _userDetailModel?.estateNames?.first); @@ -68,6 +70,7 @@ class UserProvider extends ChangeNotifier { else { var userModel = UserInfoModel.fromJson(model.data); JPush().setAlias(userModel.id.toString()); + print('jpush alias is ${userModel.id}'); return userModel; } }