Commit 96e8af5f authored by YJ's avatar YJ
Browse files

fix: create account

parent 733d2536
...@@ -162,6 +162,7 @@ android { ...@@ -162,6 +162,7 @@ android {
} }
dependencies { dependencies {
implementation project(':react-native-secure-storage')
implementation fileTree(dir: "libs", include: ["*.jar"]) implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.facebook.react:react-native:0.60.3' implementation 'com.facebook.react:react-native:0.60.3'
......
...@@ -3,6 +3,7 @@ package io.parity.signer; ...@@ -3,6 +3,7 @@ package io.parity.signer;
import android.app.Application; import android.app.Application;
import com.facebook.react.ReactApplication; import com.facebook.react.ReactApplication;
import com.reactlibrary.RNSecureStoragePackage;
import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage; import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage; import com.facebook.react.shell.MainReactPackage;
...@@ -25,6 +26,7 @@ public class MainApplication extends Application implements ReactApplication { ...@@ -25,6 +26,7 @@ public class MainApplication extends Application implements ReactApplication {
protected List<ReactPackage> getPackages() { protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList( return Arrays.<ReactPackage>asList(
new MainReactPackage(), new MainReactPackage(),
new RNSecureStoragePackage(),
new EthkeyBridgePackage(), new EthkeyBridgePackage(),
new RNGestureHandlerPackage() new RNGestureHandlerPackage()
); );
......
rootProject.name = 'Parity Signer' rootProject.name = 'Parity Signer'
include ':react-native-secure-storage'
project(':react-native-secure-storage').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-secure-storage/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app' include ':app'
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
6686E5A219254E3D8880285E /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = F2FB2DDD90964B3BB1FC813C /* Octicons.ttf */; }; 6686E5A219254E3D8880285E /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = F2FB2DDD90964B3BB1FC813C /* Octicons.ttf */; };
39D32408FC4A464384BA5A5C /* SimpleLineIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E8E0FEBC36F54D78A81C1639 /* SimpleLineIcons.ttf */; }; 39D32408FC4A464384BA5A5C /* SimpleLineIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E8E0FEBC36F54D78A81C1639 /* SimpleLineIcons.ttf */; };
47E3EAEBAE24454EBE6C695F /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7733AB637FF54DE5B174F42C /* Zocial.ttf */; }; 47E3EAEBAE24454EBE6C695F /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7733AB637FF54DE5B174F42C /* Zocial.ttf */; };
BB1BF6E8C2204EDEA0DEFB71 /* libRNSecureStorage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AFB9B36F67549FE85C83E49 /* libRNSecureStorage.a */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
...@@ -379,6 +380,8 @@ ...@@ -379,6 +380,8 @@
F2FB2DDD90964B3BB1FC813C /* Octicons.ttf */ = {isa = PBXFileReference; name = "Octicons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; F2FB2DDD90964B3BB1FC813C /* Octicons.ttf */ = {isa = PBXFileReference; name = "Octicons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
E8E0FEBC36F54D78A81C1639 /* SimpleLineIcons.ttf */ = {isa = PBXFileReference; name = "SimpleLineIcons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; E8E0FEBC36F54D78A81C1639 /* SimpleLineIcons.ttf */ = {isa = PBXFileReference; name = "SimpleLineIcons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
7733AB637FF54DE5B174F42C /* Zocial.ttf */ = {isa = PBXFileReference; name = "Zocial.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; 7733AB637FF54DE5B174F42C /* Zocial.ttf */ = {isa = PBXFileReference; name = "Zocial.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
8CC63279C525400CA35EAF96 /* RNSecureStorage.xcodeproj */ = {isa = PBXFileReference; name = "RNSecureStorage.xcodeproj"; path = "../node_modules/react-native-secure-storage/ios/RNSecureStorage.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
9AFB9B36F67549FE85C83E49 /* libRNSecureStorage.a */ = {isa = PBXFileReference; name = "libRNSecureStorage.a"; path = "libRNSecureStorage.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -405,6 +408,7 @@ ...@@ -405,6 +408,7 @@
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
BB1BF6E8C2204EDEA0DEFB71 /* libRNSecureStorage.a in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -620,6 +624,7 @@ ...@@ -620,6 +624,7 @@
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
8CC63279C525400CA35EAF96 /* RNSecureStorage.xcodeproj */,
); );
name = Libraries; name = Libraries;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1161,6 +1166,7 @@ ...@@ -1161,6 +1166,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
); );
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
...@@ -1183,6 +1189,7 @@ ...@@ -1183,6 +1189,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
); );
"OTHER_LDFLAGS[arch=*]" = " -lc++"; "OTHER_LDFLAGS[arch=*]" = " -lc++";
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
...@@ -1205,6 +1212,7 @@ ...@@ -1205,6 +1212,7 @@
"$(inherited)", "$(inherited)",
"$(SRCROOT)/../node_modules/react-native-camera/ios", "$(SRCROOT)/../node_modules/react-native-camera/ios",
"$(SRCROOT)/../rust/signer", "$(SRCROOT)/../rust/signer",
"$(SRCROOT)/../node_modules/react-native-secure-storage/ios/**",
); );
INFOPLIST_FILE = NativeSigner/Info.plist; INFOPLIST_FILE = NativeSigner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
...@@ -1238,6 +1246,7 @@ ...@@ -1238,6 +1246,7 @@
"$(inherited)", "$(inherited)",
"$(SRCROOT)/../node_modules/react-native-camera/ios", "$(SRCROOT)/../node_modules/react-native-camera/ios",
"$(SRCROOT)/../rust/signer", "$(SRCROOT)/../rust/signer",
"$(SRCROOT)/../node_modules/react-native-secure-storage/ios/**",
); );
INFOPLIST_FILE = NativeSigner/Info.plist; INFOPLIST_FILE = NativeSigner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
......
...@@ -34,65 +34,67 @@ export default class AccountIconChooser extends React.PureComponent<{ ...@@ -34,65 +34,67 @@ export default class AccountIconChooser extends React.PureComponent<{
constructor(props) { constructor(props) {
super(props); super(props);
this.icons = [];
const iconsDS = new FlatList.DataSource({ this.state = { icons: [] };
rowHasChanged: (r1, r2) => true }
});
this.state = { iconsDS }; componentDidMount() {
this.refreshIcons();
} }
refreshIcons = async () => { refreshIcons = async () => {
try { try {
this.icons = [ const icons = await Promise.all(
...this.icons, Array(10)
...(await Promise.all( .join(' ')
Array(10) .split(' ')
.join(' ') .map(async () => {
.split(' ') const seed = await words();
.map(async () => { const { bip39, address } = await brainWalletAddress(seed);
const seed = await words();
const { bip39, address } = await brainWalletAddress(seed); return {
seed,
address,
};
})
);
return { this.setState({
seed, icons
address, });
};
})
))
];
this.setState({ iconsDS: this.state.iconsDS.cloneWithRows(this.icons) });
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
}; };
componentDidMount() {
this.refreshIcons();
}
render() { render() {
const { value, onChange } = this.props; const { value, onChange } = this.props;
const { icons } = this.state;
console.log(icons);
return ( return (
<View style={styles.body}> <View style={styles.body}>
<FlatList <FlatList
style={styles.icons} style={styles.icons}
dataSource={this.state.iconsDS} data={icons}
horizontal={true} horizontal
renderRow={( renderItem={({ item, index, separators }) => {
{ address, seed }, const selected = item.address.toLowerCase() === value.toLowerCase();
sectionID: number,
rowID: number,
highlightRow
) => {
const selected = address.toLowerCase() === value.toLowerCase();
const style = [styles.icon]; const style = [styles.icon];
return ( return (
<TouchableOpacity <TouchableOpacity
key={index}
style={[styles.iconBorder, selected ? styles.selected : {}]} style={[styles.iconBorder, selected ? styles.selected : {}]}
onPress={() => this.props.onChange({ address, seed })} onPress={() =>
this.props.onChange({
address: item.address,
seed: item.seed,
})
}
onShowUnderlay={separators.highlight}
onHideUnderlay={separators.unhighlight}
> >
<AccountIcon style={style} seed={'0x' + address} /> <AccountIcon style={style} seed={'0x' + item.address} />
</TouchableOpacity> </TouchableOpacity>
); );
}} }}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment