Skip to content

Commit

Permalink
59 display wal lib transactions (#60)
Browse files Browse the repository at this point in the history
* preparing for separate phone exchanging barcodes

* some look and feel updates

* settings screen w/ host choice

* settings persist and reload.  beginning to create Rels

Co-authored-by: 2byrds <[email protected]>
  • Loading branch information
2byrds and 2byrds authored May 14, 2022
1 parent b14be3b commit 06e2879
Show file tree
Hide file tree
Showing 29 changed files with 429 additions and 233 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ dependencies {
} else {
implementation jscFlavor
}
implementation("com.rootsid.wal:wal-library:1.0.2-LANCE") {
implementation("com.rootsid.wal:wal-library:1.0.1-SNAPSHOT") {
exclude group: 'io.github.vincenzopalazzo', module: 'material-ui-swing'
exclude group: 'javax.annotation', module: 'jsr250-api'
exclude group: 'org.didcommx', module: 'didcomm'
Expand Down
25 changes: 16 additions & 9 deletions android/app/src/main/java/com/rootswallet/PrismModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,24 @@ class PrismModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
}

@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()
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(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
Binary file modified android/app/src/main/res/drawable-hdpi/splashscreen_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-mdpi/splashscreen_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xhdpi/splashscreen_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"splash": {
"image": "./src/assets/WhiteTextExtraGlow.png",
"resizeMode": "contain",
"backgroundColor": "#111111"
"backgroundColor": "#000000"
},
"updates": {
"enabled": true,
Expand All @@ -26,7 +26,7 @@
"adaptiveIcon": {

"foregroundImage": "./src/assets/LogoOnly1024.png",
"backgroundColor": "#111111"
"backgroundColor": "#000000"
},
"package": "com.rootswallet"
},
Expand Down
Binary file modified assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@babel/preset-env": "^7.1.6",
"@react-native-async-storage/async-storage": "~1.15.0",
"@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",
Expand Down Expand Up @@ -37,6 +38,7 @@
"react-native": "0.64.3",
"react-native-gesture-handler": "~2.1.0",
"react-native-gifted-chat": "1.0.0-beta-3",
"react-native-hyperlink": "^0.0.19",
"react-native-localize": "^2.1.7",
"react-native-paper": "^4.12.1",
"react-native-qrcode-svg": "^6.1.2",
Expand All @@ -58,5 +60,5 @@
},
"private": true,
"name": "rootswallet",
"version": "1.0.0"
"version": "0.0.1-alpha"
}
Binary file removed src/assets/adaptive-icon.png
Binary file not shown.
Binary file modified src/assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/components/IconActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default function IconActions(...props) {
const navigation = props[0]["nav"]
const add = props[0]["add"]
const scan = props[0]["scan"]
const settings = props[0]["settings"]
return (
<View style={{flexDirection:'row',}}>
<IconButton
Expand All @@ -21,6 +22,12 @@ export default function IconActions(...props) {
color="#e69138"
onPress={() => navigation.navigate(scan)}
/>
<IconButton
icon="cog-outline"
size={28}
color="#e69138"
onPress={() => navigation.navigate(settings)}
/>
</View>
)
}
2 changes: 1 addition & 1 deletion src/components/LogoTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function LogoTitle(...props) {
style={{ width: 50, height: 50 }}
source={require('../assets/LogoOnly1024.png')}
/>
<Text style={{ color: '#ff9138',fontSize: 22,fontWeight: 'normal',textAlignVertical: "center",textAlign: "center", }}>
<Text style={{ color: '#eeeeee',fontSize: 22,fontWeight: 'normal',textAlignVertical: "center",textAlign: "center", }}>
{props[0]["title"]}
</Text>
</View>
Expand Down
7 changes: 4 additions & 3 deletions src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ const ID_SEPARATOR = "_"

//these types must be unique enough to use in regex without conflict
export const MODEL_TYPE_CHAT = "rootsChatType"
export const MODEL_TYPE_MESSAGE = "rootsMsgType"
export const MODEL_TYPE_CREDENTIAL = "rootsCredentialType"
export const MODEL_TYPE_CRED_REQUEST = "rootsCredRequestType"
export const MODEL_TYPE_MESSAGE = "rootsMsgType"
export const MODEL_TYPE_REL = "rootsRelType"
export const MODEL_TYPE_SETTING = "rootsSettingType"

//TODO refactor away this general file to specific files, like 'chat'

Expand All @@ -24,15 +25,15 @@ export function createChat(chatAlias: string, fromDidAlias: string, toIds: strin
return chat;
}

export function createMessage(idText: string,bodyText: string,statusText: string,timeInMillis: number,relId: string,system?: boolean=false,cred?: Object=undefined) {
export function createMessage(idText: string,bodyText: string,statusText: string,timeInMillis: number,relId: string,system?: boolean=false,data?: Object=undefined) {
const msg = {
id: idText,
body: bodyText,
type: statusText,
createdTime: timeInMillis,
rel: relId,
system: system,
cred: cred,
data: data,
}
logger("models - created msg model w/keys",Object.keys(msg))
return msg;
Expand Down
31 changes: 18 additions & 13 deletions src/navigation/AuthStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import ScanQRCodeScreen from '../screens/ScanQRCodeScreen'
import ShowQRCodeScreen from '../screens/ShowQRCodeScreen'
import StartChatScreen from '../screens/StartChatScreen';

import { getChatItem, getRootsWallet, storageStatus, hasWallet, TEST_WALLET_NAME } from '../roots'
import { getChatItem, getRootsWallet, storageStatus,
hasWallet, loadSettings, TEST_WALLET_NAME } from '../roots'

const Stack = createStackNavigator();
const Tab = createBottomTabNavigator()
Expand Down Expand Up @@ -75,16 +76,19 @@ export default function AuthStack() {
try {
console.log("AuthStack - getting RootsWallet")
await storageStatus()
//TODO ditch test wallet name
const walFound = await hasWallet(walletName)
console.log("AuthStack - wallet found?",walFound)
setWalletFound(walFound)
if(walFound) {
//TODO ditch test wallet name
console.log("AuthStack - since wallet found, getting rootsWallet")
userToken = getRootsWallet(walletName)
} else {
console.log("AuthStack - since wallet NOT found, auth token not set")
const settingsLoaded = await loadSettings()
if(settingsLoaded) {
//TODO ditch test wallet name
const walFound = await hasWallet(walletName)
console.log("AuthStack - wallet found?",walFound)
setWalletFound(walFound)
if(walFound) {
//TODO ditch test wallet name
console.log("AuthStack - since wallet found, getting rootsWallet")
userToken = getRootsWallet(walletName)
} else {
console.log("AuthStack - since wallet NOT found, auth token not set")
}
}
} catch (e) {
// Restoring token failed
Expand Down Expand Up @@ -143,15 +147,15 @@ export default function AuthStack() {
initialParams={{walletName: walletName}}
options={ ({ navigation, route }) => ({
headerTitle: (props) => <LogoTitle {...props} title="Relationships:"/>,
headerRight: (props) => <IconActions {...props} nav={navigation} add="Create Rel" scan='Scan QR Code'/>,
headerRight: (props) => <IconActions {...props} nav={navigation} add="Create Rel" scan='Scan QR Code' settings='Settings'/>,
})}
/>
<Stack.Screen
name="Chat"
component={ChatScreen}
options={ ({ navigation, route }) => ({
headerTitle: (props) => <LogoTitle {...props} title={getChatItem(route.params.chatId).title}/>,
headerRight: (props) => <IconActions {...props} nav={navigation} add="Add Rel" scan='Scan QR Code'/>,
headerRight: (props) => <IconActions {...props} nav={navigation} add="Add Rel" scan='Scan QR Code' settings='Settings'/>,
})}
/>
</Stack.Group>
Expand Down Expand Up @@ -255,6 +259,7 @@ export default function AuthStack() {
<Stack.Screen name="Help" component={HelpScreen}/>
<Stack.Screen name="Create Rel" component={CreateRelScreen}/>
<Stack.Screen name="Create Secure Chat" component={StartChatScreen} />
<Stack.Screen name="Settings" component={SettingsScreen}/>
<Stack.Screen name="Show QR Code" component={ShowQRCodeScreen} />
<Stack.Screen name="Scan QR Code" component={ScanQRCodeScreen} />
<Stack.Screen name="Relationship Details" component={RelationshipDetailScreen}/>
Expand Down
32 changes: 16 additions & 16 deletions src/relationships/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export const rootsLogo = rwLogo;
export const starLogo = starPng;

export const YOU_ALIAS = "You"
export const ROOTS_BOT = "RootsWallet Bot";
export const PRISM_BOT = "Prism Bot";

export const ROOTS_BOT = "rootsbot1";
export const PRISM_BOT = "prismbot1";
export const LIBRARY_BOT = "did:prism:librarybot1";
const IOG_TECH = "did:prism:iogtech1";
const ROOTSID = "did:prism:rootsid";
Expand Down Expand Up @@ -85,17 +85,17 @@ export function getRelItem(relId) {
}
}

export async function initDemoRels() {
logger("rels - init demo rels")
await createRelItem(ROOTS_BOT,"RootsWallet",rootsLogo,ROOTS_BOT)
await createRelItem(PRISM_BOT,"Atala Prism",prismLogo,PRISM_BOT)
await createRelItem(LIBRARY_BOT,"Library",personLogo,LIBRARY_BOT)
await createRelItem(IOG_TECH, "IOG Tech Community",iogLogo,IOG_TECH);
await createRelItem(ROOTSID, "RootsID",rootsLogo,ROOTSID);
await createRelItem(LANCE, "MeGrimLance",lanceLogo,LANCE);
await createRelItem(TONY,"Tony.Rose",tonyLogo,TONY)
await createRelItem(DARRELL,"Darrell O'Donnell",darrellLogo,DARRELL)
await createRelItem(BUTCH,"Butch Clark",butchLogo,BUTCH)
await createRelItem(ESTEBAN,"Esteban Garcia",estebanLogo,ESTEBAN)
await createRelItem(RODO,"Rodolfo Miranda",rodoLogo,RODO)
}
// export async function initDemoRels() {
// logger("rels - init demo rels")
// await createRelItem(ROOTS_BOT,"RootsWallet",rootsLogo,ROOTS_BOT)
// await createRelItem(PRISM_BOT,"Atala Prism",prismLogo,PRISM_BOT)
// await createRelItem(LIBRARY_BOT,"Library",personLogo,LIBRARY_BOT)
// await createRelItem(IOG_TECH, "IOG Tech Community",iogLogo,IOG_TECH);
// await createRelItem(ROOTSID, "RootsID",rootsLogo,ROOTSID);
// await createRelItem(LANCE, "MeGrimLance",lanceLogo,LANCE);
// await createRelItem(TONY,"Tony.Rose",tonyLogo,TONY)
// await createRelItem(DARRELL,"Darrell O'Donnell",darrellLogo,DARRELL)
// await createRelItem(BUTCH,"Butch Clark",butchLogo,BUTCH)
// await createRelItem(ESTEBAN,"Esteban Garcia",estebanLogo,ESTEBAN)
// await createRelItem(RODO,"Rodolfo Miranda",rodoLogo,RODO)
// }
Loading

0 comments on commit 06e2879

Please sign in to comment.