diff --git a/BUILDING.md b/BUILDING.md index 2ceef1cb2..3da55b825 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -60,7 +60,7 @@ carthage build --platform iOS A prebuilt version of WebRTC.framework resides in our Carthage submodule and should be installed by the above steps. However, if you'd like to -build it from source, see: https://github.com/WhisperSystems/signal-webrtc-ios +build it from source, see: https://github.com/signalapp/signal-webrtc-ios ## 3. XCode diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8bb3381aa..c3b4a9eb3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,7 +32,7 @@ If you don't agree with us, you can use the [ClangFormat Xcode plugin](https://g ## Contributors -Signal wouldn’t be possible without the many open-source projects we depend on. Big shoutout to the maintainers of all the [pods](https://github.com/WhisperSystems/Signal-iOS/blob/master/Podfile) we use! +Signal wouldn’t be possible without the many open-source projects we depend on. Big shoutout to the maintainers of all the [pods](https://github.com/signalapp/Signal-iOS/blob/master/Podfile) we use! The original version of Signal was developed by Twisted Oak Studios. v1.0 development by Twisted Oak Studios: diff --git a/MAINTAINING.md b/MAINTAINING.md index d94891906..fc67ec4cd 100644 --- a/MAINTAINING.md +++ b/MAINTAINING.md @@ -14,7 +14,7 @@ Similarly, Carthage dependencies can be updated like so: `carthage update` WebRTC updates are managed separately and manually based on -https://github.com/WhisperSystems/signal-webrtc-ios +https://github.com/signalapp/signal-webrtc-ios ## Translations diff --git a/Podfile b/Podfile index 15ad5ef81..706f582ab 100644 --- a/Podfile +++ b/Podfile @@ -8,22 +8,22 @@ def shared_pods # pod 'SQLCipher', path: '../sqlcipher2' pod 'SQLCipher', :git => 'https://github.com/sqlcipher/sqlcipher.git', :commit => 'd5c2bec' # pod 'YapDatabase/SQLCipher', path: '../YapDatabase' - pod 'YapDatabase/SQLCipher', :git => 'https://github.com/WhisperSystems/YapDatabase.git', branch: 'release/unencryptedHeaders' + pod 'YapDatabase/SQLCipher', :git => 'https://github.com/signalapp/YapDatabase.git', branch: 'release/unencryptedHeaders' # pod 'AxolotlKit', path: '../SignalProtocolKit' pod 'SignalServiceKit', path: '.' pod 'AxolotlKit', git: 'https://github.com/signalapp/SignalProtocolKit.git' #pod 'AxolotlKit', path: '../SignalProtocolKit' - pod 'HKDFKit', git: 'https://github.com/WhisperSystems/HKDFKit.git', branch: 'mkirk/framework-friendly' + pod 'HKDFKit', git: 'https://github.com/signalapp/HKDFKit.git', branch: 'mkirk/framework-friendly' #pod 'HKDFKit', path: '../HKDFKit' - pod 'Curve25519Kit', git: 'https://github.com/WhisperSystems/Curve25519Kit', branch: 'mkirk/framework-friendly' + pod 'Curve25519Kit', git: 'https://github.com/signalapp/Curve25519Kit', branch: 'mkirk/framework-friendly' #pod 'Curve25519Kit', path: '../Curve25519Kit' - pod 'GRKOpenSSLFramework', git: 'https://github.com/WhisperSystems/GRKOpenSSLFramework' + pod 'GRKOpenSSLFramework', git: 'https://github.com/signalapp/GRKOpenSSLFramework' #pod 'GRKOpenSSLFramework', path: '../GRKOpenSSLFramework' # third party pods pod 'AFNetworking', inhibit_warnings: true - pod 'JSQMessagesViewController', git: 'https://github.com/WhisperSystems/JSQMessagesViewController.git', branch: 'mkirk/share-compatible', :inhibit_warnings => true - #pod 'JSQMessagesViewController', git: 'https://github.com/WhisperSystems/JSQMessagesViewController.git', branch: 'signal-master', :inhibit_warnings => true + pod 'JSQMessagesViewController', git: 'https://github.com/signalapp/JSQMessagesViewController.git', branch: 'mkirk/share-compatible', :inhibit_warnings => true + #pod 'JSQMessagesViewController', git: 'https://github.com/signalapp/JSQMessagesViewController.git', branch: 'signal-master', :inhibit_warnings => true #pod 'JSQMessagesViewController', path: '../JSQMessagesViewController' pod 'Mantle', :inhibit_warnings => true # pod 'YapDatabase/SQLCipher', :inhibit_warnings => true diff --git a/Podfile.lock b/Podfile.lock index 3c11d1812..d72cbbb1f 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -130,10 +130,10 @@ DEPENDENCIES: - AFNetworking - ATAppUpdater - AxolotlKit (from `https://github.com/signalapp/SignalProtocolKit.git`) - - Curve25519Kit (from `https://github.com/WhisperSystems/Curve25519Kit`, branch `mkirk/framework-friendly`) - - GRKOpenSSLFramework (from `https://github.com/WhisperSystems/GRKOpenSSLFramework`) - - HKDFKit (from `https://github.com/WhisperSystems/HKDFKit.git`, branch `mkirk/framework-friendly`) - - JSQMessagesViewController (from `https://github.com/WhisperSystems/JSQMessagesViewController.git`, branch `mkirk/share-compatible`) + - Curve25519Kit (from `https://github.com/signalapp/Curve25519Kit`, branch `mkirk/framework-friendly`) + - GRKOpenSSLFramework (from `https://github.com/signalapp/GRKOpenSSLFramework`) + - HKDFKit (from `https://github.com/signalapp/HKDFKit.git`, branch `mkirk/framework-friendly`) + - JSQMessagesViewController (from `https://github.com/signalapp/JSQMessagesViewController.git`, branch `mkirk/share-compatible`) - Mantle - PureLayout - Reachability @@ -141,7 +141,7 @@ DEPENDENCIES: - SocketRocket (from `https://github.com/facebook/SocketRocket.git`) - SQLCipher (from `https://github.com/sqlcipher/sqlcipher.git`, commit `d5c2bec`) - SSZipArchive - - YapDatabase/SQLCipher (from `https://github.com/WhisperSystems/YapDatabase.git`, branch `release/unencryptedHeaders`) + - YapDatabase/SQLCipher (from `https://github.com/signalapp/YapDatabase.git`, branch `release/unencryptedHeaders`) - YYImage EXTERNAL SOURCES: @@ -149,15 +149,15 @@ EXTERNAL SOURCES: :git: https://github.com/signalapp/SignalProtocolKit.git Curve25519Kit: :branch: mkirk/framework-friendly - :git: https://github.com/WhisperSystems/Curve25519Kit + :git: https://github.com/signalapp/Curve25519Kit GRKOpenSSLFramework: - :git: https://github.com/WhisperSystems/GRKOpenSSLFramework + :git: https://github.com/signalapp/GRKOpenSSLFramework HKDFKit: :branch: mkirk/framework-friendly - :git: https://github.com/WhisperSystems/HKDFKit.git + :git: https://github.com/signalapp/HKDFKit.git JSQMessagesViewController: :branch: mkirk/share-compatible - :git: https://github.com/WhisperSystems/JSQMessagesViewController.git + :git: https://github.com/signalapp/JSQMessagesViewController.git SignalServiceKit: :path: . SocketRocket: @@ -167,7 +167,7 @@ EXTERNAL SOURCES: :git: https://github.com/sqlcipher/sqlcipher.git YapDatabase: :branch: release/unencryptedHeaders - :git: https://github.com/WhisperSystems/YapDatabase.git + :git: https://github.com/signalapp/YapDatabase.git CHECKOUT OPTIONS: AxolotlKit: @@ -175,16 +175,16 @@ CHECKOUT OPTIONS: :git: https://github.com/signalapp/SignalProtocolKit.git Curve25519Kit: :commit: 03a19c80aafc10a3464f0c086b1eb38239c507ac - :git: https://github.com/WhisperSystems/Curve25519Kit + :git: https://github.com/signalapp/Curve25519Kit GRKOpenSSLFramework: :commit: 841e24eba93cabfe503222f858de2a40b3762aab - :git: https://github.com/WhisperSystems/GRKOpenSSLFramework + :git: https://github.com/signalapp/GRKOpenSSLFramework HKDFKit: :commit: d2e2e50990e88537d6c4e38cc32a6f6debd83446 - :git: https://github.com/WhisperSystems/HKDFKit.git + :git: https://github.com/signalapp/HKDFKit.git JSQMessagesViewController: :commit: 33dd72b7bac85fc54a87fb8016c9a927af222153 - :git: https://github.com/WhisperSystems/JSQMessagesViewController.git + :git: https://github.com/signalapp/JSQMessagesViewController.git SocketRocket: :commit: 28035e1a98a427853e4038ff1b70479fa8374cfa :git: https://github.com/facebook/SocketRocket.git @@ -193,7 +193,7 @@ CHECKOUT OPTIONS: :git: https://github.com/sqlcipher/sqlcipher.git YapDatabase: :commit: bdd7409de45f9e38b9144adba3b38d74ca48ea77 - :git: https://github.com/WhisperSystems/YapDatabase.git + :git: https://github.com/signalapp/YapDatabase.git SPEC CHECKSUMS: AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67 @@ -211,7 +211,7 @@ SPEC CHECKSUMS: PureLayout: 4d550abe49a94f24c2808b9b95db9131685fe4cd Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c - SignalServiceKit: 8f9038e584080bee8c367268067e6e0ec0feefcf + SignalServiceKit: 2dbddc0638e387feb714d9cc68962d4956c8ebe5 SocketRocket: dbb1554b8fc288ef8ef370d6285aeca7361be31e SQLCipher: f9fcf29b2e59ced7defc2a2bdd0ebe79b40d4990 SSZipArchive: 14401ade5f8e82aba1ff03e9f88e9de60937ae60 @@ -220,6 +220,6 @@ SPEC CHECKSUMS: YapDatabase: 299a32de9d350d37a9ac5b0532609d87d5d2a5de YYImage: 1e1b62a9997399593e4b9c4ecfbbabbf1d3f3b54 -PODFILE CHECKSUM: d424a8f153ae6e31631ed25ef5700e7e60234a79 +PODFILE CHECKSUM: 59053e1c79fca64b3429210d11db5520977f49cb COCOAPODS: 1.3.1 diff --git a/Pods b/Pods index 0cabd3831..74892fab4 160000 --- a/Pods +++ b/Pods @@ -1 +1 @@ -Subproject commit 0cabd3831b29c6aa789160479133d5e432b487e6 +Subproject commit 74892fab4a428293530f7d82299f2e6d8cf0be5d diff --git a/README.md b/README.md index 203732109..ea249f7a5 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ Signal is a messaging app for simple private communication with friends. Help us translate Signal! The translation effort happens on [Transifex](https://www.transifex.com/open-whisper-systems/signal-ios/) ## Contributing Code -Instructions on how to setup your development environment and build Signal-iOS can be found in [BUILDING.md](https://github.com/WhisperSystems/Signal-iOS/blob/master/BUILDING.md). Other useful instructions for development can be found in the [Development Guide wiki page](https://github.com/WhisperSystems/Signal-iOS/wiki/Development-Guide) +Instructions on how to setup your development environment and build Signal-iOS can be found in [BUILDING.md](https://github.com/signalapp/Signal-iOS/blob/master/BUILDING.md). Other useful instructions for development can be found in the [Development Guide wiki page](https://github.com/signalapp/Signal-iOS/wiki/Development-Guide) -We recommend going through our issues and picking out something with the [help wanted](https://github.com/WhisperSystems/Signal-iOS/labels/help%20wanted) label. +We recommend going through our issues and picking out something with the [help wanted](https://github.com/signalapp/Signal-iOS/labels/help%20wanted) label. For larger changes and feature ideas, we ask that you propose it on the [unofficial Community Forum](https://whispersystems.discoursehosting.net) for a high-level discussion with the wider community before implementation. diff --git a/SettingsBundle/licenses/AxolotlKit.license b/SettingsBundle/licenses/AxolotlKit.license index ea4565732..9be171d71 100644 --- a/SettingsBundle/licenses/AxolotlKit.license +++ b/SettingsBundle/licenses/AxolotlKit.license @@ -1,5 +1,5 @@ AxolotlKit -https://github.com/WhisperSystems/AxolotlKit +https://github.com/signalapp/AxolotlKit GNU GENERAL PUBLIC LICENSE Version 2, June 1991 @@ -339,4 +339,4 @@ This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. \ No newline at end of file +Public License instead of this License. diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 9c0202b95..01cd92888 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -282,6 +282,7 @@ 4574A5D61DD6704700C6B692 /* CallService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4574A5D51DD6704700C6B692 /* CallService.swift */; }; 4579431E1E7C8CE9008ED0C0 /* Pastelog.m in Sources */ = {isa = PBXBuildFile; fileRef = 4579431D1E7C8CE9008ED0C0 /* Pastelog.m */; }; 45794E861E00620000066731 /* CallUIAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45794E851E00620000066731 /* CallUIAdapter.swift */; }; + 457C87B82032645C008D52D6 /* DebugUINotifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 457C87B72032645C008D52D6 /* DebugUINotifications.swift */; }; 45847E871E4283C30080EAB3 /* Intents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 45847E861E4283C30080EAB3 /* Intents.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 4585C4681ED8F8D200896AEA /* SafetyNumberConfirmationAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4585C4671ED8F8D200896AEA /* SafetyNumberConfirmationAlert.swift */; }; 458967111DC117CC00E9DD21 /* AccountManagerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 458967101DC117CC00E9DD21 /* AccountManagerTest.swift */; }; @@ -818,6 +819,7 @@ 4579431C1E7C8CE9008ED0C0 /* Pastelog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pastelog.h; sourceTree = ""; }; 4579431D1E7C8CE9008ED0C0 /* Pastelog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Pastelog.m; sourceTree = ""; }; 45794E851E00620000066731 /* CallUIAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CallUIAdapter.swift; path = UserInterface/CallUIAdapter.swift; sourceTree = ""; }; + 457C87B72032645C008D52D6 /* DebugUINotifications.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugUINotifications.swift; sourceTree = ""; }; 45847E861E4283C30080EAB3 /* Intents.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Intents.framework; path = System/Library/Frameworks/Intents.framework; sourceTree = SDKROOT; }; 45855F351D9498A40084F340 /* OWSContactAvatarBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSContactAvatarBuilder.h; sourceTree = ""; }; 45855F361D9498A40084F340 /* OWSContactAvatarBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSContactAvatarBuilder.m; sourceTree = ""; }; @@ -1464,6 +1466,7 @@ 34D8C0241ED3673300188D7C /* DebugUIMessages.m */, 341F2C0D1F2B8AE700D07D6B /* DebugUIMisc.h */, 341F2C0E1F2B8AE700D07D6B /* DebugUIMisc.m */, + 457C87B72032645C008D52D6 /* DebugUINotifications.swift */, 34E3EF0E1EFC2684007F6822 /* DebugUIPage.h */, 34E3EF0F1EFC2684007F6822 /* DebugUIPage.m */, 4556FA671F54AA9500AF40DD /* DebugUIProfile.swift */, @@ -2933,6 +2936,7 @@ 34D5CCA91EAE3D30005515DB /* AvatarViewHelper.m in Sources */, 34D1F0B71F87F8850066283D /* OWSGenericAttachmentView.m in Sources */, 34B3F8801E8DF1700035BE1A /* InviteFlow.swift in Sources */, + 457C87B82032645C008D52D6 /* DebugUINotifications.swift in Sources */, 34B3F8871E8DF1700035BE1A /* NotificationSettingsViewController.m in Sources */, 347E0B7B2003CD7500BC2F76 /* OWSBackupImportViewController.m in Sources */, 458E38371D668EBF0094BD24 /* OWSDeviceProvisioningURLParser.m in Sources */, @@ -3152,7 +3156,11 @@ "DEBUG=1", "$(inherited)", ); - "GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = "DEBUG=1 $(inherited) SSK_BUILDING_FOR_TESTS=1"; + "GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = ( + "DEBUG=1", + "$(inherited)", + "SSK_BUILDING_FOR_TESTS=1", + ); GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m index 64c42b6bf..ef0330f6e 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m @@ -1251,7 +1251,7 @@ const CGFloat OWSMessageCellCornerRadius = 17; OWSAssert(self.delegate); if (sender.state != UIGestureRecognizerStateRecognized) { - DDLogInfo(@"%@ Ignoring tap on message: %@", self.logTag, self.viewItem.interaction.debugDescription); + DDLogVerbose(@"%@ Ignoring tap on message: %@", self.logTag, self.viewItem.interaction.debugDescription); return; } @@ -1277,7 +1277,7 @@ const CGFloat OWSMessageCellCornerRadius = 17; OWSAssert(self.delegate); if (sender.state != UIGestureRecognizerStateRecognized) { - DDLogInfo(@"%@ Ignoring tap on message: %@", self.logTag, self.viewItem.interaction.debugDescription); + DDLogVerbose(@"%@ Ignoring tap on message: %@", self.logTag, self.viewItem.interaction.debugDescription); return; } diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m index 2c3a8869a..5ee8b4494 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m @@ -150,7 +150,8 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) { switch (self.interaction.interactionType) { case OWSInteractionType_Unknown: - OWSFail(@"%@ Unknown interaction type: %@", self.logTag, self.interaction.debugDescription); + DDLogVerbose(@"%@ Unknown interaction type: %@", self.logTag, self.interaction.debugDescription); + OWSFail(@"%@ Unknown interaction type", self.logTag); return ConversationViewLayoutAlignment_Center; case OWSInteractionType_IncomingMessage: return ConversationViewLayoutAlignment_Incoming; diff --git a/Signal/src/ViewControllers/DebugUI/DebugUICalling.swift b/Signal/src/ViewControllers/DebugUI/DebugUICalling.swift index 0b8875c13..eb78d85a0 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUICalling.swift +++ b/Signal/src/ViewControllers/DebugUI/DebugUICalling.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // import Foundation @@ -8,13 +8,8 @@ import SignalMessaging class DebugUICalling: DebugUIPage { - let TAG = "[DebugUICalling]" - // MARK: Dependencies - var notificationsAdapter: CallNotificationsAdapter { - return SignalApp.shared().callService.notificationsAdapter - } var messageSender: MessageSender { return Environment.current().messageSender } @@ -32,30 +27,15 @@ class DebugUICalling: DebugUIPage { } let sectionItems = [ - OWSTableItem(title:"⚠️ Missed Call") { - self.delayedDispatchWithFakeCall(thread: thread) { call in - self.notificationsAdapter.presentMissedCall(call, callerName: thread.name()) - } - }, - OWSTableItem(title:"⚠️ New Safety Number (rejected)") { - self.delayedDispatchWithFakeCall(thread: thread) { call in - self.notificationsAdapter.presentMissedCallBecauseOfNewIdentity(call: call, callerName: thread.name()) - } - }, - OWSTableItem(title:"⚠️ No Longer Verified (rejected)") { - self.delayedDispatchWithFakeCall(thread: thread) { call in - self.notificationsAdapter.presentMissedCallBecauseOfNoLongerVerifiedIdentity(call: call, callerName: thread.name()) - } - }, OWSTableItem(title:"Send 'hangup' for old call") { let kFakeCallId = UInt64(12345) let hangupMessage = OWSCallHangupMessage(callId: kFakeCallId) let callMessage = OWSOutgoingCallMessage(thread: thread, hangupMessage: hangupMessage) self.messageSender.sendPromise(message: callMessage).then { - Logger.debug("\(self.TAG) Successfully sent hangup call message to \(thread.contactIdentifier())") + Logger.debug("\(self.logTag) Successfully sent hangup call message to \(thread.contactIdentifier())") }.catch { error in - Logger.error("\(self.TAG) failed to send hangup call message to \(thread.contactIdentifier()) with error: \(error)") + Logger.error("\(self.logTag) failed to send hangup call message to \(thread.contactIdentifier()) with error: \(error)") } }, OWSTableItem(title:"Send 'busy' for old call") { @@ -64,27 +44,13 @@ class DebugUICalling: DebugUIPage { let callMessage = OWSOutgoingCallMessage(thread: thread, busyMessage: busyMessage) self.messageSender.sendPromise(message: callMessage).then { - Logger.debug("\(self.TAG) Successfully sent busy call message to \(thread.contactIdentifier())") + Logger.debug("\(self.logTag) Successfully sent busy call message to \(thread.contactIdentifier())") }.catch { error in - Logger.error("\(self.TAG) failed to send busy call message to \(thread.contactIdentifier()) with error: \(error)") + Logger.error("\(self.logTag) failed to send busy call message to \(thread.contactIdentifier()) with error: \(error)") } } ] - return OWSTableSection(title: "Call Notifications (⚠️) have delay: \(kNotificationDelay)s", items: sectionItems) - } - - // MARK: Helpers - - // After enqueing the notification you may want to background the app or lock the screen before it triggers, so - // we give a little delay. - let kNotificationDelay: TimeInterval = 5 - - func delayedDispatchWithFakeCall(thread: TSContactThread, callBlock: @escaping (SignalCall) -> Void) { - let call = SignalCall.incomingCall(localId: UUID(), remotePhoneNumber: thread.contactIdentifier(), signalingId: 0) - - DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + kNotificationDelay) { - callBlock(call) - } + return OWSTableSection(title: "Call Debug", items: sectionItems) } } diff --git a/Signal/src/ViewControllers/DebugUI/DebugUINotifications.swift b/Signal/src/ViewControllers/DebugUI/DebugUINotifications.swift new file mode 100644 index 000000000..966c5dd65 --- /dev/null +++ b/Signal/src/ViewControllers/DebugUI/DebugUINotifications.swift @@ -0,0 +1,133 @@ +// +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// + +import Foundation +import SignalServiceKit +import SignalMessaging + +class DebugUINotifications: DebugUIPage { + + // MARK: Dependencies + + var notificationsManager: NotificationsManager { + return SignalApp.shared().notificationsManager + } + var notificationsAdapter: CallNotificationsAdapter { + return SignalApp.shared().callService.notificationsAdapter + } + var messageSender: MessageSender { + return Environment.current().messageSender + } + var contactsManager: OWSContactsManager { + return Environment.current().contactsManager + } + + // MARK: Overrides + + override func name() -> String { + return "Notifications" + } + + override func section(thread aThread: TSThread?) -> OWSTableSection? { + guard let thread = aThread else { + owsFail("\(logTag) Notifications must specify thread.") + return nil + } + + var sectionItems = [ + OWSTableItem(title:"Last Incoming Message") { [weak self] in + guard let strongSelf = self else { + return + } + + Logger.info("\(strongSelf.logTag) scheduling notification for incoming message.") + strongSelf.delayedNotificationDispatch { + Logger.info("\(strongSelf.logTag) dispatching") + TSStorageManager.shared().newDatabaseConnection().read { (transaction) in + guard let viewTransaction = transaction.ext(TSMessageDatabaseViewExtensionName) as? YapDatabaseViewTransaction else { + owsFail("unable to build view transaction") + return + } + + guard let threadId = thread.uniqueId else { + owsFail("thread had no uniqueId") + return + } + + guard let incomingMessage = viewTransaction.lastObject(inGroup: threadId) as? TSIncomingMessage else { + owsFail("last message was not an incoming message.") + return + } + Logger.info("\(strongSelf.logTag) notifying user of incoming message") + strongSelf.notificationsManager.notifyUser(for: incomingMessage, in: thread, contactsManager: strongSelf.contactsManager, transaction: transaction) + } + } + } + ] + + if let contactThread = thread as? TSContactThread { + sectionItems += [ + OWSTableItem(title:"Call Missed") { [weak self] in + guard let strongSelf = self else { + return + } + + strongSelf.delayedNotificationDispatchWithFakeCall(thread: contactThread) { call in + strongSelf.notificationsAdapter.presentMissedCall(call, callerName: thread.name()) + } + }, + OWSTableItem(title:"Call Rejected: New Safety Number") { [weak self] in + guard let strongSelf = self else { + return + } + + strongSelf.delayedNotificationDispatchWithFakeCall(thread: contactThread) { call in + strongSelf.notificationsAdapter.presentMissedCallBecauseOfNewIdentity(call: call, callerName: thread.name()) + } + }, + OWSTableItem(title:"Call Rejected: No Longer Verified") { [weak self] in + guard let strongSelf = self else { + return + } + + strongSelf.delayedNotificationDispatchWithFakeCall(thread: contactThread) { call in + strongSelf.notificationsAdapter.presentMissedCallBecauseOfNoLongerVerifiedIdentity(call: call, callerName: thread.name()) + } + } + ] + } + + return OWSTableSection(title: "Notifications have delay: \(kNotificationDelay)s", items: sectionItems) + } + + // MARK: Helpers + + // After enqueing the notification you may want to background the app or lock the screen before it triggers, so + // we give a little delay. + let kNotificationDelay: TimeInterval = 5 + + func delayedNotificationDispatch(block: @escaping () -> Void) { + + // Notifications won't sound if the app is suspended. + let taskIdentifier = UIApplication.shared.beginBackgroundTask(expirationHandler: nil) + DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + kNotificationDelay) { + block() + + // We don't want to endBackgroundTask until *after* the notifications manager is done, + // but it dispatches async without a completion handler, so we just wait a while extra. + // This is fragile, but it's only for debug UI. + DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 2.0) { + UIApplication.shared.endBackgroundTask(taskIdentifier) + } + } + } + + func delayedNotificationDispatchWithFakeCall(thread: TSContactThread, callBlock: @escaping (SignalCall) -> Void) { + let call = SignalCall.incomingCall(localId: UUID(), remotePhoneNumber: thread.contactIdentifier(), signalingId: 0) + + delayedNotificationDispatch { + callBlock(call) + } + } +} diff --git a/Signal/src/ViewControllers/DebugUI/DebugUITableViewController.m b/Signal/src/ViewControllers/DebugUI/DebugUITableViewController.m index 5213f74f2..007a443e0 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUITableViewController.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUITableViewController.m @@ -85,6 +85,8 @@ NS_ASSUME_NONNULL_BEGIN [subsectionItems addObject:[self itemForSubsection:[DebugUICalling new] viewController:viewController thread:thread]]; } + [subsectionItems + addObject:[self itemForSubsection:[DebugUINotifications new] viewController:viewController thread:thread]]; [subsectionItems addObject:[self itemForSubsection:[DebugUIProfile new] viewController:viewController thread:thread]]; [subsectionItems addObject:[self itemForSubsection:[DebugUIStress new] viewController:viewController thread:thread]]; diff --git a/Signal/src/environment/NotificationsManager.m b/Signal/src/environment/NotificationsManager.m index 90f76ab31..2f1556b9b 100644 --- a/Signal/src/environment/NotificationsManager.m +++ b/Signal/src/environment/NotificationsManager.m @@ -263,7 +263,14 @@ NSString *const kNotificationsManagerNewMesssageSoundName = @"NewMessage.aifc"; OWSAssert(contactsManager); // While batch processing, some of the necessary changes have not been commited. - NSString *messageDescription = [message previewTextWithTransaction:transaction]; + NSString *rawMessageText = [message previewTextWithTransaction:transaction]; + + // iOS strips anything that looks like a printf formatting character from + // the notification body, so if we want to dispay a literal "%" in a notification + // it must be escaped. + // see https://developer.apple.com/documentation/uikit/uilocalnotification/1616646-alertbody + // for more details. + NSString *messageText = [DisplayableText filterNotificationText:rawMessageText]; dispatch_async(dispatch_get_main_queue(), ^{ if (thread.isMuted) { @@ -278,7 +285,7 @@ NSString *const kNotificationsManagerNewMesssageSoundName = @"NewMessage.aifc"; groupName = [MessageStrings newGroupDefaultTitle]; } - if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive && messageDescription) { + if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive && messageText) { UILocalNotification *notification = [[UILocalNotification alloc] init]; if (shouldPlaySound) { notification.soundName = kNotificationsManagerNewMesssageSoundName; @@ -307,14 +314,16 @@ NSString *const kNotificationsManagerNewMesssageSoundName = @"NewMessage.aifc"; if ([thread isGroupThread]) { NSString *threadName = [NSString stringWithFormat:@"\"%@\"", groupName]; + // TODO: Format parameters might change order in l10n. We should use named parameters. notification.alertBody = [NSString stringWithFormat:NSLocalizedString(@"APN_MESSAGE_IN_GROUP_DETAILED", nil), senderName, threadName, - messageDescription]; + messageText]; + } else { - notification.alertBody = [NSString stringWithFormat:@"%@: %@", senderName, messageDescription]; + notification.alertBody = [NSString stringWithFormat:@"%@: %@", senderName, messageText]; } break; } diff --git a/SignalMessaging/attachments/SignalAttachment.swift b/SignalMessaging/attachments/SignalAttachment.swift index b956049ec..5a5617b9a 100644 --- a/SignalMessaging/attachments/SignalAttachment.swift +++ b/SignalMessaging/attachments/SignalAttachment.swift @@ -171,7 +171,7 @@ public class SignalAttachment: NSObject { /** * Media Size constraints from Signal-Android * - * https://github.com/WhisperSystems/Signal-Android/blob/master/src/org/thoughtcrime/securesms/mms/PushMediaConstraints.java + * https://github.com/signalapp/Signal-Android/blob/master/src/org/thoughtcrime/securesms/mms/PushMediaConstraints.java */ static let kMaxFileSizeAnimatedImage = UInt(25 * 1024 * 1024) static let kMaxFileSizeImage = UInt(6 * 1024 * 1024) diff --git a/SignalMessaging/utils/DisplayableText.swift b/SignalMessaging/utils/DisplayableText.swift index aca28be14..b8a888581 100644 --- a/SignalMessaging/utils/DisplayableText.swift +++ b/SignalMessaging/utils/DisplayableText.swift @@ -215,6 +215,20 @@ extension String { return text.ows_stripped() } + @objc + public class func filterNotificationText(_ text: String?) -> String? { + guard let text = self.filterText(text) else { + return nil + } + + // iOS strips anything that looks like a printf formatting character from + // the notification body, so if we want to dispay a literal "%" in a notification + // it must be escaped. + // see https://developer.apple.com/documentation/uikit/uilocalnotification/1616646-alertbody + // for more details. + return text.replacingOccurrences(of: "%", with: "%%") + } + private class func hasExcessiveDiacriticals(text: String) -> Bool { // discard any zalgo style text, by detecting maximum number of glyphs per character for char in text.enumerated() { diff --git a/SignalServiceKit.podspec b/SignalServiceKit.podspec index 52bd5214f..293fac037 100644 --- a/SignalServiceKit.podspec +++ b/SignalServiceKit.podspec @@ -15,10 +15,10 @@ Pod::Spec.new do |s| An Objective-C library for communicating with the Signal messaging service. DESC - s.homepage = "https://github.com/WhisperSystems/SignalServiceKit" + s.homepage = "https://github.com/signalapp/SignalServiceKit" s.license = 'GPLv3' s.author = { "Frederic Jacobs" => "github@fredericjacobs.com" } - s.source = { :git => "https://github.com/WhisperSystems/SignalServiceKit.git", :tag => s.version.to_s } + s.source = { :git => "https://github.com/signalapp/SignalServiceKit.git", :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/FredericJacobs' s.platform = :ios, '8.0' diff --git a/SignalServiceKit/CONTRIBUTING.md b/SignalServiceKit/CONTRIBUTING.md index 2a70aacc0..a18332c90 100644 --- a/SignalServiceKit/CONTRIBUTING.md +++ b/SignalServiceKit/CONTRIBUTING.md @@ -9,5 +9,5 @@ Please go ahead and sign, putting your github username in "Address line #2", so ## Code Conventions -Follow all [Signal-iOS Code Conventions](https://github.com/WhisperSystems/Signal-iOS/blob/master/CONTRIBUTING.md). +Follow all [Signal-iOS Code Conventions](https://github.com/signalapp/Signal-iOS/blob/master/CONTRIBUTING.md). diff --git a/SignalServiceKit/Example/TSKitiOSTestApp/Podfile b/SignalServiceKit/Example/TSKitiOSTestApp/Podfile index e79be0d5f..346d73be1 100644 --- a/SignalServiceKit/Example/TSKitiOSTestApp/Podfile +++ b/SignalServiceKit/Example/TSKitiOSTestApp/Podfile @@ -3,9 +3,9 @@ source 'https://github.com/CocoaPods/Specs.git' target 'TSKitiOSTestApp' do pod 'SocketRocket', git: 'https://github.com/facebook/SocketRocket.git' - pod 'AxolotlKit', git: 'https://github.com/WhisperSystems/SignalProtocolKit.git' + pod 'AxolotlKit', git: 'https://github.com/signalapp/SignalProtocolKit.git' pod 'SignalServiceKit', :path => '../../../SignalServiceKit.podspec' - pod 'OpenSSL', git: 'https://github.com/WhisperSystems/OpenSSL-Pod' + pod 'OpenSSL', git: 'https://github.com/signalapp/OpenSSL-Pod' target 'TSKitiOSTestAppTests' do inherit! :search_paths diff --git a/SignalServiceKit/README.md b/SignalServiceKit/README.md index c775e391d..5749588ab 100644 --- a/SignalServiceKit/README.md +++ b/SignalServiceKit/README.md @@ -5,5 +5,5 @@ messaging service for iOS & OS X To use SignalServiceKit via Cocoapods add the following to your Podfile - pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/Signal-iOS.git' + pod 'SignalServiceKit', git: 'https://github.com/signalapp/Signal-iOS.git' diff --git a/SignalServiceKit/src/Messages/OWSMessageManager.m b/SignalServiceKit/src/Messages/OWSMessageManager.m index 616754e59..75dac61d0 100644 --- a/SignalServiceKit/src/Messages/OWSMessageManager.m +++ b/SignalServiceKit/src/Messages/OWSMessageManager.m @@ -385,7 +385,7 @@ NS_ASSUME_NONNULL_BEGIN return; } - // FIXME: https://github.com/WhisperSystems/Signal-iOS/issues/1340 + // FIXME: https://github.com/signalapp/Signal-iOS/issues/1340 DDLogInfo(@"%@ Sending group info request: %@", self.logTag, envelopeAddress(envelope)); NSString *recipientId = envelope.source; diff --git a/SignalServiceKit/src/Messages/OWSMessageServiceParams.h b/SignalServiceKit/src/Messages/OWSMessageServiceParams.h index 3cb01e29c..f32a0e4cb 100644 --- a/SignalServiceKit/src/Messages/OWSMessageServiceParams.h +++ b/SignalServiceKit/src/Messages/OWSMessageServiceParams.h @@ -10,7 +10,7 @@ * the Signal Web Service. * * See: - * https://github.com/WhisperSystems/libsignal-service-java/blob/master/java/src/main/java/org/whispersystems/signalservice/internal/push/OutgoingPushMessage.java + * https://github.com/signalapp/libsignal-service-java/blob/master/java/src/main/java/org/whispersystems/signalservice/internal/push/OutgoingPushMessage.java */ @interface OWSMessageServiceParams : MTLModel diff --git a/SignalServiceKit/src/Util/NSData+messagePadding.m b/SignalServiceKit/src/Util/NSData+messagePadding.m index cd10112ba..cf22fd085 100644 --- a/SignalServiceKit/src/Util/NSData+messagePadding.m +++ b/SignalServiceKit/src/Util/NSData+messagePadding.m @@ -32,7 +32,7 @@ - (NSData *)paddedMessageBody { // From - // https://github.com/WhisperSystems/TextSecure/blob/master/libtextsecure/src/main/java/org/whispersystems/textsecure/internal/push/PushTransportDetails.java#L55 + // https://github.com/signalapp/TextSecure/blob/master/libtextsecure/src/main/java/org/whispersystems/textsecure/internal/push/PushTransportDetails.java#L55 // NOTE: This is dumb. We have our own padding scheme, but so does the cipher. // The +1 -1 here is to make sure the Cipher has room to add one padding byte, // otherwise it'll add a full 16 extra bytes.