Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Commit

Permalink
User status fix
Browse files Browse the repository at this point in the history
Signed-off-by: knrt10 <[email protected]>
  • Loading branch information
knrt10 committed Aug 1, 2019
1 parent 93f72e9 commit 5c1173e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/components/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ export class App extends Component {
CustomFields.init();
Hooks.init();
userPresence.init();
userSessionPresence.init();
this.initWidget();

this.setState({ initialized: true });
Expand Down
8 changes: 5 additions & 3 deletions src/lib/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const docActivityEvents = ['mousemove', 'mousedown', 'touchend', 'keydown'];
const token = getToken();
let timer;
let initiated = false;
const awayTime = 3000;
const awayTime = 300000;
let self;
let oldStatus;

Expand Down Expand Up @@ -169,7 +169,8 @@ export const locationUpdate = async() => {
});
navigator.geolocation.getCurrentPosition(async(position) => {
const locationUser = await locationPrimary(position.coords.latitude, position.coords.longitude);
await Livechat.sendLocationData(locationUser);
await Livechat.sendLocationData(locationUser);
userSessionPresence.init();
}, (err) => {
// This means user has denied location access
// We need then to confirm location before starting the chat
Expand All @@ -188,7 +189,8 @@ export const locationUpdate = async() => {
locationAccess: true,
});
const locationUser = await locationBackup();
await Livechat.sendLocationData(locationUser);
await Livechat.sendLocationData(locationUser);
userSessionPresence.init();
}
}
} else {
Expand Down
1 change: 1 addition & 0 deletions src/routes/Chat/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export class ChatContainer extends Component {
this.stopTypingDebounced.stop();
await Promise.all([
this.stopTyping({ rid, username: user.username }),
Livechat.updateSessionStatus('online', token),
Livechat.sendMessage({ msg, token, rid }),
]);
} catch (error) {
Expand Down
2 changes: 0 additions & 2 deletions src/routes/ChatFinished/component.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { Component } from 'preact';
import { Livechat } from '../../api';
import { store } from '../../store';
import { Button } from '../../components/Button';
import { ButtonGroup } from '../../components/ButtonGroup';
import Screen from '../../components/Screen';
Expand Down

0 comments on commit 5c1173e

Please sign in to comment.