From 73e702c188e1d59227ad5339e23ff25116f96207 Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Tue, 5 Mar 2019 13:39:37 +0100 Subject: [PATCH] add 'maybe later' button for link account --- Classes/AssistantLinkView.h | 6 +- Classes/AssistantLinkView.m | 18 ++++ Classes/Base.lproj/AssistantLinkView.xib | 107 ++++++++++++--------- Classes/fr.lproj/AssistantLinkView.strings | Bin 6746 -> 3678 bytes linphone.xcodeproj/project.pbxproj | 4 +- 5 files changed, 86 insertions(+), 49 deletions(-) diff --git a/Classes/AssistantLinkView.h b/Classes/AssistantLinkView.h index a97aea968..7fcdcac88 100644 --- a/Classes/AssistantLinkView.h +++ b/Classes/AssistantLinkView.h @@ -5,17 +5,18 @@ // Created by Gautier Pelloux-Prayer on 29/08/16. // // - #import "PhoneMainView.h" #import +#import "TPKeyboardAvoidingScrollView.h" @interface AssistantLinkView : UIViewController -@property(weak, nonatomic) IBOutlet UIView *linkAccountView; +@property(weak, nonatomic) IBOutlet TPKeyboardAvoidingScrollView *linkAccountView; @property(weak, nonatomic) IBOutlet UIView *activateSMSView; @property(weak, nonatomic) IBOutlet UIButton *countryButton; @property(weak, nonatomic) IBOutlet UITextField *countryCodeField; @property(weak, nonatomic) IBOutlet UITextField *activationCodeField; +@property (weak, nonatomic) IBOutlet UIRoundBorderedButton *maybeLaterButton; @property(weak, nonatomic) IBOutlet UIRoundBorderedButton *linkAccountButton; @property(weak, nonatomic) IBOutlet UIRoundBorderedButton *checkValidationButton; @property(weak, nonatomic) IBOutlet UIView *waitView; @@ -28,5 +29,6 @@ - (IBAction)onCountryClick:(id)sender; - (IBAction)onDialerClick:(id)sender; - (IBAction)onPhoneNumberDisclosureClick:(id)sender; +- (IBAction)onMaybeLater:(id)sender; @end diff --git a/Classes/AssistantLinkView.m b/Classes/AssistantLinkView.m index 06a1d7082..2a169c500 100644 --- a/Classes/AssistantLinkView.m +++ b/Classes/AssistantLinkView.m @@ -41,6 +41,7 @@ _linkAccountView.hidden = _activateSMSView.userInteractionEnabled = NO; _activateSMSView.hidden = _linkAccountView.userInteractionEnabled = YES; + [self fitScrollContentSize]; if (!account_creator) { account_creator = linphone_account_creator_new( @@ -103,6 +104,19 @@ [super viewDidDisappear:animated]; } +- (void)fitScrollContentSize { + // make view scrollable only if next button is too away + CGRect viewframe = _linkAccountView.frame; + if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) { + viewframe.size.height += 60; + } + [_linkAccountView setContentSize:viewframe.size]; +} + +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { + [self fitScrollContentSize]; +} + #pragma mark - UICompositeViewDelegate Functions static UICompositeViewDescription *compositeDescription = nil; @@ -280,6 +294,10 @@ void assistant_activate_phone_number_link(LinphoneAccountCreator *creator, Linph [self presentViewController:errView animated:YES completion:nil]; } +- (IBAction)onMaybeLater:(id)sender { + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; +} + #pragma mark - select country delegate - (void)didSelectCountry:(NSDictionary *)country { diff --git a/Classes/Base.lproj/AssistantLinkView.xib b/Classes/Base.lproj/AssistantLinkView.xib index 0b7830fd1..d206e13ab 100644 --- a/Classes/Base.lproj/AssistantLinkView.xib +++ b/Classes/Base.lproj/AssistantLinkView.xib @@ -1,21 +1,25 @@ - + + + + - + - + - + + @@ -27,19 +31,19 @@ - + - - + + - - + + - - - + @@ -129,15 +133,15 @@ - - + - + - - + + -