mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
ios: Don't show the 'Stop Bluetooth' button unless BTStack is running.
This commit is contained in:
parent
b9dcfca071
commit
1178d82b5c
@ -35,6 +35,7 @@
|
||||
|
||||
@interface WiiMoteHelper : NSObject<BTDiscoveryDelegate, BTstackManagerDelegate, BTstackManagerListener>
|
||||
+ (WiiMoteHelper*)get;
|
||||
+ (BOOL)isBluetoothRunning;
|
||||
+ (void)stopBluetooth;
|
||||
- (void)showDiscovery;
|
||||
@end
|
||||
|
@ -61,6 +61,11 @@ static bool btOK;
|
||||
return instance;
|
||||
}
|
||||
|
||||
+ (BOOL)isBluetoothRunning
|
||||
{
|
||||
return btOK;
|
||||
}
|
||||
|
||||
+ (void)stopBluetooth
|
||||
{
|
||||
instance = nil;
|
||||
|
@ -63,12 +63,12 @@
|
||||
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
|
||||
{
|
||||
#ifdef WIIMOTE
|
||||
UIBarButtonItem* bbi = [[UIBarButtonItem alloc]
|
||||
initWithTitle:@"Stop Bluetooth"
|
||||
style:UIBarButtonItemStyleBordered
|
||||
target:[RetroArch_iOS get]
|
||||
action:@selector(stopBluetooth)];
|
||||
navigationController.topViewController.navigationItem.rightBarButtonItem = bbi;
|
||||
navigationController.topViewController.navigationItem.rightBarButtonItem = (![WiiMoteHelper isBluetoothRunning]) ? nil :
|
||||
[[UIBarButtonItem alloc]
|
||||
initWithTitle:@"Stop Bluetooth"
|
||||
style:UIBarButtonItemStyleBordered
|
||||
target:[RetroArch_iOS get]
|
||||
action:@selector(stopBluetooth)];
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -374,6 +374,7 @@
|
||||
{
|
||||
#ifdef WIIMOTE
|
||||
[WiiMoteHelper stopBluetooth];
|
||||
[_navigator.topViewController.navigationItem setRightBarButtonItem:nil animated:YES];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user