Merge branch 'beta'

This commit is contained in:
Ali 2022-09-21 18:27:30 +02:00
commit 30b5c6b25b
9 changed files with 163 additions and 125 deletions

View File

@ -110,7 +110,7 @@ deploy_beta_testflight:
except:
- tags
script:
- bash buildbox/deploy-telegram.sh appstore
- echo done #PYTHONPATH="$PYTHONPATH:/darwin-containers" python3 -u build-system/Make/Make.py remote-deploy-testflight --darwinContainersHost="http://host.docker.internal:8650" --ipa="build/artifacts/Telegram.ipa" --dsyms="build/artifacts/Telegram.DSYMs.zip"
environment:
name: testflight_llc
@ -124,7 +124,10 @@ verifysanity_beta_testflight:
except:
- tags
script:
- bash buildbox/verify-telegram.sh appstore cached
- rm -rf build/verify-input && mkdir -p build/verify-input && mv build/artifacts/Telegram.ipa build/verify-input/TelegramVerifySource.ipa
- PYTHONPATH="$PYTHONPATH:/darwin-containers" python3 -u build-system/Make/Make.py remote-build --darwinContainersHost="http://host.docker.internal:8650" --cacheHost="$TELEGRAM_BAZEL_CACHE_HOST" --configurationPath="build-system/appstore-configuration.json" --codesigningInformationPath=build-system/fake-codesigning --configuration=release_arm64
- python3 tools/ipadiff.py build/artifacts/Telegram.ipa build/verify-input/TelegramVerifySource.ipa
- if [ $? -ne 0 ]; then; echo "Verification failed"; mkdir -p build/verifysanity_artifacts; cp build/artifacts/Telegram.ipa build/verifysanity_artifacts/; exit 1; fi
environment:
name: testflight_llc
artifacts:
@ -143,7 +146,10 @@ verify_beta_testflight:
except:
- tags
script:
- bash buildbox/verify-telegram.sh appstore full
- rm -rf build/verify-input && mkdir -p build/verify-input && mv build/artifacts/Telegram.ipa build/verify-input/TelegramVerifySource.ipa
- PYTHONPATH="$PYTHONPATH:/darwin-containers" python3 -u build-system/Make/Make.py remote-build --darwinContainersHost="http://host.docker.internal:8650" --configurationPath="build-system/appstore-configuration.json" --codesigningInformationPath=build-system/fake-codesigning --configuration=release_arm64
- python3 tools/ipadiff.py build/artifacts/Telegram.ipa build/verify-input/TelegramVerifySource.ipa
- if [ $? -ne 0 ]; then; echo "Verification failed"; mkdir -p build/verify_artifacts; cp build/artifacts/Telegram.ipa build/verify_artifacts/; exit 1; fi
environment:
name: testflight_llc
artifacts:

View File

@ -1,62 +0,0 @@
import os
import sys
import argparse
import json
from BuildEnvironment import check_run_system
def deploy_to_appstore_connect(args):
if not os.path.exists(args.configuration):
print('{} does not exist'.format(args.configuration))
sys.exit(1)
if not os.path.exists(args.ipa):
print('{} does not exist'.format(args.ipa))
sys.exit(1)
with open(args.configuration) as file:
configuration_dict = json.load(file)
required_keys = [
'username',
'app_name',
'api_token',
]
for key in required_keys:
if key not in configuration_dict:
print('Configuration at {} does not contain {}'.format(args.configuration, key))
check_run_system('appcenter login --token {token}'.format(token=configuration_dict['api_token']))
check_run_system('appcenter distribute release --app "{username}/{app_name}" -f "{ipa_path}" -g Internal'.format(
username=configuration_dict['username'],
app_name=configuration_dict['app_name'],
ipa_path=args.ipa,
))
if args.dsyms is not None:
check_run_system('appcenter crashes upload-symbols --app "{username}/{app_name}" --symbol "{dsym_path}"'.format(
username=configuration_dict['username'],
app_name=configuration_dict['app_name'],
dsym_path=args.dsyms
))
if __name__ == '__main__':
parser = argparse.ArgumentParser(prog='deploy-appstore-connect')
parser.add_argument(
'--configuration',
required=True,
help='Path to configuration json.'
)
parser.add_argument(
'--ipa',
required=True,
help='Path to IPA.'
)
if len(sys.argv) < 2:
parser.print_help()
sys.exit(1)
args = parser.parse_args()
deploy_to_appstore_connect(args)

View File

@ -52,7 +52,7 @@ def import_certificates(certificatesPath):
'/usr/bin/codesign',
'-T',
'/usr/bin/security'
], check_result=True)
], check_result=False)
run_executable_with_output('security', arguments=[
'import',
@ -65,7 +65,7 @@ def import_certificates(certificatesPath):
'/usr/bin/codesign',
'-T',
'/usr/bin/security'
], check_result=True)
], check_result=False)
run_executable_with_output('security', arguments=[
'set-key-partition-list',

View File

@ -891,6 +891,26 @@ if __name__ == '__main__':
help='Bazel remote cache host address.'
)
remote_upload_testflight_parser = subparsers.add_parser('remote-deploy-testflight', help='Build the app using a remote environment.')
remote_upload_testflight_parser.add_argument(
'--darwinContainersHost',
required=True,
type=str,
help='DarwinContainers host address.'
)
remote_upload_testflight_parser.add_argument(
'--ipa',
required=True,
type=str,
help='Path to IPA file.'
)
remote_upload_testflight_parser.add_argument(
'--dsyms',
required=True,
type=str,
help='Path to DSYMs.zip file.'
)
if len(sys.argv) < 2:
parser.print_help()
sys.exit(1)
@ -901,7 +921,7 @@ if __name__ == '__main__':
print(args)
if args.commandName is None:
exit(0)
sys.exit(0)
bazel_path = None
if args.bazel is None:
@ -940,6 +960,22 @@ if __name__ == '__main__':
configuration=args.configuration,
build_input_data_path=remote_input_path
)
elif args.commandName == 'remote-deploy-testflight':
env = os.environ
if 'APPSTORE_CONNECT_USERNAME' not in env:
print('APPSTORE_CONNECT_USERNAME environment variable is not set')
sys.exit(1)
if 'APPSTORE_CONNECT_PASSWORD' not in env:
print('APPSTORE_CONNECT_PASSWORD environment variable is not set')
sys.exit(1)
RemoteBuild.remote_deploy_testflight(
darwin_containers_host=args.darwinContainersHost,
ipa_path=args.ipa,
dsyms_path=args.dsyms,
username=env['APPSTORE_CONNECT_USERNAME'],
password=env['APPSTORE_CONNECT_PASSWORD']
)
elif args.commandName == 'test':
test(bazel=bazel_path, arguments=args)
else:

View File

@ -139,3 +139,47 @@ def remote_build(darwin_containers_host, bazel_cache_host, configuration, build_
else:
print('Telegram.ipa not found')
sys.exit(1)
def remote_deploy_testflight(darwin_containers_host, ipa_path, dsyms_path, username, password):
macos_version = '12.5'
from darwin_containers import DarwinContainers
configuration_path = 'versions.json'
xcode_version = ''
with open(configuration_path) as file:
configuration_dict = json.load(file)
if configuration_dict['xcode'] is None:
raise Exception('Missing xcode version in {}'.format(configuration_path))
xcode_version = configuration_dict['xcode']
print('Xcode version: {}'.format(xcode_version))
image_name = 'macos-{macos_version}-xcode-{xcode_version}'.format(macos_version=macos_version, xcode_version=xcode_version)
print('Image name: {}'.format(image_name))
darwinContainers = DarwinContainers(serverAddress=darwin_containers_host, verbose=False)
print('Opening container session...')
with darwinContainers.workingImageSession(name=image_name) as session:
print('Uploading data to container...')
session_scp_upload(session=session, source_path=ipa_path, destination_path='')
session_scp_upload(session=session, source_path=dsyms_path, destination_path='')
guest_upload_sh = '''
set -e
export DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS="-t DAV"
FASTLANE_PASSWORD="{password}" xcrun altool --upload-app --type ios --file "Telegram.ipa" --username "{username}" --password "@env:FASTLANE_PASSWORD"
'''.format(username=username, password=password)
guest_upload_file_path = tempfile.mktemp()
with open(guest_upload_file_path, 'w+') as file:
file.write(guest_upload_sh)
session_scp_upload(session=session, source_path=guest_upload_file_path, destination_path='guest-upload-telegram.sh')
os.unlink(guest_upload_file_path)
print('Executing remote upload...')
session_ssh(session=session, command='bash -l guest-upload-telegram.sh')

View File

@ -1334,7 +1334,7 @@ public final class ReactionContextNode: ASDisplayNode, UIScrollViewDelegate {
}
strongSelf.requestUpdateOverlayWantsToBeBelowKeyboard(transition.containedViewLayoutTransition)
},
updateSearchQuery: { [weak self] rawQuery in
updateSearchQuery: { [weak self] rawQuery, languageCode in
guard let strongSelf = self else {
return
}
@ -1347,7 +1347,6 @@ public final class ReactionContextNode: ASDisplayNode, UIScrollViewDelegate {
} else {
let context = strongSelf.context
let languageCode = "en"
var signal = context.engine.stickers.searchEmojiKeywords(inputLanguageCode: languageCode, query: query, completeMatch: false)
if !languageCode.lowercased().hasPrefix("en") {
signal = signal

View File

@ -252,8 +252,10 @@ public final class EmojiStatusSelectionController: ViewController {
private var scheduledEmojiContentAnimationHint: EmojiPagerContentComponent.ContentAnimation?
private let emojiSearchDisposable = MetaDisposable()
private let emojiSearchResult = Promise<(groups: [EmojiPagerContentComponent.ItemGroup], id: AnyHashable, emptyResultEmoji: TelegramMediaFile?)?>(nil)
private let emojiSearchResult = Promise<(groups: [EmojiPagerContentComponent.ItemGroup], id: AnyHashable)?>(nil)
private var emptyResultEmojis: [TelegramMediaFile] = []
private var stableEmptyResultEmoji: TelegramMediaFile?
private let stableEmptyResultEmojiDisposable = MetaDisposable()
private var previewItem: (groupId: AnyHashable, item: EmojiPagerContentComponent.Item)?
private var dismissedPreviewItem: (groupId: AnyHashable, item: EmojiPagerContentComponent.Item)?
@ -313,6 +315,32 @@ public final class EmojiStatusSelectionController: ViewController {
self.layer.addSublayer(self.cloudLayer0)
self.layer.addSublayer(self.cloudLayer1)
let viewKey = PostboxViewKey.orderedItemList(id: Namespaces.OrderedItemList.CloudFeaturedEmojiPacks)
self.stableEmptyResultEmojiDisposable.set((self.context.account.postbox.combinedView(keys: [viewKey])
|> take(1)
|> deliverOnMainQueue).start(next: { [weak self] views in
guard let strongSelf = self, let view = views.views[viewKey] as? OrderedItemListView else {
return
}
var filteredFiles: [TelegramMediaFile] = []
let filterList: [String] = ["😖", "😫", "🫠", "😨", ""]
for featuredEmojiPack in view.items.lazy.map({ $0.contents.get(FeaturedStickerPackItem.self)! }) {
for item in featuredEmojiPack.topItems {
for attribute in item.file.attributes {
switch attribute {
case let .CustomEmoji(_, alt, _):
if filterList.contains(alt) {
filteredFiles.append(item.file)
}
default:
break
}
}
}
}
strongSelf.emptyResultEmojis = filteredFiles
}))
self.emojiContentDisposable = (combineLatest(queue: .mainQueue(),
emojiContent,
self.emojiSearchResult.get()
@ -328,7 +356,7 @@ public final class EmojiStatusSelectionController: ViewController {
var emptySearchResults: EmojiPagerContentComponent.EmptySearchResults?
if !emojiSearchResult.groups.contains(where: { !$0.items.isEmpty }) {
if strongSelf.stableEmptyResultEmoji == nil {
strongSelf.stableEmptyResultEmoji = emojiSearchResult.emptyResultEmoji
strongSelf.stableEmptyResultEmoji = strongSelf.emptyResultEmojis.randomElement()
}
//TODO:localize
emptySearchResults = EmojiPagerContentComponent.EmptySearchResults(
@ -397,7 +425,7 @@ public final class EmojiStatusSelectionController: ViewController {
},
requestUpdate: { _ in
},
updateSearchQuery: { rawQuery in
updateSearchQuery: { rawQuery, languageCode in
guard let strongSelf = self else {
return
}
@ -410,7 +438,6 @@ public final class EmojiStatusSelectionController: ViewController {
} else {
let context = strongSelf.context
let languageCode = "en"
var signal = context.engine.stickers.searchEmojiKeywords(inputLanguageCode: languageCode, query: query, completeMatch: false)
if !languageCode.lowercased().hasPrefix("en") {
signal = signal
@ -435,14 +462,14 @@ public final class EmojiStatusSelectionController: ViewController {
|> distinctUntilChanged
let resultSignal = signal
|> mapToSignal { keywords -> Signal<(result: [EmojiPagerContentComponent.ItemGroup], emptyResultEmoji: TelegramMediaFile?), NoError> in
|> mapToSignal { keywords -> Signal<[EmojiPagerContentComponent.ItemGroup], NoError> in
return combineLatest(
context.account.postbox.itemCollectionsView(orderedItemListCollectionIds: [], namespaces: [Namespaces.ItemCollection.CloudEmojiPacks], aroundIndex: nil, count: 10000000),
context.engine.stickers.availableReactions(),
hasPremium
)
|> take(1)
|> map { view, availableReactions, hasPremium -> (result: [EmojiPagerContentComponent.ItemGroup], emptyResultEmoji: TelegramMediaFile?) in
|> map { view, availableReactions, hasPremium -> [EmojiPagerContentComponent.ItemGroup] in
var result: [(String, TelegramMediaFile?, String)] = []
var allEmoticons: [String: String] = [:]
@ -493,42 +520,21 @@ public final class EmojiStatusSelectionController: ViewController {
}
}
var emptyResultEmoji: TelegramMediaFile?
if let availableReactions = availableReactions {
//let reactionFilter: [String] = ["😖", "😫", "🫠", "😨", ""]
let filteredReactions: [TelegramMediaFile] = availableReactions.reactions.compactMap { reaction -> TelegramMediaFile? in
switch reaction.value {
case let .builtin(value):
let _ = value
//if reactionFilter.contains(value) {
return reaction.selectAnimation
/*} else {
return nil
}*/
case .custom:
return nil
}
}
emptyResultEmoji = filteredReactions.randomElement()
}
return (result: [EmojiPagerContentComponent.ItemGroup(
supergroupId: "search",
groupId: "search",
title: nil,
subtitle: nil,
actionButtonTitle: nil,
isFeatured: false,
isPremiumLocked: false,
isEmbedded: false,
hasClear: false,
collapsedLineCount: nil,
displayPremiumBadges: false,
headerItem: nil,
items: items
)],
emptyResultEmoji: emptyResultEmoji
)
return [EmojiPagerContentComponent.ItemGroup(
supergroupId: "search",
groupId: "search",
title: nil,
subtitle: nil,
actionButtonTitle: nil,
isFeatured: false,
isPremiumLocked: false,
isEmbedded: false,
hasClear: false,
collapsedLineCount: nil,
displayPremiumBadges: false,
headerItem: nil,
items: items
)]
}
}
@ -538,7 +544,7 @@ public final class EmojiStatusSelectionController: ViewController {
guard let strongSelf = self else {
return
}
strongSelf.emojiSearchResult.set(.single((result.result, AnyHashable(query), result.emptyResultEmoji)))
strongSelf.emojiSearchResult.set(.single((result, AnyHashable(query))))
}))
}
},
@ -1100,6 +1106,7 @@ public final class EmojiStatusSelectionController: ViewController {
return
}
self.previewItem = (groupId, item)
self.view.endEditing(true)
self.refreshLayout(transition: .immediate)
} else {
self.freezeUpdates = true

View File

@ -1547,7 +1547,7 @@ public final class EmojiSearchHeaderView: UIView, UITextFieldDelegate {
private let activated: () -> Void
private let deactivated: () -> Void
private let updateQuery: (String) -> Void
private let updateQuery: (String, String) -> Void
let tintContainerView: UIView
@ -1577,7 +1577,7 @@ public final class EmojiSearchHeaderView: UIView, UITextFieldDelegate {
return self.textField != nil
}
init(activated: @escaping () -> Void, deactivated: @escaping () -> Void, updateQuery: @escaping (String) -> Void) {
init(activated: @escaping () -> Void, deactivated: @escaping () -> Void, updateQuery: @escaping (String, String) -> Void) {
self.activated = activated
self.deactivated = deactivated
self.updateQuery = updateQuery
@ -1691,7 +1691,7 @@ public final class EmojiSearchHeaderView: UIView, UITextFieldDelegate {
}
@objc private func cancelPressed() {
self.updateQuery("")
self.updateQuery("", "en")
self.clearIconView.isHidden = true
self.clearIconTintView.isHidden = true
@ -1707,7 +1707,7 @@ public final class EmojiSearchHeaderView: UIView, UITextFieldDelegate {
}
@objc private func clearPressed() {
self.updateQuery("")
self.updateQuery("", "en")
self.textField?.text = ""
self.clearIconView.isHidden = true
@ -1726,11 +1726,19 @@ public final class EmojiSearchHeaderView: UIView, UITextFieldDelegate {
let text = textField.text ?? ""
var inputLanguage = textField.textInputMode?.primaryLanguage ?? "en"
if let range = inputLanguage.range(of: "-") {
inputLanguage = String(inputLanguage[inputLanguage.startIndex ..< range.lowerBound])
}
if let range = inputLanguage.range(of: "_") {
inputLanguage = String(inputLanguage[inputLanguage.startIndex ..< range.lowerBound])
}
self.clearIconView.isHidden = text.isEmpty
self.clearIconTintView.isHidden = text.isEmpty
self.clearIconButton.isHidden = text.isEmpty
self.updateQuery(text)
self.updateQuery(text, inputLanguage)
}
private func update(transition: Transition) {
@ -2068,7 +2076,7 @@ public final class EmojiPagerContentComponent: Component {
public let presentGlobalOverlayController: (ViewController) -> Void
public let navigationController: () -> NavigationController?
public let requestUpdate: (Transition) -> Void
public let updateSearchQuery: (String) -> Void
public let updateSearchQuery: (String, String) -> Void
public let chatPeerId: PeerId?
public let peekBehavior: EmojiContentPeekBehavior?
public let customLayout: CustomLayout?
@ -2088,7 +2096,7 @@ public final class EmojiPagerContentComponent: Component {
presentGlobalOverlayController: @escaping (ViewController) -> Void,
navigationController: @escaping () -> NavigationController?,
requestUpdate: @escaping (Transition) -> Void,
updateSearchQuery: @escaping (String) -> Void,
updateSearchQuery: @escaping (String, String) -> Void,
chatPeerId: PeerId?,
peekBehavior: EmojiContentPeekBehavior?,
customLayout: CustomLayout?,
@ -6036,11 +6044,11 @@ public final class EmojiPagerContentComponent: Component {
strongSelf.isSearchActivated = false
strongSelf.pagerEnvironment?.onWantsExclusiveModeUpdated(false)
strongSelf.component?.inputInteractionHolder.inputInteraction?.requestUpdate(.immediate)
}, updateQuery: { [weak self] query in
}, updateQuery: { [weak self] query, languageCode in
guard let strongSelf = self else {
return
}
strongSelf.component?.inputInteractionHolder.inputInteraction?.updateSearchQuery(query)
strongSelf.component?.inputInteractionHolder.inputInteraction?.updateSearchQuery(query, languageCode)
})
self.visibleSearchHeader = visibleSearchHeader
if self.isSearchActivated {

View File

@ -1123,7 +1123,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
},
requestUpdate: { _ in
},
updateSearchQuery: { _ in
updateSearchQuery: { _, _ in
},
chatPeerId: chatPeerId,
peekBehavior: nil,
@ -1327,7 +1327,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
},
requestUpdate: { _ in
},
updateSearchQuery: { _ in
updateSearchQuery: { _, _ in
},
chatPeerId: chatPeerId,
peekBehavior: stickerPeekBehavior,
@ -2053,7 +2053,7 @@ final class EntityInputView: UIView, AttachmentTextInputPanelInputView, UIInputV
},
requestUpdate: { _ in
},
updateSearchQuery: { _ in
updateSearchQuery: { _, _ in
},
chatPeerId: nil,
peekBehavior: nil,