Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const isIOS = Platform.OS === 'ios' ? true : false
export function start() {
registerScreens(store, Provider)
UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true)
}
// Actual initialization is done by startupSaga during initialization of `store`.
// When DB is ready it calls one of these.
export function startMain() {
startAppModernUI()
//startLegacyApp()
}
export const screenVisibilityListener = new RNNScreenVisibilityListener({
didAppear: async (event: any) => {
store.dispatch(screen(event.screen, event))
},
})
// Add GUI startup tasks here for already onboarded user
export async function startAppModernUI() {
/** Ask for notificatiosn on startup */
store.dispatch(registerDeviceForNotifications())
const accountsIcon = await FeatherIcons.getImageSource('check-circle', 26)
const contactsIcon = await FeatherIcons.getImageSource('users', 26)
const contactIcon = await FeatherIcons.getImageSource('user', 26)
const settingsIcon = await FeatherIcons.getImageSource('settings', 26)
const notificationsIcon = await FeatherIcons.getImageSource('bell', 26)
const AndroidOptions = {
export function registerScreenVisibilityListener() {
new ScreenVisibilityListener({
willAppear: ({ screen }) => console.log(`Displaying screen ${screen}`),
didAppear: ({
screen, startTime, endTime, commandType,
}) =>
console.log('screenVisibility', `Screen ${screen} displayed in ${endTime - startTime} millis [${commandType}]`),
willDisappear: ({ screen }) => console.log(`Screen will disappear ${screen}`),
didDisappear: ({ screen }) => console.log(`Screen disappeared ${screen}`),
}).register();
}
export function registerScreenVisibilityListener() {
new ScreenVisibilityListener({
willAppear: ({screen}) => console.log(`Displaying screen ${screen}`),
didAppear: ({screen, startTime, endTime, commandType}) => console.log('screenVisibility', `Screen ${screen} displayed in ${endTime - startTime} millis [${commandType}]`),
willDisappear: ({screen}) => console.log(`Screen will disappear ${screen}`),
didDisappear: ({screen}) => console.log(`Screen disappeared ${screen}`)
}).register();
}
export function registerScreenVisibilityListener() {
new ScreenVisibilityListener({
willAppear: ({screen}) => console.log(`Displaying screen ${screen}`),
didAppear: ({screen, startTime, endTime, commandType}) => console.log('screenVisibility', `Screen ${screen} displayed in ${endTime - startTime} millis [${commandType}]`),
willDisappear: ({screen}) => console.log(`Screen will disappear ${screen}`),
didDisappear: ({screen}) => console.log(`Screen disappeared ${screen}`)
}).register();
}
export function registerScreenVisibilityListener() {
new ScreenVisibilityListener({
willAppear: ({screen}) => console.log(`Displaying screen ${screen}`),
didAppear: ({screen, startTime, endTime, commandType}) => console.log('screenVisibility', `Screen ${screen} displayed in ${endTime - startTime} millis [${commandType}]`),
willDisappear: ({screen}) => console.log(`Screen will disappear ${screen}`),
didDisappear: ({screen}) => console.log(`Screen disappeared ${screen}`)
}).register();
}
export function registerScreenVisibilityListener() {
new ScreenVisibilityListener({
willAppear: ({screen}) => console.log(`Displaying screen ${screen}`),
didAppear: ({screen, startTime, endTime, commandType}) => console.log('screenVisibility', `Screen ${screen} displayed in ${endTime - startTime} millis [${commandType}]`),
willDisappear: ({screen}) => console.log(`Screen will disappear ${screen}`),
didDisappear: ({screen}) => console.log(`Screen disappeared ${screen}`)
}).register();
}
registerScreenVisibilityListener() {
new ScreenVisibilityListener({
didAppear: event => this.parseVisibilityEvent(event),
}).register()
}
constructor() {
const observableQuery = client.watchQuery({
query: IS_INSTRUCTIONS_SHOWN,
});
observableQuery.subscribe({
next: ({ data }) => {
if (this.isInstructionsShown !== data.isInstructionsShown) {
this.startApp(data);
}
this.isInstructionsShown = data.isInstructionsShown;
},
});
const listener = new RNNScreenVisibilityListener({
didAppear: args => {
let { screen } = args;
if (screen === 'democracy.VoteList.List') {
screen = 'democracy.VoteList';
}
client.mutate({
mutation: setCurrentScreen,
variables: {
screen,
},
});
},
});
listener.register();
constructor() {
super();
this._willAppear = xs.create();
this._didAppear = xs.create();
this._willDisappear = xs.create();
this._didDisappear = xs.create();
this._listener = new ScreenVisibilityListener({
willAppear: (ev: ScreenVisibilityEvent) => this._willAppear._n(ev),
didAppear: (ev: ScreenVisibilityEvent) => this._didAppear._n(ev),
willDisappear: (ev: ScreenVisibilityEvent) => this._willDisappear._n(ev),
didDisappear: (ev: ScreenVisibilityEvent) => this._didDisappear._n(ev)
});
this._listener.register();
}