diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 071723d34..e961a5c71 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -256,7 +256,6 @@ 76EB058218170B33006006FC /* Environment.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB041318170B33006006FC /* Environment.m */; }; 76EB058818170B33006006FC /* OWSPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB041918170B33006006FC /* OWSPreferences.m */; }; 76EB058A18170B33006006FC /* Release.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB041B18170B33006006FC /* Release.m */; }; - 76EB062618170B33006006FC /* Queue.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB04D518170B33006006FC /* Queue.m */; }; 76EB063A18170B33006006FC /* FunctionalUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB04EB18170B33006006FC /* FunctionalUtil.m */; }; 76EB063C18170B33006006FC /* NumberUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB04ED18170B33006006FC /* NumberUtil.m */; }; 76EB063E18170B33006006FC /* Operation.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB04EF18170B33006006FC /* Operation.m */; }; @@ -309,7 +308,6 @@ B660F6D81C29868000687D6E /* CryptoToolsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B660F6A71C29868000687D6E /* CryptoToolsTest.m */; }; B660F6DA1C29868000687D6E /* ExceptionsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B660F6AB1C29868000687D6E /* ExceptionsTest.m */; }; B660F6DB1C29868000687D6E /* FunctionalUtilTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B660F6AD1C29868000687D6E /* FunctionalUtilTest.m */; }; - B660F6DD1C29868000687D6E /* ObservableTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B660F6AF1C29868000687D6E /* ObservableTest.m */; }; B660F6DF1C29868000687D6E /* QueueTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B660F6B21C29868000687D6E /* QueueTest.m */; }; B660F6E01C29868000687D6E /* UtilTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B660F6B41C29868000687D6E /* UtilTest.m */; }; B660F7171C29988E00687D6E /* OWSContactsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB040918170B33006006FC /* OWSContactsManager.m */; }; @@ -327,11 +325,9 @@ B660F7751C29988E00687D6E /* UIColor+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFA64B31A24F3880007FB87 /* UIColor+OWS.m */; }; B660F7761C29988E00687D6E /* UIFont+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFA64B61A24F6730007FB87 /* UIFont+OWS.m */; }; B660F7771C29988E00687D6E /* UIImage+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = B68112E91A4D9EC400BA82FF /* UIImage+OWS.m */; }; - B660F77B1C29988E00687D6E /* Queue.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB04D518170B33006006FC /* Queue.m */; }; B660F77F1C29988E00687D6E /* DateUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = B90418E5183E9DD40038554A /* DateUtil.m */; }; B660F7811C29988E00687D6E /* FunctionalUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB04EB18170B33006006FC /* FunctionalUtil.m */; }; B660F7831C29988E00687D6E /* NumberUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB04ED18170B33006006FC /* NumberUtil.m */; }; - B660F7841C29988E00687D6E /* ObservableValue.m in Sources */ = {isa = PBXBuildFile; fileRef = BFB074C619A5611000F2947C /* ObservableValue.m */; }; B660F7871C29988E00687D6E /* StringUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB04F618170B33006006FC /* StringUtil.m */; }; B660F78A1C29988E00687D6E /* UIUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = B97940261832BD2400BD66CB /* UIUtil.m */; }; B660F78C1C29988E00687D6E /* UIDevice+TSHardwareVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = FCC81A971A44558300DFEC7D /* UIDevice+TSHardwareVersion.m */; }; @@ -353,7 +349,6 @@ B90418E6183E9DD40038554A /* DateUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = B90418E5183E9DD40038554A /* DateUtil.m */; }; B97940271832BD2400BD66CB /* UIUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = B97940261832BD2400BD66CB /* UIUtil.m */; }; B9EB5ABD1884C002007CBB57 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9EB5ABC1884C002007CBB57 /* MessageUI.framework */; }; - BFB074C919A5611000F2947C /* ObservableValue.m in Sources */ = {isa = PBXBuildFile; fileRef = BFB074C619A5611000F2947C /* ObservableValue.m */; }; D202868116DBE0E7009068E9 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AEACDB16C426DA00C364C0 /* CFNetwork.framework */; }; D202868216DBE0F4009068E9 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2179CFD16BB0B480006F3AB /* SystemConfiguration.framework */; }; D202868316DBE0FC009068E9 /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2179CFB16BB0B3A0006F3AB /* CoreTelephony.framework */; }; @@ -726,8 +721,6 @@ 76EB041918170B33006006FC /* OWSPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSPreferences.m; sourceTree = ""; }; 76EB041A18170B33006006FC /* Release.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Release.h; sourceTree = ""; }; 76EB041B18170B33006006FC /* Release.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Release.m; sourceTree = ""; }; - 76EB04D418170B33006006FC /* Queue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Queue.h; sourceTree = ""; }; - 76EB04D518170B33006006FC /* Queue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Queue.m; sourceTree = ""; }; 76EB04EA18170B33006006FC /* FunctionalUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionalUtil.h; sourceTree = ""; }; 76EB04EB18170B33006006FC /* FunctionalUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FunctionalUtil.m; sourceTree = ""; }; 76EB04EC18170B33006006FC /* NumberUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumberUtil.h; sourceTree = ""; }; @@ -803,7 +796,6 @@ B660F6AB1C29868000687D6E /* ExceptionsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExceptionsTest.m; sourceTree = ""; }; B660F6AC1C29868000687D6E /* FunctionalUtilTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionalUtilTest.h; sourceTree = ""; }; B660F6AD1C29868000687D6E /* FunctionalUtilTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FunctionalUtilTest.m; sourceTree = ""; }; - B660F6AF1C29868000687D6E /* ObservableTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ObservableTest.m; sourceTree = ""; }; B660F6B11C29868000687D6E /* QueueTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QueueTest.h; sourceTree = ""; }; B660F6B21C29868000687D6E /* QueueTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QueueTest.m; sourceTree = ""; }; B660F6B31C29868000687D6E /* UtilTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UtilTest.h; sourceTree = ""; }; @@ -859,8 +851,6 @@ B97940251832BD2400BD66CB /* UIUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIUtil.h; sourceTree = ""; }; B97940261832BD2400BD66CB /* UIUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIUtil.m; sourceTree = ""; }; B9EB5ABC1884C002007CBB57 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; }; - BFB074C519A5611000F2947C /* ObservableValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObservableValue.h; sourceTree = ""; }; - BFB074C619A5611000F2947C /* ObservableValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ObservableValue.m; sourceTree = ""; }; D2179CFB16BB0B3A0006F3AB /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; }; D2179CFD16BB0B480006F3AB /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; D221A089169C9E5E00537ABF /* Signal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Signal.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1427,7 +1417,6 @@ B6DA6B061B8A2F9A00CA6F98 /* AppStoreRating.m */, 34CCAF361F0C0599004084F4 /* AppUpdateNag.h */, 34CCAF371F0C0599004084F4 /* AppUpdateNag.m */, - 76EB04CF18170B33006006FC /* collections */, B90418E4183E9DD40038554A /* DateUtil.h */, B90418E5183E9DD40038554A /* DateUtil.m */, 348F2EAD1F0D21BC00D4ECE0 /* DeviceSleepManager.swift */, @@ -1439,8 +1428,6 @@ B62F5E0F1C2980B4000D370C /* NSData+ows_StripToken.m */, 76EB04EC18170B33006006FC /* NumberUtil.h */, 76EB04ED18170B33006006FC /* NumberUtil.m */, - BFB074C519A5611000F2947C /* ObservableValue.h */, - BFB074C619A5611000F2947C /* ObservableValue.m */, 76EB04EE18170B33006006FC /* Operation.h */, 76EB04EF18170B33006006FC /* Operation.m */, 34D99C911F2937CC00D284D6 /* OWSAnalytics.swift */, @@ -1473,15 +1460,6 @@ path = util; sourceTree = ""; }; - 76EB04CF18170B33006006FC /* collections */ = { - isa = PBXGroup; - children = ( - 76EB04D418170B33006006FC /* Queue.h */, - 76EB04D518170B33006006FC /* Queue.m */, - ); - path = collections; - sourceTree = ""; - }; 76EB052B18170B33006006FC /* Views */ = { isa = PBXGroup; children = ( @@ -1665,7 +1643,6 @@ B660F6AB1C29868000687D6E /* ExceptionsTest.m */, B660F6AC1C29868000687D6E /* FunctionalUtilTest.h */, B660F6AD1C29868000687D6E /* FunctionalUtilTest.m */, - B660F6AF1C29868000687D6E /* ObservableTest.m */, B660F6B11C29868000687D6E /* QueueTest.h */, B660F6B21C29868000687D6E /* QueueTest.m */, B660F6B31C29868000687D6E /* UtilTest.h */, @@ -2285,7 +2262,6 @@ 342FCE6B1EF9C375002690AD /* OWS105AttachmentFilePaths.m in Sources */, 45BFFFA81D898AF0004A12A7 /* OWSStaleNotificationObserver.m in Sources */, 45C681B71D305A580050903A /* OWSCall.m in Sources */, - 76EB062618170B33006006FC /* Queue.m in Sources */, D221A09A169C9E5E00537ABF /* main.m in Sources */, 345671011E89A5F1006EE662 /* ThreadUtil.m in Sources */, 4585C4601ED4FD0400896AEA /* OWS104CreateRecipientIdentities.m in Sources */, @@ -2381,7 +2357,6 @@ 34B3F89C1E8DF3270035BE1A /* BlockListViewController.m in Sources */, 45F2B1941D9C9F48000D2C69 /* OWSOutgoingMessageCollectionViewCell.m in Sources */, 34C42D5B1F45F7A80072EC04 /* OWSNavigationController.m in Sources */, - BFB074C919A5611000F2947C /* ObservableValue.m in Sources */, B68EF9BA1C0B1EBD009C3DCD /* FLAnimatedImage.m in Sources */, B68112EA1A4D9EC400BA82FF /* UIImage+OWS.m in Sources */, B609597C1C2C0FC6004E8797 /* iRate.m in Sources */, @@ -2476,14 +2451,12 @@ B660F7761C29988E00687D6E /* UIFont+OWS.m in Sources */, B660F7771C29988E00687D6E /* UIImage+OWS.m in Sources */, 954AEE6A1DF33E01002E5410 /* ContactsPickerTest.swift in Sources */, - B660F77B1C29988E00687D6E /* Queue.m in Sources */, 455AC69C1F4F79E500134004 /* ImageCache.swift in Sources */, 4556FA691F54AA9500AF40DD /* DebugUIProfile.swift in Sources */, 45666F581D9B2880008FE134 /* OWSScrubbingLogFormatterTest.m in Sources */, B660F77F1C29988E00687D6E /* DateUtil.m in Sources */, B660F7811C29988E00687D6E /* FunctionalUtil.m in Sources */, B660F7831C29988E00687D6E /* NumberUtil.m in Sources */, - B660F7841C29988E00687D6E /* ObservableValue.m in Sources */, B660F7871C29988E00687D6E /* StringUtil.m in Sources */, 45FBC5C91DF8575700E9B410 /* CallKitCallManager.swift in Sources */, B660F78A1C29988E00687D6E /* UIUtil.m in Sources */, @@ -2504,7 +2477,6 @@ B660F6DF1C29868000687D6E /* QueueTest.m in Sources */, B660F6BB1C29868000687D6E /* OWSContactsManagerTest.m in Sources */, 45A6DAD71EBBF85500893231 /* ReminderView.swift in Sources */, - B660F6DD1C29868000687D6E /* ObservableTest.m in Sources */, B660F6D21C29868000687D6E /* PushManagerTest.m in Sources */, 45C0DC1F1E69011F00E04C47 /* UIStoryboard+OWS.swift in Sources */, 4505C2C01E648EA300CEBF41 /* ExperienceUpgrade.swift in Sources */, diff --git a/Signal/src/ViewControllers/AttachmentSharing.h b/Signal/src/ViewControllers/AttachmentSharing.h index f9adbea7a..b7d14bdc1 100644 --- a/Signal/src/ViewControllers/AttachmentSharing.h +++ b/Signal/src/ViewControllers/AttachmentSharing.h @@ -2,8 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import - @class TSAttachmentStream; @interface AttachmentSharing : NSObject diff --git a/Signal/src/ViewControllers/LockInteractionController.h b/Signal/src/ViewControllers/LockInteractionController.h index cb54b0940..741b0f100 100644 --- a/Signal/src/ViewControllers/LockInteractionController.h +++ b/Signal/src/ViewControllers/LockInteractionController.h @@ -1,12 +1,6 @@ // -// LockInteractionController.h -// Signal +// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -// Created by Frederic Jacobs on 22/08/15. -// Copyright (c) 2015 Open Whisper Systems. All rights reserved. -// - -#import @interface LockInteractionController : NSObject diff --git a/Signal/src/environment/DebugLogger.h b/Signal/src/environment/DebugLogger.h index b3265512b..113803726 100644 --- a/Signal/src/environment/DebugLogger.h +++ b/Signal/src/environment/DebugLogger.h @@ -1,12 +1,6 @@ // -// DebugLogger.h -// Signal +// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -// Created by Frederic Jacobs on 08/08/14. -// Copyright (c) 2014 Open Whisper Systems. All rights reserved. -// - -#import #import diff --git a/Signal/src/environment/Environment.h b/Signal/src/environment/Environment.h index f36cf24fc..9e6ff6312 100644 --- a/Signal/src/environment/Environment.h +++ b/Signal/src/environment/Environment.h @@ -5,7 +5,6 @@ #import "OWSPreferences.h" #import "TSGroupModel.h" #import "TSStorageHeaders.h" -#import /** * diff --git a/Signal/src/environment/Release.h b/Signal/src/environment/Release.h index 4a9afed4f..531003768 100644 --- a/Signal/src/environment/Release.h +++ b/Signal/src/environment/Release.h @@ -2,7 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import #import "Environment.h" @interface Release : NSObject diff --git a/Signal/src/environment/SignalKeyingStorage.h b/Signal/src/environment/SignalKeyingStorage.h index 8ed9f9338..a1eee50be 100644 --- a/Signal/src/environment/SignalKeyingStorage.h +++ b/Signal/src/environment/SignalKeyingStorage.h @@ -2,7 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import #import "PhoneNumber.h" #define LOCAL_NUMBER_KEY @"Number" diff --git a/Signal/src/environment/VersionMigrations.h b/Signal/src/environment/VersionMigrations.h index 9b9c00f93..a32491b00 100644 --- a/Signal/src/environment/VersionMigrations.h +++ b/Signal/src/environment/VersionMigrations.h @@ -2,8 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import - #define RECENT_CALLS_DEFAULT_KEY @"RPRecentCallsDefaultKey" @interface VersionMigrations : NSObject diff --git a/Signal/src/util/AppStoreRating.h b/Signal/src/util/AppStoreRating.h index 0568f0919..3f08d7fcc 100644 --- a/Signal/src/util/AppStoreRating.h +++ b/Signal/src/util/AppStoreRating.h @@ -1,12 +1,6 @@ // -// AppStoreRating.h -// Signal +// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -// Created by Frederic Jacobs on 23/08/15. -// Copyright (c) 2015 Open Whisper Systems. All rights reserved. -// - -#import @interface AppStoreRating : NSObject diff --git a/Signal/src/util/DateUtil.h b/Signal/src/util/DateUtil.h index 60f12ef43..268470429 100644 --- a/Signal/src/util/DateUtil.h +++ b/Signal/src/util/DateUtil.h @@ -1,4 +1,6 @@ -#import +// +// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// @interface DateUtil : NSObject diff --git a/Signal/src/util/FunctionalUtil.h b/Signal/src/util/FunctionalUtil.h index cb22bd78c..02fcdeabe 100644 --- a/Signal/src/util/FunctionalUtil.h +++ b/Signal/src/util/FunctionalUtil.h @@ -1,4 +1,6 @@ -#import +// +// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// @interface NSArray (FunctionalUtil) diff --git a/Signal/src/util/NSData+ows_StripToken.h b/Signal/src/util/NSData+ows_StripToken.h index a014a3d55..d07ff7818 100644 --- a/Signal/src/util/NSData+ows_StripToken.h +++ b/Signal/src/util/NSData+ows_StripToken.h @@ -1,12 +1,6 @@ // -// NSData+ows_StripToken.h -// Signal +// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -// Created by Frederic Jacobs on 14/04/15. -// Copyright (c) 2015 Open Whisper Systems. All rights reserved. -// - -#import @interface NSData (ows_StripToken) diff --git a/Signal/src/util/NSString+OWS.h b/Signal/src/util/NSString+OWS.h index 1f897763d..fd450f8ec 100644 --- a/Signal/src/util/NSString+OWS.h +++ b/Signal/src/util/NSString+OWS.h @@ -2,8 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import - @interface NSString (OWS) - (NSString *)ows_stripped; diff --git a/Signal/src/util/NumberUtil.h b/Signal/src/util/NumberUtil.h index f616f0c4c..c2a187298 100644 --- a/Signal/src/util/NumberUtil.h +++ b/Signal/src/util/NumberUtil.h @@ -2,7 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import #import "StringUtil.h" @interface NumberUtil : NSObject diff --git a/Signal/src/util/ObservableValue.h b/Signal/src/util/ObservableValue.h deleted file mode 100644 index 72e43dd31..000000000 --- a/Signal/src/util/ObservableValue.h +++ /dev/null @@ -1,42 +0,0 @@ -#import -#import "CollapsingFutures.h" -#import "Queue.h" - -typedef void (^LatestValueCallback)(id latestValue); - -/** - * - * An ObservableValue represents an asynchronous stream of values, such as 'latest state of toggle' or 'latest sensor - * reading'. - * - */ -@interface ObservableValue : NSObject { - @protected - NSMutableSet *callbacks; - @private - Queue *queuedActionsToRun; - @private - bool isRunningActions; - @protected - bool sealed; -} - -@property (readonly, atomic) id currentValue; - -- (void)watchLatestValueOnArbitraryThread:(LatestValueCallback)callback - untilCancelled:(TOCCancelToken *)untilCancelledToken; - -- (void)watchLatestValue:(LatestValueCallback)callback - onThread:(NSThread *)thread - untilCancelled:(TOCCancelToken *)untilCancelledToken; - -@end - -@interface ObservableValueController : ObservableValue - -+ (ObservableValueController *)observableValueControllerWithInitialValue:(id)value; -- (void)updateValue:(id)value; -- (void)adjustValue:(id (^)(id))adjustment; -- (void)sealValue; - -@end diff --git a/Signal/src/util/ObservableValue.m b/Signal/src/util/ObservableValue.m deleted file mode 100644 index 51c1b0b9e..000000000 --- a/Signal/src/util/ObservableValue.m +++ /dev/null @@ -1,136 +0,0 @@ -// -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. -// - -#import "Environment.h" -#import "ObservableValue.h" -#import "Util.h" - -@implementation ObservableValue - -@synthesize currentValue; - -- (ObservableValue *)initWithValue:(id)value { - callbacks = [NSMutableSet set]; - queuedActionsToRun = [Queue new]; - currentValue = value; - return self; -} - -- (void)watchLatestValueOnArbitraryThread:(LatestValueCallback)callback - untilCancelled:(TOCCancelToken *)untilCancelledToken { - ows_require(callback != nil); - if (untilCancelledToken.isAlreadyCancelled) - return; - - void (^callbackCopy)(id value) = [callback copy]; - [self queueRun:^{ - callbackCopy(self.currentValue); - [callbacks addObject:callbackCopy]; - }]; - [untilCancelledToken whenCancelledDo:^{ - [self queueRun:^{ - [callbacks removeObject:callbackCopy]; - }]; - }]; -} -- (void)watchLatestValue:(LatestValueCallback)callback - onThread:(NSThread *)thread - untilCancelled:(TOCCancelToken *)untilCancelledToken { - ows_require(callback != nil); - ows_require(thread != nil); - - void (^callbackCopy)(id value) = [callback copy]; - void (^threadedCallback)(id value) = ^(id value) { - [Operation asyncRun:^{ - callbackCopy(value); - } - onThread:thread]; - }; - - [self watchLatestValueOnArbitraryThread:threadedCallback untilCancelled:untilCancelledToken]; -} - -/// used for avoiding re-entrancy issues (e.g. a callback registering another callback during enumeration) -- (void)queueRun:(void (^)())action { - @synchronized(self) { - if (isRunningActions) { - [queuedActionsToRun enqueue:[action copy]]; - return; - } - isRunningActions = true; - } - - while (true) { - @try { - action(); - } @catch (id ex) { - DDLogError(@"A queued action failed and may have stalled an ObservableValue."); - @synchronized(self) { - isRunningActions = false; - } - [ex raise]; - } - - @ - synchronized(self) { - action = [queuedActionsToRun tryDequeue]; - if (action == nil) { - isRunningActions = false; - break; - } - } - } -} - -- (void)updateValue:(id)value { - [self queueRun:^{ - if (value == currentValue) - return; - requireState(!sealed); - - currentValue = value; - for (void (^callback)(id value) in callbacks) { - callback(value); - } - }]; -} - -- (void)adjustValue:(id (^)(id))adjustment { - ows_require(adjustment != nil); - [self queueRun:^{ - id oldValue = currentValue; - id newValue = adjustment(oldValue); - if (oldValue == newValue) - return; - requireState(!sealed); - - currentValue = newValue; - for (void (^callback)(id value) in callbacks) { - callback(currentValue); - } - }]; -} - -@end - -@implementation ObservableValueController - -+ (ObservableValueController *)observableValueControllerWithInitialValue:(id)value { - return [[ObservableValueController alloc] initWithValue:value]; -} - -- (void)updateValue:(id)value { - [super updateValue:value]; -} -- (void)adjustValue:(id (^)(id))adjustment { - [super adjustValue:adjustment]; -} -- (void)sealValue { - [self queueRun:^{ - sealed = true; - callbacks = nil; - }]; -} - -@end diff --git a/Signal/src/util/Operation.h b/Signal/src/util/Operation.h index 5068406ab..eb61d3b57 100644 --- a/Signal/src/util/Operation.h +++ b/Signal/src/util/Operation.h @@ -2,7 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import #import "StringUtil.h" typedef void (^Action)(void); diff --git a/Signal/src/util/StringUtil.h b/Signal/src/util/StringUtil.h index 0811f9b1d..09ede7f70 100644 --- a/Signal/src/util/StringUtil.h +++ b/Signal/src/util/StringUtil.h @@ -2,8 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import - @interface NSString (Util) /// The utf-8 encoding of the string's text. diff --git a/Signal/src/util/UIUtil.h b/Signal/src/util/UIUtil.h index 315805eee..b23866af9 100644 --- a/Signal/src/util/UIUtil.h +++ b/Signal/src/util/UIUtil.h @@ -2,8 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import - #import "MIMETypeUtil.h" #import "UIColor+OWS.h" #import "UIFont+OWS.h" diff --git a/Signal/src/util/Util.h b/Signal/src/util/Util.h index 7f838f509..c875f126c 100644 --- a/Signal/src/util/Util.h +++ b/Signal/src/util/Util.h @@ -2,7 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import #import "DateUtil.h" #import "FunctionalUtil.h" #import "NumberUtil.h" diff --git a/Signal/src/util/collections/Queue.h b/Signal/src/util/collections/Queue.h deleted file mode 100644 index 3cc6506b9..000000000 --- a/Signal/src/util/collections/Queue.h +++ /dev/null @@ -1,10 +0,0 @@ -#import - -@interface Queue : NSObject -- (void)enqueue:(id)item; -- (id)dequeue; -- (id)tryDequeue; -- (id)peek; -- (id)peekAt:(NSUInteger)offset; -- (NSUInteger)count; -@end diff --git a/Signal/src/util/collections/Queue.m b/Signal/src/util/collections/Queue.m deleted file mode 100644 index 309808746..000000000 --- a/Signal/src/util/collections/Queue.m +++ /dev/null @@ -1,42 +0,0 @@ -// -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. -// - -#import "Queue.h" - -@implementation Queue { - @private - NSMutableArray *items; -} -- (id)init { - if (self = [super init]) { - self->items = [NSMutableArray array]; - } - return self; -} -- (void)enqueue:(id)item { - [items addObject:item]; -} -- (id)tryDequeue { - if (self.count == 0) - return nil; - return [self dequeue]; -} -- (id)dequeue { - requireState(self.count > 0); - id result = items[0]; - [items removeObjectAtIndex:0]; - return result; -} -- (id)peek { - requireState(self.count > 0); - return items[0]; -} -- (id)peekAt:(NSUInteger)offset { - ows_require(offset < self.count); - return items[offset]; -} -- (NSUInteger)count { - return items.count; -} -@end diff --git a/Signal/test/TestUtil.h b/Signal/test/TestUtil.h index 127500dd2..bcf80ce39 100644 --- a/Signal/test/TestUtil.h +++ b/Signal/test/TestUtil.h @@ -2,7 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import #import "Release.h" #define testPhoneNumber1 [PhoneNumber phoneNumberFromE164:@"+19027777777"] diff --git a/Signal/test/util/ObservableTest.m b/Signal/test/util/ObservableTest.m deleted file mode 100644 index 0542423f9..000000000 --- a/Signal/test/util/ObservableTest.m +++ /dev/null @@ -1,134 +0,0 @@ -#import -#import "ObservableValue.h" -#import "TestUtil.h" - -@interface ObservableTest : XCTestCase -@end - -@implementation ObservableTest - --(void) testObservableAddRemove { - ObservableValueController* s = [ObservableValueController observableValueControllerWithInitialValue:@""]; - ObservableValue* t = s; - NSMutableArray* a = [NSMutableArray array]; - TOCCancelTokenSource* c = [TOCCancelTokenSource new]; - - [t watchLatestValueOnArbitraryThread:^(id value) {[a addObject:value];} - untilCancelled:c.token]; - - test([a isEqualToArray:@[@""]]); - [s updateValue:@5]; - test([a isEqualToArray:(@[@"", @5])]); - [s updateValue:@7]; - test([a isEqualToArray:(@[@"", @5, @7])]); - [c cancel]; - [s updateValue:@11]; - test([a isEqualToArray:(@[@"", @5, @7])]); -} --(void) testObservableAddAdd { - ObservableValueController* s = [ObservableValueController observableValueControllerWithInitialValue:@""]; - ObservableValue* t = s; - NSMutableArray* a = [NSMutableArray array]; - TOCCancelTokenSource* c = [TOCCancelTokenSource new]; - - [t watchLatestValueOnArbitraryThread:^(id value) {[a addObject:value];} - untilCancelled:c.token]; - [t watchLatestValueOnArbitraryThread:^(id value) {[a addObject:value];} - untilCancelled:c.token]; - [t watchLatestValueOnArbitraryThread:^(id value) {[a addObject:value];} - untilCancelled:c.token]; - - test([a isEqualToArray:(@[@"", @"", @""])]); - [s updateValue:@5]; - test([a isEqualToArray:(@[@"", @"", @"", @5, @5, @5])]); -} --(void) testObservableRedundantSetIgnored { - id v1 = @""; - id v2 = nil; - id v3 = @1; - - ObservableValueController* s = [ObservableValueController observableValueControllerWithInitialValue:v1]; - ObservableValue* t = s; - __block id latest = nil; - __block int count = 0; - [t watchLatestValueOnArbitraryThread:^(id value) {latest = value;count++;} - untilCancelled:nil]; - - test(latest == v1); - test(count == 1); - - [s updateValue:v1]; - test(latest == v1); - test(count == 1); - - [s updateValue:v2]; - test(latest == v2); - test(count == 2); - - [s updateValue:v2]; - test(latest == v2); - test(count == 2); - - [s updateValue:v1]; - test(latest == v1); - test(count == 3); - - [s updateValue:v3]; - test(latest == v3); - test(count == 4); -} --(void) testObservableReentrantAdd { - ObservableValueController* s = [ObservableValueController observableValueControllerWithInitialValue:@""]; - ObservableValue* t = s; - NSMutableArray* a = [NSMutableArray array]; - TOCCancelTokenSource* c = [TOCCancelTokenSource new]; - - __block void(^registerSelf)() = nil; - void(^registerSelf_builder)() = ^{ - __block bool first = true; - [t watchLatestValueOnArbitraryThread:^(id value) { - if (!first) registerSelf(); - first = false; - [a addObject:value]; - } untilCancelled:c.token]; - }; - registerSelf = [registerSelf_builder copy]; - registerSelf(); - - // adding during a callback counts as adding after the callback - // so we should see a doubling each time - test([a isEqualToArray:@[@""]]); - [s updateValue:@1]; - test([a isEqualToArray:(@[@"", @1, @1])]); - [s updateValue:@2]; - test([a isEqualToArray:(@[@"", @1, @1, @2, @2, @2, @2])]); - [s updateValue:@3]; - test([a isEqualToArray:(@[@"", @1, @1, @2, @2, @2, @2, @3, @3, @3, @3, @3, @3, @3, @3])]); -} --(void) testObservableReentrantRemove { - ObservableValueController* s = [ObservableValueController observableValueControllerWithInitialValue:@""]; - ObservableValue* t = s; - NSMutableArray* a = [NSMutableArray array]; - TOCCancelTokenSource* c = [TOCCancelTokenSource new]; - - for (int i = 0; i < 3; i++) { - __block bool first = true; - [t watchLatestValueOnArbitraryThread:^(id value) { - if (!first) { - [c cancel]; - [a addObject:value]; - } - first = false; - } untilCancelled:c.token]; - } - - // removing during a callback counts as removing after the callback - // so we should see all the callbacks run, then they're all cancelled - test([a isEqualToArray:(@[])]); - [s updateValue:@1]; - test([a isEqualToArray:(@[@1, @1, @1])]); - [s updateValue:@2]; - test([a isEqualToArray:(@[@1, @1, @1])]); -} - -@end diff --git a/SignalServiceKit/src/Account/TSAccountManager.h b/SignalServiceKit/src/Account/TSAccountManager.h index 2ced4049a..2e53e96cc 100644 --- a/SignalServiceKit/src/Account/TSAccountManager.h +++ b/SignalServiceKit/src/Account/TSAccountManager.h @@ -2,7 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import #import "TSConstants.h" NS_ASSUME_NONNULL_BEGIN diff --git a/SignalServiceKit/src/Account/TSAttributes.h b/SignalServiceKit/src/Account/TSAttributes.h index 0cd1faf1c..d19ab8b17 100644 --- a/SignalServiceKit/src/Account/TSAttributes.h +++ b/SignalServiceKit/src/Account/TSAttributes.h @@ -1,12 +1,6 @@ // -// TSAttributes.h -// Signal +// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -// Created by Frederic Jacobs on 22/08/15. -// Copyright (c) 2015 Open Whisper Systems. All rights reserved. -// - -#import @interface TSAttributes : NSObject diff --git a/SignalServiceKit/src/Account/TSPreKeyManager.h b/SignalServiceKit/src/Account/TSPreKeyManager.h index 8f628c384..c66bd0268 100644 --- a/SignalServiceKit/src/Account/TSPreKeyManager.h +++ b/SignalServiceKit/src/Account/TSPreKeyManager.h @@ -2,7 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import #import "TSAccountManager.h" typedef NS_ENUM(NSInteger, RefreshPreKeysMode) { diff --git a/SignalServiceKit/src/Network/API/Requests/TSRequest.h b/SignalServiceKit/src/Network/API/Requests/TSRequest.h index 3b032e9c4..651ebe9e5 100644 --- a/SignalServiceKit/src/Network/API/Requests/TSRequest.h +++ b/SignalServiceKit/src/Network/API/Requests/TSRequest.h @@ -2,8 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import - @interface TSRequest : NSMutableURLRequest @property (nonatomic, retain) NSMutableDictionary *parameters; diff --git a/SignalServiceKit/src/Network/API/TSNetworkManager.h b/SignalServiceKit/src/Network/API/TSNetworkManager.h index 9c33ac40e..08451c573 100644 --- a/SignalServiceKit/src/Network/API/TSNetworkManager.h +++ b/SignalServiceKit/src/Network/API/TSNetworkManager.h @@ -20,7 +20,6 @@ #import "TSUpdateAttributesRequest.h" #import "TSVerifyCodeRequest.h" #import -#import NS_ASSUME_NONNULL_BEGIN diff --git a/SignalServiceKit/src/Network/WebSockets/TSSocketManager.h b/SignalServiceKit/src/Network/WebSockets/TSSocketManager.h index b90fc4c14..69fe44afd 100644 --- a/SignalServiceKit/src/Network/WebSockets/TSSocketManager.h +++ b/SignalServiceKit/src/Network/WebSockets/TSSocketManager.h @@ -2,7 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import #import "SRWebSocket.h" static void *SocketManagerStateObservationContext = &SocketManagerStateObservationContext; diff --git a/SignalServiceKit/src/Storage/TSDatabaseSecondaryIndexes.h b/SignalServiceKit/src/Storage/TSDatabaseSecondaryIndexes.h index 2ad0283f1..6d3b4b828 100644 --- a/SignalServiceKit/src/Storage/TSDatabaseSecondaryIndexes.h +++ b/SignalServiceKit/src/Storage/TSDatabaseSecondaryIndexes.h @@ -1,12 +1,6 @@ // -// TSDatabaseSecondaryIndexes.h -// Signal +// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -// Created by Frederic Jacobs on 26/01/15. -// Copyright (c) 2015 Open Whisper Systems. All rights reserved. -// - -#import #import #import diff --git a/SignalServiceKit/src/Storage/TSDatabaseView.h b/SignalServiceKit/src/Storage/TSDatabaseView.h index 921b36ede..01d000da0 100644 --- a/SignalServiceKit/src/Storage/TSDatabaseView.h +++ b/SignalServiceKit/src/Storage/TSDatabaseView.h @@ -2,7 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import #import extern NSString *const kNSNotificationName_DatabaseViewRegistrationComplete; diff --git a/SignalServiceKit/src/Storage/TSStorageManager.h b/SignalServiceKit/src/Storage/TSStorageManager.h index 4af7e44cc..0dbd4ad4a 100644 --- a/SignalServiceKit/src/Storage/TSStorageManager.h +++ b/SignalServiceKit/src/Storage/TSStorageManager.h @@ -4,7 +4,6 @@ #import "TSStorageKeys.h" #import "YapDatabaseConnection+OWS.h" -#import #import @class ECKeyPair; diff --git a/SignalServiceKit/src/TSConstants.h b/SignalServiceKit/src/TSConstants.h index 9e42ee6bd..cefd281a0 100644 --- a/SignalServiceKit/src/TSConstants.h +++ b/SignalServiceKit/src/TSConstants.h @@ -2,7 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import @class TSNumberVerifier; #ifndef TextSecureKit_Constants_h diff --git a/SignalServiceKit/src/Util/Asserts.h b/SignalServiceKit/src/Util/Asserts.h index 09aeaaf32..d52817043 100755 --- a/SignalServiceKit/src/Util/Asserts.h +++ b/SignalServiceKit/src/Util/Asserts.h @@ -2,8 +2,6 @@ // Copyright (c) 2017 Open Whisper Systems. All rights reserved. // -#import - #ifndef OWSAssert #ifdef DEBUG