diff --git a/app/js/services.js b/app/js/services.js
index fbb7ce81..4e57111c 100644
--- a/app/js/services.js
+++ b/app/js/services.js
@@ -719,7 +719,7 @@ angular.module('myApp.services', [])
}
})
-.service('AppMessagesManager', function ($q, $rootScope, $location, $filter, ApiUpdatesManager, AppUsersManager, AppChatsManager, AppPeersManager, AppPhotosManager, AppVideoManager, AppDocsManager, AppAudioManager, MtpApiManager, MtpApiFileManager, RichTextProcessor, NotificationsManager, SearchIndexManager, Storage) {
+.service('AppMessagesManager', function ($q, $rootScope, $location, $filter, ApiUpdatesManager, AppUsersManager, AppChatsManager, AppPeersManager, AppPhotosManager, AppVideoManager, AppDocsManager, AppAudioManager, MtpApiManager, MtpApiFileManager, RichTextProcessor, NotificationsManager, SearchIndexManager, PeersSelectService, Storage) {
var messagesStorage = {};
var messagesForHistory = {};
@@ -1961,6 +1961,23 @@ angular.module('myApp.services', [])
}
}
+ if (window.navigator.mozSetMessageHandler) {
+ window.navigator.mozSetMessageHandler('activity', function(activityRequest) {
+ var source = activityRequest.source;
+ console.log(dT(), 'Received activity', source.name, source.data);
+
+ if (source.name === 'share' && source.data.blobs.length > 0) {
+ PeersSelectService.selectPeer({confirm_type: 'EXT_SHARE_PEER'}).then(function (peerString) {
+ var peerID = AppPeersManager.getPeerID(peerString);
+ angular.forEach(source.data.blobs, function (blob) {
+ sendFile(peerID, blob, {isMedia: true});
+ });
+ $rootScope.$broadcast('history_focus', {peerString: peerString});
+ });
+ }
+ });
+ }
+
$rootScope.$on('apiUpdate', function (e, update) {
// if (update._ != 'updateUserStatus') {
// console.log('on apiUpdate', update);
diff --git a/app/manifest.webapp b/app/manifest.webapp
index 7a1ff828..8dd5276b 100644
--- a/app/manifest.webapp
+++ b/app/manifest.webapp
@@ -30,6 +30,14 @@
"description": "Required for notifications"
}
},
+ "activities": {
+ "share": {
+ "href": "/index.html",
+ "disposition": "window",
+ "filters": {},
+ "returnValue": false
+ }
+ },
"orientation": "portrait-primary",
"icons": {
"16": "/img/icons/icon16.png",
diff --git a/app/partials/confirm_modal.html b/app/partials/confirm_modal.html
index f11e846c..a5840e6f 100644
--- a/app/partials/confirm_modal.html
+++ b/app/partials/confirm_modal.html
@@ -34,6 +34,10 @@
?
+ Share with
+
+
+ ?
@@ -53,6 +57,7 @@
Forward photo
Forward video
Send contact
+ Share file
OK