Supporting alert on unregistered users + bug fixes.

pull/1/head
Frederic Jacobs 11 years ago
parent 35a2762c5f
commit d4f5675a58

@ -1074,9 +1074,6 @@
D24B5BD4169F568C00681372 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = ../../../../../../System/Library/Frameworks/AudioToolbox.framework; sourceTree = "<group>"; };
D2AEACDB16C426DA00C364C0 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
E108ED13187E34FD0045AEA3 /* iTunesArtwork@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iTunesArtwork@2x.png"; sourceTree = "<group>"; };
E1370BDA18A066F600826894 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
E1370BDB18A066F600826894 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
E1370BDC18A066F600826894 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
E16E5BE818AAC40200B7C403 /* EC25KeyAgreementParticipant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EC25KeyAgreementParticipant.h; sourceTree = "<group>"; };
E16E5BE918AAC40200B7C403 /* EC25KeyAgreementParticipant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EC25KeyAgreementParticipant.m; sourceTree = "<group>"; };
E16E5BEA18AAC40200B7C403 /* EC25KeyAgreementProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EC25KeyAgreementProtocol.h; sourceTree = "<group>"; };
@ -2462,9 +2459,6 @@
children = (
B6B6C3C419193F5B00C0B76B /* Translations */,
E18AB40618A05754001A532A /* AudioFiles */,
E1370BDA18A066F600826894 /* Default-568h@2x.png */,
E1370BDB18A066F600826894 /* Default.png */,
E1370BDC18A066F600826894 /* Default@2x.png */,
E18AB3F318A05734001A532A /* Icons */,
E108ED13187E34FD0045AEA3 /* iTunesArtwork@2x.png */,
D221A099169C9E5E00537ABF /* main.m */,

@ -12,6 +12,7 @@
#import "PriorityQueue.h"
#import "RecentCallManager.h"
#import "Release.h"
#import "SignalsViewController.h"
#import "TSSocketManager.h"
#import "TSStorageManager.h"
#import "TSAccountManager.h"
@ -136,9 +137,10 @@
}
}];
}
[self.window.rootViewController dismissViewControllerAnimated:NO completion:nil];
[self.window.rootViewController presentViewController:callViewController animated:NO completion:nil];
SignalsViewController *vc = [[Environment getCurrent] signalsViewController];
[vc dismissViewControllerAnimated:NO completion:nil];
[vc presentViewController:callViewController animated:NO completion:nil];
} onThread:NSThread.mainThread untilCancelled:nil];
[TSSocketManager becomeActive];

@ -28,6 +28,8 @@ typedef NS_ENUM(int32_t, TSErrorMessageType){
+ (instancetype)untrustedKeyWithSignal:(IncomingPushMessageSignal*)preKeyMessage withTransaction:(YapDatabaseReadWriteTransaction*)transaction;
+ (instancetype)missingSessionWithSignal:(IncomingPushMessageSignal*)preKeyMessage withTransaction:(YapDatabaseReadWriteTransaction*)transaction;
+ (instancetype)userNotRegisteredErrorMessageInThread:(TSThread*)thread;
- (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(TSThread *)thread failedMessageType:(TSErrorMessageType)errorMessageType;
- (NSData*)retryBody;

@ -21,6 +21,10 @@
return self;
}
+ (instancetype)userNotRegisteredErrorMessageInThread:(TSThread*)thread{
return [[self alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] inThread:thread];
}
+ (instancetype)invalidVersionWithSignal:(IncomingPushMessageSignal*)preKeyMessage withTransaction:(YapDatabaseReadWriteTransaction*)transaction{
TSContactThread *contactThread = [TSContactThread threadWithContactId:preKeyMessage.source transaction:transaction];
TSErrorMessage *errorMessage = [[self alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] inThread:contactThread failedMessageType:TSErrorMessageInvalidVersion];

@ -28,6 +28,8 @@
#import "TSSubmitMessageRequest.h"
#import "TSRecipientPrekeyRequest.h"
#import "TSErrorMessage.h"
#import "TSContactThread.h"
#import "TSGroupThread.h"
#import "TSRecipient.h"
@ -88,11 +90,17 @@ dispatch_queue_t sendingQueue() {
} failure:^(NSURLSessionDataTask *task, NSError *error) {
NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response;
long statuscode = response.statusCode;
switch (statuscode) {
case 404:
// Recipient not found
case 404:{
DDLogError(@"Recipient not found");
[self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[recipient removeWithTransaction:transaction];
[message setMessageState:TSOutgoingMessageStateUnsent];
[[TSErrorMessage userNotRegisteredErrorMessageInThread:thread] saveWithTransaction:transaction];
}];
break;
}
case 409:
// Mismatched devices
DDLogError(@"Missing some devices");
@ -102,14 +110,16 @@ dispatch_queue_t sendingQueue() {
DDLogWarn(@"Stale devices");
break;
default:
[self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[message setMessageState:TSOutgoingMessageStateUnsent];
[message saveWithTransaction:transaction];
}];
[self sendMessage:message toRecipient:recipient inThread:thread withAttemps:remainingAttempts];
break;
}
}];
}];
} else{
[self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[message setMessageState:TSOutgoingMessageStateUnsent];
[message saveWithTransaction:transaction];
}];
}
}

@ -30,8 +30,9 @@ typedef enum {
#define textSecureHTTPTimeOut 10
#define textSecureWebSocketAPI @"wss://textsecure-service.whispersystems.org/v1/websocket/"
#define textSecureServerURL @"https://textsecure-service.whispersystems.org/"
//#define textSecureWebSocketAPI @"wss://textsecure-service-staging.whispersystems.org/v1/websocket/"
//#define textSecureServerURL @"https://textsecure-service-staging.whispersystems.org/"
#define textSecureGeneralAPI @"v1"

@ -50,7 +50,6 @@
[Environment.getCurrent.phoneDirectoryManager forceUpdate];
[self performSegueWithIdentifier:@"verifiedSegue" sender:self];
} failure:^(NSError *error) {
// TODO: Unlock UI
NSLog(@"Failed to register");
[self showAlertForError:error];
[_challengeButton setEnabled:YES];

@ -799,7 +799,6 @@
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="callButtonTapped" destination="-1" eventType="touchUpInside" id="gf3-h4-p0f"/>
<action selector="cancelButtonTapped:" destination="-1" eventType="touchUpInside" id="gn3-TB-hhv"/>
</connections>
</button>

Loading…
Cancel
Save