Skip to content

Commit

Permalink
67 apk installation in emulator and on device (#70)
Browse files Browse the repository at this point in the history
* removing dep warnings. removed type script errors

* build regression fixed

Co-authored-by: 2byrds <[email protected]>
  • Loading branch information
2byrds and 2byrds committed Jun 30, 2022
1 parent 3acc3f1 commit 3789a51
Show file tree
Hide file tree
Showing 14 changed files with 591 additions and 378 deletions.
Binary file modified @rootsid/rootswallet.jks
Binary file not shown.
15 changes: 9 additions & 6 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import 'react-native-gesture-handler';
//import 'react-native-gesture-handler';
import React from 'react';
//import * as SplashScreen from 'expo-splash-screen';
import {Text, View} from 'react-native';
import {styles} from "./src/styles/styles";
import Providers from './src/navigation';

export default function App() {
//SplashScreen.hideAsync();
return (
<Providers />
);
// return (
// <View style={styles.container}>
// <Text>Open up App.tsx to start working on your app!</Text>
// </View>
// );
return (<Providers/>)
}
3 changes: 3 additions & 0 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />



</manifest>
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<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="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">
<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" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
3 changes: 1 addition & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 26
compileSdkVersion = 30
targetSdkVersion = 30
Expand All @@ -14,7 +13,7 @@ buildscript {
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.0")
classpath('com.android.tools.build:gradle:4.1.0')

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { registerRootComponent } from 'expo';

import App from './App';

// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
Expand Down
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"private": true,
"name": "rootswallet",
"version": "0.0.1-alpha",
"resolutions": {
"@types/react": "17.0.1"
},
Expand All @@ -13,9 +16,6 @@
"@react-native-community/masked-view": "0.1.10",
"@react-native-picker/picker": "^2.4.1",
"@react-navigation/bottom-tabs": "^6.3.1",
"@react-navigation/core": "6.2.1",
"@react-navigation/devtools": "6.0.7",
"@react-navigation/drawer": "6.4.1",
"@react-navigation/native": "6.0.10",
"@react-navigation/native-stack": "^6.6.2",
"@react-navigation/routers": "6.1.0",
Expand Down Expand Up @@ -59,8 +59,5 @@
"@types/react": "~17.0.21",
"@types/react-native": "~0.64.12",
"typescript": "~4.3.5"
},
"private": true,
"name": "rootswallet",
"version": "0.0.1-alpha"
}
}
4 changes: 1 addition & 3 deletions src/screens/ChatScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ export default function ChatScreen({route, navigation}: CompositeScreenProps<any
borderTopWidth: 1,
padding: 1,
}}
textInputStyle={{color: "white"}}
/>
);
}
Expand All @@ -259,7 +258,7 @@ export default function ChatScreen({route, navigation}: CompositeScreenProps<any
<View style={{backgroundColor: "#251520", flex: 1, display: "flex",}}>
<GiftedChat
isTyping={processing}
messages={messages?.sort((a, b) => b.createdAt - a.createdAt)}
messages={messages?.sort((a, b) => {return ((b.createdAt as Date).getDate() - (a.createdAt as Date).getDate())})}
onPress={ (context, message) => processBubbleClick(context,message)}
onQuickReply={reply => handleQuickReply(reply)}
onSend={messages => handleSend(messages)}
Expand Down Expand Up @@ -317,7 +316,6 @@ export default function ChatScreen({route, navigation}: CompositeScreenProps<any
placeholder={"Make a note..."}
renderInputToolbar={props => renderInputToolbar(props)}
//renderActions={renderActions}
renderAllAvatars={true}
renderAvatarOnTop={true}
renderBubble={renderBubble}
renderQuickReplySend={() => <Text style={{color: '#e69138', fontSize: 18}}>Confirm</Text>}
Expand Down
13 changes: 11 additions & 2 deletions src/screens/CreateRelScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import FormButton from '../components/FormButton';
import FormInput from '../components/FormInput';
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import { Text, View } from 'react-native';
import { IconButton, Title } from 'react-native-paper';
import * as models from '../models'
Expand All @@ -15,6 +15,7 @@ export default function CreateRelScreen({ route, navigation }: CompositeScreenPr
const [relAvatar, setRelAvatar] = useState<string>(rel.displayPictureUrl);
const [relDid, setRelDid] = useState<string>(rel.did);
const [problemDisabled, setProblemDisabled] = useState<boolean>(true)
const [errorText, setErrorText] = useState(<View/>)

async function handleButtonPress() {
if (relName.length > 0) {
Expand All @@ -30,6 +31,14 @@ export default function CreateRelScreen({ route, navigation }: CompositeScreenPr
}
}

useEffect(() => {
if(!problemDisabled) {
setErrorText(<View><Text style={displayProblem(problemDisabled)}>Could not create relationship</Text></View>)
} else {
setErrorText(<View></View>)
}
},[problemDisabled])

return (
<View style={styles.container}>
<View style={styles.closeButtonContainer}>
Expand Down Expand Up @@ -60,7 +69,7 @@ export default function CreateRelScreen({ route, navigation }: CompositeScreenPr
onChangeText={(text: string) => setRelDid(text)}
clearButtonMode="while-editing"
/>
<Text disable={problemDisabled} style={displayProblem(problemDisabled)}>Could not create relationship</Text>
{errorText}
<FormButton
title="Create Relationship"
modeValue="contained"
Expand Down
28 changes: 21 additions & 7 deletions src/screens/CreateWalletScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export default function CreateWalletScreen({route, navigation}: CompositeScreenP
const [passwordAlpha, setPasswordAlpha] = useState<boolean>(false)
const [passwordNumeric, setPasswordNumeric] = useState<boolean>(false)
const [passwordLongEnough, setPasswordLongEnough] = useState<boolean>(false)
const [errorText, setErrorText] = useState(<View/>)

console.log("CreateWalletScreen - start")

const {signIn} = React.useContext(AuthContext);
Expand All @@ -41,6 +43,24 @@ export default function CreateWalletScreen({route, navigation}: CompositeScreenP
}, [password, confirmPassword]
);

useEffect(() => {
if(!problemDisabled) {
setErrorText(<View><Text style={displayProblem(problemDisabled)}>Could not create relationship</Text></View>)
} else if(!passwordLongEnough) {
setErrorText(<Text style={displayProblem(passwordLongEnough)}>Password is not at least 8
characters</Text>)
} else if(!passwordAlpha) {
setErrorText(<Text style={displayProblem(passwordAlpha)}>Password does not contain letters</Text>)
} else if(!passwordNumeric) {
setErrorText(<Text style={displayProblem(passwordNumeric)}>Password does not contain
numbers</Text>);
} else if(!passwordsMatch) {
setErrorText(<Text style={displayProblem(passwordsMatch)}>Passwords do not match</Text>)
} else {
setErrorText(<View/>)
}
},[problemDisabled,passwordsMatch,passwordNumeric,passwordLongEnough,passwordAlpha])

function handleOpenWithLinking() {
Linking.openURL('https://www.rootsid.com/projects/rootswallet/help');
}
Expand Down Expand Up @@ -71,13 +91,7 @@ export default function CreateWalletScreen({route, navigation}: CompositeScreenP
secureTextEntry={true}
onChangeText={(userPassword: React.SetStateAction<string>) => setConfirmPassword(userPassword)}
/>
<Text disable={problemDisabled} style={displayProblem(problemDisabled)}>Could not create wallet</Text>
<Text disable={passwordsMatch} style={displayProblem(passwordsMatch)}>Passwords do not match</Text>
<Text disable={passwordAlpha} style={displayProblem(passwordAlpha)}>Password does not contain letters</Text>
<Text disable={passwordNumeric} style={displayProblem(passwordNumeric)}>Password does not contain
numbers</Text>
<Text disable={passwordLongEnough} style={displayProblem(passwordLongEnough)}>Password is not at least 8
characters</Text>
{errorText}
<FormButton
disabled={!(passwordsMatch && passwordAlpha && passwordNumeric && passwordLongEnough)}
title="Create Wallet"
Expand Down
8 changes: 7 additions & 1 deletion src/screens/CredentialDetailScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export default function CredentialDetailScreen({route, navigation}: CompositeScr
setCred(route.params.cred)
}, []);

function getCredPart(field: string) {
const c = decodeCredential(cred.verifiedCredential.encodedSignedCredential)
const cObj = c.credentialSubject
return utils.getObjectField(cObj,field)
}

async function updateVerification() {
const wal = wallet.getWallet(roots.TEST_WALLET_NAME)
if (wal) {
Expand Down Expand Up @@ -98,7 +104,7 @@ export default function CredentialDetailScreen({route, navigation}: CompositeScr
keyExtractor={(item) => item}
ItemSeparatorComponent={() => <Divider/>}
renderItem={({item}) => {
const output = utils.recursivePrint(decodeCredential(cred.verifiedCredential.encodedSignedCredential).credentialSubject[item])
const output = utils.recursivePrint(getCredPart(item))
console.log(item, ": ", output)
return <ScrollView style={styles.scrollableModal}><Text style={{color: "black"}}>{item + ": " + output}</Text></ScrollView>
}}
Expand Down
6 changes: 2 additions & 4 deletions src/store/AsyncStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,12 @@ export async function removeItem(key: string) {
}

export async function status() {
let keys: string[] = []
try {
keys = await AsyncStorage.getAllKeys()
const keys = await AsyncStorage.getAllKeys()
logger("AsyncStore - keys:",keys)
} catch(e) {
console.error("AsyncStore - Could not get async store status,",e)
}

logger("AsyncStore - keys:",keys)
}

export async function storeItem(alias: string, item: string, saveHistory: boolean=false) {
Expand Down
13 changes: 13 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
import {displayProblem} from "../styles/styles";
import {Text} from "react-native";
import React from "react";
import {decodeCredential} from "../credentials";

export function getObjectField(obj: object, field: string) {
for (const [key, value] of Object.entries(obj)) {
if(key === field) {
return value;
}
}
}

export function replaceSpecial(alias: string) {
return alias.replace(/[&\/\\#, +()$~%.'":*?<>{}]/g, '_');
}
Expand Down
Loading

0 comments on commit 3789a51

Please sign in to comment.