forked from organicmaps/organicmaps
[ios] Fixed weak property multiple times access.
Weak property is accessed multiple times in this method but may be unpredictably set to nil; assign to a strong variable to keep the object alive.
This commit is contained in:
parent
6d9d56acd0
commit
866a724ac2
33 changed files with 196 additions and 153 deletions
|
@ -26,5 +26,4 @@
|
|||
{
|
||||
[UIPasteboard generalPasteboard].string = self.text;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -212,11 +212,11 @@ CGAffineTransform rotation(UIInterfaceOrientation orientation)
|
|||
{
|
||||
_alertController = alertController;
|
||||
UIView * view = alertController.view;
|
||||
UIView * ownerView = alertController.ownerViewController.view;
|
||||
view.frame = ownerView.bounds;
|
||||
[alertController.ownerViewController.view addSubview:view];
|
||||
UIViewController * ownerViewController = alertController.ownerViewController;
|
||||
view.frame = ownerViewController.view.bounds;
|
||||
[ownerViewController.view addSubview:view];
|
||||
[self addControllerViewToWindow];
|
||||
[self rotate:alertController.ownerViewController.interfaceOrientation duration:0.0];
|
||||
[self rotate:ownerViewController.interfaceOrientation duration:0.0];
|
||||
[view addSubview:self];
|
||||
self.frame = view.bounds;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,8 @@ static NSString * const kStatisticsEvent = @"Rate Alert";
|
|||
[Statistics logEvent:kStatEventName(kStatisticsEvent, kStatSendEmail)];
|
||||
[Alohalytics logEvent:kRateAlertEventName withValue:@"sendFeedback"];
|
||||
self.alpha = 0.;
|
||||
self.alertController.view.alpha = 0.;
|
||||
MWMAlertViewController * alertController = self.alertController;
|
||||
alertController.view.alpha = 0.;
|
||||
if ([MFMailComposeViewController canSendMail])
|
||||
{
|
||||
struct utsname systemInfo;
|
||||
|
@ -170,9 +171,9 @@ static NSString * const kStatisticsEvent = @"Rate Alert";
|
|||
[mailController setToRecipients:@[ kRateEmail ]];
|
||||
[mailController setMessageBody:text isHTML:NO];
|
||||
mailController.navigationBar.tintColor = [UIColor blackColor];
|
||||
[self.alertController.ownerViewController presentViewController:mailController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
[alertController.ownerViewController presentViewController:mailController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -82,15 +82,16 @@ static NSString * const kKeyPath = @"subviews";
|
|||
if (_isVisible == isVisible)
|
||||
return;
|
||||
_isVisible = isVisible;
|
||||
UIViewController * controller = self.controller;
|
||||
if (isVisible)
|
||||
{
|
||||
self.backLabel.text = [NSString
|
||||
stringWithFormat:L(@"back_to"), @(GetFramework().GetApiDataHolder().GetAppTitle().c_str())];
|
||||
[self.controller.view addSubview:self.rootView];
|
||||
[self.controller.view addObserver:self
|
||||
forKeyPath:kKeyPath
|
||||
options:NSKeyValueObservingOptionNew
|
||||
context:nullptr];
|
||||
[controller.view addSubview:self.rootView];
|
||||
[controller.view addObserver:self
|
||||
forKeyPath:kKeyPath
|
||||
options:NSKeyValueObservingOptionNew
|
||||
context:nullptr];
|
||||
[self timerUpdate];
|
||||
self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0
|
||||
target:self
|
||||
|
@ -104,7 +105,7 @@ static NSString * const kKeyPath = @"subviews";
|
|||
[self.rootView removeFromSuperview];
|
||||
[self.timer invalidate];
|
||||
}
|
||||
[self.controller setNeedsStatusBarAppearanceUpdate];
|
||||
[controller setNeedsStatusBarAppearanceUpdate];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -552,10 +552,10 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) {
|
|||
- (void)setTtsSoundButton:(MWMButton *)ttsSoundButton
|
||||
{
|
||||
_ttsSoundButton = ttsSoundButton;
|
||||
[_ttsSoundButton setImage:[UIImage imageNamed:@"ic_voice_on"] forState:UIControlStateNormal];
|
||||
[_ttsSoundButton setImage:[UIImage imageNamed:@"ic_voice_off"] forState:UIControlStateSelected];
|
||||
[_ttsSoundButton setImage:[UIImage imageNamed:@"ic_voice_off"]
|
||||
forState:UIControlStateSelected | UIControlStateHighlighted];
|
||||
[ttsSoundButton setImage:[UIImage imageNamed:@"ic_voice_on"] forState:UIControlStateNormal];
|
||||
[ttsSoundButton setImage:[UIImage imageNamed:@"ic_voice_off"] forState:UIControlStateSelected];
|
||||
[ttsSoundButton setImage:[UIImage imageNamed:@"ic_voice_off"]
|
||||
forState:UIControlStateSelected | UIControlStateHighlighted];
|
||||
[self ttsButtonStatusChanged:nil];
|
||||
}
|
||||
|
||||
|
|
|
@ -213,6 +213,7 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
|
||||
- (void)actionDownloadMaps:(mwm::DownloaderMode)mode
|
||||
{
|
||||
MapViewController * ownerController = self.ownerController;
|
||||
if (platform::migrate::NeedMigrate())
|
||||
{
|
||||
if (GetFramework().IsRoutingActive())
|
||||
|
@ -225,12 +226,12 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
{
|
||||
[Statistics logEvent:kStatDownloaderMigrationDialogue
|
||||
withParameters:@{kStatFrom : kStatDownloader}];
|
||||
[self.ownerController openMigration];
|
||||
[ownerController openMigration];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[self.ownerController openMapsDownloader:mode];
|
||||
[ownerController openMapsDownloader:mode];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,11 +260,12 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
- (void)addPlace:(BOOL)isBusiness hasPoint:(BOOL)hasPoint point:(m2::PointD const &)point
|
||||
{
|
||||
self.menuState = MWMBottomMenuStateHidden;
|
||||
static_cast<EAGLView *>(self.ownerController.view).widgetsManager.fullScreen = YES;
|
||||
MapViewController * ownerController = self.ownerController;
|
||||
static_cast<EAGLView *>(ownerController.view).widgetsManager.fullScreen = YES;
|
||||
[self.placePageManager dismissPlacePage];
|
||||
self.searchManager.state = MWMSearchManagerStateHidden;
|
||||
|
||||
[MWMAddPlaceNavigationBar showInSuperview:self.ownerController.view
|
||||
[MWMAddPlaceNavigationBar showInSuperview:ownerController.view
|
||||
isBusiness:isBusiness
|
||||
applyPosition:hasPoint
|
||||
position:point
|
||||
|
@ -272,9 +274,9 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
|
||||
if (IsPointCoveredByDownloadedMaps(f.GetViewportCenter(), f.GetStorage(),
|
||||
f.GetCountryInfoGetter()))
|
||||
[self.ownerController performSegueWithIdentifier:kMapToCategorySelectorSegue sender:nil];
|
||||
[ownerController performSegueWithIdentifier:kMapToCategorySelectorSegue sender:nil];
|
||||
else
|
||||
[self.ownerController.alertController presentIncorrectFeauturePositionAlert];
|
||||
[ownerController.alertController presentIncorrectFeauturePositionAlert];
|
||||
|
||||
[self didFinishAddingPlace];
|
||||
}
|
||||
|
|
|
@ -123,11 +123,12 @@ WeekDayView getWeekDayView()
|
|||
}
|
||||
if (!haveCurrentDay)
|
||||
[self addEmptyCurrentDay];
|
||||
id<MWMPlacePageOpeningHoursCellProtocol> delegate = self.delegate;
|
||||
if (self.haveExpandSchedule)
|
||||
{
|
||||
self.toggleButton.hidden = NO;
|
||||
self.expandImage.hidden = NO;
|
||||
if (self.delegate.forcedButton)
|
||||
if (delegate.forcedButton)
|
||||
self.expandImage.image = [UIImage imageNamed:@"ic_arrow_gray_right"];
|
||||
else if (self.isExpanded)
|
||||
self.expandImage.image = [UIImage imageNamed:@"ic_arrow_gray_up"];
|
||||
|
@ -142,7 +143,7 @@ WeekDayView getWeekDayView()
|
|||
[self addClosedDays];
|
||||
}
|
||||
self.openTimeTrailingOffset.priority =
|
||||
self.delegate.forcedButton ? UILayoutPriorityDefaultHigh : UILayoutPriorityDefaultLow;
|
||||
delegate.forcedButton ? UILayoutPriorityDefaultHigh : UILayoutPriorityDefaultLow;
|
||||
self.weekDaysViewHeight.constant = ceil(self.weekDaysViewEstimatedHeight);
|
||||
[self alignTimeOffsets];
|
||||
}
|
||||
|
|
|
@ -68,9 +68,10 @@ static NSString * const kCellIdentifier = @"MWMSearchCategoryCell";
|
|||
NSString * string = @(m_categories[indexPath.row].c_str());
|
||||
[Statistics logEvent:kStatEventName(kStatSearch, kStatSelectResult)
|
||||
withParameters:@{kStatValue : string, kStatScreen : kStatCategories}];
|
||||
[self.delegate searchText:[L(string) stringByAppendingString:@" "]
|
||||
forInputLocale:[[AppInfo sharedInfo] languageId]];
|
||||
[self.delegate dismissKeyboard];
|
||||
id<MWMSearchTabbedViewProtocol> delegate = self.delegate;
|
||||
[delegate searchText:[L(string) stringByAppendingString:@" "]
|
||||
forInputLocale:[[AppInfo sharedInfo] languageId]];
|
||||
[delegate dismissKeyboard];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -142,6 +142,7 @@ static NSString * const kMyPositionCellIdentifier = @"MWMSearchHistoryMyPosition
|
|||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
BOOL const isRouteSearch = self.isRouteSearchMode;
|
||||
id<MWMSearchTabbedViewProtocol> delegate = self.delegate;
|
||||
if ([self isRequestCell:indexPath])
|
||||
{
|
||||
search::QuerySaver::TSearchRequest const & query =
|
||||
|
@ -149,7 +150,7 @@ static NSString * const kMyPositionCellIdentifier = @"MWMSearchHistoryMyPosition
|
|||
NSString * queryText = @(query.second.c_str());
|
||||
[Statistics logEvent:kStatEventName(kStatSearch, kStatSelectResult)
|
||||
withParameters:@{kStatValue : queryText, kStatScreen : kStatHistory}];
|
||||
[self.delegate searchText:queryText forInputLocale:@(query.first.c_str())];
|
||||
[delegate searchText:queryText forInputLocale:@(query.first.c_str())];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -157,7 +158,7 @@ static NSString * const kMyPositionCellIdentifier = @"MWMSearchHistoryMyPosition
|
|||
{
|
||||
[Statistics logEvent:kStatEventName(kStatSearch, kStatSelectResult)
|
||||
withParameters:@{kStatValue : kStatMyPosition, kStatScreen : kStatHistory}];
|
||||
[self.delegate tapMyPositionFromHistory];
|
||||
[delegate tapMyPositionFromHistory];
|
||||
return;
|
||||
}
|
||||
[Statistics logEvent:kStatEventName(kStatSearch, kStatSelectResult)
|
||||
|
|
|
@ -142,13 +142,15 @@ BOOL isOffsetInButton(CGFloat offset, MWMSearchTabButtonsView * button)
|
|||
|
||||
- (void)updateScrollPosition:(CGFloat)position
|
||||
{
|
||||
CGFloat const btnMid = position + 0.5 * self.scrollIndicator.width;
|
||||
CGFloat const scrollIndicatorWidth = self.scrollIndicator.width;
|
||||
CGFloat const btnMid = position + 0.5 * scrollIndicatorWidth;
|
||||
if (isInterfaceRightToLeft())
|
||||
position = self.scrollIndicator.width - position;
|
||||
position = scrollIndicatorWidth - position;
|
||||
runAsyncOnMainQueue(^{
|
||||
self.scrollIndicatorOffset.constant = nearbyint(position);
|
||||
});
|
||||
if (self.selectedButton && isOffsetInButton(btnMid, self.selectedButton))
|
||||
MWMSearchTabButtonsView * selectedButton = self.selectedButton;
|
||||
if (selectedButton && isOffsetInButton(btnMid, selectedButton))
|
||||
return;
|
||||
[self.tabButtons
|
||||
enumerateObjectsUsingBlock:^(MWMSearchTabButtonsView * btn, NSUInteger idx, BOOL * stop) {
|
||||
|
@ -174,8 +176,9 @@ BOOL isOffsetInButton(CGFloat offset, MWMSearchTabButtonsView * button)
|
|||
|
||||
- (void)refreshScrollPosition
|
||||
{
|
||||
self.scrollIndicatorOffset.constant = nearbyint(self.selectedButton.minX);
|
||||
[self tabButtonPressed:self.selectedButton];
|
||||
MWMSearchTabButtonsView * selectedButton = self.selectedButton;
|
||||
self.scrollIndicatorOffset.constant = nearbyint(selectedButton.minX);
|
||||
[self tabButtonPressed:selectedButton];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDataSource
|
||||
|
|
|
@ -203,11 +203,12 @@ NSString * identifierForType(MWMSearchTableCellType type)
|
|||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
MWMSearchTableCellType cellType = [self cellTypeForIndexPath:indexPath];
|
||||
id<MWMSearchTableViewProtocol> delegate = self.delegate;
|
||||
if (cellType == MWMSearchTableCellTypeOnMap)
|
||||
{
|
||||
MWMSearchTextField * textField = self.delegate.searchTextField;
|
||||
MWMSearchTextField * textField = delegate.searchTextField;
|
||||
[MWMSearch saveQuery:textField.text forInputLocale:textField.textInputMode.primaryLanguage];
|
||||
self.delegate.state = MWMSearchManagerStateMapSearch;
|
||||
delegate.state = MWMSearchManagerStateMapSearch;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -217,13 +218,13 @@ NSString * identifierForType(MWMSearchTableCellType type)
|
|||
NSString * suggestionString = @(result.GetSuggestionString());
|
||||
[Statistics logEvent:kStatEventName(kStatSearch, kStatSelectResult)
|
||||
withParameters:@{kStatValue : suggestionString, kStatScreen : kStatSearch}];
|
||||
[self.delegate searchText:suggestionString forInputLocale:nil];
|
||||
[delegate searchText:suggestionString forInputLocale:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
MWMSearchTextField * textField = self.delegate.searchTextField;
|
||||
MWMSearchTextField * textField = delegate.searchTextField;
|
||||
[MWMSearch saveQuery:textField.text forInputLocale:textField.textInputMode.primaryLanguage];
|
||||
[self.delegate processSearchWithResult:result];
|
||||
[delegate processSearchWithResult:result];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ NSArray<TMWMWelcomeConfigBlock> * pagesConfigBlocks = @[
|
|||
[^(MWMWhatsNewEditorController * controller) {
|
||||
controller.image.image = [UIImage imageNamed:@"img_editor_upd"];
|
||||
controller.alertTitle.text = L(@"whatsnew_update_editor_title");
|
||||
MWMPageController * pageController = controller.pageController;
|
||||
if (platform::migrate::NeedMigrate())
|
||||
{
|
||||
controller.alertText.text =
|
||||
|
@ -44,7 +45,7 @@ NSArray<TMWMWelcomeConfigBlock> * pagesConfigBlocks = @[
|
|||
forControlEvents:UIControlEventTouchUpInside];
|
||||
[controller.secondaryButton setTitle:L(@"not_now")
|
||||
forState:UIControlStateNormal];
|
||||
[controller.secondaryButton addTarget:controller.pageController
|
||||
[controller.secondaryButton addTarget:pageController
|
||||
action:@selector(close)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
|
@ -55,7 +56,7 @@ NSArray<TMWMWelcomeConfigBlock> * pagesConfigBlocks = @[
|
|||
controller.buttonsSpacing.priority = UILayoutPriorityDefaultLow;
|
||||
[controller.primaryButton setTitle:L(@"done")
|
||||
forState:UIControlStateNormal];
|
||||
[controller.primaryButton addTarget:controller.pageController
|
||||
[controller.primaryButton addTarget:pageController
|
||||
action:@selector(close)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
|
|
|
@ -63,11 +63,12 @@
|
|||
[Statistics logEvent:kStatEventName(kStatWhatsNew, [self.welcomeClass udWelcomeWasShownKey])
|
||||
withParameters:@{kStatAction : kStatOpen}];
|
||||
[self configure];
|
||||
UIViewController<MWMPageControllerProtocol> * parent = self.parent;
|
||||
if (IPAD)
|
||||
[self.parent.view addSubview:self.iPadBackgroundView];
|
||||
[self.parent addChildViewController:self];
|
||||
[self.parent.view addSubview:self.view];
|
||||
[self didMoveToParentViewController:self.parent];
|
||||
[parent.view addSubview:self.iPadBackgroundView];
|
||||
[parent addChildViewController:self];
|
||||
[parent.view addSubview:self.view];
|
||||
[self didMoveToParentViewController:parent];
|
||||
}
|
||||
|
||||
#pragma mark - Private methods
|
||||
|
|
|
@ -152,8 +152,9 @@ using TInfoDisplays = NSHashTable<__kindof TInfoDisplay>;
|
|||
|
||||
- (void)setMenuState:(MWMBottomMenuState)menuState
|
||||
{
|
||||
[self.delegate setMenuState:menuState];
|
||||
[self.delegate setMenuRestoreState:menuState];
|
||||
id<MWMNavigationDashboardManagerProtocol> delegate = self.delegate;
|
||||
[delegate setMenuState:menuState];
|
||||
[delegate setMenuRestoreState:menuState];
|
||||
}
|
||||
|
||||
- (void)mwm_refreshUI
|
||||
|
|
|
@ -33,10 +33,11 @@ static void * kContext = &kContext;
|
|||
|
||||
- (void)updateTextViewForHeight:(CGFloat)height
|
||||
{
|
||||
id<MWMNoteCelLDelegate> delegate = self.delegate;
|
||||
if (height > kMinimalTextViewHeight)
|
||||
{
|
||||
self.textViewHeight.constant = height;
|
||||
[self.delegate cellShouldChangeSize:self text:self.textView.text];
|
||||
[delegate cellShouldChangeSize:self text:self.textView.text];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -44,7 +45,7 @@ static void * kContext = &kContext;
|
|||
if (currentHeight > kMinimalTextViewHeight)
|
||||
{
|
||||
self.textViewHeight.constant = kMinimalTextViewHeight;
|
||||
[self.delegate cellShouldChangeSize:self text:self.textView.text];
|
||||
[delegate cellShouldChangeSize:self text:self.textView.text];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,10 +85,11 @@ string locale()
|
|||
|
||||
- (void)backTap
|
||||
{
|
||||
if (self.delegate)
|
||||
id<MWMObjectsCategorySelectorDelegate> delegate = self.delegate;
|
||||
if (delegate)
|
||||
{
|
||||
auto const object = self.createdObject;
|
||||
[self.delegate reloadObject:object];
|
||||
[delegate reloadObject:object];
|
||||
}
|
||||
[super backTap];
|
||||
}
|
||||
|
|
|
@ -91,8 +91,8 @@ BOOL isCompactForCellWidth(CGFloat width)
|
|||
|
||||
self.timeSpanLabel.text = [NSString stringWithFormat:@"%@-%@", openString, closeString];
|
||||
|
||||
self.timeSpanLabel.textColor =
|
||||
[self.section isRowSelected:row] ? [UIColor linkBlue] : [UIColor blackSecondaryText];
|
||||
BOOL const isRowSelected = [section isRowSelected:row];
|
||||
self.timeSpanLabel.textColor = isRowSelected ? [UIColor linkBlue] : [UIColor blackSecondaryText];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
@ -103,8 +103,9 @@ BOOL isCompactForCellWidth(CGFloat width)
|
|||
if (!self.isVisible)
|
||||
return;
|
||||
NSUInteger const row = self.row;
|
||||
self.section.selectedRow = [self.section isRowSelected:row] ? nil : @(row);
|
||||
[self.section refresh:NO];
|
||||
MWMOpeningHoursSection * section = self.section;
|
||||
section.selectedRow = [section isRowSelected:row] ? nil : @(row);
|
||||
[section refresh:NO];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -55,10 +55,11 @@ using namespace osmoh;
|
|||
if (refresh)
|
||||
{
|
||||
Weekday const wd = [self tag2Weekday:tag];
|
||||
MWMOpeningHoursSection * section = self.section;
|
||||
if (selected)
|
||||
[self.section addSelectedDay:wd];
|
||||
[section addSelectedDay:wd];
|
||||
else
|
||||
[self.section removeSelectedDay:wd];
|
||||
[section removeSelectedDay:wd];
|
||||
}
|
||||
for (UIButton * btn in self.buttons)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
self.openTimeLabel.text = [dateFormatter stringFromDate:openDate];
|
||||
self.closeTimeLabel.text = [dateFormatter stringFromDate:closeDate];
|
||||
|
||||
UIColor * clr = [self.section isRowSelected:row] ? [UIColor linkBlue] : [UIColor blackSecondaryText];
|
||||
UIColor * clr = [section isRowSelected:row] ? [UIColor linkBlue] : [UIColor blackSecondaryText];
|
||||
self.openTimeLabel.textColor = clr;
|
||||
self.closeTimeLabel.textColor = clr;
|
||||
}
|
||||
|
@ -48,8 +48,8 @@
|
|||
{
|
||||
MWMOpeningHoursSection * section = self.section;
|
||||
NSUInteger const row = self.row;
|
||||
section.selectedRow = [self.section isRowSelected:row] ? nil : @(row);
|
||||
[self.section refresh:NO];
|
||||
section.selectedRow = [section isRowSelected:row] ? nil : @(row);
|
||||
[section refresh:NO];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,18 +64,19 @@ using namespace osmoh;
|
|||
timeTableSet.Remove(index);
|
||||
[self.sections removeObjectAtIndex:index];
|
||||
[self refreshSectionsIndexes];
|
||||
UITableView * tableView = self.tableView;
|
||||
if (needRealDelete)
|
||||
{
|
||||
[self.tableView deleteSections:[[NSIndexSet alloc] initWithIndex:index]
|
||||
withRowAnimation:kMWMOpeningHoursEditorRowAnimation];
|
||||
[self.tableView reloadSections:[[NSIndexSet alloc] initWithIndex:self.count]
|
||||
withRowAnimation:kMWMOpeningHoursEditorRowAnimation];
|
||||
[tableView deleteSections:[[NSIndexSet alloc] initWithIndex:index]
|
||||
withRowAnimation:kMWMOpeningHoursEditorRowAnimation];
|
||||
[tableView reloadSections:[[NSIndexSet alloc] initWithIndex:self.count]
|
||||
withRowAnimation:kMWMOpeningHoursEditorRowAnimation];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSRange reloadRange = {index, self.count - index + 1};
|
||||
[self.tableView reloadSections:[[NSIndexSet alloc] initWithIndexesInRange:reloadRange]
|
||||
withRowAnimation:kMWMOpeningHoursEditorRowAnimation];
|
||||
[tableView reloadSections:[[NSIndexSet alloc] initWithIndexesInRange:reloadRange]
|
||||
withRowAnimation:kMWMOpeningHoursEditorRowAnimation];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -266,12 +266,13 @@ using namespace osmoh;
|
|||
|
||||
- (void)refresh:(BOOL)force
|
||||
{
|
||||
UITableView * tableView = self.delegate.tableView;
|
||||
if (force)
|
||||
{
|
||||
[self.delegate.tableView reloadData];
|
||||
[tableView reloadData];
|
||||
return;
|
||||
}
|
||||
for (MWMOpeningHoursTableViewCell * cell in self.delegate.tableView.visibleCells)
|
||||
for (MWMOpeningHoursTableViewCell * cell in tableView.visibleCells)
|
||||
{
|
||||
[cell refresh];
|
||||
}
|
||||
|
@ -344,14 +345,15 @@ using namespace osmoh;
|
|||
NSUInteger const newInd = selectedRow.unsignedIntegerValue;
|
||||
NSUInteger const oldInd = oldSelectedRow.unsignedIntegerValue;
|
||||
|
||||
UITableView * tableView = self.delegate.tableView;
|
||||
id<MWMOpeningHoursSectionProtocol> delegate = self.delegate;
|
||||
UITableView * tableView = delegate.tableView;
|
||||
[tableView beginUpdates];
|
||||
|
||||
if (!oldSelectedRow)
|
||||
{
|
||||
_selectedRow = selectedRow;
|
||||
[self insertRow:newInd + 1];
|
||||
[self.delegate updateActiveSection:self.index];
|
||||
[delegate updateActiveSection:self.index];
|
||||
}
|
||||
else if (selectedRow)
|
||||
{
|
||||
|
|
|
@ -45,8 +45,9 @@ namespace
|
|||
|
||||
- (void)configData
|
||||
{
|
||||
m_streets = self.delegate.nearbyStreets;
|
||||
auto const & currentStreet = self.delegate.currentStreet;
|
||||
id<MWMStreetEditorProtocol> delegate = self.delegate;
|
||||
m_streets = delegate.nearbyStreets;
|
||||
auto const & currentStreet = delegate.currentStreet;
|
||||
|
||||
BOOL const haveCurrentStreet = !currentStreet.m_defaultName.empty();
|
||||
if (haveCurrentStreet)
|
||||
|
@ -88,10 +89,11 @@ namespace
|
|||
|
||||
- (void)onDone
|
||||
{
|
||||
id<MWMStreetEditorProtocol> delegate = self.delegate;
|
||||
if (self.selectedStreet == NSNotFound)
|
||||
[self.delegate setNearbyStreet:{m_editedStreetName, ""}];
|
||||
[delegate setNearbyStreet:{m_editedStreetName, ""}];
|
||||
else
|
||||
[self.delegate setNearbyStreet:m_streets[self.selectedStreet]];
|
||||
[delegate setNearbyStreet:m_streets[self.selectedStreet]];
|
||||
|
||||
[self onCancel];
|
||||
}
|
||||
|
|
|
@ -674,7 +674,7 @@ using namespace storage;
|
|||
default:
|
||||
{
|
||||
MWMPlacePageInfoCell * tCell = (MWMPlacePageInfoCell *)cell;
|
||||
tCell.currentEntity = self.entity;
|
||||
tCell.currentEntity = entity;
|
||||
[tCell configureWithType:cellType info:[entity getCellValue:cellType]];
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -54,17 +54,18 @@ extern NSString * const kPP2BookmarkEditingIPADSegue = @"PP2BookmarkEditingIPAD"
|
|||
|
||||
- (void)configure
|
||||
{
|
||||
MWMPlacePageEntity * entity = self.manager.entity;
|
||||
MWMPlacePageViewManager * manager = self.manager;
|
||||
MWMPlacePageEntity * entity = manager.entity;
|
||||
[self.basePlacePageView configureWithEntity:entity];
|
||||
BOOL const isPrepareRouteMode = MapsAppDelegate.theApp.routingPlaneMode != MWMRoutingPlaneModeNone;
|
||||
if (self.actionBar.isPrepareRouteMode == isPrepareRouteMode)
|
||||
{
|
||||
[self.actionBar configureWithPlacePageManager:self.manager];
|
||||
[self.actionBar configureWithPlacePageManager:manager];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self.actionBar removeFromSuperview];
|
||||
self.actionBar = [MWMPlacePageActionBar actionBarForPlacePageManager:self.manager];
|
||||
self.actionBar = [MWMPlacePageActionBar actionBarForPlacePageManager:manager];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,8 +129,10 @@ extern NSString * const kPP2BookmarkEditingIPADSegue = @"PP2BookmarkEditingIPAD"
|
|||
|
||||
- (void)editBookmark
|
||||
{
|
||||
[self.manager.ownerViewController performSegueWithIdentifier:IPAD ? kPP2BookmarkEditingIPADSegue :
|
||||
kPP2BookmarkEditingSegue sender:self.manager];
|
||||
MWMPlacePageViewManager * manager = self.manager;
|
||||
[manager.ownerViewController
|
||||
performSegueWithIdentifier:IPAD ? kPP2BookmarkEditingIPADSegue : kPP2BookmarkEditingSegue
|
||||
sender:manager];
|
||||
}
|
||||
|
||||
- (void)reloadBookmark
|
||||
|
|
|
@ -171,20 +171,21 @@ NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
|
|||
|
||||
- (void)tapOnButtonWithType:(EButton)type
|
||||
{
|
||||
MWMPlacePageViewManager * placePageManager = self.placePageManager;
|
||||
switch (type)
|
||||
{
|
||||
case EButton::Api: [self.placePageManager apiBack]; break;
|
||||
case EButton::Booking: [self.placePageManager book:NO]; break;
|
||||
case EButton::Call: [self.placePageManager call]; break;
|
||||
case EButton::Api: [placePageManager apiBack]; break;
|
||||
case EButton::Booking: [placePageManager book:NO]; break;
|
||||
case EButton::Call: [placePageManager call]; break;
|
||||
case EButton::Bookmark:
|
||||
if (self.isBookmark)
|
||||
[self.placePageManager removeBookmark];
|
||||
[placePageManager removeBookmark];
|
||||
else
|
||||
[self.placePageManager addBookmark];
|
||||
[placePageManager addBookmark];
|
||||
break;
|
||||
case EButton::RouteFrom: [self.placePageManager routeFrom]; break;
|
||||
case EButton::RouteTo: [self.placePageManager routeTo]; break;
|
||||
case EButton::Share: [self.placePageManager share]; break;
|
||||
case EButton::RouteFrom: [placePageManager routeFrom]; break;
|
||||
case EButton::RouteTo: [placePageManager routeTo]; break;
|
||||
case EButton::Share: [placePageManager share]; break;
|
||||
case EButton::More: [self showActionSheet]; break;
|
||||
case EButton::Spacer: break;
|
||||
}
|
||||
|
|
|
@ -24,12 +24,13 @@
|
|||
|
||||
- (IBAction)buttonTap
|
||||
{
|
||||
MWMPlacePageViewManager * manager = self.manager;
|
||||
switch (self.type)
|
||||
{
|
||||
case MWMPlacePageCellTypeEditButton: [self.manager editPlace]; break;
|
||||
case MWMPlacePageCellTypeAddBusinessButton: [self.manager addBusiness]; break;
|
||||
case MWMPlacePageCellTypeAddPlaceButton: [self.manager addPlace]; break;
|
||||
case MWMPlacePageCellTypeBookingMore: [self.manager book:YES]; break;
|
||||
case MWMPlacePageCellTypeEditButton: [manager editPlace]; break;
|
||||
case MWMPlacePageCellTypeAddBusinessButton: [manager addBusiness]; break;
|
||||
case MWMPlacePageCellTypeAddPlaceButton: [manager addPlace]; break;
|
||||
case MWMPlacePageCellTypeBookingMore: [manager book:YES]; break;
|
||||
default: NSAssert(false, @"Incorrect cell type!"); break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,20 +147,21 @@
|
|||
{
|
||||
storage::NodeAttrs nodeAttrs;
|
||||
GetFramework().GetStorage().GetNodeAttrs(m_countryId, nodeAttrs);
|
||||
id<MWMMapDownloaderProtocol> delegate = self.delegate;
|
||||
switch (nodeAttrs.m_status)
|
||||
{
|
||||
case NodeStatus::NotDownloaded:
|
||||
case NodeStatus::Partly:
|
||||
if ([self isKindOfClass:[MWMMapDownloaderLargeCountryTableViewCell class]])
|
||||
[self.delegate openNodeSubtree:m_countryId];
|
||||
[delegate openNodeSubtree:m_countryId];
|
||||
else
|
||||
[self.delegate downloadNode:m_countryId];
|
||||
[delegate downloadNode:m_countryId];
|
||||
break;
|
||||
case NodeStatus::Undefined:
|
||||
case NodeStatus::Error: [self.delegate retryDownloadNode:m_countryId]; break;
|
||||
case NodeStatus::OnDiskOutOfDate: [self.delegate updateNode:m_countryId]; break;
|
||||
case NodeStatus::Error: [delegate retryDownloadNode:m_countryId]; break;
|
||||
case NodeStatus::OnDiskOutOfDate: [delegate updateNode:m_countryId]; break;
|
||||
case NodeStatus::Downloading:
|
||||
case NodeStatus::InQueue: [self.delegate cancelNode:m_countryId]; break;
|
||||
case NodeStatus::InQueue: [delegate cancelNode:m_countryId]; break;
|
||||
case NodeStatus::OnDisk: break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -850,7 +850,7 @@ using namespace mwm;
|
|||
- (void)setTableView:(UITableView *)tableView
|
||||
{
|
||||
_tableView = tableView;
|
||||
_tableView.tableFooterView = [[UIView alloc] initWithFrame:{}];
|
||||
tableView.tableFooterView = [[UIView alloc] initWithFrame:{}];
|
||||
self.dataSource = self.defaultDataSource;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,44 +61,52 @@ using TObservers = NSHashTable<__kindof TObserver>;
|
|||
{
|
||||
NSTimeInterval const timestamp = [NSDate date].timeIntervalSince1970;
|
||||
self.lastSearchTimestamp = timestamp;
|
||||
__weak auto weakSelf = self;
|
||||
m_everywhereParams.m_onResults = [weakSelf, timestamp](search::Results const & results) {
|
||||
__strong auto self = weakSelf;
|
||||
if (!self)
|
||||
return;
|
||||
if (timestamp != self.lastSearchTimestamp)
|
||||
return;
|
||||
if (results.IsEndMarker())
|
||||
{
|
||||
self.everywhereSearchActive = NO;
|
||||
{
|
||||
__weak auto weakSelf = self;
|
||||
m_everywhereParams.m_onResults = [weakSelf, timestamp](search::Results const & results) {
|
||||
__strong auto self = weakSelf;
|
||||
if (!self)
|
||||
return;
|
||||
if (timestamp != self.lastSearchTimestamp)
|
||||
return;
|
||||
if (results.IsEndMarker())
|
||||
{
|
||||
self.everywhereSearchActive = NO;
|
||||
[self onSearchCompleted];
|
||||
}
|
||||
else
|
||||
{
|
||||
self->m_results = results;
|
||||
self.suggestionsCount = results.GetSuggestsCount();
|
||||
[self onSearchResultsUpdated];
|
||||
}
|
||||
};
|
||||
}
|
||||
{
|
||||
__weak auto weakSelf = self;
|
||||
m_viewportParams.m_onStarted = [weakSelf] {
|
||||
__strong auto self = weakSelf;
|
||||
if (!self)
|
||||
return;
|
||||
if (IPAD)
|
||||
{
|
||||
GetFramework().SearchEverywhere(self->m_everywhereParams);
|
||||
self.everywhereSearchActive = YES;
|
||||
}
|
||||
self.viewportSearchActive = YES;
|
||||
[self onSearchStarted];
|
||||
};
|
||||
}
|
||||
{
|
||||
__weak auto weakSelf = self;
|
||||
m_viewportParams.m_onCompleted = [weakSelf] {
|
||||
__strong auto self = weakSelf;
|
||||
if (!self)
|
||||
return;
|
||||
self.viewportSearchActive = NO;
|
||||
[self onSearchCompleted];
|
||||
}
|
||||
else
|
||||
{
|
||||
self->m_results = results;
|
||||
self.suggestionsCount = results.GetSuggestsCount();
|
||||
[self onSearchResultsUpdated];
|
||||
}
|
||||
};
|
||||
m_viewportParams.m_onStarted = [weakSelf] {
|
||||
__strong auto self = weakSelf;
|
||||
if (!self)
|
||||
return;
|
||||
if (IPAD)
|
||||
{
|
||||
GetFramework().SearchEverywhere(self->m_everywhereParams);
|
||||
self.everywhereSearchActive = YES;
|
||||
}
|
||||
self.viewportSearchActive = YES;
|
||||
[self onSearchStarted];
|
||||
};
|
||||
m_viewportParams.m_onCompleted = [weakSelf] {
|
||||
__strong auto self = weakSelf;
|
||||
if (!self)
|
||||
return;
|
||||
self.viewportSearchActive = NO;
|
||||
[self onSearchCompleted];
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
- (void)update
|
||||
|
|
|
@ -125,8 +125,9 @@ using namespace storage;
|
|||
case NodeStatus::NotDownloaded:
|
||||
case NodeStatus::Partly:
|
||||
{
|
||||
MapViewController * controller = self.controller;
|
||||
BOOL const isMapVisible =
|
||||
[self.controller.navigationController.topViewController isEqual:self.controller];
|
||||
[controller.navigationController.topViewController isEqual:controller];
|
||||
if (isMapVisible && !self.isAutoDownloadCancelled && canAutoDownload(m_countryId))
|
||||
{
|
||||
[Statistics logEvent:kStatDownloaderMapAction
|
||||
|
@ -138,7 +139,7 @@ using namespace storage;
|
|||
}];
|
||||
m_autoDownloadCountryId = m_countryId;
|
||||
[MWMStorage downloadNode:m_countryId
|
||||
alertController:self.controller.alertController
|
||||
alertController:controller.alertController
|
||||
onSuccess:^{
|
||||
[self showInQueue];
|
||||
}];
|
||||
|
@ -313,10 +314,11 @@ using namespace storage;
|
|||
|
||||
- (IBAction)downloadAction
|
||||
{
|
||||
MapViewController * controller = self.controller;
|
||||
if (platform::migrate::NeedMigrate())
|
||||
{
|
||||
[Statistics logEvent:kStatDownloaderMigrationDialogue withParameters:@{kStatFrom : kStatMap}];
|
||||
[self.controller openMigration];
|
||||
[controller openMigration];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -328,7 +330,7 @@ using namespace storage;
|
|||
kStatScenario : kStatDownload
|
||||
}];
|
||||
[MWMStorage downloadNode:m_countryId
|
||||
alertController:self.controller.alertController
|
||||
alertController:controller.alertController
|
||||
onSuccess:^{
|
||||
[self showInQueue];
|
||||
}];
|
||||
|
|
|
@ -91,10 +91,12 @@
|
|||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
self.selectedCell.accessoryType = UITableViewCellAccessoryNone;
|
||||
self.selectedCell = [tableView cellForRowAtIndexPath:indexPath];
|
||||
self.selectedCell.accessoryType = UITableViewCellAccessoryCheckmark;
|
||||
self.selectedCell.selected = NO;
|
||||
SelectableCell * selectedCell = self.selectedCell;
|
||||
selectedCell.accessoryType = UITableViewCellAccessoryNone;
|
||||
selectedCell = [tableView cellForRowAtIndexPath:indexPath];
|
||||
selectedCell.accessoryType = UITableViewCellAccessoryCheckmark;
|
||||
selectedCell.selected = NO;
|
||||
self.selectedCell = selectedCell;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -90,9 +90,11 @@ typedef NS_ENUM(NSUInteger, DurationInHours) { One = 1, Two = 2, Six = 6, Twelve
|
|||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
self.selectedCell.accessoryType = UITableViewCellAccessoryNone;
|
||||
self.selectedCell = [tableView cellForRowAtIndexPath:indexPath];
|
||||
self.selectedCell.selected = NO;
|
||||
SelectableCell * selectedCell = self.selectedCell;
|
||||
selectedCell.accessoryType = UITableViewCellAccessoryNone;
|
||||
selectedCell = [tableView cellForRowAtIndexPath:indexPath];
|
||||
selectedCell.selected = NO;
|
||||
self.selectedCell = selectedCell;
|
||||
}
|
||||
|
||||
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
|
||||
|
|
|
@ -27,13 +27,14 @@
|
|||
|
||||
- (void)setSelectedCell:(SelectableCell *)cell
|
||||
{
|
||||
if ([_selectedCell isEqual:cell])
|
||||
SelectableCell * selectedCell = _selectedCell;
|
||||
if (selectedCell == cell)
|
||||
return;
|
||||
|
||||
_selectedCell.accessoryType = UITableViewCellAccessoryNone;
|
||||
selectedCell.accessoryType = UITableViewCellAccessoryNone;
|
||||
cell.accessoryType = UITableViewCellAccessoryCheckmark;
|
||||
cell.selected = NO;
|
||||
_selectedCell = cell;
|
||||
_selectedCell.accessoryType = UITableViewCellAccessoryCheckmark;
|
||||
_selectedCell.selected = NO;
|
||||
if (cell == self.kilometers)
|
||||
{
|
||||
[Statistics logEvent:kStatEventName(kStatSettings, kStatChangeMeasureUnits)
|
||||
|
|
Loading…
Add table
Reference in a new issue