mirror of
https://github.com/minibits-cash/minibits_wallet.git
synced 2026-10-05 19:28:26 +00:00
Migrate to hot-updater 0.32.0 client API (init + checkForUpdate)
0.32.0 removed the per-call getUpdateSource() helper. The base URL and
auth header are now configured once via HotUpdater.init(), and
checkForUpdate() takes updateStrategy at the top level.
- App.tsx: add module-scope HotUpdater.init({ baseURL, requestHeaders })
so it runs before any update check. init's requestHeaders are merged
into every checkForUpdate call by the client.
- WalletScreen / SettingsScreen / UpdateScreen: replace
checkForUpdate({ source: getUpdateSource(...), requestHeaders })
with checkForUpdate({ updateStrategy: "fingerprint" }); drop the now
unused getUpdateSource import and HOT_UPDATER_URL/HOT_UPDATER_API_KEY
env imports (auth lives in init).
updateInfo.updateBundle() / HotUpdater.reload() are unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
189132790d
commit
f41284888b
+12
@@ -24,10 +24,22 @@ import { Text } from './components/Text'
|
||||
import useIsInternetReachable from './utils/useIsInternetReachable'
|
||||
import { MMKVStorage } from './services'
|
||||
import { Button, Screen } from './components'
|
||||
import { HotUpdater } from '@hot-updater/react-native'
|
||||
import { HOT_UPDATER_URL, HOT_UPDATER_API_KEY } from '@env'
|
||||
|
||||
setSizeMattersBaseWidth(375)
|
||||
setSizeMattersBaseHeight(812)
|
||||
|
||||
// Configure hot-updater once before any HotUpdater.checkForUpdate() call.
|
||||
// As of 0.32.0 the base URL and request headers are set here instead of
|
||||
// being passed per-call via the removed getUpdateSource() helper.
|
||||
HotUpdater.init({
|
||||
baseURL: HOT_UPDATER_URL,
|
||||
requestHeaders: {
|
||||
Authorization: `Bearer ${HOT_UPDATER_API_KEY}`,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
function App() {
|
||||
const {
|
||||
|
||||
@@ -7,11 +7,7 @@ import Animated, {
|
||||
} from 'react-native-reanimated'
|
||||
import notifee, { AuthorizationStatus } from '@notifee/react-native'
|
||||
import messaging from '@react-native-firebase/messaging'
|
||||
import { HotUpdater, getUpdateSource } from '@hot-updater/react-native'
|
||||
import {
|
||||
HOT_UPDATER_API_KEY,
|
||||
HOT_UPDATER_URL,
|
||||
} from '@env'
|
||||
import { HotUpdater } from '@hot-updater/react-native'
|
||||
import {ThemeCode, Themes, colors, spacing, typography, useThemeColor} from '../theme'
|
||||
import { changeIcon } from 'react-native-change-icon'
|
||||
import {ListItem, Screen, Text, Card, NwcIcon, Button, BottomModal, InfoModal, Icon, Header, AnimatedHeader} from '../components'
|
||||
@@ -71,12 +67,7 @@ export const SettingsScreen = observer(function SettingsScreen({ route }: Props)
|
||||
const checkForUpdate = async () => {
|
||||
try {
|
||||
const updateInfo = await HotUpdater.checkForUpdate({
|
||||
source: getUpdateSource(HOT_UPDATER_URL, {
|
||||
updateStrategy: "fingerprint",
|
||||
}),
|
||||
requestHeaders: {
|
||||
Authorization: `Bearer ${HOT_UPDATER_API_KEY}`,
|
||||
},
|
||||
})
|
||||
|
||||
log.debug('[checkForUpdate]', {updateInfo})
|
||||
|
||||
@@ -3,8 +3,6 @@ import React, {FC, useEffect, useState} from 'react'
|
||||
import {Linking, Platform, ScrollView, Switch, TextStyle, View, ViewStyle} from 'react-native'
|
||||
import {
|
||||
APP_ENV,
|
||||
HOT_UPDATER_API_KEY,
|
||||
HOT_UPDATER_URL,
|
||||
} from '@env'
|
||||
// import codePush from "react-native-code-push"
|
||||
import {colors, spacing, useThemeColor} from '../theme'
|
||||
@@ -26,7 +24,7 @@ import { log } from '../services'
|
||||
import {Env} from '../utils/envtypes'
|
||||
import { CommonActions, StaticScreenProps, useNavigation } from '@react-navigation/native'
|
||||
import { translate } from '../i18n'
|
||||
import { getUpdateSource, HotUpdater, useHotUpdaterStore } from '@hot-updater/react-native'
|
||||
import { HotUpdater, useHotUpdaterStore } from '@hot-updater/react-native'
|
||||
import { ResultModalInfo } from './Wallet/ResultModalInfo'
|
||||
|
||||
|
||||
@@ -90,12 +88,7 @@ export const UpdateScreen = observer(function UpdateScreen({ route }: Props) {
|
||||
try {
|
||||
setIsUpdateModalVisible(true)
|
||||
const updateInfo = await HotUpdater.checkForUpdate({
|
||||
source: getUpdateSource(HOT_UPDATER_URL, {
|
||||
updateStrategy: "fingerprint",
|
||||
}),
|
||||
requestHeaders: {
|
||||
Authorization: `Bearer ${HOT_UPDATER_API_KEY}`,
|
||||
},
|
||||
})
|
||||
|
||||
if (!updateInfo) {
|
||||
|
||||
@@ -42,8 +42,6 @@ import {WalletTask} from '../services'
|
||||
import {translate} from '../i18n'
|
||||
import AppError, { Err } from '../utils/AppError'
|
||||
import {
|
||||
HOT_UPDATER_API_KEY,
|
||||
HOT_UPDATER_URL,
|
||||
MINIBITS_MINT_URL,
|
||||
} from '@env'
|
||||
import { IncomingParser } from '../services/incomingParser'
|
||||
@@ -54,7 +52,7 @@ import { CurrencyAmount } from './Wallet/CurrencyAmount'
|
||||
import { LeftProfileHeader } from './ContactsScreen'
|
||||
import { getUnixTime } from 'date-fns/getUnixTime'
|
||||
import FastImage from 'react-native-fast-image'
|
||||
import { HotUpdater, getUpdateSource } from '@hot-updater/react-native'
|
||||
import { HotUpdater } from '@hot-updater/react-native'
|
||||
import { NfcIcon } from '../components/NfcIcon'
|
||||
|
||||
const MINT_CHECK_INTERVAL = 60
|
||||
@@ -127,12 +125,7 @@ export const WalletScreen = observer(function WalletScreen({ route }: Props) {
|
||||
const checkForUpdate = async () => {
|
||||
try {
|
||||
const updateInfo = await HotUpdater.checkForUpdate({
|
||||
source: getUpdateSource(HOT_UPDATER_URL, {
|
||||
updateStrategy: "fingerprint",
|
||||
}),
|
||||
requestHeaders: {
|
||||
Authorization: `Bearer ${HOT_UPDATER_API_KEY}`,
|
||||
},
|
||||
})
|
||||
|
||||
log.trace('[checkForUpdate]', {updateInfo})
|
||||
|
||||
Reference in New Issue
Block a user