[iOS] Allow to send email with logs on iOS

This commit is contained in:
Roman Volosovskyi 2019-05-03 17:22:43 +03:00
parent aa3c0fb585
commit 74093f6843
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
6 changed files with 87 additions and 4 deletions

View File

@ -19,6 +19,7 @@ target 'StatusIm' do
pod 'react-native-camera', path: '../node_modules/react-native-camera'
pod 'react-native-webview', path: '../node_modules/react-native-webview'
pod 'SQLCipher', '~>3.0'
pod 'SSZipArchive'
target 'StatusImTests' do
inherit! :search_paths

View File

@ -77,6 +77,7 @@ PODS:
- SQLCipher/common (3.4.2)
- SQLCipher/standard (3.4.2):
- SQLCipher/common
- SSZipArchive (2.1.4)
- yoga (0.59.3.React)
DEPENDENCIES:
@ -88,6 +89,7 @@ DEPENDENCIES:
- react-native-webview (from `../node_modules/react-native-webview`)
- RNKeychain (from `../node_modules/react-native-keychain`)
- SQLCipher (~> 3.0)
- SSZipArchive
- yoga (from `../node_modules/react-native/ReactCommon/yoga`)
SPEC REPOS:
@ -102,6 +104,7 @@ SPEC REPOS:
- nanopb
- Protobuf
- SQLCipher
- SSZipArchive
EXTERNAL SOURCES:
React:
@ -133,8 +136,9 @@ SPEC CHECKSUMS:
react-native-webview: a42108b827082f8f0333529b0772102031d5960d
RNKeychain: 627c6095cef215dd3d9804a9a9cf45ab96aa3997
SQLCipher: f9fcf29b2e59ced7defc2a2bdd0ebe79b40d4990
SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322
yoga: 128daf064cacaede0c3bb27424b6b4c71052e6cd
PODFILE CHECKSUM: 2e0971124458d413e18b407b2337bf2c1d32f357
PODFILE CHECKSUM: 6a6c6a3aad3b4979df3974dc03b0bf305426ce72
COCOAPODS: 1.5.3

View File

@ -33,6 +33,7 @@
42B30EAD0EED4C72BB96D1AB /* Inter-ExtraBold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 6B145D55D500476BB45C2232 /* Inter-ExtraBold.otf */; };
475D202F20B7450D00879A77 /* libRNFirebase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 475D1FC020B7413500879A77 /* libRNFirebase.a */; };
4C16DE0C1F89508700AA10DB /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C16DE0B1F89508700AA10DB /* JavaScriptCore.framework */; };
4C9FBC56227C85640024181F /* libRNMail.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C9FBC50227C85250024181F /* libRNMail.a */; };
54BD2CE922134B6291FE1BFD /* Inter-Light-BETA.otf in Resources */ = {isa = PBXBuildFile; fileRef = 6864A92FD6844B928C52F5C1 /* Inter-Light-BETA.otf */; };
57C854A7993C47A3B1AECD32 /* Inter-MediumItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = C6B1215047604CD59A4C74D6 /* Inter-MediumItalic.otf */; };
5977C1355932428EBABA85A7 /* Inter-Thin-BETA.otf in Resources */ = {isa = PBXBuildFile; fileRef = 0A89F8F23C9847FFABBB253A /* Inter-Thin-BETA.otf */; };
@ -187,6 +188,13 @@
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RNFirebase;
};
4C9FBC4F227C85250024181F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4C9FBC19227C85250024181F /* RNMail.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 46FEDE7F1AFF192F00D3261C;
remoteInfo = RNMail;
};
4CB6B0F9223BA994003FA049 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
@ -548,6 +556,7 @@
475D1FCD20B7415300879A77 /* libFirebaseCore.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libFirebaseCore.a; sourceTree = BUILT_PRODUCTS_DIR; };
475D1FCE20B7415300879A77 /* libFirebaseMessaging.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libFirebaseMessaging.a; sourceTree = BUILT_PRODUCTS_DIR; };
4C16DE0B1F89508700AA10DB /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
4C9FBC19227C85250024181F /* RNMail.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNMail.xcodeproj; path = "../node_modules/react-native-mail/RNMail.xcodeproj"; sourceTree = "<group>"; };
4E586E1B0E544F64AA9F5BD1 /* libz.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
5535217F57E44D77AA9CF083 /* libRCTOrientation.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTOrientation.a; sourceTree = "<group>"; };
5E5A7625B76441D984EA8C0D /* RCTImageResizer.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RCTImageResizer.xcodeproj; path = "../node_modules/react-native-image-resizer/ios/RCTImageResizer.xcodeproj"; sourceTree = "<group>"; };
@ -622,6 +631,7 @@
files = (
ABC194E5221009A800EB06E6 /* libRNLanguages.a in Frameworks */,
475D202F20B7450D00879A77 /* libRNFirebase.a in Frameworks */,
4C9FBC56227C85640024181F /* libRNMail.a in Frameworks */,
C93242561FE1C68C00FE7099 /* libRCTAnimation.a in Frameworks */,
4C16DE0C1F89508700AA10DB /* JavaScriptCore.framework in Frameworks */,
B2DEA0D01E49E33300FA28D6 /* libRCTHttpServer.a in Frameworks */,
@ -881,6 +891,14 @@
name = Products;
sourceTree = "<group>";
};
4C9FBC1A227C85250024181F /* Products */ = {
isa = PBXGroup;
children = (
4C9FBC50227C85250024181F /* libRNMail.a */,
);
name = Products;
sourceTree = "<group>";
};
5C1C8762251D6EF495FB2384 /* Pods */ = {
isa = PBXGroup;
children = (
@ -904,6 +922,7 @@
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
4C9FBC19227C85250024181F /* RNMail.xcodeproj */,
ABC194DC2210099B00EB06E6 /* RNLanguages.xcodeproj */,
B461988B2210C98F00603CF2 /* RNCWebView.xcodeproj */,
475D1F8D20B7413500879A77 /* RNFirebase.xcodeproj */,
@ -1297,6 +1316,10 @@
ProductGroup = ABC194DD2210099B00EB06E6 /* Products */;
ProjectRef = ABC194DC2210099B00EB06E6 /* RNLanguages.xcodeproj */;
},
{
ProductGroup = 4C9FBC1A227C85250024181F /* Products */;
ProjectRef = 4C9FBC19227C85250024181F /* RNMail.xcodeproj */;
},
{
ProductGroup = 475D1EEE20B73EE000879A77 /* Products */;
ProjectRef = AF409BB755B94FB1BBA01927 /* RNSecureRandom.xcodeproj */;
@ -1428,6 +1451,13 @@
remoteRef = 475D1FBF20B7413500879A77 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
4C9FBC50227C85250024181F /* libRNMail.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNMail.a;
remoteRef = 4C9FBC4F227C85250024181F /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
4CB6B0FA223BA994003FA049 /* libjsi.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;

View File

@ -3,6 +3,7 @@
#import "React/RCTBridge.h"
#import "React/RCTEventDispatcher.h"
#import "Statusgo/Statusgo.h"
#import <SSZipArchive.h>
@interface NSDictionary (BVJSONString)
-(NSString*) bv_jsonStringWithPrettyPrint:(BOOL) prettyPrint;
@ -227,11 +228,56 @@ RCT_EXPORT_METHOD(sendDataNotification:(NSString *)dataPayloadJSON
////////////////////////////////////////////////////////////////////
#pragma mark - SendLogs method
//////////////////////////////////////////////////////////////////// sendLogs
RCT_EXPORT_METHOD(sendLogs:(NSString *)dbJson) {
RCT_EXPORT_METHOD(sendLogs:(NSString *)dbJson
callback:(RCTResponseSenderBlock)callback) {
// TODO: Implement SendLogs for iOS
#if DEBUG
NSLog(@"SendLogs() method called, not implemented");
#endif
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error = nil;
NSURL *rootUrl =[[fileManager
URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask]
lastObject];
NSURL *zipFile = [rootUrl URLByAppendingPathComponent:@"logs.zip"];
[fileManager removeItemAtPath:zipFile.path error:nil];
NSURL *logsFolderName = [rootUrl URLByAppendingPathComponent:@"logs"];
if (![fileManager fileExistsAtPath:logsFolderName.path])
[fileManager createDirectoryAtPath:logsFolderName.path withIntermediateDirectories:YES attributes:nil error:&error];
NSURL *dbFile = [logsFolderName URLByAppendingPathComponent:@"db.json"];
#if DEBUG
NSString *networkDirPath = @"ethereum/mainnet_rpc_dev";
#else
NSString *networkDirPath = @"ethereum/mainnet_rpc";
#endif
NSURL *networkDir = [rootUrl URLByAppendingPathComponent:networkDirPath];
NSURL *originalGethLogsFile = [networkDir URLByAppendingPathComponent:@"geth.log"];
NSURL *gethLogsFile = [logsFolderName URLByAppendingPathComponent:@"geth.log"];
[dbJson writeToFile:dbFile.path atomically:YES encoding:NSUTF8StringEncoding error:nil];
//NSString* gethLogs = StatusgoExportNodeLogs();
//[gethLogs writeToFile:gethLogsFile.path atomically:YES encoding:NSUTF8StringEncoding error:nil];
[fileManager copyItemAtPath:originalGethLogsFile.path toPath:gethLogsFile.path error:nil];
[SSZipArchive createZipFileAtPath:zipFile.path withContentsOfDirectory:logsFolderName.path];
[fileManager removeItemAtPath:logsFolderName.path error:nil];
callback(@[zipFile.path]);
}
//////////////////////////////////////////////////////////////////// addPeer
RCT_EXPORT_METHOD(exportLogs:(RCTResponseSenderBlock)callback) {
#if DEBUG
NSLog(@"exportLogs() method called");
#endif
NSString *result = StatusgoExportNodeLogs();
callback(@[result]);
}
//////////////////////////////////////////////////////////////////// addPeer

View File

@ -51,7 +51,6 @@
CE4E31B01D86951A0033ED64 /* Statusgo.framework */,
206C9F3C1D474E910063E3E6 /* Status */,
206C9F3B1D474E910063E3E6 /* Products */,
9E3F8AF11ED2CCBD0016D874 /* Frameworks */,
);
sourceTree = "<group>";
};
@ -111,6 +110,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 206C9F311D474E910063E3E6;
@ -172,6 +172,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../../ios/Pods/Headers/Public/SSZipArchive";
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -210,6 +211,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../../ios/Pods/Headers/Public/SSZipArchive";
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;

View File

@ -199,7 +199,7 @@
{:label-kw :t/log-level
:action-fn #(re-frame/dispatch [:navigate-to :log-level-settings])
:accessibility-label :log-level-settings-button}]
(when (and dev-mode? (not platform/ios?))
(when dev-mode?
[react/view styles/my-profile-settings-send-logs-wrapper
[react/view styles/my-profile-settings-send-logs
[profile.components/settings-item {:label-kw :t/send-logs