diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-02-28 11:57:49 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-28 11:57:49 -0600 |
commit | dc7b5a34e72b63b039c6bc44543a8938add6b406 (patch) | |
tree | 0c004fd74fc3474ec411cd6fac40c1d03cb0cbd2 /src | |
parent | fcd8c7b037908e28f7d0393960eccbd6a734c143 (diff) | |
download | voidsky-dc7b5a34e72b63b039c6bc44543a8938add6b406.tar.zst |
Add a temporary lexicon refactor guard (#235)
* Add a temporary lexicon refactor guard * Fix test * Fix tsconfig formatting
Diffstat (limited to 'src')
-rw-r--r-- | src/App.native.tsx | 1 | ||||
-rw-r--r-- | src/lib/analytics.tsx | 2 | ||||
-rw-r--r-- | src/state/models/root-store.ts | 19 | ||||
-rw-r--r-- | src/view/shell/mobile/index.tsx | 33 |
4 files changed, 53 insertions, 2 deletions
diff --git a/src/App.native.tsx b/src/App.native.tsx index 17b8b4552..8bb204923 100644 --- a/src/App.native.tsx +++ b/src/App.native.tsx @@ -28,6 +28,7 @@ const App = observer(() => { analytics.init(store) notifee.init(store) SplashScreen.hide() + store.hackCheckIfUpgradeNeeded() Linking.getInitialURL().then((url: string | null) => { if (url) { store.nav.handleLink(url) diff --git a/src/lib/analytics.tsx b/src/lib/analytics.tsx index 091a7a1ea..5358a8682 100644 --- a/src/lib/analytics.tsx +++ b/src/lib/analytics.tsx @@ -7,7 +7,7 @@ const segmentClient = createClient({ writeKey: '8I6DsgfiSLuoONyaunGoiQM7A6y2ybdI', trackAppLifecycleEvents: false, }) -export const track = segmentClient.track.bind(segmentClient) +export const track = segmentClient?.track?.bind?.(segmentClient) export {useAnalytics} from '@segment/analytics-react-native' diff --git a/src/state/models/root-store.ts b/src/state/models/root-store.ts index 229c7b3c0..d60df7dde 100644 --- a/src/state/models/root-store.ts +++ b/src/state/models/root-store.ts @@ -2,7 +2,7 @@ * The root store is the base of all modeled state. */ -import {makeAutoObservable} from 'mobx' +import {makeAutoObservable, runInAction} from 'mobx' import {AtpAgent} from '@atproto/api' import {createContext, useContext} from 'react' import {DeviceEventEmitter, EmitterSubscription} from 'react-native' @@ -39,6 +39,23 @@ export class RootStoreModel { profiles = new ProfilesViewModel(this) linkMetas = new LinkMetasViewModel(this) + // HACK + // this flag is to track the lexicon breaking refactor + // it should be removed once we get that done + // -prf + hackUpgradeNeeded = false + async hackCheckIfUpgradeNeeded() { + try { + const res = await fetch('https://bsky.social/xrpc/app.bsky.feed.getLikes') + await res.text() + runInAction(() => { + this.hackUpgradeNeeded = res.status !== 501 + }) + } catch (e) { + this.log.error('Failed to hackCheckIfUpgradeNeeded', {e}) + } + } + constructor(agent: AtpAgent) { this.agent = agent makeAutoObservable(this, { diff --git a/src/view/shell/mobile/index.tsx b/src/view/shell/mobile/index.tsx index da8e73a60..6caf89232 100644 --- a/src/view/shell/mobile/index.tsx +++ b/src/view/shell/mobile/index.tsx @@ -362,6 +362,39 @@ export const MobileShell: React.FC = observer(() => { // transform: [{scale: newTabInterp}], // } + if (store.hackUpgradeNeeded) { + return ( + <View style={styles.outerContainer}> + <View style={[s.flexCol, s.p20, s.h100pct]}> + <View style={s.flex1} /> + <View> + <Text type="title-2xl" style={s.pb10}> + Update required + </Text> + <Text style={[s.pb20, s.bold]}> + Please update your app to the latest version. If no update is + available yet, please check the App Store in a day or so. + </Text> + <Text type="title" style={s.pb10}> + What's happening? + </Text> + <Text style={s.pb10}> + We're in the final stages of the AT Protocol's v1 development. To + make sure everything works as well as possible, we're making final + breaking changes to the APIs. + </Text> + <Text> + If we didn't botch this process, a new version of the app should + be available now. + </Text> + </View> + <View style={s.flex1} /> + <View style={s.footerSpacer} /> + </View> + </View> + ) + } + if (!store.session.hasSession) { return ( <View style={styles.outerContainer}> |