Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/lib/database/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Database } from '@nozbe/watermelondb';
import SQLiteAdapter from '@nozbe/watermelondb/adapters/sqlite';
import logger from '@nozbe/watermelondb/utils/common/logger';
import RNFetchBlob from 'rn-fetch-blob';

import Subscription from './model/Subscription';
import Room from './model/Room';
Expand All @@ -26,8 +25,9 @@ import migrations from './model/migrations';
import serversMigrations from './model/serversMigrations';

import { isIOS } from '../../utils/deviceInfo';
import appGroup from '../../utils/appGroup';

const appGroupPath = isIOS ? `${ RNFetchBlob.fs.syncPathAppGroup('group.ios.chat.rocket') }/` : '';
const appGroupPath = isIOS ? appGroup.path : '';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice


if (__DEV__ && isIOS) {
console.log(appGroupPath);
Expand Down
11 changes: 11 additions & 0 deletions app/utils/appGroup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NativeModules } from 'react-native';

import { isIOS } from './deviceInfo';

const { AppGroup } = NativeModules;

const appGroup = {
path: isIOS ? AppGroup.path : ''
};

export default appGroup;
11 changes: 11 additions & 0 deletions ios/AppGroup/AppGroup.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// AppGroup.m
// RocketChatRN
//
// Created by Djorkaeff Alexandre Vilela Pereira on 8/31/20.
// Copyright © 2020 Facebook. All rights reserved.
//

#import "React/RCTBridgeModule.h"
@interface RCT_EXTERN_MODULE(AppGroup, NSObject)
@end
26 changes: 26 additions & 0 deletions ios/AppGroup/AppGroup.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// AppGroup.swift
// RocketChatRN
//
// Created by Djorkaeff Alexandre Vilela Pereira on 8/31/20.
// Copyright © 2020 Facebook. All rights reserved.
//

import Foundation

@objc(AppGroup)
class AppGroup: NSObject {

@objc
func constantsToExport() -> [AnyHashable : Any]! {
// Get App Group directory
var path = ""
if let suiteName = Bundle.main.object(forInfoDictionaryKey: "AppGroup") as? String {
if let directory = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: suiteName) {
path = directory.path
}
}

return ["path": "\(path)/"]
}
}
20 changes: 20 additions & 0 deletions ios/RocketChatRN.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
1E068CFE24FD2DC700A0FFC1 /* AppGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E068CFD24FD2DC700A0FFC1 /* AppGroup.swift */; };
1E068CFF24FD2DC700A0FFC1 /* AppGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E068CFD24FD2DC700A0FFC1 /* AppGroup.swift */; };
1E068D0124FD2E0500A0FFC1 /* AppGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E068D0024FD2E0500A0FFC1 /* AppGroup.m */; };
1E068D0224FD2E0500A0FFC1 /* AppGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E068D0024FD2E0500A0FFC1 /* AppGroup.m */; };
1E1EA80A2326CD2200E22452 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E1EA8092326CD2200E22452 /* AVFoundation.framework */; };
1E1EA80C2326CD2800E22452 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E1EA80B2326CD2800E22452 /* AudioToolbox.framework */; };
1E1EA80E2326CD2F00E22452 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E1EA80D2326CD2F00E22452 /* CoreGraphics.framework */; };
Expand Down Expand Up @@ -95,6 +99,8 @@
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = RocketChatRN/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = RocketChatRN/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = RocketChatRN/main.m; sourceTree = "<group>"; };
1E068CFD24FD2DC700A0FFC1 /* AppGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppGroup.swift; sourceTree = "<group>"; };
1E068D0024FD2E0500A0FFC1 /* AppGroup.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppGroup.m; sourceTree = "<group>"; };
1E1EA8092326CD2200E22452 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
1E1EA80B2326CD2800E22452 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
1E1EA80D2326CD2F00E22452 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -199,6 +205,15 @@
name = RocketChatRN;
sourceTree = "<group>";
};
1E068CFB24FD2DAF00A0FFC1 /* AppGroup */ = {
isa = PBXGroup;
children = (
1E068CFD24FD2DC700A0FFC1 /* AppGroup.swift */,
1E068D0024FD2E0500A0FFC1 /* AppGroup.m */,
);
path = AppGroup;
sourceTree = "<group>";
};
1EC6ACB122CB9FC300A41C61 /* ShareRocketChatRN */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -258,6 +273,7 @@
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
1E068CFB24FD2DAF00A0FFC1 /* AppGroup */,
13B07FAE1A68108700A75B9A /* RocketChatRN */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
1EC6ACB122CB9FC300A41C61 /* ShareRocketChatRN */,
Expand Down Expand Up @@ -813,7 +829,9 @@
files = (
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
7AAA749E23043B1E00F1ADE9 /* Watermelon.swift in Sources */,
1E068D0124FD2E0500A0FFC1 /* AppGroup.m in Sources */,
13B07FC11A68108700A75B9A /* main.m in Sources */,
1E068CFE24FD2DC700A0FFC1 /* AppGroup.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -822,7 +840,9 @@
buildActionMask = 2147483647;
files = (
1EC6ACF622CBA01500A41C61 /* ShareRocketChatRN.m in Sources */,
1E068CFF24FD2DC700A0FFC1 /* AppGroup.swift in Sources */,
7AC99C1C2339361F0000A0CB /* Watermelon.swift in Sources */,
1E068D0224FD2E0500A0FFC1 /* AppGroup.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down