* Started with Channel Post List * Added markdown hashtag * Added TouchableWithFeedback component * Added utils/bottom_sheet * Removed BottomSheet in favor of future SlideUpPanel * Added markdown_block_quote * Added markdown_list_item * Added markdown_list * Added MarkDownTableCell component * Markdown_table - in progress - need to verify TS * Added markdown_table * Update Podfile.lock * Added deep_linking constant * Added utils/draft * Update config to include ExperimentalNormalizeMarkdownLinks * Added markdown_link * Added markdown_table_row * Added ProgressiveImage and RetriableImage components and images utils * Converted Retriable component to functional component * Added type definition for commonmark * Continuing with markdown TS * Markdown - Typing props [ in progress ] * Fix boolean flag with mardown block quote * Adding observable config to markdown_link * TS Fixes [ in progress ] * TS fixes * TS fixes - TextStyles * Update markdown.tsx * TS fixes on markdown * TS Fixes - AtMention component * AtMention [ IN PROGRESS ] * Add markdown support * Fix emoji and jumboEmoji on iOS * Fix handleMyTeam operator * Fix navigation style based on theme * Fix iOS MattermostManaged deleteDatabse return error type * wrap setNavigationStackStyles under a requestAnimationFrame * Add preventDoubleTap to channel mention * Increase double tap to 750ms * Fix handleReceivedPostsInChannel chunk query * Set initial navigation theme * Swizzle FastImage on iOS * fix preventDoubleTap test Co-authored-by: Avinash Lingaloo <> Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
89 lines
2.7 KiB
Objective-C
89 lines
2.7 KiB
Objective-C
//
|
|
// MattermostManaged.m
|
|
// Mattermost
|
|
//
|
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
//
|
|
|
|
#import "MattermostManaged.h"
|
|
|
|
@implementation MattermostManaged
|
|
|
|
RCT_EXPORT_MODULE();
|
|
|
|
+ (BOOL)requiresMainQueueSetup
|
|
{
|
|
return YES;
|
|
}
|
|
|
|
-(NSString *)appGroupId {
|
|
NSBundle *bundle = [NSBundle mainBundle];
|
|
NSString *appGroupId = [bundle objectForInfoDictionaryKey:@"AppGroupIdentifier"];
|
|
return appGroupId;
|
|
}
|
|
|
|
|
|
-(NSDictionary * ) appGroupSharedDirectory {
|
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
|
NSURL *sharedDirectory = [fileManager containerURLForSecurityApplicationGroupIdentifier: [self appGroupId]];
|
|
NSURL * databasePath = [sharedDirectory URLByAppendingPathComponent:@"databases"];
|
|
|
|
[fileManager createDirectoryAtPath:[databasePath path]
|
|
withIntermediateDirectories:true
|
|
attributes:nil
|
|
error:nil
|
|
];
|
|
return @{
|
|
@"sharedDirectory": [sharedDirectory path ],
|
|
@"databasePath" : [databasePath path]
|
|
};
|
|
}
|
|
|
|
|
|
|
|
- (NSDictionary *)constantsToExport {
|
|
return @{
|
|
@"appGroupIdentifier": [self appGroupId],
|
|
@"appGroupSharedDirectory" : [self appGroupSharedDirectory]
|
|
};
|
|
}
|
|
|
|
RCT_EXPORT_METHOD(isRunningInSplitView:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
BOOL isRunningInFullScreen = CGRectEqualToRect(
|
|
[UIApplication sharedApplication].delegate.window.frame,
|
|
[UIApplication sharedApplication].delegate.window.screen.bounds);
|
|
resolve(@{
|
|
@"isSplitView": @(!isRunningInFullScreen)
|
|
});
|
|
}
|
|
|
|
RCT_EXPORT_METHOD(deleteDatabaseDirectory: (NSString *)databaseName shouldRemoveDirectory: (BOOL) shouldRemoveDirectory callback: (RCTResponseSenderBlock)callback){
|
|
@try {
|
|
NSDictionary * appGroupDir = [self appGroupSharedDirectory];
|
|
NSString * databaseDir;
|
|
|
|
if(databaseName){
|
|
databaseDir = [NSString stringWithFormat:@"%@/%@%@", appGroupDir[@"databasePath"], databaseName , @".db"];
|
|
}
|
|
|
|
if(shouldRemoveDirectory){
|
|
databaseDir = appGroupDir[@"databasePath"];
|
|
}
|
|
|
|
|
|
NSFileManager * fileManager = [NSFileManager defaultManager];
|
|
NSError *error = nil;
|
|
|
|
BOOL successCode = [fileManager removeItemAtPath:databaseDir error:&error];
|
|
NSNumber * success= [NSNumber numberWithBool:successCode];
|
|
|
|
callback(@[(error ?: [NSNull null]), success]);
|
|
}
|
|
@catch (NSException *exception) {
|
|
NSLog(@"%@", exception.reason);
|
|
}
|
|
}
|
|
|
|
|
|
@end
|