mirror of
https://github.com/go-vikunja/app
synced 2024-09-17 21:31:46 +00:00
Merge branch 'main' of https://github.com/go-vikunja/app
This commit is contained in:
commit
85f79e4e5a
26
.metadata
26
.metadata
@ -4,5 +4,27 @@
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: 3b309bda072a6b326e8aa4591a5836af600923ce
|
||||
channel: beta
|
||||
revision: "300451adae589accbece3490f4396f10bdf15e6e"
|
||||
channel: "stable"
|
||||
|
||||
project_type: app
|
||||
|
||||
# Tracks metadata for the flutter migrate command
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
|
||||
base_revision: 300451adae589accbece3490f4396f10bdf15e6e
|
||||
- platform: web
|
||||
create_revision: 300451adae589accbece3490f4396f10bdf15e6e
|
||||
base_revision: 300451adae589accbece3490f4396f10bdf15e6e
|
||||
|
||||
# User provided section
|
||||
|
||||
# List of Local paths (relative to this file) that should be
|
||||
# ignored by the migrate tool.
|
||||
#
|
||||
# Files that are not part of the templates will be ignored by default.
|
||||
unmanaged_files:
|
||||
- 'lib/main.dart'
|
||||
- 'ios/Runner.xcodeproj/project.pbxproj'
|
||||
|
29
.vscode/launch.json
vendored
29
.vscode/launch.json
vendored
@ -1,14 +1,19 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Flutter",
|
||||
"request": "launch",
|
||||
"type": "dart",
|
||||
"flutterMode": "debug",
|
||||
"args": [
|
||||
"--flavor",
|
||||
"main"
|
||||
],
|
||||
}
|
||||
]
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Flutter (Chromium)",
|
||||
"type": "dart",
|
||||
"request": "launch",
|
||||
"program": "lib/main.dart",
|
||||
"args": ["-d", "chrome", "--flavor", "main"],
|
||||
"deviceId": "chrome",
|
||||
},
|
||||
{
|
||||
"name": "Flutter",
|
||||
"request": "launch",
|
||||
"type": "dart",
|
||||
"flutterMode": "debug",
|
||||
"args": ["--flavor", "main"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'dart:developer' as dev;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:vikunja_app/api/bucket_implementation.dart';
|
||||
@ -83,6 +84,9 @@ class VikunjaGlobalState extends State<VikunjaGlobal> {
|
||||
late String currentTimeZone;
|
||||
|
||||
void updateWorkmanagerDuration() {
|
||||
if (kIsWeb) {
|
||||
return;
|
||||
}
|
||||
Workmanager().cancelAll().then((value) {
|
||||
settingsManager.getWorkmanagerDuration().then((duration) {
|
||||
if (duration.inMinutes > 0) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
@ -34,6 +35,9 @@ class IgnoreCertHttpOverrides extends HttpOverrides {
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
void callbackDispatcher() {
|
||||
if (kIsWeb) {
|
||||
return;
|
||||
}
|
||||
Workmanager().executeTask((task, inputData) async {
|
||||
print(
|
||||
"Native called background task: $task"); //simpleTask will be emitted here.
|
||||
@ -95,18 +99,31 @@ void main() async {
|
||||
Permission.notification.request();
|
||||
}
|
||||
});
|
||||
await FlutterDownloader.initialize();
|
||||
Workmanager().initialize(callbackDispatcher, isInDebugMode: false);
|
||||
try {
|
||||
if (!kIsWeb) {
|
||||
await FlutterDownloader.initialize();
|
||||
}
|
||||
} catch (e) {
|
||||
print("Failed to initialize downloader: $e");
|
||||
}
|
||||
try {
|
||||
if (!kIsWeb) {
|
||||
Workmanager().initialize(callbackDispatcher, isInDebugMode: false);
|
||||
}
|
||||
} catch (e) {
|
||||
print("Failed to initialize workmanager: $e");
|
||||
}
|
||||
runApp(VikunjaGlobal(
|
||||
child: new VikunjaApp(
|
||||
home: HomePage(),
|
||||
key: UniqueKey(),
|
||||
navkey: globalNavigatorKey,
|
||||
),
|
||||
login: new VikunjaApp(
|
||||
home: LoginPage(),
|
||||
key: UniqueKey(),
|
||||
)));
|
||||
child: new VikunjaApp(
|
||||
home: HomePage(),
|
||||
key: UniqueKey(),
|
||||
navkey: globalNavigatorKey,
|
||||
),
|
||||
login: new VikunjaApp(
|
||||
home: LoginPage(),
|
||||
key: UniqueKey(),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
final ValueNotifier<bool> updateTheme = ValueNotifier(false);
|
||||
@ -118,38 +135,41 @@ class VikunjaApp extends StatelessWidget {
|
||||
const VikunjaApp({Key? key, required this.home, this.navkey})
|
||||
: super(key: key);
|
||||
|
||||
Future<ThemeData> getThemedata() async {
|
||||
FlutterThemeMode themeMode = FlutterThemeMode.light;
|
||||
try {
|
||||
SettingsManager manager = SettingsManager(new FlutterSecureStorage());
|
||||
themeMode = await manager.getThemeMode();
|
||||
} catch (e) {
|
||||
print("Failed to get theme mode: $e");
|
||||
}
|
||||
switch (themeMode) {
|
||||
case FlutterThemeMode.dark:
|
||||
return buildVikunjaDarkTheme();
|
||||
case FlutterThemeMode.materialYouLight:
|
||||
return buildVikunjaMaterialLightTheme();
|
||||
case FlutterThemeMode.materialYouDark:
|
||||
return buildVikunjaMaterialDarkTheme();
|
||||
default:
|
||||
return buildVikunjaTheme();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SettingsManager manager = SettingsManager(new FlutterSecureStorage());
|
||||
|
||||
return new ValueListenableBuilder(
|
||||
valueListenable: updateTheme,
|
||||
builder: (_, mode, __) {
|
||||
updateTheme.value = false;
|
||||
FlutterThemeMode themeMode = FlutterThemeMode.system;
|
||||
Future<ThemeData> theme = manager.getThemeMode().then((value) {
|
||||
themeMode = value;
|
||||
switch (value) {
|
||||
case FlutterThemeMode.dark:
|
||||
return buildVikunjaDarkTheme();
|
||||
case FlutterThemeMode.materialYouLight:
|
||||
return buildVikunjaMaterialLightTheme();
|
||||
case FlutterThemeMode.materialYouDark:
|
||||
return buildVikunjaMaterialDarkTheme();
|
||||
default:
|
||||
return buildVikunjaTheme();
|
||||
}
|
||||
});
|
||||
return FutureBuilder<ThemeData>(
|
||||
future: theme,
|
||||
future: getThemedata(),
|
||||
builder: (BuildContext context, AsyncSnapshot<ThemeData> data) {
|
||||
if (data.hasData) {
|
||||
return new DynamicColorBuilder(
|
||||
builder: (lightTheme, darkTheme) {
|
||||
ThemeData? themeData = data.data;
|
||||
if (themeMode == FlutterThemeMode.materialYouLight)
|
||||
if (data.data == FlutterThemeMode.materialYouLight)
|
||||
themeData = themeData?.copyWith(colorScheme: lightTheme);
|
||||
else if (themeMode == FlutterThemeMode.materialYouDark)
|
||||
else if (data.data == FlutterThemeMode.materialYouDark)
|
||||
themeData = themeData?.copyWith(colorScheme: darkTheme);
|
||||
return MaterialApp(
|
||||
title: 'Vikunja',
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'dart:ffi';
|
||||
import 'dart:developer';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vikunja_app/global.dart';
|
||||
|
@ -10,8 +10,8 @@ import 'package:vikunja_app/components/TaskTile.dart';
|
||||
import 'package:vikunja_app/global.dart';
|
||||
import 'package:vikunja_app/models/task.dart';
|
||||
import 'package:vikunja_app/models/bucket.dart';
|
||||
import 'package:vikunja_app/pages/project/task_edit.dart';
|
||||
import 'package:vikunja_app/pages/project/project_edit.dart';
|
||||
import 'package:vikunja_app/pages/project/task_edit.dart';
|
||||
|
||||
import '../../components/pagestatus.dart';
|
||||
import '../../models/project.dart';
|
||||
|
@ -287,10 +287,10 @@ class SettingsManager {
|
||||
key: "workmanager-duration", value: duration.inMinutes.toString());
|
||||
}
|
||||
|
||||
Future<List<String>?> getPastServers() {
|
||||
return _storage
|
||||
.read(key: "recent-servers")
|
||||
.then((value) => (jsonDecode(value!) as List<dynamic>).cast<String>());
|
||||
Future<List<String>?> getPastServers() async {
|
||||
String jsonString = await _storage.read(key: "recent-servers") ?? "[]";
|
||||
List<dynamic> server = jsonDecode(jsonString);
|
||||
return server.map((e) => e as String).toList();
|
||||
}
|
||||
|
||||
Future<void> setPastServers(List<String>? server) {
|
||||
|
BIN
web/favicon.png
Normal file
BIN
web/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 917 B |
BIN
web/icons/Icon-192.png
Normal file
BIN
web/icons/Icon-192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
BIN
web/icons/Icon-512.png
Normal file
BIN
web/icons/Icon-512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.1 KiB |
BIN
web/icons/Icon-maskable-192.png
Normal file
BIN
web/icons/Icon-maskable-192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
BIN
web/icons/Icon-maskable-512.png
Normal file
BIN
web/icons/Icon-maskable-512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
59
web/index.html
Normal file
59
web/index.html
Normal file
@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
If you are serving your web app in a path other than the root, change the
|
||||
href value below to reflect the base path you are serving from.
|
||||
|
||||
The path provided below has to start and end with a slash "/" in order for
|
||||
it to work correctly.
|
||||
|
||||
For more details:
|
||||
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
|
||||
|
||||
This is a placeholder for base href that will be replaced by the value of
|
||||
the `--base-href` argument provided to `flutter build`.
|
||||
-->
|
||||
<base href="$FLUTTER_BASE_HREF">
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
||||
<meta name="description" content="A new Flutter project.">
|
||||
|
||||
<!-- iOS meta tags & icons -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="vikunja_app">
|
||||
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||
|
||||
<title>vikunja_app</title>
|
||||
<link rel="manifest" href="manifest.json">
|
||||
|
||||
<script>
|
||||
// The value below is injected by flutter build, do not touch.
|
||||
const serviceWorkerVersion = null;
|
||||
</script>
|
||||
<!-- This script adds the flutter initialization JS code -->
|
||||
<script src="flutter.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
window.addEventListener('load', function(ev) {
|
||||
// Download main.dart.js
|
||||
_flutter.loader.loadEntrypoint({
|
||||
serviceWorker: {
|
||||
serviceWorkerVersion: serviceWorkerVersion,
|
||||
},
|
||||
onEntrypointLoaded: function(engineInitializer) {
|
||||
engineInitializer.initializeEngine().then(function(appRunner) {
|
||||
appRunner.runApp();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
35
web/manifest.json
Normal file
35
web/manifest.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "vikunja_app",
|
||||
"short_name": "vikunja_app",
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"background_color": "#0175C2",
|
||||
"theme_color": "#0175C2",
|
||||
"description": "A new Flutter project.",
|
||||
"orientation": "portrait-primary",
|
||||
"prefer_related_applications": false,
|
||||
"icons": [
|
||||
{
|
||||
"src": "icons/Icon-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-maskable-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-maskable-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user