|
|
|
@ -45,66 +45,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
OWSAssert(flippedKey.length == currentKey.length);
|
|
|
|
|
[identityManager saveRemoteIdentity:flippedKey recipientId:recipientId];
|
|
|
|
|
}],
|
|
|
|
|
[OWSTableItem
|
|
|
|
|
itemWithTitle:@"Set Verification State"
|
|
|
|
|
actionBlock:^{
|
|
|
|
|
DDLogError(@"%@ Choosing verification state.", self.tag);
|
|
|
|
|
|
|
|
|
|
NSString *title = [NSString
|
|
|
|
|
stringWithFormat:@"Choose verification state for %@", contactThread.name];
|
|
|
|
|
UIAlertController *alertController =
|
|
|
|
|
[UIAlertController alertControllerWithTitle:title
|
|
|
|
|
message:nil
|
|
|
|
|
preferredStyle:UIAlertControllerStyleActionSheet];
|
|
|
|
|
|
|
|
|
|
NSString *recipientId = [contactThread contactIdentifier];
|
|
|
|
|
OWSIdentityManager *identityManger = [OWSIdentityManager sharedManager];
|
|
|
|
|
|
|
|
|
|
[alertController
|
|
|
|
|
addAction:[UIAlertAction
|
|
|
|
|
actionWithTitle:@"Default"
|
|
|
|
|
style:UIAlertActionStyleDefault
|
|
|
|
|
handler:^(UIAlertAction *_Nonnull action) {
|
|
|
|
|
NSData *identityKey = [identityManger
|
|
|
|
|
identityKeyForRecipientId:recipientId];
|
|
|
|
|
[[OWSIdentityManager sharedManager]
|
|
|
|
|
setVerificationState:OWSVerificationStateDefault
|
|
|
|
|
identityKey:identityKey
|
|
|
|
|
recipientId:recipientId
|
|
|
|
|
sendSyncMessage:NO];
|
|
|
|
|
}]];
|
|
|
|
|
[alertController
|
|
|
|
|
addAction:[UIAlertAction
|
|
|
|
|
actionWithTitle:@"Verified"
|
|
|
|
|
style:UIAlertActionStyleDefault
|
|
|
|
|
handler:^(UIAlertAction *_Nonnull action) {
|
|
|
|
|
NSData *identityKey = [identityManger
|
|
|
|
|
identityKeyForRecipientId:recipientId];
|
|
|
|
|
[[OWSIdentityManager sharedManager]
|
|
|
|
|
setVerificationState:OWSVerificationStateVerified
|
|
|
|
|
identityKey:identityKey
|
|
|
|
|
recipientId:recipientId
|
|
|
|
|
sendSyncMessage:NO];
|
|
|
|
|
}]];
|
|
|
|
|
[alertController
|
|
|
|
|
addAction:[UIAlertAction actionWithTitle:@"No Longer Verified"
|
|
|
|
|
style:UIAlertActionStyleDefault
|
|
|
|
|
handler:^(UIAlertAction *_Nonnull action) {
|
|
|
|
|
NSData *identityKey = [identityManger
|
|
|
|
|
identityKeyForRecipientId:recipientId];
|
|
|
|
|
[[OWSIdentityManager sharedManager]
|
|
|
|
|
setVerificationState:
|
|
|
|
|
OWSVerificationStateNoLongerVerified
|
|
|
|
|
identityKey:identityKey
|
|
|
|
|
recipientId:recipientId
|
|
|
|
|
sendSyncMessage:NO];
|
|
|
|
|
}]];
|
|
|
|
|
|
|
|
|
|
[[UIApplication sharedApplication].frontmostViewController
|
|
|
|
|
presentViewController:alertController
|
|
|
|
|
animated:YES
|
|
|
|
|
completion:nil];
|
|
|
|
|
}],
|
|
|
|
|
[OWSTableItem itemWithTitle:@"Set Verification State"
|
|
|
|
|
actionBlock:^{
|
|
|
|
|
[self presentVerificationStatePickerForContactThread:contactThread];
|
|
|
|
|
}],
|
|
|
|
|
[OWSTableItem itemWithTitle:@"Delete session"
|
|
|
|
|
actionBlock:^{
|
|
|
|
|
dispatch_async([OWSDispatch sessionStoreQueue], ^{
|
|
|
|
@ -122,6 +66,56 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ (void)presentVerificationStatePickerForContactThread:(TSContactThread *)contactThread
|
|
|
|
|
{
|
|
|
|
|
DDLogError(@"%@ Choosing verification state.", self.tag);
|
|
|
|
|
|
|
|
|
|
NSString *title = [NSString stringWithFormat:@"Choose verification state for %@", contactThread.name];
|
|
|
|
|
UIAlertController *alertController =
|
|
|
|
|
[UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
|
|
|
|
|
|
|
|
|
NSString *recipientId = [contactThread contactIdentifier];
|
|
|
|
|
OWSIdentityManager *identityManger = [OWSIdentityManager sharedManager];
|
|
|
|
|
|
|
|
|
|
[alertController addAction:[UIAlertAction actionWithTitle:@"Default"
|
|
|
|
|
style:UIAlertActionStyleDefault
|
|
|
|
|
handler:^(UIAlertAction *_Nonnull action) {
|
|
|
|
|
NSData *identityKey =
|
|
|
|
|
[identityManger identityKeyForRecipientId:recipientId];
|
|
|
|
|
[[OWSIdentityManager sharedManager]
|
|
|
|
|
setVerificationState:OWSVerificationStateDefault
|
|
|
|
|
identityKey:identityKey
|
|
|
|
|
recipientId:recipientId
|
|
|
|
|
sendSyncMessage:NO];
|
|
|
|
|
}]];
|
|
|
|
|
[alertController addAction:[UIAlertAction actionWithTitle:@"Verified"
|
|
|
|
|
style:UIAlertActionStyleDefault
|
|
|
|
|
handler:^(UIAlertAction *_Nonnull action) {
|
|
|
|
|
NSData *identityKey =
|
|
|
|
|
[identityManger identityKeyForRecipientId:recipientId];
|
|
|
|
|
[[OWSIdentityManager sharedManager]
|
|
|
|
|
setVerificationState:OWSVerificationStateVerified
|
|
|
|
|
identityKey:identityKey
|
|
|
|
|
recipientId:recipientId
|
|
|
|
|
sendSyncMessage:NO];
|
|
|
|
|
}]];
|
|
|
|
|
[alertController addAction:[UIAlertAction actionWithTitle:@"No Longer Verified"
|
|
|
|
|
style:UIAlertActionStyleDefault
|
|
|
|
|
handler:^(UIAlertAction *_Nonnull action) {
|
|
|
|
|
NSData *identityKey =
|
|
|
|
|
[identityManger identityKeyForRecipientId:recipientId];
|
|
|
|
|
[[OWSIdentityManager sharedManager]
|
|
|
|
|
setVerificationState:OWSVerificationStateNoLongerVerified
|
|
|
|
|
identityKey:identityKey
|
|
|
|
|
recipientId:recipientId
|
|
|
|
|
sendSyncMessage:NO];
|
|
|
|
|
}]];
|
|
|
|
|
|
|
|
|
|
[[UIApplication sharedApplication].frontmostViewController presentViewController:alertController
|
|
|
|
|
animated:YES
|
|
|
|
|
completion:nil];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma mark - Logging
|
|
|
|
|
|
|
|
|
|
+ (NSString *)tag
|
|
|
|
|