From 9420f61a8a53764244310568af7d27a2c5e25c8b Mon Sep 17 00:00:00 2001 From: ninty Date: Sun, 25 Feb 2018 00:25:09 +0800 Subject: [PATCH] V 1.2.2 --- API.md | 4 ++-- CHANGELOG.md | 7 +++++++ README.md | 2 +- package.json | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/API.md b/API.md index b534e05..23fb871 100644 --- a/API.md +++ b/API.md @@ -7,8 +7,8 @@ method | description ------ | ----------- **Volume**| -getVolume(type:string) => Promise | Get the system volume.

`type` must be one of `'music', 'call', 'system', 'ring', 'alarm', 'notification'`, default is `music` -setVolume(val:float, type:string) | Set the system volume by specified value, from 0 to 1. 0 for mute, and 1 is max volume.

`type` must be one of `'music', 'call', 'system', 'ring', 'alarm', 'notification'`, default is `music` +getVolume(type:string) => Promise | Get the system volume.

`type` must be one of `music`, `call`, `system`, `ring`, `alarm`, `notification`, default is `music` +setVolume(val:float, config:object) | Set the system volume by specified value, from 0 to 1. 0 for mute, and 1 is max volume.

`config` can be `{type: 'music', playSound:true, showUI:true}`

`type` : must be one of `music`, `call`, `system`, `ring`, `alarm`, `notification`, default is `music`.(Android only)
`playSound`: Whether to play a sound when changing the volume, default is `false`(Android only)
`showUI`: Show a toast containing the current volume, default is `false`(Android & iOS)

**since 1.2.2** addVolumeListener(callback) | Listen the volume changing, and it will return the listener. More info see [the example](https://github.com/c19354837/react-native-system-setting/blob/master/examples/SystemSettingExample/index.js#L42) removeVolumeListener(listener)| Remove listener when it no longer needed. ---|--- diff --git a/CHANGELOG.md b/CHANGELOG.md index f7b2aab..2d1a6d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# V1.2.2 +**2018-02-25** + +use `MPVolumeView` to get/set volume for iOS. + +change API `setVolume(val, type)` to `setVolume(val, config)`, see [detail](https://github.com/c19354837/react-native-system-setting/issues/15) + # V1.2.1 **2018-01-21** diff --git a/README.md b/README.md index 721f492..af0c43e 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ const volumeListener = SystemSetting.addVolumeListener((data) => { SystemSetting.removeVolumeListener(volumeListener) ``` -> For Android, you can change volume by type, default is `music`, [more detail](https://github.com/c19354837/react-native-system-setting/blob/master/API.md) +> `setVolume` can do more, [more detail](https://github.com/c19354837/react-native-system-setting/blob/master/API.md) **brightness** diff --git a/package.json b/package.json index aa60cc9..15fa31a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-system-setting", - "version": "1.2.1", + "version": "1.2.2", "description": "provide some system setting APIs. Volume, brightness, wifi, location, bluetooth, airplane...", "main": "SystemSetting.js", "homepage": "https://github.com/c19354837/react-native-system-setting",