Commit bc031921 authored by Nicolas Richard Walter Boeckh's avatar Nicolas Richard Walter Boeckh 💬
Browse files

Ventured into platform specific code (used for getting battery values but...

Ventured into platform specific code (used for getting battery values but necessary for BLE, sadly), added a whole `THOUGHTS.md` recapping the resources visited.
[x] Android
[ ] iOS
parent e23b8d86
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"battery","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\battery-0.3.1+7\\\\","dependencies":[]},{"name":"flutter_ble_lib","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_ble_lib-2.1.0\\\\","dependencies":[]},{"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":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.2.0\\\\","dependencies":[]}],"android":[{"name":"battery","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\battery-0.3.1+7\\\\","dependencies":[]},{"name":"flutter_ble_lib","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_ble_lib-2.1.0\\\\","dependencies":[]},{"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":"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":"battery","dependencies":[]},{"name":"flutter_ble_lib","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":"sqflite","dependencies":[]}],"date_created":"2020-02-05 15:19:43.914738","version":"1.14.7-pre.83"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"battery","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\battery-0.3.1+7\\\\","dependencies":[]},{"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":"battery","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\battery-0.3.1+7\\\\","dependencies":[]},{"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":"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":[]}],"date_created":"2020-02-06 15:03:57.583144","version":"1.14.7-pre.83"}
\ No newline at end of file
......@@ -13,7 +13,9 @@ Dates are in the sensible `DD/MM/YYYY` format.
- Add | (Func) Param for download maps on Wifi
- Add | (Func) Param for data push on Wifi
- Add | (UI) Options menu
- Push data only on WiFi option
- Add | (UI) Leaflet (flutter_map) | just the map (6h) + (overlay data || )
- Bluetooth (recents list.s)
- Add | (Func) Cache file for data | 2+3-4h
- Add | (BS) Location (expansion needed) | ~
- Add | (BS) Bluetooth LE (expansion needed) | 4-8h (flutter_blue )
......@@ -23,14 +25,25 @@ Dates are in the sensible `DD/MM/YYYY` format.
## [0.0.2] - current
### Summary
### Added
- (OS) Platform dependent code to get battery percentage value - Used as an introduction to platform dependent code, ie. what will be used for BLE.
- (Lang) fr localization.
### Changed
- Changed minSdk to version 19 (from 18) to support `rx_ble` library integration.
### Removed
## [0.0.1] - 05/02/2020
### Summary
Added a basic UI and support for Internationalization, out of the box.
### Added
- (UI) Permission Dialog.
......
......@@ -11,6 +11,6 @@ The Application that handles the connection between LogAir devices and LogAir's
```bash
flutter pub get
flutter pub pub run intl_translation:extract_to_arb --output-dir=lib/l10n lib/main.dart
flutter pub pub run intl_translation:generate_from_arb --output-dir=lib/l10n --no-use-deferred-loading lib/main.dart lib/l10n/intl_en.arb lib/l10n/intl_fr.arb
flutter pub pub run intl_translation:extract_to_arb --output-dir=lib/l10n lib/localization/localization.dart
flutter pub pub run intl_translation:generate_from_arb --output-dir=lib/l10n --no-use-deferred-loading lib/localization/localization.dart lib/l10n/intl_en.arb lib/l10n/intl_fr.arb
```
# Collection of thoughts and general development process.
## [0.0.2] - current
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 |
| | |
| Get Battery level ✅ | |
Testing procedure for background will include the backup system as well.
### 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/)
- [Splash Screen](https://www.filledstacks.com/snippet/setting-up-your-splash-screen-in-flutter/)
- [Dialogs](https://www.filledstacks.com/snippet/quick-and-easy-dialogs-in-flutter-with-rf-flutter/)
- [Platform Channels](https://flutter.dev/docs/development/platform-integration/platform-channels?tab=ios-channel-swift-tab) \[[Code](https://github.com/flutter/flutter/tree/master/examples/platform_channel_swift)\]
- [Networking in the background](https://flutter.dev/docs/cookbook/networking/background-parsing)
## [0.0.1] - 05/02/2020
UI basis : a card carousel system, with a revealable options / stats pane.
```nil
+---------------+
| |
| |
| |
| Options |
+-------------> | | <-------------+
| | Stats | |
| | | |
| | | |
| | | |
| +---------------+ |
| ^ |
| | |
∨ ∨ ∨
+---------------+ +---------------+ +---------------+
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| Map | <---> | Data | <---> | Social |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
+---------------+ +---------------+ +---------------+
^ ^
| |
+-----------------------------------------------+
```
......@@ -39,7 +39,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.logair.logair_application"
minSdkVersion 18
minSdkVersion 19
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
......
package com.logair.logair_application
import androidx.annotation.NonNull;
import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant
import android.content.Context
import android.content.ContextWrapper
import android.content.Intent
import android.content.IntentFilter
import android.os.BatteryManager
import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
import io.flutter.plugin.common.MethodChannel
class MainActivity: FlutterActivity() {
private val _BATTERYCHANNEL = "logair.application/battery";
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, _BATTERYCHANNEL).setMethodCallHandler {
call, result ->
if (call.method == "getBatteryLevel") {
val batteryLevel = getBatteryLevel()
if (batteryLevel != -1)
result.success(batteryLevel);
else
result.error("UNAVAILABLE", "Battery Level unavailable", null)
} else
result.notImplemented()
}
}
private fun getBatteryLevel(): Int {
val batteryLevel: Int
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
val batteryManager = getSystemService(Context.BATTERY_SERVICE) as BatteryManager
batteryLevel = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
} else {
val intent = ContextWrapper(applicationContext).registerReceiver(null, IntentFilter(Intent.ACTION_BATTERY_CHANGED))
batteryLevel = intent!!.getIntExtra(BatteryManager.EXTRA_LEVEL, -1) * 100 / intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1)
}
return batteryLevel
}
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
......
import UIKit
import Flutter
enum ChannelName {
static let battery = "logair.application/battery"
}
enum FlutterErrorCodes {
static let unavailable = "UNAVAILABLE"
}
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
guard let controller = window?.rootViewController as? FlutterViewController else {
fatalError("rootViewController is not type FlutterViewController")
}
let batteryChannel = FlutterMethodChannel(name: ChannelName.battery,
binaryMessenger: controller.binaryMessenger)
batteryChannel.setMethodCallHandler({
[weak self] (call: FlutterMethodCall, result: FlutterResult) -> Void in
guard call.method == "getBatteryLevel" else {
result(FlutterMethodNotImplemented)
return
}
self?.receiveBatteryLevel(result: result)
})
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
private func receiveBatteryLevel(result: FlutterResult) {
let device = UIDevice.current
device.isBatteryMonitoringEnabled = true
guard device.batteryState != .unknown else {
result(FlutterError(code: MyFlutterErrorCode.unavailable,
message: "Battery info unavailable",
details: nil))
return
}
result(Int(device.batteryLevel * 100))
}
}
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that looks up messages for specific locales by
// delegating to the appropriate library.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:implementation_imports, file_names, unnecessary_new
// ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering
// ignore_for_file:argument_type_not_assignable, invalid_assignment
// ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases
// ignore_for_file:comment_references
import 'dart:async';
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart';
import 'messages_en.dart' as messages_en;
import 'messages_fr.dart' as messages_fr;
typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
'en': () => new Future.value(null),
'fr': () => new Future.value(null),
};
MessageLookupByLibrary _findExact(String localeName) {
switch (localeName) {
case 'en':
return messages_en.messages;
case 'fr':
return messages_fr.messages;
default:
return null;
}
}
/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) async {
var availableLocale = Intl.verifiedLocale(
localeName,
(locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
if (availableLocale == null) {
return new Future.value(false);
}
var lib = _deferredLibraries[availableLocale];
await (lib == null ? new Future.value(false) : lib());
initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
return new Future.value(true);
}
bool _messagesExistFor(String locale) {
try {
return _findExact(locale) != null;
} catch (e) {
return false;
}
}
MessageLookupByLibrary _findGeneratedMessagesFor(String locale) {
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
onFailure: (_) => null);
if (actualLocale == null) return null;
return _findExact(actualLocale);
}
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a en locale. All the
// messages from the main program should be duplicated here with the same
// function name.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
final messages = new MessageLookup();
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'en';
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"locationTitle" : MessageLookupByLibrary.simpleMessage("This app requires location services")
};
}
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a fr locale. All the
// messages from the main program should be duplicated here with the same
// function name.
// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
final messages = new MessageLookup();
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'fr';
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"locationTitle" : MessageLookupByLibrary.simpleMessage("L\'application requiert des permissions de localisation")
};
}
// GENERATED CODE - DO NOT MODIFY BY HAND
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'intl/messages_all.dart';
// **************************************************************************
// Generator: Flutter Intl IDE plugin
// Made by Localizely
// **************************************************************************
class S {
S(this.localeName);
static const AppLocalizationDelegate delegate =
AppLocalizationDelegate();
static Future<S> load(Locale locale) {
final String name = locale.countryCode.isEmpty ? locale.languageCode : locale.toString();
final String localeName = Intl.canonicalizedLocale(name);
return initializeMessages(localeName).then((_) {
Intl.defaultLocale = localeName;
return S(localeName);
});
}
static S of(BuildContext context) {
return Localizations.of<S>(context, S);
}
final String localeName;
String get locationTitle {
return Intl.message(
'This app requires location services',
name: 'locationTitle',
desc: 'Title for the location permission request prompt',
args: [],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
const AppLocalizationDelegate();
List<Locale> get supportedLocales {
return const <Locale>[
Locale('en', ''), Locale('fr', ''),
];
}
@override
bool isSupported(Locale locale) => _isSupported(locale);
@override
Future<S> load(Locale locale) => S.load(locale);
@override
bool shouldReload(AppLocalizationDelegate old) => false;
bool _isSupported(Locale locale) {
if (locale != null) {
for (Locale supportedLocale in supportedLocales) {
if (supportedLocale.languageCode == locale.languageCode) {
return true;
}
}
}
return false;
}
}
\ No newline at end of file
{
"@@last_modified": "2020-02-05T12:54:12.371059",
"locationTitle": "This app requires location services",
"@locationTitle": {
"description": "Title for the location permission request prompt",
"type": "text",
"placeholders": {}
}
}
\ No newline at end of file
"@@last_modified": "2020-02-05T17:25:56.614777",
"ok": "OK",
"@ok": {
"type": "text",
"placeholders": {}
},
"cancel": "Cancel",
"@cancel": {
"type": "text",
"placeholders": {}
},
"locationPromptTitle": "This app needs to use location services",
"@locationPromptTitle": {
"description": "Title for the location permission request prompt",
"type": "text",
"placeholders": {}
},
"locationPromptReason": "To use Bluetooth Low Energy and to increase data collection accuracy, this permission is required.",
"@locationPromptReason": {
"description": "Reason for the location permission request prompt",
"type": "text",
"placeholders": {}
}
}
\ No newline at end of file
{
"@@last_modified": "2020-02-05T12:54:12.371059",
"locationTitle": "L'application requiert des permissions de localisation",
"@locationTitle": {
"description": "Titre pour l'annonce the requête de permissions de localisations",
"type": "text",
"placeholders": {}
}
}
\ No newline at end of file
"@@last_modified": "2020-02-05T17:25:56.614777",
"ok": "OK",
"@ok": {
"type": "text",
"placeholders": {}
},
"cancel": "Annuler",
"@cancel": {
"type": "text",
"placeholders": {}
},
"locationTitle": "L'application requiert des permissions de localisation",
"@locationTitle": {
"description": "Titre pour l'annonce the requête de permissions de localisations",
"type": "text",
"placeholders": {}
},
"locationPromptReason": "Afin d'augmenter la précision de la localisation et pour utiliser Bluetooth Low Energy, cette permission est nécessaire.",
"@locationPromptReason": {
"description": "Raison pour l'annonce de requête de permissions de localisation",
"type": "text",
"placeholders": {}
}
}
\ No newline at end of file
{
"@@last_modified": "2020-02-05T12:54:12.371059",
"locationTitle": "This app needs to use location services",
"@locationTitle": {
"@@last_modified": "2020-02-05T17:32:54.083906",
"ok": "OK",
"@ok": {
"type": "text",
"placeholders": {}
},
"cancel": "Cancel",
"@cancel": {
"type": "text",
"placeholders": {}
},
"locationPromptTitle": "This app needs to use location services",
"@locationPromptTitle": {
"description": "Title for the location permission request prompt",
"type": "text",
"placeholders": {}
},
"locationPromptReason": "To use Bluetooth Low Energy and to increase data collection accuracy, this permission is required.",
"@locationPromptReason": {
"description": "Reason for the location permission request prompt",
"type": "text",
"placeholders": {}
}
}
\ No newline at end of file
......@@ -21,6 +21,9 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"locationTitle" : MessageLookupByLibrary.simpleMessage("This app needs to use location services")
"cancel" : MessageLookupByLibrary.simpleMessage("Cancel"),
"locationPromptReason" : MessageLookupByLibrary.simpleMessage("To use Bluetooth Low Energy and to increase data collection accuracy, this permission is required."),
"locationPromptTitle" : MessageLookupByLibrary.simpleMessage("This app needs to use location services"),
"ok" : MessageLookupByLibrary.simpleMessage("OK")
};
}
......@@ -21,6 +21,8 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"locationTitle" : MessageLookupByLibrary.simpleMessage("L\'application requiert des permissions de localisation")
"cancel" : MessageLookupByLibrary.simpleMessage("Annuler"),
"locationPromptReason" : MessageLookupByLibrary.simpleMessage("Afin d\'augmenter la précision de la localisation et pour utiliser Bluetooth Low Energy, cette permission est nécessaire."),
"ok" : MessageLookupByLibrary.simpleMessage("OK")
};
}
......@@ -2,7 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:intl/intl.dart';
import 'package:logair_application/l10n/messages_all.dart' show initializeMessages;
/// Reference https://github.com/dart-lang/intl
/// Reference https://github.com/dart-lang/intl https://pub.dev/packages/intl
/// Adding a localization should follow the guidelines defined here : https://github.com/flutter/website/blob/master/examples/internationalization/add_language/lib/main.dart
/// The frequent locales have already been integrated (but who knows when you'll need Belarusian).
class InternalLocalization {
......@@ -19,5 +19,29 @@ class InternalLocalization {
static InternalLocalization of(BuildContext context) => Localizations.of(context, InternalLocalization);
String get locationTitle => Intl.message('This app needs to use location services', name: 'locationTitle', desc: 'Title for the location permission request prompt', locale: 'en');
/* General Values */
String get ok => Intl.message(
'OK',
name: 'ok',
);
String get cancel => Intl.message(
'Cancel',
name: 'cancel',
);
/* Location Prompt */
String get locationPromptTitle => Intl.message(
'This app needs to use location services',
name: 'locationPromptTitle',
desc: 'Title for the location permission request prompt'
);
String get locationPromptReason => Intl.message(
'To use Bluetooth Low Energy and to increase data collection accuracy, this permission is required.',
name: 'locationPromptReason',
desc: 'Reason for the location permission request prompt'
);
}
......@@ -21,10 +21,10 @@ class DataPacket {
double _relativeHumidity;
/* Environment metrics */
double _PM1;
double _PM2_5;
double _PM4;
double _PM10;
double _pm1;
double _pm2_5;
double _pm4;
double _pm10;
DataPacket(this._data) {
_timeStamp = DateTime.now().millisecondsSinceEpoch;
......
import 'package:flutter/services.dart';
class BatteryHandler {
int _batteryLevel;
static const platform = const MethodChannel('logair.application/battery');