notifications: get contact id only for calls
Contact id is only needed to present call screen, for other
notifications it is unnecessary and uses extra memory to load
certificates.
Change-Id: I88dbb0d700864e8fe7265be0b61667ac334c1bcb
diff --git a/Ring/jamiNotificationExtension/Adapter.mm b/Ring/jamiNotificationExtension/Adapter.mm
index 148f3e4..098c0ab 100644
--- a/Ring/jamiNotificationExtension/Adapter.mm
+++ b/Ring/jamiNotificationExtension/Adapter.mm
@@ -54,8 +54,6 @@
MSGPACK_DEFINE_MAP(id, ice_msg, isAnswer, connType)
};
-typedef NS_ENUM(NSInteger, NotificationType) { videoCall, audioCall, gitMessage, unknown };
-
// Constants
const std::string fileSeparator = "/";
NSString* const certificates = @"certificates";
@@ -246,13 +244,17 @@
if (isMessageTreated(peerCR.id, [treatedMessagesPath UTF8String])) {
return {};
}
- auto certPath = [[Constants documentsPath] URLByAppendingPathComponent:certificates].path.UTF8String;
- auto crlPath = [[Constants documentsPath] URLByAppendingPathComponent:crls].path.UTF8String;
- auto ocspPath = [[Constants documentsPath] URLByAppendingPathComponent:ocsp].path.UTF8String;
- std::string peerId = getPeerId(decrypted->owner->getId().toString(),
- certPath,
- crlPath,
- ocspPath);
+
+ std::string peerId = "";
+ if (peerCR.connType == "videoCall" || peerCR.connType == "audioCall") {
+ auto certPath = [[Constants documentsPath] URLByAppendingPathComponent:certificates].path.UTF8String;
+ auto crlPath = [[Constants documentsPath] URLByAppendingPathComponent:crls].path.UTF8String;
+ auto ocspPath = [[Constants documentsPath] URLByAppendingPathComponent:ocsp].path.UTF8String;
+ peerId = getPeerId(decrypted->owner->getId().toString(),
+ certPath,
+ crlPath,
+ ocspPath);
+ }
return @{@(peerId.c_str()): @(peerCR.connType.c_str())};
} catch (std::runtime_error error) {
}