Debug
This commit is contained in:
parent
e0da0fd64e
commit
c0b4a548bf
|
@ -181,8 +181,8 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
|
|||
|
||||
self.view.addSubview(bottomContainer)
|
||||
bottomContainer.autoPinWidthToSuperview()
|
||||
bottomContainer.autoPinEdge(toSuperviewEdge: .bottom)
|
||||
footerBar.autoPinEdge(.bottom, to: .bottom, of: view)
|
||||
bottomContainer.autoPinEdge(toSuperviewSafeArea: .bottom)
|
||||
footerBar.autoPinEdge(toSuperviewSafeArea: .bottom)
|
||||
footerBar.autoSetDimension(.height, toSize: 44)
|
||||
|
||||
updateTitle()
|
||||
|
|
|
@ -1027,10 +1027,26 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
|
|||
|
||||
- (nullable NSString *)profileNameForRecipientWithID:(NSString *)recipientID
|
||||
{
|
||||
if ([self.tsAccountManager.localNumber isEqualToString:recipientID]) {
|
||||
return self.localUserProfile.profileName;
|
||||
}
|
||||
|
||||
__block OWSUserProfile *userProfile;
|
||||
|
||||
[self.dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
userProfile = [OWSUserProfile fetchObjectWithUniqueID:recipientID transaction:transaction];
|
||||
}];
|
||||
|
||||
if (userProfile != nil) {
|
||||
return userProfile.profileName;
|
||||
}
|
||||
|
||||
__block NSString *result;
|
||||
|
||||
[LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
result = [self profileNameForRecipientWithID:recipientID transaction:transaction];
|
||||
} error:nil];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ public final class LokiAPI : NSObject {
|
|||
// MARK: Settings
|
||||
private static let maxRetryCount: UInt = 4
|
||||
private static let defaultTimeout: TimeInterval = 20
|
||||
private static let longPollingTimeout: TimeInterval = 40
|
||||
|
||||
internal static var powDifficulty: UInt = 1
|
||||
/// - Note: Changing this on the fly is not recommended.
|
||||
|
@ -51,19 +50,17 @@ public final class LokiAPI : NSObject {
|
|||
}
|
||||
}
|
||||
|
||||
internal static func getRawMessages(from target: LokiAPITarget, usingLongPolling useLongPolling: Bool) -> RawResponsePromise {
|
||||
internal static func getRawMessages(from target: LokiAPITarget) -> RawResponsePromise {
|
||||
let lastHashValue = getLastMessageHashValue(for: target) ?? ""
|
||||
let parameters = [ "pubKey" : getUserHexEncodedPublicKey(), "lastHash" : lastHashValue ]
|
||||
let headers: [String:String]? = useLongPolling ? [ "X-Loki-Long-Poll" : "true" ] : nil
|
||||
let timeout: TimeInterval? = useLongPolling ? longPollingTimeout : nil
|
||||
return invoke(.getMessages, on: target, associatedWith: getUserHexEncodedPublicKey(), parameters: parameters, headers: headers, timeout: timeout)
|
||||
return invoke(.getMessages, on: target, associatedWith: getUserHexEncodedPublicKey(), parameters: parameters)
|
||||
}
|
||||
|
||||
// MARK: Public API
|
||||
public static func getMessages() -> Promise<Set<MessageListPromise>> {
|
||||
return attempt(maxRetryCount: maxRetryCount, recoveringOn: LokiAPI.workQueue) {
|
||||
getTargetSnodes(for: getUserHexEncodedPublicKey()).mapValues2 { targetSnode in
|
||||
getRawMessages(from: targetSnode, usingLongPolling: false).map2 { parseRawMessagesResponse($0, from: targetSnode) }
|
||||
getRawMessages(from: targetSnode).map2 { parseRawMessagesResponse($0, from: targetSnode) }
|
||||
}.map2 { Set($0) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ public final class LokiPoller : NSObject {
|
|||
|
||||
private func poll(_ target: LokiAPITarget, seal longTermSeal: Resolver<Void>) -> Promise<Void> {
|
||||
guard !hasStopped else { return Promise { $0.fulfill(()) } }
|
||||
return LokiAPI.getRawMessages(from: target, usingLongPolling: false).then(on: DispatchQueue.main) { [weak self] rawResponse -> Promise<Void> in
|
||||
return LokiAPI.getRawMessages(from: target).then(on: DispatchQueue.main) { [weak self] rawResponse -> Promise<Void> in
|
||||
guard let strongSelf = self, !strongSelf.hasStopped else { return Promise { $0.fulfill(()) } }
|
||||
let messages = LokiAPI.parseRawMessagesResponse(rawResponse, from: target)
|
||||
strongSelf.onMessagesReceived(messages)
|
||||
|
|
|
@ -85,6 +85,8 @@ public final class MentionsManager : NSObject {
|
|||
populate(in: transaction)
|
||||
}
|
||||
}
|
||||
userPublicKeyCache[threadID] = result
|
||||
if !result.isEmpty {
|
||||
userPublicKeyCache[threadID] = result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue