-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mobile): force ota updates on load
- Loading branch information
Showing
9 changed files
with
252 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { t } from '@lingui/macro' | ||
import { useLingui } from '@lingui/react' | ||
import { View } from 'react-native' | ||
import UpdateIllustration from '../svg-assets/update-illustration' | ||
import { Text } from '../ui/text' | ||
|
||
export function UpdateLoader() { | ||
const { i18n } = useLingui() | ||
return ( | ||
<View className="flex-1 items-center justify-center gap-12 bg-background"> | ||
<UpdateIllustration className="h-72 text-primary" /> | ||
<Text className="text-muted-foreground">{t( | ||
i18n, | ||
)`6pm is updating, please wait...`}</Text> | ||
</View> | ||
) | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useQuery } from '@tanstack/react-query' | ||
import * as Updates from 'expo-updates' | ||
|
||
export function useOTAUpdates() { | ||
const { isLoading, refetch } = useQuery({ | ||
queryKey: ['updates'], | ||
queryFn: async () => { | ||
await Updates.fetchUpdateAsync() | ||
await Updates.reloadAsync() | ||
}, | ||
enabled: false, | ||
}) | ||
|
||
async function checkForUpdate() { | ||
return await Updates.checkForUpdateAsync() | ||
} | ||
|
||
return { | ||
checkForUpdate, | ||
startUpdate: refetch, | ||
updating: isLoading, | ||
} | ||
} |
Oops, something went wrong.