diff --git a/lib/main.dart b/lib/main.dart index 05d9d3a7843cf4da5a41c538da09435b4b986df2..a38fdb81baf10ba49a5a4166cd4529d56951a435 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -53,11 +53,11 @@ Future<void> main() async { // Get a valid GVA endpoint endPointGVA = await _homeProvider.getValidEndpoint(); - if (endPointGVA == 'HS') { - _homeProvider.playSound('faché', 0.8); - } else { - _homeProvider.playSound('start', 0.2); - } + // if (endPointGVA == 'HS') { + // _homeProvider.playSound('faché', 0.8); + // } else { + // _homeProvider.playSound('start', 0.2); + // } if (kReleaseMode && enableSentry) { // CatcherOptions debugOptions = CatcherOptions(DialogReportMode(), [ diff --git a/lib/models/home.dart b/lib/models/home.dart index 7c35cdc3d1322cca8cb76f3d520626e0d5ef2673..a39fec1bdc0288500047f0f10b288646bf46b996 100644 --- a/lib/models/home.dart +++ b/lib/models/home.dart @@ -1,8 +1,8 @@ import 'dart:convert'; import 'dart:io'; import 'dart:math'; -import 'package:audioplayers/audio_cache.dart'; -import 'package:audioplayers/audioplayers.dart'; +// import 'package:audioplayers/audio_cache.dart'; +// import 'package:audioplayers/audioplayers.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -23,7 +23,7 @@ class HomeProvider with ChangeNotifier { Text('Explorateur', style: TextStyle(color: Colors.grey[850])); List currentTab = [HistoryScreen(), WalletsHome()]; - AudioCache player = AudioCache(prefix: 'sounds/'); + // AudioCache player = AudioCache(prefix: 'sounds/'); get currentIndex => _currentIndex; @@ -132,10 +132,10 @@ class HomeProvider with ChangeNotifier { notifyListeners(); } - void playSound(String customSound, double volume) async { - await player.play('$customSound.wav', - volume: volume, mode: PlayerMode.LOW_LATENCY, stayAwake: false); - } + // void playSound(String customSound, double volume) async { + // await player.play('$customSound.wav', + // volume: volume, mode: PlayerMode.LOW_LATENCY, stayAwake: false); + // } void handleSearchEnd() { searchIcon = Icon( diff --git a/lib/models/walletOptions.dart b/lib/models/walletOptions.dart index d8aed5f774dbda897fdbe76eed59ec3fef8a578c..993f20257ae007f6e7e00116150315eb46b9752f 100644 --- a/lib/models/walletOptions.dart +++ b/lib/models/walletOptions.dart @@ -98,7 +98,7 @@ class WalletOptionsProvider with ChangeNotifier { throw 'Bad pubkey'; } } catch (e) { - _homeProvider.playSound('non', 0.6); + // _homeProvider.playSound('non', 0.6); log.e('ERROR READING FILE: $e'); this.pubkey.clear(); return 'bad'; diff --git a/pubspec.lock b/pubspec.lock index 45f95837403621e68bb4b86b60ab097408eebfc4..ed3d8ed0d0c1bc99099fc1ee10e7257ce4ef8411 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -35,14 +35,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" - audioplayers: - dependency: "direct main" - description: - name: audioplayers - url: "https://pub.dartlang.org" - source: hosted - version: "0.18.3" + version: "2.6.1" barcode: dependency: transitive description: @@ -140,7 +133,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.1" dubp: dependency: "direct main" description: @@ -926,7 +919,7 @@ packages: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "6.1.0+1" + version: "6.2.0" watcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index ab85da559a2306bcb59c45dd5b040b5eb04c6ab8..11fdb1bde83fa1362759d1b4e5259f601894f1cf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -46,7 +46,7 @@ dependencies: responsive_framework: ^0.0.14 responsive_builder: ^0.3.0 jdenticon_dart: ^2.0.0 - audioplayers: ^0.18.1 + # audioplayers: ^0.18.1 flutter_driver: sdk: flutter test: ^1.16.8 diff --git a/web/favicon.png b/web/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..8aaa46ac1ae21512746f852a42ba87e4165dfdd1 Binary files /dev/null and b/web/favicon.png differ diff --git a/web/icons/Icon-192.png b/web/icons/Icon-192.png new file mode 100644 index 0000000000000000000000000000000000000000..b749bfef07473333cf1dd31e9eed89862a5d52aa Binary files /dev/null and b/web/icons/Icon-192.png differ diff --git a/web/icons/Icon-512.png b/web/icons/Icon-512.png new file mode 100644 index 0000000000000000000000000000000000000000..88cfd48dff1169879ba46840804b412fe02fefd6 Binary files /dev/null and b/web/icons/Icon-512.png differ diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000000000000000000000000000000000000..803aca72bbb905e519abd99ba5bd924849a36e60 --- /dev/null +++ b/web/index.html @@ -0,0 +1,98 @@ +<!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 + --> + <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="gecko"> + <link rel="apple-touch-icon" href="icons/Icon-192.png"> + + <title>gecko</title> + <link rel="manifest" href="manifest.json"> +</head> +<body> + <!-- This script installs service_worker.js to provide PWA functionality to + application. For more information, see: + https://developers.google.com/web/fundamentals/primers/service-workers --> + <script> + var serviceWorkerVersion = null; + var scriptLoaded = false; + function loadMainDartJs() { + if (scriptLoaded) { + return; + } + scriptLoaded = true; + var scriptTag = document.createElement('script'); + scriptTag.src = 'main.dart.js'; + scriptTag.type = 'application/javascript'; + document.body.append(scriptTag); + } + + if ('serviceWorker' in navigator) { + // Service workers are supported. Use them. + window.addEventListener('load', function () { + // Wait for registration to finish before dropping the <script> tag. + // Otherwise, the browser will load the script multiple times, + // potentially different versions. + var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion; + navigator.serviceWorker.register(serviceWorkerUrl) + .then((reg) => { + function waitForActivation(serviceWorker) { + serviceWorker.addEventListener('statechange', () => { + if (serviceWorker.state == 'activated') { + console.log('Installed new service worker.'); + loadMainDartJs(); + } + }); + } + if (!reg.active && (reg.installing || reg.waiting)) { + // No active web worker and we have installed or are installing + // one for the first time. Simply wait for it to activate. + waitForActivation(reg.installing ?? reg.waiting); + } else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) { + // When the app updates the serviceWorkerVersion changes, so we + // need to ask the service worker to update. + console.log('New service worker available.'); + reg.update(); + waitForActivation(reg.installing); + } else { + // Existing service worker is still good. + console.log('Loading app from service worker.'); + loadMainDartJs(); + } + }); + + // If service worker doesn't succeed in a reasonable amount of time, + // fallback to plaint <script> tag. + setTimeout(() => { + if (!scriptLoaded) { + console.warn( + 'Failed to load app from service worker. Falling back to plain <script> tag.', + ); + loadMainDartJs(); + } + }, 4000); + }); + } else { + // Service workers not supported. Just drop the <script> tag. + loadMainDartJs(); + } + </script> +</body> +</html> diff --git a/web/manifest.json b/web/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..b57dd44198ec7a3a06410d52e40e4da290c56301 --- /dev/null +++ b/web/manifest.json @@ -0,0 +1,23 @@ +{ + "name": "gecko", + "short_name": "gecko", + "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" + } + ] +}