Page MenuHomePhabricator

D10382.diff
No OneTemporary

D10382.diff

diff --git a/native/profile/tunnelbroker-menu.react.js b/native/profile/tunnelbroker-menu.react.js
--- a/native/profile/tunnelbroker-menu.react.js
+++ b/native/profile/tunnelbroker-menu.react.js
@@ -13,6 +13,7 @@
import TextInput from '../components/text-input.react.js';
import type { NavigationRoute } from '../navigation/route-names.js';
import { useColors, useStyles } from '../themes/colors.js';
+import { createOlmSessionsWithOwnDevices } from '../utils/crypto-utils.js';
type Props = {
+navigation: ProfileNavigationProp<'TunnelbrokerMenu'>,
@@ -43,10 +44,18 @@
try {
await sendMessage({ deviceID: recipient, payload: message });
} catch (e) {
- console.error(e.message);
+ console.log(e.message);
}
}, [message, recipient, sendMessage]);
+ const onCreateSessions = React.useCallback(async () => {
+ try {
+ await createOlmSessionsWithOwnDevices(sendMessage);
+ } catch (e) {
+ console.log(`Error creating olm sessions with own devices: ${e.message}`);
+ }
+ }, [sendMessage]);
+
return (
<ScrollView
contentContainerStyle={styles.scrollViewContentContainer}
@@ -88,6 +97,17 @@
>
<Text style={styles.submenuText}>Send Message</Text>
</Button>
+ <Button
+ onPress={onCreateSessions}
+ style={styles.row}
+ iosFormat="highlight"
+ iosHighlightUnderlayColor={colors.panelIosHighlightUnderlay}
+ iosActiveOpacity={0.85}
+ >
+ <Text style={styles.submenuText}>
+ Create session with own devices
+ </Text>
+ </Button>
</View>
<Text style={styles.header}>MESSAGES</Text>
diff --git a/native/utils/crypto-utils.js b/native/utils/crypto-utils.js
--- a/native/utils/crypto-utils.js
+++ b/native/utils/crypto-utils.js
@@ -156,6 +156,9 @@
deviceID: recipientDeviceID,
payload: JSON.stringify(sessionCreationMessage),
});
+ console.log(
+ `Request to create a session with device ${recipientDeviceID} sent.`,
+ );
} catch (e) {
console.log(
'Error creating outbound session with ' +

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 10:44 PM (11 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2703353
Default Alt Text
D10382.diff (2 KB)

Event Timeline