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

fix: create account

parent 733d2536
......@@ -162,6 +162,7 @@ android {
}
dependencies {
implementation project(':react-native-secure-storage')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.facebook.react:react-native:0.60.3'
......
......@@ -3,6 +3,7 @@ package io.parity.signer;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.reactlibrary.RNSecureStoragePackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
......@@ -25,6 +26,7 @@ public class MainApplication extends Application implements ReactApplication {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNSecureStoragePackage(),
new EthkeyBridgePackage(),
new RNGestureHandlerPackage()
);
......
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)
include ':app'
......@@ -59,6 +59,7 @@
6686E5A219254E3D8880285E /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = F2FB2DDD90964B3BB1FC813C /* Octicons.ttf */; };
39D32408FC4A464384BA5A5C /* SimpleLineIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E8E0FEBC36F54D78A81C1639 /* SimpleLineIcons.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 */
/* Begin PBXContainerItemProxy section */
......@@ -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; };
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; };
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 */
/* Begin PBXFrameworksBuildPhase section */
......@@ -405,6 +408,7 @@
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
BB1BF6E8C2204EDEA0DEFB71 /* libRNSecureStorage.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -620,6 +624,7 @@
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
8CC63279C525400CA35EAF96 /* RNSecureStorage.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
......@@ -1161,6 +1166,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
......@@ -1183,6 +1189,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
"OTHER_LDFLAGS[arch=*]" = " -lc++";
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
......@@ -1205,6 +1212,7 @@
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-camera/ios",
"$(SRCROOT)/../rust/signer",
"$(SRCROOT)/../node_modules/react-native-secure-storage/ios/**",
);
INFOPLIST_FILE = NativeSigner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
......@@ -1238,6 +1246,7 @@
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-camera/ios",
"$(SRCROOT)/../rust/signer",
"$(SRCROOT)/../node_modules/react-native-secure-storage/ios/**",
);
INFOPLIST_FILE = NativeSigner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
......
......@@ -34,65 +34,67 @@ export default class AccountIconChooser extends React.PureComponent<{
constructor(props) {
super(props);
this.icons = [];
const iconsDS = new FlatList.DataSource({
rowHasChanged: (r1, r2) => true
});
this.state = { iconsDS };
this.state = { icons: [] };
}
componentDidMount() {
this.refreshIcons();
}
refreshIcons = async () => {
try {
this.icons = [
...this.icons,
...(await Promise.all(
Array(10)
.join(' ')
.split(' ')
.map(async () => {
const seed = await words();
const { bip39, address } = await brainWalletAddress(seed);
const icons = await Promise.all(
Array(10)
.join(' ')
.split(' ')
.map(async () => {
const seed = await words();
const { bip39, address } = await brainWalletAddress(seed);
return {
seed,
address,
};
})
);
return {
seed,
address,
};
})
))
];
this.setState({ iconsDS: this.state.iconsDS.cloneWithRows(this.icons) });
this.setState({
icons
});
} catch (e) {
console.error(e);
}
};
componentDidMount() {
this.refreshIcons();
}
render() {
const { value, onChange } = this.props;
const { icons } = this.state;
console.log(icons);
return (
<View style={styles.body}>
<FlatList
style={styles.icons}
dataSource={this.state.iconsDS}
horizontal={true}
renderRow={(
{ address, seed },
sectionID: number,
rowID: number,
highlightRow
) => {
const selected = address.toLowerCase() === value.toLowerCase();
data={icons}
horizontal
renderItem={({ item, index, separators }) => {
const selected = item.address.toLowerCase() === value.toLowerCase();
const style = [styles.icon];
return (
<TouchableOpacity
key={index}
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>
);
}}
......
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