2022-04-24 05:59:14 +05:00
|
|
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
2025-01-20 17:17:01 +05:00
|
|
|
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';
|
2025-01-20 17:17:01 +05:00
|
|
|
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";
|
2025-01-20 17:17:01 +05:00
|
|
|
import { BackgroundSync } from '../app/services/background-sync';
|
|
|
|
|
import Notifications from "../app/services/notifications";
|
|
|
|
|
import appJson from './app.json';
|
|
|
|
|
import './globals.js';
|
2023-12-04 15:40:40 +05:00
|
|
|
|
2024-09-06 12:33:34 +05:00
|
|
|
BackgroundSync.registerHeadlessTask();
|
|
|
|
|
BackgroundSync.start();
|
|
|
|
|
Notifications.init();
|
|
|
|
|
|
2023-11-24 15:11:38 +05:00
|
|
|
enableFreeze(true);
|
2023-05-03 10:55:35 +05:00
|
|
|
NetInfo.configure({
|
|
|
|
|
reachabilityUrl: "https://notesnook.com",
|
|
|
|
|
reachabilityTest: (response) => {
|
|
|
|
|
if (!response) return false;
|
|
|
|
|
return response?.status >= 200 && response?.status < 300;
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-09-06 12:33:34 +05:00
|
|
|
|
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
|
|
|
|
2025-01-20 17:17:01 +05:00
|
|
|
const NotePreviewConfigureProvider = () => {
|
|
|
|
|
const App = require('../app/app').default;
|
|
|
|
|
return <App configureMode="note-preview" />;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
AppRegistry.registerComponent("NotePreviewConfigure", () => NotePreviewConfigureProvider);
|
|
|
|
|
|
|
|
|
|
|
2021-10-23 09:44:59 +05:00
|
|
|
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' ? (
|
2021-10-23 09:44:59 +05:00
|
|
|
<SafeAreaProvider>
|
|
|
|
|
<NotesnookShare quicknote={false} />
|
|
|
|
|
</SafeAreaProvider>
|
2021-10-26 12:28:35 +05:00
|
|
|
) : (
|
|
|
|
|
<NotesnookShare quicknote={false} />
|
2021-10-23 09:44:59 +05:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2023-11-30 12:20:22 +05:00
|
|
|
AppRegistry.registerComponent('NotesnookShare', () => ShareProvider);
|