Skip to content

Commit

Permalink
Revert "61 create rel from scanned did (#62)"
Browse files Browse the repository at this point in the history
This reverts commit 87bbcb6.
  • Loading branch information
2byrds authored Jun 30, 2022
1 parent bad0955 commit 6c6884e
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 130 deletions.
2 changes: 1 addition & 1 deletion src/components/LogoTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function LogoTitle(...props) {
source={require('../assets/LogoOnly1024.png')}
/>
<Text style={{ color: '#eeeeee',fontSize: 22,fontWeight: 'normal',textAlignVertical: "center",textAlign: "center", }}>
{props[0]["title"].substring(0,11)+"..."}
{props[0]["title"]}
</Text>
</View>
);
Expand Down
13 changes: 0 additions & 13 deletions src/components/SimpleTitle.js

This file was deleted.

5 changes: 2 additions & 3 deletions src/navigation/AuthStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -155,7 +154,7 @@ export default function AuthStack() {
name="Chat"
component={ChatScreen}
options={ ({ navigation, route }) => ({
headerTitle: (props) => <SimpleTitle {...props} title={getChatItem(route.params.chatId).title}/>,
headerTitle: (props) => <LogoTitle {...props} title={getChatItem(route.params.chatId).title}/>,
headerRight: (props) => <IconActions {...props} nav={navigation} add="Add Rel" scan='Scan QR Code' settings='Settings'/>,
})}
/>
Expand Down Expand Up @@ -194,7 +193,7 @@ export default function AuthStack() {
name="Chat"
component={ChatScreen}
options={ ({ navigation, route }) => ({
headerTitle: (props) => <SimpleTitle {...props} title={getChatItem(route.params.chatId).title}/>,
headerTitle: (props) => <LogoTitle {...props} title={getChatItem(route.params.chatId).title}/>,
headerRight: (props) => <IconActions {...props} nav={navigation} add="Add Rel" scan='Scan QR Code'/>,
})}
/>
Expand Down
37 changes: 13 additions & 24 deletions src/roots/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -150,7 +149,6 @@ function getSettingAlias(key) {

export async function loadSettings() {
const settings = await loadItems(allSettingsRegex)
applyAppSettings();
return settings;
}

Expand Down Expand Up @@ -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*/
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down
28 changes: 1 addition & 27 deletions src/screens/ChatScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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/,
Expand Down
4 changes: 2 additions & 2 deletions src/screens/CreateRelScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 1 addition & 2 deletions src/screens/ScanQRCodeScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
111 changes: 53 additions & 58 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -15,9 +44,6 @@ const styles = StyleSheet.create({
alignSelf: 'center'

},
cardano: {
color: '#1c04ba'
},
clickableListTitle: {
fontSize: 22,
color: '#e69138',
Expand Down Expand Up @@ -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,
Expand All @@ -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',
Expand All @@ -92,15 +105,25 @@ 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',
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
loginButtonLabel: {
fontSize: 22,
},
navButtonText: {
fontSize: 16,
},
Expand All @@ -114,10 +137,7 @@ const styles = StyleSheet.create({
problem: {
color: 'red',
},
rootsWallet: {
color: '#e69138'
},
row: {
row: {
flexDirection: "row",
flexWrap: "wrap",
},
Expand All @@ -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

0 comments on commit 6c6884e

Please sign in to comment.