插件配置

插件图标配置

module.exports = {
res:{
plugins:["/native/res/plugins/light.png","/native/res/plugins/email.png"]
}
};

插件内容配置

可以在plugins配置项中配置APP中使用的插件信息,如扫一扫,分享等;

module.exports = {
plugins:{
"barcode":{
},
//老版本的配置share将不再提供维护
"socialsystem":{
"inputParams": {
"title": "default title",
"content": "default content",
"url": "default url",
"image": "default image url"
},
"config": {
"showCopyUrl": "true",
"disableSystemShare":"true"
}
},
"socialweibo":{
"inputParams": {
"title": "default title",
"content": "default content",
"url": "default url",
"image": "default image url"
},
"config": {
"weibo_appKey": "2951165",
"weibo_appSecret": "9426cbb8c27c21ecc6e81f71702f",
}
},
"socialwechat":{
"inputParams": {
"title": "default title",
"content": "default content",
"url": "default url",
"image": "default image url"
},
"config": {
"wechat_appKey": "wxb19d360ad230ef",
"wechat_appSecret": "f9f81b50cc1fc68ddff9b8ef9ef7"
}
},
"socialqq":{
"inputParams": {
"title": "default title",
"content": "default content",
"url": "default url",
"image": "default image url"
},
"config": {
"qq_appId":"1106388509"
}
},
"socialdingtalk":{
"inputParams": {
"title": "default title",
"content": "default content",
"url": "default url",
"image": "default image url"
},
"config": {
"dingtalk_appKey": "dingouof1vbaprdrmb"
}
}
}
};

可选插件

配置权限声明

使用permission可根据app集成的模块配置所需的权限声明及描述文案

使用方法

iOS

  • 如果配置了permission,APP将会优先使用permission中配置的权限声明,忽略模版库的权限声明。
  • 如果没有配置permission,APP将默认使用模版库的权限声明。
  • 标准模版库用户只能使用permission实现权限声明及描述文案的定制。
  • 自定义模版库可根据实际情况选择使用permission配置或是直接修改模版库Info.plist。

Android

  • 如果配置了permission,可以通过在permission.gmu中配置add或delete参数实现权限的增加和删除。
  • 如果没有配置permission,APP将默认使用模版库的权限声明。
  • 标准模版库用户只能使用permission实现权限声明的增加或删除。
  • 自定义模版库可根据实际情况选择使用permission配置或是直接修改模版库AndroidManifest.xml。

配置示例(中文描述请自行修改)

module.exports = {
plugins:{
"permission":{
"config": {
"iOS": {
"NSLocationAlwaysUsageDescription": "应用需要访问定位服务才能继续使用",
"NSPhotoLibraryUsageDescription":"允许应用访问本地相册用于头像选取二维码失败等场景",
"NSBluetoothAlwaysUsageDescription":"应用需要访问您的蓝牙功能",
"NSLocationWhenInUseUsageDescription":"允许应用访问",
"NSCameraUsageDescription":"允许应用访问",
"NSPhotoLibraryAddUsageDescription":"应用向相册添加图片",
"NSSpeechRecognitionUsageDescription":"语音识别",
"NSMicrophoneUsageDescription":"麦克风",
"NSAppleMusicUsageDescription":"媒体资源库"
},
"android": {
"add":[
"android.permission.CAMERA",
"android.permission.RECORD_AUDIO",
"android.permission.Internet",
"android.permission.CAMERA",
"android.permission.RECORD_AUDIO",
"android.permission.Internet",
"android.permission.ACCESS_NETWORK_STATE",
"android.permission.READ_PHONE_STATE"
],
"delete":[
"android.permission.CAMERA",
"android.permission.RECORD_AUDIO"
]
}
}
}
}
}

模块权限功能对应表

iOS

模块 权限 字段 功能/接口 备注
AudioGMU 麦克风 NSMicrophoneUsageDescription LightSDK.native.startRecord media.audio.startRecord
audioRecord.start
BarcodeGMU 摄像头 NSCameraUsageDescription LightSDK.native.scanCode qrcode.scan
ContactGMU 通讯录 NSContactsUsageDescription LightSDK.native.getContactInfo contact.getContactInfo
contact.list
ImageGMU 相册
摄像头
NSPhotoLibraryUsageDescription
NSPhotoLibraryAddUsageDescription
NSCameraUsageDescription
LightSDK.native.imagePicker
LightSDK.native.chooseImage
LightSDK.native.saveImage
image.picker
image.chooseImage
image.save
LocalAuthGMU FaceID NSFaceIDUsageDescription LightSDK.native.verifyOpeation validate.verifyOpeation
MapBaiduGMU 定位 NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription
LightSDK.native.getLocation location.getLocation
MiniappGMU 蓝牙
相册
NSBluetoothAlwaysUsageDescription
NSBluetoothPeripheralUsageDescription
NSPhotoLibraryUsageDescription
NSPhotoLibraryAddUsageDescription
wx.getSystemInfoSync
小程序菜单-反馈
miniapp.getSystemInfoSync
JSNativeGMU 相册 NSPhotoLibraryUsageDescription
NSPhotoLibraryAddUsageDescription
image标签-save接口
JSNMapBaidu 定位 NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription
map标签
CalendarGMU 日历 NSCalendarsUsageDescription LightSDK.native.createCalendar
LightSDK.native.updateCalendar
LightSDK.native.deleteCalendar
LightSDK.native.queryCalendar
calendar.createEvent
calendar.deleteEvent
calendar.updateEvent
calendar.retrieveEvent

Android

模块 权限 字段 功能/接口 备注
gmubase 蓝牙
请求网络
获取网络状态
获取手机信息
震动
写文件
GET_TASKS
android.permission.BLUETOOTH
android.permission.INTERNET
android.permission.ACCESS_NETWORK_STATE
android.permission.READ_PHONE_STATE
android.permission.VIBRATE
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.GET_TASKS
LightSDK.native.getNetworkStatus
LightSDK.native.getSystemInfo
LightSDK.native.startVibrate
LightSDK.native.getUDID等
native.getNetworkStatus
native.getSystemInfo
native.startVibrate
native.getUDID等
webgmu 获取网络状态 android.permission.ACCESS_NETWORK_STATE LightSDK.native.getNetworkStatus native.getNetworkStatus
miniappgmu REORDER_TASKS android.permission.REORDER_TASKS 打开小程序
audiogmu 麦克风
请求网络
android.permission.RECORD_AUDIO
android.permission.MODIFY_AUDIO_SETTINGS
android.permission.Internet
LightSDK.native.startRecord media.audio.startRecord
audioRecord.start
barcodegmu 摄像头
震动
android.permission.CAMERA
android.permission.VIBRATE
LightSDK.native.scanCode qrcode.scan
contactgmu 通讯录 android.permission.READ_CONTACTS LightSDK.native.getContactInfo contact.getContactInfo
contact.list
imagegmu 摄像头
写文件
android.permission.CAMERA
android.permission.WRITE_EXTERNAL_STORAGE
LightSDK.native.imagePicker
LightSDK.native.chooseImage
LightSDK.native.saveImage
image.picker
image.chooseImage
image.save
localauthgmu 指纹识别 android.permission.USE_FINGERPRINT LightSDK.native.verifyOpeation validate.verifyOpeation
mapbaidugmu 定位
前台服务
android.permission.ACCESS_COARSE_LOCATION
android.permission.ACCESS_FINE_LOCATION
android.permission.FOREGROUND_SERVICE
LightSDK.native.getLocation location.getLocation
jsnativegmu 获取网络状态
获取手机信息
android.permission.ACCESS_NETWORK_STATE
android.permission.READ_PHONE_STATE
LightSDK.native.getNetworkStatus
LightSDK.native.getSystemInfo
native.getNetworkStatus
native.getSystemInfo
jsnmapbaidu 定位 android.permission.ACCESS_COARSE_LOCATION
android.permission.ACCESS_FINE_LOCATION
map标签
calendargmu 日历 android.permission.WRITE_CALENDAR
android.permission.READ_CALENDAR
LightSDK.native.createCalendar
LightSDK.native.updateCalendar
LightSDK.native.deleteCalendar
LightSDK.native.queryCalendar
calendar.createEvent
calendar.deleteEvent
calendar.updateEvent
calendar.retrieveEvent
jsnmapbaidu 定位 android.permission.ACCESS_COARSE_LOCATION
android.permission.ACCESS_FINE_LOCATION

注意事项:

  • iOS如果配置了permission,必须添加必要的权限声明,否则在调用到相关功能时无法正确请求权限,可能会引起接口无响应或app闪退。
  • iOS如果未配置定位权限声明,申请定位权限时不会有弹框,app也不会闪退,系统行为如此。
  • 在低版本iOS上,小程序容器包含的查询蓝牙开关功能并不需要申请蓝牙权限,但在高版本iOS上需要申请蓝牙权限。
  • Android如果配置了permission,并使用delete删除了模板库中的相应权限声明,但在实际应用中使用了该权限声明对应的功能,可能会导致功能异常或app闪退。
  • Android中的delete并不能删除模块权限功能对应表中的权限声明,如需删除必须删除对应模块。

隐私政策

APPSTORE上架流程中需要提供隐私政策模板,经与法务沟通,公司已经拟定了相关的统一模板。如后续各部门有APP上架需求,请根据此模板补充产品相关内容后发给法务合规部——江山、王瑛、秦思思审核后方可使用,请悉知。

我们接入的相关第三方开发包(SDK)如下:(可以结合使用的功能,提供第三方代码隐私政策说明)

1.百度地图SDK–演示地图定位功能
2.微信分享–演示分享内容到微信
3.微博分享–演示分享内容到微博
4.腾讯QQ分享–演示分享内容到QQ
5.钉钉分享–演示分享内容到钉钉
6.Android-腾讯tbs插件–文件预览功能
7.阿里推送–阿里推送功能
8.极光推送–极光推送功能
9.个推推送–个推推送功能
10.微信支付–微信支付功能
11.支付宝支付–支付宝支付功能
12.zoom视频会议–视频会议功能

我们将审慎评估第三方使用共享信息的目的,对这些合作方的安全保障能力进行综合评估,并要求其遵循合作法律协议。我们会对合作方获取信息的软件工具开发包(SDK)进行严格的安全监测,以保护数据安全

当App第一次启动时会弹出隐私条款,显示在索权前,具体配置如下:

module.exports = {
plugins:{
"privacy":{
"config": {
"privacyUrl": "privacy/alert.html",
"version":"1.0.0"
}
}
}
}

注意事项:

  1. privacyUrl字段,为显示隐私条款的h5页面路径,该路径支持远程和本地工程根目录下的相对路径(如工程根目录下privacy文件夹下的alert.html,可以配置privacy/alert.html),不支持离线包地址。
  2. version字段,为隐私条款版本号(不传、传null、””、” “、非字符串格式等默认为undefined字符串),用于隐私政策版本控制显示。
  3. 启动页打开隐私组件后,若在隐私组件页面上调用window.privacy.dismiss({})接口关闭组件,则下次启动App则不会再弹隐私组件。
  4. App覆盖升级时,若当前version与上次本地保存的version值不一致,则认为隐私条款页面有更新,启动App会重新弹出隐私组件。
  5. 隐私组件页面必须存在类似 同意暂不使用 两个按钮(否则会导致应用市场审核不通过),点击 同意 ,需调用window.privacy.dismiss({})接口关闭隐私组件,这时App将继续往下执行,如果有需要权限认证则显示权限认证弹窗。点击暂不使用,应提示 需要同意条款后才能正常使用App功能

分享组件

module.exports = {
plugins:{
//老版本的配置share将不再提供维护
"socialsystem":{
"inputParams": {
"title": "default title",
"content": "default content",
"url": "default url",
"image": "default image url"
},
"config": {
"showCopyUrl": "true",
"disableSystemShare":"true"
}
},
"socialweibo":{
"inputParams": {
"title": "default title",
"content": "default content",
"url": "default url",
"image": "default image url"
},
"config": {
"weibo_appKey": "2951165",
"weibo_appSecret": "9426cbb8c27c21ecc6e81f71702f",
}
},
"socialwechat":{
"inputParams": {
"title": "default title",
"content": "default content",
"url": "default url",
"image": "default image url"
},
"config": {
"wechat_appKey": "wxb19d360ad230ef",
"wechat_appSecret": "f9f81b50cc1fc68ddff9b8ef9ef7"
}
},
"socialqq":{
"inputParams": {
"title": "default title",
"content": "default content",
"url": "default url",
"image": "default image url"
},
"config": {
"qq_appId":"1106388509"
}
},
"socialdingtalk":{
"inputParams": {
"title": "default title",
"content": "default content",
"url": "default url",
"image": "default image url"
},
"config": {
"dingtalk_appKey": "dingouof1vbaprdrmb"
}
}
}
};

注意事项:

  • 钉钉分享的AppKey必须与申请的bundleId匹配,否则会分享失败,其他平台无此限制
  • QQ分享使用的是AppId(10位纯数字),而不是AppKey(字母数字混合)
  • QQ分享的URL Schemes还可配”QQ”+十六进制的AppId,不足8位开头补0,如果两个都配会优先使用QQ而不是tencent

相册组件

module.exports = {
plugins:{
"image": {} // 老版本的配置imageacquisition已不再提供维护
}
};

极光推送 && 个推 && 阿里云推送

module.exports = {
plugins:{
"pushali": {
"config": {
//阿里云推送-IOS
"alipush_appKey_iOS":"25298013",
"alipush_appScrect_iOS":"bce53d52657eb231c679519095e35edb",
//阿里云推送-Android
"alipush_appKey_android": "25275247",
"alipush_appSecret_android":"4b7878faee0b31444eb023db401d52a9",
"mipush_appId":"2882303761517895607",
"mipush_appKey":"5791789545607"
}
},
"pushgetui": {
"config": {
//个推
"getui_appId":"NEPRD01fb18sS1z4muQ7aA",
"getui_appKey":"ht2JArqg686JFVc5DtE1b6",
"getui_appSecret":"RY1Adm4lTg5FgZfrzqYZB3"
}
},
"pushjpush": {
"config": {
"jpush_appKey": "b061314719ab8463db7cc551" //极光推送平台的AppKey
}
}
}
};

极光推送网站
个推网站
阿里云推送网站

注意事项:

  • 老版本的配置push将不再提供维护。
  • 默认情况下使用极光推送,如果 alipush_appKey_iOSgetui_appId 等字段和 jpush_appKey一起配置的情况下也是用的极光推送。阿里云key和个推的key只有单独配置的情况下才生效。
  • 如果只配个推key和阿里云key时,以阿里云推送为优先。
  • 【个推】由于个推不支持获取和删除标签,所以LightSDK.native.pushGetTagsLightSDK.native.pushDeleteTags接口会不生效。
  • 【个推】由于个推控台上没有提供添加apns自定义参数的功能,只能通过后端服务器对接个推后台才能实现该功能。因此light原有的点击通知跳转到应用内对应页面的功能(传入url字段,跳转页面功能)需要后台支持才能生效。
  • 【个推】iOS暂不支持多媒体推送功能。
  • 【阿里云推送】控台不支持设置别名和标签,需要后端服务器配合。
  • 【阿里云推送】不支持一次性删除全部标签功能,所以LightSDK.native.pushDeleteTags接口如果删除全部标签会不生效。
  • 【阿里云推送】小米必须要配置 mipush_appIdmipush_appKey 才能够支持彻底关闭应用后接收到推送信息。
  • 【阿里云推送】android版针对华为、小米手机做了额外处理,他们支持在应用彻底关闭(在recent中杀死清除应用)后,仍然可以接收到推送消息。其他品牌的手机只能支持到通过双击返回键退出后还能接收到消息。
  • 【阿里云推送】应用彻底关闭的情况下,服务器发送推送消息,小米基本在1分钟以内收到。华为需要5-15分钟的等待时间。

扫一扫

module.exports = {
plugins:{
"barcode":{
"inputParams": {
"title":"扫一扫"
},
"outputParam": [

],
"navigationbar": {
"show": true,
"left_item": {
},
"right_item": {
}
},
"menu": {
"show": false
},
"style": {

},
"config": {
}
}
}
};

注意事项:

  • 老版本的scanning不再维护

手势指纹

module.exports = {
plugins:{
"localauth": {
"inputParams": {
"title": "手势密码"
},
"navigationbar":{
"disableSystemBarTint":false,
"backgroundColor": "#e81f1f"
},
"style": {
"backgroundColor": "#000000",//背景色
"headerBackgroundColor": "#ffffff",
"headerTextColor": "#ffffff",
"hintTextColor": "#ffffff",//错误提示文字颜色
"defaultColor": "#ffffff",//手势未输入状态时默认颜色
"selectedColor": "#6D90FB",//已输入手势的颜色
"inCorrectColor": "#db5329",//手势输入有误后的颜色
"lineColor": "#6D90FB",//手势输入过程中连接的线的颜色
"lineWidth": 3//线的宽度
},
"config": {
"maxNumberOfRetries":3,//重试次数
"minNumberOfNodes":4,//最少连接的节点个数
"freezeTime":10,//超过重试次数后的锁定时间
"backgroundImage":"iconName"//自定义背景图片 iconName自定义,图片路径配置在plugins内
}
}
}
};

注意事项:

  • 老版本的lock不再维护

安全键盘

module.exports = {
plugins:{
"safekeyboard": {
"config": {
"textShow": "instantAsterisk",
"disorder": "none",
"pressEffect": "default",
"keyboardType": "alpha|number|symbol",
"maxLength": 16,
"encryptMode": "md5",
"titleText": "Hundsun SafeKeyboard"
}
}
}
};

登录组件

module.exports = {
plugins:{
"login": {
"inputParams": {
"title": "登录"
},
"navigationbar": {
"show": true
},
"menu": {
"show": false
},
"config": {
"loginUrl":"https://2i3ydhmhd.lightyy.com/index.html",
"mustForcedToLogin":true
}
}
}
};

支付

module.exports = {
plugins:{
"pay": {}
}
};

反馈组件

module.exports = {
plugins:{
"feedback": {
"inputParams": {
"title": "反馈新问题"
},
"navigationbar": {
"show": true
},
"menu": {
"show": false
},
"style": {
"nicknameTextColor" : "@textColor2",
"placeholderTextColor" : "@textColor3",
"queryChatBackgroundColor" : "#dedede",
"queryChatTextColor":"@textColor1",
"replyChatBackgroundColor" : "#f0dad2",
"replyChatTextColor":"@textColor1"
},
"config": {
"placeholder" : "感谢反馈,请写下你的问题或意见"
}
}

}
};

地图组件

module.exports = {
plugins:{
"jsnbaidumap":{},
"mapbaidu":{
"config": {
"baidu_APIKey": "GViLdGaQF******PZR2wd",
"baidu_APIKey_iOS": "uEHT********agcacvMiEIsYgg",
"baidu_APIKey_Android": "a********OoSWlbGU2wD2PT"
}
}
}

}

注意事项:

文件组件

module.exports = {
plugins:{
"file": {
"navigationbar": {
"show": true,
"immersiveMode": false
},
"config": {
"showShareButton":true
}
}

}
};

安全组件

module.exports = {
plugins:{
"appsecurity": {
"config":{
"backgroundBlur":true, //开启后台屏幕模糊后,应用进入后台后界面自动模糊,防止窥探。true开启模糊,false不开启(仅对iOS有效)
"antiHijack":true, //Android专用,防劫持加固功能,true打开防劫持,false关闭防劫持
"simulatorEnable":true, //禁止模拟器上运行加固功能,true允许在模拟器上运行,false不允许在模拟器上运行
"rootAlert":false //手机越狱(iOS)或root(Android)状态弹框提示功能,true提示,false不提示
}
}

}
};

悬浮球组件

module.exports = {
plugins:{
"assistivetouch": {
"config": {
"src": "assistivetouch_bg",
"waitingTime": 1000,
"alpha":0.1,
"height":100,
"width":100,
"margin": 20,
"onlyShowInMainPage":true,
"action": "gmu://web?startPage=https://www.lightyy.com"
}
}

}
};

配置参数说明

字段 可选 类型及范围 说明
src string 浮动按钮背景图片,支持base64和资源路径(路径暂时只支持读取gmu_icon目录下图片)两种方式
action string 浮动按钮点击事件的响应操作,目前仅支持标准gmu协议的URL(例:gmu://web?startPage=https://www.lightyy.com)
waitingTime number 进入睡眠状态的等待时长(用户对浮动按钮无操作多长时间后会进入睡眠状态,单位ms,默认值为5000ms)
alpha number 睡眠状态时浮动按钮透明度(支持范围0 ~ 1.0),默认值为0.5
height number 浮动按钮显示高度(背景图片按照指定宽高值固定比例缩放),默认值为60
width number 浮动按钮显示宽度(背景图片按照指定宽高值固定比例缩放),默认值为60
margin number 浮动按钮吸附到屏幕边缘时的边距,默认值为18
onlyShowInMainPage bool 浮动按钮是否只在首页显示,进入二级页面即隐藏,默认为false