diff --git a/example/lib/l10n.dart b/example/lib/l10n.dart index 84aa4d2..4df7734 100755 --- a/example/lib/l10n.dart +++ b/example/lib/l10n.dart @@ -133,8 +133,8 @@ class S { ? 'Make sure it is safe to unlock the door.' : '请确认现场安全后再远程开锁。'; static String get remoteUnlockUnavailable => isEn - ? 'The lock service reports remote unlock as unsupported or disabled. Enable remote unlock for this lock, then refresh its details and try again.' - : '云端锁详情显示不支持或未开启远程开锁。请在锁端/管理端开启该锁的远程开锁权限,刷新锁详情后重试。'; + ? 'Remote unlock could not be enabled on this lock. Check the lock Bluetooth connection and permissions, then try again.' + : '远程开锁未能在当前锁上开启,请检查锁的蓝牙连接和操作权限后重试。'; static String get remoteUnlockNeedsGateway => isEn ? 'This lock is not connected to a gateway for remote unlock.' : '该锁未绑定网关,无法使用网关远程开锁。'; diff --git a/example/lib/tabs/video_talk_tab.dart b/example/lib/tabs/video_talk_tab.dart index 21ef3c1..0125804 100755 --- a/example/lib/tabs/video_talk_tab.dart +++ b/example/lib/tabs/video_talk_tab.dart @@ -888,7 +888,7 @@ class _VideoTalkTabState extends State { if (token.isEmpty) { throw StateError(S.remoteUnlockNeedsLogin); } - if (fresh.isOnline != true) { + if (enabledLock.isOnline != true) { throw StateError(S.remoteUnlockNeedsOnline); } await StarCloudClient.instance.device.remoteOpenLock( diff --git a/example/lib/tabs/wifi_config_tab.dart b/example/lib/tabs/wifi_config_tab.dart index 6bf8b8c..0e8d147 100755 --- a/example/lib/tabs/wifi_config_tab.dart +++ b/example/lib/tabs/wifi_config_tab.dart @@ -83,6 +83,26 @@ class _WifiConfigTabState extends State { wifiConfiguredLockId.value = lock.lockId; _log_(S.logWifiConfigCompleted); + try { + final remoteUnlockReply = await StarCloudClient.instance.lockSetting + .setRemoteUnlockByContext(ctx, enabled: true); + if (remoteUnlockReply.status == 0) { + lock.lockFeature['remoteUnlock'] = 1; + lock.lockSetting.remoteUnlock = 1; + pairedLock.value = null; + pairedLock.value = lock; + _log_(S.isEn + ? 'Remote unlock enabled by default.' + : '远程开锁已默认开启。'); + } else { + final status = remoteUnlockReply.status; + _log_('Remote unlock default enable failed: ' + 'status=$status.'); + } + } catch (e) { + _log_('Remote unlock default enable failed: $e'); + } + try { final gatewayStatus = await StarCloudClient.instance.wifi.getGatewayStatus(