assistant: add done button on phonepad

This commit is contained in:
Gautier Pelloux-Prayer 2016-08-30 11:08:34 +02:00
parent 676b35c363
commit 1e765d26fb
3 changed files with 43 additions and 11 deletions

View file

@ -18,7 +18,20 @@
- (void)viewDidLoad {
[super viewDidLoad];
[_activationCodeField addDoneButton];
// every UITextField subviews with phone keyboard must be tweaked to have a done button
[self addDoneButtonRecursivelyInView:self.view];
}
- (void)addDoneButtonRecursivelyInView:(UIView *)subview {
for (UIView *child in [subview subviews]) {
if ([child isKindOfClass:UITextField.class]) {
UITextField *tf = (UITextField *)child;
if (tf.keyboardType == UIKeyboardTypePhonePad || tf.keyboardType == UIKeyboardTypeNumberPad) {
[tf addDoneButton];
}
}
[self addDoneButtonRecursivelyInView:child];
}
}
- (void)viewDidAppear:(BOOL)animated {

View file

@ -392,17 +392,21 @@ static UICompositeViewDescription *compositeDescription = nil;
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]) {
[self addDoneButtonRecursivelyInView:self.view];
[self prepareErrorLabels];
}
- (void)addDoneButtonRecursivelyInView:(UIView *)subview {
for (UIView *child in [subview subviews]) {
if ([child isKindOfClass:UITextField.class]) {
UITextField *tf = (UITextField *)child;
if (tf.keyboardType == UIKeyboardTypePhonePad || tf.keyboardType == UIKeyboardTypeNumberPad) {
[tf addDoneButton];
}
}
[self addDoneButtonRecursivelyInView:child];
}
[self prepareErrorLabels];
}
- (void)fillDefaultValues {

View file

@ -34,6 +34,10 @@
// remove separators between empty items, cf
// http://stackoverflow.com/questions/1633966/can-i-force-a-uitableview-to-hide-the-separator-between-empty-cells
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
_sideMenuEntries = [[NSMutableArray alloc] init];
@ -43,6 +47,16 @@
[PhoneMainView.instance
changeCurrentView:AssistantView.compositeViewDescription];
}]];
BOOL mustLink = ([LinphoneManager.instance lpConfigIntForKey:@"must_link_account_time"] > 0);
if (mustLink) {
[_sideMenuEntries
addObject:[[SideMenuEntry alloc] initWithTitle:NSLocalizedString(@"Link my account", nil)
tapBlock:^() {
[PhoneMainView.instance
changeCurrentView:AssistantLinkView.compositeViewDescription];
}]];
}
[_sideMenuEntries
addObject:[[SideMenuEntry alloc] initWithTitle:NSLocalizedString(@"Settings", nil)
tapBlock:^() {
@ -51,11 +65,12 @@
}]];
InAppProductsManager *iapm = LinphoneManager.instance.iapManager;
if (iapm.enabled){
[_sideMenuEntries addObject:[[SideMenuEntry alloc] initWithTitle:NSLocalizedString(@"Shop", nil)
tapBlock:^() {
[PhoneMainView.instance
changeCurrentView:ShopView.compositeViewDescription];
}]];
[_sideMenuEntries
addObject:[[SideMenuEntry alloc] initWithTitle:NSLocalizedString(@"Shop", nil)
tapBlock:^() {
[PhoneMainView.instance
changeCurrentView:ShopView.compositeViewDescription];
}]];
}
[_sideMenuEntries addObject:[[SideMenuEntry alloc] initWithTitle:NSLocalizedString(@"About", nil)
tapBlock:^() {