mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
respecting allowUnsealed setting in mobile app
This commit is contained in:
parent
61d2660f88
commit
f5e9b5de61
@ -7,6 +7,7 @@ const Strings = [
|
|||||||
visibleRegistry: 'Visible in Registry',
|
visibleRegistry: 'Visible in Registry',
|
||||||
edit: 'Edit',
|
edit: 'Edit',
|
||||||
enableNotifications: 'Push Notifications',
|
enableNotifications: 'Push Notifications',
|
||||||
|
allowUnsealed: 'Allow Unsealed',
|
||||||
sealedTopics: 'Sealed Topics',
|
sealedTopics: 'Sealed Topics',
|
||||||
colorMode: 'Color Mode',
|
colorMode: 'Color Mode',
|
||||||
hourMode: 'Hour',
|
hourMode: 'Hour',
|
||||||
@ -205,6 +206,7 @@ const Strings = [
|
|||||||
visibleRegistry: 'Visible dans le Registre',
|
visibleRegistry: 'Visible dans le Registre',
|
||||||
edit: 'Modifier',
|
edit: 'Modifier',
|
||||||
enableNotifications: 'Notifications Push',
|
enableNotifications: 'Notifications Push',
|
||||||
|
allowUnsealed: 'Sujets non Sécurisés',
|
||||||
sealedTopics: 'Sujets Sécurisés',
|
sealedTopics: 'Sujets Sécurisés',
|
||||||
colorMode: 'Mode de Couleur',
|
colorMode: 'Mode de Couleur',
|
||||||
hourMode: 'Heure',
|
hourMode: 'Heure',
|
||||||
@ -400,6 +402,7 @@ const Strings = [
|
|||||||
visibleRegistry: 'Visible en el Registro',
|
visibleRegistry: 'Visible en el Registro',
|
||||||
edit: 'Editar',
|
edit: 'Editar',
|
||||||
enableNotifications: 'Notificaciones Push',
|
enableNotifications: 'Notificaciones Push',
|
||||||
|
allowUnsealed: 'Sujetos Inseguros',
|
||||||
sealedTopics: 'Temas Protegidos',
|
sealedTopics: 'Temas Protegidos',
|
||||||
colorMode: 'Modo de Color',
|
colorMode: 'Modo de Color',
|
||||||
hourMode: 'Hora',
|
hourMode: 'Hora',
|
||||||
@ -595,6 +598,7 @@ const Strings = [
|
|||||||
visibleRegistry: 'Sichtbar in der Registrierung',
|
visibleRegistry: 'Sichtbar in der Registrierung',
|
||||||
edit: 'Bearbeiten',
|
edit: 'Bearbeiten',
|
||||||
enableNotifications: 'Mitteilungen',
|
enableNotifications: 'Mitteilungen',
|
||||||
|
allowUnsealed: 'Unsichere Themen',
|
||||||
sealedTopics: 'Gesicherte Themen',
|
sealedTopics: 'Gesicherte Themen',
|
||||||
colorMode: 'Farmodus',
|
colorMode: 'Farmodus',
|
||||||
hourMode: 'Stunde',
|
hourMode: 'Stunde',
|
||||||
@ -790,6 +794,7 @@ const Strings = [
|
|||||||
visibleRegistry: 'Visível no Registro',
|
visibleRegistry: 'Visível no Registro',
|
||||||
edit: 'Editar',
|
edit: 'Editar',
|
||||||
enableNotifications: 'Notificações Push',
|
enableNotifications: 'Notificações Push',
|
||||||
|
allowUnsealed: 'Assuntos Inseguros',
|
||||||
sealedTopics: 'Tópicos Selados',
|
sealedTopics: 'Tópicos Selados',
|
||||||
colorMode: 'Modo de Cor',
|
colorMode: 'Modo de Cor',
|
||||||
hourMode: 'Hora',
|
hourMode: 'Hora',
|
||||||
@ -970,6 +975,7 @@ const Strings = [
|
|||||||
visibleRegistry: 'Видимый в реестре',
|
visibleRegistry: 'Видимый в реестре',
|
||||||
edit: 'Редактировать',
|
edit: 'Редактировать',
|
||||||
enableNotifications: 'Уведомления',
|
enableNotifications: 'Уведомления',
|
||||||
|
allowUnsealed: 'Небезопасные субъекты',
|
||||||
sealedTopics: 'Запечатанные темы',
|
sealedTopics: 'Запечатанные темы',
|
||||||
colorMode: 'Цветовая схема',
|
colorMode: 'Цветовая схема',
|
||||||
hourMode: 'Часы',
|
hourMode: 'Часы',
|
||||||
|
@ -191,6 +191,13 @@ export function Dashboard(props) {
|
|||||||
onValueChange={actions.setPushSupported} trackColor={styles.track}/>
|
onValueChange={actions.setPushSupported} trackColor={styles.track}/>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
||||||
|
<TouchableOpacity style={styles.media} activeOpacity={1}
|
||||||
|
onPress={() => actions.setPushSupported(!state.pushSupported)}>
|
||||||
|
<Text style={styles.modalLabel}>{ state.strings.allowUnsealed }</Text>
|
||||||
|
<Switch style={styles.switch} value={state.pushSupported}
|
||||||
|
onValueChange={actions.setPushSupported} trackColor={styles.track}/>
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
<View style={styles.label}></View>
|
<View style={styles.label}></View>
|
||||||
|
|
||||||
<TouchableOpacity style={styles.media} activeOpacity={1}
|
<TouchableOpacity style={styles.media} activeOpacity={1}
|
||||||
|
@ -28,6 +28,8 @@ export function useDashboard(config, server, token) {
|
|||||||
domain: null,
|
domain: null,
|
||||||
storage: null,
|
storage: null,
|
||||||
keyType: null,
|
keyType: null,
|
||||||
|
pushSupported: true,
|
||||||
|
allowUnsealed: false,
|
||||||
enableImage: true,
|
enableImage: true,
|
||||||
enableAudio: true,
|
enableAudio: true,
|
||||||
enableVideo: true,
|
enableVideo: true,
|
||||||
@ -64,8 +66,8 @@ export function useDashboard(config, server, token) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const { keyType, accountStorage, domain, enableImage, enableAudio, enableVideo, pushSupported, enableIce, iceUrl, iceUsername, icePassword } = config;
|
const { keyType, accountStorage, domain, enableImage, enableAudio, enableVideo, allowUnsealed, pushSupported, enableIce, iceUrl, iceUsername, icePassword } = config;
|
||||||
updateState({ keyType, storage: accountStorage.toString(), domain, enableImage, enableAudio, enableVideo, pushSupported, enableIce, iceUrl, iceUsername, icePassword });
|
updateState({ keyType, storage: accountStorage.toString(), domain, enableImage, enableAudio, enableVideo, allowUnsealed, pushSupported, enableIce, iceUrl, iceUsername, icePassword });
|
||||||
}, [config]);
|
}, [config]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -108,6 +110,9 @@ export function useDashboard(config, server, token) {
|
|||||||
setPushSupported: (pushSupported) => {
|
setPushSupported: (pushSupported) => {
|
||||||
updateState({ pushSupported });
|
updateState({ pushSupported });
|
||||||
},
|
},
|
||||||
|
setAllowUnsealed: (allowUnsealed) => {
|
||||||
|
updateState({ allowUnsealed });
|
||||||
|
},
|
||||||
setEnableImage: (enableImage) => {
|
setEnableImage: (enableImage) => {
|
||||||
updateState({ enableImage });
|
updateState({ enableImage });
|
||||||
},
|
},
|
||||||
@ -133,8 +138,8 @@ export function useDashboard(config, server, token) {
|
|||||||
updateState({ icePassword });
|
updateState({ icePassword });
|
||||||
},
|
},
|
||||||
saveConfig: async () => {
|
saveConfig: async () => {
|
||||||
const { storage, domain, keyType, enableImage, enableAudio, enableVideo, enableIce, iceUrl, iceUsername, icePassword } = state;
|
const { storage, domain, keyType, enableImage, pushSupported, allowUnsealed, enableAudio, enableVideo, enableIce, iceUrl, iceUsername, icePassword } = state;
|
||||||
const config = { accountStorage: Number(storage), domain, keyType, enableImage, enableAudio, enableVideo, enableIce, iceUrl, iceUsername, icePassword };
|
const config = { accountStorage: Number(storage), domain, keyType, enableImage, pushSupported, allowUnsealed, enableAudio, enableVideo, enableIce, iceUrl, iceUsername, icePassword };
|
||||||
await setNodeConfig(server, token, config);
|
await setNodeConfig(server, token, config);
|
||||||
},
|
},
|
||||||
enableUser: async (accountId, enabled) => {
|
enableUser: async (accountId, enabled) => {
|
||||||
|
@ -50,15 +50,17 @@ export function Channels({ cardId, channelId, navigation, openConversation, dmCh
|
|||||||
<TextInput style={styles.inputfield} value={state.filter} onChangeText={actions.setFilter}
|
<TextInput style={styles.inputfield} value={state.filter} onChangeText={actions.setFilter}
|
||||||
autoCapitalize="none" placeholderTextColor={Colors.inputPlaceholder} placeholder={ state.strings.topics} />
|
autoCapitalize="none" placeholderTextColor={Colors.inputPlaceholder} placeholder={ state.strings.topics} />
|
||||||
</View>
|
</View>
|
||||||
<TouchableOpacity style={styles.addtop} onPress={actions.showAdding}>
|
{ (state.sealable || state.allowUnsealed) && (
|
||||||
<Ionicons name={'message1'} size={16} color={Colors.primaryButtonText} style={[styles.box, { transform: [ { rotateY: "180deg" }, ]} ]}/>
|
<TouchableOpacity style={styles.addtop} onPress={actions.showAdding}>
|
||||||
<Text style={styles.addtext}>{ state.strings.new }</Text>
|
<Ionicons name={'message1'} size={16} color={Colors.primaryButtonText} style={[styles.box, { transform: [ { rotateY: "180deg" }, ]} ]}/>
|
||||||
</TouchableOpacity>
|
<Text style={styles.addtext}>{ state.strings.new }</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [navigation]);
|
}, [navigation, state.allowUnsealed]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
@ -85,7 +87,7 @@ export function Channels({ cardId, channelId, navigation, openConversation, dmCh
|
|||||||
keyExtractor={item => (`${item.cardId}:${item.channelId}`)}
|
keyExtractor={item => (`${item.cardId}:${item.channelId}`)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{ !navigation && (
|
{ !navigation && (state.sealable || state.allowUnsealed) && (
|
||||||
<View style={styles.columnbottom}>
|
<View style={styles.columnbottom}>
|
||||||
<TouchableOpacity style={styles.addbottom} onPress={actions.showAdding}>
|
<TouchableOpacity style={styles.addbottom} onPress={actions.showAdding}>
|
||||||
<Ionicons name={'message1'} size={16} color={Colors.white} />
|
<Ionicons name={'message1'} size={16} color={Colors.white} />
|
||||||
@ -131,7 +133,7 @@ export function Channels({ cardId, channelId, navigation, openConversation, dmCh
|
|||||||
)}
|
)}
|
||||||
<View style={styles.addControls}>
|
<View style={styles.addControls}>
|
||||||
<View style={styles.sealed}>
|
<View style={styles.sealed}>
|
||||||
{ state.sealable && (
|
{ state.sealable && state.allowUnsealed && (
|
||||||
<>
|
<>
|
||||||
<Switch style={styles.switch} trackColor={styles.track}
|
<Switch style={styles.switch} trackColor={styles.track}
|
||||||
value={state.sealed} onValueChange={actions.setSealed} />
|
value={state.sealed} onValueChange={actions.setSealed} />
|
||||||
|
@ -20,6 +20,7 @@ export function useChannels() {
|
|||||||
addSubject: null,
|
addSubject: null,
|
||||||
sealed: false,
|
sealed: false,
|
||||||
sealable: false,
|
sealable: false,
|
||||||
|
allowUnsealed: false,
|
||||||
busy: false,
|
busy: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -117,12 +118,13 @@ export function useChannels() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const allowUnsealed = account.state.status?.allowUnsealed;
|
||||||
const { status, sealKey } = account.state;
|
const { status, sealKey } = account.state;
|
||||||
if (status?.seal?.publicKey && sealKey?.public && sealKey?.private && sealKey?.public === status.seal.publicKey) {
|
if (status?.seal?.publicKey && sealKey?.public && sealKey?.private && sealKey?.public === status.seal.publicKey) {
|
||||||
updateState({ sealable: true });
|
updateState({ sealable: true, allowUnsealed });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
updateState({ sealed: false, sealable: false });
|
updateState({ sealed: false, sealable: false, allowUnsealed });
|
||||||
}
|
}
|
||||||
}, [account.state]);
|
}, [account.state]);
|
||||||
|
|
||||||
@ -138,7 +140,7 @@ export function useChannels() {
|
|||||||
if (contact.detail.status !== 'connected') {
|
if (contact.detail.status !== 'connected') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (state.sealed && !contact.profile.seal) {
|
if ((!state.allowUnsealed || state.sealed) && !contact.profile.seal) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -156,7 +158,7 @@ export function useChannels() {
|
|||||||
});
|
});
|
||||||
const addMembers = state.addMembers.filter(item => sorted.some(contact => contact.cardId === item));
|
const addMembers = state.addMembers.filter(item => sorted.some(contact => contact.cardId === item));
|
||||||
updateState({ contacts: sorted, addMembers });
|
updateState({ contacts: sorted, addMembers });
|
||||||
}, [card.state, state.sealed]);
|
}, [card.state, state.sealed, state.allowUnsealed]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
syncChannels();
|
syncChannels();
|
||||||
@ -244,7 +246,7 @@ export function useChannels() {
|
|||||||
if (!state.busy) {
|
if (!state.busy) {
|
||||||
try {
|
try {
|
||||||
updateState({ busy: true });
|
updateState({ busy: true });
|
||||||
if (state.sealed) {
|
if (state.sealed || !state.allowUnsealed) {
|
||||||
const keys = [ account.state.sealKey.public ];
|
const keys = [ account.state.sealKey.public ];
|
||||||
state.addMembers.forEach(id => {
|
state.addMembers.forEach(id => {
|
||||||
const contact = card.state.cards.get(id);
|
const contact = card.state.cards.get(id);
|
||||||
|
Loading…
Reference in New Issue
Block a user