Additional call anonymous logging

This commit is contained in:
Frederic Jacobs 2014-07-03 18:45:06 +02:00
parent 61264a480d
commit 407c64f6e1
5 changed files with 14 additions and 11 deletions

View File

@ -84,9 +84,7 @@
// start register for apn id
futureApnIdSource = [FutureSource new];
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge
| UIRemoteNotificationTypeSound
| UIRemoteNotificationTypeAlert)];
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound| UIRemoteNotificationTypeAlert)];
CategorizingLogger* logger = [CategorizingLogger categorizingLogger];
[logger addLoggingCallback:^(NSString *category, id details, NSUInteger index) {}];
@ -121,21 +119,21 @@
}
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
DDLogDebug(@"Device registered for push");
[futureApnIdSource trySetResult:deviceToken];
}
- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error {
DDLogError(@"Failed to register for push notifications: %@", error);
[futureApnIdSource trySetFailure:error];
}
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
id<ConditionLogger> apnLogger = [[Environment logging] getConditionLoggerForSender:application];
ResponderSessionDescriptor* call;
@try {
call = [ResponderSessionDescriptor responderSessionDescriptorFromEncryptedRemoteNotification:userInfo];
[apnLogger logNotice:[NSString stringWithFormat:@"Received remote notification. Parsed session descriptor: %@. Notication: %@.", call, userInfo]];
DDLogDebug(@"Received remote notification. Parsed session descriptor: %@.", call);
} @catch (OperationFailed* ex) {
[apnLogger logWarning:[NSString stringWithFormat:@"Error parsing remote notification. Error: %@. Notifaction: %@.", ex, userInfo]];
DDLogError(@"Error parsing remote notification. Error: %@.", ex);
return;
}
@ -145,6 +143,8 @@
-(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
if([self.notificationTracker shouldProcessNotification:userInfo]){
[self application:application didReceiveRemoteNotification:userInfo];
} else{
DDLogDebug(@"Push already processed. Skipping.");
}
completionHandler(UIBackgroundFetchResultNewData);
}

View File

@ -27,7 +27,7 @@
NSData* data = [self getIdForNotification:notification];
[_witnessedNotifications insertObject:data atIndex:0];
while( MAX_NOTIFICATIONS_TO_TRACK < [_witnessedNotifications count]){
while(MAX_NOTIFICATIONS_TO_TRACK < [_witnessedNotifications count]){
[_witnessedNotifications removeLastObject];
}
}

View File

@ -59,6 +59,7 @@
NSData* encryptedPayload = [self verifyAndRemoveMacFromRemoteNotifcationData:authenticatedPayload];
NSData* payload = [self decryptRemoteNotificationData:encryptedPayload];
InitiateSignal* parsedPayload = [InitiateSignal parseFromData:payload];
in_port_t maxPort = (in_port_t)-1;
@ -76,6 +77,8 @@
NSString* relayServerName = parsedPayload.serverName;
PhoneNumber* phoneNumber = [PhoneNumber phoneNumberFromE164:parsedPayload.initiator];
DDLogDebug(@"Initiating call with session descriptor: %i UDP-Port:%hu sessionID:%lld, relayServerName:%@", interopVersion, relayUdpPort, sessionId, relayServerName);
return [ResponderSessionDescriptor responderSessionDescriptorWithInteropVersion:interopVersion
andRelayUdpPort:relayUdpPort
andSessionId:sessionId

View File

@ -5,7 +5,7 @@
/// 'require(X)' is used to indicate parameter-related preconditions that callers must satisfy.
/// Failure to satisfy indicates a bug in the caller.
#define require(expr) if (!(expr)) [BadArgument raise:[NSString stringWithFormat:@"require %@ (in %s at line %d)", (@#expr), __FILE__, __LINE__]]
#define require(expr) if (!(expr)){ NSString *reason = [NSString stringWithFormat:@"require %@ (in %s at line %d)", (@#expr), __FILE__, __LINE__]; DDLogError(@"%@", reason);[BadArgument raise:reason];};
/// 'requireState(X)' is used to indicate callee-state-related preconditions that callers must satisfy.
/// Failure to satisfy indicates a stateful bug in either the caller or the callee.
@ -14,7 +14,7 @@
/// 'checkOperation(X)' is used to throw exceptions if operations fail.
/// Failure does not indicate a bug.
/// Methods may throw these exceptions for callers to catch as a 'returned error' result.
#define checkOperation(expr) if (!(expr)) [OperationFailed raise:[NSString stringWithFormat:@"Operation failed. Expected: %@(in %s at line %d)", (@#expr),__FILE__,__LINE__]]
#define checkOperation(expr) if (!(expr)){ NSString *reason = [NSString stringWithFormat:@"Operation failed. Expected: %@(in %s at line %d)", (@#expr),__FILE__,__LINE__];[OperationFailed raise:reason];}
/// 'checkOperationDescribe(X, Desc)' is used to throw exceptions if operations fail, and describe the problem.
/// Failure does not indicate a bug.

View File

@ -191,7 +191,7 @@
[_challengeTextField resignFirstResponder];
_challengeButton.enabled = NO;
[_challengeActivityIndicator startAnimating];
HttpRequest *verifyRequest = [HttpRequest httpRequestToVerifyAccessToPhoneNumberWithChallenge:_challengeTextField.text];
Future *futureDone = [HttpManager asyncOkResponseFromMasterServer:verifyRequest
unlessCancelled:nil