mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-05-11 23:48:56 +08:00
[notifications] First pass at notifications JS API
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package io.invertase.firebase.notifications;
|
||||
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
|
||||
import com.facebook.react.bridge.Promise;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
|
||||
public class RNFirebaseNotifications extends ReactContextBaseJavaModule {
|
||||
public RNFirebaseNotifications(ReactApplicationContext context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "RNFirebaseNotifications";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void sendNotification(Promise promise) {
|
||||
//
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.invertase.firebase.notifications;
|
||||
|
||||
import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class RNFirebaseNotificationsPackage implements ReactPackage {
|
||||
public RNFirebaseNotificationsPackage() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param reactContext react application context that can be used to create modules
|
||||
* @return list of native modules to register with the newly created catalyst instance
|
||||
*/
|
||||
@Override
|
||||
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
||||
List<NativeModule> modules = new ArrayList<>();
|
||||
modules.add(new RNFirebaseNotifications(reactContext));
|
||||
|
||||
return modules;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param reactContext
|
||||
* @return a list of view managers that should be registered with {@link UIManagerModule}
|
||||
*/
|
||||
@Override
|
||||
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user