breautek commented on code in PR #1406: URL: https://github.com/apache/cordova-ios/pull/1406#discussion_r1514982487
########## lib/PlatformConfigParser.js: ########## @@ -0,0 +1,37 @@ + +/** + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +'use strict'; + +const ConfigParser = require('cordova-common').ConfigParser; + +class PlatformConfigParser extends ConfigParser { + /** getPrivacyManifest */ + getPrivacyManifest () { + const platform_manifest = this.doc.find('./platform[@name="ios"]/privacy-manifest-ios'); + if (platform_manifest != null) { + return platform_manifest; + } + const manifest = this.doc.find('privacy-manifest-ios'); + return manifest; + } Review Comment: Personally I prefer a more structured approach, I don't think we need to support finding the privacy-manifest node in both root or the ios platform block. I think enforcing it to be inside the ios platform block is sufficient. Supporting both is twice the ongoing maintenance work. Additionally, I think we can rename `privacy-manifest-ios` to `privacy-manifest`, we don't need the extra `-ios`. This creates for a more generic tag name to have consistency with other platforms (should they copy Apple and require a similar feature). Chopping of the `-ios` suffix is a way of hopefully future-proofing ourselves. With both of these suggestions, the method will look more like: ```suggestion getPrivacyManifest () { return this.doc.find('./platform[@name="ios"]/privacy-manifest'); } ``` Supporting just a platform / privacy-manifest way allows for more straight forward documentation and helps prevent easy mistakes like someone having a privacy-manifest in both locations, etc... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org