Browse Source

Implemented location sharing.

pull/71/head
Simon Eisenmann 11 years ago
parent
commit
e39b08b79f
  1. 21
      doc/CHANNELING-API.txt
  2. 9
      src/app/spreed-webrtc-server/channeling.go
  3. 31
      src/i18n/messages-de.po
  4. 29
      src/i18n/messages-ja.po
  5. 29
      src/i18n/messages-ko.po
  6. 29
      src/i18n/messages-zh-cn.po
  7. 29
      src/i18n/messages-zh-tw.po
  8. 29
      src/i18n/messages.pot
  9. 15
      static/js/controllers/chatroomcontroller.js
  10. 19
      static/js/directives/chat.js
  11. 49
      static/js/services/geolocation.js
  12. 9
      static/js/services/services.js
  13. 1
      static/partials/chatroom.html
  14. 3
      static/partials/geolocation.html
  15. 2
      static/translation/messages-de.json
  16. 2
      static/translation/messages-ja.json
  17. 2
      static/translation/messages-ko.json
  18. 2
      static/translation/messages-zh-cn.json
  19. 2
      static/translation/messages-zh-tw.json

21
doc/CHANNELING-API.txt

@ -513,6 +513,27 @@ Chat messages and status information
message is shown or not. For file transfer information the message is message is shown or not. For file transfer information the message is
always "File". always "File".
Chat with geo location sharing
{
"Message": "Geolocation",
"Time": "2014-07-10T10:30:03+02:00",
"Status": {
"Geolocation": {
"accuracy": 25000
"latitude": 48.743342
"longitude": 9.320112,
"altitude": 278.691223
"altitudeAccuracy" 13.969156
}
}
}
The latitude and longitude attributes are geographic coordinates
specified in decimal degrees. Altitude and altitudeAccuracy are
specified in meters. All values are of type float64.
Chat with contact request/confirm information Chat with contact request/confirm information
Request to create a contact token with Id. Request to create a contact token with Id.

9
src/app/spreed-webrtc-server/channeling.go

@ -113,6 +113,7 @@ type DataChatStatus struct {
Mid string `json:",omitempty"` Mid string `json:",omitempty"`
SeenMids []string `json:",omitempty"` SeenMids []string `json:",omitempty"`
FileInfo *DataFileInfo `json:",omitempty"` FileInfo *DataFileInfo `json:",omitempty"`
Geolocation *DataGeolocation `json:",omitempty"`
ContactRequest *DataContactRequest `json:",omitempty"` ContactRequest *DataContactRequest `json:",omitempty"`
AutoCall *DataAutoCall `json:",omitempty"` AutoCall *DataAutoCall `json:",omitempty"`
} }
@ -125,6 +126,14 @@ type DataFileInfo struct {
Type string `json:"type"` Type string `json:"type"`
} }
type DataGeolocation struct {
Accuracy float64 `json:"accuracy,omitempty"`
Latitude float64 `json:"latitude,omitempty"`
Longitude float64 `json:"longitude,omitempty"`
Altitude float64 `json:"altitude,omitempty"`
AltitudeAccuracy float64 `json:"altitudeAccuracy,omitempty"`
}
type DataContactRequest struct { type DataContactRequest struct {
Id string Id string
Success bool Success bool

31
src/i18n/messages-de.po

@ -8,8 +8,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Spreed WebRTC 1.0\n" "Project-Id-Version: Spreed WebRTC 1.0\n"
"Report-Msgid-Bugs-To: simon@struktur.de\n" "Report-Msgid-Bugs-To: simon@struktur.de\n"
"POT-Creation-Date: 2014-07-09 13:19+0200\n" "POT-Creation-Date: 2014-07-10 12:10+0200\n"
"PO-Revision-Date: 2014-07-09 13:20+0100\n" "PO-Revision-Date: 2014-07-10 12:11+0100\n"
"Last-Translator: Simon Eisenmann <simon@struktur.de>\n" "Last-Translator: Simon Eisenmann <simon@struktur.de>\n"
"Language-Team: struktur AG <opensource@struktur.de>\n" "Language-Team: struktur AG <opensource@struktur.de>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n"
@ -87,6 +87,9 @@ msgstr "Video-Anruf starten"
msgid "Upload files" msgid "Upload files"
msgstr "Dateien hochladen" msgstr "Dateien hochladen"
msgid "Share my location"
msgstr "Meinen Standort teilen"
msgid "Clear chat" msgid "Clear chat"
msgstr "Chat löschen" msgstr "Chat löschen"
@ -102,6 +105,12 @@ msgstr "Nachricht hier eingeben..."
msgid "Send" msgid "Send"
msgstr "Senden" msgstr "Senden"
msgid "You have no contacts."
msgstr "Sie haben keine Kontakte."
msgid "Close"
msgstr "Schließen"
msgid "File sharing" msgid "File sharing"
msgstr "Datei-Austausch" msgstr "Datei-Austausch"
@ -193,6 +202,12 @@ msgstr "Abmelden"
msgid "Manage account" msgid "Manage account"
msgstr "Konto verwalten" msgstr "Konto verwalten"
msgid "Contacts"
msgstr "Kontakte"
msgid "Manage contacts"
msgstr "Kontakte verwalten"
msgid "Media" msgid "Media"
msgstr "Kamera / Mikrofon" msgstr "Kamera / Mikrofon"
@ -269,9 +284,6 @@ msgstr ""
"Ihre ID bleibt dennoch gespeichert. Klicken Sie Ausloggen weiter oben um " "Ihre ID bleibt dennoch gespeichert. Klicken Sie Ausloggen weiter oben um "
"die ID zu löschen." "die ID zu löschen."
msgid "Close"
msgstr "Schließen"
msgid "Share by Email" msgid "Share by Email"
msgstr "Per E-Mail teilen" msgstr "Per E-Mail teilen"
@ -387,6 +399,12 @@ msgstr "Sie geben eine Datei frei:"
msgid "Incoming file:" msgid "Incoming file:"
msgstr "Eingehende Datei:" msgstr "Eingehende Datei:"
msgid "You shared your location:"
msgstr "Sie haben Ihren Standort geteilt:"
msgid "Location received:"
msgstr "Standort erhalten:"
msgid "You accepted the contact request." msgid "You accepted the contact request."
msgstr "Sie haben die Kontaktanfrage angenommen." msgstr "Sie haben die Kontaktanfrage angenommen."
@ -483,6 +501,9 @@ msgstr ""
msgid "Use browser language" msgid "Use browser language"
msgstr "Browsereinstellung" msgstr "Browsereinstellung"
msgid "Contacts Manager"
msgstr "Kontakte"
msgid "Meet with me here:" msgid "Meet with me here:"
msgstr "Meeting:" msgstr "Meeting:"

29
src/i18n/messages-ja.po

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Spreed WebRTC 1.0\n" "Project-Id-Version: Spreed WebRTC 1.0\n"
"Report-Msgid-Bugs-To: simon@struktur.de\n" "Report-Msgid-Bugs-To: simon@struktur.de\n"
"POT-Creation-Date: 2014-07-09 13:19+0200\n" "POT-Creation-Date: 2014-07-10 12:10+0200\n"
"PO-Revision-Date: 2014-04-23 22:25+0100\n" "PO-Revision-Date: 2014-04-23 22:25+0100\n"
"Last-Translator: Curt Frisemo <curt.frisemo@spreed.com>\n" "Last-Translator: Curt Frisemo <curt.frisemo@spreed.com>\n"
"Language-Team: Curt Frisemo <curt.frisemo@spreed.com>\n" "Language-Team: Curt Frisemo <curt.frisemo@spreed.com>\n"
@ -88,6 +88,9 @@ msgstr "テレビ電話を始める"
msgid "Upload files" msgid "Upload files"
msgstr "ダウンロード失敗." msgstr "ダウンロード失敗."
msgid "Share my location"
msgstr ""
#, fuzzy #, fuzzy
msgid "Clear chat" msgid "Clear chat"
msgstr "チャットを始める" msgstr "チャットを始める"
@ -104,6 +107,12 @@ msgstr "ここに入力してチャット開始します..."
msgid "Send" msgid "Send"
msgstr "送信" msgstr "送信"
msgid "You have no contacts."
msgstr ""
msgid "Close"
msgstr "閉じる"
msgid "File sharing" msgid "File sharing"
msgstr "ファイル共有" msgstr "ファイル共有"
@ -194,6 +203,12 @@ msgstr ""
msgid "Manage account" msgid "Manage account"
msgstr "" msgstr ""
msgid "Contacts"
msgstr ""
msgid "Manage contacts"
msgstr ""
msgid "Media" msgid "Media"
msgstr "" msgstr ""
@ -268,9 +283,6 @@ msgid ""
" ID." " ID."
msgstr "" msgstr ""
msgid "Close"
msgstr "閉じる"
msgid "Share by Email" msgid "Share by Email"
msgstr "Eメールでシェア" msgstr "Eメールでシェア"
@ -385,6 +397,12 @@ msgstr "あなたの共有ファイル:"
msgid "Incoming file:" msgid "Incoming file:"
msgstr "受信中ファイル:" msgstr "受信中ファイル:"
msgid "You shared your location:"
msgstr ""
msgid "Location received:"
msgstr ""
msgid "You accepted the contact request." msgid "You accepted the contact request."
msgstr "" msgstr ""
@ -475,6 +493,9 @@ msgstr ""
msgid "Use browser language" msgid "Use browser language"
msgstr "ブラウザの言語を使用" msgstr "ブラウザの言語を使用"
msgid "Contacts Manager"
msgstr ""
msgid "Meet with me here:" msgid "Meet with me here:"
msgstr "ここで私と会う:" msgstr "ここで私と会う:"

29
src/i18n/messages-ko.po

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Spreed WebRTC 1.0\n" "Project-Id-Version: Spreed WebRTC 1.0\n"
"Report-Msgid-Bugs-To: simon@struktur.de\n" "Report-Msgid-Bugs-To: simon@struktur.de\n"
"POT-Creation-Date: 2014-07-09 13:19+0200\n" "POT-Creation-Date: 2014-07-10 12:10+0200\n"
"PO-Revision-Date: 2014-04-13 20:30+0900\n" "PO-Revision-Date: 2014-04-13 20:30+0900\n"
"Last-Translator: Curt Frisemo <curt.frisemo@spreed.com>\n" "Last-Translator: Curt Frisemo <curt.frisemo@spreed.com>\n"
"Language-Team: Curt Frisemo <curt.frisemo@spreed.com>\n" "Language-Team: Curt Frisemo <curt.frisemo@spreed.com>\n"
@ -88,6 +88,9 @@ msgstr "화상회의 시작"
msgid "Upload files" msgid "Upload files"
msgstr "다운로드실패" msgstr "다운로드실패"
msgid "Share my location"
msgstr ""
#, fuzzy #, fuzzy
msgid "Clear chat" msgid "Clear chat"
msgstr "대화시작" msgstr "대화시작"
@ -104,6 +107,12 @@ msgstr "대화 입력"
msgid "Send" msgid "Send"
msgstr "전송" msgstr "전송"
msgid "You have no contacts."
msgstr ""
msgid "Close"
msgstr "닫음"
msgid "File sharing" msgid "File sharing"
msgstr "회일 공유" msgstr "회일 공유"
@ -194,6 +203,12 @@ msgstr ""
msgid "Manage account" msgid "Manage account"
msgstr "" msgstr ""
msgid "Contacts"
msgstr ""
msgid "Manage contacts"
msgstr ""
msgid "Media" msgid "Media"
msgstr "" msgstr ""
@ -268,9 +283,6 @@ msgid ""
" ID." " ID."
msgstr "" msgstr ""
msgid "Close"
msgstr "닫음"
msgid "Share by Email" msgid "Share by Email"
msgstr "이메일로 공유" msgstr "이메일로 공유"
@ -385,6 +397,12 @@ msgstr "공유 화일:"
msgid "Incoming file:" msgid "Incoming file:"
msgstr "도착하는 화일:" msgstr "도착하는 화일:"
msgid "You shared your location:"
msgstr ""
msgid "Location received:"
msgstr ""
msgid "You accepted the contact request." msgid "You accepted the contact request."
msgstr "" msgstr ""
@ -475,6 +493,9 @@ msgstr ""
msgid "Use browser language" msgid "Use browser language"
msgstr "브라우저 언어 사용" msgstr "브라우저 언어 사용"
msgid "Contacts Manager"
msgstr ""
msgid "Meet with me here:" msgid "Meet with me here:"
msgstr "나를 여기서 만납니다:" msgstr "나를 여기서 만납니다:"

29
src/i18n/messages-zh-cn.po

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Spreed WebRTC 1.0\n" "Project-Id-Version: Spreed WebRTC 1.0\n"
"Report-Msgid-Bugs-To: simon@struktur.de\n" "Report-Msgid-Bugs-To: simon@struktur.de\n"
"POT-Creation-Date: 2014-07-09 13:19+0200\n" "POT-Creation-Date: 2014-07-10 12:10+0200\n"
"PO-Revision-Date: 2014-05-21 09:54+0800\n" "PO-Revision-Date: 2014-05-21 09:54+0800\n"
"Last-Translator: Michael P.\n" "Last-Translator: Michael P.\n"
"Language-Team: Curt Frisemo <curt.frisemo@spreed.com>\n" "Language-Team: Curt Frisemo <curt.frisemo@spreed.com>\n"
@ -88,6 +88,9 @@ msgstr "开始视频通话"
msgid "Upload files" msgid "Upload files"
msgstr "下载失败" msgstr "下载失败"
msgid "Share my location"
msgstr ""
#, fuzzy #, fuzzy
msgid "Clear chat" msgid "Clear chat"
msgstr "开始聊天" msgstr "开始聊天"
@ -104,6 +107,12 @@ msgstr "在此输入开始聊天..."
msgid "Send" msgid "Send"
msgstr "发送" msgstr "发送"
msgid "You have no contacts."
msgstr ""
msgid "Close"
msgstr "关闭"
msgid "File sharing" msgid "File sharing"
msgstr "分享文件" msgstr "分享文件"
@ -194,6 +203,12 @@ msgstr ""
msgid "Manage account" msgid "Manage account"
msgstr "" msgstr ""
msgid "Contacts"
msgstr ""
msgid "Manage contacts"
msgstr ""
msgid "Media" msgid "Media"
msgstr "" msgstr ""
@ -268,9 +283,6 @@ msgid ""
" ID." " ID."
msgstr "" msgstr ""
msgid "Close"
msgstr "关闭"
msgid "Share by Email" msgid "Share by Email"
msgstr "电子邮件共享" msgstr "电子邮件共享"
@ -385,6 +397,12 @@ msgstr "分享文件:"
msgid "Incoming file:" msgid "Incoming file:"
msgstr "发来文件:" msgstr "发来文件:"
msgid "You shared your location:"
msgstr ""
msgid "Location received:"
msgstr ""
msgid "You accepted the contact request." msgid "You accepted the contact request."
msgstr "" msgstr ""
@ -474,6 +492,9 @@ msgstr ""
msgid "Use browser language" msgid "Use browser language"
msgstr "使用浏览器语言" msgstr "使用浏览器语言"
msgid "Contacts Manager"
msgstr ""
msgid "Meet with me here:" msgid "Meet with me here:"
msgstr "我们这里见:" msgstr "我们这里见:"

29
src/i18n/messages-zh-tw.po

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Spreed WebRTC 1.0\n" "Project-Id-Version: Spreed WebRTC 1.0\n"
"Report-Msgid-Bugs-To: simon@struktur.de\n" "Report-Msgid-Bugs-To: simon@struktur.de\n"
"POT-Creation-Date: 2014-07-09 13:19+0200\n" "POT-Creation-Date: 2014-07-10 12:10+0200\n"
"PO-Revision-Date: 2014-05-21 09:55+0800\n" "PO-Revision-Date: 2014-05-21 09:55+0800\n"
"Last-Translator: Michael P.\n" "Last-Translator: Michael P.\n"
"Language-Team: Curt Frisemo <curt.frisemo@spreed.com>\n" "Language-Team: Curt Frisemo <curt.frisemo@spreed.com>\n"
@ -88,6 +88,9 @@ msgstr "開始視頻通話"
msgid "Upload files" msgid "Upload files"
msgstr "下載失敗" msgstr "下載失敗"
msgid "Share my location"
msgstr ""
#, fuzzy #, fuzzy
msgid "Clear chat" msgid "Clear chat"
msgstr "開始聊天" msgstr "開始聊天"
@ -104,6 +107,12 @@ msgstr "在此輸入開始聊天..."
msgid "Send" msgid "Send"
msgstr "發送" msgstr "發送"
msgid "You have no contacts."
msgstr ""
msgid "Close"
msgstr "關閉"
msgid "File sharing" msgid "File sharing"
msgstr "分享文件" msgstr "分享文件"
@ -194,6 +203,12 @@ msgstr ""
msgid "Manage account" msgid "Manage account"
msgstr "" msgstr ""
msgid "Contacts"
msgstr ""
msgid "Manage contacts"
msgstr ""
msgid "Media" msgid "Media"
msgstr "" msgstr ""
@ -268,9 +283,6 @@ msgid ""
" ID." " ID."
msgstr "" msgstr ""
msgid "Close"
msgstr "關閉"
msgid "Share by Email" msgid "Share by Email"
msgstr "電子郵件共享" msgstr "電子郵件共享"
@ -385,6 +397,12 @@ msgstr "分享文件:"
msgid "Incoming file:" msgid "Incoming file:"
msgstr "發來文件:" msgstr "發來文件:"
msgid "You shared your location:"
msgstr ""
msgid "Location received:"
msgstr ""
msgid "You accepted the contact request." msgid "You accepted the contact request."
msgstr "" msgstr ""
@ -474,6 +492,9 @@ msgstr ""
msgid "Use browser language" msgid "Use browser language"
msgstr "使用瀏覽器語言" msgstr "使用瀏覽器語言"
msgid "Contacts Manager"
msgstr ""
msgid "Meet with me here:" msgid "Meet with me here:"
msgstr "我們這裡見:" msgstr "我們這裡見:"

29
src/i18n/messages.pot

@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Spreed WebRTC 1.0\n" "Project-Id-Version: Spreed WebRTC 1.0\n"
"Report-Msgid-Bugs-To: simon@struktur.de\n" "Report-Msgid-Bugs-To: simon@struktur.de\n"
"POT-Creation-Date: 2014-07-09 13:19+0200\n" "POT-Creation-Date: 2014-07-10 12:10+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -87,6 +87,9 @@ msgstr ""
msgid "Upload files" msgid "Upload files"
msgstr "" msgstr ""
msgid "Share my location"
msgstr ""
msgid "Clear chat" msgid "Clear chat"
msgstr "" msgstr ""
@ -102,6 +105,12 @@ msgstr ""
msgid "Send" msgid "Send"
msgstr "" msgstr ""
msgid "You have no contacts."
msgstr ""
msgid "Close"
msgstr ""
msgid "File sharing" msgid "File sharing"
msgstr "" msgstr ""
@ -191,6 +200,12 @@ msgstr ""
msgid "Manage account" msgid "Manage account"
msgstr "" msgstr ""
msgid "Contacts"
msgstr ""
msgid "Manage contacts"
msgstr ""
msgid "Media" msgid "Media"
msgstr "" msgstr ""
@ -265,9 +280,6 @@ msgid ""
" ID." " ID."
msgstr "" msgstr ""
msgid "Close"
msgstr ""
msgid "Share by Email" msgid "Share by Email"
msgstr "" msgstr ""
@ -381,6 +393,12 @@ msgstr ""
msgid "Incoming file:" msgid "Incoming file:"
msgstr "" msgstr ""
msgid "You shared your location:"
msgstr ""
msgid "Location received:"
msgstr ""
msgid "You accepted the contact request." msgid "You accepted the contact request."
msgstr "" msgstr ""
@ -467,6 +485,9 @@ msgstr ""
msgid "Use browser language" msgid "Use browser language"
msgstr "" msgstr ""
msgid "Contacts Manager"
msgstr ""
msgid "Meet with me here:" msgid "Meet with me here:"
msgstr "" msgstr ""

15
static/js/controllers/chatroomcontroller.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
define(['underscore', 'moment', 'text!partials/fileinfo.html', 'text!partials/contactrequest.html'], function(_, moment, templateFileInfo, templateContactRequest) { define(['underscore', 'moment', 'text!partials/fileinfo.html', 'text!partials/contactrequest.html', 'text!partials/geolocation.html'], function(_, moment, templateFileInfo, templateContactRequest, templateGeolocation) {
// ChatroomController // ChatroomController
return ["$scope", "$element", "$window", "safeMessage", "safeDisplayName", "$compile", "$filter", "translation", function($scope, $element, $window, safeMessage, safeDisplayName, $compile, $filter, translation) { return ["$scope", "$element", "$window", "safeMessage", "safeDisplayName", "$compile", "$filter", "translation", function($scope, $element, $window, safeMessage, safeDisplayName, $compile, $filter, translation) {
@ -47,6 +47,7 @@ define(['underscore', 'moment', 'text!partials/fileinfo.html', 'text!partials/co
var buddyImageSrc = $filter("buddyImageSrc"); var buddyImageSrc = $filter("buddyImageSrc");
var fileInfo = $compile(templateFileInfo); var fileInfo = $compile(templateFileInfo);
var contactRequest = $compile(templateContactRequest); var contactRequest = $compile(templateContactRequest);
var geoLocation = $compile(templateGeolocation);
var knowMessage = { var knowMessage = {
r: {}, r: {},
@ -458,6 +459,18 @@ define(['underscore', 'moment', 'text!partials/fileinfo.html', 'text!partials/co
noop = true; noop = true;
} }
// Geolocation sharing.
if (data.Status.Geolocation) {
subscope = $scope.$new();
subscope.info = data.Status.Geolocation;
subscope.from = from;
geoLocation(subscope, function(clonedElement, scope) {
var text = fromself ? translation._("You shared your location:") : translation._("Location received:");
element = $scope.showmessage(from, timestamp, text, clonedElement);
});
noop = true;
}
// Contact request. // Contact request.
if (data.Status.ContactRequest) { if (data.Status.ContactRequest) {
subscope = $scope.$new(); subscope = $scope.$new();

19
static/js/directives/chat.js

@ -20,7 +20,7 @@
*/ */
define(['underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'], function(_, templateChat, templateChatroom) { define(['underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'], function(_, templateChat, templateChatroom) {
return ["$compile", "safeDisplayName", "mediaStream", "safeApply", "desktopNotify", "translation", "playSound", "fileUpload", "randomGen", "buddyData", "appData", "$timeout", function($compile, safeDisplayName, mediaStream, safeApply, desktopNotify, translation, playSound, fileUpload, randomGen, buddyData, appData, $timeout) { return ["$compile", "safeDisplayName", "mediaStream", "safeApply", "desktopNotify", "translation", "playSound", "fileUpload", "randomGen", "buddyData", "appData", "$timeout", "geolocation", function($compile, safeDisplayName, mediaStream, safeApply, desktopNotify, translation, playSound, fileUpload, randomGen, buddyData, appData, $timeout, geolocation) {
var displayName = safeDisplayName; var displayName = safeDisplayName;
var group_chat_id = ""; var group_chat_id = "";
@ -296,6 +296,23 @@ define(['underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'],
subscope.doCall = function() { subscope.doCall = function() {
mediaStream.webrtc.doCall(subscope.id); mediaStream.webrtc.doCall(subscope.id);
}; };
subscope.shareGeolocation = function() {
geolocation.getCurrentPosition(function(pos) {
var info = {
accuracy: pos.coords.accuracy || null,
latitude: pos.coords.latitude || null,
longitude: pos.coords.longitude || null,
altitude: pos.coords.altitude || null,
altitudeAccuracy: pos.coords.altitudeAccuracy || null
}
console.log("Sending geo location", info, pos);
subscope.sendChat(subscope.id, "Geolocation", {
Geolocation: info
});
}, function(err) {
console.error("Failed to receive geolocation", err);
});
};
subscope.doClear = function() { subscope.doClear = function() {
subscope.$broadcast("clear"); subscope.$broadcast("clear");
}; };

49
static/js/services/geolocation.js

@ -0,0 +1,49 @@
/*
* Spreed WebRTC.
* Copyright (C) 2013-2014 struktur AG
*
* This file is part of Spreed WebRTC.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
define(['underscore', 'modernizr'], function(_, Modernizr) {
var supported = Modernizr.geolocation;
// geolocation
return [function() {
var defaults = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
};
return {
getCurrentPosition: function(success, error, options) {
if (!supported) {
if (error) {
error(new Error("geolocation api is not supported"));
}
return
}
var opts = _.extend({}, defaults, options);
navigator.geolocation.getCurrentPosition(success, error, opts);
}
}
}];
});

9
static/js/services/services.js

@ -50,7 +50,8 @@ define([
'services/buddysession', 'services/buddysession',
'services/localstorage', 'services/localstorage',
'services/animationframe', 'services/animationframe',
'services/dialogs'], function(_, 'services/dialogs',
'services/geolocation'], function(_,
desktopNotify, desktopNotify,
playSound, playSound,
safeApply, safeApply,
@ -80,7 +81,8 @@ contacts,
buddySession, buddySession,
localStorage, localStorage,
animationFrame, animationFrame,
dialogs) { dialogs,
geolocation) {
var services = { var services = {
desktopNotify: desktopNotify, desktopNotify: desktopNotify,
@ -112,7 +114,8 @@ dialogs) {
buddySession: buddySession, buddySession: buddySession,
localStorage: localStorage, localStorage: localStorage,
animationFrame: animationFrame, animationFrame: animationFrame,
dialogs: dialogs dialogs: dialogs,
geolocation: geolocation
}; };
var initialize = function(angModule) { var initialize = function(angModule) {

1
static/partials/chatroom.html

@ -4,6 +4,7 @@
<div class="btn-group"> <div class="btn-group">
<button ng-if="!isgroupchat" class="btn btn-sm btn-primary" title="{{_('Start video call')}}" ng-click="doCall()"><i class="fa fa-phone fa-fw"></i></button> <button ng-if="!isgroupchat" class="btn btn-sm btn-primary" title="{{_('Start video call')}}" ng-click="doCall()"><i class="fa fa-phone fa-fw"></i></button>
<button class="btn btn-sm btn-primary btn-fileupload" title="{{_('Upload files')}}"><i class="fa fa-upload fa-fw"></i></button> <button class="btn btn-sm btn-primary btn-fileupload" title="{{_('Upload files')}}"><i class="fa fa-upload fa-fw"></i></button>
<button class="btn btn-sm btn-primary" title="{{_('Share my location')}}" ng-click="shareGeolocation()"><i class="fa fa-location-arrow fa-fw"></i></button>
</div> </div>
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<button class="btn btn-sm btn-default" title="{{_('Clear chat')}}" ng-click="doClear()"><i class="fa fa-eraser fa-fw"></i></button> <button class="btn btn-sm btn-default" title="{{_('Clear chat')}}" ng-click="doClear()"><i class="fa fa-eraser fa-fw"></i></button>

3
static/partials/geolocation.html

@ -0,0 +1,3 @@
<div class="geolocation">
<div><i class="fa fa-location-arrow"></i> <a rel="external" href="https://maps.google.com/maps?q={{info.latitude}},{{info.longitude}}">{{info.latitude|number:6}}&ordm; {{info.longitude|number:6}}&ordm; &plusmn;{{info.accuracy|number:0}}m</a></div>
</div>

2
static/translation/messages-de.json

File diff suppressed because one or more lines are too long

2
static/translation/messages-ja.json

File diff suppressed because one or more lines are too long

2
static/translation/messages-ko.json

File diff suppressed because one or more lines are too long

2
static/translation/messages-zh-cn.json

File diff suppressed because one or more lines are too long

2
static/translation/messages-zh-tw.json

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save