From e893f6189a4094bcdf1b4abe2f06691ef2658b3f Mon Sep 17 00:00:00 2001 From: "S. Kozyr" Date: Tue, 19 Mar 2024 23:16:02 +0200 Subject: [PATCH] [ios] Added blue color for link inside MWMOsmReauthAlert Signed-off-by: S. Kozyr --- data/strings/strings.txt | 14 ++++++++- .../Classes/CustomAlert/MWMOsmReauthAlert.h | 2 ++ .../Classes/CustomAlert/MWMOsmReauthAlert.mm | 24 +++++++++++++++ .../Classes/CustomAlert/MWMOsmReauthAlert.xib | 29 ++++++++++--------- 4 files changed, 55 insertions(+), 14 deletions(-) diff --git a/data/strings/strings.txt b/data/strings/strings.txt index 6277811af3..a560728f47 100644 --- a/data/strings/strings.txt +++ b/data/strings/strings.txt @@ -20312,11 +20312,23 @@ uk = Увійдить в OpenStreetMap [alert_reauth_message] - tags = android,ios + tags = android en = Please login to OpenStreetMap to automatically upload all your map edits. Learn more here. ru = Пожалуйста войдите в аккаунт OpenStreetMap.org, чтобы публиковать ваши изменения карты. Подробности по ссылке. uk = Будь ласка увійдіть в акаунт OpenStreetMap.org, щоб автоматично публікувати зміни до мапи. Подробиці за посиланням. + [alert_reauth_message_ios] + tags = ios + en = Please login to OpenStreetMap to automatically upload all your map edits. Learn more + ru = Пожалуйста войдите в аккаунт OpenStreetMap.org, чтобы публиковать ваши изменения карты. Подробности по + uk = Будь ласка увійдіть в акаунт OpenStreetMap.org, щоб автоматично публікувати зміни до мапи. Подробиці за + + [alert_reauth_link_text_ios] + tags = ios + en = here + ru = ссылке + uk = посиланням + [dialog_error_storage_title] tags = android en = Storage access problem diff --git a/iphone/Maps/Classes/CustomAlert/MWMOsmReauthAlert.h b/iphone/Maps/Classes/CustomAlert/MWMOsmReauthAlert.h index b536064bb7..39532d93de 100644 --- a/iphone/Maps/Classes/CustomAlert/MWMOsmReauthAlert.h +++ b/iphone/Maps/Classes/CustomAlert/MWMOsmReauthAlert.h @@ -4,4 +4,6 @@ + (instancetype)alert; +@property (nonatomic, retain) IBOutlet UITextView *messageLabel; + @end diff --git a/iphone/Maps/Classes/CustomAlert/MWMOsmReauthAlert.mm b/iphone/Maps/Classes/CustomAlert/MWMOsmReauthAlert.mm index be92af76d6..f532cc47f4 100644 --- a/iphone/Maps/Classes/CustomAlert/MWMOsmReauthAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/MWMOsmReauthAlert.mm @@ -12,9 +12,28 @@ static NSString * const kMap2OsmLoginSegue = @"Map2OsmLogin"; { MWMOsmReauthAlert * alert = [NSBundle.mainBundle loadNibNamed:[self className] owner:nil options:nil].firstObject; + + //[alert.messageLabel setScrollEnabled:NO]; + alert.messageLabel.attributedText = [self buildAlertMessage]; + UITapGestureRecognizer *tapGesture = + [[UITapGestureRecognizer alloc] initWithTarget:alert + action:@selector(showMoreInfo)]; + [alert.messageLabel addGestureRecognizer:tapGesture]; + return alert; } ++ (NSMutableAttributedString*)buildAlertMessage +{ + auto linkAttrs = @{NSForegroundColorAttributeName : UIColor.linkBlue}; + + NSMutableAttributedString *alertMessage = [[NSMutableAttributedString alloc] initWithString:L(@"alert_reauth_message_ios")]; + [alertMessage appendAttributedString:([[NSAttributedString alloc] initWithString:@" "])]; + NSAttributedString *alertLinkText = [[NSAttributedString alloc] initWithString:L(@"alert_reauth_link_text_ios") attributes:linkAttrs]; + [alertMessage appendAttributedString:alertLinkText]; + return alertMessage; +} + - (IBAction)osmTap { [self close:^{ @@ -23,6 +42,11 @@ static NSString * const kMap2OsmLoginSegue = @"Map2OsmLogin"; }]; } +- (IBAction)showMoreInfo +{ + NSLog(@"Navigate to URL: "); +} + - (IBAction)closeTap { [self close:nil]; diff --git a/iphone/Maps/Classes/CustomAlert/MWMOsmReauthAlert.xib b/iphone/Maps/Classes/CustomAlert/MWMOsmReauthAlert.xib index 2640318480..52548849d5 100644 --- a/iphone/Maps/Classes/CustomAlert/MWMOsmReauthAlert.xib +++ b/iphone/Maps/Classes/CustomAlert/MWMOsmReauthAlert.xib @@ -15,7 +15,7 @@ - + - + -