Skip to content

Commit

Permalink
65 fix all code warnings and go typescript as much as possible (#66)
Browse files Browse the repository at this point in the history
* adding wal-lib types

* more fixes with new types

* processing indicator per chat session fixed

* more fixes for credential refactor

* epic typescript refactor

* password validation and many small tweaks

* changes making/reading bar codes

* many UX adjustments

Co-authored-by: 2byrds <[email protected]>
  • Loading branch information
2byrds and 2byrds authored Jun 13, 2022
1 parent 7938a0d commit 380228a
Show file tree
Hide file tree
Showing 65 changed files with 4,019 additions and 4,369 deletions.
Binary file added @rootsid/rootswallet.jks
Binary file not shown.
142 changes: 0 additions & 142 deletions App.js.orig

This file was deleted.

14 changes: 3 additions & 11 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import 'react-native-gesture-handler';
import React from 'react';

//import * as SplashScreen from 'expo-splash-screen';
import Providers from './src/navigation';

export default function App() {
//SplashScreen.hideAsync();
return (
<Providers />
);
}

// const styles = StyleSheet.create({
// container: {
// flex: 1,
// backgroundColor: '#fff',
// alignItems: 'center',
// justifyContent: 'center',
// },
// });
}
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import com.android.build.OutputFile
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation. If none specified and
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
* // "index.android.js" exists, it will be used. Otherwise "index.ts" is
* // default. Can be overridden with ENTRY_FILE environment variable.
* entryFile: "index.android.js",
*
Expand Down
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="44.0.0"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://exp.host/@anonymous/rootswallet"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="10000"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://exp.host/@rootsid/rootswallet"/>
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:screenOrientation="unspecified">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
Expand Down
64 changes: 26 additions & 38 deletions android/app/src/main/java/com/rootswallet/PrismModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,20 @@ class PrismModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
return "PrismModule"
}

@ReactMethod(isBlockingSynchronousMethod = true)
fun setNetwork(host: String = "ppp.atalaprism.io", port: String = "50053") {
Log.d("PRISM_TAG","Setting GrpcConfig host "+host+" w/port "+port);
GrpcConfig.host = host
GrpcConfig.port = port
@ReactMethod
fun getDidDocument(did: String, promise: Promise) {
Log.d("PRISM_TAG","Getting DID doc"+did);
thread(start = true) {
try {
var didDocJson = getDidDocumentJson(did);
Log.d("PRISM_TAG","Got did document "+did+" w/ doc"+didDocJson)
promise.resolve(didDocJson);
} catch (e: Exception) {
promise.reject("Publish Error", e);
}
}
}

// @ReactMethod(isBlockingSynchronousMethod = true)
// fun test() {Log.d("test","test")}
//
// @ReactMethod(isBlockingSynchronousMethod = true)
// fun testNode() {
// val wal = newWallet("walletname1", "", "password1")
// val didAlias1 = "didAlias1"
// val walAfterDid = newDid(wal, didAlias1, true)
// Log.d("LANCETAG", "Testing node publish....")
// val output = publishDid(walAfterDid, didAlias1).toString()
// }

@ReactMethod(isBlockingSynchronousMethod = true)
fun newDID(walJson: String, didAlias: String): String {
var cliWal = Json.decodeFromString<Wallet>(walJson);
Expand Down Expand Up @@ -70,25 +65,6 @@ class PrismModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
}
}

@ReactMethod
fun importCred(walJson: String, credAlias: String, credJson: String, promise: Promise) {
Log.d("PRISM_TAG","Importing credential for "+credAlias+" from wallet "+walJson);
thread(start = true) {
try {
val importedCredential = ImportedCredential(
credAlias,
Json.decodeFromString<VerifiedCredential>(credJson)
)
var newWal = Json.decodeFromString<Wallet>(walJson);
newWal.importedCredentials.add(importedCredential)
//Log.d("PRISM_TAG","Credential imported",walJson)
promise.resolve(Json.encodeToString(newWal));
} catch (e: Exception) {
promise.reject("Publish Error", e);
}
}
}

@ReactMethod
fun issueCred(walJson: String, didAlias: String, credJson: String, promise: Promise) {
Log.d("PRISM_TAG","Issuing credential for "+didAlias+" from wallet "+walJson);
Expand Down Expand Up @@ -122,13 +98,25 @@ class PrismModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
}
}

@ReactMethod(isBlockingSynchronousMethod = true)
fun setNetwork(host: String = "ppp.atalaprism.io", port: String = "50053") {
Log.d("PRISM_TAG","Setting GrpcConfig host "+host+" w/port "+port);
GrpcConfig.host = host
GrpcConfig.port = port
}

@ReactMethod
fun verifyImportedCred(walJson: String, credAlias: String, promise: Promise) {
fun verifyCred(walJson: String, credAlias: String, imported: Boolean, promise: Promise) {
Log.d("PRISM_TAG","Verifying credential for "+credAlias+" from wallet "+walJson);
thread(start = true) {
try {
var cliWal = Json.decodeFromString<Wallet>(walJson);
var verResult = Json.encodeToString(verifyImportedCredential(cliWal, credAlias))
var verResult = ""
if(imported) {
verResult = Json.encodeToString(verifyImportedCredential(cliWal, credAlias))
} else {
verResult = Json.encodeToString(verifyIssuedCredential(cliWal, credAlias))
}
Log.d("PRISM_TAG","Credential "+credAlias+" is " + verResult)
promise.resolve(verResult);
} catch (e: Exception) {
Expand Down
5 changes: 0 additions & 5 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
"platforms": ["android"],
"githubUrl": "https://github.com/roots-id/rootswallet",
"icon": "./src/assets/LogoOnly1024.png",
"splash": {
"image": "./src/assets/WhiteTextExtraGlow.png",
"resizeMode": "contain",
"backgroundColor": "#000000"
},
"updates": {
"enabled": true,
"fallbackToCacheTimeout": 10000
Expand Down
23 changes: 23 additions & 0 deletions eas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"cli": {
"version": ">= 0.53.0"
},
"build": {
"development": {
"distribution": "internal",
"android": {
"gradleCommand": ":app:assembleDebug"
},
"ios": {
"buildConfiguration": "Debug"
}
},
"preview": {
"distribution": "internal"
},
"production": {}
},
"submit": {
"production": {}
}
}
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"resolutions": {
"@types/react": "17.0.1"
},
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
Expand All @@ -22,12 +23,12 @@
"@transmute/did-key-ed25519": "^0.3.0-unstable.8",
"@transmute/did-key-secp256k1": "^0.3.0-unstable.8",
"@transmute/did-key-x25519": "^0.3.0-unstable.8",
"base-64": "^1.0.0",
"buffer": "^6.0.3",
"emoji-utils": "^1.0.1",
"expo": "^44.0.6",
"expo-barcode-scanner": "^11.2.1",
"expo-secure-store": "~11.1.0",
"expo-splash-screen": "~0.14.1",
"expo-status-bar": "~1.2.0",
"expo-updates": "~0.11.7",
"i18next": "^21.6.4",
Expand All @@ -38,7 +39,7 @@
"react-native": "0.64.3",
"react-native-base64": "^0.2.1",
"react-native-gesture-handler": "~2.1.0",
"react-native-gifted-chat": "1.0.0-beta-3",
"react-native-gifted-chat": "1.0.0",
"react-native-hyperlink": "^0.0.19",
"react-native-localize": "^2.1.7",
"react-native-paper": "^4.12.1",
Expand Down
15 changes: 2 additions & 13 deletions src/components/FormButton.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
import React from 'react';
import { Dimensions, StyleSheet } from 'react-native';
import { Button } from 'react-native-paper';
import {styles} from "../styles/styles";


const { width, height } = Dimensions.get('screen');

export default function FormButton({ title, modeValue, ...rest }) {
return (
<Button
mode={modeValue}
{...rest}
style={styles.button}
contentStyle={styles.buttonContainer}
>
{title}
</Button>
);
}

const styles = StyleSheet.create({
button: {
marginTop: 10,
},
buttonContainer: {
width: width / 2,
height: height / 15,
},
});
Loading

0 comments on commit 380228a

Please sign in to comment.