From 5f2d8e63c72b4a1af7aa4d257c85efaf64535dde Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Wed, 8 Jun 2016 15:15:23 +0300 Subject: [PATCH] jail module Former-commit-id: 32422310e81ee2190eeb11eb05738d4710dd1280 --- .../main/java/com/statusim/JailModule.java | 27 ++++++++++++++ .../main/java/com/statusim/JailPackage.java | 37 +++++++++++++++++++ .../main/java/com/statusim/MainActivity.java | 1 + 3 files changed, 65 insertions(+) create mode 100644 android/app/src/main/java/com/statusim/JailModule.java create mode 100644 android/app/src/main/java/com/statusim/JailPackage.java diff --git a/android/app/src/main/java/com/statusim/JailModule.java b/android/app/src/main/java/com/statusim/JailModule.java new file mode 100644 index 0000000000..eed3852cbb --- /dev/null +++ b/android/app/src/main/java/com/statusim/JailModule.java @@ -0,0 +1,27 @@ +package com.statusim; + +import com.facebook.react.bridge.Callback; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; + +public class JailModule extends ReactContextBaseJavaModule { + + public JailModule(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public String getName() { + return "Jail"; + } + + @ReactMethod + public void parse(String js, Callback succ, Callback fail) { + succ.invoke("{\"commands\":{\"request-money\":" + + "{\"description\":\"olala!\",\"name\":\"request-money\"," + + "\"params\":{\"foo\":{\"type\":\"string\"}}}}," + + "\"responses\":{}}"); + } +} + diff --git a/android/app/src/main/java/com/statusim/JailPackage.java b/android/app/src/main/java/com/statusim/JailPackage.java new file mode 100644 index 0000000000..c1c71d94f1 --- /dev/null +++ b/android/app/src/main/java/com/statusim/JailPackage.java @@ -0,0 +1,37 @@ +package com.statusim; + +import com.facebook.react.ReactPackage; +import com.facebook.react.bridge.JavaScriptModule; +import com.facebook.react.bridge.NativeModule; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.uimanager.ViewManager; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Created by rasom on 07.06.16. + */ +public class JailPackage implements ReactPackage { + + @Override + public List> createJSModules() { + return Collections.emptyList(); + } + + @Override + public List createViewManagers(ReactApplicationContext reactContext) { + return Collections.emptyList(); + } + + @Override + public List createNativeModules( + ReactApplicationContext reactContext) { + List modules = new ArrayList<>(); + + modules.add(new JailModule(reactContext)); + + return modules; + } +} diff --git a/android/app/src/main/java/com/statusim/MainActivity.java b/android/app/src/main/java/com/statusim/MainActivity.java index 3d411d9213..bbfa9caf05 100644 --- a/android/app/src/main/java/com/statusim/MainActivity.java +++ b/android/app/src/main/java/com/statusim/MainActivity.java @@ -76,6 +76,7 @@ public class MainActivity extends ReactActivity { protected List getPackages() { return Arrays.asList( new MainReactPackage(), + new JailPackage(), new RealmReactPackage(), new VectorIconsPackage(), new ReactNativeContacts(),