diff --git a/Podfile b/Podfile index da625efb5..ad0f4f337 100644 --- a/Podfile +++ b/Podfile @@ -6,4 +6,4 @@ pod 'UICKeyChainStore', '~> 1.0.5' pod 'OpenSSL', '~> 1.0.108' pod 'MMDrawerController', '~> 0.5.0' pod 'libPhoneNumber-iOS', '~> 0.7' -pod 'CocoaLumberjack' +pod 'PastelogKit', '~> 1.0' diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index e2314d1f8..be4d0c15e 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -380,7 +380,6 @@ A1C32D5017A06538000A904E /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1C32D4F17A06537000A904E /* AddressBookUI.framework */; }; A1C32D5117A06544000A904E /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1C32D4D17A0652C000A904E /* AddressBook.framework */; }; AA0C8E498E2046B0B81EEE6E /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8313AE91B4954215858A5662 /* libPods.a */; }; - B62686301964AE3D00D2D697 /* LogSubmit.m in Sources */ = {isa = PBXBuildFile; fileRef = B626862F1964AE3D00D2D697 /* LogSubmit.m */; }; B67EBF5D19194AC60084CCFD /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B67EBF5C19194AC60084CCFD /* Settings.bundle */; }; B69CD25119773E79005CE69A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B69CD25019773E79005CE69A /* XCTest.framework */; }; B6B1013C196D213F007E3930 /* SGNKeychainUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B1013B196D213F007E3930 /* SGNKeychainUtil.m */; }; @@ -1103,8 +1102,6 @@ A1C32D4D17A0652C000A904E /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; A1C32D4F17A06537000A904E /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; }; A1FDCBEE16DAA6C300868894 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; - B626862E1964AE3D00D2D697 /* LogSubmit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LogSubmit.h; sourceTree = ""; }; - B626862F1964AE3D00D2D697 /* LogSubmit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LogSubmit.m; sourceTree = ""; }; B657DDC91911A40500F45B0C /* Signal.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Signal.entitlements; sourceTree = ""; }; B67EBF5C19194AC60084CCFD /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = Settings.bundle; path = SettingsBundle/Settings.bundle; sourceTree = SOURCE_ROOT; }; B69CD25019773E79005CE69A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; @@ -1973,8 +1970,6 @@ 76EB04B518170B33006006FC /* DecayingSampleEstimator.m */, 76EB04B618170B33006006FC /* EventWindow.h */, 76EB04B718170B33006006FC /* EventWindow.m */, - B626862E1964AE3D00D2D697 /* LogSubmit.h */, - B626862F1964AE3D00D2D697 /* LogSubmit.m */, 76EB04B818170B33006006FC /* LoggingUtil.h */, 76EB04B918170B33006006FC /* LoggingUtil.m */, 76EB04BA18170B33006006FC /* protocols */, @@ -3062,7 +3057,6 @@ 70B8010C190C55660042E3F0 /* AbstractMessage.m in Sources */, E197B61618BBEC1A00F073E5 /* StretchFactorController.m in Sources */, 76EB065018170B34006006FC /* DialerViewController.m in Sources */, - B62686301964AE3D00D2D697 /* LogSubmit.m in Sources */, 701231B518ECAA4500D456C4 /* EvpMessageDigest.m in Sources */, 76EB062218170B33006006FC /* CyclicalBuffer.m in Sources */, 76EB063C18170B33006006FC /* NumberUtil.m in Sources */, diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 0ff27b48b..c87e947cd 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -46,7 +46,7 @@ DDLogError(@"No previous version found. Possibly first launch since install."); [Environment setCurrent:[Release releaseEnvironmentWithLogging:nil]]; [Environment resetAppData]; // We clean previous keychain entries in case their are some entries remaining. - } else if ([currentVersion compare:previousVersion options:NSNumericSearch] == NSOrderedDescending) { + } else if ([currentVersion compare:previousVersion options:NSNumericSearch] == NSOrderedDescending){ // The application was updated DDLogWarn(@"Application was updated from %@ to %@", previousVersion, currentVersion); } @@ -108,6 +108,7 @@ //Accept push notification when app is not open NSDictionary *remoteNotif = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; if (remoteNotif) { + DDLogInfo(@"Application was launched by tapping a push notification."); [self application:application didReceiveRemoteNotification:remoteNotif]; } diff --git a/Signal/src/phone/signaling/ResponderSessionDescriptor.m b/Signal/src/phone/signaling/ResponderSessionDescriptor.m index 6da69f8ad..d404fe18b 100644 --- a/Signal/src/phone/signaling/ResponderSessionDescriptor.m +++ b/Signal/src/phone/signaling/ResponderSessionDescriptor.m @@ -105,11 +105,10 @@ } -(NSString*) description { - return [NSString stringWithFormat:@"relay name: %@, relay port: %d, session id: %llud, initiator phone number: %@, interop version: %d", + return [NSString stringWithFormat:@"relay name: %@, relay port: %d, session id: %llud, interop version: %d", relayServerName, relayUdpPort, sessionId, - initiatorNumber, interopVersion]; } diff --git a/Signal/src/profiling/LogSubmit.h b/Signal/src/profiling/LogSubmit.h deleted file mode 100644 index 597969b69..000000000 --- a/Signal/src/profiling/LogSubmit.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// LogSubmit.h -// Signal -// -// Created by Frederic Jacobs on 02/07/14. -// Copyright (c) 2014 Open Whisper Systems. All rights reserved. -// - -#import - -@interface LogSubmit : NSObject - -typedef void (^successBlock)(BOOL success, NSString *urlString); - -+(void)submitLogsWithCompletion:(successBlock)block; - -@property (nonatomic)NSMutableData *responseData; - -@end diff --git a/Signal/src/profiling/LogSubmit.m b/Signal/src/profiling/LogSubmit.m deleted file mode 100644 index 2b5e50a45..000000000 --- a/Signal/src/profiling/LogSubmit.m +++ /dev/null @@ -1,114 +0,0 @@ -// -// LogSubmit.m -// Signal -// -// Created by Frederic Jacobs on 02/07/14. -// Copyright (c) 2014 Open Whisper Systems. All rights reserved. -// - -#import "LogSubmit.h" -#import "AppDelegate.h" -#include -#include - -@interface LogSubmit () - - -@property (nonatomic, copy)successBlock block; - -@end - -@implementation LogSubmit - -+(void)submitLogsWithCompletion:(successBlock)block{ - AppDelegate *delegate = [[UIApplication sharedApplication]delegate]; - - NSArray *fileNames = delegate.fileLogger.logFileManager.sortedLogFileNames; - NSArray *filePaths = delegate.fileLogger.logFileManager.sortedLogFilePaths; - - NSMutableDictionary *gistFiles = [@{} mutableCopy]; - - for (unsigned int i = 0; i < [filePaths count]; i++) { - [gistFiles setObject:@{@"content":[NSString stringWithContentsOfFile:[filePaths objectAtIndex:i] encoding:NSUTF8StringEncoding error:nil]} forKey:[fileNames objectAtIndex:i]]; - } - - NSDictionary *gistDict = @{@"description":[self gistDescription], @"files":gistFiles}; - - NSData *postData = [NSJSONSerialization dataWithJSONObject:gistDict options:0 error:nil]; - - NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[[NSURL alloc] initWithString:@"https://api.github.com/gists"] cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:30]; - - [[self sharedManager] setResponseData:[NSMutableData data]]; - [[self sharedManager] setBlock:block]; - - [request setHTTPMethod:@"POST"]; - [request setHTTPBody:postData]; - - NSURLConnection *connection = [NSURLConnection connectionWithRequest:request delegate:[self sharedManager]]; - - [connection start]; - -} - -+ (id)sharedManager { - static LogSubmit *sharedMyManager = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedMyManager = [[self alloc] init]; - }); - return sharedMyManager; -} - -- (id)init { - if (self = [super init]) { - self.responseData = [NSMutableData data]; - } - return self; -} - --(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{ - [self.responseData appendData:data]; -} - -- (void)connectionDidFinishLoading:(NSURLConnection *)connection{ - - NSError *error; - NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:self.responseData options:0 error:&error]; - if (!error) { - self.block(true, [dict objectForKey:@"html_url"]); - } else{ - DDLogError(@"Error on debug response: %@", error); - self.block(false, nil); - } -} - -- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{ - DDLogError(@"Uploading logs failed with error: %@", error); - self.block(false,nil); -} - -- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{ - - NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response; - - if ( [httpResponse statusCode] != 201) { - DDLogError(@"Failed to submit debug log: %@", httpResponse.debugDescription); - self.block(false,nil); - } -} - - -+(NSString*)gistDescription{ - size_t size; - sysctlbyname("hw.machine", NULL, &size, NULL, 0); - char *machine = malloc(size); - sysctlbyname("hw.machine", machine, &size, NULL, 0); - NSString *platform = [NSString stringWithUTF8String:machine]; - free(machine); - - NSString *gistDesc = [NSString stringWithFormat:@"iPhone Version: %@, iOS Version: %@", platform,[UIDevice currentDevice].systemVersion]; - - return gistDesc; -} - -@end diff --git a/Signal/src/view controllers/SettingsViewController.m b/Signal/src/view controllers/SettingsViewController.m index 3f2c3566b..2da4acb91 100644 --- a/Signal/src/view controllers/SettingsViewController.m +++ b/Signal/src/view controllers/SettingsViewController.m @@ -8,7 +8,7 @@ #import "RecentCallManager.h" #import "RegisterViewController.h" #import "SettingsViewController.h" -#import "LogSubmit.h" +#import "Pastelog.h" #import "SGNKeychainUtil.h" #import "UIViewController+MMDrawerController.h" @@ -307,9 +307,9 @@ static NSString *const CHECKBOX_EMPTY_IMAGE_NAME = @"checkbox_empty"; [alert show]; - [LogSubmit submitLogsWithCompletion:^(BOOL success, NSString *urlString) { + [Pastelog submitLogsWithCompletion:^(NSError *error, NSString *urlString) { [alert dismissWithClickedButtonIndex:0 animated:YES]; - if (success) { + if (!error) { gistURL = urlString; UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:SETTINGS_SENDLOG_ALERT_TITLE message:SETTINGS_SENDLOG_ALERT_BODY delegate:self cancelButtonTitle:SETTINGS_SENDLOG_ALERT_PASTE otherButtonTitles:SETTINGS_SENDLOG_ALERT_EMAIL, nil]; [alertView show];