Multiple fixes
- Make logging optional if desired - HTTPS external URLs - Clean app data when re-registering - If registration future fails, bring back user interaction
This commit is contained in:
parent
2a0b0cbffc
commit
aca4733ac0
@ -379,13 +379,13 @@
|
||||
AA0C8E498E2046B0B81EEE6E /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8313AE91B4954215858A5662 /* libPods.a */; };
|
||||
B60C16651988999D00E97A6C /* VersionMigrations.m in Sources */ = {isa = PBXBuildFile; fileRef = B60C16641988999D00E97A6C /* VersionMigrations.m */; };
|
||||
B621B079198C69A100D36C3D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = B621B017198C69A100D36C3D /* Localizable.strings */; };
|
||||
B624C4E6198FD2830009264A /* whisperFake.cer in Resources */ = {isa = PBXBuildFile; fileRef = B624C4E5198FD2830009264A /* whisperFake.cer */; };
|
||||
B624C4E7198FD3910009264A /* whisperFake.cer in Resources */ = {isa = PBXBuildFile; fileRef = B624C4E5198FD2830009264A /* whisperFake.cer */; };
|
||||
B67ADDC41989FF8700E1A773 /* CallServerRequestsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B67ADDC31989FF8700E1A773 /* CallServerRequestsManager.m */; };
|
||||
B67EBF5D19194AC60084CCFD /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B67EBF5C19194AC60084CCFD /* Settings.bundle */; };
|
||||
B69B6305199573970072E805 /* whisperFake.cer in Resources */ = {isa = PBXBuildFile; fileRef = B69B6304199573970072E805 /* whisperFake.cer */; };
|
||||
B69CD25119773E79005CE69A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B69CD25019773E79005CE69A /* XCTest.framework */; };
|
||||
B6B1013C196D213F007E3930 /* SGNKeychainUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B1013B196D213F007E3930 /* SGNKeychainUtil.m */; };
|
||||
B6B9ECFC198B31BA00C620D3 /* PushManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B9ECFB198B31BA00C620D3 /* PushManager.m */; };
|
||||
B6C93C4E199567AD00EDF894 /* DebugLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = B6C93C4D199567AD00EDF894 /* DebugLogger.m */; };
|
||||
B90418E6183E9DD40038554A /* DateUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = B90418E5183E9DD40038554A /* DateUtil.m */; };
|
||||
B90418E7183E9DD40038554A /* DateUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = B90418E5183E9DD40038554A /* DateUtil.m */; };
|
||||
B942EB0E183A9633000887BB /* SearchBarTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = B942EB0D183A9633000887BB /* SearchBarTitleView.m */; };
|
||||
@ -1111,17 +1111,19 @@
|
||||
B621B069198C69A100D36C3D /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_CN; path = Localizable.strings; sourceTree = "<group>"; };
|
||||
B621B06C198C69A100D36C3D /* zh_TW.Big5 */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_TW.Big5; path = Localizable.strings; sourceTree = "<group>"; };
|
||||
B621B06F198C69A100D36C3D /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_TW; path = Localizable.strings; sourceTree = "<group>"; };
|
||||
B624C4E5198FD2830009264A /* whisperFake.cer */ = {isa = PBXFileReference; lastKnownFileType = file; name = whisperFake.cer; path = Signal/test/whisperFake.cer; sourceTree = SOURCE_ROOT; };
|
||||
B657DDC91911A40500F45B0C /* Signal.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Signal.entitlements; sourceTree = "<group>"; };
|
||||
B661C211198EE2EA00548CA1 /* iOSVersions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iOSVersions.h; path = src/environment/iOSVersions.h; sourceTree = "<group>"; };
|
||||
B67ADDC21989FF8700E1A773 /* CallServerRequestsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallServerRequestsManager.h; sourceTree = "<group>"; };
|
||||
B67ADDC31989FF8700E1A773 /* CallServerRequestsManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CallServerRequestsManager.m; sourceTree = "<group>"; };
|
||||
B67EBF5C19194AC60084CCFD /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = Settings.bundle; path = SettingsBundle/Settings.bundle; sourceTree = SOURCE_ROOT; };
|
||||
B69B6304199573970072E805 /* whisperFake.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = whisperFake.cer; sourceTree = "<group>"; };
|
||||
B69CD25019773E79005CE69A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
|
||||
B6B1013A196D213F007E3930 /* SGNKeychainUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGNKeychainUtil.h; sourceTree = "<group>"; };
|
||||
B6B1013B196D213F007E3930 /* SGNKeychainUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGNKeychainUtil.m; sourceTree = "<group>"; };
|
||||
B6B9ECFA198B31BA00C620D3 /* PushManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PushManager.h; sourceTree = "<group>"; };
|
||||
B6B9ECFB198B31BA00C620D3 /* PushManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PushManager.m; sourceTree = "<group>"; };
|
||||
B6C93C4C199567AD00EDF894 /* DebugLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugLogger.h; sourceTree = "<group>"; };
|
||||
B6C93C4D199567AD00EDF894 /* DebugLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugLogger.m; sourceTree = "<group>"; };
|
||||
B90418E4183E9DD40038554A /* DateUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateUtil.h; sourceTree = "<group>"; };
|
||||
B90418E5183E9DD40038554A /* DateUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DateUtil.m; sourceTree = "<group>"; };
|
||||
B942EB0C183A9633000887BB /* SearchBarTitleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchBarTitleView.h; sourceTree = "<group>"; };
|
||||
@ -1683,6 +1685,8 @@
|
||||
children = (
|
||||
76EB041218170B33006006FC /* Environment.h */,
|
||||
76EB041318170B33006006FC /* Environment.m */,
|
||||
B6C93C4C199567AD00EDF894 /* DebugLogger.h */,
|
||||
B6C93C4D199567AD00EDF894 /* DebugLogger.m */,
|
||||
76EB041418170B33006006FC /* LocalizableText.h */,
|
||||
76EB041518170B33006006FC /* LocalizableText.m */,
|
||||
76EB041618170B33006006FC /* PreferencesUtil.h */,
|
||||
@ -2228,6 +2232,7 @@
|
||||
A15706EA17F0CD6D007C2BD6 /* test */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B69B6304199573970072E805 /* whisperFake.cer */,
|
||||
76919BF51805D169008C664A /* contact */,
|
||||
A15706EB17F0CD6D007C2BD6 /* async */,
|
||||
A15706F217F0CD6D007C2BD6 /* audio */,
|
||||
@ -2881,7 +2886,6 @@
|
||||
D221A09B169C9E5E00537ABF /* Signal-Prefix.pch */,
|
||||
B661C211198EE2EA00548CA1 /* iOSVersions.h */,
|
||||
E1C407C117F0C246007BEE65 /* whisperReal.cer */,
|
||||
B624C4E5198FD2830009264A /* whisperFake.cer */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
@ -3278,7 +3282,6 @@
|
||||
E1370BE418A0686C00826894 /* outring.mp3 in Resources */,
|
||||
E1370BE518A0686C00826894 /* r.caf in Resources */,
|
||||
E1370BE618A0686C00826894 /* sonarping.mp3 in Resources */,
|
||||
B624C4E7198FD3910009264A /* whisperFake.cer in Resources */,
|
||||
E148751218A06AFD002CC4F3 /* HelveticaNeueLTStd-Bd.otf in Resources */,
|
||||
E148751318A06AFD002CC4F3 /* HelveticaNeueLTStd-Th.otf in Resources */,
|
||||
E148751418A06AFD002CC4F3 /* HelveticaNeueLTStd-Lt.otf in Resources */,
|
||||
@ -3306,7 +3309,7 @@
|
||||
76EB067918170B34006006FC /* InCallViewController.xib in Resources */,
|
||||
76EB068318170B34006006FC /* SettingsViewController.xib in Resources */,
|
||||
76EB068118170B34006006FC /* RegisterViewController.xib in Resources */,
|
||||
B624C4E6198FD2830009264A /* whisperFake.cer in Resources */,
|
||||
B69B6305199573970072E805 /* whisperFake.cer in Resources */,
|
||||
B97CBFB218861023008E0DE9 /* CountryCodeTableViewCell.xib in Resources */,
|
||||
B9A578B5183D610300C17105 /* FavouriteTableViewCell.xib in Resources */,
|
||||
B9B89C58185A2B7000A24465 /* LeftSideMenuCell.xib in Resources */,
|
||||
@ -3507,6 +3510,7 @@
|
||||
76EB065818170B34006006FC /* LeftSideMenuViewController.m in Sources */,
|
||||
76EB05EA18170B33006006FC /* CallProgress.m in Sources */,
|
||||
76EB05C218170B33006006FC /* DhPacketSharedSecretHashes.m in Sources */,
|
||||
B6C93C4E199567AD00EDF894 /* DebugLogger.m in Sources */,
|
||||
76EB063218170B33006006FC /* Crc32.m in Sources */,
|
||||
E197B62418BBF5BB00F073E5 /* SoundPlayer.m in Sources */,
|
||||
E197B61018BBEC1A00F073E5 /* EncodedAudioPacket.m in Sources */,
|
||||
@ -4499,7 +4503,10 @@
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "Signal/Signal-Prefix.pch";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = HAVE_CONFIG_H;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
HAVE_CONFIG_H,
|
||||
"RELEASE=1",
|
||||
);
|
||||
GCC_STRICT_ALIASING = NO;
|
||||
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO;
|
||||
GCC_WARN_STRICT_SELECTOR_MATCH = YES;
|
||||
|
||||
@ -29,11 +29,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.3</string>
|
||||
<string>1.0.4</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0.3</string>
|
||||
<string>1.0.4</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string></string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
|
||||
@ -1,14 +1,8 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "FutureSource.h"
|
||||
|
||||
#pragma mark Logging - Production logging wants us to write some logs to a file in case we need it for debugging.
|
||||
|
||||
#import <CocoaLumberjack/DDTTYLogger.h>
|
||||
#import <CocoaLumberjack/DDFileLogger.h>
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
@property (nonatomic, readonly) DDFileLogger *fileLogger;
|
||||
|
||||
@end
|
||||
|
||||
@ -2,12 +2,14 @@
|
||||
#import "AppAudioManager.h"
|
||||
#import "CallLogViewController.h"
|
||||
#import "CategorizingLogger.h"
|
||||
#import "DebugLogger.h"
|
||||
#import "DialerViewController.h"
|
||||
#import "DiscardingLog.h"
|
||||
#import "Environment.h"
|
||||
#import "InCallViewController.h"
|
||||
#import "LeftSideMenuViewController.h"
|
||||
#import "MMDrawerController.h"
|
||||
#import "PreferencesUtil.h"
|
||||
#import "NotificationTracker.h"
|
||||
#import "PushManager.h"
|
||||
#import "PriorityQueue.h"
|
||||
@ -28,7 +30,6 @@
|
||||
|
||||
@property (nonatomic, strong) MMDrawerController *drawerController;
|
||||
@property (nonatomic, strong) NotificationTracker *notificationTracker;
|
||||
@property (nonatomic) DDFileLogger *fileLogger;
|
||||
|
||||
@end
|
||||
|
||||
@ -38,8 +39,8 @@
|
||||
|
||||
- (void)performUpdateCheck{
|
||||
// We check if NSUserDefaults key for version exists.
|
||||
NSString *previousVersion = [[NSUserDefaults standardUserDefaults] objectForKey:kSignalVersionKey];
|
||||
NSString *currentVersion = [NSString stringWithFormat:@"%@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]];
|
||||
NSString *previousVersion = [[Environment preferences] lastRanVersion];
|
||||
NSString *currentVersion = [[Environment preferences] setAndGetCurrentVersion];
|
||||
|
||||
if (!previousVersion) {
|
||||
DDLogError(@"No previous version found. Possibly first launch since install.");
|
||||
@ -52,9 +53,6 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:kSignalVersionKey];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
|
||||
@ -63,15 +61,23 @@
|
||||
*/
|
||||
|
||||
- (void)protectPreferenceFiles{
|
||||
NSMutableArray *pathsToExclude = [NSMutableArray array];
|
||||
|
||||
[pathsToExclude addObject:[[[NSHomeDirectory() stringByAppendingString:@"/Library/Preferences/"] stringByAppendingString:[[NSBundle mainBundle] bundleIdentifier]] stringByAppendingString:@".plist"]];
|
||||
NSMutableArray *pathsToExclude = [NSMutableArray array];
|
||||
NSString *preferencesPath =[NSHomeDirectory() stringByAppendingString:@"/Library/Preferences/"];
|
||||
|
||||
NSError *error;
|
||||
|
||||
NSDictionary *attrs = [NSDictionary dictionaryWithObject:NSFileProtectionComplete forKey:NSFileProtectionKey];
|
||||
[[NSFileManager defaultManager] setAttributes:attrs ofItemAtPath:preferencesPath error:&error];
|
||||
|
||||
[pathsToExclude addObject:[[preferencesPath stringByAppendingString:[[NSBundle mainBundle] bundleIdentifier]] stringByAppendingString:@".plist"]];
|
||||
|
||||
NSString *logPath = [NSHomeDirectory() stringByAppendingString:@"/Library/Caches/Logs/"];
|
||||
NSArray *logsFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:logPath error:&error];
|
||||
|
||||
attrs = [NSDictionary dictionaryWithObject:NSFileProtectionComplete forKey:NSFileProtectionKey];
|
||||
[[NSFileManager defaultManager] setAttributes:attrs ofItemAtPath:logPath error:&error];
|
||||
|
||||
for (NSUInteger i = 0; i < [logsFiles count]; i++) {
|
||||
[pathsToExclude addObject:[logPath stringByAppendingString:[logsFiles objectAtIndex:i]]];
|
||||
}
|
||||
@ -85,7 +91,6 @@
|
||||
DDLogError(@"Error while removing log files from backup: %@", error.description);
|
||||
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:NSLocalizedString(@"WARNING", @"") message:NSLocalizedString(@"DISABLING_BACKUP_FAILED", @"") delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", @"") otherButtonTitles:nil, nil];
|
||||
[alert show];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -93,11 +98,19 @@
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
|
||||
[DDLog addLogger:[DDTTYLogger sharedInstance]];
|
||||
self.fileLogger = [[DDFileLogger alloc] init]; //Logging to file, because it's in the Cache folder, they are not uploaded in iTunes/iCloud backups.
|
||||
self.fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling.
|
||||
self.fileLogger.logFileManager.maximumNumberOfLogFiles = 3; // Keep three days of logs.
|
||||
[DDLog addLogger:self.fileLogger];
|
||||
BOOL loggingIsEnabled;
|
||||
|
||||
#ifdef DEBUG
|
||||
loggingIsEnabled = TRUE;
|
||||
[[DebugLogger sharedInstance] enableTTYLogging];
|
||||
|
||||
#elif RELEASE
|
||||
loggingIsEnabled = [[Environment preferences] loggingIsEnabled];
|
||||
#endif
|
||||
|
||||
if (loggingIsEnabled) {
|
||||
[[DebugLogger sharedInstance] enableFileLogging];
|
||||
}
|
||||
|
||||
[self performUpdateCheck];
|
||||
[self protectPreferenceFiles];
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#import "FutureSource.h"
|
||||
#import "FutureUtil.h"
|
||||
#import <AddressBook/AddressBook.h>
|
||||
#import <libPhoneNumber-iOS/NBPhoneNumber.h>
|
||||
#import "Constraints.h"
|
||||
#import "Environment.h"
|
||||
#import "NotificationManifest.h"
|
||||
@ -180,6 +181,8 @@ void onAddressBookChanged(ABAddressBookRef notifyAddressBook, CFDictionaryRef in
|
||||
(void*)(unsigned long)ABPersonGetSortOrdering());
|
||||
|
||||
NSArray *sortedPeople = (__bridge_transfer NSArray *)allPeopleMutable;
|
||||
|
||||
// This predicate returns all contacts from the addressbook having at least one phone number
|
||||
|
||||
NSPredicate* predicate = [NSPredicate predicateWithBlock: ^BOOL(id record, NSDictionary *bindings) {
|
||||
ABMultiValueRef phoneNumbers = ABRecordCopyValue( (__bridge ABRecordRef)record, kABPersonPhoneProperty);
|
||||
@ -285,8 +288,8 @@ void onAddressBookChanged(ABAddressBookRef notifyAddressBook, CFDictionaryRef in
|
||||
|
||||
NSMutableArray *numbers = [NSMutableArray array];
|
||||
|
||||
for (CFIndex i = 0; i < (NSInteger)[phoneNumbers count]; i++) {
|
||||
NSString *phoneNumber = phoneNumbers[(NSUInteger)i];
|
||||
for (NSUInteger i = 0; i < [phoneNumbers count]; i++) {
|
||||
NSString *phoneNumber = phoneNumbers[i];
|
||||
[numbers addObject:phoneNumber];
|
||||
}
|
||||
|
||||
|
||||
23
Signal/src/environment/DebugLogger.h
Normal file
23
Signal/src/environment/DebugLogger.h
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// DebugLogger.h
|
||||
// Signal
|
||||
//
|
||||
// Created by Frederic Jacobs on 08/08/14.
|
||||
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface DebugLogger : NSObject
|
||||
|
||||
MacrosSingletonInterface
|
||||
|
||||
- (void)enableFileLogging;
|
||||
|
||||
- (void)disableFileLogging;
|
||||
|
||||
- (void)enableTTYLogging;
|
||||
|
||||
- (void)wipeLogs;
|
||||
|
||||
@end
|
||||
66
Signal/src/environment/DebugLogger.m
Normal file
66
Signal/src/environment/DebugLogger.m
Normal file
@ -0,0 +1,66 @@
|
||||
//
|
||||
// DebugLogger.m
|
||||
// Signal
|
||||
//
|
||||
// Created by Frederic Jacobs on 08/08/14.
|
||||
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DebugLogger.h"
|
||||
|
||||
#pragma mark Logging - Production logging wants us to write some logs to a file in case we need it for debugging.
|
||||
|
||||
#import <CocoaLumberjack/DDTTYLogger.h>
|
||||
#import <CocoaLumberjack/DDFileLogger.h>
|
||||
|
||||
@interface DebugLogger ()
|
||||
|
||||
@property (nonatomic) DDFileLogger *fileLogger;
|
||||
|
||||
@end
|
||||
|
||||
@implementation DebugLogger
|
||||
|
||||
MacrosSingletonImplemention
|
||||
|
||||
- (void)enableFileLogging{
|
||||
self.fileLogger = [[DDFileLogger alloc] init]; //Logging to file, because it's in the Cache folder, they are not uploaded in iTunes/iCloud backups.
|
||||
self.fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling.
|
||||
self.fileLogger.logFileManager.maximumNumberOfLogFiles = 3; // Keep three days of logs.
|
||||
[DDLog addLogger:self.fileLogger];
|
||||
}
|
||||
|
||||
- (void)disableFileLogging{
|
||||
[DDLog removeLogger:self.fileLogger];
|
||||
self.fileLogger = nil;
|
||||
}
|
||||
|
||||
- (void)enableTTYLogging{
|
||||
[DDLog addLogger:[DDTTYLogger sharedInstance]];
|
||||
}
|
||||
|
||||
- (void)wipeLogs{
|
||||
BOOL reenableLogging = (self.fileLogger?YES:NO);
|
||||
|
||||
if (reenableLogging) {
|
||||
[self disableFileLogging];
|
||||
}
|
||||
|
||||
NSError *error;
|
||||
NSString *logPath = [NSHomeDirectory() stringByAppendingString:@"/Library/Caches/Logs/"];
|
||||
NSArray *logsFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:logPath error:&error];
|
||||
|
||||
for (NSUInteger i = 0; i < [logsFiles count]; i++) {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:[logPath stringByAppendingString:[logsFiles objectAtIndex:i]] error:&error];
|
||||
}
|
||||
|
||||
if (error) {
|
||||
DDLogError(@"Logs couldn't be removed. %@", error.description);
|
||||
}
|
||||
|
||||
if (reenableLogging) {
|
||||
[self enableFileLogging];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,3 +1,4 @@
|
||||
#import "DebugLogger.h"
|
||||
#import "Environment.h"
|
||||
#import "Constraints.h"
|
||||
#import "FunctionalUtil.h"
|
||||
@ -6,6 +7,7 @@
|
||||
#import "HostNameEndPoint.h"
|
||||
#import "RecentCallManager.h"
|
||||
#import "ContactsManager.h"
|
||||
#import "PreferencesUtil.h"
|
||||
#import "PhoneNumberDirectoryFilterManager.h"
|
||||
#import "SGNKeychainUtil.h"
|
||||
|
||||
@ -122,8 +124,9 @@ phoneDirectoryManager;
|
||||
e->zrtpVersionId = zrtpVersionId;
|
||||
e->contactsManager = contactsManager;
|
||||
|
||||
// @todo: better place for this?
|
||||
if (recentCallManager != nil) {
|
||||
// recentCallManagers are nil in unit tests because they would require unnecessary allocations. Detailed explanation: https://github.com/WhisperSystems/Signal-iOS/issues/62#issuecomment-51482195
|
||||
|
||||
[recentCallManager watchForCallsThrough:phoneManager
|
||||
untilCancelled:nil];
|
||||
[recentCallManager watchForContactUpdatesFrom:contactsManager
|
||||
@ -166,6 +169,10 @@ phoneDirectoryManager;
|
||||
+(void)resetAppData{
|
||||
[SGNKeychainUtil wipeKeychain];
|
||||
[[Environment preferences] clear];
|
||||
if ([[self preferences] loggingIsEnabled]) {
|
||||
[[DebugLogger sharedInstance] wipeLogs];
|
||||
}
|
||||
[[self preferences] setAndGetCurrentVersion];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -25,4 +25,10 @@
|
||||
-(BOOL) encounteredRevokedPushPermission;
|
||||
-(void) setRevokedPushPermission:(BOOL)revoked;
|
||||
|
||||
-(BOOL)loggingIsEnabled;
|
||||
-(void)setLoggingEnabled:(BOOL)flag;
|
||||
|
||||
-(NSString*)lastRanVersion;
|
||||
-(NSString*)setAndGetCurrentVersion;
|
||||
|
||||
@end
|
||||
|
||||
@ -21,6 +21,9 @@
|
||||
#define AUTOCORRECT_ENABLED_KEY @"Autocorrect Enabled Key"
|
||||
#define HISTORY_LOG_ENABLED_KEY @"History Log Enabled Key"
|
||||
#define PUSH_REVOKED_KEY @"Push Revoked Key"
|
||||
#define DEBUG_IS_ENABLED_KEY @"Debugging Log Enabled Key"
|
||||
|
||||
#define kSignalVersionKey @"SignalUpdateVersionKey"
|
||||
|
||||
@implementation PropertyListPreferences (PropertyUtil)
|
||||
|
||||
@ -95,9 +98,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)loggingIsEnabled{
|
||||
NSNumber *preference = [self tryGetValueForKey:DEBUG_IS_ENABLED_KEY];
|
||||
if (preference) {
|
||||
return [preference boolValue];
|
||||
} else{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
-(void) setFreshInstallTutorialsEnabled:(BOOL)enabled {
|
||||
[self setValueForKey:FRESH_INSTALL_TUTORIALS_ENABLED_KEY toValue:[NSNumber numberWithBool:enabled]];
|
||||
}
|
||||
|
||||
-(void) setContactImagesEnabled:(BOOL)enabled {
|
||||
[self setValueForKey:CONTACT_IMAGES_ENABLED_KEY toValue:[NSNumber numberWithBool:enabled]];
|
||||
}
|
||||
@ -115,4 +128,21 @@
|
||||
[self setValueForKey:PUSH_REVOKED_KEY toValue:[NSNumber numberWithBool:revoked]];
|
||||
}
|
||||
|
||||
-(void) setLoggingEnabled:(BOOL)flag{
|
||||
[self setValueForKey:DEBUG_IS_ENABLED_KEY toValue:[NSNumber numberWithBool:flag]];
|
||||
}
|
||||
|
||||
-(NSString*)lastRanVersion{
|
||||
return [[NSUserDefaults standardUserDefaults] objectForKey:kSignalVersionKey];
|
||||
}
|
||||
|
||||
-(NSString*)setAndGetCurrentVersion{
|
||||
NSString *lastVersion = [self lastRanVersion];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithFormat:@"%@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] forKey:kSignalVersionKey];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
return lastVersion;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
Add a Singelton implementation to the .m File
|
||||
*/
|
||||
|
||||
#define MacrosSingletonImplemantion \
|
||||
#define MacrosSingletonImplemention \
|
||||
+ (instancetype)sharedInstance { \
|
||||
\
|
||||
static dispatch_once_t onceToken; \
|
||||
@ -93,4 +93,4 @@ sharedInstance = [self.class new]; \
|
||||
return sharedInstance; \
|
||||
}
|
||||
|
||||
#define CJAMacrosSingletonInterface + (instancetype)sharedInstance;
|
||||
#define MacrosSingletonInterface + (instancetype)sharedInstance;
|
||||
|
||||
@ -104,7 +104,7 @@
|
||||
}
|
||||
|
||||
- (void)registerForPushWithToken:(NSData*)token{
|
||||
[[CallServerRequestsManager sharedManager] registerPushToken:token success:^(NSURLSessionDataTask *task, id responseObject) {
|
||||
[[CallServerRequestsManager sharedInstance] registerPushToken:token success:^(NSURLSessionDataTask *task, id responseObject) {
|
||||
if ([task.response isKindOfClass: [NSHTTPURLResponse class]]){
|
||||
NSInteger statusCode = [(NSHTTPURLResponse*) task.response statusCode];
|
||||
if (statusCode == 200) {
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
@interface CallServerRequestsManager : NSObject
|
||||
|
||||
+ (instancetype)sharedManager;
|
||||
MacrosSingletonInterface
|
||||
|
||||
- (void)registerPushToken:(NSData*)deviceToken success:(void (^)(NSURLSessionDataTask *task, id responseObject))success failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;
|
||||
|
||||
|
||||
@ -23,14 +23,7 @@
|
||||
|
||||
@implementation CallServerRequestsManager
|
||||
|
||||
+ (instancetype)sharedManager {
|
||||
static CallServerRequestsManager *sharedManager = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
sharedManager = [[self alloc] init];
|
||||
});
|
||||
return sharedManager;
|
||||
}
|
||||
MacrosSingletonImplemention
|
||||
|
||||
- (id)init{
|
||||
self = [super init];
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
+(NSString*) regionCodeFromCountryCodeString:(NSString*) countryCodeString;
|
||||
|
||||
-(NSURL*) toUrl;
|
||||
-(NSURL*) toSystemDialerURL;
|
||||
-(NSString *)toE164;
|
||||
-(NSString *)localizedDescriptionForUser;
|
||||
-(NSNumber*)getCountryCode;
|
||||
|
||||
@ -97,7 +97,6 @@ static NSString *const RPDefaultsKeyPhoneNumberCanonical = @"RPDefaultsKeyPhoneN
|
||||
char s[[text length]+1];
|
||||
int xx = 0;
|
||||
for (NSUInteger i = 0; i < [text length]; i++) {
|
||||
// @todo: Don't be terrible
|
||||
unichar x = [text characterAtIndex:i];
|
||||
if (x == '+' || (x >= '0' && x <= '9')) {
|
||||
s[xx++] = (char)x;
|
||||
@ -123,7 +122,7 @@ static NSString *const RPDefaultsKeyPhoneNumberCanonical = @"RPDefaultsKeyPhoneN
|
||||
}
|
||||
}
|
||||
|
||||
-(NSURL*) toUrl {
|
||||
-(NSURL*) toSystemDialerURL {
|
||||
NSString* link = [NSString stringWithFormat:@"telprompt://%@", e164];
|
||||
return [NSURL URLWithString:link];
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
NSString *inviteMessage = INVITE_USERS_MESSAGE;
|
||||
|
||||
messageController.body = [inviteMessage stringByAppendingString:@" http://appstore.com/signalprivatemessenger"];
|
||||
messageController.body = [inviteMessage stringByAppendingString:@" https://itunes.apple.com/app/id874139669"];
|
||||
messageController.recipients = @[[number toE164]];
|
||||
messageController.messageComposeDelegate = self;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#import "BadArgument.h"
|
||||
#import "SecurityFailure.h"
|
||||
#import "BadState.h"
|
||||
|
||||
#import <CocoaLumberjack/DDLog.h>
|
||||
/// 'require(X)' is used to indicate parameter-related preconditions that callers must satisfy.
|
||||
/// Failure to satisfy indicates a bug in the caller.
|
||||
#define require(expr) if (!(expr)){ NSString *reason = [NSString stringWithFormat:@"require %@ (in %s at line %d)", (@#expr), __FILE__, __LINE__]; DDLogError(@"%@", reason);[BadArgument raise:reason];};
|
||||
|
||||
@ -142,7 +142,7 @@ static NSString *const FAVOURITE_FALSE_ICON_NAME = @"favourite_false_icon";
|
||||
|
||||
- (void)openPhoneAppWithPhoneNumber:(PhoneNumber *)phoneNumber {
|
||||
if (phoneNumber) {
|
||||
[[UIApplication sharedApplication] openURL:[phoneNumber toUrl]];
|
||||
[[UIApplication sharedApplication] openURL:[phoneNumber toSystemDialerURL]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ static NSString *const CONTACT_TABLE_VIEW_CELL_IDENTIFIER = @"ContactTableViewCe
|
||||
}
|
||||
}
|
||||
|
||||
[[UIApplication sharedApplication] openURL:[contact.parsedPhoneNumbers[0] toUrl]];
|
||||
[[UIApplication sharedApplication] openURL:[contact.parsedPhoneNumbers[0] toSystemDialerURL]];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate
|
||||
|
||||
@ -49,6 +49,7 @@ static NSString *const FOOTER_TABLE_CELL_IDENTIFIER = @"InboxFeedFooterCell";
|
||||
[self setupLabelLocalizationAndStyles];
|
||||
|
||||
if (![Environment isRegistered]) {
|
||||
[Environment resetAppData];
|
||||
RegisterViewController *registerViewController = [RegisterViewController registerViewController];
|
||||
[self presentViewController:registerViewController animated:NO completion:nil];
|
||||
}
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
#define NUMBER_OF_TABLE_VIEW_SECTIONS 2
|
||||
|
||||
static NSString *SIDE_MENU_TABLE_CELL_IDENTIFIER = @"LeftSideMenuCell";
|
||||
static NSString *WHISPER_SYSTEMS_URL = @"http://whispersystems.org/";
|
||||
static NSString *WHISPER_SYSTEMS_BLOG_URL = @"http://whispersystems.org/blog";
|
||||
static NSString *WHISPER_SYSTEMS_URL = @"https://whispersystems.org/";
|
||||
static NSString *WHISPER_SYSTEMS_BLOG_URL = @"https://whispersystems.org/blog";
|
||||
static NSString *WHISPER_SYSTEMS_BUGREPORT_URL = @"http://support.whispersystems.org";
|
||||
|
||||
@interface LeftSideMenuViewController () {
|
||||
|
||||
@ -190,6 +190,8 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
_challengeButton.enabled = YES;
|
||||
[_challengeActivityIndicator stopAnimating];
|
||||
[Environment errorNoter](error, @"While Verifying Challenge.", NO);
|
||||
}];
|
||||
|
||||
@ -200,16 +202,15 @@
|
||||
[registered trySetResult:@YES];
|
||||
[self dismissView];
|
||||
[futureChallengeAcceptedSource trySetResult:result];
|
||||
_challengeButton.enabled = YES;
|
||||
[_challengeActivityIndicator stopAnimating];
|
||||
} failure:^{
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:REGISTER_ERROR_ALERT_VIEW_TITLE message:REGISTER_ERROR_ALERT_VIEW_BODY delegate:nil cancelButtonTitle:REGISTER_ERROR_ALERT_VIEW_DISMISS otherButtonTitles:nil, nil];
|
||||
[alertView show];
|
||||
_challengeButton.enabled = YES;
|
||||
[_challengeActivityIndicator stopAnimating];
|
||||
}];
|
||||
}];
|
||||
|
||||
[futureDone finallyDo:^(Future *completed) {
|
||||
_challengeButton.enabled = YES;
|
||||
[_challengeActivityIndicator stopAnimating];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)showViewNumber:(NSInteger)viewNumber {
|
||||
|
||||
@ -21,28 +21,31 @@
|
||||
@property (nonatomic, strong) IBOutlet UILabel *titleLabel;
|
||||
|
||||
@property (nonatomic, strong) IBOutlet SettingsTableHeaderView *privacyAndSecurityHeaderView;
|
||||
@property (nonatomic, strong) IBOutlet SettingsTableHeaderView *debuggingHeaderView;
|
||||
@property (nonatomic, strong) IBOutlet UITableViewCell *hideContactImagesCell;
|
||||
@property (nonatomic, strong) IBOutlet UITableViewCell *disableAutocorrectCell;
|
||||
@property (nonatomic, strong) IBOutlet UITableViewCell *disableHistoryCell;
|
||||
@property (nonatomic, strong) IBOutlet UITableViewCell *clearHistoryLogCell;
|
||||
@property (nonatomic, strong) IBOutlet UITableViewCell *disableLogsCell;
|
||||
|
||||
@property (nonatomic, strong) IBOutlet UIButton *hideContactImagesButton;
|
||||
@property (nonatomic, strong) IBOutlet UIButton *disableAutocorrectButton;
|
||||
@property (nonatomic, strong) IBOutlet UIButton *disableHistoryButton;
|
||||
|
||||
@property (nonatomic, strong) IBOutlet SettingsTableHeaderView *callQualityHeaderView;
|
||||
@property (nonatomic, strong) IBOutlet UITableViewCell *directoryUpdateCell;
|
||||
@property (nonatomic, strong) IBOutlet UIButton *disableDebugLogsButton;
|
||||
|
||||
@property (nonatomic, strong) IBOutlet UITableViewCell *sendDebugLog;
|
||||
|
||||
- (IBAction)registerTapped;
|
||||
|
||||
- (IBAction)privacyAndSecurityTapped;
|
||||
- (IBAction)debuggingTapped:(id)sender;
|
||||
|
||||
- (IBAction)hideContactImagesButtonTapped;
|
||||
- (IBAction)disableAutocorrectButtonTapped;
|
||||
- (IBAction)disableHistoryButtonTapped;
|
||||
|
||||
- (IBAction)disableLogTapped:(id)sender;
|
||||
|
||||
- (IBAction)menuButtonTapped;
|
||||
|
||||
@end
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
#import "DebugLogger.h"
|
||||
#import "Environment.h"
|
||||
#import "FutureUtil.h"
|
||||
#import "LocalizableText.h"
|
||||
@ -14,7 +15,7 @@
|
||||
|
||||
#define SECTION_HEADER_VIEW_HEIGHT 27
|
||||
#define PRIVACY_SECTION_INDEX 0
|
||||
#define CALL_QUALITY_SECTION_INDEX 1
|
||||
#define DEBUG_SECTION_INDEX 1
|
||||
|
||||
static NSString *const CHECKBOX_CHECKMARK_IMAGE_NAME = @"checkbox_checkmark";
|
||||
static NSString *const CHECKBOX_EMPTY_IMAGE_NAME = @"checkbox_empty";
|
||||
@ -22,7 +23,7 @@ static NSString *const CHECKBOX_EMPTY_IMAGE_NAME = @"checkbox_empty";
|
||||
@interface SettingsViewController () {
|
||||
NSArray *_sectionHeaderViews;
|
||||
NSArray *_privacyTableViewCells;
|
||||
NSArray *_callQualityTableViewCells;
|
||||
NSArray *_debuggingTableViewCells;
|
||||
|
||||
NSString *gistURL;
|
||||
}
|
||||
@ -33,9 +34,9 @@ static NSString *const CHECKBOX_EMPTY_IMAGE_NAME = @"checkbox_empty";
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
_sectionHeaderViews = @[_privacyAndSecurityHeaderView];
|
||||
|
||||
|
||||
_sectionHeaderViews = @[_privacyAndSecurityHeaderView , self.debuggingHeaderView];
|
||||
|
||||
_titleLabel.text = SETTINGS_NAV_BAR_TITLE;
|
||||
}
|
||||
|
||||
@ -49,11 +50,11 @@ static NSString *const CHECKBOX_EMPTY_IMAGE_NAME = @"checkbox_empty";
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[self saveExpandedSectionPreferences];
|
||||
|
||||
|
||||
if ([self.navigationController.viewControllers count] > 1) {
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
|
||||
|
||||
[super viewWillDisappear:animated];
|
||||
}
|
||||
|
||||
@ -75,17 +76,17 @@ static NSString *const CHECKBOX_EMPTY_IMAGE_NAME = @"checkbox_empty";
|
||||
- (NSAttributedString *)localNumberAttributedStringForNumber:(PhoneNumber *)number {
|
||||
NSString *numberPrefixString = SETTINGS_NUMBER_PREFIX;
|
||||
NSString *localNumberString = [number toE164];
|
||||
|
||||
|
||||
NSString *displayString = [NSString stringWithFormat:@"%@ %@", numberPrefixString, localNumberString];
|
||||
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:displayString];
|
||||
|
||||
|
||||
UIFont *prefixFont = [UIUtil helveticaNeueLTStdLightFontWithSize:_phoneNumberLabel.font.pointSize];
|
||||
UIFont *numberFont = [UIUtil helveticaNeueLTStdBoldFontWithSize:_phoneNumberLabel.font.pointSize];
|
||||
|
||||
|
||||
[attributedString addAttribute:NSFontAttributeName
|
||||
value:prefixFont
|
||||
range:NSMakeRange(0, [numberPrefixString length])];
|
||||
|
||||
|
||||
[attributedString addAttribute:NSFontAttributeName
|
||||
value:numberFont
|
||||
range:NSMakeRange([numberPrefixString length] + 1, [localNumberString length])];
|
||||
@ -97,8 +98,9 @@ static NSString *const CHECKBOX_EMPTY_IMAGE_NAME = @"checkbox_empty";
|
||||
- (void)configureCheckboxPreferences {
|
||||
NSArray *buttons = @[_hideContactImagesButton,
|
||||
_disableAutocorrectButton,
|
||||
_disableHistoryButton];
|
||||
|
||||
_disableHistoryButton,
|
||||
_disableDebugLogsButton];
|
||||
|
||||
for (UIButton *button in buttons) {
|
||||
[button setImage:[UIImage imageNamed:CHECKBOX_EMPTY_IMAGE_NAME]
|
||||
forState:UIControlStateNormal];
|
||||
@ -106,22 +108,25 @@ static NSString *const CHECKBOX_EMPTY_IMAGE_NAME = @"checkbox_empty";
|
||||
[button setImage:[UIImage imageNamed:CHECKBOX_CHECKMARK_IMAGE_NAME]
|
||||
forState:UIControlStateSelected];
|
||||
}
|
||||
PropertyListPreferences *prefs = [Environment preferences];
|
||||
_hideContactImagesButton.selected = ![prefs getContactImagesEnabled];
|
||||
PropertyListPreferences *prefs = [Environment preferences];
|
||||
_hideContactImagesButton.selected = ![prefs getContactImagesEnabled];
|
||||
_disableAutocorrectButton.selected = ![prefs getAutocorrectEnabled];
|
||||
_disableHistoryButton.selected = ![prefs getHistoryLogEnabled];
|
||||
_disableHistoryButton.selected = ![prefs getHistoryLogEnabled];
|
||||
_disableLogsCell.selected = ![prefs loggingIsEnabled];
|
||||
}
|
||||
|
||||
- (void)configureAllCells {
|
||||
_privacyTableViewCells = [self privacyAndSecurityCells];
|
||||
_privacyTableViewCells = [self privacyAndSecurityCells];
|
||||
_debuggingTableViewCells = [self debugCells];
|
||||
[_privacyAndSecurityHeaderView setColumnStateExpanded:YES andIsAnimated:NO];
|
||||
[_debuggingHeaderView setColumnStateExpanded:YES andIsAnimated:NO];
|
||||
}
|
||||
|
||||
- (void)saveExpandedSectionPreferences {
|
||||
NSMutableArray *expandedSectionPrefs = [NSMutableArray array];
|
||||
NSNumber *numberBoolYes = [NSNumber numberWithBool:YES];
|
||||
NSNumber *numberBoolNo = [NSNumber numberWithBool:NO];
|
||||
|
||||
|
||||
[expandedSectionPrefs addObject:(_privacyTableViewCells ? numberBoolYes : numberBoolNo)];
|
||||
}
|
||||
|
||||
@ -131,8 +136,18 @@ static NSString *const CHECKBOX_EMPTY_IMAGE_NAME = @"checkbox_empty";
|
||||
return @[_hideContactImagesCell,
|
||||
_disableAutocorrectCell,
|
||||
_disableHistoryCell,
|
||||
_clearHistoryLogCell,
|
||||
_sendDebugLog];
|
||||
_clearHistoryLogCell];
|
||||
}
|
||||
|
||||
- (NSArray *)debugCells{
|
||||
|
||||
NSMutableArray *cells = [@[_disableLogsCell] mutableCopy];
|
||||
|
||||
if ([[Environment preferences] loggingIsEnabled]) {
|
||||
[cells addObject:_sendDebugLog];
|
||||
}
|
||||
|
||||
return cells;
|
||||
}
|
||||
|
||||
- (NSArray *)indexPathsForCells:(NSArray *)cells forRow:(NSInteger)row {
|
||||
@ -147,7 +162,9 @@ static NSString *const CHECKBOX_EMPTY_IMAGE_NAME = @"checkbox_empty";
|
||||
- (NSArray *)cellsForRow:(NSInteger)row {
|
||||
if (row == PRIVACY_SECTION_INDEX) {
|
||||
return [self privacyAndSecurityCells];
|
||||
} else {
|
||||
} else if (row == DEBUG_SECTION_INDEX){
|
||||
return [self debugCells];
|
||||
}else {
|
||||
return @[];
|
||||
}
|
||||
}
|
||||
@ -165,6 +182,12 @@ static NSString *const CHECKBOX_EMPTY_IMAGE_NAME = @"checkbox_empty";
|
||||
[_privacyAndSecurityHeaderView setColumnStateExpanded:columnExpanded andIsAnimated:YES];
|
||||
}
|
||||
|
||||
- (void)debuggingTapped:(id)sender{
|
||||
[self toggleCells:&_debuggingTableViewCells forRow:DEBUG_SECTION_INDEX];
|
||||
BOOL columnExpanded = _debuggingTableViewCells != nil;
|
||||
[_debuggingHeaderView setColumnStateExpanded:columnExpanded andIsAnimated:YES];
|
||||
}
|
||||
|
||||
- (void)toggleCells:(NSArray *__strong*)cells forRow:(NSInteger)row {
|
||||
[_settingsTableView beginUpdates];
|
||||
if (*cells) {
|
||||
@ -194,6 +217,23 @@ static NSString *const CHECKBOX_EMPTY_IMAGE_NAME = @"checkbox_empty";
|
||||
[[Environment preferences] setHistoryLogEnabled:!_disableHistoryButton.selected];
|
||||
}
|
||||
|
||||
- (IBAction)disableLogTapped:(id)sender{
|
||||
_disableDebugLogsButton.selected = !_disableDebugLogsButton.selected;
|
||||
|
||||
BOOL loggingEnabled = !_disableDebugLogsButton.selected;
|
||||
|
||||
if (!loggingEnabled) {
|
||||
[[DebugLogger sharedInstance] disableFileLogging];
|
||||
[[DebugLogger sharedInstance] wipeLogs];
|
||||
} else{
|
||||
[[DebugLogger sharedInstance] enableFileLogging];
|
||||
}
|
||||
|
||||
[[Environment preferences] setLoggingEnabled:loggingEnabled];
|
||||
_debuggingTableViewCells = [self debugCells];
|
||||
[_settingsTableView reloadData];
|
||||
}
|
||||
|
||||
- (void)clearHistory {
|
||||
[[[Environment getCurrent] recentCallManager] clearRecentCalls];
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:SETTINGS_LOG_CLEAR_TITLE
|
||||
@ -222,7 +262,9 @@ static NSString *const CHECKBOX_EMPTY_IMAGE_NAME = @"checkbox_empty";
|
||||
UIView *headerView = _sectionHeaderViews[(NSUInteger)section];
|
||||
if (headerView == _privacyAndSecurityHeaderView) {
|
||||
return (NSInteger)[_privacyTableViewCells count];
|
||||
} else {
|
||||
} else if (headerView == _debuggingHeaderView){
|
||||
return (NSInteger)[_debuggingTableViewCells count];
|
||||
}else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -232,24 +274,26 @@ static NSString *const CHECKBOX_EMPTY_IMAGE_NAME = @"checkbox_empty";
|
||||
UITableViewCell *cell = nil;
|
||||
if (headerView == _privacyAndSecurityHeaderView) {
|
||||
cell = _privacyTableViewCells[(NSUInteger)indexPath.row];
|
||||
} else if (headerView ==_debuggingHeaderView){
|
||||
cell = _debuggingTableViewCells[(NSUInteger)indexPath.row];
|
||||
}
|
||||
[self findAndLocalizeLabelsForView:cell];
|
||||
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
|
||||
|
||||
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
|
||||
if (cell == _clearHistoryLogCell) {
|
||||
[self clearHistory];
|
||||
}
|
||||
|
||||
if (cell == _sendDebugLog) {
|
||||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:SETTINGS_SENDLOG_WAITING
|
||||
message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
|
||||
|
||||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:SETTINGS_SENDLOG_WAITING
|
||||
message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
|
||||
[alert show];
|
||||
|
||||
[Pastelog submitLogsWithCompletion:^(NSError *error, NSString *urlString) {
|
||||
|
||||
@ -6,13 +6,14 @@
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SettingsViewController">
|
||||
<connections>
|
||||
<outlet property="callQualityHeaderView" destination="j1j-ta-39S" id="l3w-bt-UWR"/>
|
||||
<outlet property="clearHistoryLogCell" destination="d8g-sW-ZOU" id="gqj-U8-aKQ"/>
|
||||
<outlet property="directoryUpdateCell" destination="spk-JC-Hnw" id="mbt-cO-iOG"/>
|
||||
<outlet property="debuggingHeaderView" destination="j1j-ta-39S" id="bzx-QG-fO4"/>
|
||||
<outlet property="disableAutocorrectButton" destination="dLe-ku-opM" id="Edi-TS-ZcR"/>
|
||||
<outlet property="disableAutocorrectCell" destination="nQL-pT-i5g" id="YZo-pL-RM7"/>
|
||||
<outlet property="disableDebugLogsButton" destination="ENH-DC-cin" id="E5S-Rf-oAr"/>
|
||||
<outlet property="disableHistoryButton" destination="trw-DG-amf" id="97O-Y4-iu3"/>
|
||||
<outlet property="disableHistoryCell" destination="5Wr-Th-YJI" id="fQY-Qd-xv0"/>
|
||||
<outlet property="disableLogsCell" destination="Zs4-3i-4Dm" id="eeD-Br-M2J"/>
|
||||
<outlet property="hideContactImagesButton" destination="kv5-cc-It9" id="Ftz-lp-Eqd"/>
|
||||
<outlet property="hideContactImagesCell" destination="1Sy-9w-LqE" id="Rvh-96-REp"/>
|
||||
<outlet property="phoneNumberLabel" destination="G77-lz-XM0" id="adE-bu-2Kn"/>
|
||||
@ -265,7 +266,7 @@
|
||||
<color key="textColor" red="0.0" green="0.5450980392" blue="0.93725490199999995" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizationKey" value="SETTINGS_CALL_QUALITY"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizationKey" value="SETTINGS_DEBUGGING"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JV0-FE-CfM">
|
||||
@ -275,7 +276,7 @@
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="callQualityTapped" destination="-1" eventType="touchUpInside" id="Rdi-DX-FQ1"/>
|
||||
<action selector="debuggingTapped:" destination="-1" eventType="touchUpInside" id="Qv2-AR-CPk"/>
|
||||
</connections>
|
||||
</button>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="expanded_cell_icon.png" translatesAutoresizingMaskIntoConstraints="NO" id="Xs2-Ls-WP3">
|
||||
@ -367,51 +368,6 @@
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="SettingsTableViewCell" id="Ssg-87-RAe">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Ssg-87-RAe" id="uEn-bq-BsY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<slider opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" minimumValueImage="volume_low.png" maximumValueImage="volume_high.png" translatesAutoresizingMaskIntoConstraints="NO" id="dIo-Jr-g26">
|
||||
<rect key="frame" x="18" y="6" width="284" height="33"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="minimumTrackTintColor" red="0.0" green="0.5450980392" blue="0.93725490199999995" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="thumbTintColor" red="0.81960784313725488" green="0.82745098039215681" blue="0.83137254901960778" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</slider>
|
||||
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cUv-oD-DGX" userLabel="Seperator View">
|
||||
<rect key="frame" x="15" y="42" width="290" height="1"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" red="0.7843137255" green="0.7843137255" blue="0.7843137255" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</view>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="spk-JC-Hnw">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="spk-JC-Hnw" id="710-np-6sk">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Force Directory Update" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aic-Lf-XeI">
|
||||
<rect key="frame" x="20" y="0.0" width="223" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="MAp-p5-S8N"/>
|
||||
<constraint firstAttribute="width" constant="223" id="Vj8-Eh-41I"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="aic-Lf-XeI" firstAttribute="top" secondItem="710-np-6sk" secondAttribute="top" id="DeF-Nt-zK8"/>
|
||||
<constraint firstItem="aic-Lf-XeI" firstAttribute="leading" secondItem="710-np-6sk" secondAttribute="leading" constant="20" symbolic="YES" id="h6l-yK-z5z"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="SettingsTableViewCell" id="Yc0-ZL-RM6">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
@ -436,12 +392,60 @@
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="SettingsTableViewCell" id="Zs4-3i-4Dm">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Zs4-3i-4Dm" id="wUC-kf-XXe">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Disable Debug Log" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vS9-x4-0OY" customClass="HelveticaNeueLTStdMedLabel">
|
||||
<rect key="frame" x="20" y="0.0" width="223" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="E4U-ry-REH"/>
|
||||
<constraint firstAttribute="width" constant="223" id="RGD-TX-v5k"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizationKey" value="SETTINGS_DISABLE_LOGS"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HN4-Id-TUu" userLabel="Seperator View">
|
||||
<rect key="frame" x="15" y="42" width="290" height="1"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" red="0.7843137255" green="0.7843137255" blue="0.7843137255" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ENH-DC-cin">
|
||||
<rect key="frame" x="265" y="2" width="40" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" image="checkbox_empty.png">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="disableLogTapped:" destination="-1" eventType="touchUpInside" id="Rfa-IA-Fd9"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="HN4-Id-TUu" firstAttribute="centerX" secondItem="wUC-kf-XXe" secondAttribute="centerX" id="5gQ-Vu-35O"/>
|
||||
<constraint firstItem="HN4-Id-TUu" firstAttribute="top" secondItem="ENH-DC-cin" secondAttribute="bottom" id="97R-QY-RR4"/>
|
||||
<constraint firstItem="ENH-DC-cin" firstAttribute="top" secondItem="wUC-kf-XXe" secondAttribute="top" constant="2" id="G4T-2R-9mg"/>
|
||||
<constraint firstItem="HN4-Id-TUu" firstAttribute="top" secondItem="wUC-kf-XXe" secondAttribute="top" constant="42" id="MFo-Df-tsx"/>
|
||||
<constraint firstItem="HN4-Id-TUu" firstAttribute="leading" secondItem="wUC-kf-XXe" secondAttribute="leading" constant="15" id="O6V-dk-vg4"/>
|
||||
<constraint firstItem="vS9-x4-0OY" firstAttribute="leading" secondItem="wUC-kf-XXe" secondAttribute="leading" constant="20" symbolic="YES" id="TEO-FA-N8x"/>
|
||||
<constraint firstItem="vS9-x4-0OY" firstAttribute="top" secondItem="wUC-kf-XXe" secondAttribute="top" id="fQT-vn-inw"/>
|
||||
<constraint firstItem="ENH-DC-cin" firstAttribute="leading" secondItem="vS9-x4-0OY" secondAttribute="trailing" constant="22" id="oAo-Z7-YC0"/>
|
||||
<constraint firstItem="vS9-x4-0OY" firstAttribute="bottom" secondItem="HN4-Id-TUu" secondAttribute="bottom" constant="1" id="oSz-Df-RyZ"/>
|
||||
<constraint firstItem="HN4-Id-TUu" firstAttribute="trailing" secondItem="ENH-DC-cin" secondAttribute="trailing" id="rZG-jh-FwU"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="checkbox_empty.png" width="19" height="19"/>
|
||||
<image name="expanded_cell_icon.png" width="7" height="7"/>
|
||||
<image name="menu_icon.png" width="54" height="50"/>
|
||||
<image name="volume_high.png" width="19" height="19"/>
|
||||
<image name="volume_low.png" width="12" height="12"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
@implementation AudioRemoteIOTest
|
||||
|
||||
-(void) ______REMOVE_THIS_PREFIX_TO_ENABLE_ACTUAL_AUDIO_TEST______testPlaysAndRecordsAudio {
|
||||
-(void) testPlaysAndRecordsAudio {
|
||||
__block RemoteIOAudio* a = nil;
|
||||
|
||||
__block double t = 0;
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#import "TestUtil.h"
|
||||
|
||||
@implementation QueueTest
|
||||
|
||||
-(void) queueTest {
|
||||
Queue* q = [Queue new];
|
||||
test([q count] == 0);
|
||||
@ -26,4 +27,5 @@
|
||||
testThrows([q peek]);
|
||||
testThrows([q dequeue]);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -108,15 +108,10 @@
|
||||
"REGISTRATION_ERROR" = "Registration Error";
|
||||
"REGISTRATION_BODY" = "We couldn't reach the Signal server. Please try again.";
|
||||
"REJECT_CALL_BUTTON_TITLE" = "Reject";
|
||||
"SETTINGS_CALL_QUALITY" = "Call Quality";
|
||||
"SETTINGS_CHANGE_VOLUME" = "Change Volume With Buttons";
|
||||
"SETTINGS_CLEAR_HISTORY_LOG" = "Clear History Log";
|
||||
"SETTINGS_DATE_FORMAT" = "Date Format";
|
||||
"SETTINGS_DISABLE_AUTOCORRECT" = "Disable Autocorrect";
|
||||
"SETTINGS_DISABLE_HISTORY_LOG" = "Disable History Log";
|
||||
"SETTINGS_HIDE_CONTACT_IMAGES" = "Hide Contact Images";
|
||||
"SETTINGS_LOCALIZATION_OVERRIDE" = "Localization Override";
|
||||
"SETTINGS_LOCALIZATION_OVERRIDES" = "Localization Overrides";
|
||||
"SETTINGS_LOG_CLEAR_MESSAGE" = "Call History Cleared";
|
||||
"SETTINGS_LOG_CLEAR_TITLE" = "Operation Completed";
|
||||
"SETTINGS_NAV_BAR_TITLE" = "Settings";
|
||||
@ -124,6 +119,8 @@
|
||||
"SETTINGS_NUMBER_PREFIX" = "Your Number:";
|
||||
"SETTINGS_PRIVACY_AND_SECURITY" = "Privacy and Security";
|
||||
"SETTINGS_RINGTONE" = "Ringtone";
|
||||
"SETTINGS_DEBUGGING" = "Debugging";
|
||||
"SETTINGS_DISABLE_LOGS" = "Disable debugging logs";
|
||||
"SETTINGS_SENDLOG" = "Submit Debug Log";
|
||||
"SETTINGS_SENDLOGS_WAITING" = "Sending log file\n Please wait...";
|
||||
"SETTINGS_SENDLOG_ALERT_BODY" = "Bugs can be reported by email or by copying the log in a GitHub Issue (advanced).";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user