forked from organicmaps/organicmaps-tmp
[ios] Added personal info warning alert.
This commit is contained in:
parent
04c5bf7d47
commit
50c731f223
7 changed files with 49 additions and 0 deletions
|
@ -46,6 +46,7 @@
|
|||
- (void)presentDeleteFeatureAlertWithBlock:(nonnull TMWMVoidBlock)block;
|
||||
- (void)presentEditorViralAlert;
|
||||
- (void)presentOsmAuthAlert;
|
||||
- (void)presentPersonalInfoWarningAlertWithBlock:(nonnull TMWMVoidBlock)block;
|
||||
- (void)closeAlert;
|
||||
|
||||
- (nonnull instancetype)init __attribute__((unavailable("call -initWithViewController: instead!")));
|
||||
|
|
|
@ -175,6 +175,11 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController
|
|||
[self displayAlert:[MWMAlert deleteFeatureAlertWithBlock:block]];
|
||||
}
|
||||
|
||||
- (void)presentPersonalInfoWarningAlertWithBlock:(nonnull TMWMVoidBlock)block
|
||||
{
|
||||
[self displayAlert:[MWMAlert personalInfoWarningAlertWithBlock:block]];
|
||||
}
|
||||
|
||||
- (void)presentEditorViralAlert { [self displayAlert:[MWMAlert editorViralAlert]]; }
|
||||
- (void)presentOsmAuthAlert { [self displayAlert:[MWMAlert osmAuthAlert]]; }
|
||||
- (void)displayAlert:(MWMAlert *)alert
|
||||
|
|
|
@ -44,6 +44,7 @@ using TMWMDownloadBlock = void (^)(storage::TCountriesVec const &, TMWMVoidBlock
|
|||
+ (MWMAlert *)deleteFeatureAlertWithBlock:(TMWMVoidBlock)block;
|
||||
+ (MWMAlert *)editorViralAlert;
|
||||
+ (MWMAlert *)osmAuthAlert;
|
||||
+ (MWMAlert *)personalInfoWarningAlertWithBlock:(TMWMVoidBlock)block;
|
||||
- (void)close;
|
||||
|
||||
- (void)setNeedsCloseAlertAfterEnterBackground;
|
||||
|
|
|
@ -204,6 +204,11 @@
|
|||
return [MWMOsmAuthAlert alert];
|
||||
}
|
||||
|
||||
+ (MWMAlert *)personalInfoWarningAlertWithBlock:(TMWMVoidBlock)block
|
||||
{
|
||||
return [MWMDefaultAlert personalInfoWarningAlertWithBlock:block];
|
||||
}
|
||||
|
||||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
|
||||
{
|
||||
// Should override this method if you want custom relayout after rotation.
|
||||
|
|
|
@ -31,5 +31,6 @@
|
|||
+ (instancetype)routingBicycleDisclaimerAlert;
|
||||
+ (instancetype)resetChangesAlertWithBlock:(TMWMVoidBlock)block;
|
||||
+ (instancetype)deleteFeatureAlertWithBlock:(TMWMVoidBlock)block;
|
||||
+ (instancetype)personalInfoWarningAlertWithBlock:(TMWMVoidBlock)block;
|
||||
|
||||
@end
|
||||
|
|
|
@ -373,6 +373,18 @@ static NSString * const kDefaultAlertNibName = @"MWMDefaultAlert";
|
|||
return alert;
|
||||
}
|
||||
|
||||
+ (instancetype)personalInfoWarningAlertWithBlock:(TMWMVoidBlock)block
|
||||
{
|
||||
kStatisticsEvent = @"Personal info warning alert";
|
||||
NSString * message = [NSString stringWithFormat:@"%@\n%@", L(@"editor_share_to_all_dialog_message_1"), L(@"editor_share_to_all_dialog_message_2")];
|
||||
MWMDefaultAlert * alert = [self defaultAlertWithTitle:@"editor_share_to_all_dialog_title"
|
||||
message:message
|
||||
rightButtonTitle:@"editor_report_problem_send_button"
|
||||
leftButtonTitle:@"cancel"
|
||||
rightButtonAction:block];
|
||||
return alert;
|
||||
}
|
||||
|
||||
+ (instancetype)defaultAlertWithTitle:(nonnull NSString *)title
|
||||
message:(nullable NSString *)message
|
||||
rightButtonTitle:(nonnull NSString *)rightButtonTitle
|
||||
|
|
|
@ -34,6 +34,9 @@ NSString * const kOpeningHoursEditorSegue = @"Editor2OpeningHoursEditorSegue";
|
|||
NSString * const kCuisineEditorSegue = @"Editor2CuisineEditorSegue";
|
||||
NSString * const kStreetEditorSegue = @"Editor2StreetEditorSegue";
|
||||
NSString * const kCategoryEditorSegue = @"Editor2CategoryEditorSegue";
|
||||
|
||||
NSString * const kUDEditorPersonalInfoWarninWasShown = @"PersonalInfoWarningAlertWasShown";
|
||||
|
||||
CGFloat const kDefaultHeaderHeight = 28.;
|
||||
CGFloat const kDefaultFooterHeight = 32.;
|
||||
|
||||
|
@ -281,6 +284,9 @@ void registerCellsForTableView(vector<MWMPlacePageCellType> const & cells, UITab
|
|||
return;
|
||||
}
|
||||
|
||||
if ([self showPersonalInfoWarningAlertIfNeeded])
|
||||
return;
|
||||
|
||||
auto & f = GetFramework();
|
||||
auto const & featureID = m_mapObject.GetID();
|
||||
NSDictionary<NSString *, NSString *> * info = @{
|
||||
|
@ -1110,4 +1116,22 @@ void registerCellsForTableView(vector<MWMPlacePageCellType> const & cells, UITab
|
|||
}
|
||||
}
|
||||
|
||||
#pragma mark - Alert
|
||||
|
||||
- (BOOL)showPersonalInfoWarningAlertIfNeeded
|
||||
{
|
||||
NSUserDefaults * ud = [NSUserDefaults standardUserDefaults];
|
||||
if ([ud boolForKey:kUDEditorPersonalInfoWarninWasShown])
|
||||
return NO;
|
||||
|
||||
[ud setBool:YES forKey:kUDEditorPersonalInfoWarninWasShown];
|
||||
[ud synchronize];
|
||||
|
||||
[self.alertController presentPersonalInfoWarningAlertWithBlock:^
|
||||
{
|
||||
[self onSave];
|
||||
}];
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Add table
Reference in a new issue