presence: fix phone subscription

This commit is contained in:
Gautier Pelloux-Prayer 2016-08-30 10:29:18 +02:00
parent 3121b1e7b7
commit 676b35c363
7 changed files with 40 additions and 4 deletions

View file

@ -10,11 +10,17 @@
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import "AssistantLinkView.h"
#import "UITextField+DoneButton.h"
@implementation AssistantLinkView {
LinphoneAccountCreator *account_creator;
}
- (void)viewDidLoad {
[super viewDidLoad];
[_activationCodeField addDoneButton];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];

View file

@ -391,6 +391,16 @@ static UICompositeViewDescription *compositeDescription = nil;
countryButton.layer.cornerRadius = 4.f;
countryButton.layer.masksToBounds = YES;
// every UITextField subviews with phone keyboard must be tweaked to have a done button
for (UIView *child in [view subviews]) {
if ([child.class isSubclassOfClass:UITextField.class]) {
UITextField *tf = (UITextField *)child;
if (tf.keyboardType == UIKeyboardTypePhonePad || tf.keyboardType == UIKeyboardTypeNumberPad) {
[tf addDoneButton];
}
}
}
[self prepareErrorLabels];
}

View file

@ -165,6 +165,11 @@ static UICompositeViewDescription *compositeDescription = nil;
_padView.hidden = !IPAD && UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[LinphoneManager.instance shouldPresentLinkPopup];
}
#pragma mark - Event Functions
- (void)callUpdateEvent:(NSNotification *)notif {

View file

@ -186,6 +186,8 @@ typedef struct _LinphoneManagerSounds {
+ (BOOL)isMyself:(const LinphoneAddress *)addr;
- (void)shouldPresentLinkPopup;
@property (readonly) BOOL isTesting;
@property(readonly, strong) FastAddressBook *fastAddressBook;
@property Connectivity connectivity;

View file

@ -1446,8 +1446,6 @@ static LinphoneCoreVTable linphonec_vtable = {
[self enableProxyPublish:YES];
[self shouldPresentLinkPopup];
LOGI(@"Linphone [%s] started on [%s]", linphone_core_get_version(), [[UIDevice currentDevice].model UTF8String]);
// Post event
@ -1538,7 +1536,6 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat
}
- (void)shouldPresentLinkPopup {
LOGW(@"hello!");
NSDate *nextTime =
[NSDate dateWithTimeIntervalSince1970:[self lpConfigIntForKey:@"must_link_account_time" withDefault:1]];
NSDate *now = [NSDate date];

View file

@ -461,6 +461,22 @@
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
LinphoneAddress *addr = linphone_proxy_config_normalize_sip_uri(cfg, value.UTF8String);
// first try to find a friend with the given address
Contact *c = [FastAddressBook getContactWithAddress:addr];
if (c && c.friend) {
LinphoneFriend *f = c.friend;
const LinphonePresenceModel *m =
f ? linphone_friend_get_presence_model_for_uri_or_tel(f, value.UTF8String) : NULL;
const char *contact = m ? linphone_presence_model_get_contact(m) : NULL;
if (contact) {
LinphoneAddress *contact_addr = linphone_address_new(contact);
if (contact_addr) {
linphone_address_destroy(addr);
return contact_addr;
}
}
}
// since user wants to escape plus, we assume it expects to have phone numbers by default
if (addr && cfg && linphone_proxy_config_get_dial_escape_plus(cfg)) {
char *phone = linphone_proxy_config_normalize_phone_number(cfg, value.UTF8String);

@ -1 +1 @@
Subproject commit 9cbccee8de5686fcfed41717429c4130d13d7ee8
Subproject commit ee50e0e3c1863bd7924cdcf3f7fd2eb34c886195