mirror of
https://github.com/timepill/timepill-app.git
synced 2025-04-30 09:59:31 +08:00
push 初始化
This commit is contained in:
parent
c7c6034404
commit
cc73373878
1 changed files with 6 additions and 2 deletions
|
@ -3,16 +3,19 @@ import XGPushModule from 'react-native-smart-xgpush';
|
||||||
const XGPushNativeModules = NativeModules.XGPushModule;
|
const XGPushNativeModules = NativeModules.XGPushModule;
|
||||||
|
|
||||||
function init(cb) {
|
function init(cb) {
|
||||||
XGPushNativeModules.enableDebug(true);
|
|
||||||
if(Platform.OS ==='android'){
|
if(Platform.OS ==='android'){
|
||||||
|
XGPushNativeModules.enableDebug(true);
|
||||||
XGPushModule.notifyJSDidLoad(() => {
|
XGPushModule.notifyJSDidLoad(() => {
|
||||||
XGPushModule.registerPush();
|
XGPushModule.registerPush();
|
||||||
initOtherPush();
|
initOtherPush();
|
||||||
cb()
|
cb()
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
cb()
|
cb();
|
||||||
}
|
}
|
||||||
|
setAccount("12", (r) => {
|
||||||
|
console.log('setAccount:', r)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function initOtherPush() {
|
function initOtherPush() {
|
||||||
|
@ -28,6 +31,7 @@ function initOtherPush() {
|
||||||
function setAccount(uid, cb) {
|
function setAccount(uid, cb) {
|
||||||
if(Platform.OS === 'ios'){
|
if(Platform.OS === 'ios'){
|
||||||
XGPushModule.setAccount(uid,cb);
|
XGPushModule.setAccount(uid,cb);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
XGPushModule.bindAccount(uid,cb);
|
XGPushModule.bindAccount(uid,cb);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue