s***@163.com
s***@163.com
  • 发布:2020-11-05 13:30
  • 更新:2020-11-05 14:50
  • 阅读:906

【报Bug】ANDROID隐私协议的多语言版本的内容里的A标签解析问题

分类:HTML5+

产品分类: HTML5+

HBuilderX版本号: 2.9.7

手机系统: Android

手机系统版本号: Android 10

手机厂商: 华为

手机机型: MATE30

打包方式: 云端

操作步骤:

menifest里的dcloud_privacy_prompt_message按照我的写法。

预期结果:

点击隐私协议链接跳转到空页面

实际结果:

跳转到隐私协议页面

bug描述:

WAP2APP的应用,隐私政策的多语言实现。
MANIFEST.JSON文件里的相关部分如下:

      "privacy" : {  
            "prompt" : "template",  
            "template" : {  
                "title" : "服务协议和隐私政策",  
                "message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<p /><br />  你可阅读<a href=\"\">《服务协议》</a>和<a href='https://www.toppingkh.com/privacy-policy.html'>《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",  
                "buttonAccept" : "我知道了",  
                "buttonRefuse" : "暂不同意"  
            }  
        },  
        "locales" : {  
            "en" : {  
                // 英文    
                "name" : "HUIPAY", // 应用名称    
                "android" : {  
                    "strings" : {  
                        //Android平台自定义字符串    
                        "dcloud_privacy_prompt_title" : "Privacy policy",  
                        "dcloud_privacy_prompt_message" : "<![CDATA[  Please read carefully and fully understand the terms of the privacy policy, including but not limited to: in order to provide better services to you, we need to collect your device identification, location information, operation log and other information for analysis and optimization of application performance. <br />  you can read  <a href=&apos;https://www.toppingkh.com/privacy-policy.html&apos;> Privacy Policy </a> for more information. If you agree, please click the button below to start receiving our service.]]>",  
                        "dcloud_privacy_prompt_accept_button_text" : "Got it",  
                        "dcloud_privacy_prompt_refuse_button_text" : "Disagree"  
                    }  
                },  
                "ios" : {  
                    "privacyDescription" : {  
                        //iOS平台隐私访问描述信息    
                        "NSPhotoLibraryUsageDescription" : "access to the user’s photo library(read)"  
                    },  
                    "infoPlist" : {  
                        //iOS平台自定义InfoPlist.strings    
                        "CustomKey" : "CustomValue"  
                    }  
                }  
            },  
            "zh" : {  
                // 中文(简体)    
                "name" : "汇支付", // 应用名称    
                "android" : {  
                    "strings" : {  
                        //Android平台自定义字符串    
                        "dcloud_privacy_prompt_title" : "隐私政策",  
                        "dcloud_privacy_prompt_message" : "<![CDATA[  请你务必审慎阅读、充分理解“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、位置信息、操作日志等信息用于分析、优化应用性能。<br />  你可阅读&lt;a href=&apos;https://www.topping.com/privacy-policy_zh.html&apos;&gt;《隐私政策》&lt;/a&gt;了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。]]>",  
                        "dcloud_privacy_prompt_accept_button_text" : "我知道了",  
                        "dcloud_privacy_prompt_refuse_button_text" : "暂不同意"  
                    }  
                },  
                "ios" : {  
                    "privacyDescription" : {  
                        //iOS平台隐私访问描述信息    
                        "NSPhotoLibraryUsageDescription" : "access to the user’s photo library(read)"  
                    },  
                    "infoPlist" : {  
                        //iOS平台自定义InfoPlist.strings    
                        "CustomKey" : "CustomValue"  
                    }  
                }  
            }  
        },

隐私政策在<![CDATA[ ]]>里的写法出现以下几种情况,都不正常:
1、A标签的href在中文隐私协议里把左右尖括号转义成<> ,把单引号转义成',结果是界面直接展示出来链接地址,点击链接地址可以打开相应网页;
2、A标签的href在英文隐私协议里仅把单引号转义成',结果是直接展示出来链接地址,但是点击链接地址可以打开的网页为blank;
3、A标签的href在不转义,就是写成
<a href='https://www.toppingkh.com/privacy-policy.html'> Privacy Policy </a>
云打包报错:
Output: 安装包制作目录/app/res/values-en/strings.xml:5:1-580: AAPT: error: unescaped apostrophe in string
提示单引号需要转义。

2020-11-05 13:30 负责人:无 分享
已邀请:
s***@163.com

s***@163.com (作者) - steed

解决了,正确的android多语言隐私协议对话框写法如下:
manifest.json里面的plus下增加:

        "privacy" : {  
            "prompt" : "template",  
            "template" : {  
                "title" : "服务协议和隐私政策",  
                "message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<p /><br />  你可阅读<a href=\"\">《服务协议》</a>和<a href='https://www.topping.com/privacy-policy.html'>《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",  
                "buttonAccept" : "我知道了",  
                "buttonRefuse" : "暂不同意"  
            }  
        },  
        "locales" : {  
            "en" : {  
                // 英文    
                "name" : "HUIPAY", // 应用名称    
                "android" : {  
                    "strings" : {  
                        //Android平台自定义字符串    
                        "dcloud_privacy_prompt_title" : "Privacy policy",  
                        "dcloud_privacy_prompt_message" : "<![CDATA[  Please read carefully and fully understand the terms of the privacy policy, including but not limited to: in order to provide better services to you, we need to collect your device identification, location information, operation log and other information for analysis and optimization of application performance. <br />  you can read  <a href=\"https:\/\/www.topping.com\/privacy-policy.html\"> Privacy Policy </a> for more information. If you agree, please click the button below to start receiving our service.]]>",  
                        "dcloud_privacy_prompt_accept_button_text" : "Got it",  
                        "dcloud_privacy_prompt_refuse_button_text" : "Disagree"  
                    }  
                },  
                "ios" : {  
                    "privacyDescription" : {  
                        //iOS平台隐私访问描述信息    
                        "NSPhotoLibraryUsageDescription" : "access to the user’s photo library(read)"  
                    },  
                    "infoPlist" : {  
                        //iOS平台自定义InfoPlist.strings    
                        "CustomKey" : "CustomValue"  
                    }  
                }  
            },  
            "zh" : {  
                // 中文(简体)    
                "name" : "汇支付", // 应用名称    
                "android" : {  
                    "strings" : {  
                        //Android平台自定义字符串    
                        "dcloud_privacy_prompt_title" : "隐私政策",  
                        "dcloud_privacy_prompt_message" : "<![CDATA[  请你务必审慎阅读、充分理解“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、位置信息、操作日志等信息用于分析、优化应用性能。<br />  你可阅读<a href=\"https:\/\/www.topping.com\/privacy-policy_zh.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。]]>",  
                        "dcloud_privacy_prompt_accept_button_text" : "我知道了",  
                        "dcloud_privacy_prompt_refuse_button_text" : "暂不同意"  
                    }  
                },  
                "ios" : {  
                    "privacyDescription" : {  
                        //iOS平台隐私访问描述信息    
                        "NSPhotoLibraryUsageDescription" : "access to the user’s photo library(read)"  
                    },  
                    "infoPlist" : {  
                        //iOS平台自定义InfoPlist.strings    
                        "CustomKey" : "CustomValue"  
                    }  
                }  
            }  
        },

该问题目前已经被锁定, 无法添加新回复