Browse Source

Bugfixes

master
Igor Zhukov 9 years ago
parent
commit
c5be224add
  1. 5
      app/js/controllers.js
  2. 1
      app/js/lib/config.js
  3. 16
      app/js/messages_manager.js
  4. 18
      app/js/services.js
  5. 18
      app/manifest.webapp
  6. 4
      gulpfile.js

5
app/js/controllers.js

@ -2282,6 +2282,11 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -2282,6 +2282,11 @@ angular.module('myApp.controllers', ['myApp.i18n'])
forceDraft = $scope.curDialog.peer;
$scope.draftMessage.fwdMessages = attachment.id;
$scope.$broadcast('ui_peer_reply');
var peerID = AppPeersManager.getPeerID($scope.curDialog.peer);
Storage.get('draft' + peerID).then(function (draftText) {
$scope.draftMessage.text = draftText || '';
$scope.$broadcast('ui_peer_draft');
});
}
}

1
app/js/lib/config.js

@ -44,6 +44,7 @@ Config.Navigator = { @@ -44,6 +44,7 @@ Config.Navigator = {
(navigator.userAgent || '').toLowerCase().indexOf('mac') != -1,
retina: window.devicePixelRatio > 1,
ffos: navigator.userAgent.search(/mobi.+Gecko/i) != -1,
ffos2p: navigator.userAgent.search(/mobi.+Gecko\/[34567]/i) != -1,
touch: screen.width <= 768 || ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch,
mobile: screen.width && screen.width < 480 || navigator.userAgent.search(/iOS|iPhone OS|Android|BlackBerry|BB10|Series ?[64]0|J2ME|MIDP|opera mini|opera mobi|mobi.+Gecko|Windows Phone/i) != -1
};

16
app/js/messages_manager.js

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
angular.module('myApp.services')
.service('AppMessagesManager', function ($q, $rootScope, $location, $filter, $timeout, $sce, ApiUpdatesManager, AppUsersManager, AppChatsManager, AppPeersManager, AppPhotosManager, AppVideoManager, AppDocsManager, AppStickersManager, AppAudioManager, AppWebPagesManager, MtpApiManager, MtpApiFileManager, RichTextProcessor, NotificationsManager, PeersSelectService, Storage, AppProfileManager, FileManager, TelegramMeWebService, ErrorService, StatusManager, _) {
.service('AppMessagesManager', function ($q, $rootScope, $location, $filter, $timeout, $sce, ApiUpdatesManager, AppUsersManager, AppChatsManager, AppPeersManager, AppPhotosManager, AppVideoManager, AppDocsManager, AppStickersManager, AppAudioManager, AppWebPagesManager, MtpApiManager, MtpApiFileManager, RichTextProcessor, NotificationsManager, PeersSelectService, Storage, AppProfileManager, TelegramMeWebService, ErrorService, StatusManager, _) {
var messagesStorage = {};
var messagesForHistory = {};
@ -940,15 +940,14 @@ angular.module('myApp.services') @@ -940,15 +940,14 @@ angular.module('myApp.services')
function deleteMessages (messageIDs) {
var splitted = splitMessageIDsByChannels(messageIDs);
debugger;
var promises = [];
angular.forEach(splitted.msgIDs, function (msgIDs, channelID) {
var promise;
if (channelID > 0) {
var channel = AppChatsManager.getChat(channelID);
if (!channel.pFlags.creator) {
if (!channel.pFlags.creator && !(channel.pFlags.editor && channel.pFlags.megagroup)) {
var goodMsgIDs = [];
if (channel.pFlags.editor) {
if (channel.pFlags.editor || channel.pFlags.megagroup) {
angular.forEach(msgIDs, function (msgID, i) {
var message = getMessage(splitted.mids[channelID][i]);
if (message.pFlags.out) {
@ -2460,15 +2459,13 @@ angular.module('myApp.services') @@ -2460,15 +2459,13 @@ angular.module('myApp.services')
};
notification.message = notificationMessage;
notification.image = notificationPhoto.placeholder;
notification.key = 'msg' + message.mid;
notification.tag = peerString;
if (notificationPhoto.location && !notificationPhoto.location.empty) {
MtpApiFileManager.downloadSmallFile(notificationPhoto.location, notificationPhoto.size).then(function (blob) {
notification.image = FileManager.getUrl(blob, 'image/jpeg');
if (message.pFlags.unread) {
notification.image = blob;
NotificationsManager.notify(notification);
}
});
@ -2478,6 +2475,7 @@ angular.module('myApp.services') @@ -2478,6 +2475,7 @@ angular.module('myApp.services')
}
if (window.navigator.mozSetMessageHandler) {
console.warn('set message handler');
window.navigator.mozSetMessageHandler('activity', function(activityRequest) {
var source = activityRequest.source;
console.log(dT(), 'Received activity', source.name, source.data);
@ -2803,8 +2801,8 @@ angular.module('myApp.services') @@ -2803,8 +2801,8 @@ angular.module('myApp.services')
angular.forEach(historiesUpdated, function (updatedData, peerID) {
var foundDialog = getDialogByPeerID(peerID);
if (foundDialog) {
if (updatedData.pFlags.unread) {
foundDialog[0].unread_count -= updatedData.pFlags.unread;
if (updatedData.unread) {
foundDialog[0].unread_count -= updatedData.unread;
$rootScope.$broadcast('dialog_unread', {peerID: peerID, count: foundDialog[0].unread_count});
}

18
app/js/services.js

@ -2979,7 +2979,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -2979,7 +2979,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
})
.service('NotificationsManager', function ($rootScope, $window, $interval, $q, _, MtpApiManager, AppPeersManager, IdleManager, Storage, AppRuntimeManager) {
.service('NotificationsManager', function ($rootScope, $window, $interval, $q, _, MtpApiManager, AppPeersManager, IdleManager, Storage, AppRuntimeManager, FileManager) {
navigator.vibrate = navigator.vibrate || navigator.mozVibrate || navigator.webkitVibrate;
@ -3204,12 +3204,24 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -3204,12 +3204,24 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
// console.log('notify', $rootScope.idle.isIDLE, notificationsUiSupport);
// FFOS Notification blob src bug workaround
if (Config.Navigator.ffos) {
data.image = 'https://raw.githubusercontent.com/zhukov/webogram/master/app/img/icons/icon60.png';
if (Config.Navigator.ffos && !Config.Navigator.ffos2p) {
data.image = 'https://telegram.org/img/t_logo.png';
}
else if (data.image && !angular.isString(data.image)) {
if (Config.Navigator.ffos2p) {
FileManager.getDataUrl(data.image, 'image/jpeg').then(function (url) {
data.image = url;
notify(data);
});
return false;
} else {
data.image = FileManager.getUrl(data.image, 'image/jpeg');
}
}
else if (!data.image) {
data.image = 'img/icons/icon60.png';
}
console.log('notify image', data.image);
notificationsCount++;

18
app/manifest.webapp

@ -49,11 +49,23 @@ @@ -49,11 +49,23 @@
"activities": {
"share": {
"href": "/index.html",
"disposition": "window",
"filters": {
"type": ["image/*","audio/*","video/*"]
"type": ["image/*","audio/*","video/*", "url"],
"url": {
"required": true,
"regexp": "/^https?:/"
}
}
},
"returnValue": false
"view": {
"href": "/index.html",
"filters": {
"type": "url",
"url": {
"required": true,
"regexp": "/^tg:/"
}
}
}
},
"orientation": "portrait-primary",

4
gulpfile.js

@ -203,6 +203,8 @@ gulp.task('package-dev', function() { @@ -203,6 +203,8 @@ gulp.task('package-dev', function() {
.pipe(gulp.dest('dist_package/img')),
gulp.src('app/vendor/**/*')
.pipe(gulp.dest('dist_package/vendor')),
gulp.src('app/**/*.json')
.pipe(gulp.dest('dist_package')),
gulp.src('app/**/*.html')
.pipe($.replace(/PRODUCTION_ONLY_BEGIN/g, 'PRODUCTION_ONLY_BEGIN-->'))
@ -210,7 +212,7 @@ gulp.task('package-dev', function() { @@ -210,7 +212,7 @@ gulp.task('package-dev', function() {
.pipe(gulp.dest('dist_package')),
gulp.src('app/**/*.js')
.pipe($.ngmin())
.pipe($.ngAnnotate())
.pipe($.replace(/PRODUCTION_ONLY_BEGIN(\*\/)?/g, 'PRODUCTION_ONLY_BEGIN*/'))
.pipe($.replace(/(\/\*)?PRODUCTION_ONLY_END/g, '/*PRODUCTION_ONLY_END'))
.pipe(gulp.dest('dist_package'))

Loading…
Cancel
Save