2022-07-18 22:24:37 +02:00
|
|
|
import 'react-native-url-polyfill/auto'
|
2022-06-09 20:03:25 +02:00
|
|
|
import React, {useState, useEffect} from 'react'
|
2022-07-19 22:37:24 +02:00
|
|
|
import moment from 'moment'
|
2022-06-16 00:40:18 +02:00
|
|
|
import {whenWebCrypto} from './platform/polyfills.native'
|
2022-07-19 22:37:24 +02:00
|
|
|
import {RootStoreModel, setupState, RootStoreProvider} from './state'
|
2022-07-18 22:24:37 +02:00
|
|
|
import * as Routes from './view/routes'
|
2022-06-09 20:03:25 +02:00
|
|
|
|
2022-07-19 22:37:24 +02:00
|
|
|
moment.updateLocale('en', {
|
|
|
|
relativeTime: {
|
|
|
|
future: 'in %s',
|
|
|
|
past: '%s ago',
|
|
|
|
s: 'a few seconds',
|
|
|
|
ss: '%ds',
|
|
|
|
m: 'a minute',
|
|
|
|
mm: '%dm',
|
|
|
|
h: 'an hour',
|
|
|
|
hh: '%dh',
|
|
|
|
d: 'a day',
|
|
|
|
dd: '%dd',
|
|
|
|
w: 'a week',
|
|
|
|
ww: '%dw',
|
|
|
|
M: 'a month',
|
|
|
|
MM: '%dmo',
|
|
|
|
y: 'a year',
|
|
|
|
yy: '%dy',
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2022-06-09 20:03:25 +02:00
|
|
|
function App() {
|
2022-07-19 22:37:24 +02:00
|
|
|
const [rootStore, setRootStore] = useState<RootStoreModel | undefined>(
|
|
|
|
undefined,
|
|
|
|
)
|
2022-06-09 20:03:25 +02:00
|
|
|
|
|
|
|
// init
|
|
|
|
useEffect(() => {
|
2022-06-16 00:40:18 +02:00
|
|
|
whenWebCrypto.then(() => setupState()).then(setRootStore)
|
2022-06-09 20:03:25 +02:00
|
|
|
}, [])
|
|
|
|
|
|
|
|
// show nothing prior to init
|
|
|
|
if (!rootStore) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<RootStoreProvider value={rootStore}>
|
2022-06-09 23:32:03 +02:00
|
|
|
<Routes.Root />
|
2022-06-09 20:03:25 +02:00
|
|
|
</RootStoreProvider>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App
|