|
|
@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
[[TSStorageManager sharedManager] printAllSessions];
|
|
|
|
[[TSStorageManager sharedManager] printAllSessions];
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}],
|
|
|
|
}],
|
|
|
|
[OWSTableItem itemWithTitle:@"Toggle Key Change (Contact Thread Only)"
|
|
|
|
[OWSTableItem itemWithTitle:@"Toggle Key Change"
|
|
|
|
actionBlock:^{
|
|
|
|
actionBlock:^{
|
|
|
|
DDLogError(@"Flipping identity Key. Flip again to return.");
|
|
|
|
DDLogError(@"Flipping identity Key. Flip again to return.");
|
|
|
|
|
|
|
|
|
|
|
@ -45,14 +45,18 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
OWSAssert(flippedKey.length == currentKey.length);
|
|
|
|
OWSAssert(flippedKey.length == currentKey.length);
|
|
|
|
[identityManager saveRemoteIdentity:flippedKey recipientId:recipientId];
|
|
|
|
[identityManager saveRemoteIdentity:flippedKey recipientId:recipientId];
|
|
|
|
}],
|
|
|
|
}],
|
|
|
|
[OWSTableItem itemWithTitle:@"Delete session (Contact Thread Only)"
|
|
|
|
[OWSTableItem itemWithTitle:@"Set Verification State"
|
|
|
|
|
|
|
|
actionBlock:^{
|
|
|
|
|
|
|
|
[self presentVerificationStatePickerForContactThread:contactThread];
|
|
|
|
|
|
|
|
}],
|
|
|
|
|
|
|
|
[OWSTableItem itemWithTitle:@"Delete session"
|
|
|
|
actionBlock:^{
|
|
|
|
actionBlock:^{
|
|
|
|
dispatch_async([OWSDispatch sessionStoreQueue], ^{
|
|
|
|
dispatch_async([OWSDispatch sessionStoreQueue], ^{
|
|
|
|
[[TSStorageManager sharedManager]
|
|
|
|
[[TSStorageManager sharedManager]
|
|
|
|
deleteAllSessionsForContact:contactThread.contactIdentifier];
|
|
|
|
deleteAllSessionsForContact:contactThread.contactIdentifier];
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}],
|
|
|
|
}],
|
|
|
|
[OWSTableItem itemWithTitle:@"Send session reset (Contact Thread Only)"
|
|
|
|
[OWSTableItem itemWithTitle:@"Send session reset"
|
|
|
|
actionBlock:^{
|
|
|
|
actionBlock:^{
|
|
|
|
[OWSSessionResetJob
|
|
|
|
[OWSSessionResetJob
|
|
|
|
runWithContactThread:contactThread
|
|
|
|
runWithContactThread:contactThread
|
|
|
@ -62,6 +66,68 @@ 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
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return [NSString stringWithFormat:@"[%@]", self.class];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (NSString *)tag
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return self.class.tag;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|
|
|
|
NS_ASSUME_NONNULL_END
|
|
|
|