jail module

This commit is contained in:
Roman Volosovskyi 2016-06-08 15:15:23 +03:00
parent 0f4581476d
commit 32422310e8
3 changed files with 65 additions and 0 deletions

View File

@ -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\":{}}");
}
}

View File

@ -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<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
@Override
public List<NativeModule> createNativeModules(
ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new JailModule(reactContext));
return modules;
}
}

View File

@ -76,6 +76,7 @@ public class MainActivity extends ReactActivity {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new JailPackage(),
new RealmReactPackage(),
new VectorIconsPackage(),
new ReactNativeContacts(),