mirror of
https://github.com/balzack/databag.git
synced 2025-03-13 09:00:06 +00:00
adding helper function for contact connect, styling text inputs in mobile app
Some checks are pending
CI / CI (push) Waiting to run
Some checks are pending
CI / CI (push) Waiting to run
This commit is contained in:
parent
869b3be540
commit
50eed2cbe5
@ -26,7 +26,7 @@
|
||||
"@types/react-native": "^0.73.0",
|
||||
"@types/react-native-video": "^5.0.20",
|
||||
"crypto-js": "^3.3.0",
|
||||
"databag-client-sdk": "^0.0.25",
|
||||
"databag-client-sdk": "^0.0.30",
|
||||
"jsencrypt": "^3.3.2",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
|
@ -42,7 +42,9 @@ export function Contacts({openRegistry, openContact, callContact, textContact}:
|
||||
style={styles.input}
|
||||
outlineColor="transparent"
|
||||
activeOutlineColor="transparent"
|
||||
autoCapitalize={false}
|
||||
autoCapitalize="none"
|
||||
autoComplete="off"
|
||||
autoCorrect={false}
|
||||
underlineStyle={styles.inputUnderline}
|
||||
mode="outlined"
|
||||
placeholder={state.strings.contacts}
|
||||
|
@ -96,7 +96,9 @@ export function Content({share, closeAll, openConversation, textCard}: { share:
|
||||
<TextInput
|
||||
dense={true}
|
||||
style={styles.input}
|
||||
autoCapitalize={false}
|
||||
autoCapitalize="none"
|
||||
autoComplete="off"
|
||||
autoCorrect={false}
|
||||
unserlineStyle={styles.inputUnderline}
|
||||
outlineColor="transparent"
|
||||
activeOutlineColor="transparent"
|
||||
|
@ -126,8 +126,7 @@ export function useProfile(params: ContactParams) {
|
||||
},
|
||||
saveAndConnect: async () => {
|
||||
const contact = app.state.session?.getContact();
|
||||
const added = await contact.addCard(state.node, state.guid);
|
||||
await contact.connectCard(added);
|
||||
const added = await contact.addAndConnectCard(state.node, state.guid);
|
||||
},
|
||||
remove: async () => {
|
||||
const contact = app.state.session?.getContact();
|
||||
|
@ -18,7 +18,9 @@ export function Registry({close, openContact}: {close?: () => void; openContact:
|
||||
<TextInput
|
||||
dense={true}
|
||||
style={styles.input}
|
||||
autoCapitalize={false}
|
||||
autoCapitalize="none"
|
||||
autoComplete="off"
|
||||
autoCorrect={false}
|
||||
outlineColor="transparent"
|
||||
activeOutlineColor="transparent"
|
||||
underlineStyle={styles.inputUnderline}
|
||||
@ -33,7 +35,9 @@ export function Registry({close, openContact}: {close?: () => void; openContact:
|
||||
<TextInput
|
||||
dense={true}
|
||||
style={styles.input}
|
||||
autoCapitalize={false}
|
||||
autoCapitalize="none"
|
||||
autoComplete="off"
|
||||
autoCorrect={false}
|
||||
outlineColor="transparent"
|
||||
activeOutlineColor="transparent"
|
||||
underlineStyle={styles.inputUnderline}
|
||||
|
@ -24,7 +24,7 @@
|
||||
"@types/react-dom": "18.0.6",
|
||||
"@vitejs/plugin-react": "4.3.1",
|
||||
"crypto-js": "^4.2.0",
|
||||
"databag-client-sdk": "^0.0.25",
|
||||
"databag-client-sdk": "^0.0.30",
|
||||
"jest": "29.1.1",
|
||||
"jsencrypt": "^3.3.2",
|
||||
"react": "18.3.1",
|
||||
|
@ -104,8 +104,7 @@ export function useProfile(params: ProfileParams) {
|
||||
},
|
||||
saveAndConnect: async () => {
|
||||
const contact = app.state.session?.getContact();
|
||||
const added = await contact.addCard(state.node, state.guid);
|
||||
await contact.connectCard(added);
|
||||
const added = await contact.addAndConnectCard(state.node, state.guid);
|
||||
},
|
||||
remove: async () => {
|
||||
const contact = app.state.session?.getContact()
|
||||
|
@ -246,6 +246,10 @@ Configure allocates the Service interface for the server
|
||||
|
||||
```Contact::connectCard(cardId: string): Promise<void>```
|
||||
|
||||
A new contact can be added to the account and initiate connection through the addAndConnectCard method
|
||||
|
||||
```Contact::addAndConnectCard(server: string, guid: string): Promise<void>```
|
||||
|
||||
Save contact of connection request without accepting connection with confirmCard
|
||||
|
||||
```Contact::confirmCard(cardId: string): Promise<void>```
|
||||
|
@ -40,6 +40,9 @@ export class MockContactModule implements Contact {
|
||||
return '';
|
||||
}
|
||||
|
||||
public async addAndConnectCard(server: string, guid: string): Promise<void> {
|
||||
}
|
||||
|
||||
public async removeCard(cardId: string): Promise<void> {
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "databag-client-sdk",
|
||||
"version": "0.0.28",
|
||||
"version": "0.0.30",
|
||||
"description": "an SDK for developing Databag applications",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
|
@ -76,6 +76,7 @@ export interface Contact {
|
||||
removeCard(cardId: string): Promise<void>;
|
||||
confirmCard(cardId: string): Promise<void>;
|
||||
connectCard(cardId: string): Promise<void>;
|
||||
addAndConnectCard(server: string | null, guid: string): Promise<void>;
|
||||
disconnectCard(cardId: string): Promise<void>;
|
||||
denyCard(cardId: string): Promise<void>;
|
||||
ignoreCard(cardId: string): Promise<void>;
|
||||
|
@ -885,6 +885,26 @@ export class ContactModule implements Contact {
|
||||
}
|
||||
}
|
||||
|
||||
public async addAndConnectCard(server: string | null, guid: string): Promise<void> {
|
||||
const { node, secure, token } = this;
|
||||
const insecure = server ? /^(?!0)(?!.*\.$)((1?\d?\d|25[0-5]|2[0-4]\d)(\.|:\d+$|$)){4}$/.test(server) : false;
|
||||
const message = server ? await getContactListing(server, !insecure, guid) : await getContactListing(node, secure, guid);
|
||||
const added = await addCard(node, secure, token, message);
|
||||
await setCardConnecting(node, secure, token, added.id);
|
||||
try {
|
||||
const message = await getCardOpenMessage(node, secure, token, added.id);
|
||||
const server = added.data.cardProfile.node ? added.data.cardProfile.node : node;
|
||||
const insecure = /^(?!0)(?!.*\.$)((1?\d?\d|25[0-5]|2[0-4]\d)(\.|:\d+$|$)){4}$/.test(server);
|
||||
const contact = await setCardOpenMessage(server, !insecure, message);
|
||||
if (contact.status === 'connected') {
|
||||
const { token: contactToken, articleRevision, channelRevision, profileRevision } = contact;
|
||||
await setCardConnected(node, secure, token, cardId, contactToken, articleRevision, channelRevision, profileRevision);
|
||||
}
|
||||
} catch (err) {
|
||||
this.log.error('failed to deliver open message');
|
||||
}
|
||||
}
|
||||
|
||||
public async disconnectCard(cardId: string): Promise<void> {
|
||||
const { node, secure, token } = this;
|
||||
await setCardConfirmed(node, secure, token, cardId);
|
||||
|
Loading…
Reference in New Issue
Block a user