Skip to content

Commit 3095066

Browse files
committed
corrected ble connection
1 parent 41a7964 commit 3095066

2 files changed

Lines changed: 40 additions & 6 deletions

File tree

apps/box/src/screens/InitialSetup/ConnectToBlox.screen.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { useInitialSetupNavigation } from '../../hooks/useTypedNavigation';
1414
import { Routes } from '../../navigation/navigationConfig';
1515
import { EConnectionStatus } from '../../models';
1616
import { BleManagerWrapper, DiscoveredDevice, ResponseAssembler } from '../../utils/ble';
17-
import { ActivityIndicator, StyleSheet, View } from 'react-native';
17+
import { ActivityIndicator, Platform, StyleSheet, View } from 'react-native';
1818
import axios from 'axios';
1919
import { API_URL } from '../../api/index';
2020
import { BleDeviceSelectionBottomSheet, FlashingCircle, FlashingTower } from '../../components';
@@ -244,6 +244,22 @@ export const ConnectToBloxScreen = () => {
244244
{t('connectToBlox.hotspotInstructions')}
245245
</FxText>
246246
) : null}
247+
{Platform.OS === 'ios' &&
248+
(connectionStatus === EConnectionStatus.bleFailed ||
249+
connectionStatus === EConnectionStatus.failed) ? (
250+
<FxBox
251+
marginTop="12"
252+
padding="12"
253+
borderRadius="s"
254+
backgroundColor="warningBase"
255+
>
256+
<FxText variant="bodySmallRegular" color="backgroundApp" textAlign="center">
257+
If your device is not found, go to iOS Settings → Bluetooth,
258+
find your Blox device (fulatower/fxblox), tap the (i) icon,
259+
and select "Forget This Device". Then try again.
260+
</FxText>
261+
</FxBox>
262+
) : null}
247263
<FxText variant="h200" textAlign="center">
248264
{t('connectToBlox.formatInstructions')}
249265
</FxText>

apps/box/src/screens/Settings/Bluetooth/BluetoothCommands.screen.tsx

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useRef, useState, useEffect } from 'react';
2-
import { Alert, ActivityIndicator, Modal, StyleSheet } from 'react-native';
2+
import { Alert, ActivityIndicator, Modal, Platform, StyleSheet } from 'react-native';
33
import AsyncStorage from '@react-native-async-storage/async-storage';
44
import {
55
FxArrowLeftIcon,
@@ -67,6 +67,7 @@ export const BluetoothCommandsScreen = () => {
6767
const [securityCode, setSecurityCode] = useState('');
6868
const [pendingCommand, setPendingCommand] = useState<string | null>(null);
6969
const [showConnectHint, setShowConnectHint] = useState(false);
70+
const [connectionAttempted, setConnectionAttempted] = useState(false);
7071
const [discoveredDevices, setDiscoveredDevices] = useState<DiscoveredDevice[]>([]);
7172
const deviceSelectionResolverRef = useRef<((id: string | null) => void) | null>(null);
7273
const bottomSheetRef = useRef<FxBottomSheetModalMethods>(null);
@@ -179,6 +180,7 @@ export const BluetoothCommandsScreen = () => {
179180
console.log('BluetoothCommands: Starting BLE connection...');
180181
setRunningCommand(true);
181182
setIsConnecting(true);
183+
setConnectionAttempted(true);
182184

183185
// Add a small delay to ensure UI updates
184186
await new Promise(resolve => setTimeout(resolve, 100));
@@ -373,10 +375,26 @@ export const BluetoothCommandsScreen = () => {
373375
<FxLoadingSpinner marginLeft="4" />
374376
</FxBox>
375377
) : (
376-
<FxText variant="bodyMediumRegular">
377-
Click the plug icon in the top right corner to connect to your
378-
FxBlox device using Bluetooth
379-
</FxText>
378+
<>
379+
<FxText variant="bodyMediumRegular">
380+
Click the plug icon in the top right corner to connect to your
381+
FxBlox device using Bluetooth
382+
</FxText>
383+
{Platform.OS === 'ios' && connectionAttempted && (
384+
<FxBox
385+
marginTop="16"
386+
padding="12"
387+
borderRadius="s"
388+
backgroundColor="warningBase"
389+
>
390+
<FxText variant="bodySmallRegular" color="backgroundApp">
391+
If your device is not found, go to iOS Settings → Bluetooth,
392+
find your Blox device (fulatower/fxblox), tap the (i) icon,
393+
and select "Forget This Device". Then try connecting again.
394+
</FxText>
395+
</FxBox>
396+
)}
397+
</>
380398
)}
381399
</FxBox>
382400
) : (

0 commit comments

Comments
 (0)