@ -27,7 +27,7 @@
< / span >
< input
type = "text"
placeholder = "DID, Name, Public Key"
placeholder = "DID, Name, Public Key (base 16 or 64) "
class = "block w-full rounded-l border border-r-0 border-slate-400 px-3 py-2"
v - model = "contactInput"
/ >
@ -110,48 +110,50 @@
< / div >
< div id = "ContactActions" class = "flex gap-1.5 mt-2" >
< button
v - if = "contact.seesMe"
class = "text-sm uppercase bg-slate-500 text-white px-2 py-1.5 rounded-md"
@ click = "setVisibility(contact, false, true)"
title = "They can see you"
>
< fa icon = "eye" class = "fa-fw" / >
< / button >
< button
v - else
class = "text-sm uppercase bg-slate-500 text-white px-2 py-1.5 rounded-md"
@ click = "setVisibility(contact, true, true)"
title = "They cannot see you"
>
< fa icon = "eye-slash" class = "fa-fw" / >
< / button >
< button
class = "text-sm uppercase bg-slate-500 text-white px-2 py-1.5 rounded-md"
@ click = "checkVisibility(contact)"
title = "Check Visibility"
>
< fa icon = "rotate" class = "fa-fw" / >
< / button >
< button
@ click = "register(contact)"
class = "text-sm uppercase bg-slate-500 text-white ml-6 px-2 py-1.5 rounded-md"
>
< fa
v - if = "contact.registered"
icon = "person-circle-check"
class = "fa-fw"
title = "Registered"
/ >
< fa
< div v-if ="activeDid" >
< button
v - if = "contact.seesMe"
class = "text-sm uppercase bg-slate-500 text-white px-2 py-1.5 rounded-md"
@ click = "setVisibility(contact, false, true)"
title = "They can see you"
>
< fa icon = "eye" class = "fa-fw" / >
< / button >
< button
v - else
icon = "person-circle-question"
class = "fa-fw"
title = "Registration Unknown"
/ >
< / button >
class = "text-sm uppercase bg-slate-500 text-white px-2 py-1.5 rounded-md"
@ click = "setVisibility(contact, true, true)"
title = "They cannot see you"
>
< fa icon = "eye-slash" class = "fa-fw" / >
< / button >
< button
class = "text-sm uppercase bg-slate-500 text-white px-2 py-1.5 rounded-md"
@ click = "checkVisibility(contact)"
title = "Check Visibility"
v - if = "activeDid"
>
< fa icon = "rotate" class = "fa-fw" / >
< / button >
< button
@ click = "register(contact)"
class = "text-sm uppercase bg-slate-500 text-white ml-6 px-2 py-1.5 rounded-md"
v - if = "activeDid"
>
< fa
v - if = "contact.registered"
icon = "person-circle-check"
class = "fa-fw"
title = "Registered"
/ >
< fa
v - else
icon = "person-circle-question"
class = "fa-fw"
title = "Registration Unknown"
/ >
< / button >
< / div >
< button
@ click = "deleteContact(contact)"
@ -263,6 +265,7 @@ import {
SimpleSigner ,
} from "@/libs/crypto" ;
import {
CONTACT_URL_PREFIX ,
GiveServerRecord ,
GiveVerifiableCredential ,
RegisterVerifiableCredential ,
@ -303,6 +306,7 @@ export default class ContactsView extends Vue {
givenToMeUnconfirmed : Record < string , number > = { } ;
hourDescriptionInput = "" ;
hourInput = "0" ;
isRegistered = false ;
showGiveNumbers = false ;
showGiveTotals = true ;
showGiveConfirmed = true ;
@ -312,6 +316,7 @@ export default class ContactsView extends Vue {
const settings = ( await db . settings . get ( MASTER_SETTINGS_KEY ) ) as Settings ;
this . activeDid = settings ? . activeDid || "" ;
this . apiServer = settings ? . apiServer || "" ;
this . isRegistered = ! ! settings ? . isRegistered ;
this . showGiveNumbers = ! ! settings ? . showContactGivesInline ;
if ( this . showGiveNumbers ) {
@ -475,6 +480,12 @@ export default class ContactsView extends Vue {
) ;
return ;
}
if ( this . contactInput . startsWith ( CONTACT_URL_PREFIX ) ) {
await this . newContactFromScan ( this . contactInput ) ;
return ;
}
let did = this . contactInput ;
let name , publicKeyBase64 ;
const commaPos1 = this . contactInput . indexOf ( "," ) ;
@ -493,7 +504,7 @@ export default class ContactsView extends Vue {
publicKeyBase64 = Buffer . from ( publicKeyBase64 , "hex" ) . toString ( "base64" ) ;
}
const newContact = { did , name , publicKeyBase64 } ;
return this . addContact ( newContact ) ;
await this . addContact ( newContact ) ;
}
async newContactFromScan ( url : string ) : Promise < void > {
@ -540,31 +551,39 @@ export default class ContactsView extends Vue {
( a : Contact , b ) => ( a . name || "" ) . localeCompare ( b . name || "" ) ,
allContacts ,
) ;
this . setVisibility ( newContact , true , false ) ;
let addedMessage ;
if ( this . activeDid ) {
this . setVisibility ( newContact , true , false ) ;
addedMessage =
newContact . name +
" was added, and your activity is visible to them." ;
} else {
addedMessage = newContact . name + " was added." ;
}
this . $notify (
{
group : "alert" ,
type : "success" ,
title : "Contact Added" ,
text :
newContact . name +
" was added, and your activity is visible to them." ,
text : addedMessage ,
} ,
- 1 ,
) ;
/ / p u t t i n g t h i s l a s t s o t h a t i t s h o w s o n t h e t o p
this . $notify (
{
group : "alert" ,
type : "info" ,
title : "New User?" ,
text :
"If " +
newContact . name +
" is a new user, be sure to register them." ,
} ,
- 1 ,
5000 ,
) ;
if ( this . isRegistered ) {
/ / p u t t i n g t h i s l a s t s o t h a t i t s h o w s o n t h e t o p
this . $notify (
{
group : "alert" ,
type : "info" ,
title : "New User?" ,
text :
"If " +
newContact . name +
" is a new user, be sure to register them." ,
} ,
- 1 ,
) ;
}
} )
. catch ( ( err ) => {
console . error ( "Error when adding contact to storage:" , err ) ;