diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2019-03-01 20:39:37 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-03-03 00:03:13 +0300 |
commit | 05711a847b12b937b441826cca63477ec2ce67b5 (patch) | |
tree | 903ef22268fc41b1e7e5dcabb4215a6edcc6542b /iphone | |
parent | 2dfefa3ae7ad1a77aa1429c7f4e99720fb4b6481 (diff) |
[editor] review fixes
Diffstat (limited to 'iphone')
12 files changed, 37 insertions, 36 deletions
diff --git a/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationCommon.h b/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationCommon.h index 267dc2a035..4c2eeaaed6 100644 --- a/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationCommon.h +++ b/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationCommon.h @@ -14,10 +14,10 @@ UIColor * AuthorizationButtonBackgroundColor(AuthorizationButtonType type); void AuthorizationConfigButton(UIButton * btn, AuthorizationButtonType type); // Deletes any stored credentials if called with empty key or secret. -void AuthorizationStoreCredentials(osm::TKeySecret const & keySecret); +void AuthorizationStoreCredentials(osm::KeySecret const & keySecret); BOOL AuthorizationHaveCredentials(); // Returns empty key and secret if user has not beed authorized. -osm::TKeySecret AuthorizationGetCredentials(); +osm::KeySecret AuthorizationGetCredentials(); void AuthorizationSetNeedCheck(BOOL needCheck); BOOL AuthorizationIsNeedCheck(); diff --git a/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationCommon.mm b/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationCommon.mm index be2d71fd0f..f62afcc009 100644 --- a/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationCommon.mm +++ b/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationCommon.mm @@ -13,7 +13,7 @@ NSString * const kOSMRequestSecret = @"OSMRequestSecret"; NSString * const kAuthNeedCheck = @"AuthNeedCheck"; NSString * const kOSMUserName = @"UDOsmUserName"; -void SetOSMUserNameWithCredentials(osm::TKeySecret const & keySecret) +void SetOSMUserNameWithCredentials(osm::KeySecret const & keySecret) { using namespace osm; dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ @@ -75,7 +75,7 @@ void AuthorizationConfigButton(UIButton * btn, AuthorizationButtonType type) [btn setBackgroundColor:[bgCol colorWithAlphaComponent:highlightedAlpha] forState:UIControlStateHighlighted]; } -void AuthorizationStoreCredentials(osm::TKeySecret const & keySecret) +void AuthorizationStoreCredentials(osm::KeySecret const & keySecret) { NSUserDefaults * ud = NSUserDefaults.standardUserDefaults; if (keySecret.first.empty() || keySecret.second.empty()) @@ -101,13 +101,13 @@ BOOL AuthorizationHaveCredentials() return requestToken && requestSecret; } -osm::TKeySecret AuthorizationGetCredentials() +osm::KeySecret AuthorizationGetCredentials() { NSUserDefaults * ud = NSUserDefaults.standardUserDefaults; NSString * requestToken = [ud stringForKey:kOSMRequestToken]; NSString * requestSecret = [ud stringForKey:kOSMRequestSecret]; if (requestToken && requestSecret) - return osm::TKeySecret(requestToken.UTF8String, requestSecret.UTF8String); + return osm::KeySecret(requestToken.UTF8String, requestSecret.UTF8String); return {}; } diff --git a/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationWebViewLoginViewController.mm b/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationWebViewLoginViewController.mm index 0ef6b7ec7a..8f22e65392 100644 --- a/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationWebViewLoginViewController.mm +++ b/iphone/Maps/Classes/CustomViews/Login/MWMAuthorizationWebViewLoginViewController.mm @@ -48,7 +48,7 @@ NSString * getVerifier(NSString * urlString) @implementation MWMAuthorizationWebViewLoginViewController { - TRequestToken m_requestToken; + RequestToken m_requestToken; } - (void)viewDidLoad @@ -77,7 +77,7 @@ NSString * getVerifier(NSString * urlString) OsmOAuth const auth = OsmOAuth::ServerAuth(); try { - OsmOAuth::TUrlRequestToken urt; + OsmOAuth::UrlRequestToken urt; switch (self.authType) { case MWMWebViewAuthorizationTypeGoogle: urt = auth.GetGoogleOAuthURL(); break; @@ -133,7 +133,7 @@ NSString * getVerifier(NSString * urlString) [self startSpinner]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ OsmOAuth const auth = OsmOAuth::ServerAuth(); - TKeySecret ks; + KeySecret ks; try { ks = auth.FinishAuthorization(self->m_requestToken, verifier.UTF8String); diff --git a/iphone/Maps/Core/Editor/MWMEditorHelper.mm b/iphone/Maps/Core/Editor/MWMEditorHelper.mm index 131482f786..316c0fcf7e 100644 --- a/iphone/Maps/Core/Editor/MWMEditorHelper.mm +++ b/iphone/Maps/Core/Editor/MWMEditorHelper.mm @@ -31,7 +31,7 @@ break; } }; - osm::TKeySecret const keySecret = osm_auth_ios::AuthorizationGetCredentials(); + osm::KeySecret const keySecret = osm_auth_ios::AuthorizationGetCredentials(); osm::Editor::Instance().UploadChanges( keySecret.first, keySecret.second, {{"created_by", diff --git a/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursCommon.h b/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursCommon.h index 255e8ab4b2..d9bb971075 100644 --- a/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursCommon.h +++ b/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursCommon.h @@ -6,6 +6,6 @@ NSDateComponents * dateComponentsFromTime(osmoh::Time const & time); NSDate * dateFromTime(osmoh::Time const & time); NSString * stringFromTime(osmoh::Time const & time); -NSString * stringFromOpeningDays(editor::ui::TOpeningDays const & openingDays); +NSString * stringFromOpeningDays(editor::ui::OpeningDays const & openingDays); BOOL isEveryDay(editor::ui::TimeTable const & timeTable); diff --git a/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursCommon.mm b/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursCommon.mm index 7db62904dc..d0020e5aec 100644 --- a/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursCommon.mm +++ b/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursCommon.mm @@ -24,7 +24,7 @@ NSString * stringFromTime(osmoh::Time const & time) return [fmt stringFromDate:dateFromTime(time)]; } -NSString * stringFromOpeningDays(editor::ui::TOpeningDays const & openingDays) +NSString * stringFromOpeningDays(editor::ui::OpeningDays const & openingDays) { NSCalendar * cal = NSCalendar.currentCalendar; cal.locale = NSLocale.currentLocale; diff --git a/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursModel.h b/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursModel.h index 63693a6687..815aee1e88 100644 --- a/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursModel.h +++ b/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursModel.h @@ -31,7 +31,7 @@ - (CGFloat)heightForIndexPath:(NSIndexPath * _Nonnull)indexPath withWidth:(CGFloat)width; - (void)fillCell:(MWMOpeningHoursTableViewCell * _Nonnull)cell atIndexPath:(NSIndexPath * _Nonnull)indexPath; - (NSUInteger)numberOfRowsInSection:(NSUInteger)section; -- (editor::ui::TOpeningDays)unhandledDays; +- (editor::ui::OpeningDays)unhandledDays; - (void)storeCachedData; - (void)updateOpeningHours; diff --git a/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursModel.mm b/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursModel.mm index 99ecc46926..8c77af82c4 100644 --- a/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursModel.mm +++ b/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursModel.mm @@ -89,7 +89,7 @@ using namespace osmoh; } } -- (ui::TTimeTableProxy)timeTableProxy:(NSUInteger)index +- (ui::TimeTableSet::Proxy)timeTableProxy:(NSUInteger)index { NSAssert(index < self.count, @"Invalid section index"); return timeTableSet.Get(index); @@ -123,7 +123,7 @@ using namespace osmoh; return self.sections[section].numberOfRows; } -- (ui::TOpeningDays)unhandledDays +- (ui::OpeningDays)unhandledDays { return timeTableSet.GetUnhandledDays(); } diff --git a/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursSection.h b/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursSection.h index 68342e0731..d612345a66 100644 --- a/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursSection.h +++ b/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursSection.h @@ -10,7 +10,7 @@ - (void)updateActiveSection:(NSUInteger)index; -- (editor::ui::TTimeTableProxy)timeTableProxy:(NSUInteger)index; +- (editor::ui::TimeTableSet::Proxy)timeTableProxy:(NSUInteger)index; - (void)deleteSchedule:(NSUInteger)index; @end diff --git a/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursSection.mm b/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursSection.mm index 15bbab09a7..c88c5e6028 100644 --- a/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursSection.mm +++ b/iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursSection.mm @@ -3,9 +3,10 @@ #import "MWMOpeningHoursTableViewCell.h" #import "SwiftBridge.h" -#include "3party/opening_hours/opening_hours.hpp" #include "editor/opening_hours_ui.hpp" +#include "3party/opening_hours/opening_hours.hpp" + extern NSDictionary * const kMWMOpeningHoursEditorTableCells; extern UITableViewRowAnimation const kMWMOpeningHoursEditorRowAnimation; @@ -114,7 +115,7 @@ using namespace osmoh; return cachedTime; BOOL const isClosed = [self cellKeyForRow:row] != MWMOpeningHoursEditorTimeSpanCell; - TTimeTableProxy tt = [self timeTableProxy]; + auto tt = [self timeTableProxy]; NSUInteger const index = isClosed ? [self closedTimeIndex:row] : 0; Timespan span = isClosed ? tt.GetExcludeTime()[index] : tt.GetOpeningTime(); return dateComponentsFromTime(isStart ? span.GetStart() : span.GetEnd()); @@ -125,7 +126,7 @@ using namespace osmoh; if (!startTime && !endTime) return; - TTimeTableProxy tt = [self timeTableProxy]; + auto tt = [self timeTableProxy]; NSUInteger const row = self.selectedRow.unsignedIntegerValue; NSUInteger const index = isClosed ? [self closedTimeIndex:row] : 0; Timespan span = isClosed ? tt.GetExcludeTime()[index] : tt.GetOpeningTime(); @@ -185,7 +186,7 @@ using namespace osmoh; NSUInteger const row = [self firstRowForKey:MWMOpeningHoursEditorAddClosedCell]; - TTimeTableProxy timeTable = [self timeTableProxy]; + auto timeTable = [self timeTableProxy]; NSUInteger const closedTimesCountBeforeUpdate = [self closedTimesCount]; @@ -217,7 +218,7 @@ using namespace osmoh; if (closedTimesCountBeforeUpdate == [self closedTimesCount]) { [self.delegate.tableView update:^{ - TTimeTableProxy timeTable = [self timeTableProxy]; + auto timeTable = [self timeTableProxy]; timeTable.RemoveExcludeTime([self closedTimeIndex:row]); timeTable.Commit(); @@ -232,8 +233,8 @@ using namespace osmoh; - (void)addSelectedDay:(Weekday)day { - TTimeTableProxy timeTable = [self timeTableProxy]; - TOpeningDays openingDays(timeTable.GetOpeningDays()); + auto timeTable = [self timeTableProxy]; + auto openingDays(timeTable.GetOpeningDays()); openingDays.insert(day); timeTable.SetOpeningDays(openingDays); timeTable.Commit(); @@ -242,8 +243,8 @@ using namespace osmoh; - (void)removeSelectedDay:(Weekday)day { - TTimeTableProxy timeTable = [self timeTableProxy]; - TOpeningDays openingDays(timeTable.GetOpeningDays()); + auto timeTable = [self timeTableProxy]; + auto openingDays(timeTable.GetOpeningDays()); openingDays.erase(day); timeTable.SetOpeningDays(openingDays); timeTable.Commit(); @@ -252,8 +253,8 @@ using namespace osmoh; - (BOOL)containsSelectedDay:(Weekday)day { - TTimeTableProxy timeTable = [self timeTableProxy]; - TOpeningDays const & openingDays = timeTable.GetOpeningDays(); + auto timeTable = [self timeTableProxy]; + auto const & openingDays = timeTable.GetOpeningDays(); return openingDays.find(day) != openingDays.end(); } @@ -312,7 +313,7 @@ using namespace osmoh; #pragma mark - Model -- (TTimeTableProxy)timeTableProxy +- (TimeTableSet::Proxy)timeTableProxy { return [self.delegate timeTableProxy:self.index]; } @@ -450,7 +451,7 @@ using namespace osmoh; NSUInteger const deleteScheduleCellShift = self.index != 0 ? 1 : 0; NSUInteger const oldRowCount = [self numberOfRowsForAllDay:currentAllDay] - deleteScheduleCellShift; NSUInteger const newRowCount = [self numberOfRowsForAllDay:allDay] - deleteScheduleCellShift; - TTimeTableProxy timeTable = [self timeTableProxy]; + auto timeTable = [self timeTableProxy]; timeTable.SetTwentyFourHours(allDay); timeTable.Commit(); [self refreshForNewRowCount:newRowCount oldRowCount:oldRowCount]; diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/OpeningHoursCell/MWMOpeningHours.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/OpeningHoursCell/MWMOpeningHours.mm index 4206bfa515..183bd86ddd 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/OpeningHoursCell/MWMOpeningHours.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/OpeningHoursCell/MWMOpeningHours.mm @@ -75,7 +75,7 @@ void addDay(ui::TimeTable const & tt, vector<Day> & allDays) allDays.emplace_back(workingDays, workingTimes, breaks); } -void addUnhandledDays(ui::TOpeningDays const & days, vector<Day> & allDays) +void addUnhandledDays(ui::OpeningDays const & days, vector<Day> & allDays) { if (!days.empty()) allDays.emplace_back(stringFromOpeningDays(days)); @@ -108,7 +108,7 @@ void addUnhandledDays(ui::TOpeningDays const & days, vector<Day> & allDays) for (auto const & tt : timeTableSet) { - ui::TOpeningDays const & workingDays = tt.GetOpeningDays(); + auto const & workingDays = tt.GetOpeningDays(); if (workingDays.find(today) != workingDays.end()) { hasCurrentDay = YES; diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/OpeningHoursCell/MWMPlacePageOpeningHoursCell.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/OpeningHoursCell/MWMPlacePageOpeningHoursCell.mm index b4a9eb5904..ebfa7e6259 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/OpeningHoursCell/MWMPlacePageOpeningHoursCell.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/OpeningHoursCell/MWMPlacePageOpeningHoursCell.mm @@ -112,8 +112,8 @@ WeekDayView getWeekDayView() [self.weekDaysView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; for (size_t idx = 0; idx < timeTablesCount; ++idx) { - ui::TTimeTableProxy tt = timeTableSet.Get(idx); - ui::TOpeningDays const & workingDays = tt.GetOpeningDays(); + auto tt = timeTableSet.Get(idx); + ui::OpeningDays const & workingDays = tt.GetOpeningDays(); if (workingDays.find(currentDay) != workingDays.end()) { haveCurrentDay = YES; @@ -149,7 +149,7 @@ WeekDayView getWeekDayView() [self alignTimeOffsets]; } -- (void)addCurrentDay:(ui::TTimeTableProxy)timeTable +- (void)addCurrentDay:(ui::TimeTableSet::Proxy)timeTable { WeekDayView cd = self.currentDay; NSString * label; @@ -186,7 +186,7 @@ WeekDayView getWeekDayView() [cd setClosed:NO]; } -- (void)addWeekDays:(ui::TTimeTableProxy)timeTable +- (void)addWeekDays:(ui::TimeTableSet::Proxy)timeTable { WeekDayView wd = getWeekDayView(); wd.currentDay = NO; @@ -210,7 +210,7 @@ WeekDayView getWeekDayView() - (void)addClosedDays { - editor::ui::TOpeningDays closedDays = timeTableSet.GetUnhandledDays(); + editor::ui::OpeningDays closedDays = timeTableSet.GetUnhandledDays(); if (closedDays.empty()) return; WeekDayView wd = getWeekDayView(); |