feat(autoburza): vytvořit základ pro autoburzu
This commit is contained in:
parent
656c5739a8
commit
68ee7d16c4
11 changed files with 55 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
# Uncomment this line to define a global platform for your project
|
# Uncomment this line to define a global platform for your project
|
||||||
# platform :ios, '9.0'
|
platform :ios, '10.0'
|
||||||
|
|
||||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||||
|
|
|
@ -547,3 +547,9 @@
|
||||||
};
|
};
|
||||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SystemCapabilities = {
|
||||||
|
com.apple.BackgroundModes = {
|
||||||
|
enabled = 1;
|
||||||
|
};
|
||||||
|
};
|
|
@ -1,5 +1,6 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import Flutter
|
import Flutter
|
||||||
|
import workmanager
|
||||||
|
|
||||||
@UIApplicationMain
|
@UIApplicationMain
|
||||||
@objc class AppDelegate: FlutterAppDelegate {
|
@objc class AppDelegate: FlutterAppDelegate {
|
||||||
|
@ -7,6 +8,7 @@ import Flutter
|
||||||
_ application: UIApplication,
|
_ application: UIApplication,
|
||||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||||
) -> Bool {
|
) -> Bool {
|
||||||
|
WorkmanagerPlugin.registerTask(withIdentifier: "oc_bg")
|
||||||
GeneratedPluginRegistrant.register(with: self)
|
GeneratedPluginRegistrant.register(with: self)
|
||||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,5 +50,13 @@
|
||||||
<false/>
|
<false/>
|
||||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>UIBackgroundModes</key>
|
||||||
|
<array>
|
||||||
|
<string>processing</string>
|
||||||
|
</array>
|
||||||
|
<key>BGTaskSchedulerPermittedIdentifiers</key>
|
||||||
|
<array>
|
||||||
|
<string>oc_bg</string>
|
||||||
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -157,6 +157,8 @@ abstract class Languages {
|
||||||
|
|
||||||
String get notifyWarning;
|
String get notifyWarning;
|
||||||
|
|
||||||
|
String get autoburzaSetting;
|
||||||
|
|
||||||
// Offline
|
// Offline
|
||||||
String get offline;
|
String get offline;
|
||||||
|
|
||||||
|
|
|
@ -237,4 +237,8 @@ class LanguageCz extends Languages {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get review => "Ohodnotit aplikaci";
|
String get review => "Ohodnotit aplikaci";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get autoburzaSetting =>
|
||||||
|
"Automaticky objednat jídlo z burzy když bude dostupné";
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,4 +235,8 @@ class LanguageEn extends Languages {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get review => "Review the app";
|
String get review => "Review the app";
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get autoburzaSetting =>
|
||||||
|
"Automatically order food from exchange when available";
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,6 @@ void oznamitPredem(SharedPreferences prefs, tz.Location l) async {
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
|
||||||
tz.initializeTimeZones();
|
tz.initializeTimeZones();
|
||||||
var l = tz.getLocation(await FlutterNativeTimezone.getLocalTimezone());
|
var l = tz.getLocation(await FlutterNativeTimezone.getLocalTimezone());
|
||||||
tz.setLocalLocation(l);
|
tz.setLocalLocation(l);
|
||||||
|
@ -137,6 +136,8 @@ void main() async {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
// spustit aplikaci
|
// spustit aplikaci
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ class _NastaveniState extends State<Nastaveni> {
|
||||||
bool _kontrolovatTyden = false;
|
bool _kontrolovatTyden = false;
|
||||||
bool _oznameniObed = false;
|
bool _oznameniObed = false;
|
||||||
bool _zapamatovany = false;
|
bool _zapamatovany = false;
|
||||||
|
bool _autoburza = false;
|
||||||
TimeOfDay _oznameniCas = TimeOfDay.now();
|
TimeOfDay _oznameniCas = TimeOfDay.now();
|
||||||
|
|
||||||
void najitNastaveni() async {
|
void najitNastaveni() async {
|
||||||
|
@ -37,6 +38,7 @@ class _NastaveniState extends State<Nastaveni> {
|
||||||
_preskakovatVikend = preferences.getBool("skip") ?? false;
|
_preskakovatVikend = preferences.getBool("skip") ?? false;
|
||||||
_kontrolovatTyden = preferences.getBool("tyden") ?? false;
|
_kontrolovatTyden = preferences.getBool("tyden") ?? false;
|
||||||
_oznameniObed = preferences.getBool("oznamit") ?? false;
|
_oznameniObed = preferences.getBool("oznamit") ?? false;
|
||||||
|
_autoburza = preferences.getBool("autoburza") ?? false;
|
||||||
var casStr = preferences.getString("oznameni_cas");
|
var casStr = preferences.getString("oznameni_cas");
|
||||||
if (casStr == null) {
|
if (casStr == null) {
|
||||||
var now = DateTime.now();
|
var now = DateTime.now();
|
||||||
|
@ -114,6 +116,20 @@ class _NastaveniState extends State<Nastaveni> {
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Flexible(child: Text(Languages.of(context)!.autoburzaSetting)),
|
||||||
|
Switch(
|
||||||
|
value: _autoburza,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
_kontrolovatTyden = value;
|
||||||
|
zmenitNastaveni("autoburza", value);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
],
|
||||||
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
|
|
@ -539,6 +539,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.0"
|
version: "3.0.0"
|
||||||
|
workmanager:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: workmanager
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.5.1"
|
||||||
xdg_directories:
|
xdg_directories:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -561,5 +568,5 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.1"
|
version: "3.1.1"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.17.0 <3.0.0"
|
dart: ">=2.18.0 <3.0.0"
|
||||||
flutter: ">=3.0.0"
|
flutter: ">=3.0.0"
|
||||||
|
|
|
@ -6,7 +6,7 @@ publish_to: 'none'
|
||||||
# The following defines the version and build number for your application.
|
# The following defines the version and build number for your application.
|
||||||
# A version number is three numbers separated by dots, like 1.2.43
|
# A version number is three numbers separated by dots, like 1.2.43
|
||||||
# followed by an optional build number separated by a +.
|
# followed by an optional build number separated by a +.
|
||||||
version: 1.4.1+20
|
version: 1.5.0+21
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.16.1 <3.0.0"
|
sdk: ">=2.16.1 <3.0.0"
|
||||||
|
@ -27,6 +27,7 @@ dependencies:
|
||||||
flutter_native_timezone: ^2.0.0
|
flutter_native_timezone: ^2.0.0
|
||||||
intl: ^0.17.0
|
intl: ^0.17.0
|
||||||
package_info_plus: ^1.4.3+1
|
package_info_plus: ^1.4.3+1
|
||||||
|
workmanager: ^0.5.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_lints: ^2.0.1
|
flutter_lints: ^2.0.1
|
||||||
|
|
Reference in a new issue