Merge branches 'master' and 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2021-02-10 18:25:07 +04:00
commit fdbd3ceb7a
11 changed files with 109 additions and 100 deletions

View File

View File

@ -20,13 +20,13 @@ There are several things we require from **all developers** for the moment.
git clone --recursive -j8 https://github.com/TelegramMessenger/Telegram-iOS.git
```
3. Download Bazel 3.7.0
3. Download Bazel 4.0.0
```
mkdir -p $HOME/bazel-dist
cd $HOME/bazel-dist
curl -O -L https://github.com/bazelbuild/bazel/releases/download/3.7.0/bazel-3.7.0-darwin-x86_64
mv bazel-3.7.0* bazel
curl -O -L https://github.com/bazelbuild/bazel/releases/download/4.0.0/bazel-4.0.0-darwin-x86_64
mv bazel-* bazel
```
Verify that it's working

View File

@ -1 +1 @@
E65Wt9QZyVD8tvGhCJD3My6x57eDORYaiYh6HR7T3fI=
E65Wt9QZyVD8tvGhCJD3My6x57eDORYaiYh6HR7T3fK=

@ -1 +1 @@
Subproject commit fe541dc3d45a4389d8bf973f7a16803429c5e212
Subproject commit c337e9318d17a004dc06c966bab02a8c7929ce87

View File

@ -5,7 +5,7 @@ set -e
BUILD_TELEGRAM_VERSION="1"
MACOS_VERSION="10.15"
XCODE_VERSION="12.3"
XCODE_VERSION="12.4"
GUEST_SHELL="bash"
VM_BASE_NAME="macos$(echo $MACOS_VERSION | sed -e 's/\.'/_/g)_Xcode$(echo $XCODE_VERSION | sed -e 's/\.'/_/g)"

View File

@ -30,7 +30,7 @@ private enum PeerAutoremoveSetupSection: Int32 {
private enum PeerAutoremoveSetupEntry: ItemListNodeEntry {
case header
case timeHeader(String)
case timeValue(Int32, Int32)
case timeValue(Int32, Int32, [Int32])
case timeComment(String)
case globalSwitch(String, Bool)
@ -74,8 +74,8 @@ private enum PeerAutoremoveSetupEntry: ItemListNodeEntry {
} else {
return false
}
case let .timeValue(lhsValue, lhsMaxValue):
if case let .timeValue(rhsValue, rhsMaxValue) = rhs, lhsValue == rhsValue, lhsMaxValue == rhsMaxValue {
case let .timeValue(lhsValue, lhsMaxValue, lhsAvailableValues):
if case let .timeValue(rhsValue, rhsMaxValue, rhsAvailableValues) = rhs, lhsValue == rhsValue, lhsMaxValue == rhsMaxValue, lhsAvailableValues == rhsAvailableValues {
return true
} else {
return false
@ -106,8 +106,8 @@ private enum PeerAutoremoveSetupEntry: ItemListNodeEntry {
return ChatListFilterSettingsHeaderItem(theme: presentationData.theme, text: "", animation: .autoRemove, sectionId: self.section)
case let .timeHeader(text):
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
case let .timeValue(value, maxValue):
return PeerRemoveTimeoutItem(theme: presentationData.theme, value: value, maxValue: maxValue, enabled: true, sectionId: self.section, updated: { value in
case let .timeValue(value, maxValue, availableValues):
return PeerRemoveTimeoutItem(presentationData: presentationData, value: value, maxValue: maxValue, availableValues: availableValues, enabled: true, sectionId: self.section, updated: { value in
arguments.updateValue(value)
}, tag: nil)
case let .timeComment(text):
@ -126,7 +126,7 @@ private struct PeerAutoremoveSetupState: Equatable {
var applyingSetting: Bool = false
}
private func peerAutoremoveSetupEntries(peer: Peer?, presentationData: PresentationData, defaultMyValue: Int32, peerValue: Int32, defaultGlobalValue: Bool, state: PeerAutoremoveSetupState) -> [PeerAutoremoveSetupEntry] {
private func peerAutoremoveSetupEntries(peer: Peer?, presentationData: PresentationData, isDebug: Bool, defaultMyValue: Int32, peerValue: Int32, defaultGlobalValue: Bool, state: PeerAutoremoveSetupState) -> [PeerAutoremoveSetupEntry] {
var entries: [PeerAutoremoveSetupEntry] = []
let globalValue = state.changedGlobalValue ?? defaultGlobalValue
@ -144,7 +144,17 @@ private func peerAutoremoveSetupEntries(peer: Peer?, presentationData: Presentat
//TODO:localize
entries.append(.header)
entries.append(.timeHeader("AUTO-DELETE MESSAGES"))
entries.append(.timeValue(resolvedValue, resolvedMaxValue))
var availableValues: [Int32] = [
24 * 60 * 60,
24 * 60 * 60 * 7,
Int32.max
]
if isDebug {
availableValues[0] = 5
availableValues[1] = 60
}
entries.append(.timeValue(resolvedValue, resolvedMaxValue, availableValues))
if let channel = peer as? TelegramChannel, case .broadcast = channel.info {
entries.append(.timeComment("Automatically delete messages sent in this channel after a certain period of time."))
} else {
@ -298,9 +308,11 @@ public func peerAutoremoveSetupScreen(context: AccountContext, peerId: PeerId, c
})
}
let isDebug = context.account.testingEnvironment
//TODO:localize
let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text("Auto-Deletion"), leftNavigationButton: leftNavigationButton, rightNavigationButton: rightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back))
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: peerAutoremoveSetupEntries(peer: peer, presentationData: presentationData, defaultMyValue: defaultMyValue, peerValue: peerValue, defaultGlobalValue: defaultGlobalValue, state: state), style: .blocks)
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: peerAutoremoveSetupEntries(peer: peer, presentationData: presentationData, isDebug: isDebug, defaultMyValue: defaultMyValue, peerValue: peerValue, defaultGlobalValue: defaultGlobalValue, state: state), style: .blocks)
return (controllerState, (listState, arguments))
}

View File

@ -12,41 +12,39 @@ import ItemListUI
import PresentationDataUtils
import AppBundle
private func mapTimeoutToSliderValue(_ value: Int32) -> CGFloat {
switch value {
case 24 * 60 * 60:
return 0.0
case 7 * 24 * 60 * 60:
return 1.0
default:
return 2.0
private func mapTimeoutToSliderValue(_ value: Int32, availableValues: [Int32]) -> CGFloat {
for i in 0 ..< availableValues.count {
if value <= availableValues[i] {
return CGFloat(i)
}
}
return CGFloat(availableValues.count - 1)
}
private func mapSliderValueToTimeout(_ value: CGFloat) -> Int32 {
switch value {
case 0.0:
return 24 * 60 * 60
case 1.0:
return 7 * 24 * 60 * 60
default:
return Int32.max
private func mapSliderValueToTimeout(_ value: CGFloat, availableValues: [Int32]) -> Int32 {
let intValue = Int(round(value))
if intValue >= 0 && intValue < availableValues.count {
return availableValues[intValue]
} else {
return availableValues[availableValues.count - 1]
}
}
class PeerRemoveTimeoutItem: ListViewItem, ItemListItem {
let theme: PresentationTheme
let presentationData: ItemListPresentationData
let value: Int32
let maxValue: Int32
let availableValues: [Int32]
let enabled: Bool
let sectionId: ItemListSectionId
let updated: (Int32) -> Void
let tag: ItemListItemTag?
init(theme: PresentationTheme, value: Int32, maxValue: Int32, enabled: Bool = true, sectionId: ItemListSectionId, updated: @escaping (Int32) -> Void, tag: ItemListItemTag? = nil) {
self.theme = theme
init(presentationData: ItemListPresentationData, value: Int32, maxValue: Int32, availableValues: [Int32], enabled: Bool = true, sectionId: ItemListSectionId, updated: @escaping (Int32) -> Void, tag: ItemListItemTag? = nil) {
self.presentationData = presentationData
self.value = value
self.maxValue = maxValue
self.availableValues = availableValues
self.enabled = enabled
self.sectionId = sectionId
self.updated = updated
@ -158,13 +156,13 @@ class PeerRemoveTimeoutItemNode: ListViewItemNode, ItemListItemNode {
sliderView.minimumUndottedValue = 0
sliderView.value = mapTimeoutToSliderValue(item.value)
sliderView.value = mapTimeoutToSliderValue(item.value, availableValues: item.availableValues)
sliderView.minimumUndottedValue = Int32(mapTimeoutToSliderValue(item.maxValue))
sliderView.minimumUndottedValue = Int32(mapTimeoutToSliderValue(item.maxValue, availableValues: item.availableValues))
sliderView.backgroundColor = item.theme.list.itemBlocksBackgroundColor
sliderView.backColor = item.theme.list.disclosureArrowColor
sliderView.trackColor = item.enabled ? item.theme.list.itemAccentColor : item.theme.list.itemDisabledTextColor
sliderView.backgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
sliderView.backColor = item.presentationData.theme.list.disclosureArrowColor
sliderView.trackColor = item.enabled ? item.presentationData.theme.list.itemAccentColor : item.presentationData.theme.list.itemDisabledTextColor
sliderView.knobImage = generateKnobImage()
let sliderInset: CGFloat = params.leftInset + 16.0
@ -183,7 +181,7 @@ class PeerRemoveTimeoutItemNode: ListViewItemNode, ItemListItemNode {
return { item, params, neighbors in
var themeUpdated = false
if currentItem?.theme !== item.theme {
if currentItem?.presentationData.theme !== item.presentationData.theme {
themeUpdated = true
}
@ -194,15 +192,12 @@ class PeerRemoveTimeoutItemNode: ListViewItemNode, ItemListItemNode {
let titleLayouts = zip(0 ..< makeTitleNodeLayouts.count, makeTitleNodeLayouts).map { index, makeLayout -> (TextNodeLayout, () -> TextNode) in
let text: String
//TODO:localize
switch index {
case 0:
text = "After 24 hours"
case 1:
text = "After 7 days"
default:
if item.availableValues[index] == Int32.max {
text = "Never"
} else {
text = "After \(timeIntervalString(strings: item.presentationData.strings, value: item.availableValues[index]))"
}
return makeLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: text, font: Font.regular(13.0), textColor: item.theme.list.itemSecondaryTextColor), maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: 100.0, height: 100.0)))
return makeLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: text, font: Font.regular(13.0), textColor: item.presentationData.theme.list.itemSecondaryTextColor), maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: 100.0, height: 100.0)))
}
contentSize = CGSize(width: params.width, height: 88.0)
@ -219,11 +214,11 @@ class PeerRemoveTimeoutItemNode: ListViewItemNode, ItemListItemNode {
let leftInset = 16.0 + params.leftInset
strongSelf.backgroundNode.backgroundColor = item.theme.list.itemBlocksBackgroundColor
strongSelf.topStripeNode.backgroundColor = item.theme.list.itemBlocksSeparatorColor
strongSelf.bottomStripeNode.backgroundColor = item.theme.list.itemBlocksSeparatorColor
strongSelf.backgroundNode.backgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
strongSelf.topStripeNode.backgroundColor = item.presentationData.theme.list.itemBlocksSeparatorColor
strongSelf.bottomStripeNode.backgroundColor = item.presentationData.theme.list.itemBlocksSeparatorColor
strongSelf.disabledOverlayNode.backgroundColor = item.theme.list.itemBlocksBackgroundColor.withAlphaComponent(0.4)
strongSelf.disabledOverlayNode.backgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor.withAlphaComponent(0.4)
strongSelf.disabledOverlayNode.isHidden = item.enabled
strongSelf.disabledOverlayNode.frame = CGRect(origin: CGPoint(x: params.leftInset, y: 8.0), size: CGSize(width: params.width - params.leftInset - params.rightInset, height: 44.0))
@ -263,7 +258,7 @@ class PeerRemoveTimeoutItemNode: ListViewItemNode, ItemListItemNode {
strongSelf.bottomStripeNode.isHidden = hasCorners
}
strongSelf.maskNode.image = hasCorners ? PresentationResourcesItemList.cornersImage(item.theme, top: hasTopCorners, bottom: hasBottomCorners) : nil
strongSelf.maskNode.image = hasCorners ? PresentationResourcesItemList.cornersImage(item.presentationData.theme, top: hasTopCorners, bottom: hasBottomCorners) : nil
strongSelf.backgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -min(insets.top, separatorHeight)), size: CGSize(width: params.width, height: contentSize.height + min(insets.top, separatorHeight) + min(insets.bottom, separatorHeight)))
strongSelf.maskNode.frame = strongSelf.backgroundNode.frame.insetBy(dx: params.leftInset, dy: 0.0)
@ -286,12 +281,12 @@ class PeerRemoveTimeoutItemNode: ListViewItemNode, ItemListItemNode {
if let sliderView = strongSelf.sliderView {
sliderView.isUserInteractionEnabled = item.enabled
sliderView.trackColor = item.enabled ? item.theme.list.itemAccentColor : item.theme.list.itemDisabledTextColor
sliderView.minimumUndottedValue = Int32(mapTimeoutToSliderValue(item.maxValue))
sliderView.trackColor = item.enabled ? item.presentationData.theme.list.itemAccentColor : item.presentationData.theme.list.itemDisabledTextColor
sliderView.minimumUndottedValue = Int32(mapTimeoutToSliderValue(item.maxValue, availableValues: item.availableValues))
if themeUpdated {
sliderView.backgroundColor = item.theme.list.itemBlocksBackgroundColor
sliderView.backColor = item.theme.list.disclosureArrowColor
sliderView.backgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
sliderView.backColor = item.presentationData.theme.list.disclosureArrowColor
sliderView.knobImage = generateKnobImage()
}
@ -325,19 +320,10 @@ class PeerRemoveTimeoutItemNode: ListViewItemNode, ItemListItemNode {
}
@objc func sliderValueChanged() {
guard let sliderView = self.sliderView else {
guard let sliderView = self.sliderView, let item = self.item else {
return
}
let value: Int32
switch sliderView.value {
case 0.0:
value = 24 * 60 * 60
case 1.0:
value = 7 * 24 * 60 * 60
default:
value = Int32.max
}
self.item?.updated(value)
self.item?.updated(mapSliderValueToTimeout(sliderView.value, availableValues: item.availableValues))
}
}

View File

@ -1262,16 +1262,16 @@ private func editingItems(data: PeerInfoScreenData?, context: AccountContext, pr
items[.peerSettings]!.append(PeerInfoScreenCommentItem(id: ItemSignMessagesHelp, text: presentationData.strings.Channel_SignMessages_Help))
}
case .group:
let ItemUsername = 1
let ItemLinkedChannel = 2
let ItemPreHistory = 3
let ItemStickerPack = 4
let ItemPermissions = 5
let ItemAdmins = 6
let ItemLocationHeader = 7
let ItemLocation = 8
let ItemLocationSetup = 9
let ItemAutoremove = 10
let ItemUsername = 101
let ItemLinkedChannel = 102
let ItemPreHistory = 103
let ItemStickerPack = 104
let ItemPermissions = 105
let ItemAdmins = 106
let ItemLocationHeader = 107
let ItemLocation = 108
let ItemLocationSetup = 109
let ItemAutoremove = 110
let isCreator = channel.flags.contains(.isCreator)
let isPublic = channel.username != nil
@ -1405,12 +1405,12 @@ private func editingItems(data: PeerInfoScreenData?, context: AccountContext, pr
}
}
} else if let group = data.peer as? TelegramGroup {
let ItemUsername = 1
let ItemPreHistory = 2
let ItemInviteLinks = 3
let ItemPermissions = 4
let ItemAdmins = 5
let ItemAutoremove = 6
let ItemUsername = 101
let ItemInviteLinks = 102
let ItemPreHistory = 103
let ItemPermissions = 104
let ItemAdmins = 105
let ItemAutoremove = 106
if case .creator = group.role {
if let cachedData = data.cachedData as? CachedGroupData {

View File

@ -24,12 +24,16 @@ def remove_codesign_dirs(dirs):
for dir in dirs:
if dir == 'SC_Info':
continue
if re.match('Watch/.*\\.appex/SC_Info', dir):
if re.match('^Watch/.*\\.appex/SC_Info', dir):
continue
if re.match('PlugIns/.*\\.appex/SC_Info', dir):
if re.match('^PlugIns/.*\\.appex/SC_Info', dir):
continue
if re.match('Frameworks/.*\\.framework/SC_Info', dir):
if re.match('^Frameworks/.*\\.framework/SC_Info', dir):
continue
if re.match('^Watch(/.*)?', dir):
continue
if re.match('^com\\.apple\\.WatchPlaceholder(/.*)?', dir):
continue
result.add(dir)
return result
@ -39,18 +43,20 @@ def remove_codesign_files(files):
for f in files:
if f == 'embedded.mobileprovision':
continue
if re.match('.*/.*\\.appex/embedded.mobileprovision', f):
if re.match('^.*/.*\\.appex/embedded.mobileprovision', f):
continue
if f == '_CodeSignature/CodeResources':
continue
if f == 'CrackerXI':
continue
if re.match('Watch/.*\\.app/embedded.mobileprovision', f):
if re.match('^Watch/.*\\.app/embedded.mobileprovision', f):
continue
if re.match('PlugIns/.*\\.appex/_CodeSignature/CodeResources', f):
if re.match('^PlugIns/.*\\.appex/_CodeSignature/CodeResources', f):
continue
if re.match('Frameworks/.*\\.framework/_CodeSignature/CodeResources', f):
if re.match('^Frameworks/.*\\.framework/_CodeSignature/CodeResources', f):
continue
if re.match('^Frameworks/libswift*', f):
continue
result.add(f)
return result
@ -59,8 +65,10 @@ def remove_watch_files(files):
result = set()
excluded = set()
for f in files:
if re.match('Watch/.*', f):
if re.match('^Watch/.*', f):
excluded.add(f)
elif re.match('^com\\.apple\\.WatchPlaceholder/.*', f):
excluded.add(f)
else:
result.add(f)
return (result, excluded)
@ -70,7 +78,7 @@ def remove_plugin_files(files):
result = set()
excluded = set()
for f in files:
if False and re.match('PlugIns/.*', f):
if False and re.match('^PlugIns/.*', f):
excluded.add(f)
else:
result.add(f)
@ -81,7 +89,7 @@ def remove_asset_files(files):
result = set()
excluded = set()
for f in files:
if re.match('.*\\.car', f):
if re.match('^.*\\.car', f):
excluded.add(f)
else:
result.add(f)
@ -92,7 +100,7 @@ def remove_nib_files(files):
result = set()
excluded = set()
for f in files:
if re.match('.*\\.nib', f):
if re.match('^.*\\.nib', f):
excluded.add(f)
else:
result.add(f)
@ -125,7 +133,7 @@ def is_binary(file):
def is_xcconfig(file):
if re.match('.*\\.xcconfig', file):
if re.match('^.*\\.xcconfig', file):
return True
else:
return False
@ -161,7 +169,7 @@ def is_plist(file1):
def diff_plists(file1, file2):
remove_properties = ['UISupportedDevices', 'DTAppStoreToolsBuild', 'MinimumOSVersion', 'BuildMachineOSBuild', 'CFBundleVersion']
remove_properties = ['UISupportedDevices', 'DTAppStoreToolsBuild', 'MinimumOSVersion', 'BuildMachineOSBuild', 'CFBundleVersion', 'ITSDRMScheme']
clean1_properties = ''
clean2_properties = ''
@ -250,12 +258,12 @@ def ipadiff(self_base_path, ipa1, ipa2):
clean_ipa1_files = remove_codesign_files(ipa1_files)
clean_ipa2_files = remove_codesign_files(ipa2_files)
diff_dirs(ipa1, clean_ipa1_dirs, ipa2, clean_ipa2_dirs)
diff_files(ipa1, clean_ipa1_files, ipa2, clean_ipa2_files)
clean_ipa1_files, watch_ipa1_files = remove_watch_files(clean_ipa1_files)
clean_ipa2_files, watch_ipa2_files = remove_watch_files(clean_ipa2_files)
diff_dirs(ipa1, clean_ipa1_dirs, ipa2, clean_ipa2_dirs)
diff_files(ipa1, clean_ipa1_files, ipa2, clean_ipa2_files)
clean_ipa1_files, plugin_ipa1_files = remove_plugin_files(clean_ipa1_files)
clean_ipa2_files, plugin_ipa2_files = remove_plugin_files(clean_ipa2_files)

View File

@ -78,6 +78,9 @@ static bool cleanArch(std::vector<uint8_t> &archData, bool &isEncrypted) {
if (encryptionInfoCommand->cryptid != 0) {
isEncrypted = true;
}
// The App Store has begun to change offsets in LC_ENCRYPTION_INFO
memset(archData.data() + offset + offsetof(encryption_info_command_64, cryptoff), 0, sizeof(uint32_t));
memset(archData.data() + offset + offsetof(encryption_info_command_64, cryptsize), 0, sizeof(uint32_t));
}
offset += commandSize;

View File

@ -1,5 +1,5 @@
{
"app": "7.4.2",
"bazel": "3.7.0",
"xcode": "12.3"
"bazel": "4.0.0",
"xcode": "12.4"
}