diff --git a/LokiPushNotificationService/NotificationService.swift b/LokiPushNotificationService/NotificationService.swift
index 706c2edd3..09768aa39 100644
--- a/LokiPushNotificationService/NotificationService.swift
+++ b/LokiPushNotificationService/NotificationService.swift
@@ -5,6 +5,7 @@ import SignalMessaging
class NotificationService: UNNotificationServiceExtension {
static let threadIdKey = "Signal.AppNotificationsUserInfoKey.threadId"
+ static let isFromRemoteKey = "remote"
var areVersionMigrationsComplete = false
var contentHandler: ((UNNotificationContent) -> Void)?
var notificationContent: UNMutableNotificationContent?
@@ -25,8 +26,7 @@ class NotificationService: UNNotificationServiceExtension {
if (envelope != nil && envelopeData != nil) {
decrypter.decryptEnvelope(envelope!, envelopeData: envelopeData!,
successBlock: { result,transaction in
- if let envelope = try? SSKProtoEnvelope.parseData(result.envelopeData) {
- self.removeDecryptionChain(envelope: envelope, transaction: transaction)
+ if (try? SSKProtoEnvelope.parseData(result.envelopeData)) != nil {
self.handelDecryptionResult(result: result, notificationContent: notificationContent, transaction: transaction)
} else {
self.completeWithFailure(content: notificationContent)
@@ -41,11 +41,6 @@ class NotificationService: UNNotificationServiceExtension {
}
}
- func removeDecryptionChain(envelope: SSKProtoEnvelope, transaction: YapDatabaseReadWriteTransaction) {
- let sessionRecord = SSKEnvironment.shared.primaryStorage.loadSession(envelope.source!, deviceId: Int32(envelope.sourceDevice), protocolContext: transaction)
- let sessionState = sessionRecord.sessionState()
- }
-
func handelDecryptionResult(result: OWSMessageDecryptResult, notificationContent: UNMutableNotificationContent, transaction: YapDatabaseReadWriteTransaction) {
let contentProto = try? SSKProtoContent.parseData(result.plaintextData!)
var thread: TSThread
@@ -84,9 +79,11 @@ class NotificationService: UNNotificationServiceExtension {
thread = TSContactThread.getOrCreateThread(withContactId: result.source, transaction: transaction)
displayName = contentProto?.dataMessage?.profile?.displayName ?? displayName
}
- let userInfo: [String: Any] = [NotificationService.threadIdKey: thread.uniqueId!]
+ let userInfo: [String: Any] = [NotificationService.threadIdKey: thread.uniqueId!,
+ NotificationService.isFromRemoteKey: true]
notificationContent.title = displayName
notificationContent.userInfo = userInfo
+ notificationContent.badge = 1
if newNotificationBody.count < 1 {
newNotificationBody = contentProto?.dataMessage?.body ?? ""
}
@@ -205,6 +202,8 @@ class NotificationService: UNNotificationServiceExtension {
func completeWithFailure(content: UNMutableNotificationContent) {
content.body = "You've got a new message."
content.title = "Session"
+ let userInfo: [String: Any] = [NotificationService.isFromRemoteKey: true]
+ content.userInfo = userInfo
contentHandler?(content)
}
diff --git a/Pods b/Pods
index 7d2822b86..fede6eca0 160000
--- a/Pods
+++ b/Pods
@@ -1 +1 @@
-Subproject commit 7d2822b86d1ff3bf09eb6cab2f01a03e7e214081
+Subproject commit fede6eca060a60c0232bf7f1328462a27728d823
diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj
index 628981734..3a0459a01 100644
--- a/Signal.xcodeproj/project.pbxproj
+++ b/Signal.xcodeproj/project.pbxproj
@@ -4817,6 +4817,7 @@
"-fobjc-arc-exceptions",
"-Werror=protocol",
);
+ "OTHER_SWIFT_FLAGS[arch=*]" = "-D DEBUG";
SDKROOT = iphoneos;
SWIFT_VERSION = 4.0;
VALIDATE_PRODUCT = YES;
diff --git a/Signal.xcodeproj/xcshareddata/xcschemes/LokiPushNotificationService.xcscheme b/Signal.xcodeproj/xcshareddata/xcschemes/LokiPushNotificationService.xcscheme
new file mode 100644
index 000000000..5b224cdec
--- /dev/null
+++ b/Signal.xcodeproj/xcshareddata/xcschemes/LokiPushNotificationService.xcscheme
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Signal.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Signal.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
index 949b67898..6b30c7459 100644
--- a/Signal.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
+++ b/Signal.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -4,5 +4,7 @@
BuildSystemType
Original
+ PreviewsEnabled
+
diff --git a/SignalMessaging/contacts/SystemContactsFetcher.swift b/SignalMessaging/contacts/SystemContactsFetcher.swift
index ef4d6d22d..ce035b419 100644
--- a/SignalMessaging/contacts/SystemContactsFetcher.swift
+++ b/SignalMessaging/contacts/SystemContactsFetcher.swift
@@ -353,6 +353,7 @@ public class SystemContactsFetcher: NSObject {
guard let contacts = fetchedContacts else {
owsFailDebug("contacts was unexpectedly not set.")
completion(nil)
+ return
}
Logger.info("fetched \(contacts.count) contacts.")
diff --git a/SignalServiceKit/src/Messages/TypingIndicatorMessage.swift b/SignalServiceKit/src/Messages/TypingIndicatorMessage.swift
index d5901d073..88ff54151 100644
--- a/SignalServiceKit/src/Messages/TypingIndicatorMessage.swift
+++ b/SignalServiceKit/src/Messages/TypingIndicatorMessage.swift
@@ -104,11 +104,6 @@ public class TypingIndicatorMessage: TSOutgoingMessage {
public override func shouldBeSaved() -> Bool {
return false
}
-
- @objc
- public override var ttl: UInt32 {
- return UInt32(5 * kMinuteInMs)
- }
@objc
public override var debugDescription: String {
diff --git a/SignalServiceKit/src/Storage/AxolotlStore/OWSPrimaryStorage+SessionStore.m b/SignalServiceKit/src/Storage/AxolotlStore/OWSPrimaryStorage+SessionStore.m
index be6b65f53..ef0d28cf9 100644
--- a/SignalServiceKit/src/Storage/AxolotlStore/OWSPrimaryStorage+SessionStore.m
+++ b/SignalServiceKit/src/Storage/AxolotlStore/OWSPrimaryStorage+SessionStore.m
@@ -88,6 +88,9 @@ NSString *const kSessionStoreDBConnectionKey = @"kSessionStoreDBConnectionKey";
OWSAssertDebug(contactIdentifier.length > 0);
OWSAssertDebug(deviceId >= 0);
OWSAssertDebug([protocolContext isKindOfClass:[YapDatabaseReadWriteTransaction class]]);
+ if (!CurrentAppContext().isMainApp) {
+ return;
+ }
YapDatabaseReadWriteTransaction *transaction = protocolContext;