From 497153d161651f78963f7a8e13125002b0217d7d Mon Sep 17 00:00:00 2001 From: Kiryl Kaveryn Date: Mon, 29 Jul 2024 14:00:29 +0400 Subject: [PATCH] [ios] implement bug report alert Signed-off-by: Kiryl Kaveryn --- .../AlertController/MWMAlertViewController.h | 1 + .../AlertController/MWMAlertViewController.mm | 4 ++++ iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h | 1 + .../Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm | 4 ++++ .../CustomAlert/DefaultAlert/MWMDefaultAlert.h | 2 +- .../CustomAlert/DefaultAlert/MWMDefaultAlert.mm | 12 ++++++++++++ 6 files changed, 23 insertions(+), 1 deletion(-) diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h index 32b23e48e6..6941774b81 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h @@ -43,6 +43,7 @@ callback:(nonnull MWMCheckStringBlock)callback; - (void)presentBookmarkConversionErrorAlert; +- (void)presentBugReportAlertWithTitle:(nonnull NSString *)title; - (void)presentDefaultAlertWithTitle:(nonnull NSString *)title message:(nullable NSString *)message diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm index ee13bfb52d..61b80d0feb 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm @@ -192,6 +192,10 @@ static NSString *const kAlertControllerNibIdentifier = @"MWMAlertViewController" [self displayAlert:[MWMAlert tagsLoadingErrorAlertWithOkBlock:okBlock cancelBlock:cancelBlock]]; } +- (void)presentBugReportAlertWithTitle:(nonnull NSString *)title { + [self displayAlert:[MWMAlert bugReportAlertWithTitle:title]]; +} + - (void)presentDefaultAlertWithTitle:(nonnull NSString *)title message:(nullable NSString *)message rightButtonTitle:(nonnull NSString *)rightButtonTitle diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h index 0da9878921..20af2ea950 100644 --- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h +++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h @@ -34,6 +34,7 @@ + (MWMAlert *)spinnerAlertWithTitle:(NSString *)title cancel:(MWMVoidBlock)cancel; + (MWMAlert *)bookmarkConversionErrorAlert; + (MWMAlert *)tagsLoadingErrorAlertWithOkBlock:okBlock cancelBlock:cancelBlock; ++ (MWMAlert *)bugReportAlertWithTitle:(NSString *)title; + (MWMAlert *)defaultAlertWithTitle:(NSString *)title message:(NSString *)message diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm index 13d02f71af..4bda99e9ec 100644 --- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm @@ -171,6 +171,10 @@ return [MWMDefaultAlert tagsLoadingErrorAlertWithOkBlock:okBlock cancelBlock:cancelBlock]; } ++ (MWMAlert *)bugReportAlertWithTitle:(NSString *)title { + return [MWMDefaultAlert bugReportAlertWithTitle:title]; +} + + (MWMAlert *)defaultAlertWithTitle:(NSString *)title message:(NSString *)message rightButtonTitle:(NSString *)rightButtonTitle diff --git a/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.h b/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.h index 4d91d6b229..58d88cb853 100644 --- a/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.h +++ b/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.h @@ -32,8 +32,8 @@ + (instancetype)infoAlert:(NSString *)title text:(NSString *)text; + (instancetype)convertBookmarksWithCount:(NSUInteger)count okBlock:(MWMVoidBlock)okBlock; + (instancetype)bookmarkConversionErrorAlert; - + (instancetype)tagsLoadingErrorAlertWithOkBlock:(MWMVoidBlock)okBlock cancelBlock:(MWMVoidBlock)cancelBlock; ++ (instancetype)bugReportAlertWithTitle:(NSString *)title; + (instancetype)defaultAlertWithTitle:(NSString *)title message:(NSString *)message diff --git a/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm b/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm index 488d939ef1..8a14ba1c52 100644 --- a/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm @@ -1,4 +1,5 @@ #import "MWMDefaultAlert.h" +#import "SwiftBridge.h" #include @@ -347,6 +348,17 @@ static NSString *const kDefaultAlertNibName = @"MWMDefaultAlert"; return alert; } ++ (instancetype)bugReportAlertWithTitle:(NSString *)title { + MWMDefaultAlert *alert = [self defaultAlertWithTitle:title + message:L(@"bugreport_alert_message") + rightButtonTitle:L(@"report_a_bug") + leftButtonTitle:L(@"cancel") + rightButtonAction:^{ [MailComposer sendBugReport]; } + log:nil]; + [alert setNeedsCloseAlertAfterEnterBackground]; + return alert; +} + + (instancetype)defaultAlertWithTitle:(NSString *)title message:(NSString *)message rightButtonTitle:(NSString *)rightButtonTitle