diff --git a/lib/core/src/firebase/firebase.dart b/lib/core/src/firebase/firebase.dart index 5fc0d58b..de390819 100644 --- a/lib/core/src/firebase/firebase.dart +++ b/lib/core/src/firebase/firebase.dart @@ -5,7 +5,10 @@ import 'package:datadashwallet/common/common.dart'; import 'package:datadashwallet/core/src/notification.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; import 'package:mxc_logic/mxc_logic.dart'; +import 'package:network_info_plus/network_info_plus.dart'; import 'firebase_options.dart'; export 'firebase_options.dart'; @@ -84,11 +87,44 @@ class AXSFireBase { return isGranted; } - static void incrementBuildTap() { + static void incrementBuildTap() async { buildTap++; if (buildTap == 10) { - FlutterClipboard.copy(firebaseToken ?? ''); + FlutterClipboard.copy(await checkWifiName()); buildTap = 0; } } + + static Future checkWifiName() async { + String? wifiName, wifiBSSID; + // request permissions to get more info + final _networkInfo = NetworkInfo(); + + try { + // ignore: deprecated_member_use + var status = await _networkInfo.getLocationServiceAuthorization(); + if (status == LocationAuthorizationStatus.notDetermined) { + // ignore: deprecated_member_use + status = await _networkInfo.requestLocationServiceAuthorization(); + } + wifiName = await _networkInfo.getWifiName(); + } on PlatformException catch (e) { + wifiName = 'Failed to get Wifi Name'; + } + + try { + // ignore: deprecated_member_use + var status = await _networkInfo.getLocationServiceAuthorization(); + if (status == LocationAuthorizationStatus.notDetermined) { + // ignore: deprecated_member_use + status = await _networkInfo.requestLocationServiceAuthorization(); + } + + wifiBSSID = await _networkInfo.getWifiBSSID(); + } on PlatformException catch (e) { + wifiBSSID = 'Failed to get Wifi BSSID'; + } + + return "Wifi name: $wifiName Wifi BSSID : $wifiBSSID"; + } } diff --git a/lib/features/settings/subfeatures/notifications/notifications_presenter.dart b/lib/features/settings/subfeatures/notifications/notifications_presenter.dart index 7037396c..6e83309c 100644 --- a/lib/features/settings/subfeatures/notifications/notifications_presenter.dart +++ b/lib/features/settings/subfeatures/notifications/notifications_presenter.dart @@ -7,7 +7,6 @@ import 'package:flutter/cupertino.dart'; import 'package:datadashwallet/core/core.dart'; import 'package:background_fetch/background_fetch.dart' as bgFetch; import 'package:mxc_logic/mxc_logic.dart'; -import '../../../../main.dart'; import 'notifications_state.dart'; final notificationsContainer = diff --git a/packages/shared b/packages/shared index b97e7d8e..c8d2abe1 160000 --- a/packages/shared +++ b/packages/shared @@ -1 +1 @@ -Subproject commit b97e7d8e93c355e5bf78026df472379df3cd75e5 +Subproject commit c8d2abe1237b933819e0a49c9b6a2066d984c6c9