pull/1/head
Frederic Jacobs 10 years ago
parent 763d56c5d5
commit 212f0d4350

@ -3,6 +3,7 @@
#import "DiscardingLog.h"
#import "HostNameEndPoint.h"
#import "PhoneManager.h"
#import "PhoneNumberUtil.h"
#import "RecentCallManager.h"
#import "PhoneNumberDirectoryFilterManager.h"
@ -48,6 +49,16 @@ static unsigned char DH3K_PRIME[]={
//ErrorHandlerBlock errorDiscarder = ^(id error, id relatedInfo, bool causedTermination) {};
ErrorHandlerBlock errorNoter = ^(id error, id relatedInfo, bool causedTermination) {DDLogError(@"%@: %@, %d", error, relatedInfo, causedTermination); };
NSString *defaultRegion;
#if TARGET_OS_IPHONE
defaultRegion = [[PhoneNumberUtil sharedInstance].nbPhoneNumberUtil countryCodeByCarrier];
#else
defaultRegion = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode];
#endif
NSAssert([defaultRegion isKindOfClass:[NSString class]], @"");
return [Environment environmentWithLogging:logging
andErrorNoter:errorNoter
andServerPort:31337
@ -55,7 +66,7 @@ static unsigned char DH3K_PRIME[]={
andDefaultRelayName:@"relay"
andRelayServerHostNameSuffix:@"whispersystems.org"
andCertificate:[Certificate certificateFromResourcePath:@"redphone" ofType:@"cer"]
andCurrentRegionCodeForPhoneNumbers:[NSLocale.currentLocale objectForKey:NSLocaleCountryCode]
andCurrentRegionCodeForPhoneNumbers:defaultRegion
andSupportedKeyAgreementProtocols:[self supportedKeyAgreementProtocols]
andPhoneManager:[PhoneManager phoneManagerWithErrorHandler:errorNoter]
andRecentCallManager:[RecentCallManager new]

@ -461,16 +461,11 @@ typedef enum : NSUInteger {
ABRecordSetValue(aContact, kABPersonPhoneProperty, phone, &anError);
CFRelease(phone);
if (anError) {
aContact = nil;
if (!anError && aContact) {
view.displayedPerson = aContact; // Assume person is already defined.
view.allowsAddingToAddressBook = YES;
[self.navigationController pushViewController:view animated:YES];
}
view.displayedPerson = aContact; // Assume person is already defined.
view.allowsAddingToAddressBook = YES;
[self.navigationController pushViewController:view animated:YES];
CFRelease(aContact);
}
}

@ -132,21 +132,16 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
CFErrorRef anError = NULL;
ABMultiValueRef phone = ABMultiValueCreateMutable(kABMultiStringPropertyType);
ABMultiValueAddValueAndLabel(phone, (__bridge CFTypeRef)[self.tableView cellForRowAtIndexPath:indexPath].textLabel.text, kABPersonPhoneMainLabel, NULL);
ABRecordSetValue(aContact, kABPersonPhoneProperty, phone, &anError);
CFRelease(phone);
if (anError) {
aContact = nil;
if (!anError && aContact) {
view.displayedPerson = aContact; // Assume person is already defined.
view.allowsAddingToAddressBook = YES;
[self.navigationController pushViewController:view animated:YES];
}
view.displayedPerson = aContact; // Assume person is already defined.
view.allowsAddingToAddressBook = YES;
[self.navigationController pushViewController:view animated:YES];
CFRelease(aContact);
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];

Loading…
Cancel
Save