Commit 6d47c7be authored by thomas craipeau's avatar thomas craipeau
Browse files

update

parent 142acbc4
......@@ -35,7 +35,6 @@ jamielob:reloader
copleykj:livestamp
meteorhacks:async
multiply:iron-router-progress
http@1.4.2
outatime:geolib
meteoric:ionic
255kb:meteor-status
......@@ -73,14 +72,13 @@ aldeed:template-extension
natestrauser:publish-performant-counts
mizzao:user-status
underscore@1.0.10
omega:meteor-desktop-watcher@=2.2.5
omega:meteor-desktop-bundler@=2.2.5
universe:i18n-blaze
universe:i18n
aldeed:collection2
aldeed:schema-index
aldeed:schema-deny
aldeed:autoform@7.0.0
aldeed:autoform@7.0.0!
server-render@0.3.1
fetch
jkuester:http
\ No newline at end of file
......@@ -46,12 +46,12 @@ es5-shim@4.8.0
fastclick@1.0.13
fetch@0.1.1
fourseven:scss@4.12.0
froatsnook:request@2.74.0
froatsnook:valid-email@1.0.0
geojson-utils@1.0.10
hot-code-push@1.0.4
html-tools@1.0.11
htmljs@1.0.11
http@1.4.2
id-map@1.1.0
inter-process-messaging@0.1.1
iron:controller@1.0.12
......@@ -65,6 +65,7 @@ iron:url@1.1.0
jameslefrere:atjs@0.0.1
jameslefrere:caretjs@0.0.1
jamielob:reloader@1.3.0
jkuester:http@2.0.1
jquery@3.0.0
launch-screen@1.2.0
less@2.8.0
......@@ -81,7 +82,7 @@ meteoric:ionic@0.2.0
minifier-css@1.5.3
minifier-js@2.6.0
minimongo@1.6.0
mizzao:timesync@0.5.0
mizzao:timesync@0.5.1
mizzao:user-status@0.6.8
mobile-experience@1.1.0
mobile-status-bar@1.1.0
......@@ -97,8 +98,6 @@ multiply:iron-router-progress@1.0.2
natestrauser:publish-performant-counts@0.1.2
npm-mongo@3.8.1
observe-sequence@1.0.16
omega:meteor-desktop-bundler@2.2.5
omega:meteor-desktop-watcher@2.2.5
ordered-dict@1.1.0
outatime:geolib@2.0.15
promise@0.11.2
......
import { SessionGeo } from './reactive.js';
// https://github.com/cowbell/cordova-plugin-geofence
// meteor add cordova:cordova-plugin-geofence@https://github.com/cowbell/cordova-plugin-geofence/tarball/master
/*
iOS - 20 geofences
Android - 100 geofences
TransitionType.ENTER = 1
TransitionType.EXIT = 2
TransitionType.BOTH = 3
window.geofence.initialize(onSuccess, onError)
window.geofence.addOrUpdate(geofences, onSuccess, onError)
window.geofence.remove(geofenceId, onSuccess, onError)
window.geofence.removeAll(onSuccess, onError)
window.geofence.getWatched(onSuccess, onError)
UNKNOWN
PERMISSION_DENIED
GEOFENCE_NOT_AVAILABLE
GEOFENCE_LIMIT_EXCEEDED
{
id: String, //A unique identifier of geofence
latitude: Number, //Geo latitude of geofence
longitude: Number, //Geo longitude of geofence
radius: Number, //Radius of geofence in meters
transitionType: Number, //Type of transition 1 - Enter, 2 - Exit, 3 - Both
notification: { //Notification object
id: Number, //optional should be integer, id of notification
title: String, //Title of notification
text: String, //Text of notification
smallIcon: String, //Small icon showed in notification area, only res URI
icon: String, //icon showed in notification drawer
openAppOnClick: Boolean,//is main app activity should be opened after clicking on notification
vibration: [Integer], //Optional vibration pattern - see description
data: Object //Custom object associated with notification
}
}
*/
const geofenceApi = {
limit: { Android: 100, iOS: 20 },
geofence: window.geofence,
debug: true,
congig(platform) {
SessionGeo.setDefault('geofenceInitialize', null);
SessionGeo.setDefault('geofenceError', null);
SessionGeo.setDefault('geofencePlatform', null);
SessionGeo.setDefault('geofenceCount', 0);
this.setPlatform(platform);
return this.initialize();
},
setError(error) {
SessionGeo.set('geofenceError', error);
},
async initialize () {
try {
const initialize = await this.geofence.initialize();
if (initialize) {
if (this.debug === true) {
console.log('Successful initialization');
}
SessionGeo.set('geofenceInitialize', true);
return true;
}
return null;
} catch (error) {
if (this.debug === true) {
console.log(error.code);
console.log(error.message);
}
this.setError(error);
return error;
}
/* this.geofence.initialize().then(() => {
if (this.debug === true) {
console.log('Successful initialization');
}
SessionGeo.set('geofenceInitialize', true);
}, this.onError); */
},
async addOrUpdate(geofences) {
try {
const addOrUpdate = await this.geofence.addOrUpdate(geofences);
if (addOrUpdate === 'OK') {
if (this.debug === true) {
console.log(addOrUpdate);
console.log('Geofence successfully added');
}
}
return true;
} catch (error) {
if (this.debug === true) {
console.log('Adding geofence failed', error);
}
SessionGeo.set('geofenceError', error);
return error;
}
/* this.geofence.addOrUpdate(geofences).then(() => {
if (this.debug === true) {
console.log('Geofence successfully added');
}
}, (error) => {
if (this.debug === true) {
console.log('Adding geofence failed', error);
}
SessionGeo.set('geofenceError', error);
}); */
},
setGeofences(geofences) {
// count limit
if (geofences && SessionGeo.get('geofenceInitialize') === true) {
return this.addOrUpdate(geofences);
}
},
async remove(geofenceId) {
try {
const remove = await this.geofence.remove(geofenceId);
if (remove) {
if (this.debug === true) {
console.log('Geofence sucessfully removed');
}
return true;
}
return null;
} catch (error) {
if (this.debug === true) {
console.log('Removing geofence failed', error);
}
return error;
}
/* this.geofence.remove(geofenceId)
.then(() => {
if (this.debug === true) {
console.log('Geofence sucessfully removed');
}
}
, (error) => {
if (this.debug === true) {
console.log('Removing geofence failed', error);
}
}); */
},
async removeAll() {
try {
const removeAll = await this.geofence.removeAll();
if (removeAll) {
if (this.debug === true) {
console.log(removeAll);
console.log('All geofences successfully removed.');
}
return true;
}
return null;
} catch (error) {
if (this.debug === true) {
console.log('Removing geofences failed', error);
}
return error;
}
/* this.geofence.removeAll()
.then(() => {
if (this.debug === true) {
console.log('All geofences successfully removed.');
}
}
, (error) => {
if (this.debug === true) {
console.log('Removing geofences failed', error);
}
}); */
},
async getWatched() {
try {
const geofencesJson = await this.geofence.getWatched();
const geofences = JSON.parse(geofencesJson);
console.log(JSON.stringify(geofences));
return geofences;
} catch (error) {
if (this.debug === true) {
console.log('getWatcheds failed', error);
}
return error;
}
},
setPlatform(platform) {
if (platform === 'Android' || platform === 'iOS') {
SessionGeo.set('geofencePlatform', platform);
}
SessionGeo.set('geofencePlatform', null);
},
getPlatform() {
return SessionGeo.get('geofencePlatform');
},
getLimit() {
const platform = this.getPlatform();
if (platform) {
return this.limit[platform];
}
return null;
},
onTransitionReceived() {
this.geofence.onTransitionReceived = (geofences) => {
geofences.forEach(function (geo) {
console.log(JSON.stringify(geo));
if (geo.transitionType === 1) {
console.log('ENTER');
} else if (geo.transitionType === 2) {
console.log('EXIT');
}
console.log('Geofence transition detected');
});
};
},
onNotificationClicked() {
this.geofence.onNotificationClicked = (notificationData) => {
console.log(JSON.stringify(notificationData));
console.log('App opened from Geo Notification!');
};
},
};
/* const initialize = geofenceApi.initialize();
if (initialize) {
//const removeAll = geofenceApi.removeAll();
//if (removeAll) {
const addOrUpdate = geofenceApi.addOrUpdate({
id: '69ca1b88-6fbe-4e80-a4d4-ff4d3748acdb',
latitude: 50.2980,
longitude: 18.6594,
radius: 10000,
transitionType: TransitionType.BOTH,
notification: {
id: 1,
title: 'test home',
text: 'test home',
icon: 'res://ic_launcher',
openAppOnClick: true,
},
});
console.log(JSON.stringify(addOrUpdate));
if (addOrUpdate) {
const geofencesJson = await geofenceApi.getWatched();
if(geofencesJson){
console.log(JSON.stringify(geofencesJson));
}
}
//}
geofenceApi.onTransitionReceived();
geofenceApi.onNotificationClicked();
} */
export { geofenceApi as default };
......@@ -2,7 +2,7 @@
/* eslint-disable consistent-return */
/* eslint-disable import/prefer-default-export */
import { Meteor } from 'meteor/meteor';
import { HTTP } from 'meteor/http';
import { HTTP } from 'meteor/jkuester:http';
// import { request } from 'meteor/froatsnook:request';
import FormData from 'form-data';
import { fetch } from 'meteor/fetch';
......
......@@ -2,7 +2,7 @@ import { Meteor } from 'meteor/meteor';
import { check, Match } from 'meteor/check';
import { _ } from 'meteor/underscore';
import { moment } from 'meteor/momentjs:moment';
import { HTTP } from 'meteor/http';
import { HTTP } from 'meteor/jkuester:http';
import { URL } from 'meteor/url';
import { ValidatedMethod } from 'meteor/mdg:validated-method';
import SimpleSchema from 'simpl-schema';
......
......@@ -2,7 +2,7 @@ import { Meteor } from 'meteor/meteor';
import { check, Match } from 'meteor/check';
import { Counter } from 'meteor/natestrauser:publish-performant-counts';
import { _ } from 'meteor/underscore';
import { HTTP } from 'meteor/http';
import { HTTP } from 'meteor/jkuester:http';
import { Random } from 'meteor/random';
import { Mongo } from 'meteor/mongo';
......
......@@ -8,7 +8,7 @@ import i18n from 'meteor/universe:i18n';
import SimpleSchema from 'simpl-schema';
import { _ } from 'meteor/underscore';
import { $ } from 'meteor/jquery';
import { HTTP } from 'meteor/http';
import { HTTP } from 'meteor/jkuester:http';
import { Blaze } from 'meteor/blaze';
import { Counter } from 'meteor/natestrauser:publish-performant-counts';
import MarkdownIt from 'markdown-it';
......@@ -396,8 +396,8 @@ Meteor.startup(function () {
},
);
Template.registerHelper('currentFieldValue', function (fieldName) {
return AutoForm.getFieldValue(fieldName) || false;
Template.registerHelper('currentFieldValue', function (fieldName, value) {
return AutoForm.getFieldValue(fieldName) ? AutoForm.getFieldValue(fieldName) : value ? value : false;
});
Template.registerHelper('equalFieldValue', function (fieldName, value) {
......
import 'meteor/aldeed:autoform/static';
import '../../api/simpleschema-messages.js';
import './client.js';
import './permisions.js';
import './locale.js';
import './device.js';
import './reload.js';
// import './videortc.js';
import './position.js';
import './routes.js';
import './push.js';
import './autolinker.js';
// import './sensors.js';
import '../../api/method_both.js';
import './mapbox.js';
import '../../api/client/userTest.js';
......
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
// import sensorApi from '../../api/client/sensors.js';
Meteor.startup(() => {
if (Meteor.isCordova && !Meteor.isDesktop) {
if (device.platform === 'Android') {
//sensorApi.config();
//sensorApi.disables();
/*Tracker.autorun((c) => {
if (Meteor.userId() && Meteor.user()) {
if (sensorApi.get('watch') === null) {
const AMBIENT_TEMPERATURE = sensorApi.get('AMBIENT_TEMPERATURE');
console.log('AMBIENT_TEMPERATURE watch');
console.log(AMBIENT_TEMPERATURE);
if (AMBIENT_TEMPERATURE) {
sensorApi.disable('AMBIENT_TEMPERATURE');
const RELATIVE_HUMIDITY = sensorApi.get('RELATIVE_HUMIDITY');
if (RELATIVE_HUMIDITY) {
sensorApi.disable('RELATIVE_HUMIDITY');
const PRESSURE = sensorApi.get('PRESSURE');
if (PRESSURE) {
sensorApi.disable('PRESSURE');
const LIGHT = sensorApi.get('LIGHT');
if (LIGHT) {
sensorApi.disable('LIGHT');
const PROXIMITY = sensorApi.get('PROXIMITY');
if (PROXIMITY) {
sensorApi.disable('PROXIMITY');
const TEMPERATURE = sensorApi.get('TEMPERATURE');
if (TEMPERATURE) {
sensorApi.disable('TEMPERATURE');
const ACCELEROMETER = sensorApi.get('ACCELEROMETER');
if (ACCELEROMETER) {
sensorApi.disable('ACCELEROMETER');
const GRAVITY = sensorApi.get('GRAVITY');
if (GRAVITY) {
sensorApi.disable('GRAVITY');
const GYROSCOPE = sensorApi.get('GYROSCOPE');
if (GYROSCOPE) {
sensorApi.disable('GYROSCOPE');
const MAGNETIC_FIELD = sensorApi.get('MAGNETIC_FIELD');
if (MAGNETIC_FIELD) {
sensorApi.disable('MAGNETIC_FIELD');
const ROTATION_VECTOR = sensorApi.get('ROTATION_VECTOR');
if (ROTATION_VECTOR) {
sensorApi.disable('ROTATION_VECTOR');
const STEP_COUNTER = sensorApi.get('STEP_COUNTER');
if (STEP_COUNTER) {
sensorApi.disable('STEP_COUNTER');
sensorApi.setEnvironmental({
temperature: AMBIENT_TEMPERATURE,
humidity: RELATIVE_HUMIDITY,
pressure: PRESSURE,
light: LIGHT,
timestamp: (new Date()).getTime() });
console.log(JSON.stringify(sensorApi.getEnvironmental()));
// c.stop();
} else {
sensorApi.getState('STEP_COUNTER');
}
} else {
sensorApi.getState('ROTATION_VECTOR');
}
} else {
sensorApi.getState('MAGNETIC_FIELD');
}
} else {
sensorApi.getState('GYROSCOPE');
}
} else {
sensorApi.getState('GRAVITY');
}
} else {
sensorApi.getState('ACCELEROMETER');
}
} else {
sensorApi.getState('TEMPERATURE');
}
} else {
sensorApi.getState('PROXIMITY');
}
} else {
sensorApi.getState('LIGHT');
}
} else {
sensorApi.getState('PRESSURE');
}
} else {
sensorApi.getState('RELATIVE_HUMIDITY');
}
} else {
sensorApi.getState('AMBIENT_TEMPERATURE');
}
}
}
});*/
}
}
});
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { Router } from 'meteor/iron:router';
import i18n from 'meteor/universe:i18n';
import { IonPopup } from 'meteor/meteoric:ionic';
import Howl from 'howler';
import { VideoCallServices } from 'meteor/elmarti:video-chat';
import { pageVideo } from '../../api/client/reactive.js';
Meteor.startup(() => {
pageVideo.set('showChat', false);
pageVideo.set('showCaller', false);
pageVideo.set('showTarget', false);
VideoCallServices.init({
iceServers: [{
urls: 'turn:numb.viagenie.ca',
credential: 'codjab974',
username: 'thomas.craipeau@gmail.com',
}],
});
const sound = new Howl.Howl({
src: ['sounds/highbell.mp3'],
mobileAutoEnable: true,
usingWebAudio: true,
html5: true,
});
Tracker.autorun((c) => {
if (Meteor.userId() && Meteor.user()) {
VideoCallServices.onReceiveCall = (callerId) => {
Meteor.call('getUser', callerId, (error, user) => {
if (!error) {
pageVideo.set('showChat', user._id._str);
sound.play();
IonPopup.confirm({
title: `<i class="icon fa fa-video-camera"></i> ${i18n.__('You are receiving a phone call')}`,
template: (user.profilThumbImageUrl ? `<div class="list card"><div class="item item-avatar"><img src="${Meteor.settings.public.urlimage}${user.profilThumbImageUrl}"> <h2>${user.name}</h2></div></div>` : `<div class="list card"><div class="item"><h2>${user.name}</h2></div></div>`),
onOk() {
pageVideo.set('showTarget', true);
Router.go('videoRTC');
},
okText: '<i class="icon fa fa-phone"></i>',
okType: 'button-balanced',
cancelText: '<i class="icon fa fa-times"></i>',
cancelType: 'button-assertive',
onCancel() {
pageVideo.set('showChat', false);
pageVideo.set('showTarget', false);
// VideoCallServices.rejectCall()
VideoCallServices.endCall();
},
});
}
});
};
c.stop();
}
});
});
......@@ -209,7 +209,7 @@
{{#if equals block 'locality'}}
{{> afQuickField name='country' autocomplete="off" value=country }}
{{#if currentFieldValue "country"}}
{{#if currentFieldValue "country" country}}
{{> afQuickField name='postalCode' value=postalCode autocomplete="off"}}
{{#if currentFieldValue "postalCode"}}
{{#if optionsInsee}}
......
......@@ -195,7 +195,7 @@
{{/if}}
{{> afQuickField name='country' autocomplete="off" value=country }}
{{#if currentFieldValue "country"}}
{{#if currentFieldValue "country" country}}
{{> afQuickField name='postalCode' value=postalCode autocomplete="off"}}
{{#if currentFieldValue "postalCode"}}
{{#if optionsInsee}}
......
......@@ -257,7 +257,7 @@
{{#if equals block 'locality'}}
{{> afQuickField name='country' autocomplete="off" value=country }}
{{#if currentFieldValue "country"}}
{{#if currentFieldValue "country" country}}
{{> afQuickField name='postalCode' value=postalCode autocomplete="off"}}
{{#if currentFieldValue "postalCode"}}
{{#if optionsInsee}}
......@@ -315,7 +315,7 @@
{{> afQuickField name='startDate' type="datetime-local"}}
{{> afQuickField name='endDate' type="datetime-local"}}
{{> afQuickField name='country' autocomplete="off" value=country }}
{{#if currentFieldValue "country"}}
{{#if currentFieldValue "country" country}}
{{> afQuickField name='postalCode' value=postalCode autocomplete="off"}}
{{#if currentFieldValue "postalCode"}}
{{#if optionsInsee}}
......
......@@ -259,7 +259,7 @@
{{#if equals block 'locality'}}
{{> afQuickField name='country' autocomplete="off" value=country }}
{{#if currentFieldValue "country"}}
{{#if currentFieldValue "country" country}}
{{> afQuickField name='postalCode' value=postalCode autocomplete="off"}}
{{#if currentFieldValue "postalCode"}}
{{#if optionsInsee}}
......@@ -295,7 +295,7 @@
{{> afQuickField name='mobile'}}
{{> afQuickField name='fax'}}
{{> afQuickField name='country' autocomplete="off" value=country }}
{{#if currentFieldValue "country"}}
{{#if currentFieldValue "country" country}}