Skip to content

Commit

Permalink
Merge pull request #171 from zallo-labs/Z-201-disable-web-updates
Browse files Browse the repository at this point in the history
Disable checking for updates on web
  • Loading branch information
hbriese authored Oct 26, 2023
2 parents b7c24a9 + 9c1e4e8 commit a7f6e4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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';

0 comments on commit a7f6e4f

Please sign in to comment.