Files

64 lines
1.8 KiB
JavaScript
Raw Permalink Normal View History

2022-04-24 05:59:14 +05:00
/* eslint-disable @typescript-eslint/no-var-requires */
import NetInfo from "@react-native-community/netinfo";
2021-02-10 21:57:08 +05:00
import React from 'react';
2022-02-28 23:25:18 +05:00
import { AppRegistry, LogBox, Platform, UIManager } from 'react-native';
2022-04-01 10:04:58 +05:00
import Config from 'react-native-config';
import 'react-native-get-random-values';
2021-12-31 11:05:27 +05:00
import { SafeAreaProvider } from 'react-native-safe-area-context';
2023-11-24 15:11:38 +05:00
import { enableFreeze } from "react-native-screens";
import { BackgroundSync } from '../app/services/background-sync';
import Notifications from "../app/services/notifications";
import appJson from './app.json';
import './globals.js';
BackgroundSync.registerHeadlessTask();
BackgroundSync.start();
Notifications.init();
2023-11-24 15:11:38 +05:00
enableFreeze(true);
NetInfo.configure({
reachabilityUrl: "https://notesnook.com",
reachabilityTest: (response) => {
if (!response) return false;
return response?.status >= 200 && response?.status < 300;
}
});
2023-01-17 15:12:23 +05:00
2022-07-03 13:49:57 +05:00
const appName = appJson.name;
2022-04-01 10:04:58 +05:00
if (Config.isTesting) {
Date.prototype.toLocaleString = () => 'XX-XX-XX';
}
2021-07-19 09:20:55 +05:00
2022-01-10 14:35:55 +05:00
if (__DEV__) {
2022-08-31 13:03:22 +05:00
console.warn = () => null;
2022-01-25 19:52:44 +05:00
LogBox.ignoreAllLogs();
2022-01-10 14:35:55 +05:00
}
2020-05-06 01:55:05 +05:00
2020-01-17 21:26:01 +05:00
const AppProvider = () => {
2023-08-29 20:42:45 +05:00
const App = require('../app/app').default;
2022-02-28 23:25:18 +05:00
return <App />;
2020-01-17 21:26:01 +05:00
};
AppRegistry.registerComponent(appName, () => AppProvider);
2021-02-25 02:43:54 +05:00
const NotePreviewConfigureProvider = () => {
const App = require('../app/app').default;
return <App configureMode="note-preview" />;
};
AppRegistry.registerComponent("NotePreviewConfigure", () => NotePreviewConfigureProvider);
const ShareProvider = () => {
2023-12-04 12:32:35 +05:00
let NotesnookShare = require('../share/index').default;
2021-10-26 12:28:35 +05:00
return Platform.OS === 'ios' ? (
<SafeAreaProvider>
<NotesnookShare quicknote={false} />
</SafeAreaProvider>
2021-10-26 12:28:35 +05:00
) : (
<NotesnookShare quicknote={false} />
);
};
2023-11-30 12:20:22 +05:00
AppRegistry.registerComponent('NotesnookShare', () => ShareProvider);