Browse Source

Improved FxOS downloads

master
Igor Zhukov 10 years ago
parent
commit
b69df79e85
  1. 3
      app/css/app.css
  2. 3
      app/css/mobile.css
  3. 20
      app/js/lib/ng_utils.js
  4. 2
      app/js/services.js
  5. 16
      app/manifest.webapp

3
app/css/app.css

@ -1870,6 +1870,9 @@ img.img_fullsize {
-ms-interpolation-mode: nearest-neighbor; /* IE8+ */ -ms-interpolation-mode: nearest-neighbor; /* IE8+ */
} }
.video_full_player video {
background: #000;
}
.media_modal_info { .media_modal_info {
color: #999; color: #999;

3
app/css/mobile.css

@ -1166,6 +1166,9 @@ a.mobile_modal_action .tg_checkbox_label {
font-size: 13px; font-size: 13px;
height: 46px; height: 46px;
} }
.media_modal_top_actions .navbar-quick-media-back:hover {
text-decoration: none;
}
.media_modal_top_actions .navbar-quick-media-back .icon-back { .media_modal_top_actions .navbar-quick-media-back .icon-back {
position: absolute; position: absolute;
margin-left: -18px; margin-left: -18px;

20
app/js/lib/ng_utils.js

@ -214,6 +214,26 @@ angular.module('izhukov.utils', [])
window.navigator.msSaveBlob(blob, fileName); window.navigator.msSaveBlob(blob, fileName);
return false; return false;
} }
if (window.navigator && navigator.getDeviceStorage) {
var storageName = 'sdcard';
switch (mimeType.split('/')[0]) {
case 'video': storageName = 'videos'; break;
case 'audio': storageName = 'music'; break;
case 'image': storageName = 'pictures'; break;
}
var deviceStorage = navigator.getDeviceStorage(storageName);
var request = deviceStorage.addNamed(blob, fileName);
request.onsuccess = function () {
console.log('Device storage save result', this.result);
};
request.onerror = function () {
};
return;
}
getFileCorrectUrl(blob, mimeType).then(function (url) { getFileCorrectUrl(blob, mimeType).then(function (url) {
var anchor = document.createElementNS('http://www.w3.org/1999/xhtml', 'a'); var anchor = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
anchor.href = url; anchor.href = url;

2
app/js/services.js

@ -2573,7 +2573,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
function saveVideoFile (videoID) { function saveVideoFile (videoID) {
var video = videos[videoID], var video = videos[videoID],
mimeType = video.mime_type || 'video/mpeg4', mimeType = video.mime_type || 'video/mp4',
fileExt = mimeType.split('.')[1] || 'mp4', fileExt = mimeType.split('.')[1] || 'mp4',
fileName = 't_video' + videoID + '.' + fileExt, fileName = 't_video' + videoID + '.' + fileExt,
historyVideo = videosForHistory[videoID] || video || {}; historyVideo = videosForHistory[videoID] || video || {};

16
app/manifest.webapp

@ -28,6 +28,22 @@
}, },
"push": { "push": {
"description": "Required for notifications" "description": "Required for notifications"
},
"device-storage:music": {
"description": "Required for voice notes download",
"access": "createonly"
},
"device-storage:pictures": {
"description": "Required for photos download",
"access": "createonly"
},
"device-storage:sdcard": {
"description": "Required for documents download",
"access": "createonly"
},
"device-storage:videos": {
"description": "Required for videos download",
"access": "createonly"
} }
}, },
"activities": { "activities": {

Loading…
Cancel
Save