diff --git a/src/components/LogoTitle.js b/src/components/LogoTitle.js index e637766..bea31f2 100644 --- a/src/components/LogoTitle.js +++ b/src/components/LogoTitle.js @@ -10,7 +10,7 @@ export default function LogoTitle(...props) { source={require('../assets/LogoOnly1024.png')} /> - {props[0]["title"].substring(0,11)+"..."} + {props[0]["title"]} ); diff --git a/src/components/SimpleTitle.js b/src/components/SimpleTitle.js deleted file mode 100644 index 04786ac..0000000 --- a/src/components/SimpleTitle.js +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react'; -import { Image, StyleSheet, Text, View } from 'react-native'; - -export default function SimpleTitle(...props) { -// - return ( - - - {props[0]["title"].substring(0,11)+"..."} - - - ); -} diff --git a/src/navigation/AuthStack.js b/src/navigation/AuthStack.js index 00d73df..7c4efd1 100644 --- a/src/navigation/AuthStack.js +++ b/src/navigation/AuthStack.js @@ -20,7 +20,6 @@ import HomeScreen from "../screens/HomeScreen" import MyIdentityScreen from '../screens/MyIdentityScreen'; import RelationshipsScreen from "../screens/RelationshipsScreen"; import SettingsScreen from "../screens/SettingsScreen"; -import SimpleTitle from '../components/SimpleTitle'; import WalletScreen from "../screens/WalletScreen"; import AuthContext from '../context/AuthenticationContext'; @@ -155,7 +154,7 @@ export default function AuthStack() { name="Chat" component={ChatScreen} options={ ({ navigation, route }) => ({ - headerTitle: (props) => , + headerTitle: (props) => , headerRight: (props) => , })} /> @@ -194,7 +193,7 @@ export default function AuthStack() { name="Chat" component={ChatScreen} options={ ({ navigation, route }) => ({ - headerTitle: (props) => , + headerTitle: (props) => , headerRight: (props) => , })} /> diff --git a/src/roots/index.ts b/src/roots/index.ts index 40ee711..c2e6de2 100644 --- a/src/roots/index.ts +++ b/src/roots/index.ts @@ -15,7 +15,6 @@ export const DID_MSG_TYPE = "didMsgType"; export const PENDING_STATUS_MESSAGE = "rootsPendingStatus"; export const PROMPT_ACCEPT_CREDENTIAL_MSG_TYPE = "rootsAcceptCredentialMsgType" export const PROMPT_OWN_CREDENTIAL_MSG_TYPE = "rootsOwnCredentialMsgType" -export const PROMPT_OWN_DID_MSG_TYPE = "rootsOwnDidMsgType" export const PROMPT_PUBLISH_MSG_TYPE = "rootsPromptPublishMsgType"; export const QR_CODE_MSG_TYPE = "rootsQRCodeMsgType" export const STATUS_MSG_TYPE = "statusMsgType"; @@ -79,7 +78,7 @@ export async function initRootsWallet() { const createdDidMsg = await sendMessage(achChat, "You created your first decentralized ID!", TEXT_MSG_TYPE,rel.getRelItem(rel.ROOTS_BOT)) - await sendMessage(achChat,"Add your DID to Prism so that you can receive verifiable credentials (called VCs) from other users and organizations like Catalyst, your school, rental companies, etc.", + await sendMessage(achChat,"Add your DID to PRISM so that you can receive verifiable credentials (called VCs) from other users and organizations like the library, your school, rental companies, etc.", PROMPT_PUBLISH_MSG_TYPE,rel.getRelItem(rel.PRISM_BOT)) if(demo) { @@ -150,7 +149,6 @@ function getSettingAlias(key) { export async function loadSettings() { const settings = await loadItems(allSettingsRegex) - applyAppSettings(); return settings; } @@ -532,13 +530,6 @@ export function getMessagesByChat(chatAlias: string) { return chatMsgs; } -export function getMessageById(msgId: string) { - logger("roots - getting message by id",msgId) - const msgJson = store.getItem(msgId) - const msg = JSON.parse(msgJson) - return msg -} - export function getMessagesByRel(relId: string) { logger("roots - getting message items by user",relId) // /rootsMsgType*did:prism:rootsbot1*/ @@ -593,18 +584,11 @@ function addQuickReply(msg) { ], } } - if(msg.type === PROMPT_OWN_DID_MSG_TYPE) { - msg["quickReplies"] = { - type: 'checkbox', - keepIt: true, - values: [ - { - title: 'Show QR code', - value: PROMPT_OWN_DID_MSG_TYPE, - messageId: msg.id, - }] - } - } +// { +// title: 'Keep private', +// value: PROMPT_PUBLISH_MSG_TYPE+DO_NOT_PUBLISH_DID, +// messageId: msg.id, +// } if(msg.type === PROMPT_ACCEPT_CREDENTIAL_MSG_TYPE) { msg["quickReplies"] = { type: 'checkbox', @@ -617,6 +601,11 @@ function addQuickReply(msg) { ], } } +// { +// title: 'Reject', +// value: PROMPT_ACCEPT_CREDENTIAL_MSG_TYPE+CRED_REJECTED, +// messageId: msg.id, +// } if(msg.type === PROMPT_OWN_CREDENTIAL_MSG_TYPE) { msg["quickReplies"] = { type: 'checkbox', @@ -671,7 +660,7 @@ export async function processPublishResponse(chat: Object, reply: Reply) { const pubDid = getDid(chat.fromAlias) const didPubTx = getDidPubTx(pubDid[walletSchema.DID_ALIAS]) const didPubMsg = await sendMessage(pubChat,PUBLISHED_TO_PRISM, - PROMPT_OWN_DID_MSG_TYPE,rel.getRelItem(rel.PRISM_BOT),false,pubDid[walletSchema.DID_URI_LONG_FORM]) + DID_MSG_TYPE,rel.getRelItem(rel.PRISM_BOT),false,pubDid[walletSchema.DID_URI_LONG_FORM]) const didLinkMsg = await sendMessage(pubChat,BLOCKCHAIN_URL_MSG, BLOCKCHAIN_URL_MSG_TYPE,rel.getRelItem(rel.PRISM_BOT),false,didPubTx.url) if(didLinkMsg) { @@ -714,7 +703,7 @@ export async function processPublishResponse(chat: Object, reply: Reply) { } else { logger("roots - Could not process quick reply to publish chat",chat.id) const credReqMsg = await sendMessage(chat, - "DID was already added to Prism", + "DID was already added to PRISM", TEXT_MSG_TYPE,rel.getRelItem(rel.PRISM_BOT)) return chat; } diff --git a/src/screens/ChatScreen.js b/src/screens/ChatScreen.js index 433b7b9..4bc8438 100644 --- a/src/screens/ChatScreen.js +++ b/src/screens/ChatScreen.js @@ -176,11 +176,6 @@ export default function ChatScreen({ route, navigation }) { } else { console.log("ChatScreen - not publishing DID") } - } else if(reply.value.startsWith(roots.PROMPT_OWN_DID_MSG_TYPE)) { - console.log("ChatScreen - quick reply view did") - const longDid = roots.getMessageById(reply.messageId).data - console.log("View did",longDid); - showQR(longDid) } else if(reply.value.startsWith(roots.PROMPT_ACCEPT_CREDENTIAL_MSG_TYPE)) { console.log("ChatScreen - process quick reply for accepting credential") const res = await roots.processCredentialResponse(chat,reply) @@ -398,32 +393,11 @@ export default function ChatScreen({ route, navigation }) { onPress={ (context, message) => processBubbleClick(context,message)} onQuickReply={reply => handleQuickReply(reply)} onSend={messages => handleSend(messages)} -// onPress: (tag) => setShowSystem(!showSystem), -// { -// pattern: /Your DID was added to Prism/, -// style: styles.prism, -// onPress: (tag) => setShowSystem(!showSystem), -// }, parsePatterns={(linkStyle) => [ - { - pattern: /RootsWallet/, - style: styles.rootswallet, - onPress: (tag) => console.log("Pressed RootsWallet"), - }, - { - pattern: /Cardano/, - style: styles.cardano, - onPress: (tag) => console.log("Pressed Cardano"), - }, - { - pattern: /Prism/, - style: styles.prism, - onPress: (tag) => console.log("Pressed Prism"), - }, { pattern: /Your DID was added to Prism/, style: styles.prism, - onPress: (tag) => console.log("Pressed DID added message"), + onPress: (tag) => setShowSystem(!showSystem), }, { pattern: /Show Chat QR code/, diff --git a/src/screens/CreateRelScreen.js b/src/screens/CreateRelScreen.js index b80d34f..e2eb9e6 100644 --- a/src/screens/CreateRelScreen.js +++ b/src/screens/CreateRelScreen.js @@ -10,8 +10,8 @@ import FormInput from '../components/FormInput'; const { PrismModule } = NativeModules; -export default function CreateRelScreen({ route, navigation }) { - const [relDid, setRelDid] = useState(route.params.did); +export default function CreateRelScreen({ navigation }) { + const [relDid, setRelDid] = useState('did:prism:'+Date.now()); const [relName, setRelName] = useState(''); const [problemDisabled, setProblemDisabled] = useState(true) diff --git a/src/screens/ScanQRCodeScreen.js b/src/screens/ScanQRCodeScreen.js index 452f4b7..c6f8824 100644 --- a/src/screens/ScanQRCodeScreen.js +++ b/src/screens/ScanQRCodeScreen.js @@ -32,8 +32,7 @@ export default function ScanQRCodeScreen({ route, navigation }) { const handleBarCodeScanned = ({ type, data }) => { setScanned(true); - navigation.navigate('Create Rel', { did: data }) - //alert(`Bar code with type ${type} and data ${data} has been scanned!`); + alert(`Bar code with type ${type} and data ${data} has been scanned!`); }; if (hasPermission === null) { diff --git a/src/styles/styles.js b/src/styles/styles.js index a6afbe3..b1bdfbb 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -1,6 +1,35 @@ import {StyleSheet} from "react-native"; const styles = StyleSheet.create({ + walletIconStyle: { + fontSize: 24, + color: 'blue', + alignSelf: 'center', + marginHorizontal: 5, + marginVertical: 20 + }, + walletInputStyle: { + flex: 1, + flexDirection: 'row', + marginHorizontal: 15, + height: 50, + backgroundColor: '#F0EEEE' + }, + inputStyle: { + flex: 1, + // autoCorrect: false, + // autoComplete: 'off', + // autoCapitalize: 'none', + padding: 10, + borderWidth: 1, + borderColor: 'black', + marginHorizontal: 15, + marginVertical: 20, + borderRadius: 5, + backgroundColor: 'pink', + alignSelf: 'center' + + }, button:{ width: 150, borderRadius: 10, @@ -15,9 +44,6 @@ const styles = StyleSheet.create({ alignSelf: 'center' }, - cardano: { - color: '#1c04ba' - }, clickableListTitle: { fontSize: 22, color: '#e69138', @@ -47,30 +73,6 @@ const styles = StyleSheet.create({ alignSelf: "flex-start", justifyContent: "flex-start" }, - highlightedItem: { - fontSize: 18, - fontWeight: "bold" - }, - inputStyle: { - flex: 1, - // autoCorrect: false, - // autoComplete: 'off', - // autoCapitalize: 'none', - padding: 10, - borderWidth: 1, - borderColor: 'black', - marginHorizontal: 15, - marginVertical: 20, - borderRadius: 5, - backgroundColor: 'pink', - alignSelf: 'center' - }, - item: { - backgroundColor: '#20190e', - padding: 20, - marginVertical: 8, - marginHorizontal: 16, - }, leftheader: { color: '#999999', fontSize: 20, @@ -80,6 +82,17 @@ const styles = StyleSheet.create({ justifyContent: "flex-start" }, + text: { + fontSize: 30, + }, + titleText: { + fontSize: 24, + marginBottom: 10, + color: '#eeeeee', + fontWeight: 'normal', + textAlignVertical: "center", + textAlign: "center", + }, listItem: { fontSize: 18, color: '#eeeeee', @@ -92,8 +105,15 @@ const styles = StyleSheet.create({ fontSize: 16, color: '#dddddd', }, - loginButtonLabel: { - fontSize: 22, + item: { + backgroundColor: '#20190e', + padding: 20, + marginVertical: 8, + marginHorizontal: 16, + }, + highlightedItem: { + fontSize: 18, + fontWeight: "bold" }, modalContainer: { backgroundColor: '#251520', @@ -101,6 +121,9 @@ const styles = StyleSheet.create({ justifyContent: 'center', alignItems: 'center', }, + loginButtonLabel: { + fontSize: 22, + }, navButtonText: { fontSize: 16, }, @@ -114,10 +137,7 @@ const styles = StyleSheet.create({ problem: { color: 'red', }, - rootsWallet: { - color: '#e69138' - }, - row: { + row: { flexDirection: "row", flexWrap: "wrap", }, @@ -129,31 +149,6 @@ const styles = StyleSheet.create({ alignSelf: "flex-start", justifyContent: "flex-start" }, - text: { - fontSize: 30, - }, - titleText: { - fontSize: 24, - marginBottom: 10, - color: '#eeeeee', - fontWeight: 'normal', - textAlignVertical: "center", - textAlign: "center", - }, - walletIconStyle: { - fontSize: 24, - color: 'blue', - alignSelf: 'center', - marginHorizontal: 5, - marginVertical: 20 - }, - walletInputStyle: { - flex: 1, - flexDirection: 'row', - marginHorizontal: 15, - height: 50, - backgroundColor: '#F0EEEE' - }, }) export default styles \ No newline at end of file