-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jasper
committed
Aug 2, 2018
1 parent
e47279a
commit b3c8be0
Showing
6 changed files
with
123 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.awesomeproject"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> | ||
|
||
<application | ||
android:name=".MainApplication" | ||
android:label="@string/app_name" | ||
android:icon="@mipmap/ic_launcher" | ||
android:allowBackup="false" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:label="@string/app_name" | ||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" | ||
android:windowSoftInputMode="adjustResize"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> | ||
</application> | ||
|
||
</manifest> |
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 @@ | ||
<resources> | ||
<string name="app_name">AwesomeProject</string> | ||
</resources> |
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,8 @@ | ||
<resources> | ||
|
||
<!-- Base application theme. --> | ||
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | ||
<!-- Customize your theme here. --> | ||
</style> | ||
|
||
</resources> |
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,44 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<script src="./eos.min.js"></script> | ||
<script> | ||
var eos = null; | ||
window.onload = function() { | ||
document.addEventListener('message', function(e) { | ||
var data = JSON.parse(e.data); | ||
var blockHeader = data.blockHeader; | ||
var chainId = data.chainId; | ||
var privateKey = data.PrivateKey; | ||
var actions = data.actions; | ||
getEos(chainId, privateKey, blockHeader, actions); | ||
}); | ||
}; | ||
function getEos(chainId, privateKey, blockHeader, actions) { | ||
eos = Eos({ | ||
httpEndpoint: null, | ||
transactionHeaders: blockHeader, | ||
chainId, | ||
broadcast: false, | ||
keyProvider: privateKey, | ||
mockTransactions: () => 'pass', | ||
}); | ||
transaction(actions); | ||
} | ||
function transaction(actions) { | ||
eos.transaction({ | ||
actions, | ||
}).then(tr => { | ||
tr.transaction.fee = "0.01 EOS"; | ||
window.postMessage(JSON.stringify(tr.transaction)); | ||
}).catch(err => { | ||
window.postMessage(JSON.stringify(err)); | ||
}); | ||
} | ||
</script> | ||
</head> | ||
|
||
<body> | ||
</body> | ||
</html> |
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// 引入公共组件 | ||
import React, { Component } from "react"; | ||
import {View, WebView, StyleSheet, Platform} from "react-native"; | ||
|
||
export default class WebViewComp extends Component { | ||
constructor (props) { | ||
super(props); | ||
this.state = {}; | ||
} | ||
|
||
render() { | ||
const WebViewSource = Platform.OS === "ios" ? require("./EOSJS.html") : {uri: "file:///android_asset/eos/EOSJS.html", baseUrl:"file:///android_asset/eos/"}; | ||
return ( | ||
<View style={styles.mainBox}> | ||
<WebView | ||
ref="WebView" | ||
style={styles.WebViewStyle} | ||
source={WebViewSource} | ||
onMessage={(e)=>{this.props.onMessage(e);}} | ||
javaScriptEnabled={true} | ||
mixedContentMode="always" | ||
originWhitelist={["*"]} | ||
/> | ||
</View> | ||
); | ||
} | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
mainBox: { | ||
flex:1, | ||
height:0, | ||
zIndex:-999999, | ||
position:"absolute", | ||
}, | ||
WebViewStyle: { | ||
height:0, | ||
width:0, | ||
backgroundColor:"transparent", | ||
}, | ||
}); |