diff --git a/app/js/controllers.js b/app/js/controllers.js index e6e05dc1..f1336cf1 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -2150,8 +2150,8 @@ angular.module('myApp.controllers', ['myApp.i18n']) var lastIsRead = !historyMessage || !historyMessage.pFlags.unread for (i = 0; i < len; i++) { messageID = msgs[i] - if (messageID < maxID || - history.ids.indexOf(messageID) !== -1) { + if (messageID > 0 && messageID < maxID || + history.ids.indexOf(messageID) !== -1) { continue } historyMessage = AppMessagesManager.wrapForHistory(messageID) diff --git a/app/js/lib/mtproto_wrapper.js b/app/js/lib/mtproto_wrapper.js index eda656d0..50fda25f 100644 --- a/app/js/lib/mtproto_wrapper.js +++ b/app/js/lib/mtproto_wrapper.js @@ -157,6 +157,10 @@ angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto']) } deferred.reject(error) + if (error.code == 406) { + error.handled = true + } + if (!options.noErrorBox) { error.input = method error.stack = stack || (error.originalError && error.originalError.stack) || error.stack || (new Error()).stack diff --git a/app/js/locales/en-us.json b/app/js/locales/en-us.json index 401da1a9..689896a9 100644 --- a/app/js/locales/en-us.json +++ b/app/js/locales/en-us.json @@ -187,6 +187,8 @@ "changelog_modal_header_recent_updates_md": "Recent updates in **Telegram Web**", "changelog_modal_header_new_updates_md": "**Telegram Web** has been updated!", "changelog_modal_title_current_version": "current version", + "changelog_modal_full_description_md": "Official free messaging app based on Telegram API for speed and security.\n\nThis software is licensed under GNU GPL version 3.", + "changelog_modal_changelog_link": "Changelog", "group_create_contacts_modal_title": "New group", "group_create_modal_title": "Create group", @@ -419,7 +421,6 @@ "error_modal_media_not_supported_description": "Your browser cannot play this media file. Try downloading the file and opening it in a standalone player.", "error_modal_username_not_found_description": "There is no Telegram account with the username you provided.", "error_modal_phonecalls_not_supported_description_md": "Unfortunately calls are not supported in the Web App at the moment.\n\nYou can call {user} using our mobile apps or native desktop applications.\n{download-link: Download »}", - "error_modal_fresh_reset_authorization_forbidden": "For security reasons, you can't terminate older sessions from a device that you've just connected. Please use an earlier connection or wait for a few hours", "error_modal_app_signup_forbidden_md": "You don't have a Telegram account yet, please **sign up** with {signup-link: Android / iPhone} first.", "error_modal_bad_request_description": "One of the params is missing or invalid.", diff --git a/app/js/messages_manager.js b/app/js/messages_manager.js index 41911b19..29baa25b 100644 --- a/app/js/messages_manager.js +++ b/app/js/messages_manager.js @@ -18,6 +18,7 @@ angular.module('myApp.services') var pendingByRandomID = {} var pendingByMessageID = {} var pendingAfterMsgs = {} + var pendingTopMsgs = {} var sendFilePromise = $q.when() var tempID = -1 @@ -181,7 +182,11 @@ angular.module('myApp.services') if (historiesStorage[peerID] === undefined && !message.deleted) { - var historyStorage = {count: null, history: [mid], pending: []} + var historyStorage = {count: null, history: [], pending: []} + historyStorage[mid > 0 ? 'history' : 'pending'].push(mid) + if (mid < 0 && message.pFlags.unread) { + dialog.unread_count++ + } historiesStorage[peerID] = historyStorage if (mergeReplyKeyboard(historyStorage, message)) { $rootScope.$broadcast('history_reply_markup', {peerID: peerID}) @@ -526,6 +531,9 @@ angular.module('myApp.services') historyStorage = historiesStorage[peerID] = {count: null, history: [], pending: []} } + if (maxID < 0) { + maxID = 0 + } var isMigrated = false var reqPeerID = peerID if (migratedToFrom[peerID]) { @@ -3007,29 +3015,30 @@ angular.module('myApp.services') saveMessages([message], {isNew: true}) // console.warn(dT(), 'message unread', message.mid, message.pFlags.unread) - if (historyStorage !== undefined) { - var history = historyStorage.history - if (history.indexOf(message.mid) != -1) { - return false - } - var topMsgID = history[0] - history.unshift(message.mid) - if (message.mid > 0 && message.mid < topMsgID) { - history.sort(function (a, b) { - return b - a - }) - } - if (historyStorage.count !== null) { - historyStorage.count++ - } - } else { - historyStorage = historiesStorage[peerID] = { + if (historyStorage === undefined) { + historyStorage = historiesStorage[peerID] = { count: null, - history: [message.mid], + history: [], pending: [] } } + var history = message.mid > 0 ? historyStorage.history : historyStorage.pending + if (history.indexOf(message.mid) != -1) { + return false + } + var topMsgID = history[0] + history.unshift(message.mid) + if (message.mid > 0 && message.mid < topMsgID) { + history.sort(function (a, b) { + return b - a + }) + } + if (message.mid > 0 && + historyStorage.count !== null) { + historyStorage.count++ + } + if (mergeReplyKeyboard(historyStorage, message)) { $rootScope.$broadcast('history_reply_markup', {peerID: peerID}) } @@ -3466,6 +3475,49 @@ angular.module('myApp.services') }) } break + + case 'updateServiceNotification': + // update.inbox_date = tsNow(true) + // update.pFlags = {popup: true} + var fromID = 777000 + var peerID = fromID + var messageID = tempID-- + var message = { + _: 'message', + id: messageID, + from_id: fromID, + to_id: AppPeersManager.getOutputPeer(peerID), + flags: 0, + pFlags: {unread: true}, + date: (update.inbox_date || tsNow(true)) + ServerTimeManager.serverTimeOffset, + message: update.message, + media: update.media, + entities: update.entities + } + if (!AppUsersManager.hasUser(fromID)) { + AppUsersManager.saveApiUsers([{ + _: 'user', + id: fromID, + pFlags: {verified: true}, + access_hash: 0, + first_name: 'Telegram', + phone: '42777' + }]) + } + saveMessages([message]) + + if (update.inbox_date) { + pendingTopMsgs[peerID] = messageID + handleUpdate({ + _: 'updateNewMessage', + message: message + }) + } + if (update.pFlags.popup && update.message) { + var historyMessage = wrapForHistory(messageID) + ErrorService.show({error: {code: 400, type: 'UPDATE_SERVICE_NOTIFICATION'}, historyMessage: historyMessage}) + } + break } } @@ -3493,11 +3545,18 @@ angular.module('myApp.services') var hasUpdated = false angular.forEach(dialogsResult.dialogs, function (dialog) { var peerID = AppPeersManager.getPeerID(dialog.peer) - if (dialog.top_message) { + var topMessage = dialog.top_message + var topPendingMesage = pendingTopMsgs[peerID] + if (topPendingMesage) { + if (!topMessage || getMessage(topPendingMesage).date > getMessage(topMessage).date) { + dialog.top_message = topMessage = topPendingMesage + } + } + if (topMessage) { var wasBefore = getDialogByPeerID(peerID).length > 0 saveConversation(dialog) if (wasBefore) { - clearDialogCache(dialog.top_message) + clearDialogCache(topMessage) $rootScope.$broadcast('dialog_top', dialog) } else { updatedDialogs[peerID] = dialog diff --git a/app/js/services.js b/app/js/services.js index fbabb6cb..85d79a5c 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -4341,16 +4341,23 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) } }) - .service('ChangelogNotifyService', function (Storage, $rootScope, $modal) { + .service('ChangelogNotifyService', function (Storage, $rootScope, $modal, $timeout, MtpApiManager, ApiUpdatesManager) { function checkUpdate () { - Storage.get('last_version').then(function (lastVersion) { - if (lastVersion != Config.App.version) { - if (lastVersion) { - showChangelog(lastVersion) + $timeout(function () { + Storage.get('last_version').then(function (lastVersion) { + if (lastVersion != Config.App.version) { + MtpApiManager.invokeApi('help.getAppChangelog', { + prev_app_version: lastVersion + }).then(function (updates) { + if (updates._ == 'updates' && !updates.updates.length) { + return false + } + ApiUpdatesManager.processUpdateMessage(updates) + Storage.set({last_version: Config.App.version}) + }) } - Storage.set({last_version: Config.App.version}) - } - }) + }) + }, 5000) } function showChangelog (lastVersion) { diff --git a/app/partials/desktop/changelog_modal.html b/app/partials/desktop/changelog_modal.html index 8e25b32c..646c424d 100644 --- a/app/partials/desktop/changelog_modal.html +++ b/app/partials/desktop/changelog_modal.html @@ -31,341 +31,8 @@
-
-
0.5.6
-
-
    -
  • Edit the text of your messages after sending them. This works across all Telegram chats, including groups and one-on-one conversations. Select a message and click 'Edit' or just press the up arrow button to edit your last message.
  • -
  • Unsend Messages: retract any messages within 48 hours of sending them. Check out the Telegram Blog for more info.
  • -
  • Pinned chats. Check out the Telegram Blog for more info.
  • -
  • Sticker suggestions by emoji.
  • -
  • Search for messages in specific chats.
  • -
  • Background notifications in Chrome and Firefox (can be disabled in Settings)
  • -
- -
-
- -
-
0.5.5
-
-
    -
  • Introducing Drafts: Seamless syncing for unsent messages on all your devices. Drafts are now visible in your chats list.
  • -
  • Mention people in groups by typing @ and selecting them from the list — even if they don't have a username.
  • -
  • Share links to specific posts in channels via quick forwarding menu (click on the date in a message to try this out).
  • -
- -
-
- -
-
0.5.4
-
-
    -
  • Introducing Bot API 2.0, the biggest update to our bot platform since June 2015.
  • -
  • New inline keyboards with callback, 'open URL' or 'switch to inline mode' buttons help create seamless interfaces.
  • -
  • Bots can now update existing messages on the fly as you interact with them.
  • -
  • Prepare for the rise of location-based bots: all bots can now ask users to share their location.
  • -
  • Inline bots can now send all attachments supported in Telegram (videos, music, stickers, files, etc.).
  • -
  • Try out these sample bots to see what's coming your way soon: @music, @sticker, @youtube, @foursquare
  • -
  • Check out the Telegram Blog for more info.
  • -
  • New quick forwarding in channels (click on the date in a message to try this out).
  • -
  • Improved performance.
  • -
- -
-
- -
-
0.5.3
-
-
    -
  • Inline bots: A new way to add bot content to any chat. Type a bot's username and your query in the text field to get instant results and send them to your chat partner. Try typing @gif dog in your next chat. Sample bots: @gif, @wiki, @bing, @vid, @bold.
  • -
  • Check out the Telegram Blog for more info.
  • -
  • Improved GIFs: 20x faster sending and downloading, nice animated progress
  • -
  • Click on message date to reply (or to forward from channels).
  • -
  • Preview images before sending when pasting from clipboard.
  • -
  • Improved formatting for copy-pasted history fragments (date, time and sender names inserted automatically).
  • -
-
-
- -
-
0.5.2
-
-
    -
  • Unread counters for muted chats now colored in gray.
  • -
  • Improved previews for sticker sets: Click on a sticker to view the whole set, click on stickers in a set to send right away, added a 'Share' button.
  • -
  • Improved performance.
  • -
-
-
- -
-
0.5.1
-
-
    -
  • Groups that have reached their capacity of 200 users can be upgraded to supergroups of up to 1,000 members.
  • -
  • Check out the Telegram Blog for more info
  • -
-
-
- -
-
0.5.0
-
-
    -
  • Removed annoying "multiple tabs open" error.
  • -
  • Improved message forwarding.
  • -
  • Added view counter to messages from channels.
  • -
  • Improved image loading in Safari and Firefox.
  • -
-
-
- -
-
0.4.9
-
-
    -
  • New emoji and sticker menu, tabs for sticker packs.
  • -
-
-
- -
-
0.4.8
-
-
    -
  • Introducing Channels – a great new way to broadcast your messages to unlimited audiences.
  • -
  • Check out the Telegram Blog for more info
  • -
  • Improved performance in Safari on OS X El Capitan.
  • -
  • Added formatting for fixed-width code, surround text with `single backticks` for inline text and ```triple backticks``` for blocks of pre-formatted text.
  • -
-
-
- -
-
0.4.7
-
-
    -
  • New bot API, free for everyone. If you're an engineer, create your own bots for games, services or integrations. -
  • -
  • Check out Telegram Blog for more info
  • -
  • Improved Stickers support: now stickers are loading much faster.
  • -
  • Click on any custom stickers in chats to view and add sticker sets.
  • -
  • [Mobile] Reply to a message easily: tap on any message and select "Reply".
  • -
-
-
- -
-
0.4.6
-
- -
-
- -
-
0.4.5
-
-
    -
  • - Invite links for group chats:
    - Check out Telegram Blog for more info -
  • -
  • Smart notifications
  • -
  • 'Listened' status for voice messages
  • -
  • Places in locations (venues, landmarks)
  • -
-
-
- -
-
0.4.4
-
-
    -
  • Link Previews:
    - Get rich link summaries for tweets, YouTube videos, Instagram photos and other content.
  • - -
  • Check out Telegram Blog for more info.
  • -
-
-
- -
-
0.4.3
-
-
    -
  • Sessions List:
    - View your active Telegram sessions (on desktop, tablet and mobile devices) and close specific sessions remotely.
  • - -
  • Two-step verification:
    - Set up an additional password that will be required to log into your Telegram account.
  • - -
  • Check out Telegram Blog for more info.
  • -
-
-
- -
-
0.4.2
-
-
    -
  • Optimization for screens with smaller Y-resolutions.
  • -
  • Supported Spotify URL embeds.
  • -
  • Mentions of the current user in group chats are now highlighted.
  • -
-
-
- -
-
0.4.1
-
-
    -
  • Reply to specific messages in groups.
  • -
  • Mention @usernames in groups to notify multiple users.
  • -
  • Revised notifications in groups: mentioned users and people you reply to will be notified (private chat notification settings apply in this case instead of group settings). Check out Telegram Blog for more info.
  • -
  • Setting to disable message preview
  • -
-
-
- -
-
0.4.0
-
-
    -
  • Full stickers support
  • -
  • Multisearch box: instantly find chats, usernames and messages
  • -
  • Emoji autocomplete: e.g., type :kiss in the message field to see the list. Full cheat sheet »
  • -
  • Added 'typing' notification in chats list
  • -
  • Online members counter in group headers
  • -
-
-
- -
-
0.3.9
-
-
    -
  • [Desktop] Material design completed
  • -
-
-
- -
-
0.3.8
-
-
    -
  • Telegram.me links open right in Telegram Web when authorized
  • -
  • @username mentions in messages are clickable and open a conversation with the user
  • -
-
-
- -
-
0.3.7
-
-
    -
  • [Desktop] New material design for modal windows
  • -
  • [Desktop] Forward messages to multiple recipients
  • -
-
-
- -
-
0.3.6
-
-
    -
  • New viewer for photos, videos, documents.
  • -
  • [FirefoxOS] Improved media downloads.
  • -
-
-
- -
-
0.3.5
-
-
    -
  • Added embedded Soundcloud tracks and playlists.
  • -
  • Added global user search to contacts list.
  • -
  • Added switch to mobile version on window resize.
  • -
  • Migrate to HTTPS notification
  • -
  • Bugfixes.
  • -
-
-
- -
-
0.3.4
-
-
    -
  • Added embedded Facebook posts and Vimeo videos.
  • -
  • Improved IE10+ support: downloading files and style fixes.
  • -
  • Added unsupported media playback warning.
  • -
  • Bugfixes.
  • -
-
-
- -
-
0.3.3
-
-
    -
  • Added Native Client module: dramatically improved encryption speed; Download and upload speed is now as high as in native applications.
  • -
  • HTTPS. We recommend you to use https://web.telegram.org.
  • -
  • Added multiple open tabs warning. Please note, that only one tab with Telegram Web will work.
  • -
  • Added embedded Instagram, Twitter, Vine, YouTube links.
  • -
  • Jump to selected spot when playing back audio.
  • -
  • Bugfixes
  • -
-
-
- -
-
0.3.2
-
-
    -
  • Usernames support: Choose a username right now!
  • -
  • Search can now find public users by username.
  • -
  • Most popular emoticons shown in 'recent' when empty
  • -
  • [ChromeApp] Added saving window position and size
  • -
  • Bugfixes
  • -
-
-
- -
-
0.3.1
-
-
    -
  • New languages: Spanish, German and Italian are now available
  • -
  • New custom-made audio player
  • -
  • Bad browser page for IE 6-9
  • -
  • Perfomance improvements and bugfixes
  • -
-
-
- -
-
0.3.0
-
-
    -
  • Log in codes may be received in other Telegram apps
  • -
  • Partner's online status updates automatically
  • -
  • Added support for non-english hashtags in messages
  • -
  • Fixed invalid scrollbar width bug
  • -
  • [Desktop] Added automatic country code detection
  • -
  • [FirefoxOS] Improved PUSH-notifications for <= 1.1
  • -
  • [FirefoxOS] Fixed emoji in notifications
  • -
  • [FirefoxOS] Fixed attachment bug for <= 1.1
  • -
  • [FirefoxOS] Added phonebook permissions handling
  • -
  • [FirefoxOS] Added ability to share Gallery photos in Telegram
  • -
-
+
+
@@ -373,7 +40,7 @@
diff --git a/app/partials/desktop/error_modal.html b/app/partials/desktop/error_modal.html index 51640358..c9ccc054 100644 --- a/app/partials/desktop/error_modal.html +++ b/app/partials/desktop/error_modal.html @@ -65,7 +65,12 @@ - + +
+
+
+
+
diff --git a/app/partials/mobile/channel_modal.html b/app/partials/mobile/channel_modal.html deleted file mode 100644 index 22bb30f7..00000000 --- a/app/partials/mobile/channel_modal.html +++ /dev/null @@ -1,130 +0,0 @@ -
- -
- -
- - - -
diff --git a/app/partials/mobile/settings_modal.html b/app/partials/mobile/settings_modal.html index 7dbf2554..ccd90897 100644 --- a/app/partials/mobile/settings_modal.html +++ b/app/partials/mobile/settings_modal.html @@ -158,7 +158,7 @@

- +