-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.dart
90 lines (87 loc) · 2.95 KB
/
app.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import 'package:zeronet/imports.dart';
import 'imports.dart';
class DashboardApp extends StatelessWidget {
const DashboardApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
if (firstTime) {
SystemChrome.setEnabledSystemUIMode(
SystemUiMode.manual,
overlays: [
SystemUiOverlay.top,
SystemUiOverlay.bottom,
],
);
activateFilters();
siteUiController.updateCurrentAppRoute(AppRoute.Settings);
if (!isExecPermitted)
makeExecHelper().then(
(value) => isExecPermitted = value,
);
if (zeroNetNativeDir!.isNotEmpty) saveDataFile();
// createTorDataDir();
firstTime = false;
}
if (uiStore.zeroNetStatus.value == ZeroNetStatus.NOT_RUNNING &&
!manuallyStoppedZeroNet) {
checkInitStatus();
}
if (launchUrlString!.isNotEmpty) {
browserUrl =
(zeroNetUrl.isEmpty ? defZeroNetUrl : zeroNetUrl) + launchUrlString!;
if (uiStore.zeroNetStatus.value == ZeroNetStatus.RUNNING) {
siteUiController.updateCurrentAppRoute(AppRoute.ZeroBrowser);
} else
siteUiController.updateCurrentAppRoute(AppRoute.ShortcutLoadingPage);
}
return Obx(
() {
setSystemUiTheme();
switch (siteUiController.currentAppRoute.value) {
case AppRoute.AboutPage:
return WillPopScope(
onWillPop: () {
if (fromBrowser) {
fromBrowser = false;
//TODO! Replace with Updated WebView
// flutterWebViewPlugin.canGoBack().then(
// (value) => value ? flutterWebViewPlugin.goBack() : null,
// );
siteUiController.updateCurrentAppRoute(AppRoute.ZeroBrowser);
} else
siteUiController.updateCurrentAppRoute(AppRoute.Home);
return Future.value(false);
},
child: AboutPage(),
);
case AppRoute.Home:
if (PlatformExt.isMobile && kReleaseMode) getInAppPurchases();
return HomePage();
case AppRoute.Settings:
return WillPopScope(
onWillPop: () {
siteUiController.updateCurrentAppRoute(AppRoute.Home);
return Future.value(false);
},
child: SettingsPage(),
);
case AppRoute.ShortcutLoadingPage:
return ShortcutLoadingPage();
case AppRoute.ZeroBrowser:
// setZeroBrowserThemeValues();
return ZeroBrowser();
case AppRoute.LogPage:
return WillPopScope(
onWillPop: () {
siteUiController.updateCurrentAppRoute(AppRoute.Home);
return Future.value(false);
},
child: ZeroNetLogPage(),
);
default:
return Container();
}
},
);
}
}