Remove ok sound on startup

This commit is contained in:
poka 2021-09-12 06:47:50 +02:00
parent 32ae4952cc
commit 7b88d34fdb
10 changed files with 138 additions and 24 deletions

View File

@ -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(), [

View File

@ -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(

View File

@ -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';

View File

@ -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:

View File

@ -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

BIN
web/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 917 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

98
web/index.html Normal file
View File

@ -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>

23
web/manifest.json Normal file
View File

@ -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"
}
]
}