refactor: 移除不必要的代码和调试信息,优化更新检查逻辑
This commit is contained in:
parent
6f165f0583
commit
e320bc29a2
|
|
@ -1,7 +1,7 @@
|
|||
import { Ionicons } from '@expo/vector-icons'
|
||||
import { useIsFocused } from '@react-navigation/native'
|
||||
import { root } from '@repo/core'
|
||||
import { FileController, FirmwareController, TemplateSocialController } from '@repo/sdk'
|
||||
import { TemplateSocialController } from '@repo/sdk'
|
||||
import { Block, ConfirmModal, Img, ListEmpty, Text, Toast } from '@share/components'
|
||||
import { FlashList } from '@shopify/flash-list'
|
||||
import { Image } from 'expo-image'
|
||||
|
|
@ -66,18 +66,8 @@ const Index = observer(function Index() {
|
|||
const [loadingMore, setLoadingMore] = useState(false)
|
||||
const [hasMore, setHasMore] = useState(true)
|
||||
|
||||
const loadBin = async () => {
|
||||
const firmware = root.get(FirmwareController)
|
||||
|
||||
const file = root.get(FileController)
|
||||
// file.convertToWebp('https://cdn.roasmax.cn/material/b59b75841c484d8bafec9c5636930b69.webp', 256)
|
||||
firmware.getLatestPublished('duomi').then((r) => {
|
||||
// console.log('latest duomi firmware:', r)
|
||||
})
|
||||
}
|
||||
useEffect(() => {
|
||||
console.log('expo env------------', process.env.EXPO_PUBLIC_ENV)
|
||||
loadBin()
|
||||
}, [])
|
||||
|
||||
/** ================= refs(核心) ================= */
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ function RootLayout() {
|
|||
}
|
||||
|
||||
// 上报到 Sentry(可选)
|
||||
Sentry.captureMessage(`Navigation: ${screenName}`, 'info')
|
||||
// Sentry.captureMessage(`Navigation: ${screenName}`, 'info')
|
||||
} catch (error) {
|
||||
console.error('❌ Navigation listener error:', error)
|
||||
Sentry.captureException(error)
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ class BleManager {
|
|||
if (this.flushTimerRef) {
|
||||
clearTimeout(this.flushTimerRef)
|
||||
}
|
||||
this.flushTimerRef = setTimeout(() => this.flushPendingDevices(), 500)
|
||||
this.flushTimerRef = setTimeout(() => this.flushPendingDevices(), 1000)
|
||||
}
|
||||
|
||||
private async requestBluetoothPermissions(): Promise<boolean> {
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ export class BleProtocolService {
|
|||
.join(' ')
|
||||
console.debug(`raw ${i + 1} frame \n ${rawFrame}`)
|
||||
}
|
||||
console.debug(`Writing frame ${i + 1}/${total}, length = ${frame.length}`)
|
||||
// console.debug(`Writing frame ${i + 1}/${total}, length = ${frame.length}`)
|
||||
const base64 = Buffer.from(frame).toString('base64')
|
||||
const result = await this.client.write(deviceId, BLE_UUIDS.SERVICE, BLE_UUIDS.WRITE_CHARACTERISTIC, base64, false)
|
||||
await new Promise((resolve) => setTimeout(resolve, FRAME_CONSTANTS.FRAME_INTERVAL))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import * as Sentry from '@sentry/react-native'
|
||||
import * as Updates from 'expo-updates'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
|
|
@ -32,16 +31,6 @@ export const useUpdateChecker = ({
|
|||
|
||||
console.log('update-------', update)
|
||||
|
||||
Sentry.captureMessage('useUpdateChecker', {
|
||||
tags: {
|
||||
useUpdateChecker: 'checkForUpdateAsync',
|
||||
component: 'useUpdateChecker',
|
||||
},
|
||||
contexts: {
|
||||
update: update,
|
||||
},
|
||||
})
|
||||
|
||||
if (update.isAvailable) {
|
||||
setHasUpdate(true)
|
||||
return true
|
||||
|
|
@ -54,18 +43,6 @@ export const useUpdateChecker = ({
|
|||
setCheckError(error instanceof Error ? error.message : '检查更新失败')
|
||||
setHasUpdate(false)
|
||||
|
||||
Sentry.captureMessage('useUpdateCheckerError', {
|
||||
tags: {
|
||||
useUpdateChecker: 'checkForUpdateAsync_failed',
|
||||
component: 'useUpdateChecker',
|
||||
},
|
||||
contexts: {
|
||||
update: {
|
||||
isEnabled: Updates.isEnabled,
|
||||
__DEV__: __DEV__,
|
||||
},
|
||||
},
|
||||
})
|
||||
return false
|
||||
} finally {
|
||||
setIsChecking(false)
|
||||
|
|
|
|||
Loading…
Reference in New Issue