Skip to content

Commit 6eec241

Browse files
author
Erika Perugachi
authored
Merge pull request #1065 from erikaperugachi/reply
Scroll and fullscreen
2 parents 4360387 + 52868e9 commit 6eec241

File tree

3 files changed

+51
-30
lines changed

3 files changed

+51
-30
lines changed

electron_app/src/windows/mailbox.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ const create = () => {
7070
mailboxWindow.on('close', e => {
7171
if (!globalManager.forcequit.get()) {
7272
e.preventDefault();
73-
hide();
73+
if (mailboxWindow.isFullScreen()) {
74+
mailboxWindow.setFullScreen(false);
75+
setTimeout(() => hide(), 1200);
76+
} else {
77+
hide();
78+
}
7479
} else {
7580
destroyTrayIcon();
7681
require('./../socketClient').disconnect();

email_composer/src/utils/EmailUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { HTMLTagsRegex } from './RegexUtils';
1919
const myEmailAddress = `${myAccount.recipientId}@${appDomain}`;
2020

2121
const formAppSign = () => {
22-
return '<br/><span style="font-size: 12px;">Sent with <a style="color: #0091ff; text-decoration: none;" href="https://goo.gl/qW4Aks">Criptext</a> secure email</span>';
22+
return '<br/><span style="font-size: 12px;">Sent with <a style="color: #0091ff; text-decoration: none;" href="http://bit.ly/2Xzx8Es">Criptext</a> secure email</span>';
2323
};
2424

2525
const getRecipientsWithDomain = (recipients, type) => {

email_mailbox/src/components/Thread.js

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,6 @@ class Thread extends Component {
2525
};
2626
}
2727

28-
componentWillReceiveProps(nextProps) {
29-
if (this.props.thread && !nextProps.thread) {
30-
this.props.onBackOption();
31-
} else if (this.props.thread.unread) {
32-
if (
33-
nextProps.emailKeysUnread.length !== this.props.emailKeysUnread.length
34-
) {
35-
this.props.onUpdateUnreadEmails(
36-
nextProps.emailKeysUnread,
37-
nextProps.thread.threadId
38-
);
39-
}
40-
}
41-
if (
42-
this.props.emails.length === 0 &&
43-
nextProps.emails.length > this.props.emails.length
44-
) {
45-
const groupedIndex =
46-
nextProps.indexFirstUnread < 0
47-
? nextProps.emails.length - 1
48-
: nextProps.indexFirstUnread;
49-
this.setState({
50-
groupedIndex: groupedIndex || 0
51-
});
52-
}
53-
}
54-
5528
render() {
5629
return (
5730
<div className="thread-container">
@@ -84,7 +57,9 @@ class Thread extends Component {
8457
/>
8558
</div>
8659
</div>
87-
<div className="cptx-thread-emails">{this.renderEmails()}</div>
60+
<div className="cptx-thread-emails" ref={e => (this.scroll = e)}>
61+
{this.renderEmails()}
62+
</div>
8863
</div>
8964
{this.renderTooltipForEmail()}
9065
</div>
@@ -102,6 +77,42 @@ class Thread extends Component {
10277
}
10378
}
10479

80+
componentDidUpdate(prevProps) {
81+
if (!this.props.thread && prevProps.thread) {
82+
return this.props.onBackOption();
83+
}
84+
85+
if (
86+
this.props.thread.unread &&
87+
prevProps.emailKeysUnread.length !== this.props.emailKeysUnread.length
88+
) {
89+
this.props.onUpdateUnreadEmails(
90+
this.props.emailKeysUnread,
91+
this.props.thread.threadId
92+
);
93+
}
94+
95+
if (
96+
prevProps.emails.length === 0 &&
97+
prevProps.emails.length > this.props.emails.length
98+
) {
99+
const groupedIndex =
100+
this.props.indexFirstUnread < 0
101+
? this.props.emails.length - 1
102+
: this.props.indexFirstUnread;
103+
this.setState({
104+
groupedIndex: groupedIndex || 0
105+
});
106+
}
107+
108+
if (
109+
this.props.emails.length > prevProps.emails.length &&
110+
prevProps.emails.length !== 0
111+
) {
112+
this.setScrollToBottomPosition();
113+
}
114+
}
115+
105116
renderEmails = () => {
106117
if (!this.props.emails.length) {
107118
return <EmailLoading />;
@@ -177,6 +188,11 @@ class Thread extends Component {
177188
groupedIndex: 0
178189
});
179190
};
191+
192+
setScrollToBottomPosition = () => {
193+
const bottomPosition = this.scroll.scrollHeight - this.scroll.clientHeight;
194+
this.scroll.scrollTop = bottomPosition;
195+
};
180196
}
181197

182198
const ExpandView = props => (

0 commit comments

Comments
 (0)