From 58e6cc13b7f7f0900c61b4a7ee853fb11a6e28d9 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <4123478+tido64@users.noreply.github.com> Date: Fri, 26 Apr 2024 08:33:07 +0200 Subject: [PATCH] fix(macos): add `applicationCategoryType` and `humanReadableCopyright` (#1992) --- .rubocop.yml | 1 + ios/test_app.rb | 10 ++++++++++ schema.json | 10 ++++++++++ scripts/docs/macos.applicationCategoryType.md | 4 ++++ scripts/docs/macos.humanReadableCopyright.md | 4 ++++ scripts/generate-schema.mjs | 2 ++ scripts/schema.js | 10 ++++++++++ scripts/types.ts | 2 ++ 8 files changed, 43 insertions(+) create mode 100644 scripts/docs/macos.applicationCategoryType.md create mode 100644 scripts/docs/macos.humanReadableCopyright.md diff --git a/.rubocop.yml b/.rubocop.yml index 281154b70..533727a2b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -32,6 +32,7 @@ Metrics/CyclomaticComplexity: Metrics/PerceivedComplexity: AllowedMethods: + - generate_info_plist! - make_project! - react_native_pods - use_test_app_internal! diff --git a/ios/test_app.rb b/ios/test_app.rb index 48c9193a0..458276f48 100644 --- a/ios/test_app.rb +++ b/ios/test_app.rb @@ -153,6 +153,16 @@ def generate_info_plist!(project_root, target_platform, destination) info['UIAppFonts'] = fonts unless target_platform == :macos end + if target_platform == :macos + config = manifest[target_platform.to_s] + unless config.nil? + category = config['applicationCategoryType'] + info['LSApplicationCategoryType'] = category unless category.nil? + copyright = config['humanReadableCopyright'] + info['NSHumanReadableCopyright'] = copyright unless copyright.nil? + end + end + plist.value = CFPropertyList.guess(info) plist.save(infoplist_dst, CFPropertyList::List::FORMAT_XML, { :formatted => true }) end diff --git a/schema.json b/schema.json index 5b2ded1cc..9ceec4eb7 100644 --- a/schema.json +++ b/schema.json @@ -296,6 +296,16 @@ ], "type": "object", "properties": { + "applicationCategoryType": { + "description": "The category that best describes the app for the App Store.", + "markdownDescription": "The category that best describes the app for the App Store.\n\nThe equivalent key in `Info.plist` is\n[`LSApplicationCategoryType`](https://developer.apple.com/documentation/bundleresources/information_property_list/lsapplicationcategorytype).", + "type": "string" + }, + "humanReadableCopyright": { + "description": "A human-readable copyright notice for the bundle.", + "markdownDescription": "A human-readable copyright notice for the bundle.\n\nThe equivalent key in `Info.plist` is\n[`NSHumanReadableCopyright`](https://developer.apple.com/documentation/bundleresources/information_property_list/nshumanreadablecopyright).", + "type": "string" + }, "reactNativePath": { "description": "Sets a custom path to React Native for macOS. Useful for when `require(\"react-native-macos\")` does not return the desired path.", "type": "string" diff --git a/scripts/docs/macos.applicationCategoryType.md b/scripts/docs/macos.applicationCategoryType.md new file mode 100644 index 000000000..297b9c677 --- /dev/null +++ b/scripts/docs/macos.applicationCategoryType.md @@ -0,0 +1,4 @@ +The category that best describes the app for the App Store. + +The equivalent key in `Info.plist` is +[`LSApplicationCategoryType`](https://developer.apple.com/documentation/bundleresources/information_property_list/lsapplicationcategorytype). diff --git a/scripts/docs/macos.humanReadableCopyright.md b/scripts/docs/macos.humanReadableCopyright.md new file mode 100644 index 000000000..677cc2616 --- /dev/null +++ b/scripts/docs/macos.humanReadableCopyright.md @@ -0,0 +1,4 @@ +A human-readable copyright notice for the bundle. + +The equivalent key in `Info.plist` is +[`NSHumanReadableCopyright`](https://developer.apple.com/documentation/bundleresources/information_property_list/nshumanreadablecopyright). diff --git a/scripts/generate-schema.mjs b/scripts/generate-schema.mjs index 642f7a6d1..aff8eb7e1 100755 --- a/scripts/generate-schema.mjs +++ b/scripts/generate-schema.mjs @@ -32,6 +32,8 @@ export async function readDocumentation() { "ios.icons", "ios.icons.primaryIcon", "ios.icons.alternateIcons", + "macos.applicationCategoryType", + "macos.humanReadableCopyright", "windows.appxManifest", "windows.certificateKeyFile", "windows.certificatePassword", diff --git a/scripts/schema.js b/scripts/schema.js index 514ef249d..d7ab559c3 100644 --- a/scripts/schema.js +++ b/scripts/schema.js @@ -274,6 +274,16 @@ function generateSchema(docs = {}) { allOf: [{ $ref: "#/$defs/apple" }], type: "object", properties: { + applicationCategoryType: { + description: extractBrief(docs["macos.applicationCategoryType"]), + markdownDescription: docs["macos.applicationCategoryType"], + type: "string", + }, + humanReadableCopyright: { + description: extractBrief(docs["macos.humanReadableCopyright"]), + markdownDescription: docs["macos.humanReadableCopyright"], + type: "string", + }, reactNativePath: { description: `Sets a custom path to React Native for macOS. Useful for when \`require("${defaultPlatformPackages.macos}")\` does not return the desired path.`, type: "string", diff --git a/scripts/types.ts b/scripts/types.ts index 70d12e8f0..5753eff9b 100644 --- a/scripts/types.ts +++ b/scripts/types.ts @@ -208,6 +208,8 @@ export type Docs = { "ios.icons": string; "ios.icons.primaryIcon": string; "ios.icons.alternateIcons": string; + "macos.applicationCategoryType": string; + "macos.humanReadableCopyright": string; "windows.appxManifest": string; "windows.certificateKeyFile": string; "windows.certificatePassword": string;