mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-05 19:28:46 +02:00
Temp
This commit is contained in:
parent
4235d7e9c8
commit
f3e1795b68
4 changed files with 34 additions and 7 deletions
|
|
@ -31,7 +31,7 @@ class UITests: XCTestCase {
|
|||
}
|
||||
|
||||
func testSignUp() throws {
|
||||
deleteTestAccount(phone: "9996629999")
|
||||
deleteTestAccount(phone: "9996625296")
|
||||
app.launch()
|
||||
|
||||
// Welcome screen — tap Start Messaging
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import sys
|
|||
import json
|
||||
import hashlib
|
||||
import base64
|
||||
import time
|
||||
import requests
|
||||
|
||||
def sha256_file(path):
|
||||
|
|
@ -29,13 +30,36 @@ def init_build(host, token, files, channel):
|
|||
def upload_file(path, upload_info):
|
||||
url = upload_info.get('url')
|
||||
headers = dict(upload_info.get('headers', {}))
|
||||
|
||||
|
||||
size = os.path.getsize(path)
|
||||
headers['Content-Length'] = str(size)
|
||||
|
||||
print('Uploading', path)
|
||||
with open(path, 'rb') as f:
|
||||
r = requests.put(url, data=f, headers=headers, timeout=900)
|
||||
print('Uploading {} ({:.1f} MB)'.format(path, size / 1024 / 1024))
|
||||
start_time = time.time()
|
||||
|
||||
def reader():
|
||||
sent = 0
|
||||
last_print = time.time()
|
||||
with open(path, 'rb') as f:
|
||||
while True:
|
||||
chunk = f.read(256 * 1024)
|
||||
if not chunk:
|
||||
break
|
||||
sent += len(chunk)
|
||||
now = time.time()
|
||||
if now - last_print >= 5:
|
||||
elapsed = now - start_time
|
||||
speed = sent / elapsed / 1024 / 1024 if elapsed > 0 else 0
|
||||
print(' {:.1f}% ({:.1f} / {:.1f} MB) {:.2f} MB/s'.format(
|
||||
sent * 100 / size, sent / 1024 / 1024, size / 1024 / 1024, speed))
|
||||
last_print = now
|
||||
yield chunk
|
||||
elapsed = time.time() - start_time
|
||||
speed = size / elapsed / 1024 / 1024 if elapsed > 0 else 0
|
||||
print(' 100% - all bytes sent in {:.1f}s ({:.2f} MB/s), waiting for server response...'.format(elapsed, speed))
|
||||
|
||||
r = requests.put(url, data=reader(), headers=headers, timeout=900)
|
||||
print(' Server responded: {} ({:.1f}s total)'.format(r.status_code, time.time() - start_time))
|
||||
if r.status_code != 200:
|
||||
print('Upload failed', r.status_code)
|
||||
print(r.text[:500])
|
||||
|
|
|
|||
|
|
@ -2722,7 +2722,8 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||
|
||||
let messageString: NSAttributedString
|
||||
if !messageText.isEmpty && entities.count > 0 {
|
||||
messageString = foldLineBreaks(stringWithAppliedEntities(messageText, entities: entities, strings: item.presentationData.strings, dateTimeFormat: item.presentationData.dateTimeFormat, baseColor: theme.messageTextColor, linkColor: theme.messageTextColor, baseFont: textFont, linkFont: textFont, boldFont: textFont, italicFont: italicTextFont, boldItalicFont: textFont, fixedFont: textFont, blockQuoteFont: textFont, underlineLinks: false, message: message._asMessage()))
|
||||
let appliedString = stringWithAppliedEntities(messageText, entities: entities, strings: item.presentationData.strings, dateTimeFormat: item.presentationData.dateTimeFormat, baseColor: theme.messageTextColor, linkColor: theme.messageTextColor, baseFont: textFont, linkFont: textFont, boldFont: textFont, italicFont: italicTextFont, boldItalicFont: textFont, fixedFont: textFont, blockQuoteFont: textFont, underlineLinks: false, message: message._asMessage())
|
||||
messageString = foldLineBreaks(appliedString)
|
||||
} else if spoilers != nil || customEmojiRanges != nil {
|
||||
let mutableString = NSMutableAttributedString(string: messageText, font: textFont, textColor: theme.messageTextColor)
|
||||
if let spoilers = spoilers {
|
||||
|
|
|
|||
|
|
@ -287,7 +287,9 @@ public func chatListItemStrings(strings: PresentationStrings, nameDisplayOrder:
|
|||
}
|
||||
if !processed {
|
||||
if !message.text.isEmpty {
|
||||
messageText = "📎 \(messageText)"
|
||||
if enableMediaEmoji {
|
||||
messageText = "📎 \(messageText)"
|
||||
}
|
||||
} else {
|
||||
if fileMedia.isAnimatedSticker {
|
||||
messageText = strings.Message_Sticker
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue