app后台清除登录状态保持

master
戴余标 2 years ago
parent b3ed14b1dd
commit f5ae339b49

@ -20,13 +20,11 @@ def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

@ -72,11 +72,7 @@ class _MyAppState extends State<MyApp> {
void initState() {
super.initState();
// final service = FlutterBackgroundService();
// Future.delayed(const Duration(milliseconds: 0), () async {
// //Hive.initFlutter;
// });
_Getpermission();
HiveStore.init();
registerWxApi(
appId: "wxd930ea5d5a228f5f",universalLink:"https://your.univerallink.com/link/ "
);

@ -1,7 +1,15 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:project_telephony/ui/tab_navigator.dart';
import 'dart:async';
import 'package:project_telephony/utils/headers.dart';
import 'package:provider/provider.dart';
import '../constants/environment/environment.dart';
import '../providers/user_provider.dart';
import '../utils/hive_store.dart';
import 'login/login_page.dart';
class Loading extends StatefulWidget {
Loading({Key? key}) : super(key: key);
@ -12,11 +20,27 @@ class Loading extends StatefulWidget {
class _LoadingState extends State<Loading> {
Future initialAll() async {
await HiveStore.init();
}
@override
void initState() {
// TODO: implement initState
super.initState();
final userProvider = Provider.of<UserProvider>(context, listen: false);
var env = const String.fromEnvironment('ENV', defaultValue: 'dev');
if (kDebugMode) {
print('env :$env');
}
DevEV.instance.setEnvironment( context, environment: env == 'dev',);
Future.delayed(const Duration(milliseconds: 1000), () async {
await initialAll();
if (!await userProvider.init()) {
await Get.offAll(() => const LoginPage());
} else {
await Get.offAll(() => const TabNavigator());
}
});
Future.delayed(const Duration(seconds: 3),(){
//3
Navigator.of(context).pushReplacementNamed("/TabNavigator");

@ -5,6 +5,7 @@ import 'package:project_telephony/ui/user/user_page.dart';
import 'package:project_telephony/utils/headers.dart';
import '../utils/hive_store.dart';
import 'home/home_page.dart';
class TabNavigator extends StatefulWidget {
@ -29,8 +30,8 @@ class _TabNavigatorState extends State<TabNavigator>
super.initState();
//
Future.delayed(const Duration(milliseconds: 0), () async {
// Hive.initFLutter;
// await HiveStore.init()
//Hive.initFlutter;
await HiveStore.init();
});
_pages = [const HomePage(), const UserPage()];
_tabController = TabController(

Loading…
Cancel
Save