Commit 9cb64041 authored by Nicolas Richard Walter Boeckh's avatar Nicolas Richard Walter Boeckh 💬

Trying to get a Dialog with All options going, Dialog should include frequent selections

parent 18454438
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"battery","dependencies":[]},{"name":"geolocator","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","dependencies":[]},{"name":"location_permissions","dependencies":[]},{"name":"path_provider","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"plugin_scaffold","dependencies":[]},{"name":"rx_ble","dependencies":["plugin_scaffold"]},{"name":"sqflite","dependencies":[]}]}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"geolocator","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\geolocator-5.2.1\\\\","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_api_availability-2.0.2\\\\","dependencies":[]},{"name":"location_permissions","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location_permissions-2.0.4+1\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.0\\\\","dependencies":[]},{"name":"permission_handler","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler-4.2.0+hotfix.3\\\\","dependencies":[]},{"name":"plugin_scaffold","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\plugin_scaffold-1.2.0\\\\","dependencies":[]},{"name":"rx_ble","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\rx_ble-0.6.1\\\\","dependencies":["plugin_scaffold"]},{"name":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.2.0\\\\","dependencies":[]}],"android":[{"name":"geolocator","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\geolocator-5.2.1\\\\","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_api_availability-2.0.2\\\\","dependencies":[]},{"name":"location_permissions","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location_permissions-2.0.4+1\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.0\\\\","dependencies":[]},{"name":"permission_handler","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler-4.2.0+hotfix.3\\\\","dependencies":[]},{"name":"plugin_scaffold","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\plugin_scaffold-1.2.0\\\\","dependencies":[]},{"name":"rx_ble","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\rx_ble-0.6.1\\\\","dependencies":["plugin_scaffold"]},{"name":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.2.0\\\\","dependencies":[]}],"macos":[{"name":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.2.0\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"geolocator","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","dependencies":[]},{"name":"location_permissions","dependencies":[]},{"name":"path_provider","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"plugin_scaffold","dependencies":[]},{"name":"rx_ble","dependencies":["plugin_scaffold"]},{"name":"sqflite","dependencies":[]}],"date_created":"2020-02-11 17:16:22.831677","version":"1.14.7-pre.83"}
\ No newline at end of file
......@@ -6,13 +6,15 @@ The idea for BLE is to use Platform specific code, ie `Platform channels`...
| Platform Specific | Cross OS |
| ------------------------ | ------------------------:|
| Bluetooth Read | Scan named MAC addresses |
| Stay Alive | Write to File |
| | |
| Stay Alive | Scan environment |
| | Scan named MAC addresses |
| | Write to File |
| Get Battery level ✅ | |
Testing procedure for background will include the backup system as well (ie. writing to files).
### [0.0.2] Android
`BatteryService`, `BTLEHandler`, `WebsocketHandler` and the likes should be `Singletons`, to reduce load on the platform.
Also, `BTLEHandler` needs to follow an inverse paradigm to `BatteryService`, ie. it shouldn't request updates but listen to them.
......@@ -27,7 +29,17 @@ Thought of firmware implementation for obfuscation / integrity verification. See
Other option for making the service run in background: make the platform side tick once per second and notify the dart framework, may need to use a sticky notification as well.
### Resources
Notification turned out to be unnecessary, oops.
___
### [0.0.2] iOS
This is a tricky one.
Sadly, because Apple doesn't care about it's users, we will only be able to support devices running `iOS >= 7.X` (100% of iPad 1, 1.5% of iPad 2, 100% of iPhone 3GS, 8.3% of iPhone 4 and 100% of iPod Touch 4 ~= 0.1% of the ecosystem, allegedly, although the iPhone 4 is barely 7 years old).
### [0.0.2] Resources
- [Permissions aaS](https://www.filledstacks.com/snippet/request-permissions-in-flutter-as-a-service/)
- [Toasts](https://www.filledstacks.com/snippet/easy-toasts-with-ok-toast/)
......@@ -56,7 +68,7 @@ Useful to implement at the beginning because otherwise refactoring becomes painf
Based on the intl package, and uses it's generators to convert the `.arb` files (text, description, etc. in JSON format) to `.dart` files, of which only one is loaded at launch (also possible to force reload on language switch).
### Resources
### [0.0.1] Resources
- [Intl package documentation](https://pub.dev/packages/intl) \[[Code](https://github.com/dart-lang/intl)\]
- [Intl extensibility documentation](https://github.com/flutter/website/blob/master/examples/internationalization/add_language/lib/main.dart)
......
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:device_preview/device_preview.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
......@@ -10,9 +11,9 @@ import 'package:logair_application/routes/home.dart';
// TODO USED FOR DEBUGGING
final bool displayMode = false;
void main() => runApp(displayMode ? DevicePreview(child: MyApp()) : MyApp());
void main() => runApp(displayMode ? DevicePreview(child: LogAirApplication()) : LogAirApplication());
class MyApp extends StatelessWidget {
class LogAirApplication extends StatelessWidget {
static const String _title = 'LogAir Connector';
// This widget is the root of your application.
......@@ -20,8 +21,6 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
BTLEHandler();
return MaterialApp(
localizationsDelegates: [
const InternalLocalizationDelegate(),
......
import 'package:flutter/services.dart';
import 'package:logair_application/enums/platform_channels.dart';
import 'dart:async';
import 'package:logair_application/platform/wake_service.dart';
class BTLEHandler {
// TODO Tick once per second as well
static final BTLEHandler _singleton = new BTLEHandler._internal();
static bool started = false;
static Duration duration = new Duration(seconds: 1);
Timer t;
factory BTLEHandler() => _singleton;
BTLEHandler._internal();
bool switchState() {
if (started)
_end();
else
_start();
return started;
}
void _start() {
WakeService().modifyWakeService(true).then((value) => print('Device will stay awake $value'));
started = true;
t = new Timer.periodic(duration, (Timer t) => print("${new DateTime.now()}"));
}
void _end() {
WakeService().modifyWakeService(false).then((value) => print('Device will stay awake $value'));
t.cancel();
}
}
\ No newline at end of file
import 'package:flutter/services.dart';
import 'package:logair_application/enums/platform_channels.dart';
class WakeService {
class WakeService {
static const MethodChannel methodChannel = const MethodChannel(Channels.WAKE);
static final WakeService _singleton = new WakeService._internal();
factory WakeService() {
return _singleton;
}
WakeService._internal();
Future<bool> modifyWakeService(bool start) async {
bool wakeServiceStatus;
......
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:logair_application/platform/wake_service.dart';
import 'package:logair_application/platform/bluetooth_le_service.dart';
import 'package:logair_application/ui/carousel_card.dart';
import 'package:logair_application/platform/battery_service.dart';
import 'package:logair_application/ui/dialog/bluetooth_selection_dialog.dart';
class DataWidget extends StatelessWidget {
DataWidget();
......@@ -24,21 +25,17 @@ class DataWidget extends StatelessWidget {
Text("Data", style: TextStyle(fontFamily: "Consolas", fontSize: 22)),
RaisedButton(
onPressed: () => {
WakeService().modifyWakeService(true).then((value) => print('Device will stay awake $value'))
// await BTLEHandler().dialog(ocntext)
BTLEHandler().switchState()
},
child: Text(
'Start BG Service Ticker',
style: TextStyle(fontSize: 20)
),
child: Text('Toggle BTLE Service'),
),
RaisedButton(
onPressed: () => {
WakeService().modifyWakeService(false).then((value) => print('Device will stay awake $value'))
//showBTElements
showBluetoothSelectionDialog(context)
},
child: Text(
'End BG Service Ticker',
style: TextStyle(fontSize: 20)
),
child: Text("BTLE popup")
)
]
)
......
import 'package:flutter/material.dart';
showBluetoothSelectionDialog(BuildContext context) {
List<String> _frequentDevices = []; // await Devices, filter with cached values
showDialog(
context: context,
builder: (BuildContext context) {
return SimpleDialog(
children: <Widget>[
],
);
}
);
}
\ No newline at end of file
......@@ -43,13 +43,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
battery:
dependency: "direct main"
description:
name: battery
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.1+7"
boolean_selector:
dependency: transitive
description:
......
......@@ -19,7 +19,6 @@ dependencies:
provider: null
geolocator: ^5.2.1
flutter_map: ^0.8.2
battery: ^0.3.1+7
rx_ble:
permission_handler: ^4.2.0+hotfix.3
get_it: ^3.1.0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment