Sketch out OWSIdentityManager.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-06-06 15:01:16 -04:00 committed by Michael Kirk
parent ceb210748e
commit b6ddea9eae
6 changed files with 2 additions and 54 deletions

View file

@ -154,7 +154,6 @@
458E38371D668EBF0094BD24 /* OWSDeviceProvisioningURLParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 458E38361D668EBF0094BD24 /* OWSDeviceProvisioningURLParser.m */; };
458E383A1D6699FA0094BD24 /* OWSDeviceProvisioningURLParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 458E38391D6699FA0094BD24 /* OWSDeviceProvisioningURLParserTest.m */; };
459311FC1D75C948008DD4F0 /* OWSDeviceTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 459311FB1D75C948008DD4F0 /* OWSDeviceTableViewCell.m */; };
459B1C671ED480BB00506A04 /* MarkIdentityAsSeenJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 459B1C661ED480BB00506A04 /* MarkIdentityAsSeenJob.swift */; };
45A6DAD61EBBF85500893231 /* ReminderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45A6DAD51EBBF85500893231 /* ReminderView.swift */; };
45A6DAD71EBBF85500893231 /* ReminderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45A6DAD51EBBF85500893231 /* ReminderView.swift */; };
45AE48511E0732D6004D96C2 /* TurnServerInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45AE48501E0732D6004D96C2 /* TurnServerInfo.swift */; };
@ -577,7 +576,6 @@
459311FB1D75C948008DD4F0 /* OWSDeviceTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSDeviceTableViewCell.m; sourceTree = "<group>"; };
4597E94E1D8313C100040CDE /* sq */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sq; path = translations/sq.lproj/Localizable.strings; sourceTree = "<group>"; };
4597E94F1D8313CB00040CDE /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bg; path = translations/bg.lproj/Localizable.strings; sourceTree = "<group>"; };
459B1C661ED480BB00506A04 /* MarkIdentityAsSeenJob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MarkIdentityAsSeenJob.swift; path = Jobs/MarkIdentityAsSeenJob.swift; sourceTree = "<group>"; };
45A6DAD51EBBF85500893231 /* ReminderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReminderView.swift; sourceTree = "<group>"; };
45AE48501E0732D6004D96C2 /* TurnServerInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TurnServerInfo.swift; sourceTree = "<group>"; };
45B201741DAECBFD00C461E0 /* Signal-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Signal-Bridging-Header.h"; sourceTree = "<group>"; };
@ -1163,7 +1161,6 @@
451DE9FC1DC1A28200810E42 /* SyncPushTokensJob.swift */,
45D231761DC7E8F10034FA89 /* SessionResetJob.swift */,
452ECA4C1E087E7200E2F016 /* MessageFetcherJob.swift */,
459B1C661ED480BB00506A04 /* MarkIdentityAsSeenJob.swift */,
4585C4651ED5DF7A00896AEA /* ProfileFetcherJob.swift */,
);
name = Jobs;
@ -2126,7 +2123,6 @@
45C0DC1E1E69011F00E04C47 /* UIStoryboard+OWS.swift in Sources */,
34F3089F1ECA580B00BB7697 /* OWSUnreadIndicatorCell.m in Sources */,
34B3F8861E8DF1700035BE1A /* NotificationSettingsOptionsViewController.m in Sources */,
459B1C671ED480BB00506A04 /* MarkIdentityAsSeenJob.swift in Sources */,
452ECA4D1E087E7200E2F016 /* MessageFetcherJob.swift in Sources */,
452EA0971EA662330078744B /* AttachmentPointerAdapter.swift in Sources */,
34DFCB851E8E04B500053165 /* AddToBlockListViewController.m in Sources */,

View file

@ -1,43 +0,0 @@
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
import Foundation
@objc
class MarkIdentityAsSeenJob: NSObject {
let TAG = "[MarkIdentityAsSeenJob]"
private let recipientIds: [String]
public class func run(thread: TSThread) {
let recipientIds = thread.recipientIdentifiers
MarkIdentityAsSeenJob(recipientIds: recipientIds).run()
}
public class func run(recipientId: String) {
MarkIdentityAsSeenJob(recipientIds: [recipientId]).run()
}
init(recipientIds: [String]) {
self.recipientIds = recipientIds
}
public func run() {
for recipientId in self.recipientIds {
markAsSeenIfNecessary(recipientId: recipientId)
}
}
private func markAsSeenIfNecessary(recipientId: String) {
guard let identity = OWSRecipientIdentity.fetch(uniqueId: recipientId) else {
Logger.verbose("\(self.TAG) no existing identity for recipient: \(recipientId). No messages with them yet?")
return
}
if !identity.wasSeen {
Logger.info("\(self.TAG) marking identity as seen for recipient: \(recipientId)")
identity.updateAsSeen()
}
}
}

View file

@ -834,7 +834,6 @@ typedef enum : NSUInteger {
_callOnOpen = NO;
}
[self updateNavigationBarSubtitleLabel];
[MarkIdentityAsSeenJob runWithThread:self.thread];
[ProfileFetcherJob runWithThread:self.thread networkManager:self.networkManager];
[self markVisibleMessagesAsRead];

View file

@ -72,7 +72,6 @@ class SafetyNumberConfirmationAlert: NSObject {
OWSDispatch.sessionStoreQueue().async {
OWSIdentityManager.shared().saveRemoteIdentity(untrustedIdentity.identityKey,
recipientId: untrustedIdentity.recipientId)
MarkIdentityAsSeenJob.run(recipientId: untrustedIdentity.recipientId)
DispatchQueue.main.async {
completion(true)
}

View file

@ -54,8 +54,8 @@ static NSString *const OWS104CreateRecipientIdentitiesMigrationId = @"104";
identityKey:identityKey
isFirstKnownKey:NO
createdAt:[NSDate dateWithTimeIntervalSince1970:0]
approvedForBlockingUse:YES
approvedForNonBlockingUse:NO] saveWithTransaction:transaction];
verificationState:OWSVerificationStateDefault]
saveWithTransaction:transaction];
}];
[self saveWithTransaction:transaction];

View file

@ -216,9 +216,6 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
return;
}
TSContactThread *thread = [TSContactThread getOrCreateThreadWithContactId:recipientId];
[MarkIdentityAsSeenJob runWithThread:thread];
[self.callUIAdapter startAndShowOutgoingCallWithRecipientId:recipientId];
completionHandler();
} else if ([identifier isEqualToString:PushManagerActionsShowThread]) {