[FIX] Fix require cycle for appGroupPath (#4298)

* fix require cycle for appGroupPath

* add console log
This commit is contained in:
Gleidson Daniel Silva 2022-06-13 10:58:00 -03:00 committed by GitHub
parent 79cd150231
commit 74a82974f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 14 deletions

View File

@ -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;

View File

@ -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`;