-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.ios.js
32 lines (28 loc) · 930 Bytes
/
index.ios.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
var VkSdkLoginManager = require('react-native').NativeModules.VkSdkLoginManager;
module.exports = {
/**
* Starts authorization process to retrieve unlimited token.
* If VKapp is available in system, it will opens and requests access from user.
* Otherwise Mobile Safari will be opened for access request.
* @returns {Promise}
*/
authorize: function() {
return new Promise(function(resolve, reject) {
VkSdkLoginManager.authorize(function(error, result) {
if (error) {
reject(error);
} else {
resolve(result);
}
});
});
},
/**
* Forces logout using OAuth (with VKAuthorizeController). Removes all cookies for *.vk.com.
* Has no effect for logout in VK app.
*/
logout: function() {
VkSdkLoginManager.logout();
}
};