Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
impl: wifi info test on ios
Browse files Browse the repository at this point in the history
  • Loading branch information
reasje committed Jan 19, 2024
1 parent f4f6979 commit 4d99581
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
40 changes: 38 additions & 2 deletions lib/core/src/firebase/firebase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<String> 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";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
2 changes: 1 addition & 1 deletion packages/shared

0 comments on commit 4d99581

Please sign in to comment.