@@ -14,12 +14,14 @@ import ZulipButton from '../common/ZulipButton';
1414import { logout } from '../account/logoutActions' ;
1515import { tryStopNotifications } from '../notification/notifTokens' ;
1616import AccountDetails from './AccountDetails' ;
17- import AwayStatusSwitch from './AwayStatusSwitch' ;
18- import { getOwnUser } from '../users/userSelectors' ;
19- import { getIdentity } from '../account/accountsSelectors' ;
17+ import { getOwnUser , getOwnUserId } from '../users/userSelectors' ;
18+ import { getAuth , getIdentity } from '../account/accountsSelectors' ;
2019import { useNavigation } from '../react-navigation' ;
2120import { showConfirmationDialog } from '../utils/info' ;
2221import { OfflineNoticePlaceholder } from '../boot/OfflineNoticeProvider' ;
22+ import { getUserStatus } from '../user-statuses/userStatusesModel' ;
23+ import SwitchRow from '../common/SwitchRow' ;
24+ import * as api from '../api' ;
2325
2426const styles = createStyleSheet ( {
2527 buttonRow : {
@@ -125,14 +127,23 @@ type Props = $ReadOnly<{|
125127 * The profile/settings/account screen we offer among the main tabs of the app.
126128 */
127129export default function ProfileScreen ( props : Props ) : Node {
130+ const auth = useSelector ( getAuth ) ;
128131 const ownUser = useSelector ( getOwnUser ) ;
132+ const ownUserId = useSelector ( getOwnUserId ) ;
133+ const awayStatus = useSelector ( state => getUserStatus ( state , ownUserId ) . away ) ;
129134
130135 return (
131136 < SafeAreaView mode = "padding" edges = { [ 'top' ] } style = { { flex : 1 } } >
132137 < OfflineNoticePlaceholder />
133138 < ScrollView >
134139 < AccountDetails user = { ownUser } showEmail = { false } />
135- < AwayStatusSwitch />
140+ < SwitchRow
141+ label = "Set yourself to away"
142+ value = { awayStatus }
143+ onValueChange = { ( away : boolean ) => {
144+ api . updateUserStatus ( auth , { away } ) ;
145+ } }
146+ />
136147 < View style = { styles . buttonRow } >
137148 < SetStatusButton />
138149 </ View >
0 commit comments