mirror of
https://github.com/balzack/databag.git
synced 2025-04-24 02:25:26 +00:00
allowing for non-secure registry com
This commit is contained in:
parent
b8e040f7be
commit
e16a7ea412
@ -3,7 +3,7 @@ import {DatabagSDK, Session} from 'databag-client-sdk';
|
||||
import {SessionStore} from '../SessionStore';
|
||||
import {NativeCrypto} from '../NativeCrypto';
|
||||
import {LocalStore} from '../LocalStore';
|
||||
const DATABAG_DB = 'db_v210.db';
|
||||
const DATABAG_DB = 'db_v213.db';
|
||||
const SETTINGS_DB = 'ls_v001.db';
|
||||
|
||||
const databag = new DatabagSDK({ tagBatch: 32, topicBatch: 32, articleTypes: [], channelTypes: [ 'sealed','superbasic'] }, new NativeCrypto());
|
||||
|
@ -301,4 +301,8 @@ export const styles = StyleSheet.create({
|
||||
fontSize: 16,
|
||||
color: Colors.danger,
|
||||
},
|
||||
radio: {
|
||||
borderRadius: 32,
|
||||
backgroundColor: 'yellow',
|
||||
},
|
||||
});
|
||||
|
@ -589,6 +589,7 @@ export function Settings({showLogout}: {showLogout: boolean}) {
|
||||
<Text style={styles.smallLabel}>{state.strings.timeFormat}:</Text>
|
||||
<View style={styles.radioButtons}>
|
||||
<RadioButton.Item
|
||||
style={styles.radio}
|
||||
label={state.strings.timeHalf}
|
||||
labelStyle={styles.option}
|
||||
mode="android"
|
||||
@ -598,6 +599,7 @@ export function Settings({showLogout}: {showLogout: boolean}) {
|
||||
}}
|
||||
/>
|
||||
<RadioButton.Item
|
||||
style={styles.radio}
|
||||
label={state.strings.timeFull}
|
||||
labelStyle={styles.option}
|
||||
mode="android"
|
||||
@ -617,6 +619,7 @@ export function Settings({showLogout}: {showLogout: boolean}) {
|
||||
<Text style={styles.smallLabel}>{state.strings.dateFormat}:</Text>
|
||||
<View style={styles.radioButtons}>
|
||||
<RadioButton.Item
|
||||
style={styles.radio}
|
||||
label={state.strings.monthStart}
|
||||
labelStyle={styles.option}
|
||||
mode="android"
|
||||
@ -626,6 +629,7 @@ export function Settings({showLogout}: {showLogout: boolean}) {
|
||||
}}
|
||||
/>
|
||||
<RadioButton.Item
|
||||
style={styles.radio}
|
||||
label={state.strings.monthEnd}
|
||||
labelStyle={styles.option}
|
||||
mode="android"
|
||||
|
@ -181,18 +181,10 @@ export class MockContactModule implements Contact {
|
||||
return [];
|
||||
}
|
||||
|
||||
public getRegistryImageUrl(server: string, secure: boolean, guid: string): string {
|
||||
return '';
|
||||
}
|
||||
|
||||
public getTopicAssetUrl(cardId: string, channelId: string, topicId: string, assetId: string): string {
|
||||
return '';
|
||||
}
|
||||
|
||||
public getCardImageUrl(cardId: string): string {
|
||||
return '';
|
||||
}
|
||||
|
||||
public async addParticipantAccess(cardId: string, channelId: string, name: string): Promise<Participant> {
|
||||
return { id: '', name: '', node: '', secure: false, token: '' };
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ export interface Identity {
|
||||
}
|
||||
|
||||
export interface Contact {
|
||||
addCard(server: string, guid: string): Promise<string>;
|
||||
addCard(server: string | null, guid: string): Promise<string>;
|
||||
removeCard(cardId: string): Promise<void>;
|
||||
confirmCard(cardId: string): Promise<void>;
|
||||
connectCard(cardId: string): Promise<void>;
|
||||
@ -87,9 +87,6 @@ export interface Contact {
|
||||
setChannelNotifications(cardId: string, channelId: string, enabled: boolean): Promise<void>;
|
||||
|
||||
getRegistry(handle: string | null, server: string | null): Promise<Profile[]>;
|
||||
getRegistryImageUrl(server: string, secure: boolean, guid: string): string;
|
||||
|
||||
getCardImageUrl(cardId: string): string;
|
||||
|
||||
addCardListener(ev: (cards: Card[]) => void): void;
|
||||
removeCardListener(ev: (cards: Card[]) => void): void;
|
||||
|
@ -646,9 +646,9 @@ export class ContactModule implements Contact {
|
||||
|
||||
|
||||
|
||||
public async addCard(server: string, guid: string): Promise<string> {
|
||||
public async addCard(server: string | null, guid: string): Promise<string> {
|
||||
const { node, secure, token } = this;
|
||||
const insecure = /^(?!0)(?!.*\.$)((1?\d?\d|25[0-5]|2[0-4]\d)(\.|:\d+$|$)){4}$/.test(server);
|
||||
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);
|
||||
return await addCard(node, secure, token, message);
|
||||
}
|
||||
@ -876,7 +876,8 @@ export class ContactModule implements Contact {
|
||||
|
||||
public async getRegistry(handle: string | null, server: string | null): Promise<Profile[]> {
|
||||
const { node, secure } = this;
|
||||
const listing = server ? await getRegistryListing(handle, server, true) : await getRegistryListing(handle, node, secure)
|
||||
const insecure = server ? /^(?!0)(?!.*\.$)((1?\d?\d|25[0-5]|2[0-4]\d)(\.|:\d+$|$)){4}$/.test(server) : false;
|
||||
const listing = server ? await getRegistryListing(handle, server, !insecure) : await getRegistryListing(handle, node, secure)
|
||||
return listing.map((entity) => {
|
||||
return {
|
||||
guid: entity.guid,
|
||||
@ -893,20 +894,6 @@ export class ContactModule implements Contact {
|
||||
});
|
||||
}
|
||||
|
||||
public getRegistryImageUrl(server: string, secure: boolean, guid: string): string {
|
||||
return getRegistryImageUrl(server, secure, guid);
|
||||
}
|
||||
|
||||
public getCardImageUrl(cardId: string): string {
|
||||
const entry = this.cardEntries.get(cardId);
|
||||
if (entry && entry.item.profile.imageSet) {
|
||||
const { node, secure, token } = this;
|
||||
return getCardImageUrl(node, secure, token, cardId, entry.item.profile.revision);
|
||||
}
|
||||
return avatar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private setCard(cardId: string, item: CardItem): Card {
|
||||
const { node, secure, token } = this;
|
||||
|
Loading…
x
Reference in New Issue
Block a user