-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
91 lines (78 loc) · 2.17 KB
/
index.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import { NativeModules, Platform } from 'react-native'
const OS = Platform.OS
const Umeng = NativeModules.UmengModule
export function isWXAppInstalled() {
return new Promise((res) => {
Umeng.isWXAppInstalled().then((data) => {
res(Number(data))
}).catch((err) => {
res({ code: 400, msg: err.toString() })
})
})
}
export function isQQAppInstalled() {
return new Promise((res) => {
Umeng.isQQAppInstalled().then((data) => {
res(Number(data))
}).catch((err) => {
res({ code: 400, msg: err.toString() })
})
})
}
export function isWBAppInstalled() {
return new Promise((res) => {
Umeng.isWBAppInstalled().then((data) => {
res(Number(data))
}).catch((err) => {
res({ code: 400, msg: err.toString() })
})
})
}
export function WXLogin() {
return new Promise((res) => {
Umeng.WXLogin().then((r) => {
const data = JSON.parse(r)
if (Number(data.isLogin)) res({ code: 200, data })
if (!Number(data.isLogin)) res({ code: 400, msg: data.errmsg })
}).catch((err) => {
res({ code: 400, msg: err.errmsg })
})
})
}
export function QQLogin() {
return new Promise((res) => {
Umeng.QQLogin().then((r) => {
const data = JSON.parse(r)
if (Number(data.isLogin)) res({ code: 200, data })
if (!Number(data.isLogin)) res({ code: 400, msg: data.errmsg })
}).catch((err) => {
res({ code: 400, msg: err.errmsg })
})
})
}
export function WBLogin() {
return new Promise((res) => {
Umeng.WBLogin().then((r) => {
const data = JSON.parse(r)
if (Number(data.isLogin)) res({ code: 200, data })
if (!Number(data.isLogin)) res({ code: 400, msg: data.errmsg })
}).catch((err) => {
res({ code: 400, msg: err.errmsg })
})
})
}
export function shareWxTimeline(obj) {
return Umeng.shareWxTimeline(OS === 'ios' ? obj : JSON.stringify(obj))
}
export function shareWxSession(obj) {
return Umeng.shareWxSession(OS === 'ios' ? obj : JSON.stringify(obj))
}
export function shareQzone(obj) {
return Umeng.shareQzone(OS === 'ios' ? obj : JSON.stringify(obj))
}
export function shareQQ(obj) {
return Umeng.shareQQ(OS === 'ios' ? obj : JSON.stringify(obj))
}
export function shareWB(obj) {
return Umeng.shareWB(OS === 'ios' ? obj : JSON.stringify(obj))
}