Skip to content

Commit

Permalink
remove: device unPair feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mediocre9 committed Feb 6, 2023
1 parent 99e2aca commit 682284b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
15 changes: 0 additions & 15 deletions lib/screens/home/cubit/home_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,4 @@ class HomeCubit extends Cubit<HomeState> {
emit(Paired(device: device));
}
}

/// Unpairs a bonded/paired device.
Future<void> unPairDevice(BluetoothDevice device) async {
_foundedDevices.removeWhere((element) => element.address == device.address);
if (device.isBonded) {
await _bluetooth
.removeDeviceBondWithAddress(device.address)
.then((isUnPairSucessful) {
if (isUnPairSucessful!) {
emit(BluetoothResponse(
message: 'Device ${device.name} has been unpaired!'));
}
});
}
}
}
5 changes: 0 additions & 5 deletions lib/screens/home/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ class HomeScreen extends StatelessWidget {
return _CardTile(
device: state.devices[i],
theme: theme,
onLongPress: () =>
event.unPairDevice(state.devices[i]),
onPressed: () => event.pairDevice(state.devices[i]),
);
},
Expand Down Expand Up @@ -125,13 +123,11 @@ class HomeScreen extends StatelessWidget {
class _CardTile extends StatelessWidget {
final BluetoothDevice device;
final void Function() onPressed;
final void Function() onLongPress;
const _CardTile({
Key? key,
required this.theme,
required this.device,
required this.onPressed,
required this.onLongPress,
}) : super(key: key);

final ThemeData theme;
Expand All @@ -155,7 +151,6 @@ class _CardTile extends StatelessWidget {
Text('MAC: ${device.address}', style: theme.textTheme.labelMedium),
],
),
onLongPress: onLongPress,
onTap: onPressed,
),
);
Expand Down

0 comments on commit 682284b

Please sign in to comment.