diff --git a/open_earable/lib/ble/ble_controller.dart b/open_earable/lib/ble/ble_controller.dart index a52a22d..91e29ea 100644 --- a/open_earable/lib/ble/ble_controller.dart +++ b/open_earable/lib/ble/ble_controller.dart @@ -70,7 +70,7 @@ class BluetoothController extends ChangeNotifier { _connectionStateSubscriptionLeft = _openEarableLeft.bleManager.connectionStateStream.listen((connected) { - _isV2 = _openEarableLeft.deviceHardwareVersion?.substring(0, 1) == "1"; + _isV2 = _openEarableLeft.deviceHardwareVersion?.substring(0, 1) == "2"; _connectedLeft = connected; if (connected) { _getSOCLeft(); @@ -157,6 +157,8 @@ class BluetoothController extends ChangeNotifier { prefs.setString("lastConnectedDeviceName" + otherSide, ""); } prefs.setString("lastConnectedDeviceName" + side, device.name); - notifyListeners(); + Future.microtask(() { + notifyListeners(); + }); } } diff --git a/open_earable/lib/controls_tab/views/v1_connect.dart b/open_earable/lib/controls_tab/views/v1_connect.dart index e02df46..3891470 100644 --- a/open_earable/lib/controls_tab/views/v1_connect.dart +++ b/open_earable/lib/controls_tab/views/v1_connect.dart @@ -204,13 +204,25 @@ class _ConnectCard extends State { } _connectButtonAction(BuildContext context) { - Navigator.of(context).push(MaterialPageRoute( - builder: (context) => Scaffold( - backgroundColor: Theme.of(context).colorScheme.background, - appBar: AppBar( - title: Text("Bluetooth Devices"), - ), - body: BLEPage(_openEarable, 0)))); + Navigator.of(context).push(Platform.isIOS + ? CupertinoPageRoute( + builder: (context) => CupertinoPageScaffold( + backgroundColor: + CupertinoTheme.of(context).scaffoldBackgroundColor, + navigationBar: CupertinoNavigationBar( + middle: Text("Bluetooth Devices"), + ), + child: BLEPage( + Provider.of(context, listen: false) + .openEarableLeft, + 0))) + : MaterialPageRoute( + builder: (context) => Scaffold( + backgroundColor: Theme.of(context).colorScheme.background, + appBar: AppBar( + title: Text("Bluetooth Devices"), + ), + body: BLEPage(_openEarable, 0)))); } void _tryAutoconnect( diff --git a/open_earable/lib/main.dart b/open_earable/lib/main.dart index 3a16fde..32bf2a6 100644 --- a/open_earable/lib/main.dart +++ b/open_earable/lib/main.dart @@ -242,18 +242,31 @@ class _MyHomePageState extends State { index: OpenEarableSettingsV2() .selectedButtonIndex))); } else { - Navigator.of(context).push(MaterialPageRoute( - builder: (context) => Scaffold( - backgroundColor: - Theme.of(context).colorScheme.background, - appBar: AppBar( - title: Text("Bluetooth Devices"), - ), - body: BLEPage( - Provider.of(context, - listen: false) - .openEarableLeft, - 0)))); + Navigator.of(context).push(Platform.isIOS + ? CupertinoPageRoute( + builder: (context) => CupertinoPageScaffold( + backgroundColor: CupertinoTheme.of(context) + .scaffoldBackgroundColor, + navigationBar: CupertinoNavigationBar( + middle: Text("Bluetooth Devices"), + ), + child: BLEPage( + Provider.of(context, + listen: false) + .openEarableLeft, + 0))) + : MaterialPageRoute( + builder: (context) => Scaffold( + backgroundColor: + Theme.of(context).colorScheme.background, + appBar: AppBar( + title: Text("Bluetooth Devices"), + ), + body: BLEPage( + Provider.of(context, + listen: false) + .openEarableLeft, + 0)))); } }, ), diff --git a/open_earable/lib/shared/earable_not_connected_warning.dart b/open_earable/lib/shared/earable_not_connected_warning.dart index 86d5d77..253b8ec 100644 --- a/open_earable/lib/shared/earable_not_connected_warning.dart +++ b/open_earable/lib/shared/earable_not_connected_warning.dart @@ -21,10 +21,17 @@ class EarableNotConnectedWarning extends StatelessWidget { SizedBox(height: 16), Center( child: Text( - "Not connected to\nOpenEarable " + - (OpenEarableSettingsV2().selectedButtonIndex == 0 - ? "(left)" - : "(right)"), + "Not connected to\nOpenEarable" + + ((Provider.of(context) + .openEarableLeft + .deviceHardwareVersion ?? + "1") + .substring(0, 1) == + "1" + ? "" + : (OpenEarableSettingsV2().selectedButtonIndex == 0 + ? " (left)" + : " (right)")), style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold,