mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Clean & add documentation
This commit is contained in:
parent
67d047aaa5
commit
a65235fd3a
10 changed files with 20 additions and 16 deletions
|
@ -126,9 +126,6 @@
|
|||
<Test
|
||||
Identifier = "OWSSignalAddressTest">
|
||||
</Test>
|
||||
<Test
|
||||
Identifier = "OWSUDManagerTest">
|
||||
</Test>
|
||||
<Test
|
||||
Identifier = "PhoneNumberTest">
|
||||
</Test>
|
||||
|
|
|
@ -64,7 +64,7 @@ typedef NS_ENUM(NSInteger, LKThreadFriendRequestStatus) {
|
|||
@property (nonatomic, readonly) BOOL hasCurrentUserSentFriendRequest;
|
||||
@property (nonatomic, readonly) BOOL hasCurrentUserReceivedFriendRequest;
|
||||
// ========
|
||||
@property (nonatomic) BOOL isForceHidden;
|
||||
@property (nonatomic) BOOL isForceHidden; // FIXME: Having both this and shouldThreadBeVisible is confusing
|
||||
|
||||
/**
|
||||
* Whether the object is a group thread or not.
|
||||
|
|
|
@ -23,10 +23,10 @@ public final class SessionManagementProtocol : NSObject {
|
|||
|
||||
@objc(createPreKeys)
|
||||
public static func createPreKeys() {
|
||||
// We don't generate PreKeyRecords here.
|
||||
// We don't generate new pre keys here like Signal does.
|
||||
// This is because we need the records to be linked to a contact since we don't have a central server.
|
||||
// It's done automatically when we generate a pre key bundle to send to a contact (`generatePreKeyBundleForContact:`).
|
||||
// You can use `getOrCreatePreKeyForContact:` to generate one if needed.
|
||||
// It's done automatically when we generate a pre key bundle to send to a contact (generatePreKeyBundleForContact:).
|
||||
// You can use getOrCreatePreKeyForContact: to generate one if needed.
|
||||
let signedPreKeyRecord = storage.generateRandomSignedRecord()
|
||||
signedPreKeyRecord.markAsAcceptedByService()
|
||||
storage.storeSignedPreKey(signedPreKeyRecord.id, signedPreKeyRecord: signedPreKeyRecord)
|
||||
|
@ -36,6 +36,10 @@ public final class SessionManagementProtocol : NSObject {
|
|||
|
||||
@objc(refreshSignedPreKey)
|
||||
public static func refreshSignedPreKey() {
|
||||
// We don't generate new pre keys here like Signal does.
|
||||
// This is because we need the records to be linked to a contact since we don't have a central server.
|
||||
// It's done automatically when we generate a pre key bundle to send to a contact (generatePreKeyBundleForContact:).
|
||||
// You can use getOrCreatePreKeyForContact: to generate one if needed.
|
||||
guard storage.currentSignedPrekeyId() == nil else {
|
||||
print("[Loki] Skipping pre key refresh; using existing signed pre key.")
|
||||
return
|
||||
|
@ -51,6 +55,8 @@ public final class SessionManagementProtocol : NSObject {
|
|||
|
||||
@objc(rotateSignedPreKey)
|
||||
public static func rotateSignedPreKey() {
|
||||
// This is identical to what Signal does, except that it doesn't upload the signed pre key
|
||||
// to a server.
|
||||
let signedPreKeyRecord = storage.generateRandomSignedRecord()
|
||||
signedPreKeyRecord.markAsAcceptedByService()
|
||||
storage.storeSignedPreKey(signedPreKeyRecord.id, signedPreKeyRecord: signedPreKeyRecord)
|
||||
|
|
|
@ -97,6 +97,8 @@ public final class SessionProtocol : NSObject {
|
|||
}
|
||||
|
||||
// MARK: Typing Indicators
|
||||
/// Invoked only if typing indicators are enabled. Provides an opportunity to not
|
||||
/// send them if certain conditions are met.
|
||||
@objc(shouldSendTypingIndicatorForThread:)
|
||||
public static func shouldSendTypingIndicator(for thread: TSThread) -> Bool {
|
||||
return !thread.isGroupThread() && !isMessageNoteToSelf(thread)
|
||||
|
@ -109,7 +111,9 @@ public final class SessionProtocol : NSObject {
|
|||
return !isMessageNoteToSelf(thread) && !thread.isGroupThread()
|
||||
}
|
||||
|
||||
// TODO: Not sure how these two relate
|
||||
// TODO: Not sure how these two relate. EDIT: I think the one below is used to block delivery receipts. That means that
|
||||
// right now we do send delivery receipts in note to self, but not read receipts. Other than that their behavior should
|
||||
// be identical. Should we just not send any kind of receipt in note to self?
|
||||
|
||||
// Used from OWSOutgoingReceiptManager
|
||||
@objc(shouldSendReceiptForThread:)
|
||||
|
|
|
@ -1584,7 +1584,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
[incomingMessage saveWithTransaction:transaction];
|
||||
|
||||
// Loki: Remove any old incoming messages
|
||||
// Loki: Remove any old incoming friend requests
|
||||
if (incomingMessage.isFriendRequest) {
|
||||
[thread removeOldIncomingFriendRequestMessagesIfNeededWithTransaction:transaction];
|
||||
}
|
||||
|
|
|
@ -1254,7 +1254,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
}) retainUntilComplete];
|
||||
}
|
||||
})
|
||||
.catchOn(OWSDispatch.sendingQueue, ^(NSError *error) { // The snode is unreachable
|
||||
.catchOn(OWSDispatch.sendingQueue, ^(NSError *error) {
|
||||
handleError(error);
|
||||
}) retainUntilComplete];
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ NSString *const kSessionStoreDBConnectionKey = @"kSessionStoreDBConnectionKey";
|
|||
OWSAssertDebug(contactIdentifier.length > 0);
|
||||
OWSAssertDebug(deviceId >= 0);
|
||||
OWSAssertDebug([protocolContext isKindOfClass:[YapDatabaseReadWriteTransaction class]]);
|
||||
// TODO: Needs a comment from Ryan
|
||||
// FIXME: This needs a comment from Ryan explaining why it's necessary (it has to do with push notifications)
|
||||
if (!CurrentAppContext().isMainApp) { return; }
|
||||
|
||||
YapDatabaseReadWriteTransaction *transaction = protocolContext;
|
||||
|
|
|
@ -21,7 +21,7 @@ static void *kNSError_MessageSender_IsFatal = &kNSError_MessageSender_IsFatal;
|
|||
{
|
||||
NSNumber *value = objc_getAssociatedObject(self, kNSError_MessageSender_IsRetryable);
|
||||
// This value should always be set for all errors by the time OWSSendMessageOperation
|
||||
// queries it's value. If not, default to retrying in production.
|
||||
// queries it's value. If not, default to retrying in production.
|
||||
return value ? [value boolValue] : YES;
|
||||
}
|
||||
|
||||
|
|
|
@ -322,8 +322,7 @@ public class TypingIndicatorsImpl: NSObject, TypingIndicators {
|
|||
guard delegate.areTypingIndicatorsEnabled() else {
|
||||
return
|
||||
}
|
||||
|
||||
// Loki: Don't send typing indicators in group or note to self threads
|
||||
|
||||
if !SessionProtocol.shouldSendTypingIndicator(for: thread) { return }
|
||||
|
||||
let message = TypingIndicatorMessage(thread: thread, action: action)
|
||||
|
|
|
@ -39,7 +39,6 @@ class OWSUDManagerTest: SSKBaseTestSwift {
|
|||
// MARK: registration
|
||||
let aliceRecipientId = "+13213214321"
|
||||
|
||||
/*
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
|
@ -62,7 +61,6 @@ class OWSUDManagerTest: SSKBaseTestSwift {
|
|||
|
||||
udManager.setSenderCertificate(try! senderCertificate.serialized())
|
||||
}
|
||||
*/
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
|
|
Loading…
Reference in a new issue