Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable checking for updates on web #171

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/src/components/provider/UpdateProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import { logError } from '~/util/analytics';
import { AppState } from 'react-native';
import { showInfo } from './SnackbarProvider';
import { showWarning } from './SnackbarProvider';
import { __WEB__ } from '~/util/config';

const onError = (error: unknown) => {
showWarning('Failed to download update. You may experience issues.');
logError('Error encountered during update', { error });
};

export const UpdateProvider = () => {
export function UpdateProvider() {
useEffect(() => {
if (__DEV__) return; // Updates don't work in development mode as bundle is always served from server
if (__DEV__ || __WEB__) return;

const onStartUpdateListener = Updates.addListener((e) => {
if (e.type === Updates.UpdateEventType.UPDATE_AVAILABLE) {
Expand Down Expand Up @@ -46,4 +47,4 @@ export const UpdateProvider = () => {
}, []);

return null;
};
}
3 changes: 3 additions & 0 deletions app/src/util/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import constants from 'expo-constants';
import type { Config } from '../../app.config';
import { Href } from 'expo-router';
import { resolveHref } from 'expo-router/src/link/href';
import { Platform } from 'react-native';

export const CONFIG = constants.expoConfig!.extra as Config;

Expand All @@ -18,3 +19,5 @@ export const getPathFromDeepLink = (link: string) => {
const path = link.match(PATTERN)?.[1];
return path && `/${path}`;
};

export const __WEB__ = Platform.OS === 'web';
Loading