Merge branch 'mkirk/fix-notification-percents'

This commit is contained in:
Michael Kirk 2018-02-13 08:30:09 -08:00
commit 945c7cd1f9
24 changed files with 222 additions and 89 deletions

View file

@ -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

View file

@ -32,7 +32,7 @@ If you don't agree with us, you can use the [ClangFormat Xcode plugin](https://g
## Contributors
Signal wouldnt 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 wouldnt 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:

View file

@ -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

12
Podfile
View file

@ -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

View file

@ -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

2
Pods

@ -1 +1 @@
Subproject commit 0cabd3831b29c6aa789160479133d5e432b487e6
Subproject commit 74892fab4a428293530f7d82299f2e6d8cf0be5d

View file

@ -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.

View file

@ -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.
Public License instead of this License.

View file

@ -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 = "<group>"; };
4579431D1E7C8CE9008ED0C0 /* Pastelog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Pastelog.m; sourceTree = "<group>"; };
45794E851E00620000066731 /* CallUIAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CallUIAdapter.swift; path = UserInterface/CallUIAdapter.swift; sourceTree = "<group>"; };
457C87B72032645C008D52D6 /* DebugUINotifications.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugUINotifications.swift; sourceTree = "<group>"; };
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 = "<group>"; };
45855F361D9498A40084F340 /* OWSContactAvatarBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSContactAvatarBuilder.m; sourceTree = "<group>"; };
@ -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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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)
}
}

View file

@ -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)
}
}
}

View file

@ -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]];

View file

@ -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;
}

View file

@ -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)

View file

@ -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() {

View file

@ -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'

View file

@ -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).

View file

@ -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

View file

@ -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'

View file

@ -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;

View file

@ -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 <MTLJSONSerializing>

View file

@ -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.