Skip to content
Snippets Groups Projects
Commit 378e3778 authored by Alexey Lunin's avatar Alexey Lunin
Browse files

add email screen

parent 5a7eddaa
Branches
Tags
1 merge request!12Hin messaging
......@@ -7,6 +7,7 @@ import SettingStack from 'src/navigators/SettingStack';
import NotificationStack from 'src/navigators/NotificationStack';
import ConnectionInvitation from 'src/screens/ConnectionInvitation';
import ListContacts from 'src/screens/ListContacts';
import EmailDetails from 'src/screens/EmailDetails';
import defaultStackOptions from './defaultStackOptions';
const Stack = createStackNavigator<MainStackParams>();
......@@ -17,6 +18,11 @@ const MainStack: React.FC = () => {
screenOptions={{ ...defaultStackOptions, headerShown: false }}
>
<Stack.Screen name={Stacks.TabStack} component={TabStack} />
<Stack.Screen
name={Screens.EmailDetails}
component={EmailDetails}
options={{ headerShown: true }}
/>
<Stack.Screen
name={Screens.Scan}
options={{ presentation: 'modal' }}
......
......@@ -13,6 +13,7 @@ const RootStack: React.FC = observer(() => {
useEffect(() => {
rootStore.agentStore.createAgent();
rootStore.urlStore.injectNavigation(navigation);
rootStore.agentStore.injectNavigation(navigation);
}, []);
......
import React, { useEffect, useState } from 'react';
import { StackScreenProps } from '@react-navigation/stack';
import {
StyleSheet,
Text,
Alert,
View,
FlatList, StatusBar, ScrollView,
} from 'react-native';
import {observer} from "mobx-react";
import {EmailStackParams, Screens} from 'src/type/navigators';
import { ColorPallet, TextTheme } from 'src/theme/theme';
type EmailDetailsProps = StackScreenProps<
EmailStackParams,
Screens.EmailDetails
>;
const EmailDetails: React.FC<EmailDetailsProps> = observer(({
navigation,
route,
}) => {
const email = route.params.email;
return (
<View style={styles.container}>
<StatusBar barStyle="light-content" />
<ScrollView>
<View>
<Text style={styles.headerProp}>
Email:
</Text>
<Text style={styles.headerProp}>
{email}
</Text>
</View>
</ScrollView>
</View>
);
});
export default EmailDetails;
const styles = StyleSheet.create({
container: {
flex: 1,
paddingLeft: 30,
paddingRight: 30,
paddingTop: 32,
paddingBottom: 10,
},
headerProp: {
color: ColorPallet.baseColors.black,
fontWeight: 'bold',
fontSize: 16,
marginRight: 7,
}
});
......@@ -63,15 +63,22 @@ import {WalletConfig, WalletExportImportConfig} from "@aries-framework/core/buil
import {
LegacyIndyCredentialFormatService
} from "@aries-framework/anoncreds/build/formats/LegacyIndyCredentialFormatService";
import {infoToast, warningToast} from 'src/utils/toast';
import MimeParser from 'emailjs-mime-parser';
import {Screens} from "../type/navigators";
import {Buffer} from "buffer";
class AgentStore {
private _rootStore: RootStore;
private _agent: Agent | null = null;
public get agent(): Agent { return this._agent as Agent; }
private _navigation: any;
public get agentCreated() {
return !!this._agent;
}
public injectNavigation = (navigation: any) => {
this._navigation = navigation;
}
public get active(): boolean {
return this._agent?.isInitialized || false;
}
......@@ -213,7 +220,47 @@ class AgentStore {
//1. receive the message
console.log(JSON.stringify(ev.payload.basicMessageRecord, null, 2))
console.log(JSON.stringify(ev.payload.basicMessageRecord, null, 2))
infoToast("Received new message");
let emailContent = ev.payload.basicMessageRecord.content;
try {
emailContent = Buffer.from(emailContent, 'base64').toString();
} catch (e: any) {
console.error('Error decoding base64', e);
warningToast("Email content is not base64 encoded");
}
this._navigation.navigate(Screens.EmailDetails, { email: emailContent });
// let parser = new MimeParser();
//
// let headerValue;
// let htmlContent;
//
// parser.onheader = (node) => {
// // If the header name is 'X-Special-Header', capture its value
// if (node.headers['x-message-id']) {
// headerValue = node.headers['x-message-id'][0].value;
// }
// };
//
// parser.onbody = (node, chunk) => {
// if (node.contentType.value === 'text/html') {
// htmlContent = chunk.toString('utf-8');
// }
// };
//
// parser.write(mimeContent);
// parser.end();
//
// console.log('Header Value:', headerValue);
// console.log('HTML Content:', htmlContent);
// "x-message-id":
// POST /v1/message/read
......
......@@ -27,7 +27,8 @@ export enum Screens {
Biometric = 'Biometric',
SetupDelay = 'SetupDelay',
SealScannedQrCodeList = 'SealScannedQrCodeList',
SealDetailsInfo = 'SealDetailsInfo'
SealDetailsInfo = 'SealDetailsInfo',
EmailDetails = 'EmailDetails'
}
export type OnboardingStackParams = {
......@@ -48,6 +49,7 @@ export type MainStackParams = {
[Screens.Scan]: undefined;
[Screens.ListContacts]: undefined;
[Screens.ConnectionInvitation]: undefined;
[Screens.EmailDetails]: { email: string };
[Stacks.SettingsStack]: undefined;
[Stacks.NotificationStack]: undefined;
};
......@@ -61,6 +63,10 @@ export type ContactStackParams = {
[Screens.ContactDetails]: { connectionId: string };
};
export type EmailStackParams = {
[Screens.EmailDetails]: { email: string };
};
export type SealStackParams = {
[Screens.ListContacts]: undefined;
[Screens.ContactDetails]: { connectionId: string };
......
......@@ -4262,6 +4262,34 @@ electron-to-chromium@^1.4.411:
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.425.tgz#399df13091b836d28283a545c25c8e4d9da86da8"
integrity sha512-wv1NufHxu11zfDbY4fglYQApMswleE9FL/DSeyOyauVXDZ+Kco96JK/tPfBUaDqfRarYp2WH2hJ/5UnVywp9Jg==
emailjs-addressparser@^2.0.1:
version "2.0.3"
resolved "https://registry.yarnpkg.com/emailjs-addressparser/-/emailjs-addressparser-2.0.3.tgz#b9c1cbaf70da13622075944ce757f3be5451fb99"
integrity sha512-GjahNdp1fRsWBGxmwC4o7XEoEf7QsdsVrbZFoeulEKNp49NrIUZcZfGMKCPDv5kExiuJLulq/7tJY+ei6BRitA==
emailjs-base64@^1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/emailjs-base64/-/emailjs-base64-1.1.4.tgz#392fa38cb6aa35dccd3af3637ffc14c1c7ce9612"
integrity sha512-4h0xp1jgVTnIQBHxSJWXWanNnmuc5o+k4aHEpcLXSToN8asjB5qbXAexs7+PEsUKcEyBteNYsSvXUndYT2CGGA==
emailjs-mime-codec@^2.0.8:
version "2.0.9"
resolved "https://registry.yarnpkg.com/emailjs-mime-codec/-/emailjs-mime-codec-2.0.9.tgz#d184451b6f2e55c5868b0f0a82d18fe2b82f0c97"
integrity sha512-7qJo4pFGcKlWh/kCeNjmcgj34YoJWY0ekZXEHYtluWg4MVBnXqGM4CRMtZQkfYwitOhUgaKN5EQktJddi/YIDQ==
dependencies:
emailjs-base64 "^1.1.4"
ramda "^0.26.1"
text-encoding "^0.7.0"
emailjs-mime-parser@^2.0.7:
version "2.0.7"
resolved "https://registry.yarnpkg.com/emailjs-mime-parser/-/emailjs-mime-parser-2.0.7.tgz#b9641a5564aeef1bd9ff4f7c51ab09b0cd7524d7"
integrity sha512-rOrRtAzq0OVLrxbTkRLyrtoY/YQldPgIzAk6lcD3LfXR0Gw3+PzsN2rO1QENY+cIQD94vYr2t2Ri0Zxlc9aeew==
dependencies:
emailjs-addressparser "^2.0.1"
emailjs-mime-codec "^2.0.8"
ramda "^0.26.1"
emittery@^0.13.1:
version "0.13.1"
resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad"
......@@ -7799,6 +7827,11 @@ queue-microtask@^1.2.2:
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==
ramda@^0.26.1:
version "0.26.1"
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.26.1.tgz#8d41351eb8111c55353617fc3bbffad8e4d35d06"
integrity sha512-hLWjpy7EnsDBb0p+Z3B7rPi3GDeRG5ZtiI33kJhTt+ORCd38AbAIjB/9zRIUoeTbE/AVX5ZkU7m6bznsvrf8eQ==
ramda@^0.27.2:
version "0.27.2"
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.27.2.tgz#84463226f7f36dc33592f6f4ed6374c48306c3f1"
......@@ -9019,6 +9052,11 @@ test-exclude@^6.0.0:
glob "^7.1.4"
minimatch "^3.0.4"
text-encoding@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.7.0.tgz#f895e836e45990624086601798ea98e8f36ee643"
integrity sha512-oJQ3f1hrOnbRLOcwKz0Liq2IcrvDeZRHXhd9RgLrsT+DjWY/nty1Hi7v3dtkaEYbPYe0mUoOfzRrMwfXXwgPUA==
text-table@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment