[Android] Add cancel request method (#7)
* feat: add cancel connect for android * fix: cancel connect only for android * fix: clean up the project * chore: new fvm version * chore: code style and comments * chore: bump version to 0.0.8
This commit is contained in:
@@ -135,6 +135,10 @@ class AppService extends ChangeNotifier {
|
||||
|
||||
Future<void> stopDiscovery() async {
|
||||
try {
|
||||
final hasRunning = await hasRunningJobs();
|
||||
if (hasRunning) {
|
||||
await cancelConnect();
|
||||
}
|
||||
final result = await _nearbyService.stopDiscovery();
|
||||
if (result) {
|
||||
updateState(AppState.readyToDiscover);
|
||||
@@ -170,6 +174,17 @@ class AppService extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> cancelConnect() async {
|
||||
try {
|
||||
await _nearbyService.android?.cancelLastConnectionProcess();
|
||||
} on NearbyServiceBusyException catch (_) {
|
||||
_logBusyException();
|
||||
} catch (e, s) {
|
||||
_log(e, s);
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> stopListeningAll() async {
|
||||
await endCommunicationChannel();
|
||||
await stopListeningConnectedDevice();
|
||||
|
||||
Reference in New Issue
Block a user