iOS:notification plugin
This commit is contained in:
@@ -32,7 +32,7 @@ dependencies {
|
||||
implementation "pub.doric:devkit:${rootProject.ext.Version}"
|
||||
implementation 'com.github.bumptech.glide:glide:4.10.0'
|
||||
implementation 'com.github.bumptech.glide:annotations:4.10.0'
|
||||
implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.3.1'
|
||||
implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.3.2'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0'
|
||||
|
@@ -42,7 +42,7 @@ dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
api 'com.github.penfeizhou:jsc4a:0.1.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
|
||||
implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.3.1'
|
||||
implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.3.2'
|
||||
implementation 'jp.wasabeef:glide-transformations:4.1.0'
|
||||
implementation 'com.google.code.gson:gson:2.8.6'
|
||||
implementation "com.google.android.material:material:1.0.0"
|
||||
|
@@ -55,8 +55,12 @@ public class NotificationPlugin extends DoricJavaPlugin {
|
||||
|
||||
@DoricMethod
|
||||
public void publish(JSObject args, DoricPromise promise) {
|
||||
String biz = args.getProperty("biz").asString().value();
|
||||
String name = args.getProperty("name").asString().value();
|
||||
JSValue bizValue = args.getProperty("biz");
|
||||
if (bizValue.isString()) {
|
||||
String biz = bizValue.asString().value();
|
||||
name = "__doric__" + biz + "#" + name;
|
||||
}
|
||||
String data = null;
|
||||
JSValue value = args.getProperty("data");
|
||||
if (value.isString()) {
|
||||
@@ -67,7 +71,7 @@ public class NotificationPlugin extends DoricJavaPlugin {
|
||||
if (value.isBoolean()) {
|
||||
androidSystem = value.asBoolean().value();
|
||||
}
|
||||
Intent intent = new Intent("__doric__" + biz + "#" + name);
|
||||
Intent intent = new Intent(name);
|
||||
intent.putExtra("__doric_data__", data);
|
||||
if (androidSystem) {
|
||||
getDoricContext().getContext().sendBroadcast(intent);
|
||||
@@ -80,8 +84,12 @@ public class NotificationPlugin extends DoricJavaPlugin {
|
||||
|
||||
@DoricMethod
|
||||
public void subscribe(JSObject args, DoricPromise promise) {
|
||||
String biz = args.getProperty("biz").asString().value();
|
||||
String name = args.getProperty("name").asString().value();
|
||||
JSValue bizValue = args.getProperty("biz");
|
||||
if (bizValue.isString()) {
|
||||
String biz = bizValue.asString().value();
|
||||
name = "__doric__" + biz + "#" + name;
|
||||
}
|
||||
final String callbackId = args.getProperty("callback").asString().value();
|
||||
JSValue value = args.getProperty("androidSystem");
|
||||
boolean androidSystem = false;
|
||||
@@ -115,7 +123,7 @@ public class NotificationPlugin extends DoricJavaPlugin {
|
||||
}
|
||||
};
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction("__doric__" + biz + "#" + name);
|
||||
intentFilter.addAction(name);
|
||||
if (androidSystem) {
|
||||
getDoricContext().getContext().registerReceiver(receiver, intentFilter);
|
||||
systemReceivers.put(callbackId, receiver);
|
||||
|
Reference in New Issue
Block a user