Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gekidou - Account Screen #5708

Merged
merged 144 commits into from
Oct 12, 2021
Merged
Changes from 1 commit
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
80bc5e0
Added DrawerItem component
Sep 7, 2021
eb02240
WIP Account Screen
Sep 8, 2021
b29160d
Added react-native-paper
Sep 8, 2021
1b3bd0c
Added StatusLabel Component
Sep 8, 2021
77fbbba
Extracted i18n
Sep 8, 2021
73071e4
TS fix DrawerItem component
Sep 8, 2021
7f4776d
WIP Account Screen
Sep 8, 2021
5cc37fa
Added server name label under log out
Sep 8, 2021
985d304
Updated translation
Sep 8, 2021
aa02d7a
WIP
Sep 8, 2021
3c85723
Fixes the Offline text style
Sep 8, 2021
c50defd
Added Metropolis fonts
Sep 8, 2021
47a6e33
WIP
Sep 8, 2021
3a90c8c
Typo clean up
Sep 9, 2021
6593ea0
WIP
Sep 9, 2021
25ae030
WIP
Sep 9, 2021
23aa03d
WIP
Sep 9, 2021
ba077dc
Added server display name
Sep 9, 2021
d948d12
Writing OpenSans properly
Sep 9, 2021
f3c7ea1
WIP
Sep 9, 2021
05e0e05
WIP
Sep 11, 2021
37abe05
Added OptionsModal
Sep 11, 2021
ffb9b61
Opening OptionsModal
Sep 11, 2021
760e14f
Added translation keys
Sep 11, 2021
b8c0e6f
Writes status to local db
Sep 12, 2021
6ceb4f1
Fix missing translation
Sep 12, 2021
d4b395c
Fix OptionModal not dismissing
Sep 12, 2021
965ac9f
Pushing status to server
Sep 12, 2021
30e48f5
Refactored
Sep 13, 2021
b246f9e
Added CustomStatusExpiry component
Sep 13, 2021
0b33dcf
Added sub components
Sep 13, 2021
ce71d68
Added CustomLabel
Sep 13, 2021
34de037
CustomStatus WIP
Sep 13, 2021
d9d5e10
Merge branch 'gekidou' into gekidou_account_screen
Sep 14, 2021
343ff9a
Added Custom Status screen WIP
Sep 14, 2021
cba722b
WIP - unsetCustomStatus and CustomStatus constant
Sep 14, 2021
c781790
WIP
Sep 15, 2021
bf070b6
WIP
Sep 15, 2021
4bbb313
WIP
Sep 15, 2021
02627ce
WIP
Sep 15, 2021
d1f3172
WIP
Sep 15, 2021
3fe2164
WIP
Sep 15, 2021
4fd413d
WIP
Sep 15, 2021
a7dd90a
Retrieving RecentCustomStatuses from Preferences table
Sep 16, 2021
9c89a00
WIP
Sep 16, 2021
be2eca1
WIP
Sep 16, 2021
c0c9c5e
WIP
Sep 16, 2021
c536a04
Added Clear After Modal
Sep 16, 2021
6c9e44d
WIP - Transations
Sep 17, 2021
def8052
WIP
Sep 17, 2021
c627f36
Done with showing modal cst
Sep 17, 2021
eeb6c6b
wip
Sep 17, 2021
7b911d5
Clear After Modal - DONE
Sep 17, 2021
f844e7f
fix
Sep 17, 2021
01b1bf8
Added missing API calls
Sep 17, 2021
518a3ae
wip
Sep 17, 2021
07a5bdc
Causing screen refresh
Sep 17, 2021
250c9b5
wip
Sep 17, 2021
f47175d
WIP
Sep 20, 2021
f33e98f
WIP
Sep 20, 2021
011503c
WIP
Sep 20, 2021
81af5f6
Code clean up
Sep 20, 2021
293fa8c
Added OOO alert box
Sep 20, 2021
b2c58c6
Refactored Options-Item
Sep 21, 2021
0c06f2e
Refactored OptionsModalList component
Sep 21, 2021
f3fa0f0
Opening 'status' in BottomSheet instead of OptionsModal
Sep 21, 2021
3390971
AddReaction screen - WIP
Sep 22, 2021
5f41aa9
Add Reaction screen - WIP
Sep 22, 2021
264c35b
Added EmojiPickerRow
Sep 23, 2021
441e67b
Added @components/emoji_picker - WIP
Sep 23, 2021
53689be
Emoji Picker - WIP
Sep 24, 2021
be6eb54
WIP
Sep 24, 2021
fea28c5
WIP
Sep 24, 2021
1968e88
WIP
Sep 24, 2021
d632dec
SectionList - WIP
Sep 24, 2021
c4957b2
Installed react-native-section_list_get_item_layout
Sep 24, 2021
206d6f5
Adding API calls - WIP
Sep 24, 2021
9e7a5aa
WIP
Sep 27, 2021
9726cc6
Search Bar component - WIP
Sep 28, 2021
7b9bebf
WIP
Sep 28, 2021
692224b
WIP
Sep 28, 2021
f0761e7
WIP
Sep 28, 2021
e829383
Rendering Emoticons now - have to tackle some fixmes
Sep 28, 2021
99a682a
Code clean up
Sep 29, 2021
2533907
Code clean up - WIP
Sep 29, 2021
1cfe893
Code clean up
Sep 29, 2021
b449d01
WIP
Sep 29, 2021
feadc1a
Major clean up
Sep 29, 2021
5a63161
wip
Sep 29, 2021
44983b9
WIP
Sep 29, 2021
55ddd25
Fix rendering issue with SectionIcons and SearchBar
Sep 30, 2021
3910867
Tackled the CustomEmojiPage
Sep 30, 2021
4aeafae
Code clean up
Sep 30, 2021
c77d3f5
WIP
Sep 30, 2021
da444ee
Done with loading User Profiles for Custom Emoji
Sep 30, 2021
dc3a101
Code clean up
Sep 30, 2021
feba29e
Code Clean up
Sep 30, 2021
9ed0bb8
Merge branch 'gekidou' into gekidou_account_screen
Sep 30, 2021
8cd23aa
Fix screen Account
Oct 1, 2021
982c546
Added missing sql file for IOS Pod
Oct 1, 2021
5becac9
Merge branch 'gekidou' into gekidou_account_screen
Oct 1, 2021
7ca0697
Updated Podfile.lock
Oct 3, 2021
2bc5095
Merge branch 'gekidou' into gekidou_account_screen
Oct 3, 2021
72e3079
Using queryConfig instead of queryCommonSystemValues
Oct 3, 2021
a875d1d
Fix - Custom status
Oct 3, 2021
820e7e8
Fix - Custom Status - Error
Oct 4, 2021
a0ede24
Fix - Clear Pass Status - WIP
Oct 4, 2021
d35870b
Fix - Custom Status Clear
Oct 4, 2021
fa6708c
Need to fix CST clear
Oct 4, 2021
e69477c
WIP
Oct 4, 2021
5bd72e0
Status clear - working
Oct 4, 2021
5569269
Using catchError operator
Oct 4, 2021
50614bd
remove unnecessary prop
Oct 4, 2021
7e505d6
Status BottomSheet now has colored indicators
Oct 4, 2021
1cc9e43
Added KeyboardTrackingView from 'react-native-keyboard-tracking-view'
Oct 4, 2021
4e62949
Code clean up
Oct 4, 2021
1e609af
WIP
Oct 4, 2021
ef2b196
code clean up
Oct 4, 2021
28241c5
Added a safety check
Oct 5, 2021
5c0c4a4
Fix - Display suggestions
Oct 5, 2021
b1e5dc2
Code clean up based on PR Review
Oct 5, 2021
8964f3c
Code clean up
Oct 5, 2021
979c667
Code clean up
Oct 5, 2021
e75e045
Code clean up
Oct 5, 2021
ad26c8b
Corrections
Oct 5, 2021
50adf91
Fix tsc
Oct 8, 2021
b6c5e28
TS fix
Oct 8, 2021
ce02714
Removed unnecessary prop
Oct 8, 2021
7ae6fb9
Fix SearchBar Ts
Oct 8, 2021
45db4c2
Updated tests
Oct 8, 2021
5ddb3d8
Delete search_bar.test.js.snap
Oct 8, 2021
5defc31
Merge branch 'gekidou' into gekidou_account_screen
Oct 8, 2021
9be5fa0
Revert "Merge branch 'gekidou' into gekidou_account_screen"
Oct 8, 2021
fd6d455
Merge branch 'gekidou' into gekidou_account_screen
Oct 8, 2021
1e8f02f
Fix fonts
enahum Oct 8, 2021
21c250b
Refactor home account screen
enahum Oct 8, 2021
a7e676e
fix theme provider
enahum Oct 8, 2021
bcfabeb
refactor bottom sheet
enahum Oct 8, 2021
f9be5bf
remove paper provider
enahum Oct 8, 2021
5330a2a
update drawer item snapshots
enahum Oct 9, 2021
616df08
Remove options modal screen
enahum Oct 9, 2021
c6b3fcf
remove react-native-ui-lib dependency
enahum Oct 9, 2021
1bd9a5d
Refactor & fix custom status & navigation (including tablet)
enahum Oct 9, 2021
a86bd3a
Refactor emoji picker
enahum Oct 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP
  • Loading branch information
Avinash Lingaloo committed Sep 11, 2021
commit 05e0e059104f2363bcfc193a3c7a62d9f2478fb6
72 changes: 67 additions & 5 deletions app/screens/home/account/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
import {withDatabase} from '@nozbe/watermelondb/DatabaseProvider';
import withObservables from '@nozbe/with-observables';
import {useRoute} from '@react-navigation/native';
import {preventDoubleTap} from '@utils/tap';
import React, {useCallback, useEffect, useState} from 'react';
import {StyleSheet, Text, TextStyle, View} from 'react-native';
import {DeviceEventEmitter, StyleSheet, Text, TextStyle, View} from 'react-native';
import Animated, {AnimatedLayout, FadeInLeft, FadeInRight} from 'react-native-reanimated';
import {SafeAreaView} from 'react-native-safe-area-context';
import {switchMap} from 'rxjs/operators';
Expand All @@ -15,10 +16,13 @@ import FormattedText from '@components/formatted_text';
import ProfilePicture from '@components/profile_picture';
import StatusLabel from '@components/status_label';
import UserStatus from '@components/user_status';
import {Navigation} from '@constants';
import General from '@constants/general';
import {MM_TABLES, SYSTEM_IDENTIFIERS} from '@constants/database';
import {useTheme} from '@context/theme';
import DatabaseManager from '@database/manager';
import {t} from '@i18n';
import {dismissModal, showModalOverCurrentContext} from '@screens/navigation';
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';

import type ServersModel from '@typings/database/models/app/servers';
Expand All @@ -27,6 +31,7 @@ import type UserModel from '@typings/database/models/servers/user';
import type {WithDatabaseArgs} from '@typings/database/database';

const {SERVER: {SYSTEM, USER}, APP: {SERVERS}} = MM_TABLES;
const {OUT_OF_OFFICE, OFFLINE, AWAY, ONLINE, DND} = General;

const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
return {
Expand Down Expand Up @@ -132,10 +137,8 @@ const AccountScreen = ({currentUser}: AccountScreenProps) => {

const goToSavedMessages = () => {};

const firstName = currentUser.firstName;
const lastName = currentUser.lastName;
const nickName = currentUser.nickname ? ` (${currentUser.nickname})` : '';
const title = `${firstName} ${lastName}${nickName}`;
const title = `${currentUser.firstName} ${currentUser.lastName}${nickName}`;
const userName = `@${currentUser.username}`;

const getLabelComponent = useCallback((id: string, defaultMessage: string, otherStyle?: TextStyle) => {
Expand All @@ -148,6 +151,65 @@ const AccountScreen = ({currentUser}: AccountScreenProps) => {
);
}, []);

const handleSetStatus = useCallback(preventDoubleTap(() => {
const items = [
{
action: () => setStatus(ONLINE),
text: {
id: t('mobile.set_status.online'),
defaultMessage: 'Online',
},
},
{
action: () => setStatus(AWAY),
text: {
id: t('mobile.set_status.away'),
defaultMessage: 'Away',
},
},
{
action: () => setStatus(DND),
text: {
id: t('mobile.set_status.dnd'),
defaultMessage: 'Do Not Disturb',
},
},
{
action: () => setStatus(OFFLINE),
text: {
id: t('mobile.set_status.offline'),
defaultMessage: 'Offline',
},
},
];

showModalOverCurrentContext('OptionsModal', {items});
}), []);

const setStatus = useCallback((status: string) => {
if (currentUser.status === OUT_OF_OFFICE) {
dismissModal();

//todo: implement this.confirmReset(status)
return;
}

updateStatus(status);
DeviceEventEmitter.emit(Navigation.NAVIGATION_CLOSE_MODAL);
}, []);

const updateStatus = useCallback((status: string) => {
currentUser.update((user) => {
user.status = status as unknown as string;
});

// todo: send the updated status to server
// this.props.actions.setStatus({
// user_id: currentUser.id,
// status,
// });
}, []);

return (
<SafeAreaView style={styles.container}>
<AnimatedLayout style={{flex: 1}}>
Expand Down Expand Up @@ -184,7 +246,7 @@ const AccountScreen = ({currentUser}: AccountScreenProps) => {
status={currentUser.status}
/>}
separator={false}
onPress={goToSavedMessages} // fixme : do onPress action
onPress={handleSetStatus}
theme={theme}
/>
<DrawerItem
Expand Down