From 098cce9d39cd98166e810b33b27a4a5e436aac91 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Thu, 11 Jul 2024 23:54:56 +0200 Subject: [PATCH] [ios] Fix version in action sheet (#2602) --- platform/darwin/bazel/example_config.bzl | 3 --- platform/darwin/src/http_file_source.mm | 5 +---- platform/ios/BUILD.bazel | 6 ++++++ platform/ios/Integration_Test_Harness/Info.plist | 2 -- platform/ios/Integration_Tests/Info.plist | 2 -- platform/ios/app/Info.plist | 2 -- platform/ios/bazel/macros.bzl | 4 +--- platform/ios/benchmark/Info.plist | 2 -- platform/ios/framework/Info-static.plist | 4 ---- platform/ios/framework/Info.plist | 4 ---- platform/ios/iosapp-UITests/Info.plist | 2 -- platform/ios/resources/Base.lproj/Localizable.strings | 2 +- platform/ios/resources/ca.lproj/Localizable.strings | 2 +- platform/ios/resources/cs.lproj/Localizable.strings | 2 +- platform/ios/resources/da.lproj/Localizable.strings | 2 +- platform/ios/resources/de.lproj/Localizable.strings | 2 +- platform/ios/resources/he.lproj/Localizable.strings | 2 +- platform/ios/resources/hu.lproj/Localizable.strings | 2 +- platform/ios/resources/ja.lproj/Localizable.strings | 2 +- platform/ios/resources/lt.lproj/Localizable.strings | 2 +- platform/ios/resources/pt-BR.lproj/Localizable.strings | 2 +- platform/ios/resources/sv.lproj/Localizable.strings | 2 +- platform/ios/resources/zh-Hans.lproj/Localizable.strings | 2 +- platform/ios/resources/zh-Hant.lproj/Localizable.strings | 2 +- platform/ios/src/MLNMapView.mm | 8 ++++---- 25 files changed, 25 insertions(+), 45 deletions(-) diff --git a/platform/darwin/bazel/example_config.bzl b/platform/darwin/bazel/example_config.bzl index 7f517075d..4a7e68731 100644 --- a/platform/darwin/bazel/example_config.bzl +++ b/platform/darwin/bazel/example_config.bzl @@ -8,6 +8,3 @@ BUNDLE_ID_PREFIX = "com.firstnamelastname" # Enter your API key for MapTiler here, if you have one. API_KEY = "0000000000" - -# Semantic version number to include in plist files. -SEM_VER = "0.0.0" diff --git a/platform/darwin/src/http_file_source.mm b/platform/darwin/src/http_file_source.mm index 91273896a..007a0b902 100644 --- a/platform/darwin/src/http_file_source.mm +++ b/platform/darwin/src/http_file_source.mm @@ -146,10 +146,7 @@ NSString *HTTPFileSource::Impl::getUserAgent() const { NSBundle *sdkBundle = HTTPFileSource::Impl::getSDKBundle(); if (sdkBundle) { - NSString *versionString = sdkBundle.infoDictionary[@"MLNSemanticVersionString"]; - if (!versionString) { - versionString = sdkBundle.infoDictionary[@"CFBundleShortVersionString"]; - } + NSString *versionString = sdkBundle.infoDictionary[@"CFBundleShortVersionString"]; if (versionString) { [userAgentComponents addObject:[NSString stringWithFormat:@"%@/%@", sdkBundle.infoDictionary[@"CFBundleName"], versionString]]; diff --git a/platform/ios/BUILD.bazel b/platform/ios/BUILD.bazel index c9b49c16f..1b9eb34ba 100644 --- a/platform/ios/BUILD.bazel +++ b/platform/ios/BUILD.bazel @@ -182,6 +182,11 @@ _IOS_APPLICATION_RESOURCES = [ "app/Assets.xcassets/**", ]) +apple_bundle_version( + name = "maplibre_app_version", + build_version = "1.0.0", +) + ios_application( name = "App", bundle_id = "{}.maplibre.app".format(BUNDLE_ID_PREFIX), @@ -193,6 +198,7 @@ ios_application( minimum_os_version = "12.0", provisioning_profile = "xcode_profile", resources = _IOS_APPLICATION_RESOURCES, + version = ":maplibre_app_version", visibility = ["//visibility:public"], deps = [ "//platform:iosapp", diff --git a/platform/ios/Integration_Test_Harness/Info.plist b/platform/ios/Integration_Test_Harness/Info.plist index 70590672b..cad9cb894 100644 --- a/platform/ios/Integration_Test_Harness/Info.plist +++ b/platform/ios/Integration_Test_Harness/Info.plist @@ -16,8 +16,6 @@ $(PRODUCT_NAME) CFBundlePackageType APPL - CFBundleShortVersionString - 5.9.0 CFBundleVersion 15256 LSRequiresIPhoneOS diff --git a/platform/ios/Integration_Tests/Info.plist b/platform/ios/Integration_Tests/Info.plist index 975d8eeae..340fb01cb 100644 --- a/platform/ios/Integration_Tests/Info.plist +++ b/platform/ios/Integration_Tests/Info.plist @@ -14,8 +14,6 @@ $(PRODUCT_NAME) CFBundlePackageType BNDL - CFBundleShortVersionString - 5.9.0 CFBundleVersion 15256 diff --git a/platform/ios/app/Info.plist b/platform/ios/app/Info.plist index fdd6bd6aa..714190ff3 100644 --- a/platform/ios/app/Info.plist +++ b/platform/ios/app/Info.plist @@ -16,8 +16,6 @@ $(PRODUCT_NAME) CFBundlePackageType APPL - CFBundleShortVersionString - 5.9.0 CFBundleSignature MBGL CFBundleVersion diff --git a/platform/ios/bazel/macros.bzl b/platform/ios/bazel/macros.bzl index 00cf66849..a3264a54b 100644 --- a/platform/ios/bazel/macros.bzl +++ b/platform/ios/bazel/macros.bzl @@ -1,4 +1,4 @@ -load("@darwin_config//:config.bzl", "API_KEY", "SEM_VER") +load("@darwin_config//:config.bzl", "API_KEY") def info_plist(name, base_info_plist, out, **kwargs): native.genrule( @@ -14,9 +14,7 @@ def info_plist(name, base_info_plist, out, **kwargs): cp $(location {}) $@ plutil -replace MLNCommitHash -string $$(cat $(location //:git_hash)) $@ - sem_version=\"""" + SEM_VER + """\" token=\"""" + API_KEY + """\" - plutil -replace MLNSemanticVersionString -string $$sem_version $@ plutil -replace MLNApiKey -string $$token $@ """).format(base_info_plist), **kwargs diff --git a/platform/ios/benchmark/Info.plist b/platform/ios/benchmark/Info.plist index ba91cce48..145b9e44a 100644 --- a/platform/ios/benchmark/Info.plist +++ b/platform/ios/benchmark/Info.plist @@ -20,8 +20,6 @@ $(PRODUCT_NAME) CFBundlePackageType APPL - CFBundleShortVersionString - 5.9.0 CFBundleSignature MBGL CFBundleVersion diff --git a/platform/ios/framework/Info-static.plist b/platform/ios/framework/Info-static.plist index 67e207823..7e87396ce 100644 --- a/platform/ios/framework/Info-static.plist +++ b/platform/ios/framework/Info-static.plist @@ -10,16 +10,12 @@ 6.0 CFBundleName $(PRODUCT_NAME) - CFBundleShortVersionString - 5.9.0 CFBundleSignature ???? CFBundleVersion 15256 MLNCommitHash $(CURRENT_COMMIT_HASH) - MLNSemanticVersionString - $(CURRENT_SEMANTIC_VERSION) NSPrincipalClass diff --git a/platform/ios/framework/Info.plist b/platform/ios/framework/Info.plist index 9f1b753a7..8c4f24046 100644 --- a/platform/ios/framework/Info.plist +++ b/platform/ios/framework/Info.plist @@ -14,16 +14,12 @@ $(PRODUCT_NAME) CFBundlePackageType FMWK - CFBundleShortVersionString - 5.9.0 CFBundleSignature ???? CFBundleVersion 15256 MLNCommitHash $(CURRENT_COMMIT_HASH) - MLNSemanticVersionString - $(CURRENT_SEMANTIC_VERSION) NSPrincipalClass diff --git a/platform/ios/iosapp-UITests/Info.plist b/platform/ios/iosapp-UITests/Info.plist index f6641c754..e6463342d 100644 --- a/platform/ios/iosapp-UITests/Info.plist +++ b/platform/ios/iosapp-UITests/Info.plist @@ -14,8 +14,6 @@ $(PRODUCT_NAME) CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 5.9.0 CFBundleVersion 15256 diff --git a/platform/ios/resources/Base.lproj/Localizable.strings b/platform/ios/resources/Base.lproj/Localizable.strings index 934638b6d..a5649b3e3 100644 --- a/platform/ios/resources/Base.lproj/Localizable.strings +++ b/platform/ios/resources/Base.lproj/Localizable.strings @@ -71,7 +71,7 @@ "ROAD_REF_A11Y_FMT" = "Route %@"; /* Action sheet title */ -"SDK_NAME" = "MapLibre Maps SDK for iOS"; +"SDK_NAME" = "MapLibre Native iOS"; /* User-friendly error description */ "STYLE_NOT_FOUND_DESC" = "The map failed to load because the style can’t be found or is incompatible."; diff --git a/platform/ios/resources/ca.lproj/Localizable.strings b/platform/ios/resources/ca.lproj/Localizable.strings index d612ff042..6018939b5 100644 --- a/platform/ios/resources/ca.lproj/Localizable.strings +++ b/platform/ios/resources/ca.lproj/Localizable.strings @@ -53,7 +53,7 @@ "PARSE_STYLE_FAILED_DESC" = "El mapa no s’ha carregat perquè s’ha corromput l’estil."; /* Action sheet title */ -"SDK_NAME" = "MapLibre Maps SDK for iOS"; +"SDK_NAME" = "MapLibre Native iOS"; /* User-friendly error description */ "STYLE_NOT_FOUND_DESC" = "El mapa no s’ha carregat perquè no es troba l’estil o bé és incompatible."; diff --git a/platform/ios/resources/cs.lproj/Localizable.strings b/platform/ios/resources/cs.lproj/Localizable.strings index 581a3f43c..28f0de62d 100644 --- a/platform/ios/resources/cs.lproj/Localizable.strings +++ b/platform/ios/resources/cs.lproj/Localizable.strings @@ -71,7 +71,7 @@ "ROAD_REF_A11Y_FMT" = "Route %@"; /* Action sheet title */ -"SDK_NAME" = "MapLibre Maps SDK for iOS"; +"SDK_NAME" = "MapLibre Native iOS"; /* User-friendly error description */ "STYLE_NOT_FOUND_DESC" = "The map failed to load because the style can’t be found or is incompatible."; diff --git a/platform/ios/resources/da.lproj/Localizable.strings b/platform/ios/resources/da.lproj/Localizable.strings index fad3ffd9b..00640749d 100644 --- a/platform/ios/resources/da.lproj/Localizable.strings +++ b/platform/ios/resources/da.lproj/Localizable.strings @@ -77,7 +77,7 @@ "ROAD_REF_A11Y_FMT" = "Rute %@"; /* Action sheet title */ -"SDK_NAME" = "MapLibre Maps SDK for iOS"; +"SDK_NAME" = "MapLibre Native iOS"; /* User-friendly error description */ "STYLE_NOT_FOUND_DESC" = "Kortet kunne ikke hentes fordi det enten ikke findes, eller ikke er kompatibelt."; diff --git a/platform/ios/resources/de.lproj/Localizable.strings b/platform/ios/resources/de.lproj/Localizable.strings index 40224d324..a6c3be7dd 100644 --- a/platform/ios/resources/de.lproj/Localizable.strings +++ b/platform/ios/resources/de.lproj/Localizable.strings @@ -53,7 +53,7 @@ "PARSE_STYLE_FAILED_DESC" = "Die Karte konnte nicht geladen werden, da diese Form beschädigt ist."; /* Action sheet title */ -"SDK_NAME" = "MapLibre Maps SDK for iOS"; +"SDK_NAME" = "MapLibre Native iOS"; /* User-friendly error description */ "STYLE_NOT_FOUND_DESC" = "Die Karte konnte nicht geladen werden, da diese Form nicht gefunden werden kann oder nicht kompatibel ist."; diff --git a/platform/ios/resources/he.lproj/Localizable.strings b/platform/ios/resources/he.lproj/Localizable.strings index 69cfb2b30..1b9fa86ee 100644 --- a/platform/ios/resources/he.lproj/Localizable.strings +++ b/platform/ios/resources/he.lproj/Localizable.strings @@ -77,7 +77,7 @@ "ROAD_REF_A11Y_FMT" = "כביש %@"; /* Action sheet title */ -"SDK_NAME" = "MapLibre Maps SDK for iOS"; +"SDK_NAME" = "MapLibre Native iOS"; /* User-friendly error description */ "STYLE_NOT_FOUND_DESC" = "טעינת המפה נכשלה - לא ניתן למצוא את הסגנון או שהסגנון אינו תואם."; diff --git a/platform/ios/resources/hu.lproj/Localizable.strings b/platform/ios/resources/hu.lproj/Localizable.strings index 4f601486d..4a315e2e0 100644 --- a/platform/ios/resources/hu.lproj/Localizable.strings +++ b/platform/ios/resources/hu.lproj/Localizable.strings @@ -53,7 +53,7 @@ "PARSE_STYLE_FAILED_DESC" = "Nem sikerült betölteni a térképet, mert a stílus sérült."; /* Action sheet title */ -"SDK_NAME" = "MapLibre Maps SDK for iOS"; +"SDK_NAME" = "MapLibre Native iOS"; /* User-friendly error description */ "STYLE_NOT_FOUND_DESC" = "Nem sikerült betölteni a térképet, mert a stílus nem található vagy inkompatibilis."; diff --git a/platform/ios/resources/ja.lproj/Localizable.strings b/platform/ios/resources/ja.lproj/Localizable.strings index a06a43afe..88036225f 100644 --- a/platform/ios/resources/ja.lproj/Localizable.strings +++ b/platform/ios/resources/ja.lproj/Localizable.strings @@ -41,7 +41,7 @@ "MAP_A11Y_VALUE" = "ズーム %1$d倍\n%2$ld ピン現れる"; /* Action sheet title */ -"SDK_NAME" = "MapLibre Maps SDK for iOS"; +"SDK_NAME" = "MapLibre Native iOS"; /* Telemetry prompt message */ "TELEMETRY_DISABLED_MSG" = "You can help make OpenStreetMap and Mapbox maps better by contributing anonymous usage data."; diff --git a/platform/ios/resources/lt.lproj/Localizable.strings b/platform/ios/resources/lt.lproj/Localizable.strings index 1fc09c4f2..7879e8b48 100644 --- a/platform/ios/resources/lt.lproj/Localizable.strings +++ b/platform/ios/resources/lt.lproj/Localizable.strings @@ -53,7 +53,7 @@ "PARSE_STYLE_FAILED_DESC" = "Nepavyko užkrauti žemėlapio, nes stilius yra netinkamo formato."; /* Action sheet title */ -"SDK_NAME" = "MapLibre Maps SDK for iOS"; +"SDK_NAME" = "MapLibre Native iOS"; /* User-friendly error description */ "STYLE_NOT_FOUND_DESC" = "Nepavyko užkrauti žemėlapio, nes neįmanoma rasti stiliaus arba jis nėra suderinamas."; diff --git a/platform/ios/resources/pt-BR.lproj/Localizable.strings b/platform/ios/resources/pt-BR.lproj/Localizable.strings index 665e4c0c2..be2d7f189 100644 --- a/platform/ios/resources/pt-BR.lproj/Localizable.strings +++ b/platform/ios/resources/pt-BR.lproj/Localizable.strings @@ -53,7 +53,7 @@ "PARSE_STYLE_FAILED_DESC" = "Falha ao carregar mapa porque o estilo está corrompido."; /* Action sheet title */ -"SDK_NAME" = "MapLibre Maps SDK for iOS"; +"SDK_NAME" = "MapLibre Native iOS"; /* User-friendly error description */ "STYLE_NOT_FOUND_DESC" = "Falha ao carregar mapa porque o estilo não pode ser encontrado ou é incompatível."; diff --git a/platform/ios/resources/sv.lproj/Localizable.strings b/platform/ios/resources/sv.lproj/Localizable.strings index 59c1b7be1..a6636aac1 100644 --- a/platform/ios/resources/sv.lproj/Localizable.strings +++ b/platform/ios/resources/sv.lproj/Localizable.strings @@ -77,7 +77,7 @@ "ROAD_REF_A11Y_FMT" = "Rutt %@"; /* Action sheet title */ -"SDK_NAME" = "MapLibre Maps SDK for iOS"; +"SDK_NAME" = "MapLibre Native iOS"; /* User-friendly error description */ "STYLE_NOT_FOUND_DESC" = "Kartan kunde inte laddas för att kartstilen kunde inte hittas eller för att den är inkompatibel."; diff --git a/platform/ios/resources/zh-Hans.lproj/Localizable.strings b/platform/ios/resources/zh-Hans.lproj/Localizable.strings index 8428a3f93..c0f4a4086 100644 --- a/platform/ios/resources/zh-Hans.lproj/Localizable.strings +++ b/platform/ios/resources/zh-Hans.lproj/Localizable.strings @@ -53,7 +53,7 @@ "PARSE_STYLE_FAILED_DESC" = "The map failed to load because the style is corrupted."; /* Action sheet title */ -"SDK_NAME" = "MapLibre Maps SDK for iOS"; +"SDK_NAME" = "MapLibre Native iOS"; /* User-friendly error description */ "STYLE_NOT_FOUND_DESC" = "The map failed to load because the style can’t be found or is incompatible."; diff --git a/platform/ios/resources/zh-Hant.lproj/Localizable.strings b/platform/ios/resources/zh-Hant.lproj/Localizable.strings index eecaf7ceb..9f8a4f8da 100644 --- a/platform/ios/resources/zh-Hant.lproj/Localizable.strings +++ b/platform/ios/resources/zh-Hant.lproj/Localizable.strings @@ -53,7 +53,7 @@ "PARSE_STYLE_FAILED_DESC" = "樣式表有毀損,無法載入地圖。"; /* Action sheet title */ -"SDK_NAME" = "MapLibre Maps SDK for iOS"; +"SDK_NAME" = "MapLibre Native iOS"; /* User-friendly error description */ "STYLE_NOT_FOUND_DESC" = "找不到樣式表或樣式表不兼容,無法載入地圖。"; diff --git a/platform/ios/src/MLNMapView.mm b/platform/ios/src/MLNMapView.mm index 74e3254c4..07e21526d 100644 --- a/platform/ios/src/MLNMapView.mm +++ b/platform/ios/src/MLNMapView.mm @@ -2864,14 +2864,14 @@ public: } } - NSString *actionSheetTitle = NSLocalizedStringWithDefaultValue(@"SDK_NAME", nil, nil, @"MapLibre Native for iOS", @"Action sheet title"); + NSString *actionSheetTitle = NSLocalizedStringWithDefaultValue(@"SDK_NAME", nil, nil, @"MapLibre Native iOS", @"Action sheet title"); UIAlertController *attributionController = [UIAlertController alertControllerWithTitle:actionSheetTitle message:nil preferredStyle:UIAlertControllerStyleActionSheet]; - - if (shouldShowVersion) + NSString *version = [NSBundle mgl_frameworkInfoDictionary][@"CFBundleShortVersionString"]; + if (shouldShowVersion && version != nil && ![version isEqualToString:@""]) { - attributionController.title = [actionSheetTitle stringByAppendingFormat:@" %@", [NSBundle mgl_frameworkInfoDictionary][@"MLNSemanticVersionString"]]; + attributionController.title = [actionSheetTitle stringByAppendingFormat:@" %@", version]; } NSArray *attributionInfos = [self.style attributionInfosWithFontSize:[UIFont buttonFontSize] linkColor:nil];