mirror of
https://github.com/status-im/status-react.git
synced 2025-01-09 10:42:53 +00:00
92dcd1140b
The native module : `react-native-status` has always been 1 big fat file per platform which contained all of the native modules. In case of Android it was `StatusModule.java` This commit modularises it & attempts to thin out this 1 big file into these categories: - `AccountManager.java` - `EncryptionUtils.java` - `DatabaseManager.java` - `UIHelper.java` - `LogManager.java` - `NetworkManager.java` - `Utils.java` In case of iOS it was `RCTStatus.m` This commit modularises it & attempts to thin out this 1 big file into these categories: - `AccountManager.m` - `EncryptionUtils.m` - `DatabaseManager.m` - `UIHelper.m` - `LogManager.m` - `NetworkManager.m` - `Utils.m` In this commit we also remove a lot of unused native code which has no reference on cljs side.
40 lines
1.1 KiB
Objective-C
40 lines
1.1 KiB
Objective-C
#import "UIHelper.h"
|
|
#import "React/RCTBridge.h"
|
|
#import "React/RCTEventDispatcher.h"
|
|
|
|
@implementation UIHelper
|
|
|
|
RCT_EXPORT_MODULE();
|
|
|
|
#pragma mark - only android methods
|
|
|
|
RCT_EXPORT_METHOD(setSoftInputMode: (NSInteger) i) {
|
|
#if DEBUG
|
|
NSLog(@"setSoftInputMode() works only on Android");
|
|
#endif
|
|
}
|
|
|
|
RCT_EXPORT_METHOD(clearCookies) {
|
|
NSHTTPCookie *cookie;
|
|
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
|
|
|
|
for (cookie in [storage cookies]) {
|
|
[storage deleteCookie:cookie];
|
|
}
|
|
}
|
|
|
|
RCT_EXPORT_METHOD(clearStorageAPIs) {
|
|
[[NSURLCache sharedURLCache] removeAllCachedResponses];
|
|
|
|
NSString *path = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
|
|
NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil];
|
|
for (NSString *string in array) {
|
|
NSLog(@"Removing %@", [path stringByAppendingPathComponent:string]);
|
|
if ([[string pathExtension] isEqualToString:@"localstorage"])
|
|
[[NSFileManager defaultManager] removeItemAtPath:[path stringByAppendingPathComponent:string] error:nil];
|
|
}
|
|
}
|
|
|
|
|
|
@end
|