2018-04-18 14:38:28 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2019-01-22 16:39:44 +01:00
|
|
|
import 'package:flutter/cupertino.dart';
|
2020-01-14 11:13:07 +01:00
|
|
|
import 'package:git_touch/app.dart';
|
2019-09-15 11:36:09 +02:00
|
|
|
import 'package:git_touch/models/code.dart';
|
2019-09-27 14:52:38 +02:00
|
|
|
import 'package:git_touch/models/auth.dart';
|
2019-09-02 15:52:32 +02:00
|
|
|
import 'package:git_touch/models/theme.dart';
|
2020-02-01 06:26:14 +01:00
|
|
|
import 'package:git_touch/router.dart';
|
2019-09-02 14:40:20 +02:00
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:git_touch/models/notification.dart';
|
2019-12-12 13:29:56 +01:00
|
|
|
import 'package:fluro/fluro.dart';
|
2019-10-13 05:01:29 +02:00
|
|
|
import 'package:fimber/fimber.dart';
|
2020-04-30 04:48:42 +02:00
|
|
|
import 'package:flutter/services.dart';
|
2018-04-18 14:38:28 +02:00
|
|
|
|
2019-01-29 12:41:24 +01:00
|
|
|
void main() async {
|
2019-11-05 08:09:54 +01:00
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
2019-02-07 07:35:19 +01:00
|
|
|
// Platform messages may fail, so we use a try/catch PlatformException.
|
|
|
|
|
|
|
|
// try {
|
|
|
|
// String initialLink = await getInitialLink();
|
2019-10-13 05:01:29 +02:00
|
|
|
// Fimber.d(initialLink);
|
2019-02-07 07:35:19 +01:00
|
|
|
// } on PlatformException {
|
2019-10-13 05:01:29 +02:00
|
|
|
// Fimber.d('test');
|
2019-02-07 07:35:19 +01:00
|
|
|
// }
|
2019-01-23 09:50:51 +01:00
|
|
|
|
2019-01-29 12:41:24 +01:00
|
|
|
// DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
|
|
|
// AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
2019-10-13 05:01:29 +02:00
|
|
|
// Fimber.d('Running on ${androidInfo.model}'); // e.g. "Moto G (4)"
|
2019-01-29 12:41:24 +01:00
|
|
|
|
|
|
|
// IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
|
2019-10-13 05:01:29 +02:00
|
|
|
// Fimber.d('Running on ${iosInfo.utsname.machine}'); // e.g. "iPod7,1"
|
|
|
|
|
|
|
|
// TODO: Later, should check to enable debug log in debug build only
|
|
|
|
Fimber.plantTree(DebugTree());
|
2019-01-29 12:41:24 +01:00
|
|
|
|
2019-11-05 08:09:54 +01:00
|
|
|
final notificationModel = NotificationModel();
|
|
|
|
final themeModel = ThemeModel();
|
|
|
|
final authModel = AuthModel();
|
|
|
|
final codeModel = CodeModel();
|
|
|
|
await Future.wait([
|
|
|
|
themeModel.init(),
|
|
|
|
authModel.init(),
|
|
|
|
codeModel.init(),
|
|
|
|
]);
|
|
|
|
|
2020-02-01 06:26:14 +01:00
|
|
|
CommonRouter.routes.forEach((screen) {
|
|
|
|
themeModel.router.define(CommonRouter.prefix + screen.path,
|
|
|
|
handler: Handler(handlerFunc: screen.handler));
|
|
|
|
});
|
|
|
|
GitlabRouter.routes.forEach((screen) {
|
|
|
|
themeModel.router.define(GitlabRouter.prefix + screen.path,
|
|
|
|
handler: Handler(handlerFunc: screen.handler));
|
|
|
|
});
|
|
|
|
GiteaRouter.routes.forEach((screen) {
|
|
|
|
themeModel.router.define(GiteaRouter.prefix + screen.path,
|
|
|
|
handler: Handler(handlerFunc: screen.handler));
|
|
|
|
});
|
2020-02-02 11:58:05 +01:00
|
|
|
BitbucketRouter.routes.forEach((screen) {
|
|
|
|
themeModel.router.define(BitbucketRouter.prefix + screen.path,
|
|
|
|
handler: Handler(handlerFunc: screen.handler));
|
|
|
|
});
|
2020-02-01 06:26:14 +01:00
|
|
|
GithubRouter.routes.forEach((screen) {
|
|
|
|
themeModel.router.define(GithubRouter.prefix + screen.path,
|
|
|
|
handler: Handler(handlerFunc: screen.handler));
|
2019-12-13 06:13:45 +01:00
|
|
|
});
|
2020-10-17 11:35:08 +02:00
|
|
|
GiteeRouter.routes.forEach((screen) {
|
|
|
|
themeModel.router.define(GiteeRouter.prefix + screen.path,
|
|
|
|
handler: Handler(handlerFunc: screen.handler));
|
|
|
|
});
|
2021-01-23 15:08:05 +01:00
|
|
|
GogsRouter.routes.forEach((screen) {
|
|
|
|
themeModel.router.define(GogsRouter.prefix + screen.path,
|
|
|
|
handler: Handler(handlerFunc: screen.handler));
|
|
|
|
});
|
2020-04-30 04:48:42 +02:00
|
|
|
// To match status bar color to app bar color
|
|
|
|
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
|
|
|
|
statusBarColor: Colors.transparent,
|
|
|
|
));
|
|
|
|
|
2019-11-05 08:09:54 +01:00
|
|
|
runApp(MultiProvider(
|
|
|
|
providers: [
|
2019-12-07 16:12:31 +01:00
|
|
|
ChangeNotifierProvider(create: (context) => notificationModel),
|
|
|
|
ChangeNotifierProvider(create: (context) => themeModel),
|
|
|
|
ChangeNotifierProvider(create: (context) => authModel),
|
|
|
|
ChangeNotifierProvider(create: (context) => codeModel),
|
2019-11-05 08:09:54 +01:00
|
|
|
],
|
2020-01-14 11:13:07 +01:00
|
|
|
child: MyApp(),
|
2019-11-05 08:09:54 +01:00
|
|
|
));
|
2019-01-23 09:50:51 +01:00
|
|
|
}
|