-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #297 from EdgeApp/william/native-build
Add native build
- Loading branch information
Showing
51 changed files
with
818 additions
and
2,345 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/lib/ | ||
/node_modules/ | ||
/.nyc_output/ | ||
/android/src/main/assets/edge-exchange-plugins/ | ||
/coverage/ | ||
/dist/ | ||
/lib/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
# Javascript: | ||
lib/ | ||
# Build output: | ||
/.nyc_output/ | ||
/android/.gradle | ||
/android/*.jar | ||
/android/src/main/assets/edge-exchange-plugins/ | ||
/coverage/ | ||
/dist/ | ||
/lib/ | ||
|
||
# Package managers: | ||
node_modules/ | ||
npm-debug.log | ||
package-lock.json | ||
yarn-error.log | ||
|
||
# Editors: | ||
.DS_Store | ||
.idea/ | ||
.vscode/ | ||
|
||
# Test results: | ||
.nyc_output/ | ||
/coverage/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{ | ||
"include": ["src/**/*.ts"], | ||
"extension": [".ts"], | ||
"require": ["sucrase/register"], | ||
"all": true | ||
} | ||
"include": ["src/**/*.ts"], | ||
"require": ["sucrase/register"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
buildscript { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
classpath "com.android.tools.build:gradle:7.3.1" | ||
} | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
|
||
def safeExtGet(prop, fallback) { | ||
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback | ||
} | ||
|
||
android { | ||
compileSdkVersion safeExtGet('compileSdkVersion', 28) | ||
defaultConfig { | ||
minSdkVersion safeExtGet('minSdkVersion', 19) | ||
targetSdkVersion safeExtGet('targetSdkVersion', 27) | ||
} | ||
lintOptions { | ||
abortOnError false | ||
} | ||
} | ||
|
||
repositories { | ||
} | ||
|
||
dependencies { | ||
implementation 'com.facebook.react:react-native:+' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env sh | ||
|
||
here=$(dirname $0) | ||
|
||
formatJava() { | ||
tool="google-java-format-1.7-all-deps.jar" | ||
url="https://github.com/google/google-java-format/releases/download/google-java-format-1.7/$tool" | ||
jar="$here/$tool" | ||
|
||
# If the tool is missing, grab it from GitHub: | ||
if [ ! -e "$jar" ]; then | ||
curl -L -o "$jar" "$url" | ||
fi | ||
|
||
echo $(find "$here/src" -name "*.java") | ||
java -jar "$jar" --replace $(find "$here/src" -name "*.java") | ||
} | ||
|
||
formatJava |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="app.edge.reactnative.exchange"> | ||
</manifest> |
26 changes: 26 additions & 0 deletions
26
android/src/main/java/app/edge/reactnative/exchange/EdgeExchangePluginsModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package app.edge.reactnative.exchange; | ||
|
||
import com.facebook.react.bridge.ReactApplicationContext; | ||
import com.facebook.react.bridge.ReactContextBaseJavaModule; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class EdgeExchangePluginsModule extends ReactContextBaseJavaModule { | ||
EdgeExchangePluginsModule(ReactApplicationContext context) { | ||
super(context); | ||
} | ||
|
||
@Override | ||
public Map<String, Object> getConstants() { | ||
final Map<String, Object> constants = new HashMap<>(); | ||
constants.put( | ||
"sourceUri", | ||
"file:///android_asset/edge-exchange-plugins/edge-exchange-plugins.js"); | ||
return constants; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "EdgeExchangePluginsModule"; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
android/src/main/java/app/edge/reactnative/exchange/EdgeExchangePluginsPackage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package app.edge.reactnative.exchange; | ||
|
||
import androidx.annotation.NonNull; | ||
import com.facebook.react.ReactPackage; | ||
import com.facebook.react.bridge.NativeModule; | ||
import com.facebook.react.bridge.ReactApplicationContext; | ||
import com.facebook.react.uimanager.ViewManager; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public class EdgeExchangePluginsPackage implements ReactPackage { | ||
@NonNull | ||
@Override | ||
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) { | ||
return Collections.<NativeModule>singletonList( | ||
new EdgeExchangePluginsModule(reactContext)); | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) { | ||
return Collections.emptyList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types' | ||
|
||
/* Debug-mode URI to use on React Native. */ | ||
export const debugUri: string | ||
|
||
/* Regular URI to use on React Native. */ | ||
export const pluginUri: string | ||
|
||
type EdgeCorePluginFactory = (env: EdgeCorePluginOptions) => EdgeCurrencyPlugin | ||
|
||
/** | ||
* The Node.js default export. | ||
*/ | ||
declare const plugins: { | ||
[pluginId: string]: EdgeCorePluginFactory | ||
} | ||
|
||
export default plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require "json" | ||
|
||
package = JSON.parse(File.read(File.join(__dir__, "package.json"))) | ||
|
||
Pod::Spec.new do |s| | ||
s.name = package['name'] | ||
s.version = package['version'] | ||
s.summary = package['description'] | ||
s.homepage = package['homepage'] | ||
s.license = package['license'] | ||
s.authors = package['author'] | ||
|
||
s.platform = :ios, "9.0" | ||
s.requires_arc = true | ||
s.source = { | ||
:git => "https://github.com/EdgeApp/edge-exchange-plugins.git", | ||
:tag => "v#{s.version}" | ||
} | ||
s.source_files = | ||
"ios/EdgeExchangePluginsModule.swift", | ||
"ios/EdgeExchangePluginsModule.m" | ||
|
||
s.resource_bundles = { | ||
"edge-exchange-plugins" => "android/src/main/assets/edge-exchange-plugins/*.js" | ||
} | ||
|
||
s.dependency "React-Core" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#import <React/RCTBridgeModule.h> | ||
|
||
@interface RCT_EXTERN_MODULE(EdgeExchangePluginsModule, NSObject) | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@objc(EdgeExchangePluginsModule) class EdgeExchangePluginsModule: NSObject { | ||
@objc static func requiresMainQueueSetup() -> Bool { return false } | ||
|
||
@objc func constantsToExport() -> NSDictionary { | ||
return ["sourceUri": sourceUri() ?? ""] | ||
} | ||
|
||
func sourceUri() -> String? { | ||
if let bundleUrl = Bundle.main.url( | ||
forResource: "edge-exchange-plugins", | ||
withExtension: "bundle" | ||
), | ||
let bundle = Bundle(url: bundleUrl), | ||
let script = bundle.url(forResource: "edge-exchange-plugins", withExtension: "js") | ||
{ | ||
return script.absoluteString | ||
} | ||
return nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Placeholder so react-native autolinking can find us. |
Oops, something went wrong.