|
@@ -26,24 +26,18 @@ class MIPush extends NativeEventEmitter {
|
|
this.state = {};
|
|
this.state = {};
|
|
}
|
|
}
|
|
|
|
|
|
- init(appid, appkey) {
|
|
|
|
- this.appid = appid;
|
|
|
|
- this.appkey = appkey;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- registerPush() {
|
|
|
|
- const { appid, appkey } = this;
|
|
|
|
|
|
+ init() {
|
|
if (Platform.OS == 'android') {
|
|
if (Platform.OS == 'android') {
|
|
PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.READ_PHONE_STATE).then((state) => {
|
|
PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.READ_PHONE_STATE).then((state) => {
|
|
if (state) {
|
|
if (state) {
|
|
PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE).then((state) => {
|
|
PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE).then((state) => {
|
|
if (state) {
|
|
if (state) {
|
|
|
|
|
|
- MIPushModule.init(appid, appkey);
|
|
|
|
|
|
+ MIPushModule.init();
|
|
} else {
|
|
} else {
|
|
PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE).then((granted) => {
|
|
PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE).then((granted) => {
|
|
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
|
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
|
- MIPushModule.init(appid, appkey);
|
|
|
|
|
|
+ MIPushModule.init();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -54,7 +48,7 @@ class MIPush extends NativeEventEmitter {
|
|
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
|
|
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
|
|
]).then((granted) => {
|
|
]).then((granted) => {
|
|
// if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
|
// if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
|
- MIPushModule.init(appid, appkey);
|
|
|
|
|
|
+ MIPushModule.init();
|
|
// }
|
|
// }
|
|
});
|
|
});
|
|
}
|
|
}
|