ironOS native ios app
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: message when bluetooth is disabled

+127 -6
+8 -3
android/app/src/main/java/com/tinkcil/data/ble/BLEManager.kt
··· 40 40 import kotlin.coroutines.resume 41 41 42 42 enum class ConnectionState { 43 - DISCONNECTED, SCANNING, CONNECTING, CONNECTED 43 + DISCONNECTED, BLUETOOTH_OFF, SCANNING, CONNECTING, CONNECTED 44 44 } 45 45 46 46 @Singleton ··· 161 161 fun startScan() { 162 162 if (_connectionState.value == ConnectionState.SCANNING || _connectionState.value == ConnectionState.CONNECTED) return 163 163 164 - val scanner = bluetoothAdapter?.bluetoothLeScanner ?: run { 165 - _lastError.value = BLEError.PermissionDenied 164 + if (bluetoothAdapter == null || !bluetoothAdapter.isEnabled) { 165 + _connectionState.value = ConnectionState.BLUETOOTH_OFF 166 + return 167 + } 168 + 169 + val scanner = bluetoothAdapter.bluetoothLeScanner ?: run { 170 + _connectionState.value = ConnectionState.BLUETOOTH_OFF 166 171 return 167 172 } 168 173
+33
android/app/src/main/java/com/tinkcil/ui/components/ScanningOverlay.kt
··· 6 6 import androidx.compose.foundation.layout.fillMaxSize 7 7 import androidx.compose.foundation.layout.height 8 8 import androidx.compose.foundation.layout.size 9 + import androidx.compose.material.icons.Icons 10 + import androidx.compose.material.icons.filled.BluetoothDisabled 9 11 import androidx.compose.material3.Button 10 12 import androidx.compose.material3.CircularProgressIndicator 13 + import androidx.compose.material3.Icon 11 14 import androidx.compose.material3.MaterialTheme 12 15 import androidx.compose.material3.OutlinedButton 13 16 import androidx.compose.material3.Text ··· 58 61 color = MaterialTheme.colorScheme.onSurface, 59 62 textAlign = TextAlign.Center 60 63 ) 64 + } 65 + ConnectionState.BLUETOOTH_OFF -> { 66 + Icon( 67 + imageVector = Icons.Filled.BluetoothDisabled, 68 + contentDescription = null, 69 + modifier = Modifier.size(48.dp), 70 + tint = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5f) 71 + ) 72 + Spacer(modifier = Modifier.height(24.dp)) 73 + Text( 74 + text = stringResource(R.string.bluetooth_off_title), 75 + style = MaterialTheme.typography.headlineSmall, 76 + color = MaterialTheme.colorScheme.onSurface, 77 + textAlign = TextAlign.Center 78 + ) 79 + Spacer(modifier = Modifier.height(8.dp)) 80 + Text( 81 + text = stringResource(R.string.bluetooth_off_message), 82 + style = MaterialTheme.typography.bodyMedium, 83 + color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.7f), 84 + textAlign = TextAlign.Center 85 + ) 86 + Spacer(modifier = Modifier.height(24.dp)) 87 + Button(onClick = onScanAgain) { 88 + Text(stringResource(R.string.connection_scan_again)) 89 + } 90 + Spacer(modifier = Modifier.height(12.dp)) 91 + OutlinedButton(onClick = onTryDemo) { 92 + Text(stringResource(R.string.try_demo)) 93 + } 61 94 } 62 95 ConnectionState.DISCONNECTED -> { 63 96 Text(
+2
android/app/src/main/res/values/strings.xml
··· 9 9 <string name="connection_no_device_found">No device found</string> 10 10 <string name="connection_scan_again">Scan Again</string> 11 11 <string name="bluetooth_error_title">Bluetooth Error</string> 12 + <string name="bluetooth_off_title">Bluetooth is Off</string> 13 + <string name="bluetooth_off_message">Turn on Bluetooth in Settings to connect to your soldering iron.</string> 12 14 <string name="try_demo">Try Demo</string> 13 15 14 16 <!-- Buttons -->
+2 -2
ios/Tinkcil.xcodeproj/project.pbxproj
··· 253 253 ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 254 254 CODE_SIGN_IDENTITY = "Apple Development"; 255 255 CODE_SIGN_STYLE = Automatic; 256 - CURRENT_PROJECT_VERSION = 8; 256 + CURRENT_PROJECT_VERSION = 9; 257 257 DEVELOPMENT_TEAM = M67B42LX8D; 258 258 ENABLE_PREVIEWS = YES; 259 259 GENERATE_INFOPLIST_FILE = YES; ··· 292 292 ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 293 293 CODE_SIGN_IDENTITY = "Apple Development"; 294 294 CODE_SIGN_STYLE = Automatic; 295 - CURRENT_PROJECT_VERSION = 8; 295 + CURRENT_PROJECT_VERSION = 9; 296 296 DEVELOPMENT_TEAM = M67B42LX8D; 297 297 ENABLE_PREVIEWS = YES; 298 298 GENERATE_INFOPLIST_FILE = YES;
+29 -1
ios/Tinkcil/ContentView.swift
··· 397 397 .accessibilityHidden(true) 398 398 399 399 VStack(spacing: 20) { 400 - if bleManager.isScanning || bleManager.connectionState.isConnecting { 400 + if case .error(let message) = bleManager.connectionState { 401 + Image(systemName: "bluetooth.slash") 402 + .font(.system(size: 36)) 403 + .foregroundStyle(.secondary) 404 + .padding(.bottom, 4) 405 + .accessibilityHidden(true) 406 + 407 + Text(message) 408 + .font(.headline) 409 + .accessibilityAddTraits(.isHeader) 410 + 411 + Text(String(localized: "bluetooth_off_message")) 412 + .font(.subheadline) 413 + .foregroundStyle(.secondary) 414 + .multilineTextAlignment(.center) 415 + 416 + Button(String(localized: "connection_scan_again")) { 417 + Haptics.light() 418 + bleManager.startScanning() 419 + } 420 + .buttonStyle(.borderedProminent) 421 + 422 + Button("Try Demo") { 423 + Haptics.light() 424 + bleManager.startDemoMode() 425 + } 426 + .font(.subheadline) 427 + .foregroundStyle(.secondary) 428 + } else if bleManager.isScanning || bleManager.connectionState.isConnecting { 401 429 ProgressView() 402 430 .scaleEffect(1.2) 403 431 .padding(.bottom, 4)
+53
ios/Tinkcil/Localizable.xcstrings
··· 1142 1142 } 1143 1143 } 1144 1144 }, 1145 + "bluetooth_off_message" : { 1146 + "extractionState" : "manual", 1147 + "localizations" : { 1148 + "de" : { 1149 + "stringUnit" : { 1150 + "state" : "translated", 1151 + "value" : "Aktiviere Bluetooth in den Einstellungen, um dich mit deinem Lötkolben zu verbinden." 1152 + } 1153 + }, 1154 + "en" : { 1155 + "stringUnit" : { 1156 + "state" : "translated", 1157 + "value" : "Turn on Bluetooth in Settings to connect to your soldering iron." 1158 + } 1159 + }, 1160 + "es" : { 1161 + "stringUnit" : { 1162 + "state" : "translated", 1163 + "value" : "Activa Bluetooth en Ajustes para conectar con tu soldador." 1164 + } 1165 + }, 1166 + "fr" : { 1167 + "stringUnit" : { 1168 + "state" : "translated", 1169 + "value" : "Activez le Bluetooth dans les Réglages pour vous connecter à votre fer à souder." 1170 + } 1171 + }, 1172 + "ja" : { 1173 + "stringUnit" : { 1174 + "state" : "translated", 1175 + "value" : "はんだごてに接続するには、設定でBluetoothをオンにしてください。" 1176 + } 1177 + }, 1178 + "ko" : { 1179 + "stringUnit" : { 1180 + "state" : "translated", 1181 + "value" : "인두기에 연결하려면 설정에서 Bluetooth를 켜세요." 1182 + } 1183 + }, 1184 + "ru" : { 1185 + "stringUnit" : { 1186 + "state" : "translated", 1187 + "value" : "Включите Bluetooth в Настройках для подключения к паяльнику." 1188 + } 1189 + }, 1190 + "zh-Hans" : { 1191 + "stringUnit" : { 1192 + "state" : "translated", 1193 + "value" : "请在设置中打开蓝牙以连接烙铁。" 1194 + } 1195 + } 1196 + } 1197 + }, 1145 1198 "connection_scan_again" : { 1146 1199 "extractionState" : "manual", 1147 1200 "localizations" : {