Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
15
iphone/CoreApi/CoreApi.modulemap
Normal file
15
iphone/CoreApi/CoreApi.modulemap
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
framework module CoreApi {
|
||||
header "AppInfo.h"
|
||||
header "MWMBookmarkColor.h"
|
||||
header "MWMCommon.h"
|
||||
header "MWMTypes.h"
|
||||
header "MWMBookmarksObserver.h"
|
||||
header "MWMBookmarksManager.h"
|
||||
header "MWMBookmarkGroup.h"
|
||||
header "MWMFrameworkHelper.h"
|
||||
header "MWMCarPlayBookmarkObject.h"
|
||||
header "MWMMapOverlayManager.h"
|
||||
header "MWMSearchFrameworkHelper.h"
|
||||
header "MWMNetworkPolicy.h"
|
||||
header "PlacePageBookmarkData.h"
|
||||
}
|
||||
792
iphone/CoreApi/CoreApi.xcodeproj/project.pbxproj
Normal file
792
iphone/CoreApi/CoreApi.xcodeproj/project.pbxproj
Normal file
|
|
@ -0,0 +1,792 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 54;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
470015F42342509C00EBF03D /* CoreApi.h in Headers */ = {isa = PBXBuildFile; fileRef = 470015F22342509C00EBF03D /* CoreApi.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
471527392491EDAA00E91BBA /* MWMBookmarkColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 471527382491EDA400E91BBA /* MWMBookmarkColor.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4718C4322355FC3C00640DF1 /* MWMNetworkPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 4718C4302355FC3C00640DF1 /* MWMNetworkPolicy.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4718C4332355FC3C00640DF1 /* MWMNetworkPolicy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4718C4312355FC3C00640DF1 /* MWMNetworkPolicy.mm */; };
|
||||
471AB98D23AB925D00F56D49 /* MWMMapSearchResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 471AB98B23AB925D00F56D49 /* MWMMapSearchResult.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
471AB98E23AB925D00F56D49 /* MWMMapSearchResult.mm in Sources */ = {isa = PBXBuildFile; fileRef = 471AB98C23AB925D00F56D49 /* MWMMapSearchResult.mm */; };
|
||||
471AB99123AB931000F56D49 /* MWMMapSearchResult+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 471AB98F23AB931000F56D49 /* MWMMapSearchResult+Core.h */; };
|
||||
472602A824092C5B00731135 /* MWMGeoUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 472602A624092C5B00731135 /* MWMGeoUtil.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
472602A924092C5B00731135 /* MWMGeoUtil.mm in Sources */ = {isa = PBXBuildFile; fileRef = 472602A724092C5B00731135 /* MWMGeoUtil.mm */; };
|
||||
475784C22344B422008291A4 /* Framework.h in Headers */ = {isa = PBXBuildFile; fileRef = 475784C02344B421008291A4 /* Framework.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
475784C32344B422008291A4 /* Framework.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 475784C12344B422008291A4 /* Framework.cpp */; };
|
||||
47942D6B237CC3D600DEFAE3 /* PlacePageData.h in Headers */ = {isa = PBXBuildFile; fileRef = 47942D51237CC3B500DEFAE3 /* PlacePageData.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47942D6C237CC3DE00DEFAE3 /* PlacePageData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47942D52237CC3B500DEFAE3 /* PlacePageData.mm */; };
|
||||
47942D6D237CC3E300DEFAE3 /* PlacePagePreviewData.h in Headers */ = {isa = PBXBuildFile; fileRef = 47942D53237CC3B500DEFAE3 /* PlacePagePreviewData.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47942D6E237CC3E800DEFAE3 /* PlacePagePreviewData+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 47942D54237CC3B500DEFAE3 /* PlacePagePreviewData+Core.h */; };
|
||||
47942D6F237CC3F400DEFAE3 /* PlacePageInfoData.h in Headers */ = {isa = PBXBuildFile; fileRef = 47942D56237CC3B500DEFAE3 /* PlacePageInfoData.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47942D70237CC40400DEFAE3 /* PlacePageInfoData+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 47942D57237CC3B500DEFAE3 /* PlacePageInfoData+Core.h */; };
|
||||
47942D71237CC40800DEFAE3 /* PlacePageInfoData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47942D58237CC3B500DEFAE3 /* PlacePageInfoData.mm */; };
|
||||
47942D72237CC40B00DEFAE3 /* OpeningHours.h in Headers */ = {isa = PBXBuildFile; fileRef = 47942D59237CC3B500DEFAE3 /* OpeningHours.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47942D73237CC41400DEFAE3 /* OpeningHours.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47942D5A237CC3B500DEFAE3 /* OpeningHours.mm */; };
|
||||
47942D82237CC52A00DEFAE3 /* MWMOpeningHours.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47942D80237CC52A00DEFAE3 /* MWMOpeningHours.mm */; };
|
||||
47942D83237CC52E00DEFAE3 /* MWMOpeningHours.h in Headers */ = {isa = PBXBuildFile; fileRef = 47942D81237CC52A00DEFAE3 /* MWMOpeningHours.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47942D86237CC55500DEFAE3 /* MWMOpeningHoursCommon.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47942D85237CC55500DEFAE3 /* MWMOpeningHoursCommon.mm */; };
|
||||
47942D87237CC55800DEFAE3 /* MWMOpeningHoursCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 47942D84237CC55400DEFAE3 /* MWMOpeningHoursCommon.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47942D88237CCA8800DEFAE3 /* PlacePagePreviewData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47942D55237CC3B500DEFAE3 /* PlacePagePreviewData.mm */; };
|
||||
47942D9C237D927800DEFAE3 /* PlacePageBookmarkData.h in Headers */ = {isa = PBXBuildFile; fileRef = 47942D9A237D927800DEFAE3 /* PlacePageBookmarkData.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47942D9D237D927800DEFAE3 /* PlacePageBookmarkData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47942D9B237D927800DEFAE3 /* PlacePageBookmarkData.mm */; };
|
||||
47942DA0237D954400DEFAE3 /* PlacePageBookmarkData+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 47942D9E237D954400DEFAE3 /* PlacePageBookmarkData+Core.h */; };
|
||||
47942DAB237ED9FE00DEFAE3 /* IOpeningHoursLocalization.h in Headers */ = {isa = PBXBuildFile; fileRef = 47942DAA237ED9FE00DEFAE3 /* IOpeningHoursLocalization.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
479F7047234F774100011E2E /* MWMFrameworkHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 479F7046234F774000011E2E /* MWMFrameworkHelper.mm */; };
|
||||
479F704A234F785B00011E2E /* MWMTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 479F7049234F785B00011E2E /* MWMTypes.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
479F704B234F78AB00011E2E /* MWMFrameworkHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 479F7045234F774000011E2E /* MWMFrameworkHelper.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
479F7056234FB7F200011E2E /* MWMBookmarksManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 479F7054234FB7F100011E2E /* MWMBookmarksManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
479F7057234FB7F200011E2E /* MWMBookmarksManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 479F7055234FB7F100011E2E /* MWMBookmarksManager.mm */; };
|
||||
479F705E234FBB8C00011E2E /* MWMBookmarkGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 479F705C234FBB8B00011E2E /* MWMBookmarkGroup.m */; };
|
||||
479F705F234FBB8F00011E2E /* MWMBookmarkGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 479F705D234FBB8C00011E2E /* MWMBookmarkGroup.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
479F7062234FBC4700011E2E /* MWMCarPlayBookmarkObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 479F7061234FBC4600011E2E /* MWMCarPlayBookmarkObject.mm */; };
|
||||
479F7063234FBC5900011E2E /* MWMCarPlayBookmarkObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 479F7060234FBC4500011E2E /* MWMCarPlayBookmarkObject.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47C637D62354AEBE00E12DE0 /* MWMMapOverlayManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47C637D42354AEBD00E12DE0 /* MWMMapOverlayManager.mm */; };
|
||||
47C637D72354AEBE00E12DE0 /* MWMMapOverlayManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 47C637D52354AEBE00E12DE0 /* MWMMapOverlayManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47C637DC2354B79B00E12DE0 /* MWMSearchFrameworkHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47C637DA2354B79A00E12DE0 /* MWMSearchFrameworkHelper.mm */; };
|
||||
47C637DD2354B79B00E12DE0 /* MWMSearchFrameworkHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 47C637DB2354B79B00E12DE0 /* MWMSearchFrameworkHelper.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47CA68DD2502022400671019 /* MWMBookmark.h in Headers */ = {isa = PBXBuildFile; fileRef = 47CA68DB2502022400671019 /* MWMBookmark.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47CA68DE2502022400671019 /* MWMBookmark.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47CA68DC2502022400671019 /* MWMBookmark.mm */; };
|
||||
47CA68E12506C01F00671019 /* MWMBookmark+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 47CA68DF2506C01F00671019 /* MWMBookmark+Core.h */; };
|
||||
47CA68E42506D29000671019 /* MWMBookmarkColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47CA68E32506D29000671019 /* MWMBookmarkColor.mm */; };
|
||||
47CA68E82506F61300671019 /* MWMTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 47CA68E62506F61300671019 /* MWMTrack.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47CA68E92506F61400671019 /* MWMTrack.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47CA68E72506F61300671019 /* MWMTrack.mm */; };
|
||||
47CA68EC2506F6F100671019 /* MWMTrack+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 47CA68EA2506F6F100671019 /* MWMTrack+Core.h */; };
|
||||
47D609DC234FE625008ECC47 /* MWMBookmarksObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 47D609DB234FE625008ECC47 /* MWMBookmarksObserver.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47D9019523AC22E500D9364C /* MWMMapUpdateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 47D9019323AC22E500D9364C /* MWMMapUpdateInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47D9019623AC22E500D9364C /* MWMMapUpdateInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47D9019423AC22E500D9364C /* MWMMapUpdateInfo.mm */; };
|
||||
47D9019923AC236100D9364C /* MWMMapUpdateInfo+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 47D9019723AC236100D9364C /* MWMMapUpdateInfo+Core.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47E8163623B1889C008FD836 /* MWMStorage.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47E8163423B1889B008FD836 /* MWMStorage.mm */; };
|
||||
47E8163723B188D3008FD836 /* MWMStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 47E8163523B1889B008FD836 /* MWMStorage.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47EEAFF42350CEDB005CF316 /* AppInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47EEAFF22350CEDA005CF316 /* AppInfo.mm */; };
|
||||
47EEAFF62350CF48005CF316 /* AppInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 47EEAFF32350CEDB005CF316 /* AppInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47EEAFF72350D060005CF316 /* MWMCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 47EEAFF52350CEF6005CF316 /* MWMCommon.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47F0D2152516847F00BC685E /* MWMBookmarksSection.h in Headers */ = {isa = PBXBuildFile; fileRef = 47F0D2132516847F00BC685E /* MWMBookmarksSection.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47F0D2162516847F00BC685E /* MWMBookmarksSection.m in Sources */ = {isa = PBXBuildFile; fileRef = 47F0D2142516847F00BC685E /* MWMBookmarksSection.m */; };
|
||||
47F4F1F923A3336C0022FD56 /* MWMMapNodeAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 47F4F1F723A3336B0022FD56 /* MWMMapNodeAttributes.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47F4F1FA23A3336C0022FD56 /* MWMMapNodeAttributes.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47F4F1F823A3336C0022FD56 /* MWMMapNodeAttributes.mm */; };
|
||||
47F4F1FD23A3D1AC0022FD56 /* MWMMapNodeAttributes+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 47F4F1FB23A3D1AC0022FD56 /* MWMMapNodeAttributes+Core.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47F701EF238C86F000D18E95 /* PlacePageButtonsData.h in Headers */ = {isa = PBXBuildFile; fileRef = 47F701ED238C86F000D18E95 /* PlacePageButtonsData.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
47F701F0238C86F000D18E95 /* PlacePageButtonsData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 47F701EE238C86F000D18E95 /* PlacePageButtonsData.mm */; };
|
||||
47F701F3238C877C00D18E95 /* PlacePageButtonsData+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 47F701F1238C877C00D18E95 /* PlacePageButtonsData+Core.h */; };
|
||||
9940622023EAC57900493D1A /* ElevationHeightPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 9940621E23EAC57900493D1A /* ElevationHeightPoint.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
9940622123EAC57900493D1A /* ElevationHeightPoint.m in Sources */ = {isa = PBXBuildFile; fileRef = 9940621F23EAC57900493D1A /* ElevationHeightPoint.m */; };
|
||||
9957FACE237AB01400855F48 /* DeepLinkParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 9957FACC237AB01400855F48 /* DeepLinkParser.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
9957FACF237AB01400855F48 /* DeepLinkParser.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9957FACD237AB01400855F48 /* DeepLinkParser.mm */; };
|
||||
9957FADB237ACB1100855F48 /* DeepLinkSearchData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9957FAD9237ACB1100855F48 /* DeepLinkSearchData.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
9957FADC237ACB1100855F48 /* DeepLinkSearchData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9957FADA237ACB1100855F48 /* DeepLinkSearchData.mm */; };
|
||||
9957FAE8237AE5B000855F48 /* Logger.h in Headers */ = {isa = PBXBuildFile; fileRef = 9957FAE6237AE5B000855F48 /* Logger.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
9957FAE9237AE5B000855F48 /* Logger.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9957FAE7237AE5B000855F48 /* Logger.mm */; };
|
||||
9974CA2923DF1968003FE824 /* ElevationProfileData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9974CA2723DF1968003FE824 /* ElevationProfileData.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
9974CA2A23DF1968003FE824 /* ElevationProfileData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9974CA2823DF1968003FE824 /* ElevationProfileData.mm */; };
|
||||
9974CA2D23DF197B003FE824 /* ElevationProfileData+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 9974CA2B23DF197B003FE824 /* ElevationProfileData+Core.h */; };
|
||||
AC6A585728057EF6003EABAF /* StringUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = AC6A585628057CC1003EABAF /* StringUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
CE838D272D9D834F00476DD0 /* PlacePagePhone.h in Headers */ = {isa = PBXBuildFile; fileRef = CE838D252D9D834F00476DD0 /* PlacePagePhone.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
CE838D282D9D834F00476DD0 /* PlacePagePhone.m in Sources */ = {isa = PBXBuildFile; fileRef = CE838D262D9D834F00476DD0 /* PlacePagePhone.m */; };
|
||||
ED0B1FF42CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.h in Headers */ = {isa = PBXBuildFile; fileRef = ED0B1FF22CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
ED0B1FF52CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED0B1FF32CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.mm */; };
|
||||
ED46DE3A2D09BE21007CACD6 /* PlacePageTrackData.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED46DE382D09BE21007CACD6 /* PlacePageTrackData.mm */; };
|
||||
ED46DE3B2D09BE21007CACD6 /* PlacePageTrackData.h in Headers */ = {isa = PBXBuildFile; fileRef = ED46DE372D09BE21007CACD6 /* PlacePageTrackData.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
ED46DE3C2D09BE21007CACD6 /* PlacePageTrackData+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = ED46DE392D09BE21007CACD6 /* PlacePageTrackData+Core.h */; };
|
||||
ED7306F42D0C5D2400523AA1 /* TrackInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED7306F12D0C5D2400523AA1 /* TrackInfo.mm */; };
|
||||
ED7306F52D0C5D2400523AA1 /* TrackInfo+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = ED7306F22D0C5D2400523AA1 /* TrackInfo+Core.h */; };
|
||||
ED7306F62D0C5D2400523AA1 /* TrackInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = ED7306F02D0C5D2400523AA1 /* TrackInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
ED965B0D2CD67A470049E39E /* DistanceFormatter.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED965B0A2CD67A470049E39E /* DistanceFormatter.mm */; };
|
||||
ED965B102CD67A470049E39E /* DistanceFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = ED965B092CD67A470049E39E /* DistanceFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
ED965B132CD67A9B0049E39E /* AltitudeFormatter.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED965B122CD67A9B0049E39E /* AltitudeFormatter.mm */; };
|
||||
ED965B142CD67A9B0049E39E /* AltitudeFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = ED965B112CD67A9B0049E39E /* AltitudeFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
ED965B222CD8F5AA0049E39E /* DurationFormatter.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED965B212CD8F5AA0049E39E /* DurationFormatter.mm */; };
|
||||
ED965B232CD8F5AA0049E39E /* DurationFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = ED965B202CD8F5AA0049E39E /* DurationFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
ED965B2A2CDA1C440049E39E /* DateTimeFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED965B282CDA159C0049E39E /* DateTimeFormatter.swift */; };
|
||||
EDC4E3512C5D222D009286A2 /* RecentlyDeletedCategory.mm in Sources */ = {isa = PBXBuildFile; fileRef = EDC4E34E2C5D222D009286A2 /* RecentlyDeletedCategory.mm */; };
|
||||
EDC4E3522C5D222D009286A2 /* RecentlyDeletedCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = EDC4E34F2C5D222D009286A2 /* RecentlyDeletedCategory.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
EDC4E3532C5D222D009286A2 /* RecentlyDeletedCategory+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = EDC4E3502C5D222D009286A2 /* RecentlyDeletedCategory+Core.h */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
470015EF2342509C00EBF03D /* CoreApi.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreApi.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
470015F22342509C00EBF03D /* CoreApi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CoreApi.h; sourceTree = "<group>"; };
|
||||
470015F32342509C00EBF03D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
4700161223425CFD00EBF03D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||
470016142342633D00EBF03D /* CoreApi.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = CoreApi.modulemap; sourceTree = "<group>"; };
|
||||
471527382491EDA400E91BBA /* MWMBookmarkColor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMBookmarkColor.h; sourceTree = "<group>"; };
|
||||
4718C4302355FC3C00640DF1 /* MWMNetworkPolicy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMNetworkPolicy.h; sourceTree = "<group>"; };
|
||||
4718C4312355FC3C00640DF1 /* MWMNetworkPolicy.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMNetworkPolicy.mm; sourceTree = "<group>"; };
|
||||
471AB98B23AB925D00F56D49 /* MWMMapSearchResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMMapSearchResult.h; sourceTree = "<group>"; };
|
||||
471AB98C23AB925D00F56D49 /* MWMMapSearchResult.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMMapSearchResult.mm; sourceTree = "<group>"; };
|
||||
471AB98F23AB931000F56D49 /* MWMMapSearchResult+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MWMMapSearchResult+Core.h"; sourceTree = "<group>"; };
|
||||
472602A624092C5B00731135 /* MWMGeoUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMGeoUtil.h; sourceTree = "<group>"; };
|
||||
472602A724092C5B00731135 /* MWMGeoUtil.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMGeoUtil.mm; sourceTree = "<group>"; };
|
||||
475784C02344B421008291A4 /* Framework.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Framework.h; sourceTree = "<group>"; };
|
||||
475784C12344B422008291A4 /* Framework.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Framework.cpp; sourceTree = "<group>"; };
|
||||
47942D51237CC3B500DEFAE3 /* PlacePageData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlacePageData.h; sourceTree = "<group>"; };
|
||||
47942D52237CC3B500DEFAE3 /* PlacePageData.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PlacePageData.mm; sourceTree = "<group>"; };
|
||||
47942D53237CC3B500DEFAE3 /* PlacePagePreviewData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlacePagePreviewData.h; sourceTree = "<group>"; };
|
||||
47942D54237CC3B500DEFAE3 /* PlacePagePreviewData+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PlacePagePreviewData+Core.h"; sourceTree = "<group>"; };
|
||||
47942D55237CC3B500DEFAE3 /* PlacePagePreviewData.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PlacePagePreviewData.mm; sourceTree = "<group>"; };
|
||||
47942D56237CC3B500DEFAE3 /* PlacePageInfoData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlacePageInfoData.h; sourceTree = "<group>"; };
|
||||
47942D57237CC3B500DEFAE3 /* PlacePageInfoData+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PlacePageInfoData+Core.h"; sourceTree = "<group>"; };
|
||||
47942D58237CC3B500DEFAE3 /* PlacePageInfoData.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PlacePageInfoData.mm; sourceTree = "<group>"; };
|
||||
47942D59237CC3B500DEFAE3 /* OpeningHours.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpeningHours.h; sourceTree = "<group>"; };
|
||||
47942D5A237CC3B500DEFAE3 /* OpeningHours.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = OpeningHours.mm; sourceTree = "<group>"; };
|
||||
47942D80237CC52A00DEFAE3 /* MWMOpeningHours.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMOpeningHours.mm; sourceTree = "<group>"; };
|
||||
47942D81237CC52A00DEFAE3 /* MWMOpeningHours.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMOpeningHours.h; sourceTree = "<group>"; };
|
||||
47942D84237CC55400DEFAE3 /* MWMOpeningHoursCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMOpeningHoursCommon.h; sourceTree = "<group>"; };
|
||||
47942D85237CC55500DEFAE3 /* MWMOpeningHoursCommon.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMOpeningHoursCommon.mm; sourceTree = "<group>"; };
|
||||
47942D9A237D927800DEFAE3 /* PlacePageBookmarkData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlacePageBookmarkData.h; sourceTree = "<group>"; };
|
||||
47942D9B237D927800DEFAE3 /* PlacePageBookmarkData.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PlacePageBookmarkData.mm; sourceTree = "<group>"; };
|
||||
47942D9E237D954400DEFAE3 /* PlacePageBookmarkData+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PlacePageBookmarkData+Core.h"; sourceTree = "<group>"; };
|
||||
47942DAA237ED9FE00DEFAE3 /* IOpeningHoursLocalization.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IOpeningHoursLocalization.h; sourceTree = "<group>"; };
|
||||
479834EE23426C0100724D1E /* common-debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "common-debug.xcconfig"; path = "../../xcode/common-debug.xcconfig"; sourceTree = "<group>"; };
|
||||
479834EF23426C0100724D1E /* common-release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "common-release.xcconfig"; path = "../../xcode/common-release.xcconfig"; sourceTree = "<group>"; };
|
||||
479F7045234F774000011E2E /* MWMFrameworkHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMFrameworkHelper.h; sourceTree = "<group>"; };
|
||||
479F7046234F774000011E2E /* MWMFrameworkHelper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMFrameworkHelper.mm; sourceTree = "<group>"; };
|
||||
479F7049234F785B00011E2E /* MWMTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMTypes.h; sourceTree = "<group>"; };
|
||||
479F7054234FB7F100011E2E /* MWMBookmarksManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMBookmarksManager.h; sourceTree = "<group>"; };
|
||||
479F7055234FB7F100011E2E /* MWMBookmarksManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMBookmarksManager.mm; sourceTree = "<group>"; };
|
||||
479F705C234FBB8B00011E2E /* MWMBookmarkGroup.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MWMBookmarkGroup.m; sourceTree = "<group>"; };
|
||||
479F705D234FBB8C00011E2E /* MWMBookmarkGroup.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMBookmarkGroup.h; sourceTree = "<group>"; };
|
||||
479F7060234FBC4500011E2E /* MWMCarPlayBookmarkObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMCarPlayBookmarkObject.h; sourceTree = "<group>"; };
|
||||
479F7061234FBC4600011E2E /* MWMCarPlayBookmarkObject.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMCarPlayBookmarkObject.mm; sourceTree = "<group>"; };
|
||||
47C637D42354AEBD00E12DE0 /* MWMMapOverlayManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMMapOverlayManager.mm; sourceTree = "<group>"; };
|
||||
47C637D52354AEBE00E12DE0 /* MWMMapOverlayManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMMapOverlayManager.h; sourceTree = "<group>"; };
|
||||
47C637DA2354B79A00E12DE0 /* MWMSearchFrameworkHelper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMSearchFrameworkHelper.mm; sourceTree = "<group>"; };
|
||||
47C637DB2354B79B00E12DE0 /* MWMSearchFrameworkHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMSearchFrameworkHelper.h; sourceTree = "<group>"; };
|
||||
47CA68DB2502022400671019 /* MWMBookmark.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMBookmark.h; sourceTree = "<group>"; };
|
||||
47CA68DC2502022400671019 /* MWMBookmark.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMBookmark.mm; sourceTree = "<group>"; };
|
||||
47CA68DF2506C01F00671019 /* MWMBookmark+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MWMBookmark+Core.h"; sourceTree = "<group>"; };
|
||||
47CA68E32506D29000671019 /* MWMBookmarkColor.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMBookmarkColor.mm; sourceTree = "<group>"; };
|
||||
47CA68E52506D38700671019 /* MWMBookmarkColor+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MWMBookmarkColor+Core.h"; sourceTree = "<group>"; };
|
||||
47CA68E62506F61300671019 /* MWMTrack.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMTrack.h; sourceTree = "<group>"; };
|
||||
47CA68E72506F61300671019 /* MWMTrack.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMTrack.mm; sourceTree = "<group>"; };
|
||||
47CA68EA2506F6F100671019 /* MWMTrack+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MWMTrack+Core.h"; sourceTree = "<group>"; };
|
||||
47D609DB234FE625008ECC47 /* MWMBookmarksObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMBookmarksObserver.h; sourceTree = "<group>"; };
|
||||
47D9019323AC22E500D9364C /* MWMMapUpdateInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMMapUpdateInfo.h; sourceTree = "<group>"; };
|
||||
47D9019423AC22E500D9364C /* MWMMapUpdateInfo.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMMapUpdateInfo.mm; sourceTree = "<group>"; };
|
||||
47D9019723AC236100D9364C /* MWMMapUpdateInfo+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MWMMapUpdateInfo+Core.h"; sourceTree = "<group>"; };
|
||||
47E8163423B1889B008FD836 /* MWMStorage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMStorage.mm; sourceTree = "<group>"; };
|
||||
47E8163523B1889B008FD836 /* MWMStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMStorage.h; sourceTree = "<group>"; };
|
||||
47EEAFF22350CEDA005CF316 /* AppInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = AppInfo.mm; sourceTree = "<group>"; };
|
||||
47EEAFF32350CEDB005CF316 /* AppInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppInfo.h; sourceTree = "<group>"; };
|
||||
47EEAFF52350CEF6005CF316 /* MWMCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMCommon.h; sourceTree = "<group>"; };
|
||||
47F0D2132516847F00BC685E /* MWMBookmarksSection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMBookmarksSection.h; sourceTree = "<group>"; };
|
||||
47F0D2142516847F00BC685E /* MWMBookmarksSection.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MWMBookmarksSection.m; sourceTree = "<group>"; };
|
||||
47F4F1F723A3336B0022FD56 /* MWMMapNodeAttributes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMMapNodeAttributes.h; sourceTree = "<group>"; };
|
||||
47F4F1F823A3336C0022FD56 /* MWMMapNodeAttributes.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMMapNodeAttributes.mm; sourceTree = "<group>"; };
|
||||
47F4F1FB23A3D1AC0022FD56 /* MWMMapNodeAttributes+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MWMMapNodeAttributes+Core.h"; sourceTree = "<group>"; };
|
||||
47F701ED238C86F000D18E95 /* PlacePageButtonsData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlacePageButtonsData.h; sourceTree = "<group>"; };
|
||||
47F701EE238C86F000D18E95 /* PlacePageButtonsData.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PlacePageButtonsData.mm; sourceTree = "<group>"; };
|
||||
47F701F1238C877C00D18E95 /* PlacePageButtonsData+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PlacePageButtonsData+Core.h"; sourceTree = "<group>"; };
|
||||
9940621E23EAC57900493D1A /* ElevationHeightPoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ElevationHeightPoint.h; sourceTree = "<group>"; };
|
||||
9940621F23EAC57900493D1A /* ElevationHeightPoint.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ElevationHeightPoint.m; sourceTree = "<group>"; };
|
||||
9957FACC237AB01400855F48 /* DeepLinkParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeepLinkParser.h; sourceTree = "<group>"; };
|
||||
9957FACD237AB01400855F48 /* DeepLinkParser.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DeepLinkParser.mm; sourceTree = "<group>"; };
|
||||
9957FAD9237ACB1100855F48 /* DeepLinkSearchData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeepLinkSearchData.h; sourceTree = "<group>"; };
|
||||
9957FADA237ACB1100855F48 /* DeepLinkSearchData.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DeepLinkSearchData.mm; sourceTree = "<group>"; };
|
||||
9957FAE6237AE5B000855F48 /* Logger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Logger.h; sourceTree = "<group>"; };
|
||||
9957FAE7237AE5B000855F48 /* Logger.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = Logger.mm; sourceTree = "<group>"; };
|
||||
9974CA2723DF1968003FE824 /* ElevationProfileData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ElevationProfileData.h; sourceTree = "<group>"; };
|
||||
9974CA2823DF1968003FE824 /* ElevationProfileData.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ElevationProfileData.mm; sourceTree = "<group>"; };
|
||||
9974CA2B23DF197B003FE824 /* ElevationProfileData+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ElevationProfileData+Core.h"; sourceTree = "<group>"; };
|
||||
AC6A585628057CC1003EABAF /* StringUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringUtils.h; sourceTree = "<group>"; };
|
||||
CE838D252D9D834F00476DD0 /* PlacePagePhone.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlacePagePhone.h; sourceTree = "<group>"; };
|
||||
CE838D262D9D834F00476DD0 /* PlacePagePhone.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PlacePagePhone.m; sourceTree = "<group>"; };
|
||||
ED0B1FF22CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeepLinkInAppFeatureHighlightData.h; sourceTree = "<group>"; };
|
||||
ED0B1FF32CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DeepLinkInAppFeatureHighlightData.mm; sourceTree = "<group>"; };
|
||||
ED46DE372D09BE21007CACD6 /* PlacePageTrackData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlacePageTrackData.h; sourceTree = "<group>"; };
|
||||
ED46DE382D09BE21007CACD6 /* PlacePageTrackData.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PlacePageTrackData.mm; sourceTree = "<group>"; };
|
||||
ED46DE392D09BE21007CACD6 /* PlacePageTrackData+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PlacePageTrackData+Core.h"; sourceTree = "<group>"; };
|
||||
ED7306F02D0C5D2400523AA1 /* TrackInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TrackInfo.h; sourceTree = "<group>"; };
|
||||
ED7306F12D0C5D2400523AA1 /* TrackInfo.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TrackInfo.mm; sourceTree = "<group>"; };
|
||||
ED7306F22D0C5D2400523AA1 /* TrackInfo+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TrackInfo+Core.h"; sourceTree = "<group>"; };
|
||||
ED965B092CD67A470049E39E /* DistanceFormatter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DistanceFormatter.h; sourceTree = "<group>"; };
|
||||
ED965B0A2CD67A470049E39E /* DistanceFormatter.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DistanceFormatter.mm; sourceTree = "<group>"; };
|
||||
ED965B112CD67A9B0049E39E /* AltitudeFormatter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AltitudeFormatter.h; sourceTree = "<group>"; };
|
||||
ED965B122CD67A9B0049E39E /* AltitudeFormatter.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AltitudeFormatter.mm; sourceTree = "<group>"; };
|
||||
ED965B202CD8F5AA0049E39E /* DurationFormatter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DurationFormatter.h; sourceTree = "<group>"; };
|
||||
ED965B212CD8F5AA0049E39E /* DurationFormatter.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DurationFormatter.mm; sourceTree = "<group>"; };
|
||||
ED965B282CDA159C0049E39E /* DateTimeFormatter.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = DateTimeFormatter.swift; sourceTree = "<group>"; tabWidth = 4; };
|
||||
EDC4E34E2C5D222D009286A2 /* RecentlyDeletedCategory.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RecentlyDeletedCategory.mm; sourceTree = "<group>"; };
|
||||
EDC4E34F2C5D222D009286A2 /* RecentlyDeletedCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecentlyDeletedCategory.h; sourceTree = "<group>"; };
|
||||
EDC4E3502C5D222D009286A2 /* RecentlyDeletedCategory+Core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RecentlyDeletedCategory+Core.h"; sourceTree = "<group>"; };
|
||||
FAA6D8CF29205D2D00E8D50D /* libcppjansson.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libcppjansson.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
470015EC2342509C00EBF03D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
470015E52342509C00EBF03D = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
479834EE23426C0100724D1E /* common-debug.xcconfig */,
|
||||
479834EF23426C0100724D1E /* common-release.xcconfig */,
|
||||
4700160B2342562200EBF03D /* Target Support Files */,
|
||||
470015F12342509C00EBF03D /* CoreApi */,
|
||||
470015F02342509C00EBF03D /* Products */,
|
||||
4700161123425CFC00EBF03D /* Frameworks */,
|
||||
);
|
||||
indentWidth = 2;
|
||||
sourceTree = "<group>";
|
||||
tabWidth = 2;
|
||||
};
|
||||
470015F02342509C00EBF03D /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
470015EF2342509C00EBF03D /* CoreApi.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
470015F12342509C00EBF03D /* CoreApi */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
ED965B0B2CD67A470049E39E /* Formatting */,
|
||||
47F4F1F623A333280022FD56 /* Storage */,
|
||||
9957FAE5237AE59C00855F48 /* Logger */,
|
||||
9957FAC1237AABD800855F48 /* DeepLink */,
|
||||
47942D6A237CC3B500DEFAE3 /* PlacePageData */,
|
||||
4718C42F2355FC0D00640DF1 /* NetworkPolicy */,
|
||||
47C637D92354B76700E12DE0 /* Search */,
|
||||
47C637D32354AEA800E12DE0 /* Traffic */,
|
||||
479F704C234FB5C800011E2E /* Bookmarks */,
|
||||
479F7048234F784B00011E2E /* Common */,
|
||||
477C775523435B69001C5B4E /* Framework */,
|
||||
470015F22342509C00EBF03D /* CoreApi.h */,
|
||||
470015F32342509C00EBF03D /* Info.plist */,
|
||||
);
|
||||
path = CoreApi;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4700160B2342562200EBF03D /* Target Support Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
470016142342633D00EBF03D /* CoreApi.modulemap */,
|
||||
);
|
||||
name = "Target Support Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4700161123425CFC00EBF03D /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FAA6D8CF29205D2D00E8D50D /* libcppjansson.a */,
|
||||
4700161223425CFD00EBF03D /* UIKit.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4718C42F2355FC0D00640DF1 /* NetworkPolicy */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4718C4302355FC3C00640DF1 /* MWMNetworkPolicy.h */,
|
||||
4718C4312355FC3C00640DF1 /* MWMNetworkPolicy.mm */,
|
||||
);
|
||||
path = NetworkPolicy;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
477C775523435B69001C5B4E /* Framework */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
475784C12344B422008291A4 /* Framework.cpp */,
|
||||
475784C02344B421008291A4 /* Framework.h */,
|
||||
479F7045234F774000011E2E /* MWMFrameworkHelper.h */,
|
||||
479F7046234F774000011E2E /* MWMFrameworkHelper.mm */,
|
||||
);
|
||||
path = Framework;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
47942D5B237CC3B500DEFAE3 /* Common */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
ED46DE372D09BE21007CACD6 /* PlacePageTrackData.h */,
|
||||
ED46DE382D09BE21007CACD6 /* PlacePageTrackData.mm */,
|
||||
ED46DE392D09BE21007CACD6 /* PlacePageTrackData+Core.h */,
|
||||
47942D9A237D927800DEFAE3 /* PlacePageBookmarkData.h */,
|
||||
47942D9E237D954400DEFAE3 /* PlacePageBookmarkData+Core.h */,
|
||||
47942D9B237D927800DEFAE3 /* PlacePageBookmarkData.mm */,
|
||||
CE838D252D9D834F00476DD0 /* PlacePagePhone.h */,
|
||||
CE838D262D9D834F00476DD0 /* PlacePagePhone.m */,
|
||||
47942D53237CC3B500DEFAE3 /* PlacePagePreviewData.h */,
|
||||
47942D54237CC3B500DEFAE3 /* PlacePagePreviewData+Core.h */,
|
||||
47942D55237CC3B500DEFAE3 /* PlacePagePreviewData.mm */,
|
||||
47942D56237CC3B500DEFAE3 /* PlacePageInfoData.h */,
|
||||
47942D57237CC3B500DEFAE3 /* PlacePageInfoData+Core.h */,
|
||||
47942D58237CC3B500DEFAE3 /* PlacePageInfoData.mm */,
|
||||
47942D59237CC3B500DEFAE3 /* OpeningHours.h */,
|
||||
47942D5A237CC3B500DEFAE3 /* OpeningHours.mm */,
|
||||
47942D81237CC52A00DEFAE3 /* MWMOpeningHours.h */,
|
||||
47942D80237CC52A00DEFAE3 /* MWMOpeningHours.mm */,
|
||||
47942D84237CC55400DEFAE3 /* MWMOpeningHoursCommon.h */,
|
||||
47942D85237CC55500DEFAE3 /* MWMOpeningHoursCommon.mm */,
|
||||
47942DAA237ED9FE00DEFAE3 /* IOpeningHoursLocalization.h */,
|
||||
47F701ED238C86F000D18E95 /* PlacePageButtonsData.h */,
|
||||
47F701F1238C877C00D18E95 /* PlacePageButtonsData+Core.h */,
|
||||
47F701EE238C86F000D18E95 /* PlacePageButtonsData.mm */,
|
||||
);
|
||||
path = Common;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
47942D6A237CC3B500DEFAE3 /* PlacePageData */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
47942D51237CC3B500DEFAE3 /* PlacePageData.h */,
|
||||
47942D52237CC3B500DEFAE3 /* PlacePageData.mm */,
|
||||
47942D5B237CC3B500DEFAE3 /* Common */,
|
||||
9974CA2623DF1931003FE824 /* ElevationProfile */,
|
||||
);
|
||||
path = PlacePageData;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
479F7048234F784B00011E2E /* Common */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AC6A585628057CC1003EABAF /* StringUtils.h */,
|
||||
479F7049234F785B00011E2E /* MWMTypes.h */,
|
||||
47EEAFF52350CEF6005CF316 /* MWMCommon.h */,
|
||||
47EEAFF32350CEDB005CF316 /* AppInfo.h */,
|
||||
47EEAFF22350CEDA005CF316 /* AppInfo.mm */,
|
||||
472602A624092C5B00731135 /* MWMGeoUtil.h */,
|
||||
472602A724092C5B00731135 /* MWMGeoUtil.mm */,
|
||||
);
|
||||
path = Common;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
479F704C234FB5C800011E2E /* Bookmarks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
479F7054234FB7F100011E2E /* MWMBookmarksManager.h */,
|
||||
479F7055234FB7F100011E2E /* MWMBookmarksManager.mm */,
|
||||
479F705D234FBB8C00011E2E /* MWMBookmarkGroup.h */,
|
||||
479F705C234FBB8B00011E2E /* MWMBookmarkGroup.m */,
|
||||
479F7060234FBC4500011E2E /* MWMCarPlayBookmarkObject.h */,
|
||||
479F7061234FBC4600011E2E /* MWMCarPlayBookmarkObject.mm */,
|
||||
47D609DB234FE625008ECC47 /* MWMBookmarksObserver.h */,
|
||||
471527382491EDA400E91BBA /* MWMBookmarkColor.h */,
|
||||
47CA68E52506D38700671019 /* MWMBookmarkColor+Core.h */,
|
||||
47CA68E32506D29000671019 /* MWMBookmarkColor.mm */,
|
||||
47CA68DB2502022400671019 /* MWMBookmark.h */,
|
||||
47CA68DF2506C01F00671019 /* MWMBookmark+Core.h */,
|
||||
47CA68DC2502022400671019 /* MWMBookmark.mm */,
|
||||
47CA68E62506F61300671019 /* MWMTrack.h */,
|
||||
47CA68EA2506F6F100671019 /* MWMTrack+Core.h */,
|
||||
ED7306F02D0C5D2400523AA1 /* TrackInfo.h */,
|
||||
ED7306F12D0C5D2400523AA1 /* TrackInfo.mm */,
|
||||
ED7306F22D0C5D2400523AA1 /* TrackInfo+Core.h */,
|
||||
47CA68E72506F61300671019 /* MWMTrack.mm */,
|
||||
47F0D2132516847F00BC685E /* MWMBookmarksSection.h */,
|
||||
47F0D2142516847F00BC685E /* MWMBookmarksSection.m */,
|
||||
EDC4E3542C5D2251009286A2 /* RecentlyDeletedCategory */,
|
||||
);
|
||||
path = Bookmarks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
47C637D32354AEA800E12DE0 /* Traffic */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
47C637D52354AEBE00E12DE0 /* MWMMapOverlayManager.h */,
|
||||
47C637D42354AEBD00E12DE0 /* MWMMapOverlayManager.mm */,
|
||||
);
|
||||
path = Traffic;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
47C637D92354B76700E12DE0 /* Search */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
47C637DB2354B79B00E12DE0 /* MWMSearchFrameworkHelper.h */,
|
||||
47C637DA2354B79A00E12DE0 /* MWMSearchFrameworkHelper.mm */,
|
||||
);
|
||||
path = Search;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
47F4F1F623A333280022FD56 /* Storage */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
47E8163523B1889B008FD836 /* MWMStorage.h */,
|
||||
47E8163423B1889B008FD836 /* MWMStorage.mm */,
|
||||
47F4F1F723A3336B0022FD56 /* MWMMapNodeAttributes.h */,
|
||||
47F4F1FB23A3D1AC0022FD56 /* MWMMapNodeAttributes+Core.h */,
|
||||
47F4F1F823A3336C0022FD56 /* MWMMapNodeAttributes.mm */,
|
||||
471AB98B23AB925D00F56D49 /* MWMMapSearchResult.h */,
|
||||
471AB98F23AB931000F56D49 /* MWMMapSearchResult+Core.h */,
|
||||
471AB98C23AB925D00F56D49 /* MWMMapSearchResult.mm */,
|
||||
47D9019323AC22E500D9364C /* MWMMapUpdateInfo.h */,
|
||||
47D9019723AC236100D9364C /* MWMMapUpdateInfo+Core.h */,
|
||||
47D9019423AC22E500D9364C /* MWMMapUpdateInfo.mm */,
|
||||
);
|
||||
path = Storage;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9957FAC1237AABD800855F48 /* DeepLink */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9957FADA237ACB1100855F48 /* DeepLinkSearchData.mm */,
|
||||
9957FAD9237ACB1100855F48 /* DeepLinkSearchData.h */,
|
||||
9957FACC237AB01400855F48 /* DeepLinkParser.h */,
|
||||
9957FACD237AB01400855F48 /* DeepLinkParser.mm */,
|
||||
ED0B1FF22CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.h */,
|
||||
ED0B1FF32CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.mm */,
|
||||
);
|
||||
path = DeepLink;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9957FAE5237AE59C00855F48 /* Logger */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9957FAE6237AE5B000855F48 /* Logger.h */,
|
||||
9957FAE7237AE5B000855F48 /* Logger.mm */,
|
||||
);
|
||||
path = Logger;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9974CA2623DF1931003FE824 /* ElevationProfile */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9974CA2723DF1968003FE824 /* ElevationProfileData.h */,
|
||||
9974CA2823DF1968003FE824 /* ElevationProfileData.mm */,
|
||||
9974CA2B23DF197B003FE824 /* ElevationProfileData+Core.h */,
|
||||
9940621E23EAC57900493D1A /* ElevationHeightPoint.h */,
|
||||
9940621F23EAC57900493D1A /* ElevationHeightPoint.m */,
|
||||
);
|
||||
path = ElevationProfile;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
ED965B0B2CD67A470049E39E /* Formatting */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
ED965B112CD67A9B0049E39E /* AltitudeFormatter.h */,
|
||||
ED965B122CD67A9B0049E39E /* AltitudeFormatter.mm */,
|
||||
ED965B092CD67A470049E39E /* DistanceFormatter.h */,
|
||||
ED965B0A2CD67A470049E39E /* DistanceFormatter.mm */,
|
||||
ED965B282CDA159C0049E39E /* DateTimeFormatter.swift */,
|
||||
ED965B202CD8F5AA0049E39E /* DurationFormatter.h */,
|
||||
ED965B212CD8F5AA0049E39E /* DurationFormatter.mm */,
|
||||
);
|
||||
path = Formatting;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EDC4E3542C5D2251009286A2 /* RecentlyDeletedCategory */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EDC4E34F2C5D222D009286A2 /* RecentlyDeletedCategory.h */,
|
||||
EDC4E34E2C5D222D009286A2 /* RecentlyDeletedCategory.mm */,
|
||||
EDC4E3502C5D222D009286A2 /* RecentlyDeletedCategory+Core.h */,
|
||||
);
|
||||
path = RecentlyDeletedCategory;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
470015EA2342509C00EBF03D /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9957FAE8237AE5B000855F48 /* Logger.h in Headers */,
|
||||
470015F42342509C00EBF03D /* CoreApi.h in Headers */,
|
||||
479F705F234FBB8F00011E2E /* MWMBookmarkGroup.h in Headers */,
|
||||
471AB99123AB931000F56D49 /* MWMMapSearchResult+Core.h in Headers */,
|
||||
ED965B102CD67A470049E39E /* DistanceFormatter.h in Headers */,
|
||||
47942D6D237CC3E300DEFAE3 /* PlacePagePreviewData.h in Headers */,
|
||||
47CA68DD2502022400671019 /* MWMBookmark.h in Headers */,
|
||||
ED7306F52D0C5D2400523AA1 /* TrackInfo+Core.h in Headers */,
|
||||
ED7306F62D0C5D2400523AA1 /* TrackInfo.h in Headers */,
|
||||
9940622023EAC57900493D1A /* ElevationHeightPoint.h in Headers */,
|
||||
9957FACE237AB01400855F48 /* DeepLinkParser.h in Headers */,
|
||||
9974CA2D23DF197B003FE824 /* ElevationProfileData+Core.h in Headers */,
|
||||
AC6A585728057EF6003EABAF /* StringUtils.h in Headers */,
|
||||
47F701EF238C86F000D18E95 /* PlacePageButtonsData.h in Headers */,
|
||||
47EEAFF72350D060005CF316 /* MWMCommon.h in Headers */,
|
||||
ED965B142CD67A9B0049E39E /* AltitudeFormatter.h in Headers */,
|
||||
47F0D2152516847F00BC685E /* MWMBookmarksSection.h in Headers */,
|
||||
ED46DE3B2D09BE21007CACD6 /* PlacePageTrackData.h in Headers */,
|
||||
ED46DE3C2D09BE21007CACD6 /* PlacePageTrackData+Core.h in Headers */,
|
||||
47CA68E82506F61300671019 /* MWMTrack.h in Headers */,
|
||||
472602A824092C5B00731135 /* MWMGeoUtil.h in Headers */,
|
||||
47D9019523AC22E500D9364C /* MWMMapUpdateInfo.h in Headers */,
|
||||
9957FADB237ACB1100855F48 /* DeepLinkSearchData.h in Headers */,
|
||||
479F7056234FB7F200011E2E /* MWMBookmarksManager.h in Headers */,
|
||||
47942D83237CC52E00DEFAE3 /* MWMOpeningHours.h in Headers */,
|
||||
4718C4322355FC3C00640DF1 /* MWMNetworkPolicy.h in Headers */,
|
||||
47CA68EC2506F6F100671019 /* MWMTrack+Core.h in Headers */,
|
||||
47F4F1FD23A3D1AC0022FD56 /* MWMMapNodeAttributes+Core.h in Headers */,
|
||||
9974CA2923DF1968003FE824 /* ElevationProfileData.h in Headers */,
|
||||
47C637DD2354B79B00E12DE0 /* MWMSearchFrameworkHelper.h in Headers */,
|
||||
47942D70237CC40400DEFAE3 /* PlacePageInfoData+Core.h in Headers */,
|
||||
47942DA0237D954400DEFAE3 /* PlacePageBookmarkData+Core.h in Headers */,
|
||||
479F704B234F78AB00011E2E /* MWMFrameworkHelper.h in Headers */,
|
||||
47D9019923AC236100D9364C /* MWMMapUpdateInfo+Core.h in Headers */,
|
||||
47942D6E237CC3E800DEFAE3 /* PlacePagePreviewData+Core.h in Headers */,
|
||||
47942D87237CC55800DEFAE3 /* MWMOpeningHoursCommon.h in Headers */,
|
||||
CE838D272D9D834F00476DD0 /* PlacePagePhone.h in Headers */,
|
||||
47942DAB237ED9FE00DEFAE3 /* IOpeningHoursLocalization.h in Headers */,
|
||||
479F7063234FBC5900011E2E /* MWMCarPlayBookmarkObject.h in Headers */,
|
||||
47E8163723B188D3008FD836 /* MWMStorage.h in Headers */,
|
||||
47EEAFF62350CF48005CF316 /* AppInfo.h in Headers */,
|
||||
EDC4E3532C5D222D009286A2 /* RecentlyDeletedCategory+Core.h in Headers */,
|
||||
47F701F3238C877C00D18E95 /* PlacePageButtonsData+Core.h in Headers */,
|
||||
47CA68E12506C01F00671019 /* MWMBookmark+Core.h in Headers */,
|
||||
471527392491EDAA00E91BBA /* MWMBookmarkColor.h in Headers */,
|
||||
47F4F1F923A3336C0022FD56 /* MWMMapNodeAttributes.h in Headers */,
|
||||
479F704A234F785B00011E2E /* MWMTypes.h in Headers */,
|
||||
47C637D72354AEBE00E12DE0 /* MWMMapOverlayManager.h in Headers */,
|
||||
47942D9C237D927800DEFAE3 /* PlacePageBookmarkData.h in Headers */,
|
||||
EDC4E3522C5D222D009286A2 /* RecentlyDeletedCategory.h in Headers */,
|
||||
47942D72237CC40B00DEFAE3 /* OpeningHours.h in Headers */,
|
||||
ED965B232CD8F5AA0049E39E /* DurationFormatter.h in Headers */,
|
||||
ED0B1FF42CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.h in Headers */,
|
||||
47942D6B237CC3D600DEFAE3 /* PlacePageData.h in Headers */,
|
||||
47D609DC234FE625008ECC47 /* MWMBookmarksObserver.h in Headers */,
|
||||
471AB98D23AB925D00F56D49 /* MWMMapSearchResult.h in Headers */,
|
||||
47942D6F237CC3F400DEFAE3 /* PlacePageInfoData.h in Headers */,
|
||||
475784C22344B422008291A4 /* Framework.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
470015EE2342509C00EBF03D /* CoreApi */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 470015F72342509C00EBF03D /* Build configuration list for PBXNativeTarget "CoreApi" */;
|
||||
buildPhases = (
|
||||
470015EA2342509C00EBF03D /* Headers */,
|
||||
470015EB2342509C00EBF03D /* Sources */,
|
||||
470015EC2342509C00EBF03D /* Frameworks */,
|
||||
470015ED2342509C00EBF03D /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = CoreApi;
|
||||
productName = CoreApi;
|
||||
productReference = 470015EF2342509C00EBF03D /* CoreApi.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
470015E62342509C00EBF03D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = YES;
|
||||
DefaultBuildSystemTypeForWorkspace = Latest;
|
||||
LastUpgradeCheck = 1510;
|
||||
ORGANIZATIONNAME = CoMaps;
|
||||
TargetAttributes = {
|
||||
470015EE2342509C00EBF03D = {
|
||||
CreatedOnToolsVersion = 10.2;
|
||||
LastSwiftMigration = 1600;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 470015E92342509C00EBF03D /* Build configuration list for PBXProject "CoreApi" */;
|
||||
compatibilityVersion = "Xcode 12.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 470015E52342509C00EBF03D;
|
||||
productRefGroup = 470015F02342509C00EBF03D /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
470015EE2342509C00EBF03D /* CoreApi */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
470015ED2342509C00EBF03D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
470015EB2342509C00EBF03D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9957FADC237ACB1100855F48 /* DeepLinkSearchData.mm in Sources */,
|
||||
ED0B1FF52CAAE3FF006E31A4 /* DeepLinkInAppFeatureHighlightData.mm in Sources */,
|
||||
9957FACF237AB01400855F48 /* DeepLinkParser.mm in Sources */,
|
||||
47F4F1FA23A3336C0022FD56 /* MWMMapNodeAttributes.mm in Sources */,
|
||||
47942D88237CCA8800DEFAE3 /* PlacePagePreviewData.mm in Sources */,
|
||||
47942D9D237D927800DEFAE3 /* PlacePageBookmarkData.mm in Sources */,
|
||||
47942D86237CC55500DEFAE3 /* MWMOpeningHoursCommon.mm in Sources */,
|
||||
9974CA2A23DF1968003FE824 /* ElevationProfileData.mm in Sources */,
|
||||
47942D82237CC52A00DEFAE3 /* MWMOpeningHours.mm in Sources */,
|
||||
ED965B132CD67A9B0049E39E /* AltitudeFormatter.mm in Sources */,
|
||||
47942D73237CC41400DEFAE3 /* OpeningHours.mm in Sources */,
|
||||
47C637DC2354B79B00E12DE0 /* MWMSearchFrameworkHelper.mm in Sources */,
|
||||
479F7062234FBC4700011E2E /* MWMCarPlayBookmarkObject.mm in Sources */,
|
||||
47942D6C237CC3DE00DEFAE3 /* PlacePageData.mm in Sources */,
|
||||
479F705E234FBB8C00011E2E /* MWMBookmarkGroup.m in Sources */,
|
||||
ED7306F42D0C5D2400523AA1 /* TrackInfo.mm in Sources */,
|
||||
47F0D2162516847F00BC685E /* MWMBookmarksSection.m in Sources */,
|
||||
479F7057234FB7F200011E2E /* MWMBookmarksManager.mm in Sources */,
|
||||
47942D71237CC40800DEFAE3 /* PlacePageInfoData.mm in Sources */,
|
||||
479F7047234F774100011E2E /* MWMFrameworkHelper.mm in Sources */,
|
||||
47D9019623AC22E500D9364C /* MWMMapUpdateInfo.mm in Sources */,
|
||||
47CA68E42506D29000671019 /* MWMBookmarkColor.mm in Sources */,
|
||||
471AB98E23AB925D00F56D49 /* MWMMapSearchResult.mm in Sources */,
|
||||
47C637D62354AEBE00E12DE0 /* MWMMapOverlayManager.mm in Sources */,
|
||||
475784C32344B422008291A4 /* Framework.cpp in Sources */,
|
||||
4718C4332355FC3C00640DF1 /* MWMNetworkPolicy.mm in Sources */,
|
||||
47CA68E92506F61400671019 /* MWMTrack.mm in Sources */,
|
||||
472602A924092C5B00731135 /* MWMGeoUtil.mm in Sources */,
|
||||
47F701F0238C86F000D18E95 /* PlacePageButtonsData.mm in Sources */,
|
||||
9940622123EAC57900493D1A /* ElevationHeightPoint.m in Sources */,
|
||||
CE838D282D9D834F00476DD0 /* PlacePagePhone.m in Sources */,
|
||||
ED965B2A2CDA1C440049E39E /* DateTimeFormatter.swift in Sources */,
|
||||
47EEAFF42350CEDB005CF316 /* AppInfo.mm in Sources */,
|
||||
47E8163623B1889C008FD836 /* MWMStorage.mm in Sources */,
|
||||
ED965B0D2CD67A470049E39E /* DistanceFormatter.mm in Sources */,
|
||||
EDC4E3512C5D222D009286A2 /* RecentlyDeletedCategory.mm in Sources */,
|
||||
ED46DE3A2D09BE21007CACD6 /* PlacePageTrackData.mm in Sources */,
|
||||
47CA68DE2502022400671019 /* MWMBookmark.mm in Sources */,
|
||||
9957FAE9237AE5B000855F48 /* Logger.mm in Sources */,
|
||||
ED965B222CD8F5AA0049E39E /* DurationFormatter.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
470015F52342509C00EBF03D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 479834EE23426C0100724D1E /* common-debug.xcconfig */;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(OMIM_ROOT)/3party/glm",
|
||||
"$(OMIM_ROOT)/3party/pugixml/pugixml/src",
|
||||
);
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
470015F62342509C00EBF03D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 479834EF23426C0100724D1E /* common-release.xcconfig */;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEFINES_MODULE = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(OMIM_ROOT)/3party/glm",
|
||||
"$(OMIM_ROOT)/3party/pugixml/pugixml/src",
|
||||
);
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
470015F82342509C00EBF03D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = CoreApi/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACH_O_TYPE = staticlib;
|
||||
MODULEMAP_FILE = CoreApi.modulemap;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
470015F92342509C00EBF03D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = CoreApi/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACH_O_TYPE = staticlib;
|
||||
MODULEMAP_FILE = CoreApi.modulemap;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = app.comaps.coreapi;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
470015E92342509C00EBF03D /* Build configuration list for PBXProject "CoreApi" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
470015F52342509C00EBF03D /* Debug */,
|
||||
470015F62342509C00EBF03D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
470015F72342509C00EBF03D /* Build configuration list for PBXNativeTarget "CoreApi" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
470015F82342509C00EBF03D /* Debug */,
|
||||
470015F92342509C00EBF03D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 470015E62342509C00EBF03D /* Project object */;
|
||||
}
|
||||
9
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmark+Core.h
Normal file
9
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmark+Core.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#import "MWMBookmark.h"
|
||||
|
||||
#include <CoreApi/Framework.h>
|
||||
|
||||
@interface MWMBookmark (Core)
|
||||
|
||||
- (instancetype)initWithMarkId:(MWMMarkID)markId bookmarkData:(Bookmark const *)bookmark;
|
||||
|
||||
@end
|
||||
21
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmark.h
Normal file
21
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmark.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
#import "MWMBookmarkColor.h"
|
||||
#import "MWMTypes.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
NS_SWIFT_NAME(Bookmark)
|
||||
@interface MWMBookmark : NSObject
|
||||
|
||||
@property(nonatomic, readonly) MWMMarkID bookmarkId;
|
||||
@property(nonatomic, readonly) NSString *bookmarkName;
|
||||
@property(nonatomic, readonly, nullable) NSString *bookmarkType;
|
||||
@property(nonatomic, readonly) MWMBookmarkColor bookmarkColor;
|
||||
@property(nonatomic, readonly) NSString *bookmarkIconName;
|
||||
@property(nonatomic, readonly) CLLocationCoordinate2D locationCoordinate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
29
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmark.mm
Normal file
29
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmark.mm
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#import "MWMBookmark+Core.h"
|
||||
#import "MWMBookmarkColor+Core.h"
|
||||
|
||||
@implementation MWMBookmark
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMBookmark (Core)
|
||||
|
||||
- (instancetype)initWithMarkId:(MWMMarkID)markId bookmarkData:(Bookmark const *)bookmark {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_bookmarkId = markId;
|
||||
_bookmarkName = @(bookmark->GetPreferredName().c_str());
|
||||
_bookmarkColor = convertKmlColor(bookmark->GetColor());
|
||||
_bookmarkIconName = [NSString stringWithFormat:@"%@%@",
|
||||
@"ic_bm_",
|
||||
[@(kml::ToString(bookmark->GetData().m_icon).c_str()) lowercaseString]];
|
||||
auto const &types = bookmark->GetData().m_featureTypes;
|
||||
if (!types.empty()) {
|
||||
_bookmarkType = @(kml::GetLocalizedFeatureType(types).c_str());
|
||||
}
|
||||
auto latlon = bookmark->GetLatLon();
|
||||
_locationCoordinate = CLLocationCoordinate2DMake(latlon.m_lat, latlon.m_lon);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
11
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarkColor+Core.h
Normal file
11
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarkColor+Core.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#import "MWMBookmarkColor.h"
|
||||
|
||||
#include <CoreApi/Framework.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
MWMBookmarkColor convertKmlColor(kml::PredefinedColor kmlColor);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
25
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarkColor.h
Normal file
25
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarkColor.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, MWMBookmarkColor) {
|
||||
MWMBookmarkColorNone = 0,
|
||||
MWMBookmarkColorRed,
|
||||
MWMBookmarkColorBlue,
|
||||
MWMBookmarkColorPurple,
|
||||
MWMBookmarkColorYellow,
|
||||
MWMBookmarkColorPink,
|
||||
MWMBookmarkColorBrown,
|
||||
MWMBookmarkColorGreen,
|
||||
MWMBookmarkColorOrange,
|
||||
|
||||
// Extended colors.
|
||||
MWMBookmarkColorDeepPurple,
|
||||
MWMBookmarkColorLightBlue,
|
||||
MWMBookmarkColorCyan,
|
||||
MWMBookmarkColorTeal,
|
||||
MWMBookmarkColorLime,
|
||||
MWMBookmarkColorDeepOrange,
|
||||
MWMBookmarkColorGray,
|
||||
MWMBookmarkColorBlueGray,
|
||||
|
||||
MWMBookmarkColorCount
|
||||
} NS_SWIFT_NAME(BookmarkColor);
|
||||
42
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarkColor.mm
Normal file
42
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarkColor.mm
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#import "MWMBookmarkColor+Core.h"
|
||||
|
||||
MWMBookmarkColor convertKmlColor(kml::PredefinedColor kmlColor) {
|
||||
switch (kmlColor) {
|
||||
case kml::PredefinedColor::None:
|
||||
return MWMBookmarkColorNone;
|
||||
case kml::PredefinedColor::Red:
|
||||
return MWMBookmarkColorRed;
|
||||
case kml::PredefinedColor::Blue:
|
||||
return MWMBookmarkColorBlue;
|
||||
case kml::PredefinedColor::Purple:
|
||||
return MWMBookmarkColorPurple;
|
||||
case kml::PredefinedColor::Yellow:
|
||||
return MWMBookmarkColorYellow;
|
||||
case kml::PredefinedColor::Pink:
|
||||
return MWMBookmarkColorPink;
|
||||
case kml::PredefinedColor::Brown:
|
||||
return MWMBookmarkColorBrown;
|
||||
case kml::PredefinedColor::Green:
|
||||
return MWMBookmarkColorGreen;
|
||||
case kml::PredefinedColor::Orange:
|
||||
return MWMBookmarkColorOrange;
|
||||
case kml::PredefinedColor::DeepPurple:
|
||||
return MWMBookmarkColorDeepPurple;
|
||||
case kml::PredefinedColor::LightBlue:
|
||||
return MWMBookmarkColorLightBlue;
|
||||
case kml::PredefinedColor::Cyan:
|
||||
return MWMBookmarkColorCyan;
|
||||
case kml::PredefinedColor::Teal:
|
||||
return MWMBookmarkColorTeal;
|
||||
case kml::PredefinedColor::Lime:
|
||||
return MWMBookmarkColorLime;
|
||||
case kml::PredefinedColor::DeepOrange:
|
||||
return MWMBookmarkColorDeepOrange;
|
||||
case kml::PredefinedColor::Gray:
|
||||
return MWMBookmarkColorGray;
|
||||
case kml::PredefinedColor::BlueGray:
|
||||
return MWMBookmarkColorBlueGray;
|
||||
case kml::PredefinedColor::Count:
|
||||
return MWMBookmarkColorCount;
|
||||
}
|
||||
}
|
||||
41
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarkGroup.h
Normal file
41
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarkGroup.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MWMTypes.h"
|
||||
|
||||
@class MWMBookmark;
|
||||
@class MWMTrack;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class MWMBookmarksManager;
|
||||
|
||||
NS_SWIFT_NAME(BookmarkGroup)
|
||||
@interface MWMBookmarkGroup : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
- (instancetype)initWithCategoryId:(MWMMarkGroupID)categoryId
|
||||
bookmarksManager:(MWMBookmarksManager *)manager;
|
||||
|
||||
@property(nonatomic, readonly) MWMMarkGroupID categoryId;
|
||||
@property(nonatomic, readonly) NSString *title;
|
||||
@property(nonatomic, readonly) NSString *author;
|
||||
@property(nonatomic, readonly) NSString *annotation;
|
||||
@property(nonatomic, readonly) NSString *detailedAnnotation;
|
||||
@property(nonatomic, readonly) NSString *serverId;
|
||||
@property(nonatomic, readonly, nullable) NSURL *imageUrl;
|
||||
@property(nonatomic, readonly) NSInteger bookmarksCount;
|
||||
@property(nonatomic, readonly) NSInteger trackCount;
|
||||
@property(nonatomic, readonly, getter=isVisible) BOOL visible;
|
||||
@property(nonatomic, readonly, getter=isEmpty) BOOL empty;
|
||||
@property(nonatomic, readonly) BOOL hasDescription;
|
||||
@property(nonatomic, readonly) BOOL isHtmlDescription;
|
||||
@property(nonatomic, readonly) MWMBookmarkGroupAccessStatus accessStatus;
|
||||
@property(nonatomic, readonly) NSArray<MWMBookmark *> *bookmarks;
|
||||
@property(nonatomic, readonly) NSArray<MWMTrack *> *tracks;
|
||||
@property(nonatomic, readonly) NSArray<MWMBookmarkGroup *> *collections;
|
||||
@property(nonatomic, readonly) NSArray<MWMBookmarkGroup *> *categories;
|
||||
@property(nonatomic, readonly) MWMBookmarkGroupType type;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
91
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarkGroup.m
Normal file
91
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarkGroup.m
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
#import "MWMBookmarkGroup.h"
|
||||
#import "MWMBookmarksManager.h"
|
||||
|
||||
@interface MWMBookmarkGroup ()
|
||||
|
||||
@property(weak, nonatomic) MWMBookmarksManager *manager;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMBookmarkGroup
|
||||
|
||||
- (instancetype)initWithCategoryId:(MWMMarkGroupID)categoryId
|
||||
bookmarksManager:(MWMBookmarksManager *)manager {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_manager = manager;
|
||||
_categoryId = categoryId;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)title {
|
||||
return [self.manager getCategoryName:self.categoryId];
|
||||
}
|
||||
|
||||
- (NSString *)author {
|
||||
return [self.manager getCategoryAuthorName:self.categoryId];
|
||||
}
|
||||
|
||||
- (NSString *)annotation {
|
||||
return [self.manager getCategoryAnnotation:self.categoryId];
|
||||
}
|
||||
|
||||
- (NSString *)detailedAnnotation {
|
||||
return [self.manager getCategoryDescription:self.categoryId];
|
||||
}
|
||||
|
||||
- (NSURL *)imageUrl {
|
||||
return [self.manager getCategoryImageUrl:self.categoryId];
|
||||
}
|
||||
|
||||
- (NSInteger)bookmarksCount {
|
||||
return [self.manager getCategoryMarksCount:self.categoryId];
|
||||
}
|
||||
|
||||
- (NSInteger)trackCount {
|
||||
return [self.manager getCategoryTracksCount:self.categoryId];
|
||||
}
|
||||
|
||||
- (BOOL)isVisible {
|
||||
return [self.manager isCategoryVisible:self.categoryId];
|
||||
}
|
||||
|
||||
- (BOOL)isEmpty {
|
||||
return [self.manager isCategoryEmpty:self.categoryId];
|
||||
}
|
||||
|
||||
- (BOOL)hasDescription {
|
||||
return [self.manager hasExtraInfo:self.categoryId];
|
||||
}
|
||||
|
||||
- (MWMBookmarkGroupAccessStatus)accessStatus {
|
||||
return [self.manager getCategoryAccessStatus:self.categoryId];
|
||||
}
|
||||
|
||||
- (NSArray<MWMBookmark *> *)bookmarks {
|
||||
return [self.manager bookmarksForGroup:self.categoryId];
|
||||
}
|
||||
|
||||
- (NSArray<MWMTrack *> *)tracks {
|
||||
return [self.manager tracksForGroup:self.categoryId];
|
||||
}
|
||||
|
||||
- (NSArray<MWMBookmarkGroup *> *)collections {
|
||||
return [self.manager collectionsForGroup:self.categoryId];
|
||||
}
|
||||
|
||||
- (NSArray<MWMBookmarkGroup *> *)categories {
|
||||
return [self.manager categoriesForGroup:self.categoryId];
|
||||
}
|
||||
|
||||
- (MWMBookmarkGroupType)type {
|
||||
return [self.manager getCategoryGroupType:self.categoryId];
|
||||
}
|
||||
|
||||
- (BOOL)isHtmlDescription {
|
||||
return [self.manager isHtmlDescription:self.categoryId];
|
||||
}
|
||||
|
||||
@end
|
||||
176
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksManager.h
Normal file
176
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksManager.h
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
#import "MWMTypes.h"
|
||||
|
||||
#import "MWMBookmarksObserver.h"
|
||||
#import "PlacePageBookmarkData.h"
|
||||
|
||||
@class MWMBookmark;
|
||||
@class MWMBookmarkGroup;
|
||||
@class MWMBookmarksSection;
|
||||
@class MWMCarPlayBookmarkObject;
|
||||
@class MWMTrack;
|
||||
@class RecentlyDeletedCategory;
|
||||
@class UIColor;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, MWMBookmarksSortingType) {
|
||||
MWMBookmarksSortingTypeByType,
|
||||
MWMBookmarksSortingTypeByDistance,
|
||||
MWMBookmarksSortingTypeByTime,
|
||||
MWMBookmarksSortingTypeByName
|
||||
} NS_SWIFT_NAME(BookmarksSortingType);
|
||||
|
||||
typedef void (^PingCompletionBlock)(BOOL success);
|
||||
typedef void (^ElevationPointChangedBlock)(double distance);
|
||||
typedef void (^SearchBookmarksCompletionBlock)(NSArray<MWMBookmark *> *bookmarks);
|
||||
typedef void (^SortBookmarksCompletionBlock)(NSArray<MWMBookmarksSection *> * _Nullable sortedSections);
|
||||
typedef void (^SharingResultCompletionHandler)(MWMBookmarksShareStatus status, NSURL * _Nullable urlToALocalFile);
|
||||
|
||||
@protocol RecentlyDeletedCategoriesManager <NSObject>
|
||||
- (uint64_t)recentlyDeletedCategoriesCount;
|
||||
- (NSArray<RecentlyDeletedCategory *> *)getRecentlyDeletedCategories;
|
||||
- (void)deleteRecentlyDeletedCategoryAtURLs:(NSArray<NSURL *> *)urls;
|
||||
- (void)recoverRecentlyDeletedCategoriesAtURLs:(NSArray<NSURL *> *)urls;
|
||||
@end
|
||||
|
||||
NS_SWIFT_NAME(BookmarksManager)
|
||||
@interface MWMBookmarksManager : NSObject<BookmarksObservable, RecentlyDeletedCategoriesManager>
|
||||
|
||||
+ (MWMBookmarksManager *)sharedManager;
|
||||
|
||||
- (BOOL)areBookmarksLoaded;
|
||||
- (void)loadBookmarks;
|
||||
- (void)loadBookmarkFile:(NSURL *)url;
|
||||
- (void)reloadCategoryAtFilePath:(NSString *)filePath;
|
||||
- (void)deleteCategoryAtFilePath:(NSString *)filePath;
|
||||
|
||||
- (BOOL)areAllCategoriesEmpty;
|
||||
- (BOOL)isCategoryEmpty:(MWMMarkGroupID)groupId;
|
||||
- (void)prepareForSearch:(MWMMarkGroupID)groupId;
|
||||
- (NSString *)getCategoryName:(MWMMarkGroupID)groupId;
|
||||
- (uint64_t)getCategoryMarksCount:(MWMMarkGroupID)groupId;
|
||||
- (uint64_t)getCategoryTracksCount:(MWMMarkGroupID)groupId;
|
||||
- (MWMBookmarkGroupAccessStatus)getCategoryAccessStatus:(MWMMarkGroupID)groupId;
|
||||
- (NSString *)getCategoryAnnotation:(MWMMarkGroupID)groupId;
|
||||
- (NSString *)getCategoryDescription:(MWMMarkGroupID)groupId;
|
||||
- (NSString *)getCategoryAuthorName:(MWMMarkGroupID)groupId;
|
||||
- (NSString *)getCategoryAuthorId:(MWMMarkGroupID)groupId;
|
||||
- (MWMBookmarkGroupType)getCategoryGroupType:(MWMMarkGroupID)groupId;
|
||||
- (nullable NSURL *)getCategoryImageUrl:(MWMMarkGroupID)groupId;
|
||||
- (BOOL)hasExtraInfo:(MWMMarkGroupID)groupId;
|
||||
- (BOOL)isHtmlDescription:(MWMMarkGroupID)groupId;
|
||||
|
||||
- (MWMMarkGroupID)createCategoryWithName:(NSString *)name;
|
||||
- (void)setCategory:(MWMMarkGroupID)groupId name:(NSString *)name;
|
||||
- (void)setCategory:(MWMMarkGroupID)groupId description:(NSString *)name;
|
||||
- (BOOL)isCategoryVisible:(MWMMarkGroupID)groupId;
|
||||
- (void)setCategory:(MWMMarkGroupID)groupId isVisible:(BOOL)isVisible;
|
||||
- (void)setUserCategoriesVisible:(BOOL)isVisible;
|
||||
- (void)deleteCategory:(MWMMarkGroupID)groupId;
|
||||
- (BOOL)checkCategoryName:(NSString *)name;
|
||||
- (BOOL)hasCategory:(MWMMarkGroupID)groupId;
|
||||
- (BOOL)hasBookmark:(MWMMarkID)bookmarkId;
|
||||
- (BOOL)hasTrack:(MWMTrackID)trackId;
|
||||
- (NSArray<NSNumber *> *)availableSortingTypes:(MWMMarkGroupID)groupId hasMyPosition:(BOOL)hasMyPosition;
|
||||
- (void)sortBookmarks:(MWMMarkGroupID)groupId
|
||||
sortingType:(MWMBookmarksSortingType)sortingType
|
||||
location:(CLLocation * _Nullable)location
|
||||
completion:(SortBookmarksCompletionBlock)completionBlock;
|
||||
- (BOOL)hasLastSortingType:(MWMMarkGroupID)groupId;
|
||||
- (MWMBookmarksSortingType)lastSortingType:(MWMMarkGroupID)groupId;
|
||||
- (void)resetLastSortingType:(MWMMarkGroupID)groupId;
|
||||
|
||||
- (NSArray<MWMCarPlayBookmarkObject *> *)bookmarksForCategory:(MWMMarkGroupID)categoryId;
|
||||
- (MWMMarkIDCollection)bookmarkIdsForCategory:(MWMMarkGroupID)categoryId;
|
||||
- (void)deleteBookmark:(MWMMarkID)bookmarkId;
|
||||
- (void)deleteTrack:(MWMTrackID)trackId;
|
||||
- (MWMBookmark *)bookmarkWithId:(MWMMarkID)bookmarkId;
|
||||
- (MWMTrack *)trackWithId:(MWMTrackID)trackId;
|
||||
- (NSArray<MWMBookmark *> *)bookmarksForGroup:(MWMMarkGroupID)groupId;
|
||||
- (NSArray<MWMTrack *> *)tracksForGroup:(MWMMarkGroupID)groupId;
|
||||
- (NSArray<MWMBookmarkGroup *> *)collectionsForGroup:(MWMMarkGroupID)groupId;
|
||||
- (NSArray<MWMBookmarkGroup *> *)categoriesForGroup:(MWMMarkGroupID)groupId;
|
||||
- (void)searchBookmarksGroup:(MWMMarkGroupID)groupId
|
||||
text:(NSString *)text
|
||||
completion:(SearchBookmarksCompletionBlock)completion;
|
||||
|
||||
- (MWMTrackIDCollection)trackIdsForCategory:(MWMMarkGroupID)categoryId;
|
||||
|
||||
/**
|
||||
Shares a specific category with the given group ID.
|
||||
|
||||
@param groupId The identifier for the category to be shared.
|
||||
@param fileType Text/Binary/GPX
|
||||
@param completion A block that handles the result of the share operation and takes two parameters:
|
||||
- status: The status of the share operation, of type `MWMBookmarksShareStatus`.
|
||||
- urlToALocalFile: The local file URL containing the shared data. This parameter is guaranteed to be non-nil only if `status` is `MWMBookmarksShareStatusSuccess`. In other cases, it will be nil.
|
||||
*/
|
||||
- (void)shareCategory:(MWMMarkGroupID)groupId fileType:(MWMKmlFileType)fileType completion:(SharingResultCompletionHandler)completion;
|
||||
/**
|
||||
Shares all categories.
|
||||
|
||||
@param completion A block that handles the result of the share operation and takes two parameters:
|
||||
- status: The status of the share operation, of type `MWMBookmarksShareStatus`.
|
||||
- urlToALocalFile: The local file URL containing the shared data. This parameter is guaranteed to be non-nil only if `status` is `MWMBookmarksShareStatusSuccess`. In other cases, it will be nil.
|
||||
*/
|
||||
- (void)shareAllCategoriesWithCompletion:(SharingResultCompletionHandler)completion;
|
||||
|
||||
/**
|
||||
Shares a specific track with the given track ID.
|
||||
|
||||
@param trackId The identifier for the track to be shared.
|
||||
@param fileType Text/Binary/GPX
|
||||
*/
|
||||
- (void)shareTrack:(MWMTrackID)trackId fileType:(MWMKmlFileType)fileType completion:(SharingResultCompletionHandler)completion;
|
||||
- (void)finishSharing;
|
||||
|
||||
- (void)setNotificationsEnabled:(BOOL)enabled;
|
||||
- (BOOL)areNotificationsEnabled;
|
||||
|
||||
- (NSArray<MWMBookmarkGroup *> *)sortedUserCategories;
|
||||
- (size_t)userCategoriesCount;
|
||||
- (MWMBookmarkGroup *)categoryWithId:(MWMMarkGroupID)groupId;
|
||||
- (MWMBookmarkGroup *)categoryForBookmarkId:(MWMMarkID)bookmarkId;
|
||||
- (MWMBookmarkGroup *)categoryForTrackId:(MWMTrackID)trackId;
|
||||
- (NSString *)descriptionForBookmarkId:(MWMMarkID)bookmarkId;
|
||||
- (void)updateBookmark:(MWMMarkID)bookmarkId
|
||||
setGroupId:(MWMMarkGroupID)groupId
|
||||
title:(NSString *)title
|
||||
color:(MWMBookmarkColor)color
|
||||
description:(NSString *)description;
|
||||
|
||||
- (void)updateBookmark:(MWMMarkID)bookmarkId
|
||||
setColor:(MWMBookmarkColor)color;
|
||||
|
||||
- (void)moveBookmark:(MWMMarkID)bookmarkId
|
||||
toGroupId:(MWMMarkGroupID)groupId;
|
||||
|
||||
- (void)updateTrack:(MWMTrackID)trackId
|
||||
setGroupId:(MWMMarkGroupID)groupId
|
||||
color:(UIColor *)color
|
||||
title:(NSString *)title;
|
||||
|
||||
- (void)updateTrack:(MWMTrackID)trackId
|
||||
setColor:(UIColor *)color;
|
||||
|
||||
- (void)moveTrack:(MWMTrackID)trackId
|
||||
toGroupId:(MWMMarkGroupID)groupId;
|
||||
|
||||
- (BOOL)hasRecentlyDeletedBookmark;
|
||||
|
||||
- (instancetype)init __attribute__((unavailable("call +manager instead")));
|
||||
- (instancetype)copy __attribute__((unavailable("call +manager instead")));
|
||||
- (instancetype)copyWithZone:(NSZone *)zone __attribute__((unavailable("call +manager instead")));
|
||||
+ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable("call +manager instead")));
|
||||
+ (instancetype) new __attribute__((unavailable("call +manager instead")));
|
||||
|
||||
- (void)setElevationActivePoint:(CLLocationCoordinate2D)point distance:(double)distance trackId:(uint64_t)trackId;
|
||||
- (void)setElevationActivePointChanged:(uint64_t)trackId callback:(ElevationPointChangedBlock)callback;
|
||||
- (void)resetElevationActivePointChanged;
|
||||
- (void)setElevationMyPositionChanged:(uint64_t)trackId callback:(ElevationPointChangedBlock)callback;
|
||||
- (void)resetElevationMyPositionChanged;
|
||||
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
884
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksManager.mm
Normal file
884
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksManager.mm
Normal file
|
|
@ -0,0 +1,884 @@
|
|||
#import "MWMBookmarksManager.h"
|
||||
|
||||
#import "MWMBookmark+Core.h"
|
||||
#import "MWMBookmarksSection.h"
|
||||
#import "MWMBookmarkGroup.h"
|
||||
#import "MWMCarPlayBookmarkObject.h"
|
||||
#import "MWMTrack+Core.h"
|
||||
#import "RecentlyDeletedCategory+Core.h"
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
#include "map/bookmarks_search_params.hpp"
|
||||
|
||||
#include "coding/internal/file_data.hpp"
|
||||
|
||||
#include "base/stl_helpers.hpp"
|
||||
#include "base/string_utils.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
static kml::PredefinedColor kmlColorFromBookmarkColor(MWMBookmarkColor bookmarkColor) {
|
||||
switch (bookmarkColor) {
|
||||
case MWMBookmarkColorNone:
|
||||
return kml::PredefinedColor::None;
|
||||
case MWMBookmarkColorRed:
|
||||
return kml::PredefinedColor::Red;
|
||||
case MWMBookmarkColorBlue:
|
||||
return kml::PredefinedColor::Blue;
|
||||
case MWMBookmarkColorPurple:
|
||||
return kml::PredefinedColor::Purple;
|
||||
case MWMBookmarkColorYellow:
|
||||
return kml::PredefinedColor::Yellow;
|
||||
case MWMBookmarkColorPink:
|
||||
return kml::PredefinedColor::Pink;
|
||||
case MWMBookmarkColorBrown:
|
||||
return kml::PredefinedColor::Brown;
|
||||
case MWMBookmarkColorGreen:
|
||||
return kml::PredefinedColor::Green;
|
||||
case MWMBookmarkColorOrange:
|
||||
return kml::PredefinedColor::Orange;
|
||||
case MWMBookmarkColorDeepPurple:
|
||||
return kml::PredefinedColor::DeepPurple;
|
||||
case MWMBookmarkColorLightBlue:
|
||||
return kml::PredefinedColor::LightBlue;
|
||||
case MWMBookmarkColorCyan:
|
||||
return kml::PredefinedColor::Cyan;
|
||||
case MWMBookmarkColorTeal:
|
||||
return kml::PredefinedColor::Teal;
|
||||
case MWMBookmarkColorLime:
|
||||
return kml::PredefinedColor::Lime;
|
||||
case MWMBookmarkColorDeepOrange:
|
||||
return kml::PredefinedColor::DeepOrange;
|
||||
case MWMBookmarkColorGray:
|
||||
return kml::PredefinedColor::Gray;
|
||||
case MWMBookmarkColorBlueGray:
|
||||
return kml::PredefinedColor::BlueGray;
|
||||
case MWMBookmarkColorCount:
|
||||
return kml::PredefinedColor::Count;
|
||||
}
|
||||
}
|
||||
|
||||
static MWMBookmarksSortingType convertSortingType(BookmarkManager::SortingType const &sortingType) {
|
||||
switch (sortingType) {
|
||||
case BookmarkManager::SortingType::ByType:
|
||||
return MWMBookmarksSortingTypeByType;
|
||||
case BookmarkManager::SortingType::ByDistance:
|
||||
return MWMBookmarksSortingTypeByDistance;
|
||||
case BookmarkManager::SortingType::ByTime:
|
||||
return MWMBookmarksSortingTypeByTime;
|
||||
case BookmarkManager::SortingType::ByName:
|
||||
return MWMBookmarksSortingTypeByName;
|
||||
}
|
||||
}
|
||||
|
||||
static BookmarkManager::SortingType convertSortingTypeToCore(MWMBookmarksSortingType sortingType) {
|
||||
switch (sortingType) {
|
||||
case MWMBookmarksSortingTypeByType:
|
||||
return BookmarkManager::SortingType::ByType;
|
||||
case MWMBookmarksSortingTypeByDistance:
|
||||
return BookmarkManager::SortingType::ByDistance;
|
||||
case MWMBookmarksSortingTypeByTime:
|
||||
return BookmarkManager::SortingType::ByTime;
|
||||
case MWMBookmarksSortingTypeByName:
|
||||
return BookmarkManager::SortingType::ByName;
|
||||
}
|
||||
}
|
||||
|
||||
static KmlFileType convertFileTypeToCore(MWMKmlFileType fileType) {
|
||||
switch (fileType) {
|
||||
case MWMKmlFileTypeText:
|
||||
return KmlFileType::Text;
|
||||
case MWMKmlFileTypeBinary:
|
||||
return KmlFileType::Binary;
|
||||
case MWMKmlFileTypeGpx:
|
||||
return KmlFileType::Gpx;
|
||||
}
|
||||
}
|
||||
|
||||
@interface MWMBookmarksManager ()
|
||||
|
||||
@property(nonatomic, readonly) BookmarkManager & bm;
|
||||
|
||||
@property(nonatomic) NSHashTable<id<MWMBookmarksObserver>> * observers;
|
||||
@property(nonatomic) BOOL areBookmarksLoaded;
|
||||
@property(nonatomic) NSURL * shareCategoryURL;
|
||||
@property(nonatomic) NSInteger lastSearchId;
|
||||
@property(nonatomic) NSInteger lastSortId;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMBookmarksManager
|
||||
|
||||
+ (instancetype)sharedManager
|
||||
{
|
||||
static MWMBookmarksManager * manager;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
manager = [[self alloc] initManager];
|
||||
});
|
||||
return manager;
|
||||
}
|
||||
|
||||
- (BookmarkManager &)bm
|
||||
{
|
||||
return GetFramework().GetBookmarkManager();
|
||||
}
|
||||
|
||||
- (void)addObserver:(id<MWMBookmarksObserver>)observer
|
||||
{
|
||||
[self.observers addObject:observer];
|
||||
}
|
||||
|
||||
- (void)removeObserver:(id<MWMBookmarksObserver>)observer
|
||||
{
|
||||
[self.observers removeObject:observer];
|
||||
}
|
||||
|
||||
- (instancetype)initManager
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
_observers = [NSHashTable<id<MWMBookmarksObserver>> weakObjectsHashTable];
|
||||
[self registerBookmarksObserver];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)registerBookmarksObserver
|
||||
{
|
||||
BookmarkManager::AsyncLoadingCallbacks bookmarkCallbacks;
|
||||
{
|
||||
__weak auto wSelf = self;
|
||||
bookmarkCallbacks.m_onStarted = [wSelf]() {
|
||||
wSelf.areBookmarksLoaded = NO;
|
||||
};
|
||||
}
|
||||
{
|
||||
__weak auto wSelf = self;
|
||||
bookmarkCallbacks.m_onFinished = [wSelf]() {
|
||||
__strong auto self = wSelf;
|
||||
if (!self)
|
||||
return;
|
||||
self.areBookmarksLoaded = YES;
|
||||
[self loopObservers:^(id<MWMBookmarksObserver> observer) {
|
||||
if ([observer respondsToSelector:@selector(onBookmarksLoadFinished)])
|
||||
[observer onBookmarksLoadFinished];
|
||||
}];
|
||||
};
|
||||
}
|
||||
{
|
||||
__weak auto wSelf = self;
|
||||
bookmarkCallbacks.m_onFileSuccess = [wSelf](std::string const & filePath,
|
||||
bool isTemporaryFile) {
|
||||
__strong __typeof(self) self = wSelf;
|
||||
[self loopObservers:^(id<MWMBookmarksObserver> observer) {
|
||||
if ([observer respondsToSelector:@selector(onBookmarksFileLoadSuccess)])
|
||||
[observer onBookmarksFileLoadSuccess];
|
||||
}];
|
||||
};
|
||||
}
|
||||
{
|
||||
__weak auto wSelf = self;
|
||||
bookmarkCallbacks.m_onFileError = [wSelf](std::string const & filePath, bool isTemporaryFile) {
|
||||
__strong __typeof(self) self = wSelf;
|
||||
[self loopObservers:^(id<MWMBookmarksObserver> observer) {
|
||||
if ([observer respondsToSelector:@selector(onBookmarksFileLoadError)])
|
||||
[observer onBookmarksFileLoadError];
|
||||
}];
|
||||
};
|
||||
}
|
||||
self.bm.SetAsyncLoadingCallbacks(std::move(bookmarkCallbacks));
|
||||
}
|
||||
|
||||
#pragma mark - Bookmarks loading
|
||||
|
||||
- (BOOL)areBookmarksLoaded
|
||||
{
|
||||
return _areBookmarksLoaded;
|
||||
}
|
||||
|
||||
- (void)loadBookmarks
|
||||
{
|
||||
self.bm.LoadBookmarks();
|
||||
}
|
||||
|
||||
- (void)loadBookmarkFile:(NSURL *)url
|
||||
{
|
||||
self.bm.LoadBookmark(url.path.UTF8String, false /* isTemporaryFile */);
|
||||
}
|
||||
|
||||
- (void)reloadCategoryAtFilePath:(NSString *)filePath
|
||||
{
|
||||
self.bm.ReloadBookmark(filePath.UTF8String);
|
||||
}
|
||||
|
||||
- (void)deleteCategoryAtFilePath:(NSString *)filePath
|
||||
{
|
||||
auto const groupId = self.bm.GetCategoryByFileName(filePath.UTF8String);
|
||||
if (groupId)
|
||||
[self deleteCategory:groupId];
|
||||
}
|
||||
|
||||
#pragma mark - Categories
|
||||
|
||||
- (BOOL)areAllCategoriesEmpty
|
||||
{
|
||||
return self.bm.AreAllCategoriesEmpty();
|
||||
}
|
||||
|
||||
- (BOOL)isCategoryEmpty:(MWMMarkGroupID)groupId {
|
||||
return self.bm.HasBmCategory(groupId) && self.bm.IsCategoryEmpty(groupId);
|
||||
}
|
||||
|
||||
- (void)prepareForSearch:(MWMMarkGroupID)groupId {
|
||||
self.bm.PrepareForSearch(groupId);
|
||||
}
|
||||
|
||||
- (NSString *)getCategoryName:(MWMMarkGroupID)groupId
|
||||
{
|
||||
return @(self.bm.GetCategoryName(groupId).c_str());
|
||||
}
|
||||
|
||||
- (uint64_t)getCategoryMarksCount:(MWMMarkGroupID)groupId
|
||||
{
|
||||
return self.bm.GetUserMarkIds(groupId).size();
|
||||
}
|
||||
|
||||
- (uint64_t)getCategoryTracksCount:(MWMMarkGroupID)groupId
|
||||
{
|
||||
return self.bm.GetTrackIds(groupId).size();
|
||||
}
|
||||
|
||||
- (MWMBookmarkGroupAccessStatus)getCategoryAccessStatus:(MWMMarkGroupID)groupId
|
||||
{
|
||||
switch (self.bm.GetCategoryData(groupId).m_accessRules)
|
||||
{
|
||||
case kml::AccessRules::Local:
|
||||
return MWMBookmarkGroupAccessStatusLocal;
|
||||
case kml::AccessRules::Public:
|
||||
return MWMBookmarkGroupAccessStatusPublic;
|
||||
case kml::AccessRules::DirectLink:
|
||||
return MWMBookmarkGroupAccessStatusPrivate;
|
||||
case kml::AccessRules::AuthorOnly:
|
||||
return MWMBookmarkGroupAccessStatusAuthorOnly;
|
||||
case kml::AccessRules::P2P:
|
||||
case kml::AccessRules::Paid:
|
||||
case kml::AccessRules::Count:
|
||||
return MWMBookmarkGroupAccessStatusOther;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)getCategoryAnnotation:(MWMMarkGroupID)groupId {
|
||||
return @(GetPreferredBookmarkStr(self.bm.GetCategoryData(groupId).m_annotation).c_str());
|
||||
}
|
||||
|
||||
- (NSString *)getCategoryDescription:(MWMMarkGroupID)groupId
|
||||
{
|
||||
return @(GetPreferredBookmarkStr(self.bm.GetCategoryData(groupId).m_description).c_str());
|
||||
}
|
||||
|
||||
- (NSString *)getCategoryAuthorName:(MWMMarkGroupID)groupId
|
||||
{
|
||||
return @(self.bm.GetCategoryData(groupId).m_authorName.c_str());
|
||||
}
|
||||
|
||||
- (NSString *)getCategoryAuthorId:(MWMMarkGroupID)groupId
|
||||
{
|
||||
return @(self.bm.GetCategoryData(groupId).m_authorId.c_str());
|
||||
}
|
||||
|
||||
- (MWMBookmarkGroupType)getCategoryGroupType:(MWMMarkGroupID)groupId {
|
||||
if (self.bm.IsCompilation(groupId) == false) {
|
||||
return MWMBookmarkGroupTypeRoot;
|
||||
}
|
||||
switch (self.bm.GetCompilationType(groupId)) {
|
||||
case kml::CompilationType::Category:
|
||||
return MWMBookmarkGroupTypeCategory;
|
||||
case kml::CompilationType::Collection:
|
||||
return MWMBookmarkGroupTypeCollection;
|
||||
case kml::CompilationType::Day:
|
||||
return MWMBookmarkGroupTypeDay;
|
||||
}
|
||||
return MWMBookmarkGroupTypeRoot;
|
||||
}
|
||||
|
||||
- (nullable NSURL *)getCategoryImageUrl:(MWMMarkGroupID)groupId {
|
||||
NSString *urlString = @(self.bm.GetCategoryData(groupId).m_imageUrl.c_str());
|
||||
return [NSURL URLWithString:urlString];
|
||||
}
|
||||
|
||||
- (BOOL)hasExtraInfo:(MWMMarkGroupID)groupId {
|
||||
auto data = self.bm.GetCategoryData(groupId);
|
||||
return !data.m_description.empty() || !data.m_annotation.empty();
|
||||
}
|
||||
|
||||
- (BOOL)isHtmlDescription:(MWMMarkGroupID)groupId {
|
||||
auto const description = GetPreferredBookmarkStr(self.bm.GetCategoryData(groupId).m_description);
|
||||
return strings::IsHTML(description);
|
||||
}
|
||||
|
||||
- (MWMMarkGroupID)createCategoryWithName:(NSString *)name
|
||||
{
|
||||
auto groupId = self.bm.CreateBookmarkCategory(name.UTF8String);
|
||||
self.bm.SetLastEditedBmCategory(groupId);
|
||||
return groupId;
|
||||
}
|
||||
|
||||
- (void)setCategory:(MWMMarkGroupID)groupId name:(NSString *)name
|
||||
{
|
||||
self.bm.GetEditSession().SetCategoryName(groupId, name.UTF8String);
|
||||
}
|
||||
|
||||
- (void)setCategory:(MWMMarkGroupID)groupId description:(NSString *)name
|
||||
{
|
||||
self.bm.GetEditSession().SetCategoryDescription(groupId, name.UTF8String);
|
||||
}
|
||||
|
||||
- (BOOL)isCategoryVisible:(MWMMarkGroupID)groupId
|
||||
{
|
||||
return self.bm.IsVisible(groupId);
|
||||
}
|
||||
|
||||
- (void)setCategory:(MWMMarkGroupID)groupId isVisible:(BOOL)isVisible
|
||||
{
|
||||
self.bm.GetEditSession().SetIsVisible(groupId, isVisible);
|
||||
}
|
||||
|
||||
- (void)setUserCategoriesVisible:(BOOL)isVisible {
|
||||
self.bm.SetAllCategoriesVisibility(isVisible);
|
||||
}
|
||||
|
||||
- (void)setCatalogCategoriesVisible:(BOOL)isVisible {
|
||||
self.bm.SetAllCategoriesVisibility(isVisible);
|
||||
}
|
||||
|
||||
- (void)deleteCategory:(MWMMarkGroupID)groupId
|
||||
{
|
||||
self.bm.GetEditSession().DeleteBmCategory(groupId, false /* move to the Trash */);
|
||||
[self loopObservers:^(id<MWMBookmarksObserver> observer) {
|
||||
if ([observer respondsToSelector:@selector(onBookmarksCategoryDeleted:)])
|
||||
[observer onBookmarksCategoryDeleted:groupId];
|
||||
}];
|
||||
}
|
||||
|
||||
- (BOOL)checkCategoryName:(NSString *)name
|
||||
{
|
||||
return !self.bm.IsUsedCategoryName(name.UTF8String);
|
||||
}
|
||||
|
||||
- (BOOL)hasCategory:(MWMMarkGroupID)groupId
|
||||
{
|
||||
return self.bm.HasBmCategory(groupId);
|
||||
}
|
||||
|
||||
- (BOOL)hasBookmark:(MWMMarkID)bookmarkId
|
||||
{
|
||||
return self.bm.HasBookmark(bookmarkId);
|
||||
}
|
||||
|
||||
- (BOOL)hasTrack:(MWMTrackID)trackId
|
||||
{
|
||||
return self.bm.HasTrack(trackId);
|
||||
}
|
||||
|
||||
- (NSArray<NSNumber *> *)availableSortingTypes:(MWMMarkGroupID)groupId hasMyPosition:(BOOL)hasMyPosition{
|
||||
auto const availableTypes = self.bm.GetAvailableSortingTypes(groupId, hasMyPosition);
|
||||
NSMutableArray *result = [NSMutableArray array];
|
||||
for (auto const &sortingType : availableTypes) {
|
||||
[result addObject:[NSNumber numberWithInteger:convertSortingType(sortingType)]];
|
||||
}
|
||||
return [result copy];
|
||||
}
|
||||
|
||||
- (void)sortBookmarks:(MWMMarkGroupID)groupId
|
||||
sortingType:(MWMBookmarksSortingType)sortingType
|
||||
location:(CLLocation *)location
|
||||
completion:(SortBookmarksCompletionBlock)completion {
|
||||
self.bm.SetLastSortingType(groupId, convertSortingTypeToCore(sortingType));
|
||||
m2::PointD myPosition = m2::PointD::Zero();
|
||||
|
||||
if (sortingType == MWMBookmarksSortingTypeByDistance) {
|
||||
if (!location) {
|
||||
completion(nil);
|
||||
return;
|
||||
}
|
||||
myPosition = mercator::FromLatLon(location.coordinate.latitude, location.coordinate.longitude);
|
||||
}
|
||||
|
||||
auto const sortId = ++self.lastSortId;
|
||||
__weak auto weakSelf = self;
|
||||
|
||||
BookmarkManager::SortParams sortParams;
|
||||
sortParams.m_groupId = groupId;
|
||||
sortParams.m_sortingType = convertSortingTypeToCore(sortingType);
|
||||
sortParams.m_hasMyPosition = location != nil;
|
||||
sortParams.m_myPosition = myPosition;
|
||||
sortParams.m_onResults = [weakSelf, sortId, completion] (BookmarkManager::SortedBlocksCollection &&sortedBlocks,
|
||||
BookmarkManager::SortParams::Status status) {
|
||||
__strong auto self = weakSelf;
|
||||
if (!self || sortId != self.lastSortId)
|
||||
return;
|
||||
|
||||
switch (status) {
|
||||
case BookmarkManager::SortParams::Status::Completed: {
|
||||
NSMutableArray *result = [NSMutableArray array];
|
||||
for (auto const &sortedBlock : sortedBlocks) {
|
||||
NSMutableArray *bookmarks = nil;
|
||||
if (sortedBlock.m_markIds.size() > 0) {
|
||||
bookmarks = [NSMutableArray array];
|
||||
for (auto const &markId : sortedBlock.m_markIds) {
|
||||
[bookmarks addObject:[[MWMBookmark alloc] initWithMarkId:markId
|
||||
bookmarkData:self.bm.GetBookmark(markId)]];
|
||||
}
|
||||
}
|
||||
NSMutableArray *tracks = nil;
|
||||
if (sortedBlock.m_trackIds.size() > 0) {
|
||||
tracks = [NSMutableArray array];
|
||||
for (auto const &trackId : sortedBlock.m_trackIds) {
|
||||
[tracks addObject:[[MWMTrack alloc] initWithTrackId:trackId trackData:self.bm.GetTrack(trackId)]];
|
||||
}
|
||||
}
|
||||
[result addObject:[[MWMBookmarksSection alloc] initWithTitle:@(sortedBlock.m_blockName.c_str())
|
||||
bookmarks:bookmarks
|
||||
tracks:tracks]];
|
||||
}
|
||||
completion([result copy]);
|
||||
break;
|
||||
}
|
||||
case BookmarkManager::SortParams::Status::Cancelled:
|
||||
completion(nil);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
self.bm.GetSortedCategory(sortParams);
|
||||
}
|
||||
|
||||
- (BOOL)hasLastSortingType:(MWMMarkGroupID)groupId {
|
||||
BookmarkManager::SortingType st;
|
||||
return self.bm.GetLastSortingType(groupId, st);
|
||||
}
|
||||
|
||||
- (MWMBookmarksSortingType)lastSortingType:(MWMMarkGroupID)groupId {
|
||||
BookmarkManager::SortingType st;
|
||||
self.bm.GetLastSortingType(groupId, st);
|
||||
return convertSortingType(st);
|
||||
}
|
||||
|
||||
- (void)resetLastSortingType:(MWMMarkGroupID)groupId {
|
||||
self.bm.ResetLastSortingType(groupId);
|
||||
}
|
||||
|
||||
#pragma mark - Bookmarks
|
||||
|
||||
- (NSArray<MWMCarPlayBookmarkObject *> *)bookmarksForCategory:(MWMMarkGroupID)categoryId
|
||||
{
|
||||
NSMutableArray<MWMCarPlayBookmarkObject *> * result = [NSMutableArray array];
|
||||
auto const & bookmarkIds = self.bm.GetUserMarkIds(categoryId);
|
||||
for (auto bookmarkId : bookmarkIds)
|
||||
{
|
||||
MWMCarPlayBookmarkObject *bookmark = [[MWMCarPlayBookmarkObject alloc] initWithBookmarkId:bookmarkId];
|
||||
[result addObject:bookmark];
|
||||
}
|
||||
return [result copy];
|
||||
}
|
||||
|
||||
- (MWMMarkIDCollection)bookmarkIdsForCategory:(MWMMarkGroupID)categoryId {
|
||||
auto const &bookmarkIds = self.bm.GetUserMarkIds(categoryId);
|
||||
NSMutableArray<NSNumber *> *collection = [[NSMutableArray alloc] initWithCapacity:bookmarkIds.size()];
|
||||
for (auto bookmarkId : bookmarkIds)
|
||||
[collection addObject:@(bookmarkId)];
|
||||
return [collection copy];
|
||||
}
|
||||
|
||||
- (void)deleteBookmark:(MWMMarkID)bookmarkId
|
||||
{
|
||||
self.bm.GetEditSession().DeleteBookmark(bookmarkId);
|
||||
[self loopObservers:^(id<MWMBookmarksObserver> observer) {
|
||||
if ([observer respondsToSelector:@selector(onBookmarkDeleted:)])
|
||||
[observer onBookmarkDeleted:bookmarkId];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)deleteTrack:(MWMTrackID)trackId {
|
||||
self.bm.GetEditSession().DeleteTrack(trackId);
|
||||
}
|
||||
|
||||
- (MWMBookmark *)bookmarkWithId:(MWMMarkID)bookmarkId {
|
||||
return [[MWMBookmark alloc] initWithMarkId:bookmarkId bookmarkData:self.bm.GetBookmark(bookmarkId)];
|
||||
}
|
||||
|
||||
- (MWMTrack *)trackWithId:(MWMTrackID)trackId {
|
||||
return [[MWMTrack alloc] initWithTrackId:trackId trackData:self.bm.GetTrack(trackId)];
|
||||
}
|
||||
|
||||
- (MWMBookmarkGroup *)categoryForBookmarkId:(MWMMarkID)bookmarkId {
|
||||
auto const groupId = self.bm.GetBookmark(bookmarkId)->GetGroupId();
|
||||
return [self categoryWithId:groupId];
|
||||
}
|
||||
|
||||
- (MWMBookmarkGroup *)categoryForTrackId:(MWMTrackID)trackId {
|
||||
auto const groupId = self.bm.GetTrack(trackId)->GetGroupId();
|
||||
return [self categoryWithId:groupId];
|
||||
}
|
||||
|
||||
- (NSString *)descriptionForBookmarkId:(MWMMarkID)bookmarkId {
|
||||
auto const description = self.bm.GetBookmark(bookmarkId)->GetDescription();
|
||||
return [NSString stringWithUTF8String:description.c_str()];
|
||||
}
|
||||
|
||||
- (NSArray<MWMBookmark *> *)bookmarksForGroup:(MWMMarkGroupID)groupId {
|
||||
auto const &bookmarkIds = self.bm.GetUserMarkIds(groupId);
|
||||
NSMutableArray *result = [NSMutableArray array];
|
||||
for (auto bookmarkId : bookmarkIds) {
|
||||
[result addObject:[[MWMBookmark alloc] initWithMarkId:bookmarkId bookmarkData:self.bm.GetBookmark(bookmarkId)]];
|
||||
}
|
||||
return [result copy];
|
||||
}
|
||||
|
||||
- (void)searchBookmarksGroup:(MWMMarkGroupID)groupId
|
||||
text:(NSString *)text
|
||||
completion:(SearchBookmarksCompletionBlock)completion
|
||||
{
|
||||
auto const searchId = ++self.lastSearchId;
|
||||
__weak auto weakSelf = self;
|
||||
|
||||
using search::BookmarksSearchParams;
|
||||
BookmarksSearchParams params{
|
||||
text.UTF8String,
|
||||
groupId,
|
||||
// m_onResults
|
||||
[weakSelf, searchId, completion](BookmarksSearchParams::Results results, BookmarksSearchParams::Status status)
|
||||
{
|
||||
__strong auto self = weakSelf;
|
||||
if (!self || searchId != self.lastSearchId)
|
||||
return;
|
||||
|
||||
self.bm.FilterInvalidBookmarks(results);
|
||||
|
||||
NSMutableArray *result = [NSMutableArray array];
|
||||
for (auto bookmarkId : results)
|
||||
[result addObject:[[MWMBookmark alloc] initWithMarkId:bookmarkId bookmarkData:self.bm.GetBookmark(bookmarkId)]];
|
||||
|
||||
completion(result);
|
||||
}
|
||||
};
|
||||
|
||||
GetFramework().GetSearchAPI().SearchInBookmarks(std::move(params));
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Tracks
|
||||
|
||||
- (MWMTrackIDCollection)trackIdsForCategory:(MWMMarkGroupID)categoryId {
|
||||
auto const & trackIds = self.bm.GetTrackIds(categoryId);
|
||||
NSMutableArray<NSNumber *> * collection = [[NSMutableArray alloc] initWithCapacity:trackIds.size()];
|
||||
|
||||
for (auto trackId : trackIds)
|
||||
[collection addObject:@(trackId)];
|
||||
return collection;
|
||||
}
|
||||
|
||||
- (NSArray<MWMTrack *> *)tracksForGroup:(MWMMarkGroupID)groupId {
|
||||
auto const & trackIds = self.bm.GetTrackIds(groupId);
|
||||
NSMutableArray * result = [[NSMutableArray alloc] initWithCapacity:trackIds.size()];
|
||||
|
||||
for (auto trackId : trackIds)
|
||||
[result addObject:[[MWMTrack alloc] initWithTrackId:trackId trackData:self.bm.GetTrack(trackId)]];
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSArray<MWMBookmarkGroup *> *)collectionsForGroup:(MWMMarkGroupID)groupId {
|
||||
auto const & collectionIds = self.bm.GetChildrenCollections(groupId);
|
||||
NSMutableArray * result = [[NSMutableArray alloc] initWithCapacity:collectionIds.size()];
|
||||
|
||||
for (auto collectionId : collectionIds)
|
||||
[result addObject:[[MWMBookmarkGroup alloc] initWithCategoryId:collectionId bookmarksManager:self]];
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSArray<MWMBookmarkGroup *> *)categoriesForGroup:(MWMMarkGroupID)groupId {
|
||||
auto const & categoryIds = self.bm.GetChildrenCategories(groupId);
|
||||
NSMutableArray * result = [[NSMutableArray alloc] initWithCapacity:categoryIds.size()];
|
||||
|
||||
for (auto categoryId : categoryIds)
|
||||
[result addObject:[[MWMBookmarkGroup alloc] initWithCategoryId:categoryId bookmarksManager:self]];
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark - Category sharing
|
||||
|
||||
- (void)shareCategory:(MWMMarkGroupID)groupId fileType:(MWMKmlFileType)fileType completion:(SharingResultCompletionHandler)completion {
|
||||
self.bm.PrepareFileForSharing({groupId}, [self, completion](auto sharingResult) {
|
||||
[self handleSharingResult:sharingResult completion:completion];
|
||||
}, convertFileTypeToCore(fileType));
|
||||
}
|
||||
|
||||
- (void)shareAllCategoriesWithCompletion:(SharingResultCompletionHandler)completion {
|
||||
self.bm.PrepareAllFilesForSharing([self, completion](auto sharingResult) {
|
||||
[self handleSharingResult:sharingResult completion:completion];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)shareTrack:(MWMTrackID)trackId fileType:(MWMKmlFileType)fileType completion:(SharingResultCompletionHandler)completion {
|
||||
self.bm.PrepareTrackFileForSharing(trackId, [self, completion](auto sharingResult) {
|
||||
[self handleSharingResult:sharingResult completion:completion];
|
||||
}, convertFileTypeToCore(fileType));
|
||||
}
|
||||
|
||||
- (void)handleSharingResult:(BookmarkManager::SharingResult)sharingResult completion:(SharingResultCompletionHandler)completion {
|
||||
NSURL *urlToALocalFile = nil;
|
||||
MWMBookmarksShareStatus status;
|
||||
switch (sharingResult.m_code) {
|
||||
case BookmarkManager::SharingResult::Code::Success:
|
||||
urlToALocalFile = [NSURL fileURLWithPath:@(sharingResult.m_sharingPath.c_str()) isDirectory:NO];
|
||||
ASSERT(urlToALocalFile, ("Invalid share category URL"));
|
||||
self.shareCategoryURL = urlToALocalFile;
|
||||
status = MWMBookmarksShareStatusSuccess;
|
||||
break;
|
||||
case BookmarkManager::SharingResult::Code::EmptyCategory:
|
||||
status = MWMBookmarksShareStatusEmptyCategory;
|
||||
break;
|
||||
case BookmarkManager::SharingResult::Code::ArchiveError:
|
||||
status = MWMBookmarksShareStatusArchiveError;
|
||||
break;
|
||||
case BookmarkManager::SharingResult::Code::FileError:
|
||||
status = MWMBookmarksShareStatusFileError;
|
||||
break;
|
||||
}
|
||||
completion(status, urlToALocalFile);
|
||||
}
|
||||
|
||||
- (void)finishSharing {
|
||||
if (!self.shareCategoryURL)
|
||||
return;
|
||||
|
||||
base::DeleteFileX(self.shareCategoryURL.path.UTF8String);
|
||||
self.shareCategoryURL = nil;
|
||||
}
|
||||
|
||||
#pragma mark - Notifications
|
||||
|
||||
- (void)setNotificationsEnabled:(BOOL)enabled {
|
||||
self.bm.SetNotificationsEnabled(enabled);
|
||||
}
|
||||
|
||||
- (BOOL)areNotificationsEnabled {
|
||||
return self.bm.AreNotificationsEnabled();
|
||||
}
|
||||
|
||||
#pragma mark - Catalog
|
||||
|
||||
- (NSArray<MWMBookmarkGroup *> *)sortedUserCategories {
|
||||
auto const & list = self.bm.GetSortedBmGroupIdList();
|
||||
NSMutableArray<MWMBookmarkGroup *> * result = [[NSMutableArray alloc] initWithCapacity:list.size()];
|
||||
|
||||
for (auto const & groupId : list)
|
||||
[result addObject:[self categoryWithId:groupId]];
|
||||
return result;
|
||||
}
|
||||
|
||||
- (MWMBookmarkGroup *)categoryWithId:(MWMMarkGroupID)groupId {
|
||||
return [[MWMBookmarkGroup alloc] initWithCategoryId:groupId bookmarksManager:self];
|
||||
}
|
||||
|
||||
- (size_t)userCategoriesCount {
|
||||
return self.bm.GetBmGroupsCount();
|
||||
}
|
||||
|
||||
- (void)updateBookmark:(MWMMarkID)bookmarkId
|
||||
setGroupId:(MWMMarkGroupID)groupId
|
||||
title:(NSString *)title
|
||||
color:(MWMBookmarkColor)color
|
||||
description:(NSString *)description {
|
||||
ASSERT_NOT_EQUAL(groupId, kml::kInvalidMarkGroupId, ());
|
||||
auto const currentGroupId = self.bm.GetBookmark(bookmarkId)->GetGroupId();
|
||||
auto editSession = self.bm.GetEditSession();
|
||||
if (currentGroupId != groupId)
|
||||
editSession.MoveBookmark(bookmarkId, currentGroupId, groupId);
|
||||
|
||||
auto bookmark = editSession.GetBookmarkForEdit(bookmarkId);
|
||||
ASSERT(bookmark, ("Invalid bookmark id:", bookmarkId));
|
||||
|
||||
auto kmlColor = kmlColorFromBookmarkColor(color);
|
||||
if (kmlColor != bookmark->GetColor())
|
||||
self.bm.SetLastEditedBmColor(kmlColor);
|
||||
|
||||
bookmark->SetColor(kmlColor);
|
||||
bookmark->SetDescription(description.UTF8String);
|
||||
if (title.UTF8String != bookmark->GetPreferredName())
|
||||
bookmark->SetCustomName(title.UTF8String);
|
||||
}
|
||||
|
||||
- (void)updateBookmark:(MWMMarkID)bookmarkId setColor:(MWMBookmarkColor)color {
|
||||
auto editSession = self.bm.GetEditSession();
|
||||
|
||||
auto bookmark = editSession.GetBookmarkForEdit(bookmarkId);
|
||||
ASSERT(bookmark, ("Invalid bookmark id:", bookmarkId));
|
||||
|
||||
auto kmlColor = kmlColorFromBookmarkColor(color);
|
||||
if (kmlColor != bookmark->GetColor())
|
||||
self.bm.SetLastEditedBmColor(kmlColor);
|
||||
|
||||
bookmark->SetColor(kmlColor);
|
||||
}
|
||||
|
||||
- (void)moveBookmark:(MWMMarkID)bookmarkId toGroupId:(MWMMarkGroupID)groupId {
|
||||
ASSERT_NOT_EQUAL(groupId, kml::kInvalidMarkGroupId, ());
|
||||
auto const currentGroupId = self.bm.GetBookmark(bookmarkId)->GetGroupId();
|
||||
if (currentGroupId != groupId) {
|
||||
auto editSession = self.bm.GetEditSession();
|
||||
editSession.MoveBookmark(bookmarkId, currentGroupId, groupId);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateTrack:(MWMTrackID)trackId
|
||||
setGroupId:(MWMMarkGroupID)groupId
|
||||
color:(UIColor *)color
|
||||
title:(NSString *)title {
|
||||
ASSERT_NOT_EQUAL(groupId, kml::kInvalidMarkGroupId, ());
|
||||
auto const currentGroupId = self.bm.GetTrack(trackId)->GetGroupId();
|
||||
auto editSession = self.bm.GetEditSession();
|
||||
if (currentGroupId != groupId)
|
||||
editSession.MoveTrack(trackId, currentGroupId, groupId);
|
||||
|
||||
auto track = editSession.GetTrackForEdit(trackId);
|
||||
ASSERT(track, ("Invalid track id:", trackId));
|
||||
|
||||
auto const currentColor = track->GetColor(0);
|
||||
auto const newColor = [MWMBookmarksManager getColorFromUIColor:color];
|
||||
|
||||
if (newColor != currentColor)
|
||||
track->SetColor(newColor);
|
||||
|
||||
track->SetName(title.UTF8String);
|
||||
}
|
||||
|
||||
- (void)updateTrack:(MWMTrackID)trackId setColor:(UIColor *)color {
|
||||
auto editSession = self.bm.GetEditSession();
|
||||
|
||||
auto track = editSession.GetTrackForEdit(trackId);
|
||||
ASSERT(track, ("Invalid track id:", trackId));
|
||||
|
||||
auto const currentColor = track->GetColor(0);
|
||||
auto const newColor = [MWMBookmarksManager getColorFromUIColor:color];
|
||||
|
||||
if (newColor != currentColor)
|
||||
track->SetColor(newColor);
|
||||
}
|
||||
|
||||
- (void)moveTrack:(MWMTrackID)trackId toGroupId:(MWMMarkGroupID)groupId {
|
||||
ASSERT_NOT_EQUAL(groupId, kml::kInvalidMarkGroupId, ());
|
||||
auto const currentGroupId = self.bm.GetTrack(trackId)->GetGroupId();
|
||||
if (currentGroupId != groupId) {
|
||||
auto editSession = self.bm.GetEditSession();
|
||||
editSession.MoveTrack(trackId, currentGroupId, groupId);
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)hasRecentlyDeletedBookmark {
|
||||
return self.bm.HasRecentlyDeletedBookmark();
|
||||
}
|
||||
|
||||
- (void)setCategory:(MWMMarkGroupID)groupId authorType:(MWMBookmarkGroupAuthorType)author
|
||||
{
|
||||
switch (author)
|
||||
{
|
||||
case MWMBookmarkGroupAuthorTypeLocal:
|
||||
self.bm.GetEditSession().SetCategoryCustomProperty(groupId, @"author_type".UTF8String, @"local".UTF8String);
|
||||
break;
|
||||
case MWMBookmarkGroupAuthorTypeTraveler:
|
||||
self.bm.GetEditSession().SetCategoryCustomProperty(groupId, @"author_type".UTF8String, @"tourist".UTF8String);
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - RecentlyDeletedCategoriesManager
|
||||
- (uint64_t)recentlyDeletedCategoriesCount {
|
||||
return self.bm.GetRecentlyDeletedCategoriesCount();
|
||||
}
|
||||
|
||||
- (NSArray<RecentlyDeletedCategory *> *)getRecentlyDeletedCategories {
|
||||
auto const categoriesCollection = self.bm.GetRecentlyDeletedCategories();
|
||||
NSMutableArray<RecentlyDeletedCategory *> * recentlyDeletedCategories = [[NSMutableArray alloc] initWithCapacity:categoriesCollection->size()];
|
||||
|
||||
for (auto const & [filePath, categoryPtr] : * categoriesCollection) {
|
||||
ASSERT(categoryPtr, ("Recently deleted category shouldn't be nil."));
|
||||
RecentlyDeletedCategory * category = [[RecentlyDeletedCategory alloc] initWithCategoryData:categoryPtr->m_categoryData filePath:filePath];
|
||||
[recentlyDeletedCategories addObject:category];
|
||||
}
|
||||
return recentlyDeletedCategories;
|
||||
}
|
||||
|
||||
- (void)deleteRecentlyDeletedCategoryAtURLs:(NSArray<NSURL *> *)urls {
|
||||
std::vector<std::string> filePaths;
|
||||
for (NSURL * url in urls)
|
||||
filePaths.push_back(url.filePathURL.path.UTF8String);
|
||||
self.bm.DeleteRecentlyDeletedCategoriesAtPaths(filePaths);
|
||||
}
|
||||
|
||||
- (void)recoverRecentlyDeletedCategoriesAtURLs:(NSArray<NSURL *> *)urls {
|
||||
std::vector<std::string> filePaths;
|
||||
for (NSURL * url in urls)
|
||||
filePaths.push_back(url.filePathURL.path.UTF8String);
|
||||
self.bm.RecoverRecentlyDeletedCategoriesAtPaths(filePaths);
|
||||
}
|
||||
|
||||
#pragma mark - Helpers
|
||||
|
||||
- (void)loopObservers:(void (^)(id<MWMBookmarksObserver> observer))block
|
||||
{
|
||||
for (id<MWMBookmarksObserver> observer in [self.observers copy])
|
||||
{
|
||||
if (observer)
|
||||
block(observer);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setElevationActivePoint:(CLLocationCoordinate2D)point distance:(double)distance trackId:(uint64_t)trackId {
|
||||
self.bm.SetElevationActivePoint(trackId, mercator::FromLatLon(point.latitude, point.longitude), distance);
|
||||
}
|
||||
|
||||
- (void)setElevationActivePointChanged:(uint64_t)trackId callback:(ElevationPointChangedBlock)callback {
|
||||
__weak __typeof(self) ws = self;
|
||||
self.bm.SetElevationActivePointChangedCallback([callback, trackId, ws] () {
|
||||
callback(ws.bm.GetElevationActivePoint(trackId));
|
||||
});
|
||||
}
|
||||
|
||||
- (void)resetElevationActivePointChanged {
|
||||
self.bm.SetElevationActivePointChangedCallback(nullptr);
|
||||
}
|
||||
|
||||
- (void)setElevationMyPositionChanged:(uint64_t)trackId callback:(ElevationPointChangedBlock)callback {
|
||||
__weak __typeof(self) ws = self;
|
||||
self.bm.SetElevationMyPositionChangedCallback([callback, trackId, ws] () {
|
||||
callback(ws.bm.GetElevationMyPosition(trackId));
|
||||
});
|
||||
}
|
||||
|
||||
- (void)resetElevationMyPositionChanged {
|
||||
self.bm.SetElevationMyPositionChangedCallback(nullptr);
|
||||
}
|
||||
|
||||
+ (dp::Color)getColorFromUIColor:(UIColor *)color {
|
||||
CGFloat fRed, fGreen, fBlue, fAlpha;
|
||||
[color getRed:&fRed green:&fGreen blue:&fBlue alpha:&fAlpha];
|
||||
|
||||
const uint8_t red = [self convertColorComponentToHex:fRed];
|
||||
const uint8_t green = [self convertColorComponentToHex:fGreen];
|
||||
const uint8_t blue = [self convertColorComponentToHex:fBlue];
|
||||
const uint8_t alpha = [self convertColorComponentToHex:fAlpha];
|
||||
|
||||
return dp::Color(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
+ (uint8_t)convertColorComponentToHex:(CGFloat)color {
|
||||
ASSERT_LESS_OR_EQUAL(color, 1.f, ("Extended sRGB color space is not supported"));
|
||||
ASSERT_GREATER_OR_EQUAL(color, 0.f, ("Extended sRGB color space is not supported"));
|
||||
static constexpr uint8_t kMaxChannelValue = 255;
|
||||
return color * kMaxChannelValue;
|
||||
}
|
||||
|
||||
@end
|
||||
22
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksObserver.h
Normal file
22
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksObserver.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "MWMTypes.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
NS_SWIFT_NAME(BookmarksObserver)
|
||||
@protocol MWMBookmarksObserver<NSObject>
|
||||
@optional
|
||||
- (void)onBookmarksLoadFinished;
|
||||
- (void)onBookmarksFileLoadSuccess;
|
||||
- (void)onBookmarksFileLoadError;
|
||||
- (void)onBookmarksCategoryDeleted:(MWMMarkGroupID)groupId;
|
||||
- (void)onRecentlyDeletedBookmarksCategoriesChanged;
|
||||
- (void)onBookmarkDeleted:(MWMMarkID)bookmarkId;
|
||||
@end
|
||||
|
||||
@protocol BookmarksObservable<NSObject>
|
||||
- (void)addObserver:(id<MWMBookmarksObserver>)observer;
|
||||
- (void)removeObserver:(id<MWMBookmarksObserver>)observer;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
21
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksSection.h
Normal file
21
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksSection.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class MWMBookmark;
|
||||
@class MWMTrack;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
NS_SWIFT_NAME(BookmarksSection)
|
||||
@interface MWMBookmarksSection : NSObject
|
||||
|
||||
@property(nonatomic, readonly) NSString *sectionName;
|
||||
@property(nonatomic, readonly, nullable) NSArray<MWMBookmark *> *bookmarks;
|
||||
@property(nonatomic, readonly, nullable) NSArray<MWMTrack *> *tracks;
|
||||
|
||||
- (instancetype)initWithTitle:(NSString *)title
|
||||
bookmarks:(nullable NSArray<MWMBookmark *> *)bookmarks
|
||||
tracks:(nullable NSArray<MWMTrack *> *)tracks;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
19
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksSection.m
Normal file
19
iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksSection.m
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#import "MWMBookmarksSection.h"
|
||||
|
||||
@implementation MWMBookmarksSection
|
||||
|
||||
- (instancetype)initWithTitle:(NSString *)title
|
||||
bookmarks:(NSArray<MWMBookmark *> *)bookmarks
|
||||
tracks:(NSArray<MWMTrack *> *)tracks {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_sectionName = title;
|
||||
_bookmarks = bookmarks;
|
||||
_tracks = tracks;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
18
iphone/CoreApi/CoreApi/Bookmarks/MWMCarPlayBookmarkObject.h
Normal file
18
iphone/CoreApi/CoreApi/Bookmarks/MWMCarPlayBookmarkObject.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
#import "MWMTypes.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MWMCarPlayBookmarkObject : NSObject
|
||||
@property(assign, nonatomic, readonly) MWMMarkID bookmarkId;
|
||||
@property(strong, nonatomic, readonly) NSString *prefferedName;
|
||||
@property(strong, nonatomic, readonly) NSString *address;
|
||||
@property(assign, nonatomic, readonly) CLLocationCoordinate2D coordinate;
|
||||
@property(assign, nonatomic, readonly) CGPoint mercatorPoint;
|
||||
|
||||
- (instancetype)initWithBookmarkId:(MWMMarkID)bookmarkId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
31
iphone/CoreApi/CoreApi/Bookmarks/MWMCarPlayBookmarkObject.mm
Normal file
31
iphone/CoreApi/CoreApi/Bookmarks/MWMCarPlayBookmarkObject.mm
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#import "MWMCarPlayBookmarkObject.h"
|
||||
#include "Framework.h"
|
||||
#include "geometry/mercator.hpp"
|
||||
|
||||
@interface MWMCarPlayBookmarkObject()
|
||||
@property(assign, nonatomic, readwrite) MWMMarkID bookmarkId;
|
||||
@property(strong, nonatomic, readwrite) NSString *prefferedName;
|
||||
@property(strong, nonatomic, readwrite) NSString *address;
|
||||
@property(assign, nonatomic, readwrite) CLLocationCoordinate2D coordinate;
|
||||
@property(assign, nonatomic, readwrite) CGPoint mercatorPoint;
|
||||
@end
|
||||
|
||||
@implementation MWMCarPlayBookmarkObject
|
||||
|
||||
- (instancetype)initWithBookmarkId:(MWMMarkID)bookmarkId {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.bookmarkId = bookmarkId;
|
||||
auto const & bm = GetFramework().GetBookmarkManager();
|
||||
Bookmark const * bookmark = bm.GetBookmark(bookmarkId);
|
||||
self.prefferedName = @(bookmark->GetPreferredName().c_str());
|
||||
auto const pivot = bookmark->GetPivot();
|
||||
self.mercatorPoint = CGPointMake(pivot.x, pivot.y);
|
||||
auto const & address = GetFramework().GetAddressAtPoint(pivot);
|
||||
self.address = @(address.FormatAddress().c_str());
|
||||
auto const location = mercator::ToLatLon(pivot);
|
||||
self.coordinate = CLLocationCoordinate2DMake(location.m_lat, location.m_lon);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
9
iphone/CoreApi/CoreApi/Bookmarks/MWMTrack+Core.h
Normal file
9
iphone/CoreApi/CoreApi/Bookmarks/MWMTrack+Core.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#import "MWMTrack.h"
|
||||
|
||||
#include <CoreApi/Framework.h>
|
||||
|
||||
@interface MWMTrack (Core)
|
||||
|
||||
- (instancetype)initWithTrackId:(MWMMarkID)markId trackData:(Track const *)track;
|
||||
|
||||
@end
|
||||
17
iphone/CoreApi/CoreApi/Bookmarks/MWMTrack.h
Normal file
17
iphone/CoreApi/CoreApi/Bookmarks/MWMTrack.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "MWMTypes.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
NS_SWIFT_NAME(Track)
|
||||
@interface MWMTrack : NSObject
|
||||
|
||||
@property(nonatomic, readonly) MWMTrackID trackId;
|
||||
@property(nonatomic, readonly) NSString *trackName;
|
||||
@property(nonatomic, readonly) NSInteger trackLengthMeters;
|
||||
@property(nonatomic, readonly) UIColor *trackColor;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
21
iphone/CoreApi/CoreApi/Bookmarks/MWMTrack.mm
Normal file
21
iphone/CoreApi/CoreApi/Bookmarks/MWMTrack.mm
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#import "MWMTrack+Core.h"
|
||||
|
||||
@implementation MWMTrack
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMTrack (Core)
|
||||
|
||||
- (instancetype)initWithTrackId:(MWMTrackID)trackId trackData:(Track const *)track {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_trackId = trackId;
|
||||
_trackName = @(track->GetName().c_str());
|
||||
_trackLengthMeters = track->GetLengthMeters();
|
||||
auto const color = track->GetColor(0);
|
||||
_trackColor = [UIColor colorWithRed:color.GetRedF() green:color.GetGreenF() blue:color.GetBlueF() alpha:1.f];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#import "RecentlyDeletedCategory.h"
|
||||
|
||||
#include "kml/types.hpp"
|
||||
|
||||
@interface RecentlyDeletedCategory (Core)
|
||||
|
||||
- (instancetype)initWithCategoryData:(kml::CategoryData)data filePath:(std::string const &)filePath;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface RecentlyDeletedCategory : NSObject
|
||||
|
||||
@property(nonatomic, readonly) NSString * title;
|
||||
@property(nonatomic, readonly) NSURL * fileURL;
|
||||
@property(nonatomic, readonly) NSDate * deletionDate;
|
||||
|
||||
- (instancetype)initTitle:(NSString *)title fileURL:(NSURL *)fileURL deletionDate:(NSDate *)deletionDate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#import "RecentlyDeletedCategory+Core.h"
|
||||
|
||||
#include <map/bookmark_helpers.hpp>
|
||||
#include <platform/platform_ios.h>
|
||||
|
||||
@implementation RecentlyDeletedCategory
|
||||
|
||||
- (instancetype)initTitle:(NSString *)title fileURL:(NSURL *)fileURL deletionDate:(NSDate *)deletionDate {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_title = title;
|
||||
_fileURL = fileURL;
|
||||
_deletionDate = deletionDate;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation RecentlyDeletedCategory (Core)
|
||||
|
||||
- (instancetype)initWithCategoryData:(kml::CategoryData)data filePath:(std::string const &)filePath {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
auto const name = GetPreferredBookmarkStr(data.m_name);
|
||||
_title = [NSString stringWithCString:name.c_str() encoding:NSUTF8StringEncoding];
|
||||
auto const pathString = [NSString stringWithCString:filePath.c_str() encoding:NSUTF8StringEncoding];
|
||||
_fileURL = [NSURL fileURLWithPath:pathString];
|
||||
NSTimeInterval creationTime = Platform::GetFileCreationTime(filePath);
|
||||
_deletionDate = [NSDate dateWithTimeIntervalSince1970:creationTime];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
10
iphone/CoreApi/CoreApi/Bookmarks/TrackInfo+Core.h
Normal file
10
iphone/CoreApi/CoreApi/Bookmarks/TrackInfo+Core.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#import "TrackInfo.h"
|
||||
|
||||
#include <CoreApi/Framework.h>
|
||||
#include "map/track_statistics.hpp"
|
||||
|
||||
@interface TrackInfo (Core)
|
||||
|
||||
- (instancetype)initWithTrackStatistics:(TrackStatistics const &)statistics;
|
||||
|
||||
@end
|
||||
20
iphone/CoreApi/CoreApi/Bookmarks/TrackInfo.h
Normal file
20
iphone/CoreApi/CoreApi/Bookmarks/TrackInfo.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TrackInfo : NSObject
|
||||
|
||||
@property (nonatomic, readonly) NSString * distance;
|
||||
@property (nonatomic, readonly) NSString * duration;
|
||||
@property (nonatomic, readonly) NSString * ascent;
|
||||
@property (nonatomic, readonly) NSString * descent;
|
||||
@property (nonatomic, readonly) NSString * maxElevation;
|
||||
@property (nonatomic, readonly) NSString * minElevation;
|
||||
|
||||
@property (nonatomic, readonly) BOOL hasElevationInfo;
|
||||
|
||||
+ (TrackInfo *)emptyInfo;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
30
iphone/CoreApi/CoreApi/Bookmarks/TrackInfo.mm
Normal file
30
iphone/CoreApi/CoreApi/Bookmarks/TrackInfo.mm
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#import "TrackInfo+Core.h"
|
||||
#import "StringUtils.h"
|
||||
|
||||
@implementation TrackInfo
|
||||
|
||||
+ (TrackInfo *)emptyInfo {
|
||||
return [[TrackInfo alloc] initWithTrackStatistics:TrackStatistics()];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TrackInfo (Core)
|
||||
|
||||
- (instancetype)initWithTrackStatistics:(TrackStatistics const &)statistics {
|
||||
if (self = [super init]) {
|
||||
_distance = ToNSString(statistics.GetFormattedLength());
|
||||
_duration = ToNSString(statistics.GetFormattedDuration());
|
||||
_ascent = ToNSString(statistics.GetFormattedAscent());
|
||||
_descent = ToNSString(statistics.GetFormattedDescent());
|
||||
_maxElevation = ToNSString(statistics.GetFormattedMaxElevation());
|
||||
_minElevation = ToNSString(statistics.GetFormattedMinElevation());
|
||||
_hasElevationInfo = statistics.m_ascent != 0 ||
|
||||
statistics.m_descent != 0 ||
|
||||
statistics.m_maxElevation != 0 ||
|
||||
statistics.m_minElevation != 0;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
26
iphone/CoreApi/CoreApi/Common/AppInfo.h
Normal file
26
iphone/CoreApi/CoreApi/Common/AppInfo.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, MWMOpenGLDriver) {
|
||||
MWMOpenGLDriverRegular,
|
||||
MWMOpenGLDriverMetalPre103, // iOS 10..10.3
|
||||
MWMOpenGLDriverMetal
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface AppInfo : NSObject
|
||||
|
||||
+ (instancetype)sharedInfo;
|
||||
- (instancetype)init __attribute__((unavailable("init is not available")));
|
||||
|
||||
@property(nonatomic, readonly) NSString * bundleVersion;
|
||||
@property(nonatomic, readonly) NSString * buildNumber;
|
||||
@property(nonatomic, readonly) NSString * languageId;
|
||||
@property(nonatomic, readonly) NSString * twoLetterLanguageId;
|
||||
@property(nonatomic, readonly) NSString * deviceModel;
|
||||
@property(nonatomic, readonly) MWMOpenGLDriver openGLDriver;
|
||||
@property(nonatomic, readonly) BOOL canMakeCalls;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
107
iphone/CoreApi/CoreApi/Common/AppInfo.mm
Normal file
107
iphone/CoreApi/CoreApi/Common/AppInfo.mm
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
#import "AppInfo.h"
|
||||
#import "MWMCommon.h"
|
||||
|
||||
#include "platform/platform_ios.h"
|
||||
#include "platform/preferred_languages.hpp"
|
||||
#include "platform/settings.hpp"
|
||||
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#import <CoreTelephony/CTCarrier.h>
|
||||
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
|
||||
|
||||
@interface AppInfo ()
|
||||
|
||||
@property(nonatomic) NSString * bundleVersion;
|
||||
@property(nonatomic) NSString * buildNumber;
|
||||
@property(nonatomic) NSString * deviceModel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation AppInfo
|
||||
|
||||
+ (instancetype)sharedInfo
|
||||
{
|
||||
static AppInfo * appInfo;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
appInfo = [[self alloc] init];
|
||||
});
|
||||
return appInfo;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
- (NSString *)bundleVersion
|
||||
{
|
||||
if (!_bundleVersion)
|
||||
_bundleVersion = NSBundle.mainBundle.infoDictionary[@"CFBundleShortVersionString"];
|
||||
return _bundleVersion;
|
||||
}
|
||||
|
||||
- (NSString *)buildNumber
|
||||
{
|
||||
if (!_buildNumber)
|
||||
_buildNumber = NSBundle.mainBundle.infoDictionary[@"CFBundleVersion"];
|
||||
return _buildNumber;
|
||||
}
|
||||
|
||||
- (NSString *)languageId
|
||||
{
|
||||
return NSLocale.preferredLanguages.firstObject;
|
||||
}
|
||||
|
||||
- (NSString *)twoLetterLanguageId
|
||||
{
|
||||
auto languageId = self.languageId;
|
||||
return languageId ? @(languages::Normalize(languageId.UTF8String).c_str()) : @"en";
|
||||
}
|
||||
|
||||
- (NSString *)deviceModel
|
||||
{
|
||||
if (!_deviceModel)
|
||||
_deviceModel = @(GetPlatform().DeviceModel().c_str());
|
||||
return _deviceModel;
|
||||
}
|
||||
|
||||
- (MWMOpenGLDriver)openGLDriver
|
||||
{
|
||||
utsname systemInfo;
|
||||
uname(&systemInfo);
|
||||
NSString * machine = @(systemInfo.machine);
|
||||
if (platform::kDeviceModelsBeforeMetalDriver[machine] != nil)
|
||||
return MWMOpenGLDriverRegular;
|
||||
if (platform::kDeviceModelsWithiOS10MetalDriver[machine] != nil)
|
||||
{
|
||||
if (isIOSVersionLessThan(10))
|
||||
return MWMOpenGLDriverRegular;
|
||||
else if (isIOSVersionLessThanString(@"10.3"))
|
||||
return MWMOpenGLDriverMetalPre103;
|
||||
}
|
||||
return MWMOpenGLDriverMetal;
|
||||
}
|
||||
|
||||
- (BOOL)canMakeCalls
|
||||
{
|
||||
if (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPhone)
|
||||
return NO;
|
||||
NSURL * telURL = [NSURL URLWithString:@"tel://"];
|
||||
if (![UIApplication.sharedApplication canOpenURL:telURL])
|
||||
return NO;
|
||||
NSDictionary<NSString *,CTCarrier *> * dict = [[CTTelephonyNetworkInfo alloc] init].serviceSubscriberCellularProviders;
|
||||
for (id key in dict)
|
||||
{
|
||||
NSString * networkCode = [dict objectForKey:key].mobileNetworkCode;
|
||||
if (networkCode != nil && networkCode.length > 0 && ![networkCode isEqualToString:@"65535"])
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
61
iphone/CoreApi/CoreApi/Common/MWMCommon.h
Normal file
61
iphone/CoreApi/CoreApi/Common/MWMCommon.h
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "MWMTypes.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
static inline BOOL firstVersionIsLessThanSecond(NSString * first, NSString * second)
|
||||
{
|
||||
NSArray<NSString *> * f = [first componentsSeparatedByString:@"."];
|
||||
NSArray<NSString *> * s = [second componentsSeparatedByString:@"."];
|
||||
NSUInteger iter = 0;
|
||||
while (f.count > iter && s.count > iter)
|
||||
{
|
||||
NSInteger fiv = f[iter].integerValue;
|
||||
NSInteger siv = s[iter].integerValue;
|
||||
|
||||
if (fiv == siv)
|
||||
iter++;
|
||||
else
|
||||
return fiv < siv;
|
||||
}
|
||||
return f.count < s.count;
|
||||
}
|
||||
|
||||
static inline BOOL isIOSVersionLessThanString(NSString * version)
|
||||
{
|
||||
return firstVersionIsLessThanSecond(UIDevice.currentDevice.systemVersion, version);
|
||||
}
|
||||
|
||||
static inline BOOL isIOSVersionLessThan(NSUInteger version)
|
||||
{
|
||||
return isIOSVersionLessThanString([NSString stringWithFormat:@"%@", @(version)]);
|
||||
}
|
||||
|
||||
static inline BOOL isInterfaceRightToLeft(void) NS_EXTENSION_UNAVAILABLE_IOS("Not available in extensions")
|
||||
{
|
||||
return UIApplication.sharedApplication.userInterfaceLayoutDirection ==
|
||||
UIUserInterfaceLayoutDirectionRightToLeft;
|
||||
}
|
||||
|
||||
static inline NSString * formattedSize(uint64_t size)
|
||||
{
|
||||
return [NSByteCountFormatter stringFromByteCount:size
|
||||
countStyle:NSByteCountFormatterCountStyleFile];
|
||||
}
|
||||
|
||||
// Use only for screen dimensions CGFloat comparison
|
||||
static inline BOOL equalScreenDimensions(CGFloat left, CGFloat right)
|
||||
{
|
||||
return fabs(left - right) < 0.5;
|
||||
}
|
||||
|
||||
static inline void performOnce(MWMVoidBlock block, NSString *key) {
|
||||
BOOL performed = [[NSUserDefaults standardUserDefaults] boolForKey:key];
|
||||
if (!performed) {
|
||||
block();
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
25
iphone/CoreApi/CoreApi/Common/MWMGeoUtil.h
Normal file
25
iphone/CoreApi/CoreApi/Common/MWMGeoUtil.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface Measure : NSObject
|
||||
|
||||
@property(nonatomic, readonly) double value;
|
||||
@property(nonatomic, readonly) NSString* valueAsString;
|
||||
|
||||
@property(nonatomic, readonly) NSString* unit;
|
||||
|
||||
- (instancetype) initAsSpeed:(double) mps;
|
||||
|
||||
@end
|
||||
|
||||
NS_SWIFT_NAME(GeoUtil)
|
||||
@interface MWMGeoUtil : NSObject
|
||||
|
||||
+ (float)angleAtPoint:(CLLocationCoordinate2D)p1 toPoint:(CLLocationCoordinate2D)p2;
|
||||
+ (NSString *)formattedOsmLinkForCoordinate:(CLLocationCoordinate2D)coordinate zoomLevel:(int)zoomLevel;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
66
iphone/CoreApi/CoreApi/Common/MWMGeoUtil.mm
Normal file
66
iphone/CoreApi/CoreApi/Common/MWMGeoUtil.mm
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
#import "MWMGeoUtil.h"
|
||||
|
||||
#include "geometry/mercator.hpp"
|
||||
#include "geometry/angles.hpp"
|
||||
|
||||
#include "platform/locale.hpp"
|
||||
#include "platform/localization.hpp"
|
||||
#include "platform/settings.hpp"
|
||||
#include "platform/measurement_utils.hpp"
|
||||
|
||||
@implementation Measure
|
||||
|
||||
// Alternative native implementation.
|
||||
// It has the issue: some localized unit are too long even in .short style. E.g. speed for RU.
|
||||
/*
|
||||
let imperial = Settings.measurementUnits() == .imperial
|
||||
var speedMeasurement = Measurement(value: speed, unit: UnitSpeed.metersPerSecond)
|
||||
speedMeasurement.convert(to: imperial ? UnitSpeed.milesPerHour : UnitSpeed.kilometersPerHour)
|
||||
|
||||
let formatter = MeasurementFormatter()
|
||||
formatter.unitOptions = .providedUnit
|
||||
formatter.numberFormatter.maximumFractionDigits = 0
|
||||
formatter.unitStyle = .short
|
||||
|
||||
if speedMeasurement.value < 10
|
||||
{
|
||||
formatter.numberFormatter.minimumFractionDigits = 1
|
||||
formatter.numberFormatter.maximumFractionDigits = 1
|
||||
}
|
||||
|
||||
let speedString = formatter.string(from: speedMeasurement)
|
||||
*/
|
||||
|
||||
- (NSString*) valueAsString {
|
||||
auto const outString = measurement_utils::ToStringPrecision(self.value, self.value >= 10.0 ? 0 : 1);
|
||||
return [NSString stringWithUTF8String:outString.c_str()];
|
||||
}
|
||||
|
||||
- (instancetype)initAsSpeed:(double) mps {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
auto units = measurement_utils::Units::Metric;
|
||||
settings::TryGet(settings::kMeasurementUnits, units);
|
||||
_value = measurement_utils::MpsToUnits(mps, units);
|
||||
|
||||
_unit = @(platform::GetLocalizedSpeedUnits(units).c_str());
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMGeoUtil
|
||||
|
||||
+ (float)angleAtPoint:(CLLocationCoordinate2D)p1 toPoint:(CLLocationCoordinate2D)p2 {
|
||||
auto mp1 = mercator::FromLatLon(p1.latitude, p1.longitude);
|
||||
auto mp2 = mercator::FromLatLon(p2.latitude, p2.longitude);
|
||||
return ang::AngleTo(mp1, mp2);
|
||||
}
|
||||
|
||||
+ (NSString *)formattedOsmLinkForCoordinate:(CLLocationCoordinate2D)coordinate zoomLevel:(int)zoomLevel {
|
||||
auto const link = measurement_utils::FormatOsmLink(coordinate.latitude, coordinate.longitude, zoomLevel);
|
||||
return [NSString stringWithCString:link.c_str() encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
@end
|
||||
63
iphone/CoreApi/CoreApi/Common/MWMTypes.h
Normal file
63
iphone/CoreApi/CoreApi/Common/MWMTypes.h
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef void (^MWMVoidBlock)(void);
|
||||
typedef void (^MWMStringBlock)(NSString *);
|
||||
typedef void (^MWMURLBlock)(NSURL *);
|
||||
typedef BOOL (^MWMCheckStringBlock)(NSString *);
|
||||
typedef void (^MWMBoolBlock)(BOOL);
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MWMDayTime) { MWMDayTimeDay, MWMDayTimeNight } NS_SWIFT_NAME(DayTime);
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MWMUnits) { MWMUnitsMetric, MWMUnitsImperial } NS_SWIFT_NAME(Units);
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MWMTheme) {
|
||||
MWMThemeDay,
|
||||
MWMThemeNight,
|
||||
MWMThemeVehicleDay,
|
||||
MWMThemeVehicleNight,
|
||||
MWMThemeAuto
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MWMKmlFileType) {
|
||||
MWMKmlFileTypeText,
|
||||
MWMKmlFileTypeBinary,
|
||||
MWMKmlFileTypeGpx
|
||||
} NS_SWIFT_NAME(KmlFileType);
|
||||
|
||||
typedef uint64_t MWMMarkID;
|
||||
typedef uint64_t MWMTrackID;
|
||||
typedef uint64_t MWMMarkGroupID;
|
||||
typedef NSArray<NSNumber *> *MWMMarkIDCollection;
|
||||
typedef NSArray<NSNumber *> *MWMTrackIDCollection;
|
||||
typedef NSArray<NSNumber *> *MWMGroupIDCollection;
|
||||
|
||||
typedef NS_CLOSED_ENUM(NSUInteger, MWMBookmarksShareStatus) {
|
||||
MWMBookmarksShareStatusSuccess,
|
||||
MWMBookmarksShareStatusEmptyCategory,
|
||||
MWMBookmarksShareStatusArchiveError,
|
||||
MWMBookmarksShareStatusFileError
|
||||
} NS_SWIFT_NAME(BookmarksShareStatus);
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MWMBookmarkGroupAccessStatus) {
|
||||
MWMBookmarkGroupAccessStatusLocal,
|
||||
MWMBookmarkGroupAccessStatusPublic,
|
||||
MWMBookmarkGroupAccessStatusPrivate,
|
||||
MWMBookmarkGroupAccessStatusAuthorOnly,
|
||||
MWMBookmarkGroupAccessStatusOther
|
||||
} NS_SWIFT_NAME(BookmarkGroupAccessStatus);
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MWMBookmarkGroupAuthorType) {
|
||||
MWMBookmarkGroupAuthorTypeLocal,
|
||||
MWMBookmarkGroupAuthorTypeTraveler
|
||||
} NS_SWIFT_NAME(BookmarkGroupAuthorType);
|
||||
|
||||
typedef NS_ENUM(NSInteger, MWMBookmarkGroupType) {
|
||||
MWMBookmarkGroupTypeRoot,
|
||||
MWMBookmarkGroupTypeCategory,
|
||||
MWMBookmarkGroupTypeCollection,
|
||||
MWMBookmarkGroupTypeDay
|
||||
} NS_SWIFT_NAME(BookmarkGroupType);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
9
iphone/CoreApi/CoreApi/Common/StringUtils.h
Normal file
9
iphone/CoreApi/CoreApi/Common/StringUtils.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#pragma once
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include <string_view>
|
||||
|
||||
inline NSString * ToNSString(std::string_view sv)
|
||||
{
|
||||
return [[NSString alloc] initWithBytes:sv.data() length:sv.size() encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
47
iphone/CoreApi/CoreApi/CoreApi.h
Normal file
47
iphone/CoreApi/CoreApi/CoreApi.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
//! Project version number for CoreApi.
|
||||
FOUNDATION_EXPORT double CoreApiVersionNumber;
|
||||
|
||||
//! Project version string for CoreApi.
|
||||
FOUNDATION_EXPORT const unsigned char CoreApiVersionString[];
|
||||
|
||||
#import <CoreApi/AppInfo.h>
|
||||
#import <CoreApi/DeepLinkParser.h>
|
||||
#import <CoreApi/DeepLinkSearchData.h>
|
||||
#import <CoreApi/DeepLinkInAppFeatureHighlightData.h>
|
||||
#import <CoreApi/Logger.h>
|
||||
#import <CoreApi/MWMBookmark.h>
|
||||
#import <CoreApi/MWMBookmarkGroup.h>
|
||||
#import <CoreApi/MWMBookmarksSection.h>
|
||||
#import <CoreApi/MWMBookmarksManager.h>
|
||||
#import <CoreApi/MWMBookmarksObserver.h>
|
||||
#import <CoreApi/MWMCarPlayBookmarkObject.h>
|
||||
#import <CoreApi/MWMCommon.h>
|
||||
#import <CoreApi/MWMFrameworkHelper.h>
|
||||
#import <CoreApi/MWMGeoUtil.h>
|
||||
#import <CoreApi/MWMMapNodeAttributes.h>
|
||||
#import <CoreApi/MWMMapOverlayManager.h>
|
||||
#import <CoreApi/MWMMapSearchResult.h>
|
||||
#import <CoreApi/MWMMapUpdateInfo.h>
|
||||
#import <CoreApi/MWMNetworkPolicy.h>
|
||||
#import <CoreApi/MWMSearchFrameworkHelper.h>
|
||||
#import <CoreApi/MWMStorage.h>
|
||||
#import <CoreApi/MWMTrack.h>
|
||||
#import <CoreApi/MWMTypes.h>
|
||||
#import <CoreApi/RecentlyDeletedCategory.h>
|
||||
#import "CoreApi/DistanceFormatter.h"
|
||||
#import "CoreApi/AltitudeFormatter.h"
|
||||
#import "CoreApi/DurationFormatter.h"
|
||||
#import "CoreApi/TrackInfo.h"
|
||||
|
||||
#pragma mark - Place Page
|
||||
|
||||
#import <CoreApi/ElevationProfileData.h>
|
||||
#import <CoreApi/IOpeningHoursLocalization.h>
|
||||
#import <CoreApi/OpeningHours.h>
|
||||
#import <CoreApi/PlacePageBookmarkData.h>
|
||||
#import <CoreApi/PlacePageTrackData.h>
|
||||
#import <CoreApi/PlacePageButtonsData.h>
|
||||
#import <CoreApi/PlacePageData.h>
|
||||
#import <CoreApi/PlacePageInfoData.h>
|
||||
#import <CoreApi/PlacePagePreviewData.h>
|
||||
#import <CoreApi/PlacePagePhone.h>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import "DeepLinkParser.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSUInteger, InAppFeatureHighlightType) {
|
||||
InAppFeatureHighlightTypeNone,
|
||||
InAppFeatureHighlightTypeTrackRecorder,
|
||||
InAppFeatureHighlightTypeICloud,
|
||||
};
|
||||
|
||||
@interface DeepLinkInAppFeatureHighlightData : NSObject
|
||||
|
||||
@property(nonatomic, readonly) DeeplinkUrlType urlType;
|
||||
@property(nonatomic, readonly) InAppFeatureHighlightType feature;
|
||||
|
||||
- (instancetype)init:(DeeplinkUrlType)urlType;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#import "DeepLinkInAppFeatureHighlightData.h"
|
||||
#import <CoreApi/Framework.h>
|
||||
|
||||
static inline InAppFeatureHighlightType FeatureTypeFrom(url_scheme::InAppFeatureHighlightRequest::InAppFeatureType type)
|
||||
{
|
||||
using namespace url_scheme;
|
||||
switch (type)
|
||||
{
|
||||
case InAppFeatureHighlightRequest::InAppFeatureType::None: return InAppFeatureHighlightTypeNone;
|
||||
case InAppFeatureHighlightRequest::InAppFeatureType::TrackRecorder: return InAppFeatureHighlightTypeTrackRecorder;
|
||||
case InAppFeatureHighlightRequest::InAppFeatureType::iCloud: return InAppFeatureHighlightTypeICloud;
|
||||
}
|
||||
}
|
||||
|
||||
@implementation DeepLinkInAppFeatureHighlightData
|
||||
|
||||
- (instancetype)init:(DeeplinkUrlType)urlType {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_urlType = urlType;
|
||||
_feature = FeatureTypeFrom(GetFramework().GetInAppFeatureHighlightRequest().m_feature);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
23
iphone/CoreApi/CoreApi/DeepLink/DeepLinkParser.h
Normal file
23
iphone/CoreApi/CoreApi/DeepLink/DeepLinkParser.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSUInteger, DeeplinkUrlType) {
|
||||
DeeplinkUrlTypeIncorrect = 0,
|
||||
DeeplinkUrlTypeMap,
|
||||
DeeplinkUrlTypeRoute,
|
||||
DeeplinkUrlTypeSearch,
|
||||
DeeplinkUrlTypeCrosshair,
|
||||
DeeplinkUrlTypeOAuth2,
|
||||
DeeplinkUrlTypeMenu,
|
||||
DeeplinkUrlTypeSettings
|
||||
};
|
||||
|
||||
@interface DeepLinkParser : NSObject
|
||||
|
||||
+ (DeeplinkUrlType)parseAndSetApiURL:(NSURL *)url;
|
||||
+ (void)executeMapApiRequest;
|
||||
+ (void)addBookmarksFile:(NSURL*)url;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
39
iphone/CoreApi/CoreApi/DeepLink/DeepLinkParser.mm
Normal file
39
iphone/CoreApi/CoreApi/DeepLink/DeepLinkParser.mm
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#import "DeepLinkParser.h"
|
||||
#include <CoreApi/Framework.h>
|
||||
#import "DeepLinkSearchData.h"
|
||||
|
||||
#import "map/mwm_url.hpp"
|
||||
|
||||
static inline DeeplinkUrlType deeplinkUrlType(url_scheme::ParsedMapApi::UrlType type)
|
||||
{
|
||||
using namespace url_scheme;
|
||||
switch (type)
|
||||
{
|
||||
case ParsedMapApi::UrlType::Incorrect: return DeeplinkUrlTypeIncorrect;
|
||||
case ParsedMapApi::UrlType::Map: return DeeplinkUrlTypeMap;
|
||||
case ParsedMapApi::UrlType::Route: return DeeplinkUrlTypeRoute;
|
||||
case ParsedMapApi::UrlType::Search: return DeeplinkUrlTypeSearch;
|
||||
case ParsedMapApi::UrlType::Crosshair: return DeeplinkUrlTypeCrosshair;
|
||||
case ParsedMapApi::UrlType::OAuth2: return DeeplinkUrlTypeOAuth2;
|
||||
case ParsedMapApi::UrlType::Menu: return DeeplinkUrlTypeMenu;
|
||||
case ParsedMapApi::UrlType::Settings: return DeeplinkUrlTypeSettings;
|
||||
}
|
||||
}
|
||||
|
||||
@implementation DeepLinkParser
|
||||
|
||||
+ (DeeplinkUrlType)parseAndSetApiURL:(NSURL *)url {
|
||||
Framework &f = GetFramework();
|
||||
return deeplinkUrlType(f.ParseAndSetApiURL(url.absoluteString.UTF8String));
|
||||
}
|
||||
|
||||
+ (void)executeMapApiRequest {
|
||||
GetFramework().ExecuteMapApiRequest();
|
||||
}
|
||||
|
||||
+ (void)addBookmarksFile:(NSURL *)url {
|
||||
// iOS doesn't create temporary files on import at least in Safari and Files.
|
||||
GetFramework().AddBookmarksFile(url.path.UTF8String, false /* isTemporaryFile */);
|
||||
}
|
||||
|
||||
@end
|
||||
18
iphone/CoreApi/CoreApi/DeepLink/DeepLinkSearchData.h
Normal file
18
iphone/CoreApi/CoreApi/DeepLink/DeepLinkSearchData.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DeepLinkSearchData : NSObject
|
||||
|
||||
@property(nonatomic, readonly) NSString *query;
|
||||
@property(nonatomic, readonly) NSString *locale;
|
||||
@property(nonatomic, readonly) double centerLat;
|
||||
@property(nonatomic, readonly) double centerLon;
|
||||
@property(nonatomic, readonly) BOOL isSearchOnMap;
|
||||
|
||||
- (instancetype)init;
|
||||
- (BOOL)hasValidCenterLatLon;
|
||||
- (void)onViewportChanged:(int)zoomLevel;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
31
iphone/CoreApi/CoreApi/DeepLink/DeepLinkSearchData.mm
Normal file
31
iphone/CoreApi/CoreApi/DeepLink/DeepLinkSearchData.mm
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#import "DeepLinkSearchData.h"
|
||||
#import <CoreApi/Framework.h>
|
||||
#include "drape_frontend/visual_params.hpp"
|
||||
#include "geometry/mercator.hpp"
|
||||
#include "geometry/latlon.hpp"
|
||||
|
||||
@implementation DeepLinkSearchData
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
auto const &request = GetFramework().GetParsedSearchRequest();
|
||||
ms::LatLon const center = GetFramework().GetParsedCenterLatLon();
|
||||
_query = [@((request.m_query + " ").c_str()) stringByRemovingPercentEncoding];
|
||||
_locale = @(request.m_locale.c_str());
|
||||
_centerLat = center.m_lat;
|
||||
_centerLon = center.m_lon;
|
||||
_isSearchOnMap = request.m_isSearchOnMap;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)hasValidCenterLatLon {
|
||||
return _centerLat != ms::LatLon::kInvalid && _centerLon != ms::LatLon::kInvalid;
|
||||
}
|
||||
|
||||
- (void)onViewportChanged:(int)zoomLevel {
|
||||
auto const center = mercator::FromLatLon(_centerLat, _centerLon);
|
||||
auto const rect = df::GetRectForDrawScale(zoomLevel, center);
|
||||
GetFramework().GetSearchAPI().OnViewportChanged(rect);
|
||||
}
|
||||
@end
|
||||
11
iphone/CoreApi/CoreApi/Formatting/AltitudeFormatter.h
Normal file
11
iphone/CoreApi/CoreApi/Formatting/AltitudeFormatter.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface AltitudeFormatter : NSObject
|
||||
|
||||
+ (NSString *)altitudeStringFromMeters:(double)meters;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
12
iphone/CoreApi/CoreApi/Formatting/AltitudeFormatter.mm
Normal file
12
iphone/CoreApi/CoreApi/Formatting/AltitudeFormatter.mm
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#import "AltitudeFormatter.h"
|
||||
|
||||
#include "platform/distance.hpp"
|
||||
|
||||
@implementation AltitudeFormatter
|
||||
|
||||
+ (NSString *)altitudeStringFromMeters:(double)meters {
|
||||
auto const altitude = platform::Distance::FormatAltitude(meters);
|
||||
return [NSString stringWithUTF8String:altitude.c_str()];
|
||||
}
|
||||
|
||||
@end
|
||||
16
iphone/CoreApi/CoreApi/Formatting/DateTimeFormatter.swift
Normal file
16
iphone/CoreApi/CoreApi/Formatting/DateTimeFormatter.swift
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import Foundation
|
||||
|
||||
@objcMembers
|
||||
public final class DateTimeFormatter: NSObject {
|
||||
private static let dateFormatter = DateFormatter()
|
||||
|
||||
public static func dateString(from date: Date, dateStyle: DateFormatter.Style, timeStyle: DateFormatter.Style) -> String {
|
||||
DateFormatter.localizedString(from: date, dateStyle: dateStyle, timeStyle: timeStyle)
|
||||
}
|
||||
|
||||
public static func dateString(from date: Date, locale: Locale = .current, format: String) -> String {
|
||||
dateFormatter.locale = locale
|
||||
dateFormatter.dateFormat = format
|
||||
return dateFormatter.string(from: date)
|
||||
}
|
||||
}
|
||||
11
iphone/CoreApi/CoreApi/Formatting/DistanceFormatter.h
Normal file
11
iphone/CoreApi/CoreApi/Formatting/DistanceFormatter.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DistanceFormatter : NSObject
|
||||
|
||||
+ (NSString *)distanceStringFromMeters:(double)meters;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
12
iphone/CoreApi/CoreApi/Formatting/DistanceFormatter.mm
Normal file
12
iphone/CoreApi/CoreApi/Formatting/DistanceFormatter.mm
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#import "DistanceFormatter.h"
|
||||
|
||||
#include "platform/distance.hpp"
|
||||
|
||||
@implementation DistanceFormatter
|
||||
|
||||
+ (NSString *)distanceStringFromMeters:(double)meters {
|
||||
auto const coreDistance = platform::Distance::CreateFormatted(meters);
|
||||
return [NSString stringWithUTF8String:coreDistance.ToString().c_str()];
|
||||
}
|
||||
|
||||
@end
|
||||
11
iphone/CoreApi/CoreApi/Formatting/DurationFormatter.h
Normal file
11
iphone/CoreApi/CoreApi/Formatting/DurationFormatter.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DurationFormatter: NSObject
|
||||
|
||||
+ (NSString *)durationStringFromTimeInterval:(NSTimeInterval)timeInterval NS_SWIFT_NAME(durationString(from:));
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
12
iphone/CoreApi/CoreApi/Formatting/DurationFormatter.mm
Normal file
12
iphone/CoreApi/CoreApi/Formatting/DurationFormatter.mm
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#import "DurationFormatter.h"
|
||||
|
||||
#include "platform/duration.hpp"
|
||||
|
||||
@implementation DurationFormatter
|
||||
|
||||
+ (NSString *)durationStringFromTimeInterval:(NSTimeInterval)timeInterval {
|
||||
auto const duration = platform::Duration(static_cast<int>(timeInterval));
|
||||
return [NSString stringWithCString:duration.GetPlatformLocalizedString().c_str() encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
@end
|
||||
21
iphone/CoreApi/CoreApi/Framework/Framework.cpp
Normal file
21
iphone/CoreApi/CoreApi/Framework/Framework.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "Framework.h"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
|
||||
static Framework * g_framework = 0;
|
||||
bool g_wasDeleted = false;
|
||||
|
||||
Framework & GetFramework()
|
||||
{
|
||||
CHECK(!g_wasDeleted, ());
|
||||
if (g_framework == 0)
|
||||
g_framework = new Framework();
|
||||
return *g_framework;
|
||||
}
|
||||
|
||||
void DeleteFramework()
|
||||
{
|
||||
g_wasDeleted = true;
|
||||
delete g_framework;
|
||||
g_framework = nullptr;
|
||||
}
|
||||
9
iphone/CoreApi/CoreApi/Framework/Framework.h
Normal file
9
iphone/CoreApi/CoreApi/Framework/Framework.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// Wraps framework access
|
||||
#pragma once
|
||||
|
||||
#include "map/framework.hpp"
|
||||
|
||||
/// Creates framework at first access
|
||||
Framework & GetFramework();
|
||||
/// Releases framework resources
|
||||
void DeleteFramework();
|
||||
65
iphone/CoreApi/CoreApi/Framework/MWMFrameworkHelper.h
Normal file
65
iphone/CoreApi/CoreApi/Framework/MWMFrameworkHelper.h
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "MWMTypes.h"
|
||||
|
||||
@class MWMMapSearchResult;
|
||||
@class TrackInfo;
|
||||
@class ElevationProfileData;
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MWMZoomMode) { MWMZoomModeIn = 0, MWMZoomModeOut };
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef void (^SearchInDownloaderCompletions)(NSArray<MWMMapSearchResult *> *results, BOOL finished);
|
||||
typedef void (^TrackRecordingUpdatedHandler)(TrackInfo * _Nonnull trackInfo);
|
||||
|
||||
@protocol TrackRecorder
|
||||
|
||||
+ (void)startTrackRecording;
|
||||
+ (void)setTrackRecordingUpdateHandler:(TrackRecordingUpdatedHandler _Nullable)trackRecordingDidUpdate;
|
||||
+ (void)stopTrackRecording;
|
||||
+ (void)saveTrackRecordingWithName:(nonnull NSString *)name;
|
||||
+ (BOOL)isTrackRecordingEnabled;
|
||||
+ (BOOL)isTrackRecordingEmpty;
|
||||
/// Returns current track recording elevation info.
|
||||
/// If the track recording is not in progress, returns empty ElevationProfileData.
|
||||
+ (ElevationProfileData * _Nonnull)trackRecordingElevationInfo;
|
||||
|
||||
@end
|
||||
|
||||
NS_SWIFT_NAME(FrameworkHelper)
|
||||
@interface MWMFrameworkHelper : NSObject<TrackRecorder>
|
||||
|
||||
+ (void)processFirstLaunch:(BOOL)hasLocation;
|
||||
+ (void)setVisibleViewport:(CGRect)rect scaleFactor:(CGFloat)scale;
|
||||
+ (void)setTheme:(MWMTheme)theme;
|
||||
+ (MWMDayTime)daytimeAtLocation:(nullable CLLocation *)location;
|
||||
+ (void)createFramework;
|
||||
+ (MWMMarkID)invalidBookmarkId;
|
||||
+ (MWMMarkGroupID)invalidCategoryId;
|
||||
+ (void)zoomMap:(MWMZoomMode)mode;
|
||||
+ (void)moveMap:(UIOffset)offset;
|
||||
+ (void)scrollMapToDistanceX:(double)x andY:(double)y;
|
||||
+ (void)deactivateMapSelection;
|
||||
+ (void)switchMyPositionMode;
|
||||
+ (void)stopLocationFollow;
|
||||
+ (NSArray<NSString *> *)obtainLastSearchQueries;
|
||||
+ (void)rotateMap:(double)azimuth animated:(BOOL)isAnimated;
|
||||
+ (void)updatePositionArrowOffset:(BOOL)useDefault offset:(int)offsetY;
|
||||
+ (int64_t)dataVersion;
|
||||
+ (void)searchInDownloader:(NSString *)query
|
||||
inputLocale:(NSString *)locale
|
||||
completion:(SearchInDownloaderCompletions)completion;
|
||||
+ (BOOL)canEditMapAtViewportCenter;
|
||||
+ (void)showOnMap:(MWMMarkGroupID)categoryId;
|
||||
+ (void)showBookmark:(MWMMarkID)bookmarkId;
|
||||
+ (void)showTrack:(MWMTrackID)trackId;
|
||||
+ (void)saveRouteAsTrack;
|
||||
+ (void)updatePlacePageData;
|
||||
+ (void)updateAfterDeleteBookmark;
|
||||
+ (int)currentZoomLevel;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
244
iphone/CoreApi/CoreApi/Framework/MWMFrameworkHelper.mm
Normal file
244
iphone/CoreApi/CoreApi/Framework/MWMFrameworkHelper.mm
Normal file
|
|
@ -0,0 +1,244 @@
|
|||
#import "MWMFrameworkHelper.h"
|
||||
#import "MWMMapSearchResult+Core.h"
|
||||
#import "TrackInfo+Core.h"
|
||||
#import "ElevationProfileData+Core.h"
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
#include "base/sunrise_sunset.hpp"
|
||||
|
||||
#include "platform/local_country_file_utils.hpp"
|
||||
#include "platform/network_policy_ios.h"
|
||||
|
||||
@implementation MWMFrameworkHelper
|
||||
|
||||
+ (void)processFirstLaunch:(BOOL)hasLocation {
|
||||
auto &f = GetFramework();
|
||||
if (!hasLocation)
|
||||
f.SwitchMyPositionNextMode();
|
||||
else
|
||||
f.RunFirstLaunchAnimation();
|
||||
}
|
||||
|
||||
+ (void)setVisibleViewport:(CGRect)rect scaleFactor:(CGFloat)scale {
|
||||
CGFloat const x0 = rect.origin.x * scale;
|
||||
CGFloat const y0 = rect.origin.y * scale;
|
||||
CGFloat const x1 = x0 + rect.size.width * scale;
|
||||
CGFloat const y1 = y0 + rect.size.height * scale;
|
||||
GetFramework().SetVisibleViewport(m2::RectD(x0, y0, x1, y1));
|
||||
}
|
||||
|
||||
+ (void)setTheme:(MWMTheme)theme {
|
||||
auto &f = GetFramework();
|
||||
|
||||
auto const style = f.GetMapStyle();
|
||||
auto const isOutdoor = ^BOOL(MapStyle style) {
|
||||
switch (style) {
|
||||
case MapStyleOutdoorsLight:
|
||||
case MapStyleOutdoorsDark:
|
||||
return YES;
|
||||
default:
|
||||
return NO;
|
||||
}
|
||||
}(style);
|
||||
auto const newStyle = ^MapStyle(MWMTheme theme) {
|
||||
switch (theme) {
|
||||
case MWMThemeDay:
|
||||
return isOutdoor ? MapStyleOutdoorsLight : MapStyleDefaultLight;
|
||||
case MWMThemeVehicleDay:
|
||||
return MapStyleVehicleLight;
|
||||
case MWMThemeNight:
|
||||
return isOutdoor ? MapStyleOutdoorsDark : MapStyleDefaultDark;
|
||||
case MWMThemeVehicleNight:
|
||||
return MapStyleVehicleDark;
|
||||
case MWMThemeAuto:
|
||||
NSAssert(NO, @"Invalid theme");
|
||||
return MapStyleDefaultLight;
|
||||
}
|
||||
}(theme);
|
||||
|
||||
if (style != newStyle)
|
||||
f.SetMapStyle(newStyle);
|
||||
}
|
||||
|
||||
+ (MWMDayTime)daytimeAtLocation:(CLLocation *)location {
|
||||
if (!location)
|
||||
return MWMDayTimeDay;
|
||||
DayTimeType dayTime =
|
||||
GetDayTime(NSDate.date.timeIntervalSince1970, location.coordinate.latitude, location.coordinate.longitude);
|
||||
switch (dayTime) {
|
||||
case DayTimeType::Day:
|
||||
case DayTimeType::PolarDay:
|
||||
return MWMDayTimeDay;
|
||||
case DayTimeType::Night:
|
||||
case DayTimeType::PolarNight:
|
||||
return MWMDayTimeNight;
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)createFramework {
|
||||
UNUSED_VALUE(GetFramework());
|
||||
}
|
||||
|
||||
+ (MWMMarkID)invalidBookmarkId {
|
||||
return kml::kInvalidMarkId;
|
||||
}
|
||||
|
||||
+ (MWMMarkGroupID)invalidCategoryId {
|
||||
return kml::kInvalidMarkGroupId;
|
||||
}
|
||||
|
||||
+ (NSArray<NSString *> *)obtainLastSearchQueries {
|
||||
NSMutableArray *result = [NSMutableArray array];
|
||||
auto const &queries = GetFramework().GetSearchAPI().GetLastSearchQueries();
|
||||
for (auto const &item : queries) {
|
||||
[result addObject:@(item.second.c_str())];
|
||||
}
|
||||
return [result copy];
|
||||
}
|
||||
|
||||
#pragma mark - Map Interaction
|
||||
|
||||
+ (void)zoomMap:(MWMZoomMode)mode {
|
||||
switch (mode) {
|
||||
case MWMZoomModeIn:
|
||||
GetFramework().Scale(Framework::SCALE_MAG, true);
|
||||
break;
|
||||
case MWMZoomModeOut:
|
||||
GetFramework().Scale(Framework::SCALE_MIN, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)moveMap:(UIOffset)offset {
|
||||
GetFramework().Move(offset.horizontal, offset.vertical, true);
|
||||
}
|
||||
|
||||
+ (void)scrollMapToDistanceX:(double)x andY:(double)y
|
||||
{
|
||||
GetFramework().Scroll(x, y);
|
||||
}
|
||||
|
||||
+ (void)deactivateMapSelection {
|
||||
GetFramework().DeactivateMapSelection();
|
||||
}
|
||||
|
||||
+ (void)switchMyPositionMode {
|
||||
GetFramework().SwitchMyPositionNextMode();
|
||||
}
|
||||
|
||||
+ (void)stopLocationFollow {
|
||||
GetFramework().StopLocationFollow();
|
||||
}
|
||||
|
||||
+ (void)rotateMap:(double)azimuth animated:(BOOL)isAnimated {
|
||||
GetFramework().Rotate(azimuth, isAnimated);
|
||||
}
|
||||
|
||||
+ (void)updatePositionArrowOffset:(BOOL)useDefault offset:(int)offsetY {
|
||||
GetFramework().UpdateMyPositionRoutingOffset(useDefault, offsetY);
|
||||
}
|
||||
|
||||
+ (int64_t)dataVersion {
|
||||
return GetFramework().GetCurrentDataVersion();
|
||||
}
|
||||
|
||||
+ (void)searchInDownloader:(NSString *)query
|
||||
inputLocale:(NSString *)locale
|
||||
completion:(SearchInDownloaderCompletions)completion {
|
||||
storage::DownloaderSearchParams params{
|
||||
query.UTF8String,
|
||||
locale.precomposedStringWithCompatibilityMapping.UTF8String,
|
||||
// m_onResults
|
||||
[completion](storage::DownloaderSearchResults const & results)
|
||||
{
|
||||
NSMutableArray *resultsArray = [NSMutableArray arrayWithCapacity:results.m_results.size()];
|
||||
for (auto const & res : results.m_results)
|
||||
{
|
||||
MWMMapSearchResult *result = [[MWMMapSearchResult alloc] initWithSearchResult:res];
|
||||
[resultsArray addObject:result];
|
||||
}
|
||||
completion(resultsArray, results.m_endMarker);
|
||||
}
|
||||
};
|
||||
|
||||
GetFramework().GetSearchAPI().SearchInDownloader(std::move(params));
|
||||
}
|
||||
|
||||
+ (BOOL)canEditMapAtViewportCenter {
|
||||
auto const &f = GetFramework();
|
||||
return f.CanEditMapForPosition(f.GetViewportCenter());
|
||||
}
|
||||
|
||||
+ (void)showOnMap:(MWMMarkGroupID)categoryId {
|
||||
GetFramework().ShowBookmarkCategory(categoryId);
|
||||
}
|
||||
|
||||
+ (void)showBookmark:(MWMMarkID)bookmarkId {
|
||||
GetFramework().ShowBookmark(bookmarkId);
|
||||
}
|
||||
|
||||
+ (void)showTrack:(MWMTrackID)trackId {
|
||||
GetFramework().ShowTrack(trackId);
|
||||
}
|
||||
|
||||
+ (void)saveRouteAsTrack {
|
||||
GetFramework().SaveRoute();
|
||||
}
|
||||
|
||||
+ (void)updatePlacePageData {
|
||||
GetFramework().UpdatePlacePageInfoForCurrentSelection();
|
||||
}
|
||||
|
||||
+ (void)updateAfterDeleteBookmark {
|
||||
auto & frm = GetFramework();
|
||||
auto buildInfo = frm.GetCurrentPlacePageInfo().GetBuildInfo();
|
||||
buildInfo.m_match = place_page::BuildInfo::Match::FeatureOnly;
|
||||
buildInfo.m_userMarkId = kml::kInvalidMarkId;
|
||||
buildInfo.m_source = place_page::BuildInfo::Source::Other;
|
||||
frm.UpdatePlacePageInfoForCurrentSelection(buildInfo);
|
||||
}
|
||||
|
||||
+ (int)currentZoomLevel {
|
||||
return GetFramework().GetDrawScale();
|
||||
}
|
||||
|
||||
// MARK: - TrackRecorder
|
||||
|
||||
+ (void)startTrackRecording {
|
||||
GetFramework().StartTrackRecording();
|
||||
}
|
||||
|
||||
+ (void)setTrackRecordingUpdateHandler:(TrackRecordingUpdatedHandler _Nullable)trackRecordingDidUpdate {
|
||||
if (!trackRecordingDidUpdate)
|
||||
{
|
||||
GetFramework().SetTrackRecordingUpdateHandler(nullptr);
|
||||
return;
|
||||
}
|
||||
GetFramework().SetTrackRecordingUpdateHandler([trackRecordingDidUpdate](TrackStatistics const & statistics) {
|
||||
TrackInfo * info = [[TrackInfo alloc] initWithTrackStatistics:statistics];
|
||||
trackRecordingDidUpdate(info);
|
||||
});
|
||||
}
|
||||
|
||||
+ (void)stopTrackRecording {
|
||||
GetFramework().StopTrackRecording();
|
||||
}
|
||||
|
||||
+ (void)saveTrackRecordingWithName:(nonnull NSString *)name {
|
||||
GetFramework().SaveTrackRecordingWithName(name.UTF8String);
|
||||
}
|
||||
|
||||
+ (BOOL)isTrackRecordingEnabled {
|
||||
return GetFramework().IsTrackRecordingEnabled();
|
||||
}
|
||||
|
||||
+ (BOOL)isTrackRecordingEmpty {
|
||||
return GetFramework().IsTrackRecordingEmpty();
|
||||
}
|
||||
|
||||
+ (ElevationProfileData * _Nonnull)trackRecordingElevationInfo {
|
||||
return [[ElevationProfileData alloc] initWithElevationInfo:GetFramework().GetTrackRecordingElevationInfo()];
|
||||
}
|
||||
|
||||
@end
|
||||
22
iphone/CoreApi/CoreApi/Info.plist
Normal file
22
iphone/CoreApi/CoreApi/Info.plist
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
</dict>
|
||||
</plist>
|
||||
23
iphone/CoreApi/CoreApi/Logger/Logger.h
Normal file
23
iphone/CoreApi/CoreApi/Logger/Logger.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSUInteger, LogLevel) {
|
||||
LogLevelDebug = 0,
|
||||
LogLevelInfo,
|
||||
LogLevelWarning,
|
||||
LogLevelError,
|
||||
LogLevelCritical
|
||||
};
|
||||
|
||||
@interface Logger : NSObject
|
||||
|
||||
+ (void)log:(LogLevel)level message:(NSString *)message;
|
||||
+ (BOOL)canLog:(LogLevel)level;
|
||||
+ (void)setFileLoggingEnabled:(BOOL)fileLoggingEnabled;
|
||||
+ (nullable NSURL *)getLogFileURL;
|
||||
+ (uint64_t)getLogFileSize;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
258
iphone/CoreApi/CoreApi/Logger/Logger.mm
Normal file
258
iphone/CoreApi/CoreApi/Logger/Logger.mm
Normal file
|
|
@ -0,0 +1,258 @@
|
|||
#import "Logger.h"
|
||||
#import <OSLog/OSLog.h>
|
||||
|
||||
#include "base/logging.hpp"
|
||||
#include "coding/zip_creator.hpp"
|
||||
|
||||
@interface Logger ()
|
||||
|
||||
@property (nullable, nonatomic) NSFileHandle * fileHandle;
|
||||
@property (nonnull, nonatomic) os_log_t osLogger;
|
||||
/// This property is introduced to avoid the CoreApi => Maps target dependency and stores the MWMSettings.isFileLoggingEnabled value.
|
||||
@property (class, nonatomic) BOOL fileLoggingEnabled;
|
||||
@property (class, readonly, nonatomic) dispatch_queue_t fileLoggingQueue;
|
||||
|
||||
+ (Logger *)logger;
|
||||
+ (void)enableFileLogging;
|
||||
+ (void)disableFileLogging;
|
||||
+ (void)logMessageWithLevel:(base::LogLevel)level src:(base::SrcPoint const &)src message:(std::string const &)message;
|
||||
+ (void)tryWriteToFile:(std::string const &)logString;
|
||||
+ (NSURL *)getZippedLogFile:(NSString *)logFilePath;
|
||||
+ (void)removeFileAtPath:(NSString *)filePath;
|
||||
+ (base::LogLevel)baseLevel:(LogLevel)level;
|
||||
|
||||
@end
|
||||
|
||||
// Subsystem and category are used for the OSLog.
|
||||
NSString * const kLoggerSubsystem = [[NSBundle mainBundle] bundleIdentifier];
|
||||
NSString * const kLoggerCategory = @"OM";
|
||||
NSString * const kLogFileName = @"log.txt";
|
||||
NSString * const kZipLogFileExtension = @"zip";
|
||||
NSString * const kLogFilePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]
|
||||
stringByAppendingPathComponent:kLogFileName];
|
||||
// TODO: (KK) Review and change this limit after some testing.
|
||||
NSUInteger const kMaxLogFileSize = 1024 * 1024 * 100; // 100 MB;
|
||||
|
||||
@implementation Logger
|
||||
|
||||
static BOOL _fileLoggingEnabled = NO;
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self == [Logger class]) {
|
||||
SetLogMessageFn(&LogMessage);
|
||||
SetAssertFunction(&AssertMessage);
|
||||
}
|
||||
}
|
||||
|
||||
+ (Logger *)logger {
|
||||
static Logger * logger = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
logger = [[self alloc] init];
|
||||
});
|
||||
return logger;
|
||||
}
|
||||
|
||||
+ (dispatch_queue_t)fileLoggingQueue {
|
||||
static dispatch_queue_t fileLoggingQueue = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
dispatch_queue_attr_t attributes = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_UTILITY, 0);
|
||||
fileLoggingQueue = dispatch_queue_create("app.comaps.fileLoggingQueue", attributes);
|
||||
});
|
||||
return fileLoggingQueue;
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_osLogger = os_log_create(kLoggerSubsystem.UTF8String, kLoggerCategory.UTF8String);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
+ (void)setFileLoggingEnabled:(BOOL)fileLoggingEnabled {
|
||||
fileLoggingEnabled ? [self enableFileLogging] : [self disableFileLogging];
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
LOG_SHORT(LINFO, ("Local time:", NSDate.date.description.UTF8String, ", Time Zone:", NSTimeZone.defaultTimeZone.abbreviation.UTF8String));
|
||||
});
|
||||
LOG(LINFO, ("File logging is enabled:", _fileLoggingEnabled ? "YES" : "NO"));
|
||||
}
|
||||
|
||||
+ (BOOL)fileLoggingEnabled {
|
||||
return _fileLoggingEnabled;
|
||||
}
|
||||
|
||||
+ (void)log:(LogLevel)level message:(NSString *)message {
|
||||
LOG_SHORT([self baseLevel:level], (message.UTF8String));
|
||||
}
|
||||
|
||||
+ (BOOL)canLog:(LogLevel)level {
|
||||
return [Logger baseLevel:level] >= base::g_LogLevel;
|
||||
}
|
||||
|
||||
+ (nullable NSURL *)getLogFileURL {
|
||||
if ([self fileLoggingEnabled]) {
|
||||
if (![NSFileManager.defaultManager fileExistsAtPath:kLogFilePath]) {
|
||||
LOG(LERROR, ("Log file doesn't exist while file logging is enabled:", kLogFilePath.UTF8String));
|
||||
return nil;
|
||||
}
|
||||
return [self getZippedLogFile:kLogFilePath];
|
||||
} else {
|
||||
// Fetch logs from the OSLog store.
|
||||
if (@available(iOS 15.0, *)) {
|
||||
NSError * error;
|
||||
OSLogStore * store = [OSLogStore storeWithScope:OSLogStoreCurrentProcessIdentifier error:&error];
|
||||
|
||||
if (error) {
|
||||
LOG(LERROR, (error.localizedDescription.UTF8String));
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSPredicate * predicate = [NSPredicate predicateWithFormat:@"subsystem == %@", kLoggerSubsystem];
|
||||
OSLogEnumerator * enumerator = [store entriesEnumeratorWithOptions:{} position:nil predicate:predicate error:&error];
|
||||
|
||||
if (error) {
|
||||
LOG(LERROR, (error.localizedDescription.UTF8String));
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSMutableString * logString = [NSMutableString string];
|
||||
NSString * kNewLineStr = @"\n";
|
||||
|
||||
id object;
|
||||
while (object = [enumerator nextObject]) {
|
||||
if ([object isMemberOfClass:[OSLogEntryLog class]]) {
|
||||
[logString appendString:[object composedMessage]];
|
||||
[logString appendString:kNewLineStr];
|
||||
}
|
||||
}
|
||||
|
||||
if (logString.length == 0) {
|
||||
LOG(LINFO, ("OSLog entry is empty."));
|
||||
return nil;
|
||||
}
|
||||
|
||||
[NSFileManager.defaultManager createFileAtPath:kLogFilePath contents:[logString dataUsingEncoding:NSUTF8StringEncoding] attributes:nil];
|
||||
return [self getZippedLogFile:kLogFilePath];
|
||||
} else {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (uint64_t)getLogFileSize {
|
||||
Logger * logger = [self logger];
|
||||
return logger.fileHandle != nil ? [logger.fileHandle offsetInFile] : 0;
|
||||
}
|
||||
|
||||
// MARK: - C++ injection
|
||||
|
||||
void LogMessage(base::LogLevel level, base::SrcPoint const & src, std::string const & message)
|
||||
{
|
||||
[Logger logMessageWithLevel:level src:src message:message];
|
||||
CHECK_LESS(level, base::g_LogAbortLevel, ("Abort. Log level is too serious", level));
|
||||
}
|
||||
|
||||
bool AssertMessage(base::SrcPoint const & src, std::string const & message)
|
||||
{
|
||||
[Logger logMessageWithLevel:base::LCRITICAL src:src message:message];
|
||||
return true;
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
+ (void)enableFileLogging {
|
||||
Logger * logger = [self logger];
|
||||
NSFileManager * fileManager = [NSFileManager defaultManager];
|
||||
|
||||
// Create a log file if it doesn't exist and setup file handle for writing.
|
||||
if (![fileManager fileExistsAtPath:kLogFilePath])
|
||||
[fileManager createFileAtPath:kLogFilePath contents:nil attributes:nil];
|
||||
NSFileHandle * fileHandle = [NSFileHandle fileHandleForWritingAtPath:kLogFilePath];
|
||||
if (fileHandle == nil) {
|
||||
LOG(LERROR, ("Failed to open log file for writing", kLogFilePath.UTF8String));
|
||||
[self disableFileLogging];
|
||||
return;
|
||||
}
|
||||
// Clean up the file if it exceeds the maximum size.
|
||||
if ([fileManager contentsAtPath:kLogFilePath].length > kMaxLogFileSize)
|
||||
[fileHandle truncateFileAtOffset:0];
|
||||
|
||||
logger.fileHandle = fileHandle;
|
||||
|
||||
_fileLoggingEnabled = YES;
|
||||
}
|
||||
|
||||
+ (void)disableFileLogging {
|
||||
Logger * logger = [self logger];
|
||||
|
||||
[logger.fileHandle closeFile];
|
||||
logger.fileHandle = nil;
|
||||
[self removeFileAtPath:kLogFilePath];
|
||||
|
||||
_fileLoggingEnabled = NO;
|
||||
}
|
||||
|
||||
+ (void)logMessageWithLevel:(base::LogLevel)level src:(base::SrcPoint const &)src message:(std::string const &)message {
|
||||
// Build the log message string.
|
||||
auto & logHelper = base::LogHelper::Instance();
|
||||
std::ostringstream output;
|
||||
// TODO: (KK) Either guard this call, or refactor thread ids in logHelper.
|
||||
logHelper.WriteProlog(output, level);
|
||||
logHelper.WriteLog(output, src, message);
|
||||
|
||||
auto const logString = output.str();
|
||||
|
||||
// Log the message into the system log.
|
||||
os_log([self logger].osLogger, "%{public}s", logString.c_str());
|
||||
|
||||
if (level < base::GetDefaultLogAbortLevel())
|
||||
dispatch_async([self fileLoggingQueue], ^{ [self tryWriteToFile:logString]; });
|
||||
else
|
||||
[self tryWriteToFile:logString];
|
||||
}
|
||||
|
||||
+ (void)tryWriteToFile:(std::string const &)logString {
|
||||
NSFileHandle * fileHandle = [self logger].fileHandle;
|
||||
if (fileHandle != nil) {
|
||||
[fileHandle seekToEndOfFile];
|
||||
[fileHandle writeData:[NSData dataWithBytes:logString.c_str() length:logString.length()]];
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSURL *)getZippedLogFile:(NSString *)logFilePath {
|
||||
NSString * zipFileName = [[logFilePath.lastPathComponent stringByDeletingPathExtension] stringByAppendingPathExtension:kZipLogFileExtension];
|
||||
NSString * zipFilePath = [[NSFileManager.defaultManager temporaryDirectory] URLByAppendingPathComponent:zipFileName].path;
|
||||
auto const success = CreateZipFromFiles({logFilePath.UTF8String}, zipFilePath.UTF8String);
|
||||
if (!success) {
|
||||
LOG(LERROR, ("Failed to zip log file:", kLogFilePath.UTF8String, ". The original file will be returned."));
|
||||
return [NSURL fileURLWithPath:logFilePath];
|
||||
}
|
||||
return [NSURL fileURLWithPath:zipFilePath];
|
||||
}
|
||||
|
||||
+ (void)removeFileAtPath:(NSString *)filePath {
|
||||
if ([NSFileManager.defaultManager fileExistsAtPath:filePath]) {
|
||||
NSError * error;
|
||||
[NSFileManager.defaultManager removeItemAtPath:filePath error:&error];
|
||||
if (error)
|
||||
LOG(LERROR, (error.localizedDescription.UTF8String));
|
||||
}
|
||||
}
|
||||
|
||||
+ (base::LogLevel)baseLevel:(LogLevel)level {
|
||||
switch (level) {
|
||||
case LogLevelDebug: return LDEBUG;
|
||||
case LogLevelInfo: return LINFO;
|
||||
case LogLevelWarning: return LWARNING;
|
||||
case LogLevelError: return LERROR;
|
||||
case LogLevelCritical: return LCRITICAL;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
31
iphone/CoreApi/CoreApi/NetworkPolicy/MWMNetworkPolicy.h
Normal file
31
iphone/CoreApi/CoreApi/NetworkPolicy/MWMNetworkPolicy.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, MWMNetworkPolicyPermission) {
|
||||
MWMNetworkPolicyPermissionAsk,
|
||||
MWMNetworkPolicyPermissionAlways,
|
||||
MWMNetworkPolicyPermissionNever,
|
||||
MWMNetworkPolicyPermissionToday,
|
||||
MWMNetworkPolicyPermissionNotToday
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, MWMConnectionType) {
|
||||
MWMConnectionTypeNone,
|
||||
MWMConnectionTypeWifi,
|
||||
MWMConnectionTypeCellular
|
||||
} NS_SWIFT_NAME(ConnectionType);
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
NS_SWIFT_NAME(NetworkPolicy)
|
||||
@interface MWMNetworkPolicy: NSObject
|
||||
|
||||
@property(nonatomic) MWMNetworkPolicyPermission permission;
|
||||
@property(nonatomic, readonly) NSDate *permissionExpirationDate;
|
||||
@property(nonatomic, readonly) BOOL canUseNetwork;
|
||||
@property(nonatomic, readonly) MWMConnectionType connectionType;
|
||||
|
||||
+ (MWMNetworkPolicy *)sharedPolicy;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
73
iphone/CoreApi/CoreApi/NetworkPolicy/MWMNetworkPolicy.mm
Normal file
73
iphone/CoreApi/CoreApi/NetworkPolicy/MWMNetworkPolicy.mm
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
#import "MWMNetworkPolicy.h"
|
||||
|
||||
#include "platform/network_policy_ios.h"
|
||||
#include "platform/platform.hpp"
|
||||
|
||||
@implementation MWMNetworkPolicy
|
||||
|
||||
+ (MWMNetworkPolicy *)sharedPolicy {
|
||||
static MWMNetworkPolicy *policy;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
policy = [[MWMNetworkPolicy alloc] init];
|
||||
});
|
||||
return policy;
|
||||
}
|
||||
|
||||
- (MWMNetworkPolicyPermission)permission {
|
||||
switch (network_policy::GetStage()) {
|
||||
case network_policy::Ask:
|
||||
return MWMNetworkPolicyPermissionAsk;
|
||||
case network_policy::Always:
|
||||
return MWMNetworkPolicyPermissionAlways;
|
||||
case network_policy::Never:
|
||||
return MWMNetworkPolicyPermissionNever;
|
||||
case network_policy::Today:
|
||||
return MWMNetworkPolicyPermissionToday;
|
||||
case network_policy::NotToday:
|
||||
return MWMNetworkPolicyPermissionNotToday;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setPermission:(MWMNetworkPolicyPermission)permission {
|
||||
network_policy::Stage stage;
|
||||
switch (permission) {
|
||||
case MWMNetworkPolicyPermissionAsk:
|
||||
stage = network_policy::Stage::Ask;
|
||||
break;
|
||||
case MWMNetworkPolicyPermissionAlways:
|
||||
stage = network_policy::Stage::Always;
|
||||
break;
|
||||
case MWMNetworkPolicyPermissionNever:
|
||||
stage = network_policy::Stage::Never;
|
||||
break;
|
||||
case MWMNetworkPolicyPermissionToday:
|
||||
stage = network_policy::Stage::Today;
|
||||
break;
|
||||
case MWMNetworkPolicyPermissionNotToday:
|
||||
stage = network_policy::Stage::NotToday;
|
||||
break;
|
||||
}
|
||||
network_policy::SetStage(stage);
|
||||
}
|
||||
|
||||
- (NSDate *)permissionExpirationDate {
|
||||
return network_policy::GetPolicyDate();
|
||||
}
|
||||
|
||||
- (BOOL)canUseNetwork {
|
||||
return network_policy::CanUseNetwork();
|
||||
}
|
||||
|
||||
- (MWMConnectionType)connectionType {
|
||||
switch (GetPlatform().ConnectionStatus()) {
|
||||
case Platform::EConnectionType::CONNECTION_NONE:
|
||||
return MWMConnectionTypeNone;
|
||||
case Platform::EConnectionType::CONNECTION_WIFI:
|
||||
return MWMConnectionTypeWifi;
|
||||
case Platform::EConnectionType::CONNECTION_WWAN:
|
||||
return MWMConnectionTypeCellular;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol IOpeningHoursLocalization
|
||||
|
||||
@property(nonatomic, readonly) NSString *closedString;
|
||||
@property(nonatomic, readonly) NSString *breakString;
|
||||
@property(nonatomic, readonly) NSString *twentyFourSevenString;
|
||||
@property(nonatomic, readonly) NSString *allDayString;
|
||||
@property(nonatomic, readonly) NSString *dailyString;
|
||||
@property(nonatomic, readonly) NSString *todayString;
|
||||
@property(nonatomic, readonly) NSString *dayOffString;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "IOpeningHoursLocalization.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace osmoh
|
||||
{
|
||||
struct Day
|
||||
{
|
||||
Day(NSString * workingDays, NSString * workingTimes, NSString * breaks)
|
||||
: m_workingDays(workingDays), m_workingTimes(workingTimes), m_breaks(breaks)
|
||||
{
|
||||
}
|
||||
|
||||
explicit Day(NSString * workingDays) : m_workingDays(workingDays), m_isOpen(false) {}
|
||||
NSString * TodayTime() const
|
||||
{
|
||||
return m_workingTimes ? [NSString stringWithFormat:@"%@ %@", m_workingDays, m_workingTimes]
|
||||
: m_workingDays;
|
||||
}
|
||||
|
||||
NSString * m_workingDays;
|
||||
NSString * m_workingTimes;
|
||||
NSString * m_breaks;
|
||||
bool m_isOpen = true;
|
||||
};
|
||||
|
||||
/// @return { Days schedule list, is closed now }
|
||||
std::pair<std::vector<osmoh::Day>, bool> processRawString(NSString *str, id<IOpeningHoursLocalization> localization);
|
||||
|
||||
} // namespace osmoh
|
||||
129
iphone/CoreApi/CoreApi/PlacePageData/Common/MWMOpeningHours.mm
Normal file
129
iphone/CoreApi/CoreApi/PlacePageData/Common/MWMOpeningHours.mm
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
#import "MWMOpeningHours.h"
|
||||
#import "MWMOpeningHoursCommon.h"
|
||||
|
||||
#include "editor/ui2oh.hpp"
|
||||
|
||||
using namespace editor;
|
||||
using namespace osmoh;
|
||||
|
||||
namespace
|
||||
{
|
||||
NSString * stringFromTimeSpan(Timespan const & timeSpan)
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@ - %@", stringFromTime(timeSpan.GetStart()),
|
||||
stringFromTime(timeSpan.GetEnd())];
|
||||
}
|
||||
|
||||
NSString * breaksFromClosedTime(TTimespans const & closedTimes, id<IOpeningHoursLocalization> localization)
|
||||
{
|
||||
NSMutableString * breaks = [@"" mutableCopy];
|
||||
auto const size = closedTimes.size();
|
||||
for (size_t i = 0; i < size; i++)
|
||||
{
|
||||
if (i)
|
||||
[breaks appendString:@"\n"];
|
||||
[breaks appendString:[NSString stringWithFormat:@"%@ %@", localization.breakString,
|
||||
stringFromTimeSpan(closedTimes[i])]];
|
||||
}
|
||||
return [breaks copy];
|
||||
}
|
||||
|
||||
void addToday(ui::TimeTable const & tt, std::vector<Day> & allDays, id<IOpeningHoursLocalization> localization)
|
||||
{
|
||||
NSString * workingDays;
|
||||
NSString * workingTimes;
|
||||
NSString * breaks;
|
||||
|
||||
BOOL const everyDay = isEveryDay(tt);
|
||||
if (tt.IsTwentyFourHours())
|
||||
{
|
||||
workingDays = everyDay ? localization.twentyFourSevenString : localization.allDayString;
|
||||
workingTimes = @"";
|
||||
breaks = @"";
|
||||
}
|
||||
else
|
||||
{
|
||||
workingDays = everyDay ? localization.dailyString : localization.todayString;
|
||||
workingTimes = stringFromTimeSpan(tt.GetOpeningTime());
|
||||
breaks = breaksFromClosedTime(tt.GetExcludeTime(), localization);
|
||||
}
|
||||
|
||||
allDays.emplace(allDays.begin(), workingDays, workingTimes, breaks);
|
||||
}
|
||||
|
||||
void addClosedToday(std::vector<Day> & allDays, id<IOpeningHoursLocalization> localization)
|
||||
{
|
||||
allDays.emplace(allDays.begin(), localization.dayOffString);
|
||||
}
|
||||
|
||||
void addDay(ui::TimeTable const & tt, std::vector<Day> & allDays, id<IOpeningHoursLocalization> localization)
|
||||
{
|
||||
NSString * workingDays = stringFromOpeningDays(tt.GetOpeningDays());
|
||||
NSString * workingTimes;
|
||||
NSString * breaks;
|
||||
if (tt.IsTwentyFourHours())
|
||||
{
|
||||
workingTimes = localization.allDayString;
|
||||
}
|
||||
else
|
||||
{
|
||||
workingTimes = stringFromTimeSpan(tt.GetOpeningTime());
|
||||
breaks = breaksFromClosedTime(tt.GetExcludeTime(), localization);
|
||||
}
|
||||
allDays.emplace_back(workingDays, workingTimes, breaks);
|
||||
}
|
||||
|
||||
void addUnhandledDays(ui::OpeningDays const & days, std::vector<Day> & allDays)
|
||||
{
|
||||
if (!days.empty())
|
||||
allDays.emplace_back(stringFromOpeningDays(days));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace osmoh {
|
||||
|
||||
std::pair<std::vector<osmoh::Day>, bool> processRawString(NSString *str, id<IOpeningHoursLocalization> localization)
|
||||
{
|
||||
osmoh::OpeningHours oh(str.UTF8String);
|
||||
bool const isClosed = oh.IsClosed(time(nullptr));
|
||||
|
||||
ui::TimeTableSet timeTableSet;
|
||||
if (!MakeTimeTableSet(oh, timeTableSet))
|
||||
return {{}, isClosed};
|
||||
|
||||
std::vector<Day> days;
|
||||
|
||||
NSCalendar * cal = NSCalendar.currentCalendar;
|
||||
cal.locale = NSLocale.currentLocale;
|
||||
|
||||
auto const timeTablesSize = timeTableSet.Size();
|
||||
auto const today =
|
||||
static_cast<Weekday>([cal components:NSCalendarUnitWeekday fromDate:[NSDate date]].weekday);
|
||||
auto const unhandledDays = timeTableSet.GetUnhandledDays();
|
||||
|
||||
/// Schedule contains more than one rule for all days or unhandled days.
|
||||
BOOL const isExtendedSchedule = timeTablesSize != 1 || !unhandledDays.empty();
|
||||
BOOL hasCurrentDay = NO;
|
||||
|
||||
for (auto const & tt : timeTableSet)
|
||||
{
|
||||
auto const & workingDays = tt.GetOpeningDays();
|
||||
if (workingDays.find(today) != workingDays.end())
|
||||
{
|
||||
hasCurrentDay = YES;
|
||||
addToday(tt, days, localization);
|
||||
}
|
||||
|
||||
if (isExtendedSchedule)
|
||||
addDay(tt, days, localization);
|
||||
}
|
||||
|
||||
if (!hasCurrentDay)
|
||||
addClosedToday(days, localization);
|
||||
|
||||
addUnhandledDays(unhandledDays, days);
|
||||
return {std::move(days), isClosed};
|
||||
}
|
||||
|
||||
} // namespace osmoh
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include "3party/opening_hours/opening_hours.hpp"
|
||||
#include "editor/opening_hours_ui.hpp"
|
||||
#include "base/assert.hpp"
|
||||
|
||||
NSDateComponents * dateComponentsFromTime(osmoh::Time const & time);
|
||||
NSDate * dateFromTime(osmoh::Time const & time);
|
||||
NSString * stringFromTime(osmoh::Time const & time);
|
||||
|
||||
NSString * stringFromOpeningDays(editor::ui::OpeningDays const & openingDays);
|
||||
|
||||
BOOL isEveryDay(editor::ui::TimeTable const & timeTable);
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
#import "MWMOpeningHoursCommon.h"
|
||||
#import "CoreApi/CoreApi-Swift.h"
|
||||
|
||||
NSDateComponents * dateComponentsFromTime(osmoh::Time const & time)
|
||||
{
|
||||
NSDateComponents * dc = [[NSDateComponents alloc] init];
|
||||
dc.hour = time.GetHoursCount();
|
||||
dc.minute = time.GetMinutesCount();
|
||||
return dc;
|
||||
}
|
||||
|
||||
NSDate * dateFromTime(osmoh::Time const & time)
|
||||
{
|
||||
NSCalendar * cal = NSCalendar.currentCalendar;
|
||||
cal.locale = NSLocale.currentLocale;
|
||||
return [cal dateFromComponents:dateComponentsFromTime(time)];
|
||||
}
|
||||
|
||||
NSString * stringFromTime(osmoh::Time const & time)
|
||||
{
|
||||
return [DateTimeFormatter dateStringFrom:dateFromTime(time)
|
||||
dateStyle:NSDateFormatterNoStyle
|
||||
timeStyle:NSDateFormatterShortStyle];
|
||||
}
|
||||
|
||||
NSString * stringFromOpeningDays(editor::ui::OpeningDays const & openingDays)
|
||||
{
|
||||
NSCalendar * cal = NSCalendar.currentCalendar;
|
||||
cal.locale = NSLocale.currentLocale;
|
||||
NSUInteger const firstWeekday = cal.firstWeekday - 1;
|
||||
|
||||
NSArray<NSString *> * weekdaySymbols = cal.shortStandaloneWeekdaySymbols;
|
||||
NSMutableArray<NSString *> * spanNames = [NSMutableArray arrayWithCapacity:2];
|
||||
NSMutableArray<NSString *> * spans = [NSMutableArray array];
|
||||
|
||||
auto weekdayFromDay = ^(NSUInteger day)
|
||||
{
|
||||
NSUInteger idx = day + 1;
|
||||
if (idx > static_cast<NSUInteger>(osmoh::Weekday::Saturday))
|
||||
idx -= static_cast<NSUInteger>(osmoh::Weekday::Saturday);
|
||||
return static_cast<osmoh::Weekday>(idx);
|
||||
};
|
||||
|
||||
auto joinSpanNames = ^
|
||||
{
|
||||
NSUInteger const spanNamesCount = spanNames.count;
|
||||
if (spanNamesCount == 0)
|
||||
return;
|
||||
else if (spanNamesCount == 1)
|
||||
[spans addObject:spanNames[0]];
|
||||
else if (spanNamesCount == 2)
|
||||
[spans addObject:[spanNames componentsJoinedByString:@"-"]];
|
||||
else
|
||||
ASSERT(false, ("Invalid span names count."));
|
||||
[spanNames removeAllObjects];
|
||||
};
|
||||
NSUInteger const weekDaysCount = 7;
|
||||
for (NSUInteger i = 0, day = firstWeekday; i < weekDaysCount; ++i, ++day)
|
||||
{
|
||||
osmoh::Weekday const wd = weekdayFromDay(day);
|
||||
if (openingDays.find(wd) == openingDays.end())
|
||||
joinSpanNames();
|
||||
else
|
||||
spanNames[(spanNames.count == 0 ? 0 : 1)] = weekdaySymbols[static_cast<NSInteger>(wd) - 1];
|
||||
}
|
||||
joinSpanNames();
|
||||
return [spans componentsJoinedByString:@", "];
|
||||
}
|
||||
|
||||
BOOL isEveryDay(editor::ui::TimeTable const & timeTable)
|
||||
{
|
||||
return timeTable.GetOpeningDays().size() == 7;
|
||||
}
|
||||
26
iphone/CoreApi/CoreApi/PlacePageData/Common/OpeningHours.h
Normal file
26
iphone/CoreApi/CoreApi/PlacePageData/Common/OpeningHours.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
@protocol IOpeningHoursLocalization;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface WorkingDay : NSObject
|
||||
|
||||
@property(nonatomic, readonly) NSString *workingDays;
|
||||
@property(nonatomic, readonly) NSString *workingTimes;
|
||||
@property(nonatomic, readonly, nullable) NSString *breaks;
|
||||
@property(nonatomic, readonly) BOOL isOpen;
|
||||
|
||||
@end
|
||||
|
||||
@interface OpeningHours : NSObject
|
||||
|
||||
@property(nonatomic, readonly) NSArray<WorkingDay *> *days;
|
||||
@property(nonatomic, readonly) BOOL isClosedNow;
|
||||
|
||||
- (nullable instancetype)initWithRawString:(NSString *)rawString
|
||||
localization:(id<IOpeningHoursLocalization>)localization;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
50
iphone/CoreApi/CoreApi/PlacePageData/Common/OpeningHours.mm
Normal file
50
iphone/CoreApi/CoreApi/PlacePageData/Common/OpeningHours.mm
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#import "OpeningHours.h"
|
||||
|
||||
#import "MWMOpeningHours.h"
|
||||
#include "3party/opening_hours/opening_hours.hpp"
|
||||
|
||||
@interface WorkingDay ()
|
||||
|
||||
@property(nonatomic, copy) NSString *workingDays;
|
||||
@property(nonatomic, copy) NSString *workingTimes;
|
||||
@property(nonatomic, copy) NSString *breaks;
|
||||
@property(nonatomic) BOOL isOpen;
|
||||
|
||||
@end
|
||||
|
||||
@implementation WorkingDay
|
||||
|
||||
@end
|
||||
|
||||
@interface OpeningHours ()
|
||||
|
||||
@property(nonatomic, strong) NSArray<WorkingDay *> *days;
|
||||
@property(nonatomic) BOOL isClosedNow;
|
||||
|
||||
@end
|
||||
|
||||
@implementation OpeningHours
|
||||
|
||||
- (instancetype)initWithRawString:(NSString *)rawString localization:(id<IOpeningHoursLocalization>)localization {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
auto const [days, isClosed] = osmoh::processRawString(rawString, localization);
|
||||
_isClosedNow = isClosed;
|
||||
NSMutableArray *array = [NSMutableArray arrayWithCapacity:days.size()];
|
||||
for (auto const & day : days) {
|
||||
WorkingDay *wd = [[WorkingDay alloc] init];
|
||||
wd.isOpen = day.m_isOpen;
|
||||
wd.workingDays = day.m_workingDays;
|
||||
wd.workingTimes = day.m_isOpen ? day.m_workingTimes : localization.closedString;
|
||||
wd.breaks = day.m_breaks;
|
||||
[array addObject:wd];
|
||||
}
|
||||
if (array.count == 0) {
|
||||
return nil;
|
||||
}
|
||||
_days = [array copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#import "PlacePageBookmarkData.h"
|
||||
|
||||
#include <CoreApi/Framework.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PlacePageBookmarkData (Core)
|
||||
|
||||
- (instancetype)initWithRawData:(place_page::Info const &)rawData;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import "MWMTypes.h"
|
||||
#import "MWMBookmarkColor.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PlacePageBookmarkData : NSObject
|
||||
|
||||
@property(nonatomic, readonly) MWMMarkID bookmarkId;
|
||||
@property(nonatomic, readonly) MWMMarkGroupID bookmarkGroupId;
|
||||
@property(nonatomic, readonly, nullable) NSString *externalTitle;
|
||||
@property(nonatomic, readonly, nullable) NSString *bookmarkDescription;
|
||||
@property(nonatomic, readonly, nullable) NSString *bookmarkCategory;
|
||||
@property(nonatomic, readonly) BOOL isHtmlDescription;
|
||||
@property(nonatomic, readonly) MWMBookmarkColor color;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#import "PlacePageBookmarkData+Core.h"
|
||||
#import "MWMBookmarkColor+Core.h"
|
||||
|
||||
@implementation PlacePageBookmarkData
|
||||
|
||||
@end
|
||||
|
||||
@implementation PlacePageBookmarkData (Core)
|
||||
|
||||
- (instancetype)initWithRawData:(place_page::Info const &)rawData {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_bookmarkId = rawData.GetBookmarkId();
|
||||
_bookmarkGroupId = rawData.GetBookmarkCategoryId();
|
||||
_externalTitle = rawData.GetSecondaryTitle().empty() ? nil : @(rawData.GetSecondaryTitle().c_str());
|
||||
_bookmarkDescription = rawData.IsBookmark() ? @(GetPreferredBookmarkStr(rawData.GetBookmarkData().m_description).c_str()) : nil;
|
||||
_bookmarkCategory = rawData.IsBookmark() ? @(rawData.GetBookmarkCategoryName().c_str()) : nil;
|
||||
_isHtmlDescription = strings::IsHTML(GetPreferredBookmarkStr(rawData.GetBookmarkData().m_description));
|
||||
_color = convertKmlColor(rawData.GetBookmarkData().m_color.m_predefinedColor);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#import "PlacePageButtonsData.h"
|
||||
|
||||
#include <CoreApi/Framework.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PlacePageButtonsData (Core)
|
||||
|
||||
- (instancetype)initWithRawData:(place_page::Info const &)rawData;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PlacePageButtonsData : NSObject
|
||||
|
||||
@property(nonatomic, readonly) BOOL showAddPlace;
|
||||
@property(nonatomic, readonly) BOOL showEditPlace;
|
||||
|
||||
@property(nonatomic, readonly) BOOL enableAddPlace;
|
||||
@property(nonatomic, readonly) BOOL enableEditPlace;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#import "PlacePageButtonsData+Core.h"
|
||||
|
||||
@implementation PlacePageButtonsData
|
||||
|
||||
@end
|
||||
|
||||
@implementation PlacePageButtonsData (Core)
|
||||
|
||||
- (instancetype)initWithRawData:(place_page::Info const &)rawData {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_showAddPlace = rawData.ShouldShowAddPlace();
|
||||
_showEditPlace = rawData.ShouldShowEditPlace();
|
||||
_enableAddPlace = rawData.ShouldEnableAddPlace();
|
||||
_enableEditPlace = rawData.ShouldEnableEditPlace();
|
||||
if (_showAddPlace || _showEditPlace || _enableAddPlace || _enableEditPlace)
|
||||
return self;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#import "PlacePageInfoData.h"
|
||||
|
||||
#include <CoreApi/Framework.h>
|
||||
|
||||
@protocol IOpeningHoursLocalization;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PlacePageInfoData (Core)
|
||||
|
||||
- (instancetype)initWithRawData:(place_page::Info const &)rawData ohLocalization:(id<IOpeningHoursLocalization>)localization;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class OpeningHours;
|
||||
@class PlacePagePhone;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PlacePageInfoData : NSObject
|
||||
|
||||
@property(nonatomic, readonly, nullable) NSString *openingHoursString;
|
||||
@property(nonatomic, readonly, nullable) NSDate *checkDate;
|
||||
@property(nonatomic, readonly, nullable) NSDate *checkDateOpeningHours;
|
||||
@property(nonatomic, readonly, nullable) OpeningHours *openingHours;
|
||||
@property(nonatomic, readonly) NSArray<PlacePagePhone *> *phones;
|
||||
@property(nonatomic, readonly, nullable) NSString *website;
|
||||
@property(nonatomic, readonly, nullable) NSString *wikipedia;
|
||||
@property(nonatomic, readonly, nullable) NSString *wikimediaCommons;
|
||||
@property(nonatomic, readonly, nullable) NSString *fediverse;
|
||||
@property(nonatomic, readonly, nullable) NSString *facebook;
|
||||
@property(nonatomic, readonly, nullable) NSString *instagram;
|
||||
@property(nonatomic, readonly, nullable) NSString *twitter;
|
||||
@property(nonatomic, readonly, nullable) NSString *vk;
|
||||
@property(nonatomic, readonly, nullable) NSString *line;
|
||||
@property(nonatomic, readonly, nullable) NSString *bluesky;
|
||||
@property(nonatomic, readonly, nullable) NSString *panoramax;
|
||||
@property(nonatomic, readonly, nullable) NSString *email;
|
||||
@property(nonatomic, readonly, nullable) NSURL *emailUrl;
|
||||
@property(nonatomic, readonly, nullable) NSString *cuisine;
|
||||
@property(nonatomic, readonly, nullable) NSString *ppOperator;
|
||||
@property(nonatomic, readonly, nullable) NSString *branch;
|
||||
@property(nonatomic, readonly, nullable) NSString *address;
|
||||
@property(nonatomic, readonly, nullable) NSArray *coordFormats;
|
||||
@property(nonatomic, readonly, nullable) NSString *wifiAvailable;
|
||||
@property(nonatomic, readonly, nullable) NSString *level;
|
||||
@property(nonatomic, readonly, nullable) NSString *atm;
|
||||
@property(nonatomic, readonly, nullable) NSString *capacity;
|
||||
@property(nonatomic, readonly, nullable) NSString *wheelchair;
|
||||
@property(nonatomic, readonly, nullable) NSString *driveThrough;
|
||||
@property(nonatomic, readonly, nullable) NSString *websiteMenu;
|
||||
@property(nonatomic, readonly, nullable) NSString *selfService;
|
||||
@property(nonatomic, readonly, nullable) NSString *outdoorSeating;
|
||||
@property(nonatomic, readonly, nullable) NSString *network;
|
||||
|
||||
- (NSDate * _Nullable)getMostRecentCheckDate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
156
iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm
Normal file
156
iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
#import "PlacePageInfoData+Core.h"
|
||||
|
||||
#import "OpeningHours.h"
|
||||
#import "PlacePagePhone.h"
|
||||
|
||||
#import <CoreApi/StringUtils.h>
|
||||
|
||||
#include "platform/localization.hpp"
|
||||
|
||||
#include "indexer/validate_and_format_contacts.hpp"
|
||||
#include "indexer/feature_meta.hpp"
|
||||
|
||||
#include "map/place_page_info.hpp"
|
||||
|
||||
using namespace place_page;
|
||||
using namespace osm;
|
||||
|
||||
/// Get localized metadata value string when string format is "type.feature.value".
|
||||
NSString * GetLocalizedMetadataValueString(MapObject::MetadataID metaID, std::string const & value) {
|
||||
return ToNSString(platform::GetLocalizedTypeName(feature::ToString(metaID) + "." + value));
|
||||
}
|
||||
|
||||
/// Parse date string in YYYY-MM-DD format to NSDate
|
||||
NSDate * _Nullable ParseDateString(NSString * _Nullable dateString) {
|
||||
if (!dateString || dateString.length == 0) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
static NSDateFormatter *dateFormatter = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
dateFormatter = [[NSDateFormatter alloc] init];
|
||||
dateFormatter.dateFormat = @"yyyy-MM-dd";
|
||||
dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
|
||||
dateFormatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"];
|
||||
});
|
||||
|
||||
return [dateFormatter dateFromString:dateString];
|
||||
}
|
||||
|
||||
@implementation PlacePageInfoData
|
||||
|
||||
- (NSDate * _Nullable)getMostRecentCheckDate {
|
||||
// CheckDate can utilize checkDateOpeningHours if that is available
|
||||
// As surveying opening hours would confirm presence
|
||||
if (_checkDate && _checkDateOpeningHours) {
|
||||
// Both available - return the more recent date
|
||||
return [_checkDate compare:_checkDateOpeningHours] == NSOrderedDescending ? _checkDate : _checkDateOpeningHours;
|
||||
} else if (_checkDate) {
|
||||
return _checkDate;
|
||||
} else if (_checkDateOpeningHours) {
|
||||
return _checkDateOpeningHours;
|
||||
} else {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PlacePageInfoData (Core)
|
||||
|
||||
- (instancetype)initWithRawData:(Info const &)rawData ohLocalization:(id<IOpeningHoursLocalization>)localization {
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
auto const cuisines = rawData.FormatCuisines();
|
||||
if (!cuisines.empty())
|
||||
_cuisine = ToNSString(cuisines);
|
||||
|
||||
/// @todo Refactor PlacePageInfoData to have a map of simple string properties.
|
||||
using MetadataID = MapObject::MetadataID;
|
||||
rawData.ForEachMetadataReadable([&](MetadataID metaID, std::string const & value)
|
||||
{
|
||||
switch (metaID)
|
||||
{
|
||||
case MetadataID::FMD_OPEN_HOURS:
|
||||
_openingHoursString = ToNSString(value);
|
||||
_openingHours = [[OpeningHours alloc] initWithRawString:_openingHoursString
|
||||
localization:localization];
|
||||
break;
|
||||
case MetadataID::FMD_CHECK_DATE:
|
||||
_checkDate = ParseDateString(ToNSString(value));
|
||||
break;
|
||||
case MetadataID::FMD_CHECK_DATE_OPEN_HOURS:
|
||||
_checkDateOpeningHours = ParseDateString(ToNSString(value));
|
||||
break;
|
||||
case MetadataID::FMD_PHONE_NUMBER:
|
||||
{
|
||||
NSArray<NSString *> *phones = [ToNSString(value) componentsSeparatedByString:@";"];
|
||||
NSMutableArray<PlacePagePhone *> *placePhones = [NSMutableArray new];
|
||||
[phones enumerateObjectsUsingBlock:^(NSString * _Nonnull phone, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
NSString *filteredDigits = [[phone componentsSeparatedByCharactersInSet:
|
||||
[[NSCharacterSet decimalDigitCharacterSet] invertedSet]]
|
||||
componentsJoinedByString:@""];
|
||||
NSString *resultNumber = [phone hasPrefix:@"+"] ? [NSString stringWithFormat:@"+%@", filteredDigits] : filteredDigits;
|
||||
NSURL *phoneUrl = [NSURL URLWithString:[NSString stringWithFormat:@"tel://%@", resultNumber]];
|
||||
|
||||
[placePhones addObject:[PlacePagePhone placePagePhoneWithPhone:phone andURL:phoneUrl]];
|
||||
}];
|
||||
_phones = [placePhones copy];
|
||||
break;
|
||||
}
|
||||
case MetadataID::FMD_WEBSITE: _website = ToNSString(value); break;
|
||||
case MetadataID::FMD_WIKIPEDIA: _wikipedia = ToNSString(value); break;
|
||||
case MetadataID::FMD_WIKIMEDIA_COMMONS: _wikimediaCommons = ToNSString(value); break;
|
||||
case MetadataID::FMD_EMAIL:
|
||||
_email = ToNSString(value);
|
||||
_emailUrl = [NSURL URLWithString:[NSString stringWithFormat:@"mailto:%@", _email]];
|
||||
break;
|
||||
case MetadataID::FMD_CONTACT_FEDIVERSE: _fediverse = ToNSString(value); break;
|
||||
case MetadataID::FMD_CONTACT_FACEBOOK: _facebook = ToNSString(value); break;
|
||||
case MetadataID::FMD_CONTACT_INSTAGRAM: _instagram = ToNSString(value); break;
|
||||
case MetadataID::FMD_CONTACT_TWITTER: _twitter = ToNSString(value); break;
|
||||
case MetadataID::FMD_CONTACT_VK: _vk = ToNSString(value); break;
|
||||
case MetadataID::FMD_CONTACT_LINE: _line = ToNSString(value); break;
|
||||
case MetadataID::FMD_CONTACT_BLUESKY: _bluesky = ToNSString(value); break;
|
||||
case MetadataID::FMD_PANORAMAX: _panoramax = ToNSString(value); break;
|
||||
case MetadataID::FMD_OPERATOR: _ppOperator = [NSString stringWithFormat:NSLocalizedString(@"operator", nil), ToNSString(value)]; break;
|
||||
case MetadataID::FMD_BRANCH: _branch = ToNSString(value); break;
|
||||
case MetadataID::FMD_INTERNET:
|
||||
_wifiAvailable = (rawData.GetInternet() == feature::Internet::No)
|
||||
? NSLocalizedString(@"no_available", nil) : NSLocalizedString(@"yes_available", nil);
|
||||
break;
|
||||
case MetadataID::FMD_LEVEL: _level = ToNSString(value); break;
|
||||
case MetadataID::FMD_CAPACITY: _capacity = [NSString stringWithFormat:NSLocalizedString(@"capacity", nil), ToNSString(value)]; break;
|
||||
case MetadataID::FMD_WHEELCHAIR: _wheelchair = ToNSString(platform::GetLocalizedTypeName(value)); break;
|
||||
case MetadataID::FMD_DRIVE_THROUGH:
|
||||
if (value == "yes")
|
||||
_driveThrough = NSLocalizedString(@"drive_through", nil);
|
||||
break;
|
||||
case MetadataID::FMD_WEBSITE_MENU: _websiteMenu = ToNSString(value); break;
|
||||
case MetadataID::FMD_SELF_SERVICE: _selfService = GetLocalizedMetadataValueString(metaID, value); break;
|
||||
case MetadataID::FMD_OUTDOOR_SEATING:
|
||||
if (value == "yes")
|
||||
_outdoorSeating = NSLocalizedString(@"outdoor_seating", nil);
|
||||
break;
|
||||
case MetadataID::FMD_NETWORK: _network = [NSString stringWithFormat:NSLocalizedString(@"network", nil), ToNSString(value)]; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
_atm = rawData.HasAtm() ? NSLocalizedStringFromTable(@"type.amenity.atm", @"LocalizableTypes", nil) : nil;
|
||||
|
||||
_address = rawData.GetSecondarySubtitle().empty() ? nil : @(rawData.GetSecondarySubtitle().c_str());
|
||||
_coordFormats = @[@(rawData.GetFormattedCoordinate(place_page::CoordinatesFormat::LatLonDMS).c_str()),
|
||||
@(rawData.GetFormattedCoordinate(place_page::CoordinatesFormat::LatLonDecimal).c_str()),
|
||||
@(rawData.GetFormattedCoordinate(place_page::CoordinatesFormat::OLCFull).c_str()),
|
||||
@(rawData.GetFormattedCoordinate(place_page::CoordinatesFormat::OSMLink).c_str()),
|
||||
@(rawData.GetFormattedCoordinate(place_page::CoordinatesFormat::UTM).c_str()),
|
||||
@(rawData.GetFormattedCoordinate(place_page::CoordinatesFormat::MGRS).c_str())];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
16
iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePagePhone.h
Normal file
16
iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePagePhone.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PlacePagePhone : NSObject
|
||||
|
||||
/// User-visible string of the phone number.
|
||||
@property(nonatomic, readonly) NSString *phone;
|
||||
/// Optional `tel:` URL, which can be used to ask iOS to call the phone number.
|
||||
@property(nonatomic, readonly, nullable) NSURL *url;
|
||||
|
||||
+ (instancetype)placePagePhoneWithPhone:(NSString *)phone andURL:(nullable NSURL *)url;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
18
iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePagePhone.m
Normal file
18
iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePagePhone.m
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#import "PlacePagePhone.h"
|
||||
|
||||
@implementation PlacePagePhone
|
||||
|
||||
- (instancetype)initWithPhone:(NSString *)phone andURL:(nullable NSURL *)url {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_phone = phone;
|
||||
_url = url;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype)placePagePhoneWithPhone:(NSString *)phone andURL:(nullable NSURL *)url {
|
||||
return [[self alloc] initWithPhone:phone andURL:url];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#import "PlacePagePreviewData.h"
|
||||
|
||||
#include <CoreApi/Framework.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PlacePagePreviewData (Core)
|
||||
|
||||
- (instancetype)initWithRawData:(place_page::Info const &)rawData;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class PlacePageScheduleData;
|
||||
@class TrackInfo;
|
||||
|
||||
typedef NS_ENUM(NSInteger, PlacePageDataHotelType) {
|
||||
PlacePageDataHotelTypeHotel,
|
||||
PlacePageDataHotelTypeApartment,
|
||||
PlacePageDataHotelTypeCampSite,
|
||||
PlacePageDataHotelTypeChalet,
|
||||
PlacePageDataHotelTypeGuestHouse,
|
||||
PlacePageDataHotelTypeHostel,
|
||||
PlacePageDataHotelTypeMotel,
|
||||
PlacePageDataHotelTypeResort,
|
||||
PlacePageDataHotelTypeNone
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, PlacePageDataOpeningHours) {
|
||||
PlacePageDataOpeningHoursUnknown,
|
||||
PlacePageDataOpeningHoursAllDay,
|
||||
PlacePageDataOpeningHoursOpen,
|
||||
PlacePageDataOpeningHoursClosed
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
PlacePageDataOpeningHours state;
|
||||
time_t nextTimeOpen;
|
||||
time_t nextTimeClosed;
|
||||
} PlacePageDataSchedule;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PlacePagePreviewData : NSObject
|
||||
|
||||
@property(nonatomic, readonly, nullable) NSString *title;
|
||||
@property(nonatomic, readonly, nullable) NSString *secondaryTitle;
|
||||
@property(nonatomic, readonly, nullable) NSString *subtitle;
|
||||
@property(nonatomic, readonly, nullable) NSString *branch;
|
||||
@property(nonatomic, readonly, nullable) NSString *coordinates;
|
||||
@property(nonatomic, readonly, nullable) NSString *secondarySubtitle;
|
||||
@property(nonatomic, readonly) PlacePageDataSchedule schedule;
|
||||
@property(nonatomic, readonly) BOOL isMyPosition;
|
||||
|
||||
- (instancetype)initWithTrackInfo:(TrackInfo * _Nonnull)trackInfo;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
#import "PlacePagePreviewData+Core.h"
|
||||
#import "DistanceFormatter.h"
|
||||
#import "AltitudeFormatter.h"
|
||||
#import "DurationFormatter.h"
|
||||
#import "TrackInfo.h"
|
||||
|
||||
#include "3party/opening_hours/opening_hours.hpp"
|
||||
|
||||
static PlacePageDataSchedule convertOpeningHours(std::string_view rawOH)
|
||||
{
|
||||
PlacePageDataSchedule schedule;
|
||||
|
||||
if (rawOH.empty()) {
|
||||
schedule.state = PlacePageDataOpeningHoursUnknown;
|
||||
return schedule;
|
||||
}
|
||||
|
||||
/// @todo Avoid temporary string when OpeningHours (boost::spirit) will allow string_view.
|
||||
osmoh::OpeningHours oh((std::string(rawOH)));
|
||||
if (!oh.IsValid()) {
|
||||
schedule.state = PlacePageDataOpeningHoursUnknown;
|
||||
return schedule;
|
||||
}
|
||||
|
||||
if (oh.IsTwentyFourHours()) {
|
||||
schedule.state = PlacePageDataOpeningHoursAllDay;
|
||||
return schedule;
|
||||
}
|
||||
|
||||
auto const t = time(nullptr);
|
||||
osmoh::OpeningHours::InfoT info = oh.GetInfo(t);
|
||||
switch (info.state) {
|
||||
case osmoh::RuleState::Open:
|
||||
schedule.state = PlacePageDataOpeningHoursOpen;
|
||||
schedule.nextTimeClosed = info.nextTimeClosed;
|
||||
break;
|
||||
|
||||
case osmoh::RuleState::Closed:
|
||||
schedule.state = PlacePageDataOpeningHoursClosed;
|
||||
schedule.nextTimeOpen = info.nextTimeOpen;
|
||||
break;
|
||||
|
||||
case osmoh::RuleState::Unknown:
|
||||
schedule.state = PlacePageDataOpeningHoursUnknown;
|
||||
break;
|
||||
}
|
||||
|
||||
return schedule;
|
||||
}
|
||||
|
||||
@implementation PlacePagePreviewData
|
||||
|
||||
- (instancetype)initWithTrackInfo:(TrackInfo * _Nonnull)trackInfo {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
NSString * kSeparator = @" • ";
|
||||
_title = [@[trackInfo.duration, trackInfo.distance] componentsJoinedByString:kSeparator];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PlacePagePreviewData (Core)
|
||||
|
||||
- (instancetype)initWithRawData:(place_page::Info const &)rawData {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_title = rawData.GetTitle().empty() ? nil : @(rawData.GetTitle().c_str());
|
||||
_secondaryTitle = rawData.GetSecondaryTitle().empty() ? nil : @(rawData.GetSecondaryTitle().c_str());
|
||||
_subtitle = rawData.GetSubtitle().empty() ? nil : @(rawData.GetSubtitle().c_str());
|
||||
_branch = rawData.GetBranch().empty() ? nil : @(rawData.GetBranch().c_str());
|
||||
_secondarySubtitle = rawData.GetSecondarySubtitle().empty() ? nil : @(rawData.GetSecondarySubtitle().c_str());
|
||||
|
||||
if (!rawData.IsTrack()) {
|
||||
_coordinates = @(rawData.GetFormattedCoordinate(place_page::CoordinatesFormat::LatLonDMS).c_str());
|
||||
_isMyPosition = rawData.IsMyPosition();
|
||||
_schedule = convertOpeningHours(rawData.GetOpeningHours());
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#import "PlacePageTrackData.h"
|
||||
|
||||
#include <CoreApi/Framework.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PlacePageTrackData (Core)
|
||||
|
||||
- (instancetype)initWithRawData:(place_page::Info const &)rawData
|
||||
onActivePointChanged:(MWMVoidBlock)onActivePointChangedHandler;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIColor.h>
|
||||
#import "MWMTypes.h"
|
||||
|
||||
@class TrackInfo;
|
||||
@class ElevationProfileData;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PlacePageTrackData : NSObject
|
||||
|
||||
@property(nonatomic, readonly) MWMTrackID trackId;
|
||||
@property(nonatomic, readonly) MWMMarkGroupID groupId;
|
||||
@property(nonatomic, readonly, nullable) NSString * trackCategory;
|
||||
// TODO: The track description is not fully implemented in the core yet.
|
||||
@property(nonatomic, readonly, nullable) NSString * trackDescription;
|
||||
|
||||
/// The color is nil for Track Recordings.
|
||||
@property(nonatomic, readonly, nullable) UIColor * color;
|
||||
@property(nonatomic, readwrite, nonnull) TrackInfo * trackInfo;
|
||||
@property(nonatomic, readwrite, nullable) ElevationProfileData * elevationProfileData;
|
||||
@property(nonatomic, readonly) double activePointDistance;
|
||||
@property(nonatomic, readonly) double myPositionDistance;
|
||||
@property(nonatomic) MWMVoidBlock onActivePointChangedHandler;
|
||||
|
||||
- (instancetype)initWithTrackInfo:(TrackInfo *)trackInfo
|
||||
elevationInfo:(ElevationProfileData * _Nullable)elevationInfo
|
||||
onActivePointChanged:(MWMVoidBlock)onActivePointChangedHandler;
|
||||
|
||||
- (void)updateActivePointDistance:(double)distance;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
#import "PlacePageTrackData+Core.h"
|
||||
#import "ElevationProfileData+Core.h"
|
||||
#import "TrackInfo+Core.h"
|
||||
|
||||
@interface PlacePageTrackData ()
|
||||
|
||||
@property(nonatomic, readwrite) double activePointDistance;
|
||||
|
||||
@end
|
||||
|
||||
@implementation PlacePageTrackData
|
||||
|
||||
- (instancetype)initWithTrackInfo:(TrackInfo *)trackInfo
|
||||
elevationInfo:(ElevationProfileData * _Nullable)elevationInfo
|
||||
onActivePointChanged:(MWMVoidBlock)onActivePointChangedHandler {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_trackInfo = trackInfo;
|
||||
_elevationProfileData = elevationInfo;
|
||||
_onActivePointChangedHandler = onActivePointChangedHandler;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)updateActivePointDistance:(double)distance {
|
||||
self.activePointDistance = distance;
|
||||
if (self.onActivePointChangedHandler)
|
||||
self.onActivePointChangedHandler();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PlacePageTrackData (Core)
|
||||
|
||||
- (instancetype)initWithRawData:(place_page::Info const &)rawData
|
||||
onActivePointChanged:(MWMVoidBlock)onActivePointChangedHandler {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
auto const trackPtr = GetFramework().GetBookmarkManager().GetTrack(rawData.GetTrackId());
|
||||
auto const & track = *trackPtr;
|
||||
auto const & bm = GetFramework().GetBookmarkManager();
|
||||
|
||||
_trackId = track.GetData().m_id;
|
||||
|
||||
auto const & groupId = track.GetGroupId();
|
||||
if (groupId && bm.HasBmCategory(groupId)) {
|
||||
_groupId = groupId;
|
||||
_trackCategory = [NSString stringWithCString:bm.GetCategoryName(groupId).c_str() encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
auto const color = track.GetColor(0);
|
||||
_color = [UIColor colorWithRed:color.GetRedF() green:color.GetGreenF() blue:color.GetBlueF() alpha:1.f];
|
||||
|
||||
_trackDescription = [NSString stringWithCString:track.GetDescription().c_str() encoding:NSUTF8StringEncoding];
|
||||
_trackInfo = [[TrackInfo alloc] initWithTrackStatistics:track.GetStatistics()];
|
||||
_activePointDistance = bm.GetElevationActivePoint(_trackId);
|
||||
_myPositionDistance = bm.GetElevationMyPosition(_trackId);
|
||||
_onActivePointChangedHandler = onActivePointChangedHandler;
|
||||
|
||||
auto const & elevationInfo = track.GetElevationInfo();
|
||||
if (track.HasAltitudes() && elevationInfo.has_value()) {
|
||||
_elevationProfileData = [[ElevationProfileData alloc] initWithTrackId:_trackId
|
||||
elevationInfo:elevationInfo.value()];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface ElevationHeightPoint : NSObject
|
||||
|
||||
@property(nonatomic, readonly) CLLocationCoordinate2D coordinates;
|
||||
@property(nonatomic, readonly) double distance;
|
||||
@property(nonatomic, readonly) double altitude;
|
||||
|
||||
- (instancetype)initWithCoordinates:(CLLocationCoordinate2D)coordinates distance:(double)distance andAltitude:(double)altitude;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#import "ElevationHeightPoint.h"
|
||||
|
||||
@implementation ElevationHeightPoint
|
||||
|
||||
- (instancetype)initWithCoordinates:(CLLocationCoordinate2D)coordinates distance:(double)distance andAltitude:(double)altitude {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_coordinates = coordinates;
|
||||
_distance = distance;
|
||||
_altitude = altitude;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#import "ElevationProfileData.h"
|
||||
#import "MWMTypes.h"
|
||||
|
||||
#include "map/elevation_info.hpp"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface ElevationProfileData (Core)
|
||||
|
||||
- (instancetype)initWithTrackId:(MWMTrackID)trackId
|
||||
elevationInfo:(ElevationInfo const &)elevationInfo;
|
||||
- (instancetype)initWithElevationInfo:(ElevationInfo const &)elevationInfo;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import "ElevationHeightPoint.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, ElevationDifficulty) {
|
||||
ElevationDifficultyDisabled,
|
||||
ElevationDifficultyEasy,
|
||||
ElevationDifficultyMedium,
|
||||
ElevationDifficultyHard
|
||||
};
|
||||
|
||||
@interface ElevationProfileData : NSObject
|
||||
|
||||
@property(nonatomic, readonly) uint64_t trackId;
|
||||
@property(nonatomic, readonly) BOOL isTrackRecording;
|
||||
@property(nonatomic, readonly) ElevationDifficulty difficulty;
|
||||
@property(nonatomic, readonly) NSArray<ElevationHeightPoint *> * points;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
#import "ElevationProfileData+Core.h"
|
||||
|
||||
#include "geometry/mercator.hpp"
|
||||
|
||||
static ElevationDifficulty convertDifficulty(uint8_t difficulty) {
|
||||
switch (difficulty) {
|
||||
case ElevationInfo::Difficulty::Easy:
|
||||
return ElevationDifficulty::ElevationDifficultyEasy;
|
||||
case ElevationInfo::Difficulty::Medium:
|
||||
return ElevationDifficulty::ElevationDifficultyMedium;
|
||||
case ElevationInfo::Difficulty::Hard:
|
||||
return ElevationDifficulty::ElevationDifficultyHard;
|
||||
case ElevationInfo::Difficulty::Unknown:
|
||||
return ElevationDifficulty::ElevationDifficultyDisabled;
|
||||
}
|
||||
return ElevationDifficulty::ElevationDifficultyDisabled;
|
||||
}
|
||||
|
||||
@implementation ElevationProfileData
|
||||
|
||||
@end
|
||||
|
||||
@implementation ElevationProfileData (Core)
|
||||
|
||||
- (instancetype)initWithTrackId:(MWMTrackID)trackId
|
||||
elevationInfo:(ElevationInfo const &)elevationInfo {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_trackId = trackId;
|
||||
_difficulty = convertDifficulty(elevationInfo.GetDifficulty());
|
||||
_points = [ElevationProfileData pointsFromElevationInfo:elevationInfo];
|
||||
_isTrackRecording = false;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithElevationInfo:(ElevationInfo const &)elevationInfo {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_difficulty = convertDifficulty(elevationInfo.GetDifficulty());
|
||||
_points = [ElevationProfileData pointsFromElevationInfo:elevationInfo];
|
||||
_isTrackRecording = true;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (NSArray<ElevationHeightPoint *> *)pointsFromElevationInfo:(ElevationInfo const &)elevationInfo {
|
||||
auto const & points = elevationInfo.GetPoints();
|
||||
NSMutableArray * pointsArray = [[NSMutableArray alloc] initWithCapacity:points.size()];
|
||||
for (auto const & point : points) {
|
||||
auto pointLatLon = mercator::ToLatLon(point.m_point.GetPoint());
|
||||
CLLocationCoordinate2D coordinates = CLLocationCoordinate2DMake(pointLatLon.m_lat, pointLatLon.m_lon);
|
||||
ElevationHeightPoint * elevationPoint = [[ElevationHeightPoint alloc] initWithCoordinates:coordinates
|
||||
distance:point.m_distance
|
||||
andAltitude:point.m_point.GetAltitude()];
|
||||
[pointsArray addObject:elevationPoint];
|
||||
}
|
||||
return pointsArray;
|
||||
}
|
||||
|
||||
@end
|
||||
65
iphone/CoreApi/CoreApi/PlacePageData/PlacePageData.h
Normal file
65
iphone/CoreApi/CoreApi/PlacePageData/PlacePageData.h
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
#import "MWMTypes.h"
|
||||
|
||||
@class PlacePageButtonsData;
|
||||
@class PlacePageTrackData;
|
||||
@class PlacePagePreviewData;
|
||||
@class PlacePageInfoData;
|
||||
@class PlacePageBookmarkData;
|
||||
@class MWMMapNodeAttributes;
|
||||
@class TrackInfo;
|
||||
@class ElevationProfileData;
|
||||
|
||||
typedef NS_ENUM(NSInteger, PlacePageRoadType) {
|
||||
PlacePageRoadTypeToll,
|
||||
PlacePageRoadTypeFerry,
|
||||
PlacePageRoadTypeDirty,
|
||||
PlacePageRoadTypeNone
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, PlacePageObjectType) {
|
||||
PlacePageObjectTypePOI,
|
||||
PlacePageObjectTypeBookmark,
|
||||
PlacePageObjectTypeTrack,
|
||||
PlacePageObjectTypeTrackRecording
|
||||
};
|
||||
|
||||
@protocol IOpeningHoursLocalization;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PlacePageData : NSObject
|
||||
|
||||
@property(class, nonatomic, readonly) BOOL hasData;
|
||||
|
||||
@property(nonatomic, readonly, nullable) PlacePageButtonsData *buttonsData;
|
||||
@property(nonatomic, readonly) PlacePagePreviewData *previewData;
|
||||
@property(nonatomic, readonly, nullable) PlacePageInfoData *infoData;
|
||||
@property(nonatomic, readonly, nullable) PlacePageBookmarkData *bookmarkData;
|
||||
@property(nonatomic, readonly) PlacePageRoadType roadType;
|
||||
@property(nonatomic, readonly, nullable) NSString *wikiDescriptionHtml;
|
||||
@property(nonatomic, readonly, nullable) PlacePageTrackData *trackData;
|
||||
@property(nonatomic, readonly, nullable) MWMMapNodeAttributes *mapNodeAttributes;
|
||||
@property(nonatomic, readonly, nullable) NSString *bookingSearchUrl;
|
||||
@property(nonatomic, readonly) BOOL isMyPosition;
|
||||
@property(nonatomic, readonly) BOOL isPreviewPlus;
|
||||
@property(nonatomic, readonly) BOOL isRoutePoint;
|
||||
@property(nonatomic, readonly) PlacePageObjectType objectType;
|
||||
@property(nonatomic, readonly) CLLocationCoordinate2D locationCoordinate;
|
||||
@property(nonatomic, copy, nullable) MWMVoidBlock onBookmarkStatusUpdate;
|
||||
@property(nonatomic, copy, nullable) MWMVoidBlock onMapNodeStatusUpdate;
|
||||
@property(nonatomic, copy, nullable) MWMVoidBlock onTrackRecordingProgressUpdate;
|
||||
@property(nonatomic, copy, nullable) void (^onMapNodeProgressUpdate)(uint64_t downloadedBytes, uint64_t totalBytes);
|
||||
|
||||
- (instancetype)initWithLocalizationProvider:(id<IOpeningHoursLocalization>)localization;
|
||||
- (instancetype)initWithTrackInfo:(TrackInfo * _Nonnull)trackInfo elevationInfo:(ElevationProfileData * _Nullable)elevationInfo;
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
- (void)updateBookmarkStatus;
|
||||
- (void)updateWithTrackInfo:(TrackInfo * _Nonnull)trackInfo elevationInfo:(ElevationProfileData * _Nullable)elevationInfo;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
190
iphone/CoreApi/CoreApi/PlacePageData/PlacePageData.mm
Normal file
190
iphone/CoreApi/CoreApi/PlacePageData/PlacePageData.mm
Normal file
|
|
@ -0,0 +1,190 @@
|
|||
#import "PlacePageData.h"
|
||||
|
||||
#import "PlacePageButtonsData+Core.h"
|
||||
#import "PlacePagePreviewData+Core.h"
|
||||
#import "PlacePageInfoData+Core.h"
|
||||
#import "PlacePageBookmarkData+Core.h"
|
||||
#import "PlacePageTrackData+Core.h"
|
||||
#import "ElevationProfileData+Core.h"
|
||||
#import "MWMMapNodeAttributes.h"
|
||||
|
||||
#include <CoreApi/CoreApi.h>
|
||||
#include "platform/network_policy.hpp"
|
||||
|
||||
static place_page::Info & rawData() { return GetFramework().GetCurrentPlacePageInfo(); }
|
||||
|
||||
static PlacePageRoadType convertRoadType(RoadWarningMarkType roadType) {
|
||||
switch (roadType) {
|
||||
case RoadWarningMarkType::Toll:
|
||||
return PlacePageRoadTypeToll;
|
||||
case RoadWarningMarkType::Ferry:
|
||||
return PlacePageRoadTypeFerry;
|
||||
case RoadWarningMarkType::Dirty:
|
||||
return PlacePageRoadTypeDirty;
|
||||
case RoadWarningMarkType::Count:
|
||||
return PlacePageRoadTypeNone;
|
||||
}
|
||||
}
|
||||
|
||||
@interface PlacePageData () <MWMStorageObserver> {
|
||||
FeatureID m_featureID;
|
||||
m2::PointD m_mercator;
|
||||
std::vector<std::string> m_rawTypes;
|
||||
}
|
||||
|
||||
@property(nonatomic, readwrite) PlacePagePreviewData *previewData;
|
||||
@property(nonatomic, readwrite) CLLocationCoordinate2D locationCoordinate;
|
||||
|
||||
- (PlacePageObjectType)objectTypeFromRawData;
|
||||
|
||||
@end
|
||||
|
||||
@implementation PlacePageData
|
||||
|
||||
- (instancetype)initWithLocalizationProvider:(id<IOpeningHoursLocalization>)localization {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_buttonsData = [[PlacePageButtonsData alloc] initWithRawData:rawData()];
|
||||
_infoData = [[PlacePageInfoData alloc] initWithRawData:rawData() ohLocalization:localization];
|
||||
|
||||
if (rawData().IsBookmark()) {
|
||||
_bookmarkData = [[PlacePageBookmarkData alloc] initWithRawData:rawData()];
|
||||
}
|
||||
|
||||
if (auto const & wikiDescription = rawData().GetWikiDescription(); !wikiDescription.empty()) {
|
||||
_wikiDescriptionHtml = @(("<html><body>" + wikiDescription + "</body></html>").c_str());
|
||||
}
|
||||
|
||||
_roadType = convertRoadType(rawData().GetRoadType());
|
||||
|
||||
_isMyPosition = rawData().IsMyPosition();
|
||||
_isRoutePoint = rawData().IsRoutePoint();
|
||||
_isPreviewPlus = rawData().GetOpeningMode() == place_page::OpeningMode::PreviewPlus;
|
||||
auto latlon = rawData().GetLatLon();
|
||||
_locationCoordinate = CLLocationCoordinate2DMake(latlon.m_lat, latlon.m_lon);
|
||||
|
||||
NSMutableArray *tagsArray = [NSMutableArray array];
|
||||
for (auto const & s : rawData().GetRawTypes()) {
|
||||
[tagsArray addObject:@(s.c_str())];
|
||||
}
|
||||
|
||||
if (rawData().IsTrack()) {
|
||||
__weak auto weakSelf = self;
|
||||
_trackData = [[PlacePageTrackData alloc] initWithRawData:rawData() onActivePointChanged:^(void) {
|
||||
[weakSelf handleActiveTrackSelectionPointChanged];
|
||||
}];
|
||||
}
|
||||
_previewData = [[PlacePagePreviewData alloc] initWithRawData:rawData()];
|
||||
|
||||
auto const &countryId = rawData().GetCountryId();
|
||||
if (!countryId.empty()) {
|
||||
_mapNodeAttributes = [[MWMStorage sharedStorage] attributesForCountry:@(rawData().GetCountryId().c_str())];
|
||||
[[MWMStorage sharedStorage] addObserver:self];
|
||||
}
|
||||
|
||||
_objectType = [self objectTypeFromRawData];
|
||||
|
||||
m_featureID = rawData().GetID();
|
||||
m_mercator = rawData().GetMercator();
|
||||
m_rawTypes = rawData().GetRawTypes();
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithTrackInfo:(TrackInfo * _Nonnull)trackInfo elevationInfo:(ElevationProfileData * _Nullable)elevationInfo {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_objectType = PlacePageObjectTypeTrackRecording;
|
||||
_roadType = PlacePageRoadTypeNone;
|
||||
_previewData = [[PlacePagePreviewData alloc] initWithTrackInfo:trackInfo];
|
||||
__weak auto weakSelf = self;
|
||||
_trackData = [[PlacePageTrackData alloc] initWithTrackInfo:trackInfo
|
||||
elevationInfo:elevationInfo
|
||||
onActivePointChanged:^(void) {
|
||||
[weakSelf handleActiveTrackSelectionPointChanged];
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)updateWithTrackInfo:(TrackInfo * _Nonnull)trackInfo elevationInfo:(ElevationProfileData * _Nullable)elevationInfo {
|
||||
_previewData = [[PlacePagePreviewData alloc] initWithTrackInfo:trackInfo];
|
||||
_trackData.trackInfo = trackInfo;
|
||||
_trackData.elevationProfileData = elevationInfo;
|
||||
if (self.onTrackRecordingProgressUpdate != nil)
|
||||
self.onTrackRecordingProgressUpdate();
|
||||
}
|
||||
|
||||
- (void)handleActiveTrackSelectionPointChanged
|
||||
{
|
||||
if (!self || !PlacePageData.hasData || !rawData().IsTrack())
|
||||
return;
|
||||
auto const & trackInfo = GetFramework().GetBookmarkManager().GetTrackSelectionInfo(rawData().GetTrackId());
|
||||
auto const latlon = mercator::ToLatLon(trackInfo.m_trackPoint);
|
||||
_locationCoordinate = CLLocationCoordinate2DMake(latlon.m_lat, latlon.m_lon);
|
||||
self.previewData = [[PlacePagePreviewData alloc] initWithRawData:rawData()];
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
if (self.mapNodeAttributes != nil) {
|
||||
[[MWMStorage sharedStorage] removeObserver:self];
|
||||
}
|
||||
}
|
||||
|
||||
+ (BOOL)hasData {
|
||||
return GetFramework().HasPlacePageInfo();
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (void)updateBookmarkStatus {
|
||||
if (!GetFramework().HasPlacePageInfo()) {
|
||||
return;
|
||||
}
|
||||
if (rawData().IsBookmark()) {
|
||||
_bookmarkData = [[PlacePageBookmarkData alloc] initWithRawData:rawData()];
|
||||
} else if (rawData().IsTrack()) {
|
||||
__weak auto weakSelf = self;
|
||||
_trackData = [[PlacePageTrackData alloc] initWithRawData:rawData() onActivePointChanged:^(void) {
|
||||
[weakSelf handleActiveTrackSelectionPointChanged];
|
||||
}];
|
||||
} else {
|
||||
_bookmarkData = nil;
|
||||
}
|
||||
_previewData = [[PlacePagePreviewData alloc] initWithRawData:rawData()];
|
||||
_objectType = [self objectTypeFromRawData];
|
||||
if (self.onBookmarkStatusUpdate != nil) {
|
||||
self.onBookmarkStatusUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
- (PlacePageObjectType)objectTypeFromRawData {
|
||||
if (rawData().IsBookmark()) {
|
||||
return PlacePageObjectTypeBookmark;
|
||||
} else if (rawData().IsTrack()) {
|
||||
return PlacePageObjectTypeTrack;
|
||||
} else if (self.trackData) {
|
||||
return PlacePageObjectTypeTrackRecording;
|
||||
} else {
|
||||
return PlacePageObjectTypePOI;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - MWMStorageObserver
|
||||
|
||||
- (void)processCountryEvent:(NSString *)countryId {
|
||||
if ([countryId isEqualToString:self.mapNodeAttributes.countryId]) {
|
||||
_mapNodeAttributes = [[MWMStorage sharedStorage] attributesForCountry:countryId];
|
||||
if (self.onMapNodeStatusUpdate != nil) {
|
||||
self.onMapNodeStatusUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)processCountry:(NSString *)countryId downloadedBytes:(uint64_t)downloadedBytes totalBytes:(uint64_t)totalBytes {
|
||||
if ([countryId isEqualToString:self.mapNodeAttributes.countryId] && self.onMapNodeProgressUpdate != nil) {
|
||||
self.onMapNodeProgressUpdate(downloadedBytes, totalBytes);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
16
iphone/CoreApi/CoreApi/Search/MWMSearchFrameworkHelper.h
Normal file
16
iphone/CoreApi/CoreApi/Search/MWMSearchFrameworkHelper.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MWMSearchFrameworkHelper : NSObject
|
||||
|
||||
+ (NSArray<NSString *> *)searchCategories;
|
||||
|
||||
+ (BOOL)isSearchHistoryEmpty;
|
||||
+ (BOOL)isLanguageSupported:(NSString *)languageCode;
|
||||
+ (NSArray<NSString *> *)lastSearchQueries;
|
||||
+ (void)clearSearchHistory;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
43
iphone/CoreApi/CoreApi/Search/MWMSearchFrameworkHelper.mm
Normal file
43
iphone/CoreApi/CoreApi/Search/MWMSearchFrameworkHelper.mm
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#import "MWMSearchFrameworkHelper.h"
|
||||
|
||||
#include "platform/preferred_languages.hpp"
|
||||
#include "search/displayed_categories.hpp"
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
@implementation MWMSearchFrameworkHelper
|
||||
|
||||
+ (NSArray<NSString *> *)searchCategories
|
||||
{
|
||||
NSMutableArray * result = [NSMutableArray array];
|
||||
auto const & categories = GetFramework().GetDisplayedCategories().GetKeys();
|
||||
for (auto const & item : categories)
|
||||
[result addObject:@(item.c_str())];
|
||||
return [result copy];
|
||||
}
|
||||
|
||||
+ (BOOL)isSearchHistoryEmpty
|
||||
{
|
||||
return GetFramework().GetSearchAPI().GetLastSearchQueries().empty();
|
||||
}
|
||||
|
||||
+ (BOOL)isLanguageSupported:(NSString *)languageCode
|
||||
{
|
||||
return search::DisplayedCategories::IsLanguageSupported(languageCode.UTF8String);
|
||||
}
|
||||
|
||||
+ (NSArray<NSString *> *)lastSearchQueries
|
||||
{
|
||||
NSMutableArray * result = [NSMutableArray array];
|
||||
auto const & queries = GetFramework().GetSearchAPI().GetLastSearchQueries();
|
||||
for (auto const & item : queries)
|
||||
[result addObject:@(item.second.c_str())];
|
||||
return [result copy];
|
||||
}
|
||||
|
||||
+ (void)clearSearchHistory
|
||||
{
|
||||
GetFramework().GetSearchAPI().ClearSearchHistory();
|
||||
}
|
||||
|
||||
@end
|
||||
16
iphone/CoreApi/CoreApi/Storage/MWMMapNodeAttributes+Core.h
Normal file
16
iphone/CoreApi/CoreApi/Storage/MWMMapNodeAttributes+Core.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#import "MWMMapNodeAttributes.h"
|
||||
|
||||
#include <CoreApi/Framework.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MWMMapNodeAttributes (Core)
|
||||
|
||||
- (instancetype)initWithCoreAttributes:(storage::NodeAttrs const &)attributes
|
||||
countryId:(NSString *)countryId
|
||||
hasParent:(BOOL)hasParent
|
||||
hasChildren:(BOOL)hasChildren;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
48
iphone/CoreApi/CoreApi/Storage/MWMMapNodeAttributes.h
Normal file
48
iphone/CoreApi/CoreApi/Storage/MWMMapNodeAttributes.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, MWMMapNodeStatus) {
|
||||
MWMMapNodeStatusUndefined,
|
||||
MWMMapNodeStatusDownloading,
|
||||
MWMMapNodeStatusApplying,
|
||||
MWMMapNodeStatusInQueue,
|
||||
MWMMapNodeStatusError,
|
||||
MWMMapNodeStatusOnDiskOutOfDate,
|
||||
MWMMapNodeStatusOnDisk,
|
||||
MWMMapNodeStatusNotDownloaded,
|
||||
MWMMapNodeStatusPartly
|
||||
} NS_SWIFT_NAME(MapNodeStatus);
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
NS_SWIFT_NAME(CountryIdAndName)
|
||||
@interface MWMCountryIdAndName: NSObject
|
||||
|
||||
@property(nonatomic, readonly) NSString *countryId;
|
||||
@property(nonatomic, readonly) NSString *countryName;
|
||||
|
||||
- (instancetype)initWithCountryId:(NSString *)countryId name:(NSString *)countryName;
|
||||
|
||||
@end
|
||||
|
||||
NS_SWIFT_NAME(MapNodeAttributes)
|
||||
@interface MWMMapNodeAttributes : NSObject
|
||||
|
||||
@property(nonatomic, readonly) NSString *countryId;
|
||||
@property(nonatomic, readonly) NSUInteger totalMwmCount;
|
||||
@property(nonatomic, readonly) NSUInteger downloadedMwmCount;
|
||||
@property(nonatomic, readonly) NSUInteger downloadingMwmCount;
|
||||
@property(nonatomic, readonly) uint64_t totalSize;
|
||||
@property(nonatomic, readonly) uint64_t downloadedSize;
|
||||
@property(nonatomic, readonly) uint64_t downloadingSize;
|
||||
@property(nonatomic, readonly) uint64_t totalUpdateSizeBytes;
|
||||
@property(nonatomic, readonly) NSString *nodeName;
|
||||
@property(nonatomic, readonly) NSString *nodeDescription;
|
||||
@property(nonatomic, readonly) MWMMapNodeStatus nodeStatus;
|
||||
@property(nonatomic, readonly) BOOL hasChildren;
|
||||
@property(nonatomic, readonly) BOOL hasParent;
|
||||
@property(nonatomic, readonly) NSArray<MWMCountryIdAndName *> *parentInfo;
|
||||
@property(nonatomic, readonly, nullable) NSArray<MWMCountryIdAndName *> *topmostParentInfo;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
105
iphone/CoreApi/CoreApi/Storage/MWMMapNodeAttributes.mm
Normal file
105
iphone/CoreApi/CoreApi/Storage/MWMMapNodeAttributes.mm
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
#import "MWMMapNodeAttributes+Core.h"
|
||||
#include <CoreApi/Framework.h>
|
||||
|
||||
static MWMMapNodeStatus convertStatus(storage::NodeStatus status) {
|
||||
switch (status) {
|
||||
case storage::NodeStatus::Undefined:
|
||||
return MWMMapNodeStatusUndefined;
|
||||
case storage::NodeStatus::Downloading:
|
||||
return MWMMapNodeStatusDownloading;
|
||||
case storage::NodeStatus::Applying:
|
||||
return MWMMapNodeStatusApplying;
|
||||
case storage::NodeStatus::InQueue:
|
||||
return MWMMapNodeStatusInQueue;
|
||||
case storage::NodeStatus::Error:
|
||||
return MWMMapNodeStatusError;
|
||||
case storage::NodeStatus::OnDiskOutOfDate:
|
||||
return MWMMapNodeStatusOnDiskOutOfDate;
|
||||
case storage::NodeStatus::OnDisk:
|
||||
return MWMMapNodeStatusOnDisk;
|
||||
case storage::NodeStatus::NotDownloaded:
|
||||
return MWMMapNodeStatusNotDownloaded;
|
||||
case storage::NodeStatus::Partly:
|
||||
return MWMMapNodeStatusPartly;
|
||||
}
|
||||
}
|
||||
|
||||
@interface MWMCountryIdAndName ()
|
||||
|
||||
@property(nonatomic, copy) NSString *countryId;
|
||||
@property(nonatomic, copy) NSString *countryName;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMCountryIdAndName
|
||||
|
||||
- (instancetype)initWithCountryId:(NSString *)countryId name:(NSString *)countryName {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_countryId = countryId;
|
||||
_countryName = countryName;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCountryAndName:(storage::CountryIdAndName const &)countryAndName {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_countryId = @(countryAndName.m_id.c_str());
|
||||
_countryName = @(countryAndName.m_localName.c_str());
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMMapNodeAttributes
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMMapNodeAttributes (Core)
|
||||
|
||||
- (instancetype)initWithCoreAttributes:(storage::NodeAttrs const &)attributes
|
||||
countryId:(NSString *)countryId
|
||||
hasParent:(BOOL)hasParent
|
||||
hasChildren:(BOOL)hasChildren {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_countryId = [countryId copy];
|
||||
_totalMwmCount = attributes.m_mwmCounter;
|
||||
_downloadedMwmCount = attributes.m_localMwmCounter;
|
||||
_downloadingMwmCount = attributes.m_downloadingMwmCounter - attributes.m_localMwmCounter;
|
||||
_totalSize = attributes.m_mwmSize;
|
||||
_downloadedSize = attributes.m_localMwmSize;
|
||||
_downloadingSize = attributes.m_downloadingMwmSize - attributes.m_localMwmSize;
|
||||
_nodeName = @(attributes.m_nodeLocalName.c_str());
|
||||
_nodeDescription = @(attributes.m_nodeLocalDescription.c_str());
|
||||
_nodeStatus = convertStatus(attributes.m_status);
|
||||
_hasChildren = hasChildren;
|
||||
_hasParent = hasParent;
|
||||
|
||||
storage::Storage::UpdateInfo updateInfo;
|
||||
if (GetFramework().GetStorage().GetUpdateInfo([countryId UTF8String], updateInfo)) {
|
||||
_totalUpdateSizeBytes = updateInfo.m_totalDownloadSizeInBytes;
|
||||
} else {
|
||||
_totalUpdateSizeBytes = 0;
|
||||
}
|
||||
|
||||
NSMutableArray *parentInfoArray = [NSMutableArray arrayWithCapacity:attributes.m_parentInfo.size()];
|
||||
for (auto const &pi : attributes.m_parentInfo) {
|
||||
MWMCountryIdAndName *cn = [[MWMCountryIdAndName alloc] initWithCountryAndName:pi];
|
||||
[parentInfoArray addObject:cn];
|
||||
}
|
||||
_parentInfo = [parentInfoArray copy];
|
||||
|
||||
NSMutableArray *topmostInfoArray = [NSMutableArray arrayWithCapacity:attributes.m_topmostParentInfo.size()];
|
||||
for (auto const &pi : attributes.m_topmostParentInfo) {
|
||||
MWMCountryIdAndName *cn = [[MWMCountryIdAndName alloc] initWithCountryAndName:pi];
|
||||
[topmostInfoArray addObject:cn];
|
||||
}
|
||||
_topmostParentInfo = topmostInfoArray.count > 0 ? [topmostInfoArray copy] : nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
13
iphone/CoreApi/CoreApi/Storage/MWMMapSearchResult+Core.h
Normal file
13
iphone/CoreApi/CoreApi/Storage/MWMMapSearchResult+Core.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#import "MWMMapSearchResult.h"
|
||||
|
||||
#include <CoreApi/Framework.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MWMMapSearchResult (Core)
|
||||
|
||||
- (instancetype)initWithSearchResult:(storage::DownloaderSearchResult const &)searchResult;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
13
iphone/CoreApi/CoreApi/Storage/MWMMapSearchResult.h
Normal file
13
iphone/CoreApi/CoreApi/Storage/MWMMapSearchResult.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
NS_SWIFT_NAME(MapSearchResult)
|
||||
@interface MWMMapSearchResult : NSObject
|
||||
|
||||
@property(nonatomic, readonly) NSString *countryId;
|
||||
@property(nonatomic, readonly) NSString *matchedName;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
18
iphone/CoreApi/CoreApi/Storage/MWMMapSearchResult.mm
Normal file
18
iphone/CoreApi/CoreApi/Storage/MWMMapSearchResult.mm
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#import "MWMMapSearchResult+Core.h"
|
||||
|
||||
@implementation MWMMapSearchResult
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMMapSearchResult (Core)
|
||||
|
||||
- (instancetype)initWithSearchResult:(storage::DownloaderSearchResult const &)searchResult {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_countryId = @(searchResult.m_countryId.c_str());
|
||||
_matchedName = @(searchResult.m_matchedName.c_str());
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
13
iphone/CoreApi/CoreApi/Storage/MWMMapUpdateInfo+Core.h
Normal file
13
iphone/CoreApi/CoreApi/Storage/MWMMapUpdateInfo+Core.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#import "MWMMapUpdateInfo.h"
|
||||
|
||||
#include <CoreApi/Framework.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MWMMapUpdateInfo (Core)
|
||||
|
||||
- (instancetype)initWithUpdateInfo:(storage::Storage::UpdateInfo const &)updateInfo;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
14
iphone/CoreApi/CoreApi/Storage/MWMMapUpdateInfo.h
Normal file
14
iphone/CoreApi/CoreApi/Storage/MWMMapUpdateInfo.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
NS_SWIFT_NAME(MapUpdateInfo)
|
||||
@interface MWMMapUpdateInfo : NSObject
|
||||
|
||||
@property(nonatomic, readonly) uint32_t numberOfFiles;
|
||||
@property(nonatomic, readonly) uint64_t updateSize;
|
||||
@property(nonatomic, readonly) uint64_t differenceSize;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
19
iphone/CoreApi/CoreApi/Storage/MWMMapUpdateInfo.mm
Normal file
19
iphone/CoreApi/CoreApi/Storage/MWMMapUpdateInfo.mm
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#import "MWMMapUpdateInfo+Core.h"
|
||||
|
||||
@implementation MWMMapUpdateInfo
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMMapUpdateInfo (Core)
|
||||
|
||||
- (instancetype)initWithUpdateInfo:(storage::Storage::UpdateInfo const &)updateInfo {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_numberOfFiles = updateInfo.m_numberOfMwmFilesToUpdate;
|
||||
_updateSize = updateInfo.m_totalDownloadSizeInBytes;
|
||||
_differenceSize = updateInfo.m_sizeDifference;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
68
iphone/CoreApi/CoreApi/Storage/MWMStorage.h
Normal file
68
iphone/CoreApi/CoreApi/Storage/MWMStorage.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
@class MWMMapNodeAttributes;
|
||||
@class MWMMapUpdateInfo;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
extern NSErrorDomain const kStorageErrorDomain;
|
||||
|
||||
extern NSInteger const kStorageNotEnoughSpace;
|
||||
extern NSInteger const kStorageNoConnection;
|
||||
extern NSInteger const kStorageCellularForbidden;
|
||||
extern NSInteger const kStorageRoutingActive;
|
||||
extern NSInteger const kStorageHaveUnsavedEdits;
|
||||
|
||||
NS_SWIFT_NAME(StorageObserver)
|
||||
@protocol MWMStorageObserver <NSObject>
|
||||
|
||||
- (void)processCountryEvent:(NSString *)countryId;
|
||||
|
||||
@optional
|
||||
|
||||
- (void)processCountry:(NSString *)countryId
|
||||
downloadedBytes:(uint64_t)downloadedBytes
|
||||
totalBytes:(uint64_t)totalBytes;
|
||||
|
||||
@end
|
||||
|
||||
NS_SWIFT_NAME(Storage)
|
||||
@interface MWMStorage : NSObject
|
||||
|
||||
+ (instancetype)sharedStorage;
|
||||
|
||||
- (BOOL)downloadNode:(NSString *)countryId error:(NSError * __autoreleasing _Nullable *)error;
|
||||
- (void)retryDownloadNode:(NSString *)countryId;
|
||||
- (BOOL)updateNode:(NSString *)countryId error:(NSError * __autoreleasing _Nullable *)error;
|
||||
- (BOOL)deleteNode:(NSString *)countryId
|
||||
ignoreUnsavedEdits:(BOOL)force
|
||||
error:(NSError * __autoreleasing _Nullable *)error;
|
||||
- (void)cancelDownloadNode:(NSString *)countryId;
|
||||
- (void)showNode:(NSString *)countryId;
|
||||
- (BOOL)downloadNodes:(NSArray<NSString *> *)countryIds error:(NSError * __autoreleasing _Nullable *)error;
|
||||
|
||||
- (BOOL)haveDownloadedCountries;
|
||||
- (BOOL)downloadInProgress;
|
||||
- (void)enableCellularDownload:(BOOL)enable;
|
||||
|
||||
- (void)addObserver:(id<MWMStorageObserver>)observer;
|
||||
- (void)removeObserver:(id<MWMStorageObserver>)observer;
|
||||
|
||||
#pragma mark - Attributes
|
||||
|
||||
- (NSArray<NSString *> *)allCountries;
|
||||
- (NSArray<NSString *> *)allCountriesWithParent:(NSString *)countryId;
|
||||
- (NSArray<NSString *> *)availableCountriesWithParent:(NSString *)countryId;
|
||||
- (NSArray<NSString *> *)downloadedCountries;
|
||||
- (NSArray<NSString *> *)downloadedCountriesWithParent:(NSString *)countryId;
|
||||
- (MWMMapNodeAttributes *)attributesForCountry:(NSString *)countryId;
|
||||
- (MWMMapNodeAttributes *)attributesForRoot;
|
||||
- (NSString *)getRootId;
|
||||
- (NSString *)nameForCountry:(NSString *)countryId;
|
||||
- (nullable NSArray<NSString *> *)nearbyAvailableCountries:(CLLocationCoordinate2D)location;
|
||||
- (MWMMapUpdateInfo *)updateInfoWithParent:(nullable NSString *)countryId;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
316
iphone/CoreApi/CoreApi/Storage/MWMStorage.mm
Normal file
316
iphone/CoreApi/CoreApi/Storage/MWMStorage.mm
Normal file
|
|
@ -0,0 +1,316 @@
|
|||
#import "MWMStorage.h"
|
||||
#import "MWMMapNodeAttributes+Core.h"
|
||||
#import "MWMMapUpdateInfo+Core.h"
|
||||
|
||||
#include <CoreApi/Framework.h>
|
||||
|
||||
#include "storage/country_info_getter.hpp"
|
||||
#include "storage/storage_helpers.hpp"
|
||||
|
||||
NSErrorDomain const kStorageErrorDomain = @"com.mapswithme.storage";
|
||||
|
||||
NSInteger const kStorageNotEnoughSpace = 1;
|
||||
NSInteger const kStorageNoConnection = 2;
|
||||
NSInteger const kStorageCellularForbidden = 3;
|
||||
NSInteger const kStorageRoutingActive = 4;
|
||||
NSInteger const kStorageHaveUnsavedEdits = 5;
|
||||
|
||||
using namespace storage;
|
||||
|
||||
@interface MWMStorage ()
|
||||
|
||||
@property(nonatomic, strong) NSHashTable<id<MWMStorageObserver>> *observers;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMStorage
|
||||
|
||||
+ (instancetype)sharedStorage {
|
||||
static MWMStorage *instance;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
instance = [[self alloc] init];
|
||||
});
|
||||
return instance;
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_observers = [NSHashTable weakObjectsHashTable];
|
||||
NSHashTable *observers = _observers;
|
||||
|
||||
GetFramework().GetStorage().Subscribe(
|
||||
[observers](CountryId const & countryId) {
|
||||
// A copy is created, because MWMMapDownloadDialog is unsubscribed inside this notification with
|
||||
// NSGenericException', reason: '*** Collection <NSConcreteHashTable> was mutated while being enumerated.'
|
||||
NSHashTable *observersCopy = [observers copy];
|
||||
for (id<MWMStorageObserver> observer in observersCopy) {
|
||||
[observer processCountryEvent:@(countryId.c_str())];
|
||||
}
|
||||
},
|
||||
[observers](CountryId const & countryId, downloader::Progress const & progress) {
|
||||
for (id<MWMStorageObserver> observer in observers) {
|
||||
// processCountry function in observer's implementation may not exist.
|
||||
/// @todo We can face with an invisible bug, if function's signature will be changed.
|
||||
if ([observer respondsToSelector:@selector(processCountry:downloadedBytes:totalBytes:)]) {
|
||||
[observer processCountry:@(countryId.c_str())
|
||||
downloadedBytes:progress.m_bytesDownloaded
|
||||
totalBytes:progress.m_bytesTotal];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)addObserver:(id<MWMStorageObserver>)observer {
|
||||
[self.observers addObject:observer];
|
||||
}
|
||||
|
||||
- (void)removeObserver:(id<MWMStorageObserver>)observer {
|
||||
[self.observers removeObject:observer];
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)downloadNode:(NSString *)countryId error:(NSError *__autoreleasing _Nullable *)error {
|
||||
if (IsEnoughSpaceForDownload(countryId.UTF8String, GetFramework().GetStorage())) {
|
||||
NSError *connectionError;
|
||||
if ([self checkConnection:&connectionError]) {
|
||||
GetFramework().GetStorage().DownloadNode(countryId.UTF8String);
|
||||
return YES;
|
||||
} else if (error) {
|
||||
*error = connectionError;
|
||||
}
|
||||
} else if (error) {
|
||||
*error = [NSError errorWithDomain:kStorageErrorDomain code:kStorageNotEnoughSpace userInfo:nil];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)retryDownloadNode:(NSString *)countryId {
|
||||
if ([self checkConnection:nil]) {
|
||||
GetFramework().GetStorage().RetryDownloadNode(countryId.UTF8String);
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)updateNode:(NSString *)countryId error:(NSError *__autoreleasing _Nullable *)error {
|
||||
if (IsEnoughSpaceForUpdate(countryId.UTF8String, GetFramework().GetStorage())) {
|
||||
NSError *connectionError;
|
||||
if ([self checkConnection:&connectionError]) {
|
||||
GetFramework().GetStorage().UpdateNode(countryId.UTF8String);
|
||||
return YES;
|
||||
} else if (error) {
|
||||
*error = connectionError;
|
||||
}
|
||||
} else if (error) {
|
||||
*error = [NSError errorWithDomain:kStorageErrorDomain code:kStorageNotEnoughSpace userInfo:nil];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)deleteNode:(NSString *)countryId
|
||||
ignoreUnsavedEdits:(BOOL)force
|
||||
error:(NSError *__autoreleasing _Nullable *)error {
|
||||
auto &f = GetFramework();
|
||||
if (f.GetRoutingManager().IsRoutingActive()) {
|
||||
if (error) {
|
||||
*error = [NSError errorWithDomain:kStorageErrorDomain code:kStorageRoutingActive userInfo:nil];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (!force && f.HasUnsavedEdits(countryId.UTF8String)) {
|
||||
if (error) {
|
||||
*error = [NSError errorWithDomain:kStorageErrorDomain code:kStorageHaveUnsavedEdits userInfo:nil];
|
||||
}
|
||||
} else {
|
||||
f.GetStorage().DeleteNode(countryId.UTF8String);
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)cancelDownloadNode:(NSString *)countryId {
|
||||
GetFramework().GetStorage().CancelDownloadNode(countryId.UTF8String);
|
||||
}
|
||||
|
||||
- (void)showNode:(NSString *)countryId {
|
||||
GetFramework().ShowNode(countryId.UTF8String);
|
||||
}
|
||||
|
||||
- (BOOL)downloadNodes:(NSArray<NSString *> *)countryIds error:(NSError *__autoreleasing _Nullable *)error {
|
||||
auto &s = GetFramework().GetStorage();
|
||||
|
||||
MwmSize requiredSize = 0;
|
||||
for (NSString *countryId in countryIds) {
|
||||
NodeAttrs nodeAttrs;
|
||||
GetFramework().GetStorage().GetNodeAttrs(countryId.UTF8String, nodeAttrs);
|
||||
requiredSize += nodeAttrs.m_mwmSize;
|
||||
}
|
||||
|
||||
if (storage::IsEnoughSpaceForDownload(requiredSize)) {
|
||||
NSError *connectionError;
|
||||
if ([self checkConnection:&connectionError]) {
|
||||
for (NSString *countryId in countryIds) {
|
||||
s.DownloadNode(countryId.UTF8String);
|
||||
}
|
||||
return YES;
|
||||
} else if (error) {
|
||||
*error = connectionError;
|
||||
}
|
||||
} else if (error) {
|
||||
*error = [NSError errorWithDomain:kStorageErrorDomain code:kStorageNotEnoughSpace userInfo:nil];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)checkConnection:(NSError *__autoreleasing *)error {
|
||||
switch (Platform::ConnectionStatus()) {
|
||||
case Platform::EConnectionType::CONNECTION_NONE:
|
||||
if (error) {
|
||||
*error = [NSError errorWithDomain:kStorageErrorDomain code:kStorageNoConnection userInfo:nil];
|
||||
}
|
||||
return NO;
|
||||
break;
|
||||
case Platform::EConnectionType::CONNECTION_WIFI:
|
||||
if (error) {
|
||||
*error = nil;
|
||||
}
|
||||
return YES;
|
||||
break;
|
||||
case Platform::EConnectionType::CONNECTION_WWAN: {
|
||||
if (!GetFramework().GetDownloadingPolicy().IsCellularDownloadEnabled()) {
|
||||
if (error) {
|
||||
*error = [NSError errorWithDomain:kStorageErrorDomain code:kStorageCellularForbidden userInfo:nil];
|
||||
}
|
||||
return NO;
|
||||
} else {
|
||||
if (error) {
|
||||
*error = nil;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)haveDownloadedCountries {
|
||||
return GetFramework().GetStorage().HaveDownloadedCountries();
|
||||
}
|
||||
|
||||
- (BOOL)downloadInProgress {
|
||||
return GetFramework().GetStorage().IsDownloadInProgress();
|
||||
}
|
||||
|
||||
- (void)enableCellularDownload:(BOOL)enable {
|
||||
GetFramework().GetDownloadingPolicy().EnableCellularDownload(enable);
|
||||
}
|
||||
|
||||
#pragma mark - Attributes
|
||||
|
||||
- (NSArray<NSString *> *)allCountries {
|
||||
NSString *rootId = @(GetFramework().GetStorage().GetRootId().c_str());
|
||||
return [self allCountriesWithParent:rootId];
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)allCountriesWithParent:(NSString *)countryId {
|
||||
storage::CountriesVec downloadedChildren;
|
||||
storage::CountriesVec availableChildren;
|
||||
GetFramework().GetStorage().GetChildrenInGroups(countryId.UTF8String, downloadedChildren, availableChildren,
|
||||
true /* keepAvailableChildren */);
|
||||
|
||||
NSMutableArray *result = [NSMutableArray arrayWithCapacity:availableChildren.size()];
|
||||
for (auto const &cid : availableChildren) {
|
||||
[result addObject:@(cid.c_str())];
|
||||
}
|
||||
return [result copy];
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)availableCountriesWithParent:(NSString *)countryId {
|
||||
storage::CountriesVec downloadedChildren;
|
||||
storage::CountriesVec availableChildren;
|
||||
GetFramework().GetStorage().GetChildrenInGroups(countryId.UTF8String, downloadedChildren, availableChildren);
|
||||
|
||||
NSMutableArray *result = [NSMutableArray arrayWithCapacity:availableChildren.size()];
|
||||
for (auto const &cid : availableChildren) {
|
||||
[result addObject:@(cid.c_str())];
|
||||
}
|
||||
return [result copy];
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)downloadedCountries {
|
||||
NSString *rootId = @(GetFramework().GetStorage().GetRootId().c_str());
|
||||
return [self downloadedCountriesWithParent:rootId];
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)downloadedCountriesWithParent:(NSString *)countryId {
|
||||
storage::CountriesVec downloadedChildren;
|
||||
storage::CountriesVec availableChildren;
|
||||
GetFramework().GetStorage().GetChildrenInGroups(countryId.UTF8String, downloadedChildren, availableChildren);
|
||||
|
||||
NSMutableArray *result = [NSMutableArray arrayWithCapacity:downloadedChildren.size()];
|
||||
for (auto const &cid : downloadedChildren) {
|
||||
[result addObject:@(cid.c_str())];
|
||||
}
|
||||
return [result copy];
|
||||
}
|
||||
|
||||
- (MWMMapNodeAttributes *)attributesForCountry:(NSString *)countryId {
|
||||
auto const &s = GetFramework().GetStorage();
|
||||
storage::NodeAttrs nodeAttrs;
|
||||
s.GetNodeAttrs(countryId.UTF8String, nodeAttrs);
|
||||
storage::CountriesVec children;
|
||||
s.GetChildren(countryId.UTF8String, children);
|
||||
BOOL isParentRoot = nodeAttrs.m_parentInfo.size() == 1 && nodeAttrs.m_parentInfo[0].m_id == s.GetRootId();
|
||||
return [[MWMMapNodeAttributes alloc] initWithCoreAttributes:nodeAttrs
|
||||
countryId:countryId
|
||||
hasParent:!isParentRoot
|
||||
hasChildren:!children.empty()];
|
||||
}
|
||||
|
||||
- (MWMMapNodeAttributes *)attributesForRoot {
|
||||
return [self attributesForCountry:@(GetFramework().GetStorage().GetRootId().c_str())];
|
||||
}
|
||||
|
||||
- (NSString *)getRootId {
|
||||
return @(GetFramework().GetStorage().GetRootId().c_str());
|
||||
}
|
||||
|
||||
- (NSString *)nameForCountry:(NSString *)countryId {
|
||||
return @(GetFramework().GetStorage().GetNodeLocalName(countryId.UTF8String).c_str());
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)nearbyAvailableCountries:(CLLocationCoordinate2D)location {
|
||||
auto &f = GetFramework();
|
||||
storage::CountriesVec closestCoutryIds;
|
||||
f.GetCountryInfoGetter().GetRegionsCountryId(mercator::FromLatLon(location.latitude, location.longitude),
|
||||
closestCoutryIds);
|
||||
NSMutableArray *nearmeCountries = [NSMutableArray array];
|
||||
for (auto const &countryId : closestCoutryIds) {
|
||||
storage::NodeStatuses nodeStatuses;
|
||||
f.GetStorage().GetNodeStatuses(countryId, nodeStatuses);
|
||||
if (nodeStatuses.m_status != storage::NodeStatus::OnDisk)
|
||||
[nearmeCountries addObject:@(countryId.c_str())];
|
||||
}
|
||||
|
||||
return nearmeCountries.count > 0 ? [nearmeCountries copy] : nil;
|
||||
}
|
||||
|
||||
- (MWMMapUpdateInfo *)updateInfoWithParent:(nullable NSString *)countryId {
|
||||
auto const &s = GetFramework().GetStorage();
|
||||
Storage::UpdateInfo updateInfo;
|
||||
if (countryId.length > 0) {
|
||||
s.GetUpdateInfo(countryId.UTF8String, updateInfo);
|
||||
} else {
|
||||
s.GetUpdateInfo(s.GetRootId(), updateInfo);
|
||||
}
|
||||
return [[MWMMapUpdateInfo alloc] initWithUpdateInfo:updateInfo];
|
||||
}
|
||||
|
||||
@end
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue