jpush.setAlias导致启动页阻塞 后移至首页中加载

hmxc
张萌 3 years ago
parent 7be2fcbbcb
commit 9415b8e39a

1
.gitignore vendored

@ -30,6 +30,7 @@
/dev/docs/pubspec.yaml
/packages/flutter/coverage/
version
/tool/config.dart
# packages file containing multi-root paths
.packages.generated

@ -12,21 +12,16 @@ import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:jpush_flutter/jpush_flutter.dart';
import 'package:power_logger/power_logger.dart';
import 'package:provider/provider.dart';
void main() async {
const buildType = const String.fromEnvironment('BUILD_TYPE');
DeveloperUtil.setDev(!(buildType.contains('PRODUCT')));
WidgetsFlutterBinding.ensureInitialized();
await MainInitialize.initJPush();
///firebase crashlytics initalize
//await MainInitialize.initFirebase();
MainInitialize.initTheme();
MainInitialize.initWechat();
MainInitialize.initWebSocket();
await MainInitialize.initJPush();
runApp(MyApp());
}
@ -78,7 +73,7 @@ class _MyAppState extends State<MyApp> {
return MediaQuery(
//
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: BotToastInit().call(context,child),
child: BotToastInit().call(context, child),
);
},
navigatorObservers: [BotToastNavigatorObserver()],

@ -27,6 +27,7 @@ import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/login_util.dart';
import 'package:aku_community/widget/animated/OverlayWidget.dart';
import 'package:aku_community/widget/others/rectIndicator.dart';
import 'package:aku_community/widget/others/user_tool.dart';
import 'package:badges/badges.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -34,6 +35,8 @@ import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';
import 'package:get/get.dart';
import 'package:jpush_flutter/jpush_flutter.dart';
import 'package:power_logger/power_logger.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
@ -69,6 +72,15 @@ class _HomePageState extends State<HomePage>
@override
void initState() {
super.initState();
if (UserTool.userProvider.isLogin) {
try {
JPush().setAlias(UserTool.userProvider.userInfoModel!.id.toString());
LoggerData.addData(
'setAlias ${UserTool.userProvider.userInfoModel!.id} ${DateTime.now()}');
} catch (e) {
LoggerData.addData('${e.toString()} ${DateTime.now()}');
}
}
_scrollController = ScrollController();
_refreshController = EasyRefreshController();
}

@ -1,12 +1,14 @@
import 'dart:io';
import 'package:aku_community/const/resource.dart';
import 'package:aku_community/main_initialize.dart';
import 'package:aku_community/pages/setting_page/agreement_page/agreement_page.dart';
import 'package:aku_community/pages/setting_page/agreement_page/privacy_page.dart';
import 'package:aku_community/pages/tab_navigator.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/provider/user_provider.dart';
import 'package:aku_community/utils/developer_util.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/hive_store.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
@ -19,11 +21,6 @@ import 'package:hive_flutter/hive_flutter.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:power_logger/power_logger.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/utils/headers.dart';
class SplashPage extends StatefulWidget {
SplashPage({Key? key}) : super(key: key);
@ -132,73 +129,110 @@ class _SplashPageState extends State<SplashPage> {
await Permission.locationWhenInUse.request();
}
await _initOp();
MainInitialize.initTheme();
MainInitialize.initWechat();
MainInitialize.initWebSocket();
Get.offAll(() => TabNavigator());
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
color: Colors.white,
child: Stack(
children: [
Align(
alignment: Alignment.topCenter,
child:
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text('\n',style: TextStyle(color:Color(0xFF000000),fontSize: 40.sp,height: 1.15),),
],
alignment: Alignment.topCenter,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
'\n',
style: TextStyle(
color: Color(0xFF000000),
fontSize: 40.sp,
height: 1.15),
),
],
),
margin: EdgeInsets.only(top: 450.w),
),
margin: EdgeInsets.only(top: 450.w),
),
25.wb,
Container(
child:
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text('\n便\n\n\n\n\n\n\n',style: TextStyle(color:Color(0xFF000000),fontSize: 40.sp,height: 1.15),),
],
),
margin: EdgeInsets.only(top: 530.w),
),
25.wb,
Container(
height: 400.w,
width: 2.w,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0x99000000), Color(0x00000000)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter),
borderRadius: BorderRadius.circular(2.w),
),
25.wb,
Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
'\n便\n\n\n\n\n\n\n',
style: TextStyle(
color: Color(0xFF000000),
fontSize: 40.sp,
height: 1.15),
),
],
),
],
)
margin: EdgeInsets.only(top: 530.w),
),
25.wb,
Container(
height: 400.w,
width: 2.w,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0x99000000), Color(0x00000000)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter),
borderRadius: BorderRadius.circular(2.w),
),
),
],
)),
Positioned(
child: Image.asset(
R.ASSETS_IMAGES_CIRCLE_TEXT_PNG,
width: 61.w,
height: 72.w,
fit: BoxFit.fill,
),
top: 410.w,
left: 275.w,
),
Positioned(
child: Image.asset(
R.ASSETS_IMAGES_CIRCLE_RIGHT_TOP_PNG,
width: 185.w,
height: 249.w,
fit: BoxFit.fill,
),
top: 0.w,
right: 0.w,
),
Positioned(
child: Image.asset(
R.ASSETS_IMAGES_CIRCLE_LEFT_BOTTOM_PNG,
width: 270.w,
height: 504.w,
fit: BoxFit.fill,
),
bottom: 224.w,
left: 0.w,
),
Positioned(
child: Image.asset(
R.ASSETS_IMAGES_CIRCLE_RIGHT_BOTTOM_PNG,
width: 88.w,
height: 180.w,
fit: BoxFit.fill,
),
bottom: 150.w,
right: 0.w,
),
Positioned(child: Image.asset(R.ASSETS_IMAGES_CIRCLE_TEXT_PNG,width: 61.w,height: 72.w,fit: BoxFit.fill,),top: 410.w,left: 275.w,),
Positioned(child: Image.asset(R.ASSETS_IMAGES_CIRCLE_RIGHT_TOP_PNG,width: 185.w,height: 249.w,fit: BoxFit.fill,),top: 0.w,right: 0.w,),
Positioned(child: Image.asset(R.ASSETS_IMAGES_CIRCLE_LEFT_BOTTOM_PNG,width: 270.w,height: 504.w,fit: BoxFit.fill,),bottom: 224.w,left: 0.w,),
Positioned(child: Image.asset(R.ASSETS_IMAGES_CIRCLE_RIGHT_BOTTOM_PNG,width: 88.w,height: 180.w,fit: BoxFit.fill,),bottom: 150.w,right: 0.w,),
Align(
alignment: Alignment.bottomCenter,
child: Container(
@ -207,11 +241,20 @@ class _SplashPageState extends State<SplashPage> {
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Image.asset(R.ASSETS_IMAGES_SPLASH_LOGO_PNG,width: 140.w,height: 140.w,fit: BoxFit.fill,),
Text('小蜜蜂智慧社区',style: TextStyle(color:Color(0xD9000000),fontSize: 32.sp,fontWeight: FontWeight.bold),),
Image.asset(
R.ASSETS_IMAGES_SPLASH_LOGO_PNG,
width: 140.w,
height: 140.w,
fit: BoxFit.fill,
),
Text(
'小蜜蜂智慧社区',
style: TextStyle(
color: Color(0xD9000000),
fontSize: 32.sp,
fontWeight: FontWeight.bold),
),
],
),
),
)

@ -66,13 +66,7 @@ class UserProvider extends ChangeNotifier {
Future updateProfile() async {
_userInfoModel = await SignFunc.getUserInfo();
if (_userInfoModel != null && !kIsWeb && !Platform.isMacOS) {
try {
await JPush().setAlias(_userInfoModel!.id.toString());
} catch (e) {
LoggerData.addData(e);
}
}
notifyListeners();
}

@ -1,12 +1,11 @@
import 'dart:async';
import 'package:aku_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:power_logger/power_logger.dart';
import 'package:web_socket_channel/io.dart';
import 'package:web_socket_channel/web_socket_channel.dart';
import 'package:aku_community/widget/others/user_tool.dart';
const String baseUri = 'wss://test.kaidalai.cn/websocket/app';
enum SOCKETSTATUS {
CONNECTED, //

@ -1,6 +1,6 @@
class Config {
///
static const String homeDir = '/users/datang';
static const String homeDir = '/users/zhangmeng';
///
static const String packageName = 'aku_community';
@ -11,9 +11,9 @@ class Config {
///
static String get apkDevDir =>
'/users/datang/team/bee/app/aku_community/dev';
'/users/zhangmeng/team/bee/app/aku_community/dev';
///
static String get apkDir =>
'/users/datang/team/bee/app/aku_community/release';
'/users/zhangmeng/team/bee/app/aku_community/release';
}

Loading…
Cancel
Save