[FIX] Fix require cycle for appGroupPath (#4298)
* fix require cycle for appGroupPath * add console log
This commit is contained in:
parent
79cd150231
commit
74a82974f0
|
@ -1,11 +1,5 @@
|
||||||
import { NativeModules } from 'react-native';
|
import { NativeModules, Platform } from 'react-native';
|
||||||
|
|
||||||
import { isIOS } from '../methods/helpers';
|
|
||||||
|
|
||||||
const { AppGroup } = NativeModules;
|
const { AppGroup } = NativeModules;
|
||||||
|
|
||||||
const appGroup: { path: string } = {
|
export const appGroupPath: string = Platform.OS === 'ios' ? AppGroup.path : '';
|
||||||
path: isIOS ? AppGroup.path : ''
|
|
||||||
};
|
|
||||||
|
|
||||||
export default appGroup;
|
|
||||||
|
|
|
@ -2,8 +2,7 @@ import { Database } from '@nozbe/watermelondb';
|
||||||
import SQLiteAdapter from '@nozbe/watermelondb/adapters/sqlite';
|
import SQLiteAdapter from '@nozbe/watermelondb/adapters/sqlite';
|
||||||
import logger from '@nozbe/watermelondb/utils/common/logger';
|
import logger from '@nozbe/watermelondb/utils/common/logger';
|
||||||
|
|
||||||
import { isIOS } from '../methods/helpers';
|
import { appGroupPath } from './appGroup';
|
||||||
import appGroup from './appGroup';
|
|
||||||
import { isOfficial } from '../constants';
|
import { isOfficial } from '../constants';
|
||||||
import Subscription from './model/Subscription';
|
import Subscription from './model/Subscription';
|
||||||
import Room from './model/Room';
|
import Room from './model/Room';
|
||||||
|
@ -27,10 +26,8 @@ import migrations from './model/migrations';
|
||||||
import serversMigrations from './model/servers/migrations';
|
import serversMigrations from './model/servers/migrations';
|
||||||
import { TAppDatabase, TServerDatabase } from './interfaces';
|
import { TAppDatabase, TServerDatabase } from './interfaces';
|
||||||
|
|
||||||
const appGroupPath = isIOS ? appGroup.path : '';
|
if (__DEV__) {
|
||||||
|
console.log(`📂 ${appGroupPath}`);
|
||||||
if (__DEV__ && isIOS) {
|
|
||||||
console.log(appGroupPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDatabasePath = (name: string) => `${appGroupPath}${name}${isOfficial ? '' : '-experimental'}.db`;
|
const getDatabasePath = (name: string) => `${appGroupPath}${name}${isOfficial ? '' : '-experimental'}.db`;
|
||||||
|
|
Loading…
Reference in New Issue