Skip to content

Commit

Permalink
Set geolocation ReactiveVar
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Feb 15, 2019
1 parent 62246ce commit 66066f1
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { messageBox, modal } from 'meteor/rocketchat:ui-utils';
import { fileUpload } from 'meteor/rocketchat:ui';
import { settings } from 'meteor/rocketchat:settings';
import { t } from 'meteor/rocketchat:utils';
import { geolocation } from '../messageBox';

messageBox.actions.add('Create_new', 'Video_message', {
id: 'video-message',
Expand Down Expand Up @@ -63,6 +62,8 @@ messageBox.actions.add('Add_files_from', 'Computer', {
},
});

const geolocation = new ReactiveVar(false);

messageBox.actions.add('Share', 'My_location', {
id: 'share-location',
icon: 'map-pin',
Expand Down Expand Up @@ -97,10 +98,8 @@ messageBox.actions.add('Share', 'My_location', {
});

Meteor.startup(() => {
RocketChat.Geolocation = new ReactiveVar(false);

const handleGeolocation = (position) => RocketChat.Geolocation.set(position);
const handleGeolocationError = () => RocketChat.Geolocation.set(false);
const handleGeolocation = (position) => geolocation.set(position);
const handleGeolocationError = () => geolocation.set(false);

Tracker.autorun(() => {
const isMapViewEnabled = RocketChat.settings.get('MapView_Enabled') === true;
Expand All @@ -110,7 +109,7 @@ Meteor.startup(() => {
isMapViewEnabled && isGeolocationWatchSupported && (googleMapsApiKey && googleMapsApiKey.length);

if (!canGetGeolocation) {
RocketChat.Geolocation.set(false);
geolocation.set(false);
return;
}

Expand Down

0 comments on commit 66066f1

Please sign in to comment.