mirror of https://github.com/oxen-io/session-ios
Merge branch 'mkirk/remove-verification-debug-ui'
commit
e039363873
@ -1,15 +0,0 @@
|
|||||||
//
|
|
||||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "DebugUIPage.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@class TSContactThread;
|
|
||||||
|
|
||||||
@interface DebugUIVerification : DebugUIPage
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
@ -1,85 +0,0 @@
|
|||||||
//
|
|
||||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "DebugUIVerification.h"
|
|
||||||
#import "DebugUIMessages.h"
|
|
||||||
#import "OWSTableViewController.h"
|
|
||||||
#import "Signal-Swift.h"
|
|
||||||
#import <SignalServiceKit/OWSIdentityManager.h>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@implementation DebugUIVerification
|
|
||||||
|
|
||||||
#pragma mark - Logging
|
|
||||||
|
|
||||||
+ (NSString *)tag
|
|
||||||
{
|
|
||||||
return [NSString stringWithFormat:@"[%@]", self.class];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *)tag
|
|
||||||
{
|
|
||||||
return self.class.tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Factory Methods
|
|
||||||
|
|
||||||
- (NSString *)name
|
|
||||||
{
|
|
||||||
return @"Verification";
|
|
||||||
}
|
|
||||||
|
|
||||||
- (nullable OWSTableSection *)sectionForThread:(nullable TSThread *)threadParameter
|
|
||||||
{
|
|
||||||
OWSAssert([threadParameter isKindOfClass:[TSContactThread class]]);
|
|
||||||
|
|
||||||
TSContactThread *thread = (TSContactThread *)threadParameter;
|
|
||||||
|
|
||||||
NSString *recipientId = thread.contactIdentifier;
|
|
||||||
OWSAssert(recipientId.length > 0);
|
|
||||||
|
|
||||||
return [OWSTableSection
|
|
||||||
sectionWithTitle:self.name
|
|
||||||
items:@[
|
|
||||||
[OWSTableItem itemWithTitle:@"Default"
|
|
||||||
actionBlock:^{
|
|
||||||
[DebugUIVerification setVerificationState:OWSVerificationStateDefault
|
|
||||||
recipientId:recipientId];
|
|
||||||
}],
|
|
||||||
[OWSTableItem itemWithTitle:@"Verified"
|
|
||||||
actionBlock:^{
|
|
||||||
[DebugUIVerification setVerificationState:OWSVerificationStateVerified
|
|
||||||
recipientId:recipientId];
|
|
||||||
}],
|
|
||||||
[OWSTableItem itemWithTitle:@"No Longer Verified"
|
|
||||||
actionBlock:^{
|
|
||||||
[DebugUIVerification
|
|
||||||
setVerificationState:OWSVerificationStateNoLongerVerified
|
|
||||||
recipientId:recipientId];
|
|
||||||
}],
|
|
||||||
]];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void)setVerificationState:(OWSVerificationState)verificationState recipientId:(NSString *)recipientId
|
|
||||||
{
|
|
||||||
OWSAssert(recipientId.length > 0);
|
|
||||||
|
|
||||||
OWSRecipientIdentity *_Nullable recipientIdentity =
|
|
||||||
[[OWSIdentityManager sharedManager] recipientIdentityForRecipientId:recipientId];
|
|
||||||
OWSAssert(recipientIdentity);
|
|
||||||
// By capturing the identity key when we enter these views, we prevent the edge case
|
|
||||||
// where the user verifies a key that we learned about while this view was open.
|
|
||||||
NSData *identityKey = recipientIdentity.identityKey;
|
|
||||||
OWSAssert(identityKey.length > 0);
|
|
||||||
|
|
||||||
[OWSIdentityManager.sharedManager setVerificationState:verificationState
|
|
||||||
identityKey:identityKey
|
|
||||||
recipientId:recipientId
|
|
||||||
isUserInitiatedChange:verificationState != OWSVerificationStateNoLongerVerified];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
Loading…
Reference in New Issue