Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const Camera = {
render: () => {
return null;
},
requestCameraPermission: async () => {
return true;
},
};

export const useCameraDevices = () => {
return { back: null };
};
export const useFrameProcessor = () => {};
29 changes: 21 additions & 8 deletions compass-numapp-template/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
apply plugin: "com.android.application"

import com.android.build.OutputFile

apply plugin: "com.android.application"
apply plugin: "com.facebook.react"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
Expand Down Expand Up @@ -73,12 +75,10 @@ import com.android.build.OutputFile
*/

project.ext.react = [
entryFile: "index.js"
entryFile: "index.js",
enableHermes: true
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
Expand Down Expand Up @@ -156,8 +156,21 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+"
implementation 'org.webkit:android-jsc:+'
implementation "com.facebook.react:react-android:+"
implementation "com.facebook.react:hermes-android"
implementation 'com.facebook.soloader:soloader:0.10.5+'
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}

debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
exclude group:'com.squareup.okhttp3', module:'okhttp'
}

}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package de.num.compass.android;

import android.content.Context;

import com.facebook.flipper.android.AndroidFlipperClient;
import com.facebook.flipper.android.utils.FlipperUtils;
import com.facebook.flipper.core.FlipperClient;
import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
import com.facebook.flipper.plugins.inspector.DescriptorMapping;
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.modules.network.NetworkingModule;

public class ReactNativeFlipper {

public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
if (FlipperUtils.shouldEnableFlipper(context)) {
final FlipperClient client = AndroidFlipperClient.getInstance(context);

client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
client.addPlugin(CrashReporterPlugin.getInstance());

NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
NetworkingModule.setCustomClientBuilder(builder -> {
builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
});

client.start();
}

}
}
Original file line number Diff line number Diff line change
@@ -1,51 +1,73 @@
package de.num.compass.android;

import android.app.Application;
import android.content.Context;

import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import com.facebook.react.bridge.JSIModulePackage;
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
import com.visioncameracodescanner.VisionCameraCodeScannerPluginPackage;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}

@Override
protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
packages.add(new VisionCameraCodeScannerPluginPackage());
return packages;
}

@Override
protected JSIModulePackage getJSIModulePackage() {
return new ReanimatedJSIModulePackage();
}

@Override
protected String getJSMainModuleName() {
return "index";
}
};

@Override
protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
packages.add(new VisionCameraCodeScannerPluginPackage());
return packages;
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}

@Override
protected JSIModulePackage getJSIModulePackage() {
return new ReanimatedJSIModulePackage();
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}

@Override
protected String getJSMainModuleName() {
return "index";
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick iup the class that initializes
Flipper since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("de.num.compass.android.ReactNativeFlipper");
aClass.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
}
catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException |
IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}
};

@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}

@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
13 changes: 10 additions & 3 deletions compass-numapp-template/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

buildscript {
ext {
buildToolsVersion = "31.0.0"
buildToolsVersion = "33.0.0"
minSdkVersion = 24
compileSdkVersion = 31
targetSdkVersion = 31
compileSdkVersion = 33
targetSdkVersion = 33
supportLibVersion = "28.0.0"
kotlinVersion = "1.6.20"

if (System.properties["os.arch"] == "aarch64") {
ndkVersion = "24.0.8215888"
} else {
ndkVersion = "21.4.7075529"
}
}
repositories {
google()
Expand Down
3 changes: 3 additions & 0 deletions compass-numapp-template/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ MYAPP_UPLOAD_STORE_FILE=key.store
MYAPP_UPLOAD_KEY_ALIAS=COMPASS
MYAPP_UPLOAD_STORE_PASSWORD=compass_default_key
MYAPP_UPLOAD_KEY_PASSWORD=compass_default_key

FLIPPER_VERSION = 0.191.0
hermesEnabled = true
1 change: 1 addition & 0 deletions compass-numapp-template/ios/.xcode.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export NODE_BINARY=$(command -v node)
Loading