diff --git a/TelegramCore.xcodeproj/project.pbxproj b/TelegramCore.xcodeproj/project.pbxproj index 6147b7773d..4f86f10ff7 100644 --- a/TelegramCore.xcodeproj/project.pbxproj +++ b/TelegramCore.xcodeproj/project.pbxproj @@ -7,32 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - D03B0C951D6222CA00955575 /* NBAsYouTypeFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0C7B1D6222CA00955575 /* NBAsYouTypeFormatter.h */; }; - D03B0C961D6222CA00955575 /* NBAsYouTypeFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0C7C1D6222CA00955575 /* NBAsYouTypeFormatter.m */; }; - D03B0C971D6222CA00955575 /* NBMetadataCore.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0C7D1D6222CA00955575 /* NBMetadataCore.h */; }; - D03B0C981D6222CA00955575 /* NBMetadataCore.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0C7E1D6222CA00955575 /* NBMetadataCore.m */; }; - D03B0C991D6222CA00955575 /* NBMetadataCoreMapper.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0C7F1D6222CA00955575 /* NBMetadataCoreMapper.h */; }; - D03B0C9A1D6222CA00955575 /* NBMetadataCoreMapper.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0C801D6222CA00955575 /* NBMetadataCoreMapper.m */; }; - D03B0C9B1D6222CA00955575 /* NBMetadataCoreTest.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0C811D6222CA00955575 /* NBMetadataCoreTest.h */; }; - D03B0C9C1D6222CA00955575 /* NBMetadataCoreTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0C821D6222CA00955575 /* NBMetadataCoreTest.m */; }; - D03B0C9D1D6222CA00955575 /* NBMetadataCoreTestMapper.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0C831D6222CA00955575 /* NBMetadataCoreTestMapper.h */; }; - D03B0C9E1D6222CA00955575 /* NBMetadataCoreTestMapper.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0C841D6222CA00955575 /* NBMetadataCoreTestMapper.m */; }; - D03B0C9F1D6222CA00955575 /* NBMetadataHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0C851D6222CA00955575 /* NBMetadataHelper.h */; }; - D03B0CA01D6222CA00955575 /* NBMetadataHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0C861D6222CA00955575 /* NBMetadataHelper.m */; }; - D03B0CA11D6222CA00955575 /* NBNumberFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0C871D6222CA00955575 /* NBNumberFormat.h */; }; - D03B0CA21D6222CA00955575 /* NBNumberFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0C881D6222CA00955575 /* NBNumberFormat.m */; }; - D03B0CA31D6222CA00955575 /* NBPhoneMetaData.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0C891D6222CA00955575 /* NBPhoneMetaData.h */; }; - D03B0CA41D6222CA00955575 /* NBPhoneMetaData.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0C8A1D6222CA00955575 /* NBPhoneMetaData.m */; }; - D03B0CA51D6222CA00955575 /* NBPhoneMetaDataGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0C8B1D6222CA00955575 /* NBPhoneMetaDataGenerator.h */; }; - D03B0CA61D6222CA00955575 /* NBPhoneMetaDataGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0C8C1D6222CA00955575 /* NBPhoneMetaDataGenerator.m */; }; - D03B0CA71D6222CA00955575 /* NBPhoneNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0C8D1D6222CA00955575 /* NBPhoneNumber.h */; }; - D03B0CA81D6222CA00955575 /* NBPhoneNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0C8E1D6222CA00955575 /* NBPhoneNumber.m */; }; - D03B0CA91D6222CA00955575 /* NBPhoneNumberDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0C8F1D6222CA00955575 /* NBPhoneNumberDefines.h */; }; - D03B0CAA1D6222CA00955575 /* NBPhoneNumberDefines.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0C901D6222CA00955575 /* NBPhoneNumberDefines.m */; }; - D03B0CAB1D6222CA00955575 /* NBPhoneNumberDesc.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0C911D6222CA00955575 /* NBPhoneNumberDesc.h */; }; - D03B0CAC1D6222CA00955575 /* NBPhoneNumberDesc.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0C921D6222CA00955575 /* NBPhoneNumberDesc.m */; }; - D03B0CAD1D6222CA00955575 /* NBPhoneNumberUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0C931D6222CA00955575 /* NBPhoneNumberUtil.h */; }; - D03B0CAE1D6222CA00955575 /* NBPhoneNumberUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0C941D6222CA00955575 /* NBPhoneNumberUtil.m */; }; D03B0CB91D62233400955575 /* Either.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CB81D62233400955575 /* Either.swift */; }; D03B0CBB1D62233C00955575 /* MergeLists.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CBA1D62233C00955575 /* MergeLists.swift */; }; D03B0CBD1D62234300955575 /* Regex.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CBC1D62234300955575 /* Regex.swift */; }; @@ -55,7 +29,6 @@ D03B0CF71D62250800955575 /* TelegramMediaImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CEF1D62250800955575 /* TelegramMediaImage.swift */; }; D03B0CF81D62250800955575 /* TelegramMediaLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CF01D62250800955575 /* TelegramMediaLocation.swift */; }; D03B0CF91D62250800955575 /* TelegramMediaMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CF11D62250800955575 /* TelegramMediaMap.swift */; }; - D03B0CFA1D62250800955575 /* TelegramMediaVoiceNote.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CF21D62250800955575 /* TelegramMediaVoiceNote.swift */; }; D03B0CFB1D62250800955575 /* TelegramMediaWebpage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CF31D62250800955575 /* TelegramMediaWebpage.swift */; }; D03B0CFD1D62251400955575 /* TelegramMediaCloudLocations.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CFC1D62251400955575 /* TelegramMediaCloudLocations.swift */; }; D03B0D081D62255C00955575 /* ChannelState.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CFF1D62255C00955575 /* ChannelState.swift */; }; @@ -85,14 +58,11 @@ D03B0D721D631ABA00955575 /* SearchMessages.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D711D631ABA00955575 /* SearchMessages.swift */; }; D03B0E431D631E6600955575 /* NetworkLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0E411D631E6600955575 /* NetworkLogging.h */; }; D03B0E441D631E6600955575 /* NetworkLogging.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0E421D631E6600955575 /* NetworkLogging.m */; }; - D03B0E581D631EB900955575 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D03B0E571D631EB900955575 /* CoreMedia.framework */; }; D03B0E5C1D63241D00955575 /* TelegramCoreIncludes.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0E5B1D63240700955575 /* TelegramCoreIncludes.h */; }; - D03B0E5E1D6327F600955575 /* SSignalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D03B0E5D1D6327F600955575 /* SSignalKit.framework */; }; - D06706691D512ADB00DED3E3 /* AsyncDisplayKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D06706641D512ADB00DED3E3 /* AsyncDisplayKit.framework */; }; - D067066A1D512ADB00DED3E3 /* Display.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D06706651D512ADB00DED3E3 /* Display.framework */; }; D067066C1D512ADB00DED3E3 /* Postbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D06706671D512ADB00DED3E3 /* Postbox.framework */; }; D067066D1D512ADB00DED3E3 /* SwiftSignalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D06706681D512ADB00DED3E3 /* SwiftSignalKit.framework */; }; - D067066F1D512AEB00DED3E3 /* MtProtoKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D067066E1D512AEB00DED3E3 /* MtProtoKit.framework */; }; + D09A2FE61D7CD4940018FB72 /* TelegramChannel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09A2FE51D7CD4940018FB72 /* TelegramChannel.swift */; }; + D09A2FEB1D7CDC320018FB72 /* PeerAccessRestrictionInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09A2FEA1D7CDC320018FB72 /* PeerAccessRestrictionInfo.swift */; }; D09D8C0B1D4FAB1D0081DBEC /* TelegramCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D09D8C011D4FAB1D0081DBEC /* TelegramCore.framework */; }; D09D8C101D4FAB1D0081DBEC /* TelegramCoreTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D09D8C0F1D4FAB1D0081DBEC /* TelegramCoreTests.m */; }; D09D8C121D4FAB1D0081DBEC /* TelegramCore.h in Headers */ = {isa = PBXBuildFile; fileRef = D09D8C041D4FAB1D0081DBEC /* TelegramCore.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -101,7 +71,72 @@ D0AB0B961D662F0B002C78E7 /* ManagedChatListHoles.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AB0B951D662F0B002C78E7 /* ManagedChatListHoles.swift */; }; D0AB0B981D664E18002C78E7 /* ManagedUnsentMessageIndices.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AB0B971D664E18002C78E7 /* ManagedUnsentMessageIndices.swift */; }; D0AB0B9A1D666520002C78E7 /* ManagedSynchronizePeerReadStates.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AB0B991D666520002C78E7 /* ManagedSynchronizePeerReadStates.swift */; }; - D0F69EA41D6B8ED60046BCD6 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = D03B0E5F1D6327FF00955575 /* libz.tbd */; }; + D0B417C11D7DCEEF004562A4 /* ApiGroupOrChannel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B417C01D7DCEEF004562A4 /* ApiGroupOrChannel.swift */; }; + D0B4186B1D7E03D5004562A4 /* TelegramCoreMac.h in Headers */ = {isa = PBXBuildFile; fileRef = D0B418691D7E03D5004562A4 /* TelegramCoreMac.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D0B418721D7E0409004562A4 /* PostboxMac.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0B418701D7E0409004562A4 /* PostboxMac.framework */; }; + D0B418731D7E0409004562A4 /* SwiftSignalKitMac.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0B418711D7E0409004562A4 /* SwiftSignalKitMac.framework */; }; + D0B4187F1D7E054E004562A4 /* MtProtoKitMac.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0B4187E1D7E054E004562A4 /* MtProtoKitMac.framework */; }; + D0B418801D7E0567004562A4 /* Either.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CB81D62233400955575 /* Either.swift */; }; + D0B418811D7E0567004562A4 /* MergeLists.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CBA1D62233C00955575 /* MergeLists.swift */; }; + D0B418821D7E0567004562A4 /* Regex.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CBC1D62234300955575 /* Regex.swift */; }; + D0B418831D7E0567004562A4 /* Log.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CBE1D62234A00955575 /* Log.swift */; }; + D0B418841D7E0567004562A4 /* StringFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CC01D62235000955575 /* StringFormat.swift */; }; + D0B418851D7E0567004562A4 /* PhoneNumbers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CCD1D62239600955575 /* PhoneNumbers.swift */; }; + D0B418861D7E056D004562A4 /* Namespaces.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CD21D62244300955575 /* Namespaces.swift */; }; + D0B418871D7E0573004562A4 /* ApiUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CDA1D62245F00955575 /* ApiUtils.swift */; }; + D0B418881D7E0573004562A4 /* PeerUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CD81D62245B00955575 /* PeerUtils.swift */; }; + D0B418891D7E0573004562A4 /* PeerAccessRestrictionInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09A2FEA1D7CDC320018FB72 /* PeerAccessRestrictionInfo.swift */; }; + D0B4188A1D7E0573004562A4 /* TelegramUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CD41D62245300955575 /* TelegramUser.swift */; }; + D0B4188B1D7E0573004562A4 /* TelegramGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CD51D62245300955575 /* TelegramGroup.swift */; }; + D0B4188C1D7E0573004562A4 /* TelegramChannel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09A2FE51D7CD4940018FB72 /* TelegramChannel.swift */; }; + D0B4188D1D7E0573004562A4 /* ApiGroupOrChannel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B417C01D7DCEEF004562A4 /* ApiGroupOrChannel.swift */; }; + D0B4188E1D7E0578004562A4 /* StoreMessage_Telegram.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CDF1D62249100955575 /* StoreMessage_Telegram.swift */; }; + D0B4188F1D7E057C004562A4 /* ViewCountMessageAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CE71D6224AD00955575 /* ViewCountMessageAttribute.swift */; }; + D0B418901D7E057C004562A4 /* ReplyMessageAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CE51D6224A700955575 /* ReplyMessageAttribute.swift */; }; + D0B418911D7E057C004562A4 /* TextEntitiesMessageAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CE31D62249F00955575 /* TextEntitiesMessageAttribute.swift */; }; + D0B418921D7E057C004562A4 /* InlineBotMessageAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CE11D62249B00955575 /* InlineBotMessageAttribute.swift */; }; + D0B418931D7E0580004562A4 /* TelegramMediaCloudLocations.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CFC1D62251400955575 /* TelegramMediaCloudLocations.swift */; }; + D0B418941D7E0580004562A4 /* TelegramMediaAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CEC1D62250800955575 /* TelegramMediaAction.swift */; }; + D0B418951D7E0580004562A4 /* TelegramMediaContact.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CED1D62250800955575 /* TelegramMediaContact.swift */; }; + D0B418961D7E0580004562A4 /* TelegramMediaFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CEE1D62250800955575 /* TelegramMediaFile.swift */; }; + D0B418971D7E0580004562A4 /* TelegramMediaImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CEF1D62250800955575 /* TelegramMediaImage.swift */; }; + D0B418981D7E0580004562A4 /* TelegramMediaLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CF01D62250800955575 /* TelegramMediaLocation.swift */; }; + D0B418991D7E0580004562A4 /* TelegramMediaMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CF11D62250800955575 /* TelegramMediaMap.swift */; }; + D0B4189B1D7E0580004562A4 /* TelegramMediaWebpage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CF31D62250800955575 /* TelegramMediaWebpage.swift */; }; + D0B4189C1D7E0587004562A4 /* ChannelState.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0CFF1D62255C00955575 /* ChannelState.swift */; }; + D0B4189D1D7E0587004562A4 /* EnqueueMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D001D62255C00955575 /* EnqueueMessage.swift */; }; + D0B4189E1D7E0587004562A4 /* Holes.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D011D62255C00955575 /* Holes.swift */; }; + D0B4189F1D7E0587004562A4 /* SendUnsentMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D021D62255C00955575 /* SendUnsentMessage.swift */; }; + D0B418A01D7E0587004562A4 /* StateManagement.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D031D62255C00955575 /* StateManagement.swift */; }; + D0B418A11D7E0587004562A4 /* SynchronizePeerReadState.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D041D62255C00955575 /* SynchronizePeerReadState.swift */; }; + D0B418A21D7E0587004562A4 /* UpdateGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D051D62255C00955575 /* UpdateGroup.swift */; }; + D0B418A31D7E0587004562A4 /* UpdateMessageService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D061D62255C00955575 /* UpdateMessageService.swift */; }; + D0B418A41D7E0587004562A4 /* UpdatesApiUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D071D62255C00955575 /* UpdatesApiUtils.swift */; }; + D0B418A51D7E058E004562A4 /* DownloadFromCloudLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D491D631A3800955575 /* DownloadFromCloudLocation.swift */; }; + D0B418A61D7E0592004562A4 /* CloudFileMediaResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D431D6319F900955575 /* CloudFileMediaResource.swift */; }; + D0B418A71D7E0592004562A4 /* Fetch.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D391D6319E200955575 /* Fetch.swift */; }; + D0B418A81D7E0597004562A4 /* Api.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D541D631A6900955575 /* Api.swift */; }; + D0B418A91D7E0597004562A4 /* Buffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D551D631A6900955575 /* Buffer.swift */; }; + D0B418AA1D7E0597004562A4 /* Download.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D561D631A6900955575 /* Download.swift */; }; + D0B418AB1D7E0597004562A4 /* MultipartFetch.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D571D631A6900955575 /* MultipartFetch.swift */; }; + D0B418AC1D7E0597004562A4 /* Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D581D631A6900955575 /* Network.swift */; }; + D0B418AD1D7E0597004562A4 /* Serialization.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D591D631A6900955575 /* Serialization.swift */; }; + D0B418AE1D7E059F004562A4 /* Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D611D631A8B00955575 /* Account.swift */; }; + D0B418AF1D7E059F004562A4 /* AccountSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D621D631A8B00955575 /* AccountSettings.swift */; }; + D0B418B01D7E059F004562A4 /* AccountViewTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D631D631A8B00955575 /* AccountViewTracker.swift */; }; + D0B418B11D7E059F004562A4 /* RecentPeers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D641D631A8B00955575 /* RecentPeers.swift */; }; + D0B418B21D7E059F004562A4 /* ManagedServiceViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AB0B911D65E9FA002C78E7 /* ManagedServiceViews.swift */; }; + D0B418B31D7E059F004562A4 /* ManagedMessageHistoryHoles.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AB0B931D662ECE002C78E7 /* ManagedMessageHistoryHoles.swift */; }; + D0B418B41D7E059F004562A4 /* ManagedChatListHoles.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AB0B951D662F0B002C78E7 /* ManagedChatListHoles.swift */; }; + D0B418B51D7E059F004562A4 /* ManagedUnsentMessageIndices.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AB0B971D664E18002C78E7 /* ManagedUnsentMessageIndices.swift */; }; + D0B418B61D7E059F004562A4 /* ManagedSynchronizePeerReadStates.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AB0B991D666520002C78E7 /* ManagedSynchronizePeerReadStates.swift */; }; + D0B418B71D7E05A6004562A4 /* Phonebook.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D6A1D631A9D00955575 /* Phonebook.swift */; }; + D0B418B81D7E05A6004562A4 /* ContactManagement.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D6C1D631AA300955575 /* ContactManagement.swift */; }; + D0B418B91D7E05AD004562A4 /* SearchMessages.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03B0D711D631ABA00955575 /* SearchMessages.swift */; }; + D0B418BA1D7E05BB004562A4 /* NetworkLogging.m in Sources */ = {isa = PBXBuildFile; fileRef = D03B0E421D631E6600955575 /* NetworkLogging.m */; }; + D0B418BB1D7E05BE004562A4 /* NetworkLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0E411D631E6600955575 /* NetworkLogging.h */; }; + D0B418BC1D7E05D0004562A4 /* TelegramCoreIncludes.h in Headers */ = {isa = PBXBuildFile; fileRef = D03B0E5B1D63240700955575 /* TelegramCoreIncludes.h */; }; + D0CAF2EA1D75EC600011F558 /* MtProtoKitDynamic.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0CAF2E91D75EC600011F558 /* MtProtoKitDynamic.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -115,32 +150,6 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - D03B0C7B1D6222CA00955575 /* NBAsYouTypeFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBAsYouTypeFormatter.h; sourceTree = ""; }; - D03B0C7C1D6222CA00955575 /* NBAsYouTypeFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBAsYouTypeFormatter.m; sourceTree = ""; }; - D03B0C7D1D6222CA00955575 /* NBMetadataCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBMetadataCore.h; sourceTree = ""; }; - D03B0C7E1D6222CA00955575 /* NBMetadataCore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBMetadataCore.m; sourceTree = ""; }; - D03B0C7F1D6222CA00955575 /* NBMetadataCoreMapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBMetadataCoreMapper.h; sourceTree = ""; }; - D03B0C801D6222CA00955575 /* NBMetadataCoreMapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBMetadataCoreMapper.m; sourceTree = ""; }; - D03B0C811D6222CA00955575 /* NBMetadataCoreTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBMetadataCoreTest.h; sourceTree = ""; }; - D03B0C821D6222CA00955575 /* NBMetadataCoreTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBMetadataCoreTest.m; sourceTree = ""; }; - D03B0C831D6222CA00955575 /* NBMetadataCoreTestMapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBMetadataCoreTestMapper.h; sourceTree = ""; }; - D03B0C841D6222CA00955575 /* NBMetadataCoreTestMapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBMetadataCoreTestMapper.m; sourceTree = ""; }; - D03B0C851D6222CA00955575 /* NBMetadataHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBMetadataHelper.h; sourceTree = ""; }; - D03B0C861D6222CA00955575 /* NBMetadataHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBMetadataHelper.m; sourceTree = ""; }; - D03B0C871D6222CA00955575 /* NBNumberFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBNumberFormat.h; sourceTree = ""; }; - D03B0C881D6222CA00955575 /* NBNumberFormat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBNumberFormat.m; sourceTree = ""; }; - D03B0C891D6222CA00955575 /* NBPhoneMetaData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBPhoneMetaData.h; sourceTree = ""; }; - D03B0C8A1D6222CA00955575 /* NBPhoneMetaData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBPhoneMetaData.m; sourceTree = ""; }; - D03B0C8B1D6222CA00955575 /* NBPhoneMetaDataGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBPhoneMetaDataGenerator.h; sourceTree = ""; }; - D03B0C8C1D6222CA00955575 /* NBPhoneMetaDataGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBPhoneMetaDataGenerator.m; sourceTree = ""; }; - D03B0C8D1D6222CA00955575 /* NBPhoneNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBPhoneNumber.h; sourceTree = ""; }; - D03B0C8E1D6222CA00955575 /* NBPhoneNumber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBPhoneNumber.m; sourceTree = ""; }; - D03B0C8F1D6222CA00955575 /* NBPhoneNumberDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBPhoneNumberDefines.h; sourceTree = ""; }; - D03B0C901D6222CA00955575 /* NBPhoneNumberDefines.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBPhoneNumberDefines.m; sourceTree = ""; }; - D03B0C911D6222CA00955575 /* NBPhoneNumberDesc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBPhoneNumberDesc.h; sourceTree = ""; }; - D03B0C921D6222CA00955575 /* NBPhoneNumberDesc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBPhoneNumberDesc.m; sourceTree = ""; }; - D03B0C931D6222CA00955575 /* NBPhoneNumberUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NBPhoneNumberUtil.h; sourceTree = ""; }; - D03B0C941D6222CA00955575 /* NBPhoneNumberUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NBPhoneNumberUtil.m; sourceTree = ""; }; D03B0CB81D62233400955575 /* Either.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Either.swift; sourceTree = ""; }; D03B0CBA1D62233C00955575 /* MergeLists.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MergeLists.swift; sourceTree = ""; }; D03B0CBC1D62234300955575 /* Regex.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Regex.swift; sourceTree = ""; }; @@ -163,7 +172,6 @@ D03B0CEF1D62250800955575 /* TelegramMediaImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelegramMediaImage.swift; sourceTree = ""; }; D03B0CF01D62250800955575 /* TelegramMediaLocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelegramMediaLocation.swift; sourceTree = ""; }; D03B0CF11D62250800955575 /* TelegramMediaMap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelegramMediaMap.swift; sourceTree = ""; }; - D03B0CF21D62250800955575 /* TelegramMediaVoiceNote.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelegramMediaVoiceNote.swift; sourceTree = ""; }; D03B0CF31D62250800955575 /* TelegramMediaWebpage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelegramMediaWebpage.swift; sourceTree = ""; }; D03B0CFC1D62251400955575 /* TelegramMediaCloudLocations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelegramMediaCloudLocations.swift; sourceTree = ""; }; D03B0CFF1D62255C00955575 /* ChannelState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChannelState.swift; sourceTree = ""; }; @@ -209,6 +217,8 @@ D06706671D512ADB00DED3E3 /* Postbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Postbox.framework; path = "../../../../Library/Developer/Xcode/DerivedData/Telegram-iOS-diblohvjozhgaifjcniwdlixlilx/Build/Products/Debug-iphonesimulator/Postbox.framework"; sourceTree = ""; }; D06706681D512ADB00DED3E3 /* SwiftSignalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftSignalKit.framework; path = "../../../../Library/Developer/Xcode/DerivedData/Telegram-iOS-diblohvjozhgaifjcniwdlixlilx/Build/Products/Debug-iphonesimulator/SwiftSignalKit.framework"; sourceTree = ""; }; D067066E1D512AEB00DED3E3 /* MtProtoKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MtProtoKit.framework; path = "../../../../Library/Developer/Xcode/DerivedData/Telegram-iOS-diblohvjozhgaifjcniwdlixlilx/Build/Products/Debug-iphonesimulator/MtProtoKit.framework"; sourceTree = ""; }; + D09A2FE51D7CD4940018FB72 /* TelegramChannel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelegramChannel.swift; sourceTree = ""; }; + D09A2FEA1D7CDC320018FB72 /* PeerAccessRestrictionInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PeerAccessRestrictionInfo.swift; sourceTree = ""; }; D09D8C011D4FAB1D0081DBEC /* TelegramCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TelegramCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D09D8C041D4FAB1D0081DBEC /* TelegramCore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TelegramCore.h; sourceTree = ""; }; D09D8C051D4FAB1D0081DBEC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -220,6 +230,15 @@ D0AB0B951D662F0B002C78E7 /* ManagedChatListHoles.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ManagedChatListHoles.swift; sourceTree = ""; }; D0AB0B971D664E18002C78E7 /* ManagedUnsentMessageIndices.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ManagedUnsentMessageIndices.swift; sourceTree = ""; }; D0AB0B991D666520002C78E7 /* ManagedSynchronizePeerReadStates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ManagedSynchronizePeerReadStates.swift; sourceTree = ""; }; + D0AC49491D7097A400AA55DA /* SSignalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SSignalKit.framework; path = "../../../../Library/Developer/Xcode/DerivedData/Telegram-iOS-diblohvjozhgaifjcniwdlixlilx/Build/Products/Debug-iphoneos/SSignalKit.framework"; sourceTree = ""; }; + D0B417C01D7DCEEF004562A4 /* ApiGroupOrChannel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApiGroupOrChannel.swift; sourceTree = ""; }; + D0B418671D7E03D5004562A4 /* TelegramCoreMac.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TelegramCoreMac.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0B418691D7E03D5004562A4 /* TelegramCoreMac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TelegramCoreMac.h; sourceTree = ""; }; + D0B4186A1D7E03D5004562A4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D0B418701D7E0409004562A4 /* PostboxMac.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PostboxMac.framework; path = "../../../../Library/Developer/Xcode/DerivedData/Telegram-iOS-diblohvjozhgaifjcniwdlixlilx/Build/Products/Debug/PostboxMac.framework"; sourceTree = ""; }; + D0B418711D7E0409004562A4 /* SwiftSignalKitMac.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftSignalKitMac.framework; path = "../../../../Library/Developer/Xcode/DerivedData/Telegram-iOS-diblohvjozhgaifjcniwdlixlilx/Build/Products/Debug/SwiftSignalKitMac.framework"; sourceTree = ""; }; + D0B4187E1D7E054E004562A4 /* MtProtoKitMac.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MtProtoKitMac.framework; path = "../../../../Library/Developer/Xcode/DerivedData/Telegram-iOS-diblohvjozhgaifjcniwdlixlilx/Build/Products/Debug/MtProtoKitMac.framework"; sourceTree = ""; }; + D0CAF2E91D75EC600011F558 /* MtProtoKitDynamic.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MtProtoKitDynamic.framework; path = "../../../../Library/Developer/Xcode/DerivedData/Telegram-iOS-diblohvjozhgaifjcniwdlixlilx/Build/Products/Debug-iphonesimulator/MtProtoKitDynamic.framework"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -227,12 +246,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D0F69EA41D6B8ED60046BCD6 /* libz.tbd in Frameworks */, - D03B0E5E1D6327F600955575 /* SSignalKit.framework in Frameworks */, - D03B0E581D631EB900955575 /* CoreMedia.framework in Frameworks */, - D067066F1D512AEB00DED3E3 /* MtProtoKit.framework in Frameworks */, - D06706691D512ADB00DED3E3 /* AsyncDisplayKit.framework in Frameworks */, - D067066A1D512ADB00DED3E3 /* Display.framework in Frameworks */, + D0CAF2EA1D75EC600011F558 /* MtProtoKitDynamic.framework in Frameworks */, D067066C1D512ADB00DED3E3 /* Postbox.framework in Frameworks */, D067066D1D512ADB00DED3E3 /* SwiftSignalKit.framework in Frameworks */, ); @@ -246,6 +260,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D0B418631D7E03D5004562A4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D0B4187F1D7E054E004562A4 /* MtProtoKitMac.framework in Frameworks */, + D0B418721D7E0409004562A4 /* PostboxMac.framework in Frameworks */, + D0B418731D7E0409004562A4 /* SwiftSignalKitMac.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -260,32 +284,6 @@ D03B0C7A1D6222CA00955575 /* libphonenumber-iOS */ = { isa = PBXGroup; children = ( - D03B0C7B1D6222CA00955575 /* NBAsYouTypeFormatter.h */, - D03B0C7C1D6222CA00955575 /* NBAsYouTypeFormatter.m */, - D03B0C7D1D6222CA00955575 /* NBMetadataCore.h */, - D03B0C7E1D6222CA00955575 /* NBMetadataCore.m */, - D03B0C7F1D6222CA00955575 /* NBMetadataCoreMapper.h */, - D03B0C801D6222CA00955575 /* NBMetadataCoreMapper.m */, - D03B0C811D6222CA00955575 /* NBMetadataCoreTest.h */, - D03B0C821D6222CA00955575 /* NBMetadataCoreTest.m */, - D03B0C831D6222CA00955575 /* NBMetadataCoreTestMapper.h */, - D03B0C841D6222CA00955575 /* NBMetadataCoreTestMapper.m */, - D03B0C851D6222CA00955575 /* NBMetadataHelper.h */, - D03B0C861D6222CA00955575 /* NBMetadataHelper.m */, - D03B0C871D6222CA00955575 /* NBNumberFormat.h */, - D03B0C881D6222CA00955575 /* NBNumberFormat.m */, - D03B0C891D6222CA00955575 /* NBPhoneMetaData.h */, - D03B0C8A1D6222CA00955575 /* NBPhoneMetaData.m */, - D03B0C8B1D6222CA00955575 /* NBPhoneMetaDataGenerator.h */, - D03B0C8C1D6222CA00955575 /* NBPhoneMetaDataGenerator.m */, - D03B0C8D1D6222CA00955575 /* NBPhoneNumber.h */, - D03B0C8E1D6222CA00955575 /* NBPhoneNumber.m */, - D03B0C8F1D6222CA00955575 /* NBPhoneNumberDefines.h */, - D03B0C901D6222CA00955575 /* NBPhoneNumberDefines.m */, - D03B0C911D6222CA00955575 /* NBPhoneNumberDesc.h */, - D03B0C921D6222CA00955575 /* NBPhoneNumberDesc.m */, - D03B0C931D6222CA00955575 /* NBPhoneNumberUtil.h */, - D03B0C941D6222CA00955575 /* NBPhoneNumberUtil.m */, ); name = "libphonenumber-iOS"; path = "third-party/libphonenumber-iOS"; @@ -319,8 +317,11 @@ children = ( D03B0CDA1D62245F00955575 /* ApiUtils.swift */, D03B0CD81D62245B00955575 /* PeerUtils.swift */, + D09A2FEA1D7CDC320018FB72 /* PeerAccessRestrictionInfo.swift */, D03B0CD41D62245300955575 /* TelegramUser.swift */, D03B0CD51D62245300955575 /* TelegramGroup.swift */, + D09A2FE51D7CD4940018FB72 /* TelegramChannel.swift */, + D0B417C01D7DCEEF004562A4 /* ApiGroupOrChannel.swift */, ); name = Peers; sourceTree = ""; @@ -356,7 +357,6 @@ D03B0CEF1D62250800955575 /* TelegramMediaImage.swift */, D03B0CF01D62250800955575 /* TelegramMediaLocation.swift */, D03B0CF11D62250800955575 /* TelegramMediaMap.swift */, - D03B0CF21D62250800955575 /* TelegramMediaVoiceNote.swift */, D03B0CF31D62250800955575 /* TelegramMediaWebpage.swift */, ); name = Media; @@ -455,6 +455,11 @@ D06706631D512ADA00DED3E3 /* Frameworks */ = { isa = PBXGroup; children = ( + D0B4187E1D7E054E004562A4 /* MtProtoKitMac.framework */, + D0B418701D7E0409004562A4 /* PostboxMac.framework */, + D0B418711D7E0409004562A4 /* SwiftSignalKitMac.framework */, + D0CAF2E91D75EC600011F558 /* MtProtoKitDynamic.framework */, + D0AC49491D7097A400AA55DA /* SSignalKit.framework */, D03B0E6B1D63283C00955575 /* libiconv.tbd */, D03B0E691D63283000955575 /* libwebp.a */, D03B0E611D63281A00955575 /* libavcodec.a */, @@ -479,6 +484,7 @@ D03B0E591D63215200955575 /* TelegramCore.xcconfig */, D09D8C031D4FAB1D0081DBEC /* TelegramCore */, D09D8C0E1D4FAB1D0081DBEC /* TelegramCoreTests */, + D0B418681D7E03D5004562A4 /* TelegramCoreMac */, D09D8C021D4FAB1D0081DBEC /* Products */, D06706631D512ADA00DED3E3 /* Frameworks */, ); @@ -489,6 +495,7 @@ children = ( D09D8C011D4FAB1D0081DBEC /* TelegramCore.framework */, D09D8C0A1D4FAB1D0081DBEC /* TelegramCoreTests.xctest */, + D0B418671D7E03D5004562A4 /* TelegramCoreMac.framework */, ); name = Products; sourceTree = ""; @@ -521,6 +528,15 @@ path = TelegramCoreTests; sourceTree = ""; }; + D0B418681D7E03D5004562A4 /* TelegramCoreMac */ = { + isa = PBXGroup; + children = ( + D0B418691D7E03D5004562A4 /* TelegramCoreMac.h */, + D0B4186A1D7E03D5004562A4 /* Info.plist */, + ); + path = TelegramCoreMac; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -528,22 +544,19 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - D03B0CA11D6222CA00955575 /* NBNumberFormat.h in Headers */, - D03B0CA91D6222CA00955575 /* NBPhoneNumberDefines.h in Headers */, D03B0E431D631E6600955575 /* NetworkLogging.h in Headers */, - D03B0C9B1D6222CA00955575 /* NBMetadataCoreTest.h in Headers */, - D03B0CAB1D6222CA00955575 /* NBPhoneNumberDesc.h in Headers */, - D03B0CA51D6222CA00955575 /* NBPhoneMetaDataGenerator.h in Headers */, D09D8C121D4FAB1D0081DBEC /* TelegramCore.h in Headers */, D03B0E5C1D63241D00955575 /* TelegramCoreIncludes.h in Headers */, - D03B0CA31D6222CA00955575 /* NBPhoneMetaData.h in Headers */, - D03B0CA71D6222CA00955575 /* NBPhoneNumber.h in Headers */, - D03B0C951D6222CA00955575 /* NBAsYouTypeFormatter.h in Headers */, - D03B0C9F1D6222CA00955575 /* NBMetadataHelper.h in Headers */, - D03B0C971D6222CA00955575 /* NBMetadataCore.h in Headers */, - D03B0C991D6222CA00955575 /* NBMetadataCoreMapper.h in Headers */, - D03B0CAD1D6222CA00955575 /* NBPhoneNumberUtil.h in Headers */, - D03B0C9D1D6222CA00955575 /* NBMetadataCoreTestMapper.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D0B418641D7E03D5004562A4 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D0B4186B1D7E03D5004562A4 /* TelegramCoreMac.h in Headers */, + D0B418BC1D7E05D0004562A4 /* TelegramCoreIncludes.h in Headers */, + D0B418BB1D7E05BE004562A4 /* NetworkLogging.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -586,6 +599,24 @@ productReference = D09D8C0A1D4FAB1D0081DBEC /* TelegramCoreTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + D0B418661D7E03D5004562A4 /* TelegramCoreMac */ = { + isa = PBXNativeTarget; + buildConfigurationList = D0B4186C1D7E03D5004562A4 /* Build configuration list for PBXNativeTarget "TelegramCoreMac" */; + buildPhases = ( + D0B418621D7E03D5004562A4 /* Sources */, + D0B418631D7E03D5004562A4 /* Frameworks */, + D0B418641D7E03D5004562A4 /* Headers */, + D0B418651D7E03D5004562A4 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = TelegramCoreMac; + productName = TelegramCoreMac; + productReference = D0B418671D7E03D5004562A4 /* TelegramCoreMac.framework */; + productType = "com.apple.product-type.framework"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -608,6 +639,10 @@ DevelopmentTeamName = "TELEGRAM MESSENGER LLP"; ProvisioningStyle = Automatic; }; + D0B418661D7E03D5004562A4 = { + CreatedOnToolsVersion = 8.0; + ProvisioningStyle = Manual; + }; }; }; buildConfigurationList = D09D8BFB1D4FAB1D0081DBEC /* Build configuration list for PBXProject "TelegramCore" */; @@ -624,6 +659,7 @@ targets = ( D09D8C001D4FAB1D0081DBEC /* TelegramCore */, D09D8C091D4FAB1D0081DBEC /* TelegramCoreTests */, + D0B418661D7E03D5004562A4 /* TelegramCoreMac */, ); }; /* End PBXProject section */ @@ -643,6 +679,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D0B418651D7E03D5004562A4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -655,21 +698,16 @@ D03B0CB91D62233400955575 /* Either.swift in Sources */, D03B0CBD1D62234300955575 /* Regex.swift in Sources */, D03B0D661D631A8B00955575 /* AccountSettings.swift in Sources */, + D09A2FE61D7CD4940018FB72 /* TelegramChannel.swift in Sources */, D03B0D0E1D62255C00955575 /* UpdateGroup.swift in Sources */, D03B0CF71D62250800955575 /* TelegramMediaImage.swift in Sources */, - D03B0CAC1D6222CA00955575 /* NBPhoneNumberDesc.m in Sources */, D03B0D6B1D631A9D00955575 /* Phonebook.swift in Sources */, D03B0D3D1D6319E200955575 /* Fetch.swift in Sources */, - D03B0CA01D6222CA00955575 /* NBMetadataHelper.m in Sources */, - D03B0CAE1D6222CA00955575 /* NBPhoneNumberUtil.m in Sources */, D03B0D4E1D631A3800955575 /* DownloadFromCloudLocation.swift in Sources */, D03B0D681D631A8B00955575 /* RecentPeers.swift in Sources */, - D03B0C9E1D6222CA00955575 /* NBMetadataCoreTestMapper.m in Sources */, D03B0D5F1D631A6900955575 /* Serialization.swift in Sources */, D03B0D441D6319F900955575 /* CloudFileMediaResource.swift in Sources */, - D03B0C961D6222CA00955575 /* NBAsYouTypeFormatter.m in Sources */, D0AB0B921D65E9FA002C78E7 /* ManagedServiceViews.swift in Sources */, - D03B0CA21D6222CA00955575 /* NBNumberFormat.m in Sources */, D03B0CCE1D62239600955575 /* PhoneNumbers.swift in Sources */, D03B0D5A1D631A6900955575 /* Api.swift in Sources */, D03B0CDB1D62245F00955575 /* ApiUtils.swift in Sources */, @@ -679,25 +717,20 @@ D03B0D5E1D631A6900955575 /* Network.swift in Sources */, D03B0CF51D62250800955575 /* TelegramMediaContact.swift in Sources */, D03B0CFB1D62250800955575 /* TelegramMediaWebpage.swift in Sources */, + D09A2FEB1D7CDC320018FB72 /* PeerAccessRestrictionInfo.swift in Sources */, D0AB0B981D664E18002C78E7 /* ManagedUnsentMessageIndices.swift in Sources */, D03B0CF91D62250800955575 /* TelegramMediaMap.swift in Sources */, D03B0D671D631A8B00955575 /* AccountViewTracker.swift in Sources */, D03B0D101D62255C00955575 /* UpdatesApiUtils.swift in Sources */, D03B0CBF1D62234A00955575 /* Log.swift in Sources */, D03B0CD61D62245300955575 /* TelegramUser.swift in Sources */, - D03B0C9C1D6222CA00955575 /* NBMetadataCoreTest.m in Sources */, D03B0CD91D62245B00955575 /* PeerUtils.swift in Sources */, D03B0CE41D62249F00955575 /* TextEntitiesMessageAttribute.swift in Sources */, - D03B0C9A1D6222CA00955575 /* NBMetadataCoreMapper.m in Sources */, D03B0CD31D62244300955575 /* Namespaces.swift in Sources */, D03B0D6D1D631AA300955575 /* ContactManagement.swift in Sources */, D03B0D0F1D62255C00955575 /* UpdateMessageService.swift in Sources */, D03B0CF61D62250800955575 /* TelegramMediaFile.swift in Sources */, - D03B0C981D6222CA00955575 /* NBMetadataCore.m in Sources */, D03B0CE81D6224AD00955575 /* ViewCountMessageAttribute.swift in Sources */, - D03B0CA41D6222CA00955575 /* NBPhoneMetaData.m in Sources */, - D03B0CAA1D6222CA00955575 /* NBPhoneNumberDefines.m in Sources */, - D03B0CA61D6222CA00955575 /* NBPhoneMetaDataGenerator.m in Sources */, D03B0D0C1D62255C00955575 /* StateManagement.swift in Sources */, D03B0D721D631ABA00955575 /* SearchMessages.swift in Sources */, D03B0D5C1D631A6900955575 /* Download.swift in Sources */, @@ -709,13 +742,12 @@ D0AB0B9A1D666520002C78E7 /* ManagedSynchronizePeerReadStates.swift in Sources */, D03B0D5B1D631A6900955575 /* Buffer.swift in Sources */, D03B0E441D631E6600955575 /* NetworkLogging.m in Sources */, - D03B0CA81D6222CA00955575 /* NBPhoneNumber.m in Sources */, - D03B0CFA1D62250800955575 /* TelegramMediaVoiceNote.swift in Sources */, D03B0CBB1D62233C00955575 /* MergeLists.swift in Sources */, D03B0CC11D62235000955575 /* StringFormat.swift in Sources */, D03B0D651D631A8B00955575 /* Account.swift in Sources */, D0AB0B941D662ECE002C78E7 /* ManagedMessageHistoryHoles.swift in Sources */, D03B0CF41D62250800955575 /* TelegramMediaAction.swift in Sources */, + D0B417C11D7DCEEF004562A4 /* ApiGroupOrChannel.swift in Sources */, D03B0D0B1D62255C00955575 /* SendUnsentMessage.swift in Sources */, D03B0D0D1D62255C00955575 /* SynchronizePeerReadState.swift in Sources */, D03B0D081D62255C00955575 /* ChannelState.swift in Sources */, @@ -730,6 +762,71 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D0B418621D7E03D5004562A4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D0B418A71D7E0592004562A4 /* Fetch.swift in Sources */, + D0B418A51D7E058E004562A4 /* DownloadFromCloudLocation.swift in Sources */, + D0B418931D7E0580004562A4 /* TelegramMediaCloudLocations.swift in Sources */, + D0B418911D7E057C004562A4 /* TextEntitiesMessageAttribute.swift in Sources */, + D0B4189E1D7E0587004562A4 /* Holes.swift in Sources */, + D0B418B81D7E05A6004562A4 /* ContactManagement.swift in Sources */, + D0B418AC1D7E0597004562A4 /* Network.swift in Sources */, + D0B418981D7E0580004562A4 /* TelegramMediaLocation.swift in Sources */, + D0B4189C1D7E0587004562A4 /* ChannelState.swift in Sources */, + D0B4188B1D7E0573004562A4 /* TelegramGroup.swift in Sources */, + D0B418A41D7E0587004562A4 /* UpdatesApiUtils.swift in Sources */, + D0B418A81D7E0597004562A4 /* Api.swift in Sources */, + D0B418A31D7E0587004562A4 /* UpdateMessageService.swift in Sources */, + D0B418811D7E0567004562A4 /* MergeLists.swift in Sources */, + D0B418951D7E0580004562A4 /* TelegramMediaContact.swift in Sources */, + D0B418AF1D7E059F004562A4 /* AccountSettings.swift in Sources */, + D0B418851D7E0567004562A4 /* PhoneNumbers.swift in Sources */, + D0B418AE1D7E059F004562A4 /* Account.swift in Sources */, + D0B418841D7E0567004562A4 /* StringFormat.swift in Sources */, + D0B418901D7E057C004562A4 /* ReplyMessageAttribute.swift in Sources */, + D0B418801D7E0567004562A4 /* Either.swift in Sources */, + D0B418871D7E0573004562A4 /* ApiUtils.swift in Sources */, + D0B418831D7E0567004562A4 /* Log.swift in Sources */, + D0B418961D7E0580004562A4 /* TelegramMediaFile.swift in Sources */, + D0B4189B1D7E0580004562A4 /* TelegramMediaWebpage.swift in Sources */, + D0B418B31D7E059F004562A4 /* ManagedMessageHistoryHoles.swift in Sources */, + D0B418921D7E057C004562A4 /* InlineBotMessageAttribute.swift in Sources */, + D0B418A61D7E0592004562A4 /* CloudFileMediaResource.swift in Sources */, + D0B418A91D7E0597004562A4 /* Buffer.swift in Sources */, + D0B418B91D7E05AD004562A4 /* SearchMessages.swift in Sources */, + D0B4188F1D7E057C004562A4 /* ViewCountMessageAttribute.swift in Sources */, + D0B4188A1D7E0573004562A4 /* TelegramUser.swift in Sources */, + D0B4189D1D7E0587004562A4 /* EnqueueMessage.swift in Sources */, + D0B4188C1D7E0573004562A4 /* TelegramChannel.swift in Sources */, + D0B418B61D7E059F004562A4 /* ManagedSynchronizePeerReadStates.swift in Sources */, + D0B418AA1D7E0597004562A4 /* Download.swift in Sources */, + D0B418A01D7E0587004562A4 /* StateManagement.swift in Sources */, + D0B4188E1D7E0578004562A4 /* StoreMessage_Telegram.swift in Sources */, + D0B418991D7E0580004562A4 /* TelegramMediaMap.swift in Sources */, + D0B4188D1D7E0573004562A4 /* ApiGroupOrChannel.swift in Sources */, + D0B418BA1D7E05BB004562A4 /* NetworkLogging.m in Sources */, + D0B418B41D7E059F004562A4 /* ManagedChatListHoles.swift in Sources */, + D0B418A21D7E0587004562A4 /* UpdateGroup.swift in Sources */, + D0B418A11D7E0587004562A4 /* SynchronizePeerReadState.swift in Sources */, + D0B418B21D7E059F004562A4 /* ManagedServiceViews.swift in Sources */, + D0B418891D7E0573004562A4 /* PeerAccessRestrictionInfo.swift in Sources */, + D0B418941D7E0580004562A4 /* TelegramMediaAction.swift in Sources */, + D0B418821D7E0567004562A4 /* Regex.swift in Sources */, + D0B418AB1D7E0597004562A4 /* MultipartFetch.swift in Sources */, + D0B418B71D7E05A6004562A4 /* Phonebook.swift in Sources */, + D0B418861D7E056D004562A4 /* Namespaces.swift in Sources */, + D0B418AD1D7E0597004562A4 /* Serialization.swift in Sources */, + D0B418881D7E0573004562A4 /* PeerUtils.swift in Sources */, + D0B4189F1D7E0587004562A4 /* SendUnsentMessage.swift in Sources */, + D0B418B51D7E059F004562A4 /* ManagedUnsentMessageIndices.swift in Sources */, + D0B418971D7E0580004562A4 /* TelegramMediaImage.swift in Sources */, + D0B418B11D7E059F004562A4 /* RecentPeers.swift in Sources */, + D0B418B01D7E059F004562A4 /* AccountViewTracker.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -775,7 +872,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -795,6 +893,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + COPY_PHASE_STRIP = YES; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = X834Q8SBVP; DYLIB_COMPATIBILITY_VERSION = 1; @@ -809,7 +908,7 @@ "$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib", "$(PROJECT_DIR)/third-party/libwebp/lib", ); - OTHER_LDFLAGS = "-ObjC"; + OTHER_LDFLAGS = "-Wl,-dead_strip"; PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramCore; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -870,7 +969,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -915,7 +1015,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -949,7 +1050,7 @@ "$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib", "$(PROJECT_DIR)/third-party/libwebp/lib", ); - OTHER_LDFLAGS = "-ObjC"; + OTHER_LDFLAGS = "-Wl,-dead_strip"; PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramCore; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -968,6 +1069,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + COPY_PHASE_STRIP = YES; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = X834Q8SBVP; DYLIB_COMPATIBILITY_VERSION = 1; @@ -982,7 +1084,7 @@ "$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib", "$(PROJECT_DIR)/third-party/libwebp/lib", ); - OTHER_LDFLAGS = "-ObjC"; + OTHER_LDFLAGS = "-Wl,-dead_strip"; PRODUCT_BUNDLE_IDENTIFIER = org.telegram.TelegramCore; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1014,6 +1116,88 @@ }; name = Release; }; + D0B4186D1D7E03D5004562A4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = TelegramCoreMac/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.Telegram.TelegramCoreMac; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + D0B4186E1D7E03D5004562A4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = TelegramCoreMac/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.Telegram.TelegramCoreMac; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; + D0B4186F1D7E03D5004562A4 /* Hockeyapp */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = TelegramCoreMac/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + PRODUCT_BUNDLE_IDENTIFIER = org.telegram.Telegram.TelegramCoreMac; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 3.0; + }; + name = Hockeyapp; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -1047,6 +1231,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + D0B4186C1D7E03D5004562A4 /* Build configuration list for PBXNativeTarget "TelegramCoreMac" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D0B4186D1D7E03D5004562A4 /* Debug */, + D0B4186E1D7E03D5004562A4 /* Release */, + D0B4186F1D7E03D5004562A4 /* Hockeyapp */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = D09D8BF81D4FAB1D0081DBEC /* Project object */; diff --git a/TelegramCore.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/TelegramCoreMac.xcscheme b/TelegramCore.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/TelegramCoreMac.xcscheme new file mode 100644 index 0000000000..d24ff0c01f --- /dev/null +++ b/TelegramCore.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/TelegramCoreMac.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TelegramCore.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/xcschememanagement.plist b/TelegramCore.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/xcschememanagement.plist index e5f38dbfbd..8644d96f6c 100644 --- a/TelegramCore.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/TelegramCore.xcodeproj/xcuserdata/peter.xcuserdatad/xcschemes/xcschememanagement.plist @@ -9,6 +9,11 @@ orderHint 1 + TelegramCoreMac.xcscheme + + orderHint + 26 + SuppressBuildableAutocreation @@ -22,6 +27,11 @@ primary + D0B418661D7E03D5004562A4 + + primary + + diff --git a/TelegramCore/Account.swift b/TelegramCore/Account.swift index a1861f3f3c..b6f9a1762e 100644 --- a/TelegramCore/Account.swift +++ b/TelegramCore/Account.swift @@ -1,8 +1,13 @@ import Foundation -import SwiftSignalKit -import Postbox -import MtProtoKit -import Display +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac + import MtProtoKitMac +#else + import Postbox + import SwiftSignalKit + import MtProtoKitDynamic +#endif import TelegramCorePrivateModule public struct AccountId { @@ -168,20 +173,23 @@ public class UnauthorizedAccount { self.network = network } - public func changedMasterDatacenterId(_ masterDatacenterId: Int32) -> UnauthorizedAccount { + public func changedMasterDatacenterId(_ masterDatacenterId: Int32) -> Signal { if masterDatacenterId == Int32(self.network.mtProto.datacenterId) { - return self + return .single(self) } else { let postbox = self.postbox let keychain = Keychain(get: { key in return postbox.keychainEntryForKey(key) - }, set: { (key, data) in - postbox.setKeychainEntryForKey(key, value: data) - }, remove: { key in - postbox.removeKeychainEntryForKey(key) + }, set: { (key, data) in + postbox.setKeychainEntryForKey(key, value: data) + }, remove: { key in + postbox.removeKeychainEntryForKey(key) }) - return UnauthorizedAccount(id: self.id, postbox: self.postbox, network: Network(datacenterId: Int(masterDatacenterId), keychain: keychain)) + return initializedNetwork(datacenterId: Int(masterDatacenterId), keychain: keychain) + |> map { network in + return UnauthorizedAccount(id: self.id, postbox: self.postbox, network: network) + } } } } @@ -191,9 +199,9 @@ private var declaredEncodables: Void = { declareEncodable(AuthorizedAccountState.self, f: { AuthorizedAccountState(decoder: $0) }) declareEncodable(TelegramUser.self, f: { TelegramUser(decoder: $0) }) declareEncodable(TelegramGroup.self, f: { TelegramGroup(decoder: $0) }) + declareEncodable(TelegramChannel.self, f: { TelegramChannel(decoder: $0) }) declareEncodable(TelegramMediaImage.self, f: { TelegramMediaImage(decoder: $0) }) declareEncodable(TelegramMediaImageRepresentation.self, f: { TelegramMediaImageRepresentation(decoder: $0) }) - declareEncodable(TelegramMediaVoiceNote.self, f: { TelegramMediaVoiceNote(decoder: $0) }) declareEncodable(TelegramMediaContact.self, f: { TelegramMediaContact(decoder: $0) }) declareEncodable(TelegramMediaMap.self, f: { TelegramMediaMap(decoder: $0) }) declareEncodable(TelegramMediaFile.self, f: { TelegramMediaFile(decoder: $0) }) @@ -226,7 +234,7 @@ public func accountWithId(_ id: AccountId, appGroupPath: String) -> Signal map { (postbox, accountState) in + } |> mapToSignal { (postbox, accountState) -> Signal, NoError> in let keychain = Keychain(get: { key in return postbox.keychainEntryForKey(key) }, set: { (key, data) in @@ -238,15 +246,24 @@ public func accountWithId(_ id: AccountId, appGroupPath: String) -> Signal map { network -> Either in + .left(value: UnauthorizedAccount(id: id, postbox: postbox, network: network)) + } case let authorizedState as AuthorizedAccountState: - return .right(value: Account(id: id, postbox: postbox, network: Network(datacenterId: Int(authorizedState.masterDatacenterId), keychain: keychain), peerId: authorizedState.peerId)) + return initializedNetwork(datacenterId: Int(authorizedState.masterDatacenterId), keychain: keychain) + |> map { network -> Either in + return .right(value: Account(id: id, postbox: postbox, network: network, peerId: authorizedState.peerId)) + } case _: assertionFailure("Unexpected accountState \(accountState)") } } - return .left(value: UnauthorizedAccount(id: id, postbox: postbox, network: Network(datacenterId: 2, keychain: keychain))) + return initializedNetwork(datacenterId: 2, keychain: keychain) + |> map { network -> Either in + return .left(value: UnauthorizedAccount(id: id, postbox: postbox, network: network)) + } } } @@ -346,10 +363,16 @@ public class Account { let appVersionString = "\(Bundle.main.infoDictionary?["CFBundleShortVersionString"] ?? "") (\(Bundle.main.infoDictionary?["CFBundleVersion"] ?? ""))" - let langCode = NSLocale.preferredLanguages.first ?? "en" - return network.request(Api.functions.account.registerDevice(tokenType: 1, token: tokenString, deviceModel: "iPhome Simulator", systemVersion: UIDevice.current.systemVersion, appVersion: appVersionString, appSandbox: .boolTrue, langCode: langCode)) + #if os(macOS) + let pInfo = ProcessInfo.processInfo + let systemVersion = pInfo.operatingSystemVersionString + #else + let systemVersion = UIDevice.current.systemVersion + #endif + + return network.request(Api.functions.account.registerDevice(tokenType: 1, token: tokenString, deviceModel: "iPhome Simulator", systemVersion: systemVersion, appVersion: appVersionString, appSandbox: .boolTrue, langCode: langCode)) |> retryRequest |> mapToSignal { _ -> Signal in return .complete() diff --git a/TelegramCore/AccountSettings.swift b/TelegramCore/AccountSettings.swift index 47a9c240d1..4cfece3e0a 100644 --- a/TelegramCore/AccountSettings.swift +++ b/TelegramCore/AccountSettings.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public struct AutomaticDownloadSettings { public let downloadPhoto: Bool diff --git a/TelegramCore/AccountViewTracker.swift b/TelegramCore/AccountViewTracker.swift index d4921a0ea3..7d99f062b6 100644 --- a/TelegramCore/AccountViewTracker.swift +++ b/TelegramCore/AccountViewTracker.swift @@ -1,7 +1,13 @@ import Foundation -import Postbox -import SwiftSignalKit -import MtProtoKit +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac + import MtProtoKitMac +#else + import Postbox + import SwiftSignalKit + import MtProtoKitDynamic +#endif private func pendingWebpages(entries: [MessageHistoryEntry]) -> Set { var messageIds = Set() @@ -54,8 +60,9 @@ private func fetchWebpage(account: Account, messageId: MessageId) -> Signal Void in var peers: [Peer] = [] for chat in chats { - let telegramGroup = TelegramGroup(chat: chat) - peers.append(telegramGroup) + if let groupOrChannel = parseTelegramGroupOrChannel(chat: chat) { + peers.append(groupOrChannel) + } } for user in users { let telegramUser = TelegramUser(user: user) diff --git a/TelegramCore/Api.swift b/TelegramCore/Api.swift index cf079aca88..f59227d287 100644 --- a/TelegramCore/Api.swift +++ b/TelegramCore/Api.swift @@ -10,6 +10,11 @@ fileprivate final class FunctionDescription: CustomStringConvertible { } } +public protocol ApiSerializeableObject { + func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool +} + + fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { var dict: [Int32 : (BufferReader) -> Any?] = [:] dict[-1471112230] = { return $0.readInt32() } @@ -170,8 +175,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-471670279] = { return Api.ChannelParticipant.parse_channelParticipantCreator($0) } dict[471043349] = { return Api.contacts.Blocked.parse_blocked($0) } dict[-1878523231] = { return Api.contacts.Blocked.parse_blockedSlice($0) } - dict[-994444869] = { return Api.Error.parse_error($0) } - dict[1504640087] = { return Api.Error.parse_richError($0) } dict[-515593041] = { return Api.ContactLocated.parse_contactLocated($0) } dict[-1054510761] = { return Api.ContactLocated.parse_contactLocatedPreview($0) } dict[-1560655744] = { return Api.KeyboardButton.parse_keyboardButton($0) } @@ -301,7 +304,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-2066640507] = { return Api.messages.AffectedMessages.parse_affectedMessages($0) } dict[-402498398] = { return Api.messages.SavedGifs.parse_savedGifsNotModified($0) } dict[772213157] = { return Api.messages.SavedGifs.parse_savedGifs($0) } - dict[563410286] = { return Api.ResponseIndirect.parse_responseIndirect($0) } dict[-860866985] = { return Api.WallPaper.parse_wallPaper($0) } dict[1662091044] = { return Api.WallPaper.parse_wallPaperSolid($0) } dict[-1938715001] = { return Api.messages.Messages.parse_messages($0) } @@ -321,7 +323,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1857044719] = { return Api.Updates.parse_updateShortMessage($0) } dict[377562760] = { return Api.Updates.parse_updateShortChatMessage($0) } dict[301019932] = { return Api.Updates.parse_updateShortSentMessage($0) } - dict[1769565673] = { return Api.InitConnection.parse_initConnection($0) } dict[1038967584] = { return Api.MessageMedia.parse_messageMediaEmpty($0) } dict[1457575028] = { return Api.MessageMedia.parse_messageMediaGeo($0) } dict[1585262393] = { return Api.MessageMedia.parse_messageMediaContact($0) } @@ -531,366 +532,13 @@ public struct Api { return nil } - public static func serializeObject(_ object: Any, buffer: Buffer, boxed: Swift.Bool) -> Swift.Bool { - switch object { - case let _1 as Api.messages.StickerSet: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputGeoPlaceName: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputGeoPoint: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.Chat: - return _1.serialize(buffer, boxed) - case let _1 as Api.ChatFull: - return _1.serialize(buffer, boxed) - case let _1 as Api.ChatParticipant: - return _1.serialize(buffer, boxed) - case let _1 as Api.updates.Difference: - return _1.serialize(buffer, boxed) - case let _1 as Api.SchemeMethod: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputPhotoCrop: - return _1.serialize(buffer, boxed) - case let _1 as Api.Photo: - return _1.serialize(buffer, boxed) - case let _1 as Api.Chat: - return _1.serialize(buffer, boxed) - case let _1 as Api.ChatInvite: - return _1.serialize(buffer, boxed) - case let _1 as Api.contacts.Requests: - return _1.serialize(buffer, boxed) - case let _1 as Api.channels.ChannelParticipants: - return _1.serialize(buffer, boxed) - case let _1 as Api.GeoPlaceName: - return _1.serialize(buffer, boxed) - case let _1 as Api.UserFull: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputPeerNotifyEvents: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputChannel: - return _1.serialize(buffer, boxed) - case let _1 as Api.DcOption: - return _1.serialize(buffer, boxed) - case let _1 as Api.MessageGroup: - return _1.serialize(buffer, boxed) - case let _1 as Api.account.PasswordSettings: - return _1.serialize(buffer, boxed) - case let _1 as Api.help.AppUpdate: - return _1.serialize(buffer, boxed) - case let _1 as Api.channels.ChannelParticipant: - return _1.serialize(buffer, boxed) - case let _1 as Api.contacts.SentLink: - return _1.serialize(buffer, boxed) - case let _1 as Api.ChannelParticipantRole: - return _1.serialize(buffer, boxed) - case let _1 as Api.storage.FileType: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputEncryptedFile: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.SentEncryptedMessage: - return _1.serialize(buffer, boxed) - case let _1 as Api.ExportedMessageLink: - return _1.serialize(buffer, boxed) - case let _1 as Api.auth.Authorization: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputFile: - return _1.serialize(buffer, boxed) - case let _1 as Api.Peer: - return _1.serialize(buffer, boxed) - case let _1 as Api.UserStatus: - return _1.serialize(buffer, boxed) - case let _1 as Api.Dialog: - return _1.serialize(buffer, boxed) - case let _1 as Api.help.AppChangelog: - return _1.serialize(buffer, boxed) - case let _1 as Api.SendMessageAction: - return _1.serialize(buffer, boxed) - case let _1 as Api.PrivacyKey: - return _1.serialize(buffer, boxed) - case let _1 as Api.Update: - return _1.serialize(buffer, boxed) - case let _1 as Api.ChannelParticipant: - return _1.serialize(buffer, boxed) - case let _1 as Api.contacts.Blocked: - return _1.serialize(buffer, boxed) - case let _1 as Api.Error: - return _1.serialize(buffer, boxed) - case let _1 as Api.ContactLocated: - return _1.serialize(buffer, boxed) - case let _1 as Api.KeyboardButton: - return _1.serialize(buffer, boxed) - case let _1 as Api.ContactStatus: - return _1.serialize(buffer, boxed) - case let _1 as Api.PhotoSize: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.Stickers: - return _1.serialize(buffer, boxed) - case let _1 as Api.GlobalPrivacySettings: - return _1.serialize(buffer, boxed) - case let _1 as Api.InlineBotSwitchPM: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.FoundGifs: - return _1.serialize(buffer, boxed) - case let _1 as Api.FileLocation: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputNotifyPeer: - return _1.serialize(buffer, boxed) - case let _1 as Api.EncryptedMessage: - return _1.serialize(buffer, boxed) - case let _1 as Api.ChannelParticipantsFilter: - return _1.serialize(buffer, boxed) - case let _1 as Api.WebPage: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputBotInlineMessage: - return _1.serialize(buffer, boxed) - case let _1 as Api.KeyboardButtonRow: - return _1.serialize(buffer, boxed) - case let _1 as Api.StickerSet: - return _1.serialize(buffer, boxed) - case let _1 as Api.photos.Photo: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputContact: - return _1.serialize(buffer, boxed) - case let _1 as Api.TopPeerCategory: - return _1.serialize(buffer, boxed) - case let _1 as Api.contacts.Contacts: - return _1.serialize(buffer, boxed) - case let _1 as Api.ChannelMessagesFilter: - return _1.serialize(buffer, boxed) - case let _1 as Api.auth.PasswordRecovery: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.BotResults: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputDocument: - return _1.serialize(buffer, boxed) - case let _1 as Api.contacts.ResolvedPeer: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputMedia: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputPeer: - return _1.serialize(buffer, boxed) - case let _1 as Api.Contact: - return _1.serialize(buffer, boxed) - case let _1 as Api.BotInlineResult: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.BotCallbackAnswer: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.Chats: - return _1.serialize(buffer, boxed) - case let _1 as Api.contacts.MyLink: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputPrivacyRule: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.DhConfig: - return _1.serialize(buffer, boxed) - case let _1 as Api.auth.ExportedAuthorization: - return _1.serialize(buffer, boxed) - case let _1 as Api.ContactRequest: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.AffectedHistory: - return _1.serialize(buffer, boxed) - case let _1 as Api.account.PasswordInputSettings: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.MessageEditData: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.ChatFull: - return _1.serialize(buffer, boxed) - case let _1 as Api.contacts.ForeignLink: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputEncryptedChat: - return _1.serialize(buffer, boxed) - case let _1 as Api.DraftMessage: - return _1.serialize(buffer, boxed) - case let _1 as Api.DisabledFeature: - return _1.serialize(buffer, boxed) - case let _1 as Api.EncryptedFile: - return _1.serialize(buffer, boxed) - case let _1 as Api.NotifyPeer: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputPrivacyKey: - return _1.serialize(buffer, boxed) - case let _1 as Api.ReplyMarkup: - return _1.serialize(buffer, boxed) - case let _1 as Api.TopPeer: - return _1.serialize(buffer, boxed) - case let _1 as Api.contacts.Link: - return _1.serialize(buffer, boxed) - case let _1 as Api.ContactBlocked: - return _1.serialize(buffer, boxed) - case let _1 as Api.auth.CheckedPhone: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputUser: - return _1.serialize(buffer, boxed) - case let _1 as Api.SchemeType: - return _1.serialize(buffer, boxed) - case let _1 as Api.upload.File: - return _1.serialize(buffer, boxed) - case let _1 as Api.MessageRange: - return _1.serialize(buffer, boxed) - case let _1 as Api.Config: - return _1.serialize(buffer, boxed) - case let _1 as Api.TopPeerCategoryPeers: - return _1.serialize(buffer, boxed) - case let _1 as Api.BotCommand: - return _1.serialize(buffer, boxed) - case let _1 as Api.contacts.Located: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.AffectedMessages: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.SavedGifs: - return _1.serialize(buffer, boxed) - case let _1 as Api.ResponseIndirect: - return _1.serialize(buffer, boxed) - case let _1 as Api.WallPaper: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.Messages: - return _1.serialize(buffer, boxed) - case let _1 as Api.auth.SentCode: - return _1.serialize(buffer, boxed) - case let _1 as Api.phone.DhConfig: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputChatPhoto: - return _1.serialize(buffer, boxed) - case let _1 as Api.Updates: - return _1.serialize(buffer, boxed) - case let _1 as Api.InitConnection: - return _1.serialize(buffer, boxed) - case let _1 as Api.MessageMedia: - return _1.serialize(buffer, boxed) - case let _1 as Api.Null: - return _1.serialize(buffer, boxed) - case let _1 as Api.auth.CodeType: - return _1.serialize(buffer, boxed) - case let _1 as Api.DocumentAttribute: - return _1.serialize(buffer, boxed) - case let _1 as Api.account.Authorizations: - return _1.serialize(buffer, boxed) - case let _1 as Api.ChatPhoto: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.PeerDialogs: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputStickerSet: - return _1.serialize(buffer, boxed) - case let _1 as Api.BotInfo: - return _1.serialize(buffer, boxed) - case let _1 as Api.contacts.Suggested: - return _1.serialize(buffer, boxed) - case let _1 as Api.updates.State: - return _1.serialize(buffer, boxed) - case let _1 as Api.FoundGif: - return _1.serialize(buffer, boxed) - case let _1 as Api.User: - return _1.serialize(buffer, boxed) - case let _1 as Api.Message: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputFileLocation: - return _1.serialize(buffer, boxed) - case let _1 as Api.GeoPoint: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputPhoneCall: - return _1.serialize(buffer, boxed) - case let _1 as Api.ReceivedNotifyMessage: - return _1.serialize(buffer, boxed) - case let _1 as Api.ChatParticipants: - return _1.serialize(buffer, boxed) - case let _1 as Api.NearestDc: - return _1.serialize(buffer, boxed) - case let _1 as Api.photos.Photos: - return _1.serialize(buffer, boxed) - case let _1 as Api.contacts.ImportedContacts: - return _1.serialize(buffer, boxed) - case let _1 as Api.Bool: - return _1.serialize(buffer, boxed) - case let _1 as Api.MessageFwdHeader: - return _1.serialize(buffer, boxed) - case let _1 as Api.help.Support: - return _1.serialize(buffer, boxed) - case let _1 as Api.ChatLocated: - return _1.serialize(buffer, boxed) - case let _1 as Api.MessagesFilter: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.Dialogs: - return _1.serialize(buffer, boxed) - case let _1 as Api.help.InviteText: - return _1.serialize(buffer, boxed) - case let _1 as Api.ContactSuggested: - return _1.serialize(buffer, boxed) - case let _1 as Api.BotInlineMessage: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputPeerNotifySettings: - return _1.serialize(buffer, boxed) - case let _1 as Api.ExportedChatInvite: - return _1.serialize(buffer, boxed) - case let _1 as Api.DcNetworkStats: - return _1.serialize(buffer, boxed) - case let _1 as Api.Authorization: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.AllStickers: - return _1.serialize(buffer, boxed) - case let _1 as Api.PhoneConnection: - return _1.serialize(buffer, boxed) - case let _1 as Api.AccountDaysTTL: - return _1.serialize(buffer, boxed) - case let _1 as Api.Scheme: - return _1.serialize(buffer, boxed) - case let _1 as Api.account.Password: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputBotInlineResult: - return _1.serialize(buffer, boxed) - case let _1 as Api.account.PrivacyRules: - return _1.serialize(buffer, boxed) - case let _1 as Api.messages.Message: - return _1.serialize(buffer, boxed) - case let _1 as Api.PrivacyRule: - return _1.serialize(buffer, boxed) - case let _1 as Api.MessageAction: - return _1.serialize(buffer, boxed) - case let _1 as Api.PhoneCall: - return _1.serialize(buffer, boxed) - case let _1 as Api.PeerNotifyEvents: - return _1.serialize(buffer, boxed) - case let _1 as Api.ContactLink: - return _1.serialize(buffer, boxed) - case let _1 as Api.help.AppPrefs: - return _1.serialize(buffer, boxed) - case let _1 as Api.contacts.Found: - return _1.serialize(buffer, boxed) - case let _1 as Api.PeerNotifySettings: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputBotInlineMessageID: - return _1.serialize(buffer, boxed) - case let _1 as Api.SchemeParam: - return _1.serialize(buffer, boxed) - case let _1 as Api.StickerPack: - return _1.serialize(buffer, boxed) - case let _1 as Api.UserProfilePhoto: - return _1.serialize(buffer, boxed) - case let _1 as Api.updates.ChannelDifference: - return _1.serialize(buffer, boxed) - case let _1 as Api.MessageEntity: - return _1.serialize(buffer, boxed) - case let _1 as Api.InputPhoto: - return _1.serialize(buffer, boxed) - case let _1 as Api.contacts.TopPeers: - return _1.serialize(buffer, boxed) - case let _1 as Api.auth.SentCodeType: - return _1.serialize(buffer, boxed) - case let _1 as Api.EncryptedChat: - return _1.serialize(buffer, boxed) - case let _1 as Api.Document: - return _1.serialize(buffer, boxed) - case let _1 as Api.ImportedContact: - return _1.serialize(buffer, boxed) - default: - break - } - return false + public static func serializeObject(_ object: ApiSerializeableObject, buffer: Buffer, boxed: Swift.Bool) -> Swift.Bool { + return object.serialize(buffer, boxed) } public struct messages { - public enum StickerSet: CustomStringConvertible { + public enum StickerSet: /*CustomStringConvertible,*/ ApiSerializeableObject { case stickerSet(set: Api.StickerSet, packs: [Api.StickerPack], documents: [Api.Document]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .stickerSet(let set, let packs, let documents): @@ -937,19 +585,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .stickerSet(let set, let packs, let documents): - return "(messages.stickerSet set: \(set), packs: \(packs), documents: \(documents))" - } - } - } } - public enum Chat: CustomStringConvertible { + public enum Chat: /*CustomStringConvertible,*/ ApiSerializeableObject { case chat(chat: Api.Chat, users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .chat(let chat, let users): @@ -986,20 +625,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .chat(let chat, let users): - return "(messages.chat chat: \(chat), users: \(users))" - } - } - } } - public enum SentEncryptedMessage: CustomStringConvertible { + public enum SentEncryptedMessage: /*CustomStringConvertible,*/ ApiSerializeableObject { case sentEncryptedMessage(date: Int32) case sentEncryptedFile(date: Int32, file: Api.EncryptedFile) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .sentEncryptedMessage(let date): @@ -1047,22 +677,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .sentEncryptedMessage(let date): - return "(messages.sentEncryptedMessage date: \(date))" - case .sentEncryptedFile(let date, let file): - return "(messages.sentEncryptedFile date: \(date), file: \(file))" - } - } - } } - public enum Stickers: CustomStringConvertible { + public enum Stickers: /*CustomStringConvertible,*/ ApiSerializeableObject { case stickersNotModified case stickers(hash: String, stickers: [Api.Document]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .stickersNotModified: @@ -1106,21 +725,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .stickersNotModified: - return "(messages.stickersNotModified)" - case .stickers(let hash, let stickers): - return "(messages.stickers hash: \(hash), stickers: \(stickers))" - } - } - } } - public enum FoundGifs: CustomStringConvertible { + public enum FoundGifs: /*CustomStringConvertible,*/ ApiSerializeableObject { case foundGifs(nextOffset: Int32, results: [Api.FoundGif]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .foundGifs(let nextOffset, let results): @@ -1155,19 +763,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .foundGifs(let nextOffset, let results): - return "(messages.foundGifs nextOffset: \(nextOffset), results: \(results))" - } - } - } } - public enum BotResults: CustomStringConvertible { + public enum BotResults: /*CustomStringConvertible,*/ ApiSerializeableObject { case botResults(flags: Int32, queryId: Int64, nextOffset: String?, switchPm: Api.InlineBotSwitchPM?, results: [Api.BotInlineResult]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .botResults(let flags, let queryId, let nextOffset, let switchPm, let results): @@ -1216,19 +815,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .botResults(let flags, let queryId, let nextOffset, let switchPm, let results): - return "(messages.botResults flags: \(flags), queryId: \(queryId), nextOffset: \(nextOffset), switchPm: \(switchPm), results: \(results))" - } - } - } } - public enum BotCallbackAnswer: CustomStringConvertible { + public enum BotCallbackAnswer: /*CustomStringConvertible,*/ ApiSerializeableObject { case botCallbackAnswer(flags: Int32, message: String?) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .botCallbackAnswer(let flags, let message): @@ -1257,19 +847,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .botCallbackAnswer(let flags, let message): - return "(messages.botCallbackAnswer flags: \(flags), message: \(message))" - } - } - } } - public enum Chats: CustomStringConvertible { + public enum Chats: /*CustomStringConvertible,*/ ApiSerializeableObject { case chats(chats: [Api.Chat]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .chats(let chats): @@ -1300,20 +881,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .chats(let chats): - return "(messages.chats chats: \(chats))" - } - } - } } - public enum DhConfig: CustomStringConvertible { + public enum DhConfig: /*CustomStringConvertible,*/ ApiSerializeableObject { case dhConfigNotModified(random: Buffer) case dhConfig(g: Int32, p: Buffer, version: Int32, random: Buffer) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .dhConfigNotModified(let random): @@ -1367,21 +939,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .dhConfigNotModified(let random): - return "(messages.dhConfigNotModified random: \(random))" - case .dhConfig(let g, let p, let version, let random): - return "(messages.dhConfig g: \(g), p: \(p), version: \(version), random: \(random))" - } - } - } } - public enum AffectedHistory: CustomStringConvertible { + public enum AffectedHistory: /*CustomStringConvertible,*/ ApiSerializeableObject { case affectedHistory(pts: Int32, ptsCount: Int32, offset: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .affectedHistory(let pts, let ptsCount, let offset): @@ -1414,19 +975,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .affectedHistory(let pts, let ptsCount, let offset): - return "(messages.affectedHistory pts: \(pts), ptsCount: \(ptsCount), offset: \(offset))" - } - } - } } - public enum MessageEditData: CustomStringConvertible { + public enum MessageEditData: /*CustomStringConvertible,*/ ApiSerializeableObject { case messageEditData(flags: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .messageEditData(let flags): @@ -1451,19 +1003,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .messageEditData(let flags): - return "(messages.messageEditData flags: \(flags))" - } - } - } } - public enum ChatFull: CustomStringConvertible { + public enum ChatFull: /*CustomStringConvertible,*/ ApiSerializeableObject { case chatFull(fullChat: Api.ChatFull, chats: [Api.Chat], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .chatFull(let fullChat, let chats, let users): @@ -1510,19 +1053,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .chatFull(let fullChat, let chats, let users): - return "(messages.chatFull fullChat: \(fullChat), chats: \(chats), users: \(users))" - } - } - } } - public enum AffectedMessages: CustomStringConvertible { + public enum AffectedMessages: /*CustomStringConvertible,*/ ApiSerializeableObject { case affectedMessages(pts: Int32, ptsCount: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .affectedMessages(let pts, let ptsCount): @@ -1551,20 +1085,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .affectedMessages(let pts, let ptsCount): - return "(messages.affectedMessages pts: \(pts), ptsCount: \(ptsCount))" - } - } - } } - public enum SavedGifs: CustomStringConvertible { + public enum SavedGifs: /*CustomStringConvertible,*/ ApiSerializeableObject { case savedGifsNotModified case savedGifs(hash: Int32, gifs: [Api.Document]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .savedGifsNotModified: @@ -1608,23 +1133,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .savedGifsNotModified: - return "(messages.savedGifsNotModified)" - case .savedGifs(let hash, let gifs): - return "(messages.savedGifs hash: \(hash), gifs: \(gifs))" - } - } - } } - public enum Messages: CustomStringConvertible { + public enum Messages: /*CustomStringConvertible,*/ ApiSerializeableObject { case messages(messages: [Api.Message], chats: [Api.Chat], users: [Api.User]) case messagesSlice(count: Int32, messages: [Api.Message], chats: [Api.Chat], users: [Api.User]) case channelMessages(flags: Int32, pts: Int32, count: Int32, messages: [Api.Message], chats: [Api.Chat], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .messages(let messages, let chats, let users): @@ -1777,23 +1291,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .messages(let messages, let chats, let users): - return "(messages.messages messages: \(messages), chats: \(chats), users: \(users))" - case .messagesSlice(let count, let messages, let chats, let users): - return "(messages.messagesSlice count: \(count), messages: \(messages), chats: \(chats), users: \(users))" - case .channelMessages(let flags, let pts, let count, let messages, let chats, let users): - return "(messages.channelMessages flags: \(flags), pts: \(pts), count: \(count), messages: \(messages), chats: \(chats), users: \(users))" - } - } - } } - public enum PeerDialogs: CustomStringConvertible { + public enum PeerDialogs: /*CustomStringConvertible,*/ ApiSerializeableObject { case peerDialogs(dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User], state: Api.updates.State) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .peerDialogs(let dialogs, let messages, let chats, let users, let state): @@ -1860,20 +1361,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .peerDialogs(let dialogs, let messages, let chats, let users, let state): - return "(messages.peerDialogs dialogs: \(dialogs), messages: \(messages), chats: \(chats), users: \(users), state: \(state))" - } - } - } } - public enum Dialogs: CustomStringConvertible { + public enum Dialogs: /*CustomStringConvertible,*/ ApiSerializeableObject { case dialogs(dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User]) case dialogsSlice(count: Int32, dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .dialogs(let dialogs, let messages, let chats, let users): @@ -1991,22 +1483,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .dialogs(let dialogs, let messages, let chats, let users): - return "(messages.dialogs dialogs: \(dialogs), messages: \(messages), chats: \(chats), users: \(users))" - case .dialogsSlice(let count, let dialogs, let messages, let chats, let users): - return "(messages.dialogsSlice count: \(count), dialogs: \(dialogs), messages: \(messages), chats: \(chats), users: \(users))" - } - } - } } - public enum AllStickers: CustomStringConvertible { + public enum AllStickers: /*CustomStringConvertible,*/ ApiSerializeableObject { case allStickersNotModified case allStickers(hash: Int32, sets: [Api.StickerSet]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .allStickersNotModified: @@ -2050,22 +1531,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .allStickersNotModified: - return "(messages.allStickersNotModified)" - case .allStickers(let hash, let sets): - return "(messages.allStickers hash: \(hash), sets: \(sets))" - } - } - } } - public enum Message: CustomStringConvertible { + public enum Message: /*CustomStringConvertible,*/ ApiSerializeableObject { case messageEmpty case message(message: Api.Message, chats: [Api.Chat], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .messageEmpty: @@ -2121,22 +1591,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .messageEmpty: - return "(messages.messageEmpty)" - case .message(let message, let chats, let users): - return "(messages.message message: \(message), chats: \(chats), users: \(users))" - } - } - } } } - public enum InputGeoPlaceName: CustomStringConvertible { + public enum InputGeoPlaceName: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputGeoPlaceName(country: String, state: String, city: String, district: String, street: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputGeoPlaceName(let country, let state, let city, let district, let street): @@ -2177,20 +1636,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputGeoPlaceName(let country, let state, let city, let district, let street): - return "(inputGeoPlaceName country: \(country), state: \(state), city: \(city), district: \(district), street: \(street))" - } - } - } } - public enum InputGeoPoint: CustomStringConvertible { + public enum InputGeoPoint: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputGeoPointEmpty case inputGeoPoint(lat: Double, long: Double) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputGeoPointEmpty: @@ -2228,22 +1678,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputGeoPointEmpty: - return "(inputGeoPointEmpty)" - case .inputGeoPoint(let lat, let long): - return "(inputGeoPoint lat: \(lat), long: \(long))" - } - } - } } - public enum ChatFull: CustomStringConvertible { + public enum ChatFull: /*CustomStringConvertible,*/ ApiSerializeableObject { case chatFull(id: Int32, participants: Api.ChatParticipants, chatPhoto: Api.Photo, notifySettings: Api.PeerNotifySettings, exportedInvite: Api.ExportedChatInvite, botInfo: [Api.BotInfo]) case channelFull(flags: Int32, id: Int32, about: String, participantsCount: Int32?, adminsCount: Int32?, kickedCount: Int32?, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, chatPhoto: Api.Photo, notifySettings: Api.PeerNotifySettings, exportedInvite: Api.ExportedChatInvite, botInfo: [Api.BotInfo], migratedFromChatId: Int32?, migratedFromMaxId: Int32?, pinnedMsgId: Int32?) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .chatFull(let id, let participants, let chatPhoto, let notifySettings, let exportedInvite, let botInfo): @@ -2391,23 +1830,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .chatFull(let id, let participants, let chatPhoto, let notifySettings, let exportedInvite, let botInfo): - return "(chatFull id: \(id), participants: \(participants), chatPhoto: \(chatPhoto), notifySettings: \(notifySettings), exportedInvite: \(exportedInvite), botInfo: \(botInfo))" - case .channelFull(let flags, let id, let about, let participantsCount, let adminsCount, let kickedCount, let readInboxMaxId, let readOutboxMaxId, let unreadCount, let chatPhoto, let notifySettings, let exportedInvite, let botInfo, let migratedFromChatId, let migratedFromMaxId, let pinnedMsgId): - return "(channelFull flags: \(flags), id: \(id), about: \(about), participantsCount: \(participantsCount), adminsCount: \(adminsCount), kickedCount: \(kickedCount), readInboxMaxId: \(readInboxMaxId), readOutboxMaxId: \(readOutboxMaxId), unreadCount: \(unreadCount), chatPhoto: \(chatPhoto), notifySettings: \(notifySettings), exportedInvite: \(exportedInvite), botInfo: \(botInfo), migratedFromChatId: \(migratedFromChatId), migratedFromMaxId: \(migratedFromMaxId), pinnedMsgId: \(pinnedMsgId))" - } - } - } } - public enum ChatParticipant: CustomStringConvertible { + public enum ChatParticipant: /*CustomStringConvertible,*/ ApiSerializeableObject { case chatParticipant(userId: Int32, inviterId: Int32, date: Int32) case chatParticipantCreator(userId: Int32) case chatParticipantAdmin(userId: Int32, inviterId: Int32, date: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .chatParticipant(let userId, let inviterId, let date): @@ -2482,23 +1910,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .chatParticipant(let userId, let inviterId, let date): - return "(chatParticipant userId: \(userId), inviterId: \(inviterId), date: \(date))" - case .chatParticipantCreator(let userId): - return "(chatParticipantCreator userId: \(userId))" - case .chatParticipantAdmin(let userId, let inviterId, let date): - return "(chatParticipantAdmin userId: \(userId), inviterId: \(inviterId), date: \(date))" - } - } - } } - public enum SchemeMethod: CustomStringConvertible { + public enum SchemeMethod: /*CustomStringConvertible,*/ ApiSerializeableObject { case schemeMethod(id: Int32, method: String, params: [Api.SchemeParam], type: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .schemeMethod(let id, let method, let params, let type): @@ -2541,20 +1956,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .schemeMethod(let id, let method, let params, let type): - return "(schemeMethod id: \(id), method: \(method), params: \(params), type: \(type))" - } - } - } } - public enum InputPhotoCrop: CustomStringConvertible { + public enum InputPhotoCrop: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputPhotoCropAuto case inputPhotoCrop(cropLeft: Double, cropTop: Double, cropWidth: Double) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputPhotoCropAuto: @@ -2596,23 +2002,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputPhotoCropAuto: - return "(inputPhotoCropAuto)" - case .inputPhotoCrop(let cropLeft, let cropTop, let cropWidth): - return "(inputPhotoCrop cropLeft: \(cropLeft), cropTop: \(cropTop), cropWidth: \(cropWidth))" - } - } - } } - public enum Photo: CustomStringConvertible { + public enum Photo: /*CustomStringConvertible,*/ ApiSerializeableObject { case photoEmpty(id: Int64) case wallPhoto(id: Int64, accessHash: Int64, userId: Int32, date: Int32, caption: String, geo: Api.GeoPoint, unread: Api.Bool, sizes: [Api.PhotoSize]) case photo(id: Int64, accessHash: Int64, date: Int32, sizes: [Api.PhotoSize]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .photoEmpty(let id): @@ -2727,27 +2122,14 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .photoEmpty(let id): - return "(photoEmpty id: \(id))" - case .wallPhoto(let id, let accessHash, let userId, let date, let caption, let geo, let unread, let sizes): - return "(wallPhoto id: \(id), accessHash: \(accessHash), userId: \(userId), date: \(date), caption: \(caption), geo: \(geo), unread: \(unread), sizes: \(sizes))" - case .photo(let id, let accessHash, let date, let sizes): - return "(photo id: \(id), accessHash: \(accessHash), date: \(date), sizes: \(sizes))" - } - } - } } - public enum Chat: CustomStringConvertible { + public enum Chat: /*CustomStringConvertible,*/ ApiSerializeableObject { case chatEmpty(id: Int32) case chatForbidden(id: Int32, title: String) case chat(flags: Int32, id: Int32, title: String, photo: Api.ChatPhoto, participantsCount: Int32, date: Int32, version: Int32, migratedTo: Api.InputChannel?) case channel(flags: Int32, id: Int32, accessHash: Int64?, title: String, username: String?, photo: Api.ChatPhoto, date: Int32, version: Int32, restrictionReason: String?) case channelForbidden(flags: Int32, id: Int32, accessHash: Int64, title: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .chatEmpty(let id): @@ -2922,28 +2304,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .chatEmpty(let id): - return "(chatEmpty id: \(id))" - case .chatForbidden(let id, let title): - return "(chatForbidden id: \(id), title: \(title))" - case .chat(let flags, let id, let title, let photo, let participantsCount, let date, let version, let migratedTo): - return "(chat flags: \(flags), id: \(id), title: \(title), photo: \(photo), participantsCount: \(participantsCount), date: \(date), version: \(version), migratedTo: \(migratedTo))" - case .channel(let flags, let id, let accessHash, let title, let username, let photo, let date, let version, let restrictionReason): - return "(channel flags: \(flags), id: \(id), accessHash: \(accessHash), title: \(title), username: \(username), photo: \(photo), date: \(date), version: \(version), restrictionReason: \(restrictionReason))" - case .channelForbidden(let flags, let id, let accessHash, let title): - return "(channelForbidden flags: \(flags), id: \(id), accessHash: \(accessHash), title: \(title))" - } - } - } } - public enum ChatInvite: CustomStringConvertible { + public enum ChatInvite: /*CustomStringConvertible,*/ ApiSerializeableObject { case chatInviteAlready(chat: Api.Chat) case chatInvite(flags: Int32, title: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .chatInviteAlready(let chat): @@ -2991,21 +2356,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .chatInviteAlready(let chat): - return "(chatInviteAlready chat: \(chat))" - case .chatInvite(let flags, let title): - return "(chatInvite flags: \(flags), title: \(title))" - } - } - } } - public enum GeoPlaceName: CustomStringConvertible { + public enum GeoPlaceName: /*CustomStringConvertible,*/ ApiSerializeableObject { case geoPlaceName(country: String, state: String, city: String, district: String, street: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .geoPlaceName(let country, let state, let city, let district, let street): @@ -3046,19 +2400,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .geoPlaceName(let country, let state, let city, let district, let street): - return "(geoPlaceName country: \(country), state: \(state), city: \(city), district: \(district), street: \(street))" - } - } - } } - public enum UserFull: CustomStringConvertible { + public enum UserFull: /*CustomStringConvertible,*/ ApiSerializeableObject { case userFull(flags: Int32, user: Api.User, about: String?, link: Api.contacts.Link, profilePhoto: Api.Photo?, notifySettings: Api.PeerNotifySettings, botInfo: Api.BotInfo?) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .userFull(let flags, let user, let about, let link, let profilePhoto, let notifySettings, let botInfo): @@ -3117,20 +2462,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .userFull(let flags, let user, let about, let link, let profilePhoto, let notifySettings, let botInfo): - return "(userFull flags: \(flags), user: \(user), about: \(about), link: \(link), profilePhoto: \(profilePhoto), notifySettings: \(notifySettings), botInfo: \(botInfo))" - } - } - } } - public enum InputPeerNotifyEvents: CustomStringConvertible { + public enum InputPeerNotifyEvents: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputPeerNotifyEventsEmpty case inputPeerNotifyEventsAll - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputPeerNotifyEventsEmpty: @@ -3156,22 +2492,11 @@ public struct Api { return Api.InputPeerNotifyEvents.inputPeerNotifyEventsAll } - public var description: String { - get { - switch self { - case .inputPeerNotifyEventsEmpty: - return "(inputPeerNotifyEventsEmpty)" - case .inputPeerNotifyEventsAll: - return "(inputPeerNotifyEventsAll)" - } - } - } } - public enum InputChannel: CustomStringConvertible { + public enum InputChannel: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputChannelEmpty case inputChannel(channelId: Int32, accessHash: Int64) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputChannelEmpty: @@ -3209,21 +2534,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputChannelEmpty: - return "(inputChannelEmpty)" - case .inputChannel(let channelId, let accessHash): - return "(inputChannel channelId: \(channelId), accessHash: \(accessHash))" - } - } - } } - public enum DcOption: CustomStringConvertible { + public enum DcOption: /*CustomStringConvertible,*/ ApiSerializeableObject { case dcOption(flags: Int32, id: Int32, ipAddress: String, port: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .dcOption(let flags, let id, let ipAddress, let port): @@ -3260,19 +2574,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .dcOption(let flags, let id, let ipAddress, let port): - return "(dcOption flags: \(flags), id: \(id), ipAddress: \(ipAddress), port: \(port))" - } - } - } } - public enum MessageGroup: CustomStringConvertible { + public enum MessageGroup: /*CustomStringConvertible,*/ ApiSerializeableObject { case messageGroup(minId: Int32, maxId: Int32, count: Int32, date: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .messageGroup(let minId, let maxId, let count, let date): @@ -3309,21 +2614,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .messageGroup(let minId, let maxId, let count, let date): - return "(messageGroup minId: \(minId), maxId: \(maxId), count: \(count), date: \(date))" - } - } - } } - public enum ChannelParticipantRole: CustomStringConvertible { + public enum ChannelParticipantRole: /*CustomStringConvertible,*/ ApiSerializeableObject { case channelRoleEmpty case channelRoleModerator case channelRoleEditor - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .channelRoleEmpty: @@ -3358,26 +2654,13 @@ public struct Api { return Api.ChannelParticipantRole.channelRoleEditor } - public var description: String { - get { - switch self { - case .channelRoleEmpty: - return "(channelRoleEmpty)" - case .channelRoleModerator: - return "(channelRoleModerator)" - case .channelRoleEditor: - return "(channelRoleEditor)" - } - } - } } - public enum InputEncryptedFile: CustomStringConvertible { + public enum InputEncryptedFile: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputEncryptedFileEmpty case inputEncryptedFileUploaded(id: Int64, parts: Int32, md5Checksum: String, keyFingerprint: Int32) case inputEncryptedFile(id: Int64, accessHash: Int64) case inputEncryptedFileBigUploaded(id: Int64, parts: Int32, keyFingerprint: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputEncryptedFileEmpty: @@ -3469,25 +2752,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputEncryptedFileEmpty: - return "(inputEncryptedFileEmpty)" - case .inputEncryptedFileUploaded(let id, let parts, let md5Checksum, let keyFingerprint): - return "(inputEncryptedFileUploaded id: \(id), parts: \(parts), md5Checksum: \(md5Checksum), keyFingerprint: \(keyFingerprint))" - case .inputEncryptedFile(let id, let accessHash): - return "(inputEncryptedFile id: \(id), accessHash: \(accessHash))" - case .inputEncryptedFileBigUploaded(let id, let parts, let keyFingerprint): - return "(inputEncryptedFileBigUploaded id: \(id), parts: \(parts), keyFingerprint: \(keyFingerprint))" - } - } - } } - public enum ExportedMessageLink: CustomStringConvertible { + public enum ExportedMessageLink: /*CustomStringConvertible,*/ ApiSerializeableObject { case exportedMessageLink(link: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .exportedMessageLink(let link): @@ -3512,20 +2780,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .exportedMessageLink(let link): - return "(exportedMessageLink link: \(link))" - } - } - } } - public enum InputFile: CustomStringConvertible { + public enum InputFile: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputFile(id: Int64, parts: Int32, name: String, md5Checksum: String) case inputFileBig(id: Int64, parts: Int32, name: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputFile(let id, let parts, let name, let md5Checksum): @@ -3587,23 +2846,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputFile(let id, let parts, let name, let md5Checksum): - return "(inputFile id: \(id), parts: \(parts), name: \(name), md5Checksum: \(md5Checksum))" - case .inputFileBig(let id, let parts, let name): - return "(inputFileBig id: \(id), parts: \(parts), name: \(name))" - } - } - } } - public enum Peer: CustomStringConvertible { + public enum Peer: /*CustomStringConvertible,*/ ApiSerializeableObject { case peerUser(userId: Int32) case peerChat(chatId: Int32) case peerChannel(channelId: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .peerUser(let userId): @@ -3662,28 +2910,15 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .peerUser(let userId): - return "(peerUser userId: \(userId))" - case .peerChat(let chatId): - return "(peerChat chatId: \(chatId))" - case .peerChannel(let channelId): - return "(peerChannel channelId: \(channelId))" - } - } - } } - public enum UserStatus: CustomStringConvertible { + public enum UserStatus: /*CustomStringConvertible,*/ ApiSerializeableObject { case userStatusEmpty case userStatusOnline(expires: Int32) case userStatusOffline(wasOnline: Int32) case userStatusRecently case userStatusLastWeek case userStatusLastMonth - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .userStatusEmpty: @@ -3761,29 +2996,10 @@ public struct Api { return Api.UserStatus.userStatusLastMonth } - public var description: String { - get { - switch self { - case .userStatusEmpty: - return "(userStatusEmpty)" - case .userStatusOnline(let expires): - return "(userStatusOnline expires: \(expires))" - case .userStatusOffline(let wasOnline): - return "(userStatusOffline wasOnline: \(wasOnline))" - case .userStatusRecently: - return "(userStatusRecently)" - case .userStatusLastWeek: - return "(userStatusLastWeek)" - case .userStatusLastMonth: - return "(userStatusLastMonth)" - } - } - } } - public enum Dialog: CustomStringConvertible { + public enum Dialog: /*CustomStringConvertible,*/ ApiSerializeableObject { case dialog(flags: Int32, peer: Api.Peer, topMessage: Int32, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, notifySettings: Api.PeerNotifySettings, pts: Int32?, draft: Api.DraftMessage?) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .dialog(let flags, let peer, let topMessage, let readInboxMaxId, let readOutboxMaxId, let unreadCount, let notifySettings, let pts, let draft): @@ -3846,17 +3062,9 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .dialog(let flags, let peer, let topMessage, let readInboxMaxId, let readOutboxMaxId, let unreadCount, let notifySettings, let pts, let draft): - return "(dialog flags: \(flags), peer: \(peer), topMessage: \(topMessage), readInboxMaxId: \(readInboxMaxId), readOutboxMaxId: \(readOutboxMaxId), unreadCount: \(unreadCount), notifySettings: \(notifySettings), pts: \(pts), draft: \(draft))" - } - } - } } - public enum SendMessageAction: CustomStringConvertible { + public enum SendMessageAction: /*CustomStringConvertible,*/ ApiSerializeableObject { case sendMessageTypingAction case sendMessageCancelAction case sendMessageRecordVideoAction @@ -3867,7 +3075,6 @@ public struct Api { case sendMessageUploadAudioAction(progress: Int32) case sendMessageUploadDocumentAction(progress: Int32) case sendMessageUploadPhotoAction(progress: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .sendMessageTypingAction: @@ -3997,38 +3204,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .sendMessageTypingAction: - return "(sendMessageTypingAction)" - case .sendMessageCancelAction: - return "(sendMessageCancelAction)" - case .sendMessageRecordVideoAction: - return "(sendMessageRecordVideoAction)" - case .sendMessageRecordAudioAction: - return "(sendMessageRecordAudioAction)" - case .sendMessageGeoLocationAction: - return "(sendMessageGeoLocationAction)" - case .sendMessageChooseContactAction: - return "(sendMessageChooseContactAction)" - case .sendMessageUploadVideoAction(let progress): - return "(sendMessageUploadVideoAction progress: \(progress))" - case .sendMessageUploadAudioAction(let progress): - return "(sendMessageUploadAudioAction progress: \(progress))" - case .sendMessageUploadDocumentAction(let progress): - return "(sendMessageUploadDocumentAction progress: \(progress))" - case .sendMessageUploadPhotoAction(let progress): - return "(sendMessageUploadPhotoAction progress: \(progress))" - } - } - } } - public enum PrivacyKey: CustomStringConvertible { + public enum PrivacyKey: /*CustomStringConvertible,*/ ApiSerializeableObject { case privacyKeyStatusTimestamp case privacyKeyChatInvite - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .privacyKeyStatusTimestamp: @@ -4054,19 +3234,9 @@ public struct Api { return Api.PrivacyKey.privacyKeyChatInvite } - public var description: String { - get { - switch self { - case .privacyKeyStatusTimestamp: - return "(privacyKeyStatusTimestamp)" - case .privacyKeyChatInvite: - return "(privacyKeyChatInvite)" - } - } - } } - public enum Update: CustomStringConvertible { + public enum Update: /*CustomStringConvertible,*/ ApiSerializeableObject { case updateMessageID(id: Int32, randomId: Int64) case updateRestoreMessages(messages: [Int32], pts: Int32) case updateChatParticipants(participants: Api.ChatParticipants) @@ -4124,7 +3294,6 @@ public struct Api { case updateBotInlineSend(flags: Int32, userId: Int32, query: String, geo: Api.GeoPoint?, id: String, msgId: Api.InputBotInlineMessageID?) case updateReadChannelOutbox(channelId: Int32, maxId: Int32) case updateDraftMessage(peer: Api.Peer, draft: Api.DraftMessage) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .updateMessageID(let id, let randomId): @@ -5583,136 +4752,15 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .updateMessageID(let id, let randomId): - return "(updateMessageID id: \(id), randomId: \(randomId))" - case .updateRestoreMessages(let messages, let pts): - return "(updateRestoreMessages messages: \(messages), pts: \(pts))" - case .updateChatParticipants(let participants): - return "(updateChatParticipants participants: \(participants))" - case .updateUserStatus(let userId, let status): - return "(updateUserStatus userId: \(userId), status: \(status))" - case .updateContactRegistered(let userId, let date): - return "(updateContactRegistered userId: \(userId), date: \(date))" - case .updateContactLocated(let contacts): - return "(updateContactLocated contacts: \(contacts))" - case .updateActivation(let userId): - return "(updateActivation userId: \(userId))" - case .updateNewAuthorization(let authKeyId, let date, let device, let location): - return "(updateNewAuthorization authKeyId: \(authKeyId), date: \(date), device: \(device), location: \(location))" - case .updatePhoneCallRequested(let phoneCall): - return "(updatePhoneCallRequested phoneCall: \(phoneCall))" - case .updatePhoneCallConfirmed(let id, let aOrB, let connection): - return "(updatePhoneCallConfirmed id: \(id), aOrB: \(aOrB), connection: \(connection))" - case .updatePhoneCallDeclined(let id): - return "(updatePhoneCallDeclined id: \(id))" - case .updateUserPhoto(let userId, let date, let photo, let previous): - return "(updateUserPhoto userId: \(userId), date: \(date), photo: \(photo), previous: \(previous))" - case .updateNewEncryptedMessage(let message, let qts): - return "(updateNewEncryptedMessage message: \(message), qts: \(qts))" - case .updateEncryptedChatTyping(let chatId): - return "(updateEncryptedChatTyping chatId: \(chatId))" - case .updateEncryption(let chat, let date): - return "(updateEncryption chat: \(chat), date: \(date))" - case .updateEncryptedMessagesRead(let chatId, let maxDate, let date): - return "(updateEncryptedMessagesRead chatId: \(chatId), maxDate: \(maxDate), date: \(date))" - case .updateChatParticipantDelete(let chatId, let userId, let version): - return "(updateChatParticipantDelete chatId: \(chatId), userId: \(userId), version: \(version))" - case .updateDcOptions(let dcOptions): - return "(updateDcOptions dcOptions: \(dcOptions))" - case .updateUserBlocked(let userId, let blocked): - return "(updateUserBlocked userId: \(userId), blocked: \(blocked))" - case .updateNotifySettings(let peer, let notifySettings): - return "(updateNotifySettings peer: \(peer), notifySettings: \(notifySettings))" - case .updateUserTyping(let userId, let action): - return "(updateUserTyping userId: \(userId), action: \(action))" - case .updateChatUserTyping(let chatId, let userId, let action): - return "(updateChatUserTyping chatId: \(chatId), userId: \(userId), action: \(action))" - case .updateUserName(let userId, let firstName, let lastName, let username): - return "(updateUserName userId: \(userId), firstName: \(firstName), lastName: \(lastName), username: \(username))" - case .updateServiceNotification(let type, let message, let media, let popup): - return "(updateServiceNotification type: \(type), message: \(message), media: \(media), popup: \(popup))" - case .updatePrivacy(let key, let rules): - return "(updatePrivacy key: \(key), rules: \(rules))" - case .updateUserPhone(let userId, let phone): - return "(updateUserPhone userId: \(userId), phone: \(phone))" - case .updateNewMessage(let message, let pts, let ptsCount): - return "(updateNewMessage message: \(message), pts: \(pts), ptsCount: \(ptsCount))" - case .updateReadMessages(let messages, let pts, let ptsCount): - return "(updateReadMessages messages: \(messages), pts: \(pts), ptsCount: \(ptsCount))" - case .updateDeleteMessages(let messages, let pts, let ptsCount): - return "(updateDeleteMessages messages: \(messages), pts: \(pts), ptsCount: \(ptsCount))" - case .updateReadHistoryInbox(let peer, let maxId, let pts, let ptsCount): - return "(updateReadHistoryInbox peer: \(peer), maxId: \(maxId), pts: \(pts), ptsCount: \(ptsCount))" - case .updateReadHistoryOutbox(let peer, let maxId, let pts, let ptsCount): - return "(updateReadHistoryOutbox peer: \(peer), maxId: \(maxId), pts: \(pts), ptsCount: \(ptsCount))" - case .updateContactLink(let userId, let myLink, let foreignLink): - return "(updateContactLink userId: \(userId), myLink: \(myLink), foreignLink: \(foreignLink))" - case .updateReadMessagesContents(let messages, let pts, let ptsCount): - return "(updateReadMessagesContents messages: \(messages), pts: \(pts), ptsCount: \(ptsCount))" - case .updateChatParticipantAdd(let chatId, let userId, let inviterId, let date, let version): - return "(updateChatParticipantAdd chatId: \(chatId), userId: \(userId), inviterId: \(inviterId), date: \(date), version: \(version))" - case .updateWebPage(let webpage, let pts, let ptsCount): - return "(updateWebPage webpage: \(webpage), pts: \(pts), ptsCount: \(ptsCount))" - case .updateChannel(let channelId): - return "(updateChannel channelId: \(channelId))" - case .updateChannelGroup(let channelId, let group): - return "(updateChannelGroup channelId: \(channelId), group: \(group))" - case .updateNewChannelMessage(let message, let pts, let ptsCount): - return "(updateNewChannelMessage message: \(message), pts: \(pts), ptsCount: \(ptsCount))" - case .updateReadChannelInbox(let channelId, let maxId): - return "(updateReadChannelInbox channelId: \(channelId), maxId: \(maxId))" - case .updateDeleteChannelMessages(let channelId, let messages, let pts, let ptsCount): - return "(updateDeleteChannelMessages channelId: \(channelId), messages: \(messages), pts: \(pts), ptsCount: \(ptsCount))" - case .updateChannelMessageViews(let channelId, let id, let views): - return "(updateChannelMessageViews channelId: \(channelId), id: \(id), views: \(views))" - case .updateChatAdmins(let chatId, let enabled, let version): - return "(updateChatAdmins chatId: \(chatId), enabled: \(enabled), version: \(version))" - case .updateChatParticipantAdmin(let chatId, let userId, let isAdmin, let version): - return "(updateChatParticipantAdmin chatId: \(chatId), userId: \(userId), isAdmin: \(isAdmin), version: \(version))" - case .updateNewStickerSet(let stickerset): - return "(updateNewStickerSet stickerset: \(stickerset))" - case .updateStickerSetsOrder(let order): - return "(updateStickerSetsOrder order: \(order))" - case .updateStickerSets: - return "(updateStickerSets)" - case .updateSavedGifs: - return "(updateSavedGifs)" - case .updateEditChannelMessage(let message, let pts, let ptsCount): - return "(updateEditChannelMessage message: \(message), pts: \(pts), ptsCount: \(ptsCount))" - case .updateChannelPinnedMessage(let channelId, let id): - return "(updateChannelPinnedMessage channelId: \(channelId), id: \(id))" - case .updateChannelTooLong(let flags, let channelId, let pts): - return "(updateChannelTooLong flags: \(flags), channelId: \(channelId), pts: \(pts))" - case .updateBotCallbackQuery(let queryId, let userId, let peer, let msgId, let data): - return "(updateBotCallbackQuery queryId: \(queryId), userId: \(userId), peer: \(peer), msgId: \(msgId), data: \(data))" - case .updateEditMessage(let message, let pts, let ptsCount): - return "(updateEditMessage message: \(message), pts: \(pts), ptsCount: \(ptsCount))" - case .updateInlineBotCallbackQuery(let queryId, let userId, let msgId, let data): - return "(updateInlineBotCallbackQuery queryId: \(queryId), userId: \(userId), msgId: \(msgId), data: \(data))" - case .updateBotInlineQuery(let flags, let queryId, let userId, let query, let geo, let offset): - return "(updateBotInlineQuery flags: \(flags), queryId: \(queryId), userId: \(userId), query: \(query), geo: \(geo), offset: \(offset))" - case .updateBotInlineSend(let flags, let userId, let query, let geo, let id, let msgId): - return "(updateBotInlineSend flags: \(flags), userId: \(userId), query: \(query), geo: \(geo), id: \(id), msgId: \(msgId))" - case .updateReadChannelOutbox(let channelId, let maxId): - return "(updateReadChannelOutbox channelId: \(channelId), maxId: \(maxId))" - case .updateDraftMessage(let peer, let draft): - return "(updateDraftMessage peer: \(peer), draft: \(draft))" - } - } - } } - public enum ChannelParticipant: CustomStringConvertible { + public enum ChannelParticipant: /*CustomStringConvertible,*/ ApiSerializeableObject { case channelParticipant(userId: Int32, date: Int32) case channelParticipantSelf(userId: Int32, inviterId: Int32, date: Int32) case channelParticipantModerator(userId: Int32, inviterId: Int32, date: Int32) case channelParticipantEditor(userId: Int32, inviterId: Int32, date: Int32) case channelParticipantKicked(userId: Int32, kickedBy: Int32, date: Int32) case channelParticipantCreator(userId: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .channelParticipant(let userId, let date): @@ -5858,107 +4906,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .channelParticipant(let userId, let date): - return "(channelParticipant userId: \(userId), date: \(date))" - case .channelParticipantSelf(let userId, let inviterId, let date): - return "(channelParticipantSelf userId: \(userId), inviterId: \(inviterId), date: \(date))" - case .channelParticipantModerator(let userId, let inviterId, let date): - return "(channelParticipantModerator userId: \(userId), inviterId: \(inviterId), date: \(date))" - case .channelParticipantEditor(let userId, let inviterId, let date): - return "(channelParticipantEditor userId: \(userId), inviterId: \(inviterId), date: \(date))" - case .channelParticipantKicked(let userId, let kickedBy, let date): - return "(channelParticipantKicked userId: \(userId), kickedBy: \(kickedBy), date: \(date))" - case .channelParticipantCreator(let userId): - return "(channelParticipantCreator userId: \(userId))" - } - } - } } - public enum Error: CustomStringConvertible { - case error(code: Int32, text: String) - case richError(code: Int32, type: String, nDescription: String, debug: String, requestParams: String) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { - switch self { - case .error(let code, let text): - if boxed { - buffer.appendInt32(-994444869) - } - serializeInt32(code, buffer: buffer, boxed: false) - serializeString(text, buffer: buffer, boxed: false) - break - case .richError(let code, let type, let nDescription, let debug, let requestParams): - if boxed { - buffer.appendInt32(1504640087) - } - serializeInt32(code, buffer: buffer, boxed: false) - serializeString(type, buffer: buffer, boxed: false) - serializeString(nDescription, buffer: buffer, boxed: false) - serializeString(debug, buffer: buffer, boxed: false) - serializeString(requestParams, buffer: buffer, boxed: false) - break - } - return true - } - - fileprivate static func parse_error(_ reader: BufferReader) -> Error? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - _2 = parseString(reader) - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.Error.error(code: _1!, text: _2!) - } - else { - return nil - } - } - fileprivate static func parse_richError(_ reader: BufferReader) -> Error? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - _2 = parseString(reader) - var _3: String? - _3 = parseString(reader) - var _4: String? - _4 = parseString(reader) - var _5: String? - _5 = parseString(reader) - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 { - return Api.Error.richError(code: _1!, type: _2!, nDescription: _3!, debug: _4!, requestParams: _5!) - } - else { - return nil - } - } - - public var description: String { - get { - switch self { - case .error(let code, let text): - return "(error code: \(code), text: \(text))" - case .richError(let code, let type, let nDescription, let debug, let requestParams): - return "(richError code: \(code), type: \(type), nDescription: \(nDescription), debug: \(debug), requestParams: \(requestParams))" - } - } - } - } - - public enum ContactLocated: CustomStringConvertible { + public enum ContactLocated: /*CustomStringConvertible,*/ ApiSerializeableObject { case contactLocated(userId: Int32, location: Api.GeoPoint, date: Int32, distance: Int32) case contactLocatedPreview(hash: String, hidden: Api.Bool, date: Int32, distance: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .contactLocated(let userId, let location, let date, let distance): @@ -6028,26 +4980,15 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .contactLocated(let userId, let location, let date, let distance): - return "(contactLocated userId: \(userId), location: \(location), date: \(date), distance: \(distance))" - case .contactLocatedPreview(let hash, let hidden, let date, let distance): - return "(contactLocatedPreview hash: \(hash), hidden: \(hidden), date: \(date), distance: \(distance))" - } - } - } } - public enum KeyboardButton: CustomStringConvertible { + public enum KeyboardButton: /*CustomStringConvertible,*/ ApiSerializeableObject { case keyboardButton(text: String) case keyboardButtonUrl(text: String, url: String) case keyboardButtonCallback(text: String, data: Buffer) case keyboardButtonRequestPhone(text: String) case keyboardButtonRequestGeoLocation(text: String) case keyboardButtonSwitchInline(text: String, query: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .keyboardButton(let text): @@ -6169,29 +5110,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .keyboardButton(let text): - return "(keyboardButton text: \(text))" - case .keyboardButtonUrl(let text, let url): - return "(keyboardButtonUrl text: \(text), url: \(url))" - case .keyboardButtonCallback(let text, let data): - return "(keyboardButtonCallback text: \(text), data: \(data))" - case .keyboardButtonRequestPhone(let text): - return "(keyboardButtonRequestPhone text: \(text))" - case .keyboardButtonRequestGeoLocation(let text): - return "(keyboardButtonRequestGeoLocation text: \(text))" - case .keyboardButtonSwitchInline(let text, let query): - return "(keyboardButtonSwitchInline text: \(text), query: \(query))" - } - } - } } - public enum ContactStatus: CustomStringConvertible { + public enum ContactStatus: /*CustomStringConvertible,*/ ApiSerializeableObject { case contactStatus(userId: Int32, status: Api.UserStatus) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .contactStatus(let userId, let status): @@ -6222,21 +5144,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .contactStatus(let userId, let status): - return "(contactStatus userId: \(userId), status: \(status))" - } - } - } } - public enum PhotoSize: CustomStringConvertible { + public enum PhotoSize: /*CustomStringConvertible,*/ ApiSerializeableObject { case photoSizeEmpty(type: String) case photoSize(type: String, location: Api.FileLocation, w: Int32, h: Int32, size: Int32) case photoCachedSize(type: String, location: Api.FileLocation, w: Int32, h: Int32, bytes: Buffer) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .photoSizeEmpty(let type): @@ -6331,23 +5244,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .photoSizeEmpty(let type): - return "(photoSizeEmpty type: \(type))" - case .photoSize(let type, let location, let w, let h, let size): - return "(photoSize type: \(type), location: \(location), w: \(w), h: \(h), size: \(size))" - case .photoCachedSize(let type, let location, let w, let h, let bytes): - return "(photoCachedSize type: \(type), location: \(location), w: \(w), h: \(h), bytes: \(bytes))" - } - } - } } - public enum GlobalPrivacySettings: CustomStringConvertible { + public enum GlobalPrivacySettings: /*CustomStringConvertible,*/ ApiSerializeableObject { case globalPrivacySettings(noSuggestions: Api.Bool, hideContacts: Api.Bool, hideLocated: Api.Bool, hideLastVisit: Api.Bool) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .globalPrivacySettings(let noSuggestions, let hideContacts, let hideLocated, let hideLastVisit): @@ -6392,19 +5292,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .globalPrivacySettings(let noSuggestions, let hideContacts, let hideLocated, let hideLastVisit): - return "(globalPrivacySettings noSuggestions: \(noSuggestions), hideContacts: \(hideContacts), hideLocated: \(hideLocated), hideLastVisit: \(hideLastVisit))" - } - } - } } - public enum InlineBotSwitchPM: CustomStringConvertible { + public enum InlineBotSwitchPM: /*CustomStringConvertible,*/ ApiSerializeableObject { case inlineBotSwitchPM(text: String, startParam: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inlineBotSwitchPM(let text, let startParam): @@ -6433,20 +5324,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inlineBotSwitchPM(let text, let startParam): - return "(inlineBotSwitchPM text: \(text), startParam: \(startParam))" - } - } - } } - public enum FileLocation: CustomStringConvertible { + public enum FileLocation: /*CustomStringConvertible,*/ ApiSerializeableObject { case fileLocationUnavailable(volumeId: Int64, localId: Int32, secret: Int64) case fileLocation(dcId: Int32, volumeId: Int64, localId: Int32, secret: Int64) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .fileLocationUnavailable(let volumeId, let localId, let secret): @@ -6508,24 +5390,13 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .fileLocationUnavailable(let volumeId, let localId, let secret): - return "(fileLocationUnavailable volumeId: \(volumeId), localId: \(localId), secret: \(secret))" - case .fileLocation(let dcId, let volumeId, let localId, let secret): - return "(fileLocation dcId: \(dcId), volumeId: \(volumeId), localId: \(localId), secret: \(secret))" - } - } - } } - public enum InputNotifyPeer: CustomStringConvertible { + public enum InputNotifyPeer: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputNotifyPeer(peer: Api.InputPeer) case inputNotifyUsers case inputNotifyChats case inputNotifyAll - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputNotifyPeer(let peer): @@ -6579,26 +5450,11 @@ public struct Api { return Api.InputNotifyPeer.inputNotifyAll } - public var description: String { - get { - switch self { - case .inputNotifyPeer(let peer): - return "(inputNotifyPeer peer: \(peer))" - case .inputNotifyUsers: - return "(inputNotifyUsers)" - case .inputNotifyChats: - return "(inputNotifyChats)" - case .inputNotifyAll: - return "(inputNotifyAll)" - } - } - } } - public enum EncryptedMessage: CustomStringConvertible { + public enum EncryptedMessage: /*CustomStringConvertible,*/ ApiSerializeableObject { case encryptedMessage(randomId: Int64, chatId: Int32, date: Int32, bytes: Buffer, file: Api.EncryptedFile) case encryptedMessageService(randomId: Int64, chatId: Int32, date: Int32, bytes: Buffer) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .encryptedMessage(let randomId, let chatId, let date, let bytes, let file): @@ -6670,24 +5526,13 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .encryptedMessage(let randomId, let chatId, let date, let bytes, let file): - return "(encryptedMessage randomId: \(randomId), chatId: \(chatId), date: \(date), bytes: \(bytes), file: \(file))" - case .encryptedMessageService(let randomId, let chatId, let date, let bytes): - return "(encryptedMessageService randomId: \(randomId), chatId: \(chatId), date: \(date), bytes: \(bytes))" - } - } - } } - public enum ChannelParticipantsFilter: CustomStringConvertible { + public enum ChannelParticipantsFilter: /*CustomStringConvertible,*/ ApiSerializeableObject { case channelParticipantsRecent case channelParticipantsAdmins case channelParticipantsKicked case channelParticipantsBots - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .channelParticipantsRecent: @@ -6731,27 +5576,12 @@ public struct Api { return Api.ChannelParticipantsFilter.channelParticipantsBots } - public var description: String { - get { - switch self { - case .channelParticipantsRecent: - return "(channelParticipantsRecent)" - case .channelParticipantsAdmins: - return "(channelParticipantsAdmins)" - case .channelParticipantsKicked: - return "(channelParticipantsKicked)" - case .channelParticipantsBots: - return "(channelParticipantsBots)" - } - } - } } - public enum WebPage: CustomStringConvertible { + public enum WebPage: /*CustomStringConvertible,*/ ApiSerializeableObject { case webPageEmpty(id: Int64) case webPagePending(id: Int64, date: Int32) case webPage(flags: Int32, id: Int64, url: String, displayUrl: String, type: String?, siteName: String?, title: String?, description: String?, photo: Api.Photo?, embedUrl: String?, embedType: String?, embedWidth: Int32?, embedHeight: Int32?, duration: Int32?, author: String?, document: Api.Document?) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .webPageEmpty(let id): @@ -6878,27 +5708,14 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .webPageEmpty(let id): - return "(webPageEmpty id: \(id))" - case .webPagePending(let id, let date): - return "(webPagePending id: \(id), date: \(date))" - case .webPage(let flags, let id, let url, let displayUrl, let type, let siteName, let title, let description, let photo, let embedUrl, let embedType, let embedWidth, let embedHeight, let duration, let author, let document): - return "(webPage flags: \(flags), id: \(id), url: \(url), displayUrl: \(displayUrl), type: \(type), siteName: \(siteName), title: \(title), description: \(description), photo: \(photo), embedUrl: \(embedUrl), embedType: \(embedType), embedWidth: \(embedWidth), embedHeight: \(embedHeight), duration: \(duration), author: \(author), document: \(document))" - } - } - } } - public enum InputBotInlineMessage: CustomStringConvertible { + public enum InputBotInlineMessage: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputBotInlineMessageMediaAuto(flags: Int32, caption: String, replyMarkup: Api.ReplyMarkup?) case inputBotInlineMessageText(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?) case inputBotInlineMessageMediaGeo(flags: Int32, geoPoint: Api.InputGeoPoint, replyMarkup: Api.ReplyMarkup?) case inputBotInlineMessageMediaVenue(flags: Int32, geoPoint: Api.InputGeoPoint, title: String, address: String, provider: String, venueId: String, replyMarkup: Api.ReplyMarkup?) case inputBotInlineMessageMediaContact(flags: Int32, phoneNumber: String, firstName: String, lastName: String, replyMarkup: Api.ReplyMarkup?) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputBotInlineMessageMediaAuto(let flags, let caption, let replyMarkup): @@ -7079,27 +5896,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputBotInlineMessageMediaAuto(let flags, let caption, let replyMarkup): - return "(inputBotInlineMessageMediaAuto flags: \(flags), caption: \(caption), replyMarkup: \(replyMarkup))" - case .inputBotInlineMessageText(let flags, let message, let entities, let replyMarkup): - return "(inputBotInlineMessageText flags: \(flags), message: \(message), entities: \(entities), replyMarkup: \(replyMarkup))" - case .inputBotInlineMessageMediaGeo(let flags, let geoPoint, let replyMarkup): - return "(inputBotInlineMessageMediaGeo flags: \(flags), geoPoint: \(geoPoint), replyMarkup: \(replyMarkup))" - case .inputBotInlineMessageMediaVenue(let flags, let geoPoint, let title, let address, let provider, let venueId, let replyMarkup): - return "(inputBotInlineMessageMediaVenue flags: \(flags), geoPoint: \(geoPoint), title: \(title), address: \(address), provider: \(provider), venueId: \(venueId), replyMarkup: \(replyMarkup))" - case .inputBotInlineMessageMediaContact(let flags, let phoneNumber, let firstName, let lastName, let replyMarkup): - return "(inputBotInlineMessageMediaContact flags: \(flags), phoneNumber: \(phoneNumber), firstName: \(firstName), lastName: \(lastName), replyMarkup: \(replyMarkup))" - } - } - } } - public enum KeyboardButtonRow: CustomStringConvertible { + public enum KeyboardButtonRow: /*CustomStringConvertible,*/ ApiSerializeableObject { case keyboardButtonRow(buttons: [Api.KeyboardButton]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .keyboardButtonRow(let buttons): @@ -7130,19 +5930,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .keyboardButtonRow(let buttons): - return "(keyboardButtonRow buttons: \(buttons))" - } - } - } } - public enum StickerSet: CustomStringConvertible { + public enum StickerSet: /*CustomStringConvertible,*/ ApiSerializeableObject { case stickerSet(flags: Int32, id: Int64, accessHash: Int64, title: String, shortName: String, count: Int32, nHash: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .stickerSet(let flags, let id, let accessHash, let title, let shortName, let count, let nHash): @@ -7191,19 +5982,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .stickerSet(let flags, let id, let accessHash, let title, let shortName, let count, let nHash): - return "(stickerSet flags: \(flags), id: \(id), accessHash: \(accessHash), title: \(title), shortName: \(shortName), count: \(count), nHash: \(nHash))" - } - } - } } - public enum InputContact: CustomStringConvertible { + public enum InputContact: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputPhoneContact(clientId: Int64, phone: String, firstName: String, lastName: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputPhoneContact(let clientId, let phone, let firstName, let lastName): @@ -7240,23 +6022,14 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputPhoneContact(let clientId, let phone, let firstName, let lastName): - return "(inputPhoneContact clientId: \(clientId), phone: \(phone), firstName: \(firstName), lastName: \(lastName))" - } - } - } } - public enum TopPeerCategory: CustomStringConvertible { + public enum TopPeerCategory: /*CustomStringConvertible,*/ ApiSerializeableObject { case topPeerCategoryBotsPM case topPeerCategoryBotsInline case topPeerCategoryCorrespondents case topPeerCategoryGroups case topPeerCategoryChannels - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .topPeerCategoryBotsPM: @@ -7309,29 +6082,12 @@ public struct Api { return Api.TopPeerCategory.topPeerCategoryChannels } - public var description: String { - get { - switch self { - case .topPeerCategoryBotsPM: - return "(topPeerCategoryBotsPM)" - case .topPeerCategoryBotsInline: - return "(topPeerCategoryBotsInline)" - case .topPeerCategoryCorrespondents: - return "(topPeerCategoryCorrespondents)" - case .topPeerCategoryGroups: - return "(topPeerCategoryGroups)" - case .topPeerCategoryChannels: - return "(topPeerCategoryChannels)" - } - } - } } - public enum ChannelMessagesFilter: CustomStringConvertible { + public enum ChannelMessagesFilter: /*CustomStringConvertible,*/ ApiSerializeableObject { case channelMessagesFilterEmpty case channelMessagesFilter(flags: Int32, ranges: [Api.MessageRange]) case channelMessagesFilterCollapsed - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .channelMessagesFilterEmpty: @@ -7384,24 +6140,11 @@ public struct Api { return Api.ChannelMessagesFilter.channelMessagesFilterCollapsed } - public var description: String { - get { - switch self { - case .channelMessagesFilterEmpty: - return "(channelMessagesFilterEmpty)" - case .channelMessagesFilter(let flags, let ranges): - return "(channelMessagesFilter flags: \(flags), ranges: \(ranges))" - case .channelMessagesFilterCollapsed: - return "(channelMessagesFilterCollapsed)" - } - } - } } - public enum InputDocument: CustomStringConvertible { + public enum InputDocument: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputDocumentEmpty case inputDocument(id: Int64, accessHash: Int64) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputDocumentEmpty: @@ -7439,19 +6182,9 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputDocumentEmpty: - return "(inputDocumentEmpty)" - case .inputDocument(let id, let accessHash): - return "(inputDocument id: \(id), accessHash: \(accessHash))" - } - } - } } - public enum InputMedia: CustomStringConvertible { + public enum InputMedia: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputMediaEmpty case inputMediaGeoPoint(geoPoint: Api.InputGeoPoint) case inputMediaContact(phoneNumber: String, firstName: String, lastName: String) @@ -7462,7 +6195,6 @@ public struct Api { case inputMediaUploadedDocument(file: Api.InputFile, mimeType: String, attributes: [Api.DocumentAttribute], caption: String) case inputMediaUploadedThumbDocument(file: Api.InputFile, thumb: Api.InputFile, mimeType: String, attributes: [Api.DocumentAttribute], caption: String) case inputMediaDocument(id: Api.InputDocument, caption: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputMediaEmpty: @@ -7728,41 +6460,14 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputMediaEmpty: - return "(inputMediaEmpty)" - case .inputMediaGeoPoint(let geoPoint): - return "(inputMediaGeoPoint geoPoint: \(geoPoint))" - case .inputMediaContact(let phoneNumber, let firstName, let lastName): - return "(inputMediaContact phoneNumber: \(phoneNumber), firstName: \(firstName), lastName: \(lastName))" - case .inputMediaUploadedPhoto(let file, let caption): - return "(inputMediaUploadedPhoto file: \(file), caption: \(caption))" - case .inputMediaPhoto(let id, let caption): - return "(inputMediaPhoto id: \(id), caption: \(caption))" - case .inputMediaVenue(let geoPoint, let title, let address, let provider, let venueId): - return "(inputMediaVenue geoPoint: \(geoPoint), title: \(title), address: \(address), provider: \(provider), venueId: \(venueId))" - case .inputMediaGifExternal(let url, let q): - return "(inputMediaGifExternal url: \(url), q: \(q))" - case .inputMediaUploadedDocument(let file, let mimeType, let attributes, let caption): - return "(inputMediaUploadedDocument file: \(file), mimeType: \(mimeType), attributes: \(attributes), caption: \(caption))" - case .inputMediaUploadedThumbDocument(let file, let thumb, let mimeType, let attributes, let caption): - return "(inputMediaUploadedThumbDocument file: \(file), thumb: \(thumb), mimeType: \(mimeType), attributes: \(attributes), caption: \(caption))" - case .inputMediaDocument(let id, let caption): - return "(inputMediaDocument id: \(id), caption: \(caption))" - } - } - } } - public enum InputPeer: CustomStringConvertible { + public enum InputPeer: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputPeerEmpty case inputPeerSelf case inputPeerChat(chatId: Int32) case inputPeerUser(userId: Int32, accessHash: Int64) case inputPeerChannel(channelId: Int32, accessHash: Int64) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputPeerEmpty: @@ -7847,27 +6552,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputPeerEmpty: - return "(inputPeerEmpty)" - case .inputPeerSelf: - return "(inputPeerSelf)" - case .inputPeerChat(let chatId): - return "(inputPeerChat chatId: \(chatId))" - case .inputPeerUser(let userId, let accessHash): - return "(inputPeerUser userId: \(userId), accessHash: \(accessHash))" - case .inputPeerChannel(let channelId, let accessHash): - return "(inputPeerChannel channelId: \(channelId), accessHash: \(accessHash))" - } - } - } } - public enum Contact: CustomStringConvertible { + public enum Contact: /*CustomStringConvertible,*/ ApiSerializeableObject { case contact(userId: Int32, mutual: Api.Bool) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .contact(let userId, let mutual): @@ -7898,20 +6586,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .contact(let userId, let mutual): - return "(contact userId: \(userId), mutual: \(mutual))" - } - } - } } - public enum BotInlineResult: CustomStringConvertible { + public enum BotInlineResult: /*CustomStringConvertible,*/ ApiSerializeableObject { case botInlineResult(flags: Int32, id: String, type: String, title: String?, description: String?, url: String?, thumbUrl: String?, contentUrl: String?, contentType: String?, w: Int32?, h: Int32?, duration: Int32?, sendMessage: Api.BotInlineMessage) case botInlineMediaResult(flags: Int32, id: String, type: String, photo: Api.Photo?, document: Api.Document?, title: String?, description: String?, sendMessage: Api.BotInlineMessage) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .botInlineResult(let flags, let id, let type, let title, let description, let url, let thumbUrl, let contentUrl, let contentType, let w, let h, let duration, let sendMessage): @@ -8037,26 +6716,15 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .botInlineResult(let flags, let id, let type, let title, let description, let url, let thumbUrl, let contentUrl, let contentType, let w, let h, let duration, let sendMessage): - return "(botInlineResult flags: \(flags), id: \(id), type: \(type), title: \(title), description: \(description), url: \(url), thumbUrl: \(thumbUrl), contentUrl: \(contentUrl), contentType: \(contentType), w: \(w), h: \(h), duration: \(duration), sendMessage: \(sendMessage))" - case .botInlineMediaResult(let flags, let id, let type, let photo, let document, let title, let description, let sendMessage): - return "(botInlineMediaResult flags: \(flags), id: \(id), type: \(type), photo: \(photo), document: \(document), title: \(title), description: \(description), sendMessage: \(sendMessage))" - } - } - } } - public enum InputPrivacyRule: CustomStringConvertible { + public enum InputPrivacyRule: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputPrivacyValueAllowContacts case inputPrivacyValueAllowAll case inputPrivacyValueAllowUsers(users: [Api.InputUser]) case inputPrivacyValueDisallowContacts case inputPrivacyValueDisallowAll case inputPrivacyValueDisallowUsers(users: [Api.InputUser]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputPrivacyValueAllowContacts: @@ -8146,29 +6814,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputPrivacyValueAllowContacts: - return "(inputPrivacyValueAllowContacts)" - case .inputPrivacyValueAllowAll: - return "(inputPrivacyValueAllowAll)" - case .inputPrivacyValueAllowUsers(let users): - return "(inputPrivacyValueAllowUsers users: \(users))" - case .inputPrivacyValueDisallowContacts: - return "(inputPrivacyValueDisallowContacts)" - case .inputPrivacyValueDisallowAll: - return "(inputPrivacyValueDisallowAll)" - case .inputPrivacyValueDisallowUsers(let users): - return "(inputPrivacyValueDisallowUsers users: \(users))" - } - } - } } - public enum ContactRequest: CustomStringConvertible { + public enum ContactRequest: /*CustomStringConvertible,*/ ApiSerializeableObject { case contactRequest(userId: Int32, date: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .contactRequest(let userId, let date): @@ -8197,19 +6846,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .contactRequest(let userId, let date): - return "(contactRequest userId: \(userId), date: \(date))" - } - } - } } - public enum InputEncryptedChat: CustomStringConvertible { + public enum InputEncryptedChat: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputEncryptedChat(chatId: Int32, accessHash: Int64) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputEncryptedChat(let chatId, let accessHash): @@ -8238,20 +6878,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputEncryptedChat(let chatId, let accessHash): - return "(inputEncryptedChat chatId: \(chatId), accessHash: \(accessHash))" - } - } - } } - public enum DraftMessage: CustomStringConvertible { + public enum DraftMessage: /*CustomStringConvertible,*/ ApiSerializeableObject { case draftMessageEmpty case draftMessage(flags: Int32, replyToMsgId: Int32?, message: String, entities: [Api.MessageEntity]?, date: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .draftMessageEmpty: @@ -8307,21 +6938,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .draftMessageEmpty: - return "(draftMessageEmpty)" - case .draftMessage(let flags, let replyToMsgId, let message, let entities, let date): - return "(draftMessage flags: \(flags), replyToMsgId: \(replyToMsgId), message: \(message), entities: \(entities), date: \(date))" - } - } - } } - public enum DisabledFeature: CustomStringConvertible { + public enum DisabledFeature: /*CustomStringConvertible,*/ ApiSerializeableObject { case disabledFeature(feature: String, nDescription: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .disabledFeature(let feature, let nDescription): @@ -8350,20 +6970,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .disabledFeature(let feature, let nDescription): - return "(disabledFeature feature: \(feature), nDescription: \(nDescription))" - } - } - } } - public enum EncryptedFile: CustomStringConvertible { + public enum EncryptedFile: /*CustomStringConvertible,*/ ApiSerializeableObject { case encryptedFileEmpty case encryptedFile(id: Int64, accessHash: Int64, size: Int32, dcId: Int32, keyFingerprint: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .encryptedFileEmpty: @@ -8413,24 +7024,13 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .encryptedFileEmpty: - return "(encryptedFileEmpty)" - case .encryptedFile(let id, let accessHash, let size, let dcId, let keyFingerprint): - return "(encryptedFile id: \(id), accessHash: \(accessHash), size: \(size), dcId: \(dcId), keyFingerprint: \(keyFingerprint))" - } - } - } } - public enum NotifyPeer: CustomStringConvertible { + public enum NotifyPeer: /*CustomStringConvertible,*/ ApiSerializeableObject { case notifyPeer(peer: Api.Peer) case notifyUsers case notifyChats case notifyAll - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .notifyPeer(let peer): @@ -8484,26 +7084,11 @@ public struct Api { return Api.NotifyPeer.notifyAll } - public var description: String { - get { - switch self { - case .notifyPeer(let peer): - return "(notifyPeer peer: \(peer))" - case .notifyUsers: - return "(notifyUsers)" - case .notifyChats: - return "(notifyChats)" - case .notifyAll: - return "(notifyAll)" - } - } - } } - public enum InputPrivacyKey: CustomStringConvertible { + public enum InputPrivacyKey: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputPrivacyKeyStatusTimestamp case inputPrivacyKeyChatInvite - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputPrivacyKeyStatusTimestamp: @@ -8529,24 +7114,13 @@ public struct Api { return Api.InputPrivacyKey.inputPrivacyKeyChatInvite } - public var description: String { - get { - switch self { - case .inputPrivacyKeyStatusTimestamp: - return "(inputPrivacyKeyStatusTimestamp)" - case .inputPrivacyKeyChatInvite: - return "(inputPrivacyKeyChatInvite)" - } - } - } } - public enum ReplyMarkup: CustomStringConvertible { + public enum ReplyMarkup: /*CustomStringConvertible,*/ ApiSerializeableObject { case replyKeyboardHide(flags: Int32) case replyKeyboardForceReply(flags: Int32) case replyKeyboardMarkup(flags: Int32, rows: [Api.KeyboardButtonRow]) case replyInlineMarkup(rows: [Api.KeyboardButtonRow]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .replyKeyboardHide(let flags): @@ -8638,25 +7212,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .replyKeyboardHide(let flags): - return "(replyKeyboardHide flags: \(flags))" - case .replyKeyboardForceReply(let flags): - return "(replyKeyboardForceReply flags: \(flags))" - case .replyKeyboardMarkup(let flags, let rows): - return "(replyKeyboardMarkup flags: \(flags), rows: \(rows))" - case .replyInlineMarkup(let rows): - return "(replyInlineMarkup rows: \(rows))" - } - } - } } - public enum TopPeer: CustomStringConvertible { + public enum TopPeer: /*CustomStringConvertible,*/ ApiSerializeableObject { case topPeer(peer: Api.Peer, rating: Double) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .topPeer(let peer, let rating): @@ -8687,19 +7246,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .topPeer(let peer, let rating): - return "(topPeer peer: \(peer), rating: \(rating))" - } - } - } } - public enum ContactBlocked: CustomStringConvertible { + public enum ContactBlocked: /*CustomStringConvertible,*/ ApiSerializeableObject { case contactBlocked(userId: Int32, date: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .contactBlocked(let userId, let date): @@ -8728,21 +7278,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .contactBlocked(let userId, let date): - return "(contactBlocked userId: \(userId), date: \(date))" - } - } - } } - public enum InputUser: CustomStringConvertible { + public enum InputUser: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputUserEmpty case inputUserSelf case inputUser(userId: Int32, accessHash: Int64) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputUserEmpty: @@ -8789,23 +7330,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputUserEmpty: - return "(inputUserEmpty)" - case .inputUserSelf: - return "(inputUserSelf)" - case .inputUser(let userId, let accessHash): - return "(inputUser userId: \(userId), accessHash: \(accessHash))" - } - } - } } - public enum SchemeType: CustomStringConvertible { + public enum SchemeType: /*CustomStringConvertible,*/ ApiSerializeableObject { case schemeType(id: Int32, predicate: String, params: [Api.SchemeParam], type: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .schemeType(let id, let predicate, let params, let type): @@ -8848,19 +7376,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .schemeType(let id, let predicate, let params, let type): - return "(schemeType id: \(id), predicate: \(predicate), params: \(params), type: \(type))" - } - } - } } - public enum MessageRange: CustomStringConvertible { + public enum MessageRange: /*CustomStringConvertible,*/ ApiSerializeableObject { case messageRange(minId: Int32, maxId: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .messageRange(let minId, let maxId): @@ -8889,19 +7408,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .messageRange(let minId, let maxId): - return "(messageRange minId: \(minId), maxId: \(maxId))" - } - } - } } - public enum Config: CustomStringConvertible { + public enum Config: /*CustomStringConvertible,*/ ApiSerializeableObject { case config(date: Int32, expires: Int32, testMode: Api.Bool, thisDc: Int32, dcOptions: [Api.DcOption], chatSizeMax: Int32, megagroupSizeMax: Int32, forwardedCountMax: Int32, onlineUpdatePeriodMs: Int32, offlineBlurTimeoutMs: Int32, offlineIdleTimeoutMs: Int32, onlineCloudTimeoutMs: Int32, notifyCloudDelayMs: Int32, notifyDefaultDelayMs: Int32, chatBigSize: Int32, pushChatPeriodMs: Int32, pushChatLimit: Int32, savedGifsLimit: Int32, editTimeLimit: Int32, ratingEDecay: Int32, disabledFeatures: [Api.DisabledFeature]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .config(let date, let expires, let testMode, let thisDc, let dcOptions, let chatSizeMax, let megagroupSizeMax, let forwardedCountMax, let onlineUpdatePeriodMs, let offlineBlurTimeoutMs, let offlineIdleTimeoutMs, let onlineCloudTimeoutMs, let notifyCloudDelayMs, let notifyDefaultDelayMs, let chatBigSize, let pushChatPeriodMs, let pushChatLimit, let savedGifsLimit, let editTimeLimit, let ratingEDecay, let disabledFeatures): @@ -9020,19 +7530,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .config(let date, let expires, let testMode, let thisDc, let dcOptions, let chatSizeMax, let megagroupSizeMax, let forwardedCountMax, let onlineUpdatePeriodMs, let offlineBlurTimeoutMs, let offlineIdleTimeoutMs, let onlineCloudTimeoutMs, let notifyCloudDelayMs, let notifyDefaultDelayMs, let chatBigSize, let pushChatPeriodMs, let pushChatLimit, let savedGifsLimit, let editTimeLimit, let ratingEDecay, let disabledFeatures): - return "(config date: \(date), expires: \(expires), testMode: \(testMode), thisDc: \(thisDc), dcOptions: \(dcOptions), chatSizeMax: \(chatSizeMax), megagroupSizeMax: \(megagroupSizeMax), forwardedCountMax: \(forwardedCountMax), onlineUpdatePeriodMs: \(onlineUpdatePeriodMs), offlineBlurTimeoutMs: \(offlineBlurTimeoutMs), offlineIdleTimeoutMs: \(offlineIdleTimeoutMs), onlineCloudTimeoutMs: \(onlineCloudTimeoutMs), notifyCloudDelayMs: \(notifyCloudDelayMs), notifyDefaultDelayMs: \(notifyDefaultDelayMs), chatBigSize: \(chatBigSize), pushChatPeriodMs: \(pushChatPeriodMs), pushChatLimit: \(pushChatLimit), savedGifsLimit: \(savedGifsLimit), editTimeLimit: \(editTimeLimit), ratingEDecay: \(ratingEDecay), disabledFeatures: \(disabledFeatures))" - } - } - } } - public enum TopPeerCategoryPeers: CustomStringConvertible { + public enum TopPeerCategoryPeers: /*CustomStringConvertible,*/ ApiSerializeableObject { case topPeerCategoryPeers(category: Api.TopPeerCategory, count: Int32, peers: [Api.TopPeer]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .topPeerCategoryPeers(let category, let count, let peers): @@ -9073,19 +7574,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .topPeerCategoryPeers(let category, let count, let peers): - return "(topPeerCategoryPeers category: \(category), count: \(count), peers: \(peers))" - } - } - } } - public enum BotCommand: CustomStringConvertible { + public enum BotCommand: /*CustomStringConvertible,*/ ApiSerializeableObject { case botCommand(command: String, description: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .botCommand(let command, let description): @@ -9114,49 +7606,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .botCommand(let command, let description): - return "(botCommand command: \(command), description: \(description))" - } - } - } } - public enum ResponseIndirect: CustomStringConvertible { - case responseIndirect - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { - switch self { - case .responseIndirect: - if boxed { - buffer.appendInt32(563410286) - } - - break - } - return true - } - - fileprivate static func parse_responseIndirect(_ reader: BufferReader) -> ResponseIndirect? { - return Api.ResponseIndirect.responseIndirect - } - - public var description: String { - get { - switch self { - case .responseIndirect: - return "(responseIndirect)" - } - } - } - } - - public enum WallPaper: CustomStringConvertible { + public enum WallPaper: /*CustomStringConvertible,*/ ApiSerializeableObject { case wallPaper(id: Int32, title: String, sizes: [Api.PhotoSize], color: Int32) case wallPaperSolid(id: Int32, title: String, bgColor: Int32, color: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .wallPaper(let id, let title, let sizes, let color): @@ -9228,23 +7682,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .wallPaper(let id, let title, let sizes, let color): - return "(wallPaper id: \(id), title: \(title), sizes: \(sizes), color: \(color))" - case .wallPaperSolid(let id, let title, let bgColor, let color): - return "(wallPaperSolid id: \(id), title: \(title), bgColor: \(bgColor), color: \(color))" - } - } - } } - public enum InputChatPhoto: CustomStringConvertible { + public enum InputChatPhoto: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputChatPhotoEmpty case inputChatUploadedPhoto(file: Api.InputFile, crop: Api.InputPhotoCrop) case inputChatPhoto(id: Api.InputPhoto, crop: Api.InputPhotoCrop) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputChatPhotoEmpty: @@ -9311,21 +7754,9 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputChatPhotoEmpty: - return "(inputChatPhotoEmpty)" - case .inputChatUploadedPhoto(let file, let crop): - return "(inputChatUploadedPhoto file: \(file), crop: \(crop))" - case .inputChatPhoto(let id, let crop): - return "(inputChatPhoto id: \(id), crop: \(crop))" - } - } - } } - public enum Updates: CustomStringConvertible { + public enum Updates: /*CustomStringConvertible,*/ ApiSerializeableObject { case updatesTooLong case updateShort(update: Api.Update, date: Int32) case updatesCombined(updates: [Api.Update], users: [Api.User], chats: [Api.Chat], date: Int32, seqStart: Int32, seq: Int32) @@ -9333,7 +7764,6 @@ public struct Api { case updateShortMessage(flags: Int32, id: Int32, userId: Int32, message: String, pts: Int32, ptsCount: Int32, date: Int32, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int32?, replyToMsgId: Int32?, entities: [Api.MessageEntity]?) case updateShortChatMessage(flags: Int32, id: Int32, fromId: Int32, chatId: Int32, message: String, pts: Int32, ptsCount: Int32, date: Int32, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int32?, replyToMsgId: Int32?, entities: [Api.MessageEntity]?) case updateShortSentMessage(flags: Int32, id: Int32, pts: Int32, ptsCount: Int32, date: Int32, media: Api.MessageMedia?, entities: [Api.MessageEntity]?) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .updatesTooLong: @@ -9662,88 +8092,9 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .updatesTooLong: - return "(updatesTooLong)" - case .updateShort(let update, let date): - return "(updateShort update: \(update), date: \(date))" - case .updatesCombined(let updates, let users, let chats, let date, let seqStart, let seq): - return "(updatesCombined updates: \(updates), users: \(users), chats: \(chats), date: \(date), seqStart: \(seqStart), seq: \(seq))" - case .updates(let updates, let users, let chats, let date, let seq): - return "(updates updates: \(updates), users: \(users), chats: \(chats), date: \(date), seq: \(seq))" - case .updateShortMessage(let flags, let id, let userId, let message, let pts, let ptsCount, let date, let fwdFrom, let viaBotId, let replyToMsgId, let entities): - return "(updateShortMessage flags: \(flags), id: \(id), userId: \(userId), message: \(message), pts: \(pts), ptsCount: \(ptsCount), date: \(date), fwdFrom: \(fwdFrom), viaBotId: \(viaBotId), replyToMsgId: \(replyToMsgId), entities: \(entities))" - case .updateShortChatMessage(let flags, let id, let fromId, let chatId, let message, let pts, let ptsCount, let date, let fwdFrom, let viaBotId, let replyToMsgId, let entities): - return "(updateShortChatMessage flags: \(flags), id: \(id), fromId: \(fromId), chatId: \(chatId), message: \(message), pts: \(pts), ptsCount: \(ptsCount), date: \(date), fwdFrom: \(fwdFrom), viaBotId: \(viaBotId), replyToMsgId: \(replyToMsgId), entities: \(entities))" - case .updateShortSentMessage(let flags, let id, let pts, let ptsCount, let date, let media, let entities): - return "(updateShortSentMessage flags: \(flags), id: \(id), pts: \(pts), ptsCount: \(ptsCount), date: \(date), media: \(media), entities: \(entities))" - } - } - } } - public enum InitConnection: CustomStringConvertible { - case initConnection(apiId: Int32, deviceModel: String, systemVersion: String, appVersion: String, langCode: String, query: Any) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { - switch self { - case .initConnection(let apiId, let deviceModel, let systemVersion, let appVersion, let langCode, let query): - if boxed { - buffer.appendInt32(1769565673) - } - serializeInt32(apiId, buffer: buffer, boxed: false) - serializeString(deviceModel, buffer: buffer, boxed: false) - serializeString(systemVersion, buffer: buffer, boxed: false) - serializeString(appVersion, buffer: buffer, boxed: false) - serializeString(langCode, buffer: buffer, boxed: false) - let _ = Api.serializeObject(query, buffer: buffer, boxed: true) - break - } - return true - } - - fileprivate static func parse_initConnection(_ reader: BufferReader) -> InitConnection? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - _2 = parseString(reader) - var _3: String? - _3 = parseString(reader) - var _4: String? - _4 = parseString(reader) - var _5: String? - _5 = parseString(reader) - var _6: Any? - if let signature = reader.readInt32() { - _6 = Api.parse(reader, signature: signature) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - let _c6 = _6 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { - return Api.InitConnection.initConnection(apiId: _1!, deviceModel: _2!, systemVersion: _3!, appVersion: _4!, langCode: _5!, query: _6!) - } - else { - return nil - } - } - - public var description: String { - get { - switch self { - case .initConnection(let apiId, let deviceModel, let systemVersion, let appVersion, let langCode, let query): - return "(initConnection apiId: \(apiId), deviceModel: \(deviceModel), systemVersion: \(systemVersion), appVersion: \(appVersion), langCode: \(langCode), query: \(query))" - } - } - } - } - - public enum MessageMedia: CustomStringConvertible { + public enum MessageMedia: /*CustomStringConvertible,*/ ApiSerializeableObject { case messageMediaEmpty case messageMediaGeo(geo: Api.GeoPoint) case messageMediaContact(phoneNumber: String, firstName: String, lastName: String, userId: Int32) @@ -9752,7 +8103,6 @@ public struct Api { case messageMediaPhoto(photo: Api.Photo, caption: String) case messageMediaVenue(geo: Api.GeoPoint, title: String, address: String, provider: String, venueId: String) case messageMediaDocument(document: Api.Document, caption: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .messageMediaEmpty: @@ -9926,33 +8276,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .messageMediaEmpty: - return "(messageMediaEmpty)" - case .messageMediaGeo(let geo): - return "(messageMediaGeo geo: \(geo))" - case .messageMediaContact(let phoneNumber, let firstName, let lastName, let userId): - return "(messageMediaContact phoneNumber: \(phoneNumber), firstName: \(firstName), lastName: \(lastName), userId: \(userId))" - case .messageMediaUnsupported: - return "(messageMediaUnsupported)" - case .messageMediaWebPage(let webpage): - return "(messageMediaWebPage webpage: \(webpage))" - case .messageMediaPhoto(let photo, let caption): - return "(messageMediaPhoto photo: \(photo), caption: \(caption))" - case .messageMediaVenue(let geo, let title, let address, let provider, let venueId): - return "(messageMediaVenue geo: \(geo), title: \(title), address: \(address), provider: \(provider), venueId: \(venueId))" - case .messageMediaDocument(let document, let caption): - return "(messageMediaDocument document: \(document), caption: \(caption))" - } - } - } } - public enum Null: CustomStringConvertible { + public enum Null: /*CustomStringConvertible,*/ ApiSerializeableObject { case null - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .null: @@ -9969,24 +8296,15 @@ public struct Api { return Api.Null.null } - public var description: String { - get { - switch self { - case .null: - return "(null)" - } - } - } } - public enum DocumentAttribute: CustomStringConvertible { + public enum DocumentAttribute: /*CustomStringConvertible,*/ ApiSerializeableObject { case documentAttributeImageSize(w: Int32, h: Int32) case documentAttributeAnimated case documentAttributeVideo(duration: Int32, w: Int32, h: Int32) case documentAttributeFilename(fileName: String) case documentAttributeSticker(alt: String, stickerset: Api.InputStickerSet) case documentAttributeAudio(flags: Int32, duration: Int32, title: String?, performer: String?, waveform: Buffer?) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .documentAttributeImageSize(let w, let h): @@ -10122,30 +8440,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .documentAttributeImageSize(let w, let h): - return "(documentAttributeImageSize w: \(w), h: \(h))" - case .documentAttributeAnimated: - return "(documentAttributeAnimated)" - case .documentAttributeVideo(let duration, let w, let h): - return "(documentAttributeVideo duration: \(duration), w: \(w), h: \(h))" - case .documentAttributeFilename(let fileName): - return "(documentAttributeFilename fileName: \(fileName))" - case .documentAttributeSticker(let alt, let stickerset): - return "(documentAttributeSticker alt: \(alt), stickerset: \(stickerset))" - case .documentAttributeAudio(let flags, let duration, let title, let performer, let waveform): - return "(documentAttributeAudio flags: \(flags), duration: \(duration), title: \(title), performer: \(performer), waveform: \(waveform))" - } - } - } } - public enum ChatPhoto: CustomStringConvertible { + public enum ChatPhoto: /*CustomStringConvertible,*/ ApiSerializeableObject { case chatPhotoEmpty case chatPhoto(photoSmall: Api.FileLocation, photoBig: Api.FileLocation) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .chatPhotoEmpty: @@ -10187,23 +8486,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .chatPhotoEmpty: - return "(chatPhotoEmpty)" - case .chatPhoto(let photoSmall, let photoBig): - return "(chatPhoto photoSmall: \(photoSmall), photoBig: \(photoBig))" - } - } - } } - public enum InputStickerSet: CustomStringConvertible { + public enum InputStickerSet: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputStickerSetEmpty case inputStickerSetID(id: Int64, accessHash: Int64) case inputStickerSetShortName(shortName: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputStickerSetEmpty: @@ -10258,23 +8546,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputStickerSetEmpty: - return "(inputStickerSetEmpty)" - case .inputStickerSetID(let id, let accessHash): - return "(inputStickerSetID id: \(id), accessHash: \(accessHash))" - case .inputStickerSetShortName(let shortName): - return "(inputStickerSetShortName shortName: \(shortName))" - } - } - } } - public enum BotInfo: CustomStringConvertible { + public enum BotInfo: /*CustomStringConvertible,*/ ApiSerializeableObject { case botInfo(userId: Int32, description: String, commands: [Api.BotCommand]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .botInfo(let userId, let description, let commands): @@ -10313,20 +8588,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .botInfo(let userId, let description, let commands): - return "(botInfo userId: \(userId), description: \(description), commands: \(commands))" - } - } - } } - public enum FoundGif: CustomStringConvertible { + public enum FoundGif: /*CustomStringConvertible,*/ ApiSerializeableObject { case foundGif(url: String, thumbUrl: String, contentUrl: String, contentType: String, w: Int32, h: Int32) case foundGifCached(url: String, photo: Api.Photo, document: Api.Document) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .foundGif(let url, let thumbUrl, let contentUrl, let contentType, let w, let h): @@ -10400,22 +8666,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .foundGif(let url, let thumbUrl, let contentUrl, let contentType, let w, let h): - return "(foundGif url: \(url), thumbUrl: \(thumbUrl), contentUrl: \(contentUrl), contentType: \(contentType), w: \(w), h: \(h))" - case .foundGifCached(let url, let photo, let document): - return "(foundGifCached url: \(url), photo: \(photo), document: \(document))" - } - } - } } - public enum User: CustomStringConvertible { + public enum User: /*CustomStringConvertible,*/ ApiSerializeableObject { case userEmpty(id: Int32) case user(flags: Int32, id: Int32, accessHash: Int64?, firstName: String?, lastName: String?, username: String?, phone: String?, photo: Api.UserProfilePhoto?, status: Api.UserStatus?, botInfoVersion: Int32?, restrictionReason: String?, botInlinePlaceholder: String?) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .userEmpty(let id): @@ -10505,23 +8760,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .userEmpty(let id): - return "(userEmpty id: \(id))" - case .user(let flags, let id, let accessHash, let firstName, let lastName, let username, let phone, let photo, let status, let botInfoVersion, let restrictionReason, let botInlinePlaceholder): - return "(user flags: \(flags), id: \(id), accessHash: \(accessHash), firstName: \(firstName), lastName: \(lastName), username: \(username), phone: \(phone), photo: \(photo), status: \(status), botInfoVersion: \(botInfoVersion), restrictionReason: \(restrictionReason), botInlinePlaceholder: \(botInlinePlaceholder))" - } - } - } } - public enum Message: CustomStringConvertible { + public enum Message: /*CustomStringConvertible,*/ ApiSerializeableObject { case messageEmpty(id: Int32) case message(flags: Int32, id: Int32, fromId: Int32?, toId: Api.Peer, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int32?, replyToMsgId: Int32?, date: Int32, message: String, media: Api.MessageMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, views: Int32?, editDate: Int32?) case messageService(flags: Int32, id: Int32, fromId: Int32?, toId: Api.Peer, replyToMsgId: Int32?, date: Int32, action: Api.MessageAction) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .messageEmpty(let id): @@ -10674,25 +8918,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .messageEmpty(let id): - return "(messageEmpty id: \(id))" - case .message(let flags, let id, let fromId, let toId, let fwdFrom, let viaBotId, let replyToMsgId, let date, let message, let media, let replyMarkup, let entities, let views, let editDate): - return "(message flags: \(flags), id: \(id), fromId: \(fromId), toId: \(toId), fwdFrom: \(fwdFrom), viaBotId: \(viaBotId), replyToMsgId: \(replyToMsgId), date: \(date), message: \(message), media: \(media), replyMarkup: \(replyMarkup), entities: \(entities), views: \(views), editDate: \(editDate))" - case .messageService(let flags, let id, let fromId, let toId, let replyToMsgId, let date, let action): - return "(messageService flags: \(flags), id: \(id), fromId: \(fromId), toId: \(toId), replyToMsgId: \(replyToMsgId), date: \(date), action: \(action))" - } - } - } } - public enum InputFileLocation: CustomStringConvertible { + public enum InputFileLocation: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputFileLocation(volumeId: Int64, localId: Int32, secret: Int64) case inputEncryptedFileLocation(id: Int64, accessHash: Int64) case inputDocumentFileLocation(id: Int64, accessHash: Int64) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputFileLocation(let volumeId, let localId, let secret): @@ -10767,25 +8998,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputFileLocation(let volumeId, let localId, let secret): - return "(inputFileLocation volumeId: \(volumeId), localId: \(localId), secret: \(secret))" - case .inputEncryptedFileLocation(let id, let accessHash): - return "(inputEncryptedFileLocation id: \(id), accessHash: \(accessHash))" - case .inputDocumentFileLocation(let id, let accessHash): - return "(inputDocumentFileLocation id: \(id), accessHash: \(accessHash))" - } - } - } } - public enum GeoPoint: CustomStringConvertible { + public enum GeoPoint: /*CustomStringConvertible,*/ ApiSerializeableObject { case geoPointEmpty case geoPoint(long: Double, lat: Double) case geoPlace(long: Double, lat: Double, name: Api.GeoPlaceName) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .geoPointEmpty: @@ -10850,23 +9068,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .geoPointEmpty: - return "(geoPointEmpty)" - case .geoPoint(let long, let lat): - return "(geoPoint long: \(long), lat: \(lat))" - case .geoPlace(let long, let lat, let name): - return "(geoPlace long: \(long), lat: \(lat), name: \(name))" - } - } - } } - public enum InputPhoneCall: CustomStringConvertible { + public enum InputPhoneCall: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputPhoneCall(id: Int64, accessHash: Int64) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputPhoneCall(let id, let accessHash): @@ -10895,19 +9100,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputPhoneCall(let id, let accessHash): - return "(inputPhoneCall id: \(id), accessHash: \(accessHash))" - } - } - } } - public enum ReceivedNotifyMessage: CustomStringConvertible { + public enum ReceivedNotifyMessage: /*CustomStringConvertible,*/ ApiSerializeableObject { case receivedNotifyMessage(id: Int32, flags: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .receivedNotifyMessage(let id, let flags): @@ -10936,20 +9132,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .receivedNotifyMessage(let id, let flags): - return "(receivedNotifyMessage id: \(id), flags: \(flags))" - } - } - } } - public enum ChatParticipants: CustomStringConvertible { + public enum ChatParticipants: /*CustomStringConvertible,*/ ApiSerializeableObject { case chatParticipantsForbidden(flags: Int32, chatId: Int32, selfParticipant: Api.ChatParticipant?) case chatParticipants(chatId: Int32, participants: [Api.ChatParticipant], version: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .chatParticipantsForbidden(let flags, let chatId, let selfParticipant): @@ -11015,21 +9202,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .chatParticipantsForbidden(let flags, let chatId, let selfParticipant): - return "(chatParticipantsForbidden flags: \(flags), chatId: \(chatId), selfParticipant: \(selfParticipant))" - case .chatParticipants(let chatId, let participants, let version): - return "(chatParticipants chatId: \(chatId), participants: \(participants), version: \(version))" - } - } - } } - public enum NearestDc: CustomStringConvertible { + public enum NearestDc: /*CustomStringConvertible,*/ ApiSerializeableObject { case nearestDc(country: String, thisDc: Int32, nearestDc: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .nearestDc(let country, let thisDc, let nearestDc): @@ -11062,20 +9238,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .nearestDc(let country, let thisDc, let nearestDc): - return "(nearestDc country: \(country), thisDc: \(thisDc), nearestDc: \(nearestDc))" - } - } - } } - public enum Bool: CustomStringConvertible { + public enum Bool: /*CustomStringConvertible,*/ ApiSerializeableObject { case boolFalse case boolTrue - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .boolFalse: @@ -11101,21 +9268,10 @@ public struct Api { return Api.Bool.boolTrue } - public var description: String { - get { - switch self { - case .boolFalse: - return "(boolFalse)" - case .boolTrue: - return "(boolTrue)" - } - } - } } - public enum MessageFwdHeader: CustomStringConvertible { + public enum MessageFwdHeader: /*CustomStringConvertible,*/ ApiSerializeableObject { case messageFwdHeader(flags: Int32, fromId: Int32?, date: Int32, channelId: Int32?, channelPost: Int32?) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .messageFwdHeader(let flags, let fromId, let date, let channelId, let channelPost): @@ -11156,19 +9312,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .messageFwdHeader(let flags, let fromId, let date, let channelId, let channelPost): - return "(messageFwdHeader flags: \(flags), fromId: \(fromId), date: \(date), channelId: \(channelId), channelPost: \(channelPost))" - } - } - } } - public enum ChatLocated: CustomStringConvertible { + public enum ChatLocated: /*CustomStringConvertible,*/ ApiSerializeableObject { case chatLocated(chatId: Int32, distance: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .chatLocated(let chatId, let distance): @@ -11197,17 +9344,9 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .chatLocated(let chatId, let distance): - return "(chatLocated chatId: \(chatId), distance: \(distance))" - } - } - } } - public enum MessagesFilter: CustomStringConvertible { + public enum MessagesFilter: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputMessagesFilterEmpty case inputMessagesFilterPhotos case inputMessagesFilterVideo @@ -11217,7 +9356,6 @@ public struct Api { case inputMessagesFilterVoice case inputMessagesFilterMusic case inputMessagesFilterChatPhotos - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputMessagesFilterEmpty: @@ -11306,35 +9444,10 @@ public struct Api { return Api.MessagesFilter.inputMessagesFilterChatPhotos } - public var description: String { - get { - switch self { - case .inputMessagesFilterEmpty: - return "(inputMessagesFilterEmpty)" - case .inputMessagesFilterPhotos: - return "(inputMessagesFilterPhotos)" - case .inputMessagesFilterVideo: - return "(inputMessagesFilterVideo)" - case .inputMessagesFilterPhotoVideo: - return "(inputMessagesFilterPhotoVideo)" - case .inputMessagesFilterDocument: - return "(inputMessagesFilterDocument)" - case .inputMessagesFilterPhotoVideoDocuments: - return "(inputMessagesFilterPhotoVideoDocuments)" - case .inputMessagesFilterVoice: - return "(inputMessagesFilterVoice)" - case .inputMessagesFilterMusic: - return "(inputMessagesFilterMusic)" - case .inputMessagesFilterChatPhotos: - return "(inputMessagesFilterChatPhotos)" - } - } - } } - public enum ContactSuggested: CustomStringConvertible { + public enum ContactSuggested: /*CustomStringConvertible,*/ ApiSerializeableObject { case contactSuggested(userId: Int32, mutualContacts: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .contactSuggested(let userId, let mutualContacts): @@ -11363,23 +9476,14 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .contactSuggested(let userId, let mutualContacts): - return "(contactSuggested userId: \(userId), mutualContacts: \(mutualContacts))" - } - } - } } - public enum BotInlineMessage: CustomStringConvertible { + public enum BotInlineMessage: /*CustomStringConvertible,*/ ApiSerializeableObject { case botInlineMessageMediaAuto(flags: Int32, caption: String, replyMarkup: Api.ReplyMarkup?) case botInlineMessageText(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?) case botInlineMessageMediaGeo(flags: Int32, geo: Api.GeoPoint, replyMarkup: Api.ReplyMarkup?) case botInlineMessageMediaVenue(flags: Int32, geo: Api.GeoPoint, title: String, address: String, provider: String, venueId: String, replyMarkup: Api.ReplyMarkup?) case botInlineMessageMediaContact(flags: Int32, phoneNumber: String, firstName: String, lastName: String, replyMarkup: Api.ReplyMarkup?) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .botInlineMessageMediaAuto(let flags, let caption, let replyMarkup): @@ -11560,27 +9664,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .botInlineMessageMediaAuto(let flags, let caption, let replyMarkup): - return "(botInlineMessageMediaAuto flags: \(flags), caption: \(caption), replyMarkup: \(replyMarkup))" - case .botInlineMessageText(let flags, let message, let entities, let replyMarkup): - return "(botInlineMessageText flags: \(flags), message: \(message), entities: \(entities), replyMarkup: \(replyMarkup))" - case .botInlineMessageMediaGeo(let flags, let geo, let replyMarkup): - return "(botInlineMessageMediaGeo flags: \(flags), geo: \(geo), replyMarkup: \(replyMarkup))" - case .botInlineMessageMediaVenue(let flags, let geo, let title, let address, let provider, let venueId, let replyMarkup): - return "(botInlineMessageMediaVenue flags: \(flags), geo: \(geo), title: \(title), address: \(address), provider: \(provider), venueId: \(venueId), replyMarkup: \(replyMarkup))" - case .botInlineMessageMediaContact(let flags, let phoneNumber, let firstName, let lastName, let replyMarkup): - return "(botInlineMessageMediaContact flags: \(flags), phoneNumber: \(phoneNumber), firstName: \(firstName), lastName: \(lastName), replyMarkup: \(replyMarkup))" - } - } - } } - public enum InputPeerNotifySettings: CustomStringConvertible { + public enum InputPeerNotifySettings: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputPeerNotifySettings(flags: Int32, muteUntil: Int32, sound: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputPeerNotifySettings(let flags, let muteUntil, let sound): @@ -11613,20 +9700,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputPeerNotifySettings(let flags, let muteUntil, let sound): - return "(inputPeerNotifySettings flags: \(flags), muteUntil: \(muteUntil), sound: \(sound))" - } - } - } } - public enum ExportedChatInvite: CustomStringConvertible { + public enum ExportedChatInvite: /*CustomStringConvertible,*/ ApiSerializeableObject { case chatInviteEmpty case chatInviteExported(link: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .chatInviteEmpty: @@ -11660,21 +9738,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .chatInviteEmpty: - return "(chatInviteEmpty)" - case .chatInviteExported(let link): - return "(chatInviteExported link: \(link))" - } - } - } } - public enum DcNetworkStats: CustomStringConvertible { + public enum DcNetworkStats: /*CustomStringConvertible,*/ ApiSerializeableObject { case dcPingStats(dcId: Int32, ipAddress: String, pings: [Int32]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .dcPingStats(let dcId, let ipAddress, let pings): @@ -11713,19 +9780,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .dcPingStats(let dcId, let ipAddress, let pings): - return "(dcPingStats dcId: \(dcId), ipAddress: \(ipAddress), pings: \(pings))" - } - } - } } - public enum Authorization: CustomStringConvertible { + public enum Authorization: /*CustomStringConvertible,*/ ApiSerializeableObject { case authorization(hash: Int64, flags: Int32, deviceModel: String, platform: String, systemVersion: String, apiId: Int32, appName: String, appVersion: String, dateCreated: Int32, dateActive: Int32, ip: String, country: String, region: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .authorization(let hash, let flags, let deviceModel, let platform, let systemVersion, let apiId, let appName, let appVersion, let dateCreated, let dateActive, let ip, let country, let region): @@ -11798,20 +9856,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .authorization(let hash, let flags, let deviceModel, let platform, let systemVersion, let apiId, let appName, let appVersion, let dateCreated, let dateActive, let ip, let country, let region): - return "(authorization hash: \(hash), flags: \(flags), deviceModel: \(deviceModel), platform: \(platform), systemVersion: \(systemVersion), apiId: \(apiId), appName: \(appName), appVersion: \(appVersion), dateCreated: \(dateCreated), dateActive: \(dateActive), ip: \(ip), country: \(country), region: \(region))" - } - } - } } - public enum PhoneConnection: CustomStringConvertible { + public enum PhoneConnection: /*CustomStringConvertible,*/ ApiSerializeableObject { case phoneConnectionNotReady case phoneConnection(server: String, port: Int32, streamId: Int64) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .phoneConnectionNotReady: @@ -11853,21 +9902,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .phoneConnectionNotReady: - return "(phoneConnectionNotReady)" - case .phoneConnection(let server, let port, let streamId): - return "(phoneConnection server: \(server), port: \(port), streamId: \(streamId))" - } - } - } } - public enum AccountDaysTTL: CustomStringConvertible { + public enum AccountDaysTTL: /*CustomStringConvertible,*/ ApiSerializeableObject { case accountDaysTTL(days: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .accountDaysTTL(let days): @@ -11892,20 +9930,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .accountDaysTTL(let days): - return "(accountDaysTTL days: \(days))" - } - } - } } - public enum Scheme: CustomStringConvertible { + public enum Scheme: /*CustomStringConvertible,*/ ApiSerializeableObject { case scheme(schemeRaw: String, types: [Api.SchemeType], methods: [Api.SchemeMethod], version: Int32) case schemeNotModified - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .scheme(let schemeRaw, let types, let methods, let version): @@ -11963,23 +9992,12 @@ public struct Api { return Api.Scheme.schemeNotModified } - public var description: String { - get { - switch self { - case .scheme(let schemeRaw, let types, let methods, let version): - return "(scheme schemeRaw: \(schemeRaw), types: \(types), methods: \(methods), version: \(version))" - case .schemeNotModified: - return "(schemeNotModified)" - } - } - } } - public enum InputBotInlineResult: CustomStringConvertible { + public enum InputBotInlineResult: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputBotInlineResult(flags: Int32, id: String, type: String, title: String?, description: String?, url: String?, thumbUrl: String?, contentUrl: String?, contentType: String?, w: Int32?, h: Int32?, duration: Int32?, sendMessage: Api.InputBotInlineMessage) case inputBotInlineResultPhoto(id: String, type: String, photo: Api.InputPhoto, sendMessage: Api.InputBotInlineMessage) case inputBotInlineResultDocument(flags: Int32, id: String, type: String, title: String?, description: String?, document: Api.InputDocument, sendMessage: Api.InputBotInlineMessage) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputBotInlineResult(let flags, let id, let type, let title, let description, let url, let thumbUrl, let contentUrl, let contentType, let w, let h, let duration, let sendMessage): @@ -12132,28 +10150,15 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputBotInlineResult(let flags, let id, let type, let title, let description, let url, let thumbUrl, let contentUrl, let contentType, let w, let h, let duration, let sendMessage): - return "(inputBotInlineResult flags: \(flags), id: \(id), type: \(type), title: \(title), description: \(description), url: \(url), thumbUrl: \(thumbUrl), contentUrl: \(contentUrl), contentType: \(contentType), w: \(w), h: \(h), duration: \(duration), sendMessage: \(sendMessage))" - case .inputBotInlineResultPhoto(let id, let type, let photo, let sendMessage): - return "(inputBotInlineResultPhoto id: \(id), type: \(type), photo: \(photo), sendMessage: \(sendMessage))" - case .inputBotInlineResultDocument(let flags, let id, let type, let title, let description, let document, let sendMessage): - return "(inputBotInlineResultDocument flags: \(flags), id: \(id), type: \(type), title: \(title), description: \(description), document: \(document), sendMessage: \(sendMessage))" - } - } - } } - public enum PrivacyRule: CustomStringConvertible { + public enum PrivacyRule: /*CustomStringConvertible,*/ ApiSerializeableObject { case privacyValueAllowContacts case privacyValueAllowAll case privacyValueAllowUsers(users: [Int32]) case privacyValueDisallowContacts case privacyValueDisallowAll case privacyValueDisallowUsers(users: [Int32]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .privacyValueAllowContacts: @@ -12243,27 +10248,9 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .privacyValueAllowContacts: - return "(privacyValueAllowContacts)" - case .privacyValueAllowAll: - return "(privacyValueAllowAll)" - case .privacyValueAllowUsers(let users): - return "(privacyValueAllowUsers users: \(users))" - case .privacyValueDisallowContacts: - return "(privacyValueDisallowContacts)" - case .privacyValueDisallowAll: - return "(privacyValueDisallowAll)" - case .privacyValueDisallowUsers(let users): - return "(privacyValueDisallowUsers users: \(users))" - } - } - } } - public enum MessageAction: CustomStringConvertible { + public enum MessageAction: /*CustomStringConvertible,*/ ApiSerializeableObject { case messageActionEmpty case messageActionChatCreate(title: String, users: [Int32]) case messageActionChatEditTitle(title: String) @@ -12277,7 +10264,6 @@ public struct Api { case messageActionChatAddUser(users: [Int32]) case messageActionPinMessage case messageActionHistoryClear - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .messageActionEmpty: @@ -12496,44 +10482,11 @@ public struct Api { return Api.MessageAction.messageActionHistoryClear } - public var description: String { - get { - switch self { - case .messageActionEmpty: - return "(messageActionEmpty)" - case .messageActionChatCreate(let title, let users): - return "(messageActionChatCreate title: \(title), users: \(users))" - case .messageActionChatEditTitle(let title): - return "(messageActionChatEditTitle title: \(title))" - case .messageActionChatEditPhoto(let photo): - return "(messageActionChatEditPhoto photo: \(photo))" - case .messageActionChatDeletePhoto: - return "(messageActionChatDeletePhoto)" - case .messageActionChatDeleteUser(let userId): - return "(messageActionChatDeleteUser userId: \(userId))" - case .messageActionChatJoinedByLink(let inviterId): - return "(messageActionChatJoinedByLink inviterId: \(inviterId))" - case .messageActionChannelCreate(let title): - return "(messageActionChannelCreate title: \(title))" - case .messageActionChatMigrateTo(let channelId): - return "(messageActionChatMigrateTo channelId: \(channelId))" - case .messageActionChannelMigrateFrom(let title, let chatId): - return "(messageActionChannelMigrateFrom title: \(title), chatId: \(chatId))" - case .messageActionChatAddUser(let users): - return "(messageActionChatAddUser users: \(users))" - case .messageActionPinMessage: - return "(messageActionPinMessage)" - case .messageActionHistoryClear: - return "(messageActionHistoryClear)" - } - } - } } - public enum PhoneCall: CustomStringConvertible { + public enum PhoneCall: /*CustomStringConvertible,*/ ApiSerializeableObject { case phoneCallEmpty(id: Int64) case phoneCall(id: Int64, accessHash: Int64, date: Int32, userId: Int32, calleeId: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .phoneCallEmpty(let id): @@ -12591,22 +10544,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .phoneCallEmpty(let id): - return "(phoneCallEmpty id: \(id))" - case .phoneCall(let id, let accessHash, let date, let userId, let calleeId): - return "(phoneCall id: \(id), accessHash: \(accessHash), date: \(date), userId: \(userId), calleeId: \(calleeId))" - } - } - } } - public enum PeerNotifyEvents: CustomStringConvertible { + public enum PeerNotifyEvents: /*CustomStringConvertible,*/ ApiSerializeableObject { case peerNotifyEventsEmpty case peerNotifyEventsAll - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .peerNotifyEventsEmpty: @@ -12632,24 +10574,13 @@ public struct Api { return Api.PeerNotifyEvents.peerNotifyEventsAll } - public var description: String { - get { - switch self { - case .peerNotifyEventsEmpty: - return "(peerNotifyEventsEmpty)" - case .peerNotifyEventsAll: - return "(peerNotifyEventsAll)" - } - } - } } - public enum ContactLink: CustomStringConvertible { + public enum ContactLink: /*CustomStringConvertible,*/ ApiSerializeableObject { case contactLinkUnknown case contactLinkNone case contactLinkHasPhone case contactLinkContact - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .contactLinkUnknown: @@ -12693,26 +10624,11 @@ public struct Api { return Api.ContactLink.contactLinkContact } - public var description: String { - get { - switch self { - case .contactLinkUnknown: - return "(contactLinkUnknown)" - case .contactLinkNone: - return "(contactLinkNone)" - case .contactLinkHasPhone: - return "(contactLinkHasPhone)" - case .contactLinkContact: - return "(contactLinkContact)" - } - } - } } - public enum PeerNotifySettings: CustomStringConvertible { + public enum PeerNotifySettings: /*CustomStringConvertible,*/ ApiSerializeableObject { case peerNotifySettingsEmpty case peerNotifySettings(flags: Int32, muteUntil: Int32, sound: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .peerNotifySettingsEmpty: @@ -12754,21 +10670,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .peerNotifySettingsEmpty: - return "(peerNotifySettingsEmpty)" - case .peerNotifySettings(let flags, let muteUntil, let sound): - return "(peerNotifySettings flags: \(flags), muteUntil: \(muteUntil), sound: \(sound))" - } - } - } } - public enum InputBotInlineMessageID: CustomStringConvertible { + public enum InputBotInlineMessageID: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputBotInlineMessageID(dcId: Int32, id: Int64, accessHash: Int64) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputBotInlineMessageID(let dcId, let id, let accessHash): @@ -12801,19 +10706,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputBotInlineMessageID(let dcId, let id, let accessHash): - return "(inputBotInlineMessageID dcId: \(dcId), id: \(id), accessHash: \(accessHash))" - } - } - } } - public enum SchemeParam: CustomStringConvertible { + public enum SchemeParam: /*CustomStringConvertible,*/ ApiSerializeableObject { case schemeParam(name: String, type: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .schemeParam(let name, let type): @@ -12842,19 +10738,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .schemeParam(let name, let type): - return "(schemeParam name: \(name), type: \(type))" - } - } - } } - public enum StickerPack: CustomStringConvertible { + public enum StickerPack: /*CustomStringConvertible,*/ ApiSerializeableObject { case stickerPack(emoticon: String, documents: [Int64]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .stickerPack(let emoticon, let documents): @@ -12889,20 +10776,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .stickerPack(let emoticon, let documents): - return "(stickerPack emoticon: \(emoticon), documents: \(documents))" - } - } - } } - public enum UserProfilePhoto: CustomStringConvertible { + public enum UserProfilePhoto: /*CustomStringConvertible,*/ ApiSerializeableObject { case userProfilePhotoEmpty case userProfilePhoto(photoId: Int64, photoSmall: Api.FileLocation, photoBig: Api.FileLocation) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .userProfilePhotoEmpty: @@ -12948,19 +10826,9 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .userProfilePhotoEmpty: - return "(userProfilePhotoEmpty)" - case .userProfilePhoto(let photoId, let photoSmall, let photoBig): - return "(userProfilePhoto photoId: \(photoId), photoSmall: \(photoSmall), photoBig: \(photoBig))" - } - } - } } - public enum MessageEntity: CustomStringConvertible { + public enum MessageEntity: /*CustomStringConvertible,*/ ApiSerializeableObject { case messageEntityUnknown(offset: Int32, length: Int32) case messageEntityMention(offset: Int32, length: Int32) case messageEntityHashtag(offset: Int32, length: Int32) @@ -12974,7 +10842,6 @@ public struct Api { case messageEntityTextUrl(offset: Int32, length: Int32, url: String) case messageEntityMentionName(offset: Int32, length: Int32, userId: Int32) case inputMessageEntityMentionName(offset: Int32, length: Int32, userId: Api.InputUser) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .messageEntityUnknown(let offset, let length): @@ -13273,44 +11140,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .messageEntityUnknown(let offset, let length): - return "(messageEntityUnknown offset: \(offset), length: \(length))" - case .messageEntityMention(let offset, let length): - return "(messageEntityMention offset: \(offset), length: \(length))" - case .messageEntityHashtag(let offset, let length): - return "(messageEntityHashtag offset: \(offset), length: \(length))" - case .messageEntityBotCommand(let offset, let length): - return "(messageEntityBotCommand offset: \(offset), length: \(length))" - case .messageEntityUrl(let offset, let length): - return "(messageEntityUrl offset: \(offset), length: \(length))" - case .messageEntityEmail(let offset, let length): - return "(messageEntityEmail offset: \(offset), length: \(length))" - case .messageEntityBold(let offset, let length): - return "(messageEntityBold offset: \(offset), length: \(length))" - case .messageEntityItalic(let offset, let length): - return "(messageEntityItalic offset: \(offset), length: \(length))" - case .messageEntityCode(let offset, let length): - return "(messageEntityCode offset: \(offset), length: \(length))" - case .messageEntityPre(let offset, let length, let language): - return "(messageEntityPre offset: \(offset), length: \(length), language: \(language))" - case .messageEntityTextUrl(let offset, let length, let url): - return "(messageEntityTextUrl offset: \(offset), length: \(length), url: \(url))" - case .messageEntityMentionName(let offset, let length, let userId): - return "(messageEntityMentionName offset: \(offset), length: \(length), userId: \(userId))" - case .inputMessageEntityMentionName(let offset, let length, let userId): - return "(inputMessageEntityMentionName offset: \(offset), length: \(length), userId: \(userId))" - } - } - } } - public enum InputPhoto: CustomStringConvertible { + public enum InputPhoto: /*CustomStringConvertible,*/ ApiSerializeableObject { case inputPhotoEmpty case inputPhoto(id: Int64, accessHash: Int64) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inputPhotoEmpty: @@ -13348,25 +11182,14 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inputPhotoEmpty: - return "(inputPhotoEmpty)" - case .inputPhoto(let id, let accessHash): - return "(inputPhoto id: \(id), accessHash: \(accessHash))" - } - } - } } - public enum EncryptedChat: CustomStringConvertible { + public enum EncryptedChat: /*CustomStringConvertible,*/ ApiSerializeableObject { case encryptedChatEmpty(id: Int32) case encryptedChatWaiting(id: Int32, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32) case encryptedChatDiscarded(id: Int32) case encryptedChatRequested(id: Int32, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32, gA: Buffer) case encryptedChat(id: Int32, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32, gAOrB: Buffer, keyFingerprint: Int64) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .encryptedChatEmpty(let id): @@ -13519,28 +11342,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .encryptedChatEmpty(let id): - return "(encryptedChatEmpty id: \(id))" - case .encryptedChatWaiting(let id, let accessHash, let date, let adminId, let participantId): - return "(encryptedChatWaiting id: \(id), accessHash: \(accessHash), date: \(date), adminId: \(adminId), participantId: \(participantId))" - case .encryptedChatDiscarded(let id): - return "(encryptedChatDiscarded id: \(id))" - case .encryptedChatRequested(let id, let accessHash, let date, let adminId, let participantId, let gA): - return "(encryptedChatRequested id: \(id), accessHash: \(accessHash), date: \(date), adminId: \(adminId), participantId: \(participantId), gA: \(gA))" - case .encryptedChat(let id, let accessHash, let date, let adminId, let participantId, let gAOrB, let keyFingerprint): - return "(encryptedChat id: \(id), accessHash: \(accessHash), date: \(date), adminId: \(adminId), participantId: \(participantId), gAOrB: \(gAOrB), keyFingerprint: \(keyFingerprint))" - } - } - } } - public enum Document: CustomStringConvertible { + public enum Document: /*CustomStringConvertible,*/ ApiSerializeableObject { case documentEmpty(id: Int64) case document(id: Int64, accessHash: Int64, date: Int32, mimeType: String, size: Int32, thumb: Api.PhotoSize, dcId: Int32, attributes: [Api.DocumentAttribute]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .documentEmpty(let id): @@ -13618,21 +11424,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .documentEmpty(let id): - return "(documentEmpty id: \(id))" - case .document(let id, let accessHash, let date, let mimeType, let size, let thumb, let dcId, let attributes): - return "(document id: \(id), accessHash: \(accessHash), date: \(date), mimeType: \(mimeType), size: \(size), thumb: \(thumb), dcId: \(dcId), attributes: \(attributes))" - } - } - } } - public enum ImportedContact: CustomStringConvertible { + public enum ImportedContact: /*CustomStringConvertible,*/ ApiSerializeableObject { case importedContact(userId: Int32, clientId: Int64) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .importedContact(let userId, let clientId): @@ -13661,20 +11456,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .importedContact(let userId, let clientId): - return "(importedContact userId: \(userId), clientId: \(clientId))" - } - } - } } public struct channels { - public enum ChannelParticipants: CustomStringConvertible { + public enum ChannelParticipants: /*CustomStringConvertible,*/ ApiSerializeableObject { case channelParticipants(count: Int32, participants: [Api.ChannelParticipant], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .channelParticipants(let count, let participants, let users): @@ -13719,19 +11505,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .channelParticipants(let count, let participants, let users): - return "(channels.channelParticipants count: \(count), participants: \(participants), users: \(users))" - } - } - } } - public enum ChannelParticipant: CustomStringConvertible { + public enum ChannelParticipant: /*CustomStringConvertible,*/ ApiSerializeableObject { case channelParticipant(participant: Api.ChannelParticipant, users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .channelParticipant(let participant, let users): @@ -13768,21 +11545,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .channelParticipant(let participant, let users): - return "(channels.channelParticipant participant: \(participant), users: \(users))" - } - } - } } } public struct auth { - public enum Authorization: CustomStringConvertible { + public enum Authorization: /*CustomStringConvertible,*/ ApiSerializeableObject { case authorization(user: Api.User) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .authorization(let user): @@ -13809,19 +11577,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .authorization(let user): - return "(auth.authorization user: \(user))" - } - } - } } - public enum PasswordRecovery: CustomStringConvertible { + public enum PasswordRecovery: /*CustomStringConvertible,*/ ApiSerializeableObject { case passwordRecovery(emailPattern: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .passwordRecovery(let emailPattern): @@ -13846,19 +11605,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .passwordRecovery(let emailPattern): - return "(auth.passwordRecovery emailPattern: \(emailPattern))" - } - } - } } - public enum ExportedAuthorization: CustomStringConvertible { + public enum ExportedAuthorization: /*CustomStringConvertible,*/ ApiSerializeableObject { case exportedAuthorization(id: Int32, bytes: Buffer) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .exportedAuthorization(let id, let bytes): @@ -13887,19 +11637,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .exportedAuthorization(let id, let bytes): - return "(auth.exportedAuthorization id: \(id), bytes: \(bytes))" - } - } - } } - public enum CheckedPhone: CustomStringConvertible { + public enum CheckedPhone: /*CustomStringConvertible,*/ ApiSerializeableObject { case checkedPhone(phoneRegistered: Api.Bool) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .checkedPhone(let phoneRegistered): @@ -13926,21 +11667,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .checkedPhone(let phoneRegistered): - return "(auth.checkedPhone phoneRegistered: \(phoneRegistered))" - } - } - } } - public enum SentCode: CustomStringConvertible { + public enum SentCode: /*CustomStringConvertible,*/ ApiSerializeableObject { case sentCodePreview(phoneRegistered: Api.Bool, phoneCodeHash: String, phoneCodeTest: String) case sentPassPhrase(phoneRegistered: Api.Bool) case sentCode(flags: Int32, type: Api.auth.SentCodeType, phoneCodeHash: String, nextType: Api.auth.CodeType?, timeout: Int32?) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .sentCodePreview(let phoneRegistered, let phoneCodeHash, let phoneCodeTest): @@ -14031,25 +11763,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .sentCodePreview(let phoneRegistered, let phoneCodeHash, let phoneCodeTest): - return "(auth.sentCodePreview phoneRegistered: \(phoneRegistered), phoneCodeHash: \(phoneCodeHash), phoneCodeTest: \(phoneCodeTest))" - case .sentPassPhrase(let phoneRegistered): - return "(auth.sentPassPhrase phoneRegistered: \(phoneRegistered))" - case .sentCode(let flags, let type, let phoneCodeHash, let nextType, let timeout): - return "(auth.sentCode flags: \(flags), type: \(type), phoneCodeHash: \(phoneCodeHash), nextType: \(nextType), timeout: \(timeout))" - } - } - } } - public enum CodeType: CustomStringConvertible { + public enum CodeType: /*CustomStringConvertible,*/ ApiSerializeableObject { case codeTypeSms case codeTypeCall case codeTypeFlashCall - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .codeTypeSms: @@ -14084,26 +11803,13 @@ public struct Api { return Api.auth.CodeType.codeTypeFlashCall } - public var description: String { - get { - switch self { - case .codeTypeSms: - return "(auth.codeTypeSms)" - case .codeTypeCall: - return "(auth.codeTypeCall)" - case .codeTypeFlashCall: - return "(auth.codeTypeFlashCall)" - } - } - } } - public enum SentCodeType: CustomStringConvertible { + public enum SentCodeType: /*CustomStringConvertible,*/ ApiSerializeableObject { case sentCodeTypeApp(length: Int32) case sentCodeTypeSms(length: Int32) case sentCodeTypeCall(length: Int32) case sentCodeTypeFlashCall(pattern: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .sentCodeTypeApp(let length): @@ -14179,28 +11885,13 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .sentCodeTypeApp(let length): - return "(auth.sentCodeTypeApp length: \(length))" - case .sentCodeTypeSms(let length): - return "(auth.sentCodeTypeSms length: \(length))" - case .sentCodeTypeCall(let length): - return "(auth.sentCodeTypeCall length: \(length))" - case .sentCodeTypeFlashCall(let pattern): - return "(auth.sentCodeTypeFlashCall pattern: \(pattern))" - } - } - } } } public struct contacts { - public enum Requests: CustomStringConvertible { + public enum Requests: /*CustomStringConvertible,*/ ApiSerializeableObject { case requests(requests: [Api.ContactRequest], users: [Api.User]) case requestsSlice(count: Int32, requests: [Api.ContactRequest], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .requests(let requests, let users): @@ -14278,21 +11969,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .requests(let requests, let users): - return "(contacts.requests requests: \(requests), users: \(users))" - case .requestsSlice(let count, let requests, let users): - return "(contacts.requestsSlice count: \(count), requests: \(requests), users: \(users))" - } - } - } } - public enum SentLink: CustomStringConvertible { + public enum SentLink: /*CustomStringConvertible,*/ ApiSerializeableObject { case sentLink(message: Api.messages.Message, link: Api.contacts.Link) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .sentLink(let message, let link): @@ -14325,20 +12005,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .sentLink(let message, let link): - return "(contacts.sentLink message: \(message), link: \(link))" - } - } - } } - public enum Blocked: CustomStringConvertible { + public enum Blocked: /*CustomStringConvertible,*/ ApiSerializeableObject { case blocked(blocked: [Api.ContactBlocked], users: [Api.User]) case blockedSlice(count: Int32, blocked: [Api.ContactBlocked], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .blocked(let blocked, let users): @@ -14416,22 +12087,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .blocked(let blocked, let users): - return "(contacts.blocked blocked: \(blocked), users: \(users))" - case .blockedSlice(let count, let blocked, let users): - return "(contacts.blockedSlice count: \(count), blocked: \(blocked), users: \(users))" - } - } - } } - public enum Contacts: CustomStringConvertible { + public enum Contacts: /*CustomStringConvertible,*/ ApiSerializeableObject { case contacts(contacts: [Api.Contact], users: [Api.User]) case contactsNotModified - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .contacts(let contacts, let users): @@ -14481,21 +12141,10 @@ public struct Api { return Api.contacts.Contacts.contactsNotModified } - public var description: String { - get { - switch self { - case .contacts(let contacts, let users): - return "(contacts.contacts contacts: \(contacts), users: \(users))" - case .contactsNotModified: - return "(contacts.contactsNotModified)" - } - } - } } - public enum ResolvedPeer: CustomStringConvertible { + public enum ResolvedPeer: /*CustomStringConvertible,*/ ApiSerializeableObject { case resolvedPeer(peer: Api.Peer, chats: [Api.Chat], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .resolvedPeer(let peer, let chats, let users): @@ -14542,21 +12191,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .resolvedPeer(let peer, let chats, let users): - return "(contacts.resolvedPeer peer: \(peer), chats: \(chats), users: \(users))" - } - } - } } - public enum MyLink: CustomStringConvertible { + public enum MyLink: /*CustomStringConvertible,*/ ApiSerializeableObject { case myLinkEmpty case myLinkRequested(contact: Api.Bool) case myLinkContact - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .myLinkEmpty: @@ -14601,25 +12241,12 @@ public struct Api { return Api.contacts.MyLink.myLinkContact } - public var description: String { - get { - switch self { - case .myLinkEmpty: - return "(contacts.myLinkEmpty)" - case .myLinkRequested(let contact): - return "(contacts.myLinkRequested contact: \(contact))" - case .myLinkContact: - return "(contacts.myLinkContact)" - } - } - } } - public enum ForeignLink: CustomStringConvertible { + public enum ForeignLink: /*CustomStringConvertible,*/ ApiSerializeableObject { case foreignLinkUnknown case foreignLinkRequested(hasPhone: Api.Bool) case foreignLinkMutual - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .foreignLinkUnknown: @@ -14664,23 +12291,10 @@ public struct Api { return Api.contacts.ForeignLink.foreignLinkMutual } - public var description: String { - get { - switch self { - case .foreignLinkUnknown: - return "(contacts.foreignLinkUnknown)" - case .foreignLinkRequested(let hasPhone): - return "(contacts.foreignLinkRequested hasPhone: \(hasPhone))" - case .foreignLinkMutual: - return "(contacts.foreignLinkMutual)" - } - } - } } - public enum Link: CustomStringConvertible { + public enum Link: /*CustomStringConvertible,*/ ApiSerializeableObject { case link(myLink: Api.ContactLink, foreignLink: Api.ContactLink, user: Api.User) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .link(let myLink, let foreignLink, let user): @@ -14719,19 +12333,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .link(let myLink, let foreignLink, let user): - return "(contacts.link myLink: \(myLink), foreignLink: \(foreignLink), user: \(user))" - } - } - } } - public enum Located: CustomStringConvertible { + public enum Located: /*CustomStringConvertible,*/ ApiSerializeableObject { case located(results: [Api.ContactLocated], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .located(let results, let users): @@ -14772,19 +12377,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .located(let results, let users): - return "(contacts.located results: \(results), users: \(users))" - } - } - } } - public enum Suggested: CustomStringConvertible { + public enum Suggested: /*CustomStringConvertible,*/ ApiSerializeableObject { case suggested(results: [Api.ContactSuggested], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .suggested(let results, let users): @@ -14825,19 +12421,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .suggested(let results, let users): - return "(contacts.suggested results: \(results), users: \(users))" - } - } - } } - public enum ImportedContacts: CustomStringConvertible { + public enum ImportedContacts: /*CustomStringConvertible,*/ ApiSerializeableObject { case importedContacts(imported: [Api.ImportedContact], retryContacts: [Int64], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .importedContacts(let imported, let retryContacts, let users): @@ -14888,19 +12475,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .importedContacts(let imported, let retryContacts, let users): - return "(contacts.importedContacts imported: \(imported), retryContacts: \(retryContacts), users: \(users))" - } - } - } } - public enum Found: CustomStringConvertible { + public enum Found: /*CustomStringConvertible,*/ ApiSerializeableObject { case found(results: [Api.Peer], chats: [Api.Chat], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .found(let results, let chats, let users): @@ -14951,20 +12529,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .found(let results, let chats, let users): - return "(contacts.found results: \(results), chats: \(chats), users: \(users))" - } - } - } } - public enum TopPeers: CustomStringConvertible { + public enum TopPeers: /*CustomStringConvertible,*/ ApiSerializeableObject { case topPeersNotModified case topPeers(categories: [Api.TopPeerCategoryPeers], chats: [Api.Chat], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .topPeersNotModified: @@ -15024,24 +12593,13 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .topPeersNotModified: - return "(contacts.topPeersNotModified)" - case .topPeers(let categories, let chats, let users): - return "(contacts.topPeers categories: \(categories), chats: \(chats), users: \(users))" - } - } - } } } public struct help { - public enum AppUpdate: CustomStringConvertible { + public enum AppUpdate: /*CustomStringConvertible,*/ ApiSerializeableObject { case appUpdate(id: Int32, critical: Api.Bool, url: String, text: String) case noAppUpdate - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .appUpdate(let id, let critical, let url, let text): @@ -15089,22 +12647,11 @@ public struct Api { return Api.help.AppUpdate.noAppUpdate } - public var description: String { - get { - switch self { - case .appUpdate(let id, let critical, let url, let text): - return "(help.appUpdate id: \(id), critical: \(critical), url: \(url), text: \(text))" - case .noAppUpdate: - return "(help.noAppUpdate)" - } - } - } } - public enum AppChangelog: CustomStringConvertible { + public enum AppChangelog: /*CustomStringConvertible,*/ ApiSerializeableObject { case appChangelogEmpty case appChangelog(text: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .appChangelogEmpty: @@ -15138,21 +12685,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .appChangelogEmpty: - return "(help.appChangelogEmpty)" - case .appChangelog(let text): - return "(help.appChangelog text: \(text))" - } - } - } } - public enum Support: CustomStringConvertible { + public enum Support: /*CustomStringConvertible,*/ ApiSerializeableObject { case support(phoneNumber: String, user: Api.User) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .support(let phoneNumber, let user): @@ -15183,19 +12719,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .support(let phoneNumber, let user): - return "(help.support phoneNumber: \(phoneNumber), user: \(user))" - } - } - } } - public enum InviteText: CustomStringConvertible { + public enum InviteText: /*CustomStringConvertible,*/ ApiSerializeableObject { case inviteText(message: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .inviteText(let message): @@ -15220,19 +12747,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .inviteText(let message): - return "(help.inviteText message: \(message))" - } - } - } } - public enum AppPrefs: CustomStringConvertible { + public enum AppPrefs: /*CustomStringConvertible,*/ ApiSerializeableObject { case appPrefs(bytes: Buffer) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .appPrefs(let bytes): @@ -15257,23 +12775,14 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .appPrefs(let bytes): - return "(help.appPrefs bytes: \(bytes))" - } - } - } } } public struct updates { - public enum Difference: CustomStringConvertible { + public enum Difference: /*CustomStringConvertible,*/ ApiSerializeableObject { case differenceEmpty(date: Int32, seq: Int32) case difference(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], state: Api.updates.State) case differenceSlice(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], intermediateState: Api.updates.State) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .differenceEmpty(let date, let seq): @@ -15440,23 +12949,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .differenceEmpty(let date, let seq): - return "(updates.differenceEmpty date: \(date), seq: \(seq))" - case .difference(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let state): - return "(updates.difference newMessages: \(newMessages), newEncryptedMessages: \(newEncryptedMessages), otherUpdates: \(otherUpdates), chats: \(chats), users: \(users), state: \(state))" - case .differenceSlice(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let intermediateState): - return "(updates.differenceSlice newMessages: \(newMessages), newEncryptedMessages: \(newEncryptedMessages), otherUpdates: \(otherUpdates), chats: \(chats), users: \(users), intermediateState: \(intermediateState))" - } - } - } } - public enum State: CustomStringConvertible { + public enum State: /*CustomStringConvertible,*/ ApiSerializeableObject { case state(pts: Int32, qts: Int32, date: Int32, seq: Int32, unreadCount: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .state(let pts, let qts, let date, let seq, let unreadCount): @@ -15497,21 +12993,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .state(let pts, let qts, let date, let seq, let unreadCount): - return "(updates.state pts: \(pts), qts: \(qts), date: \(date), seq: \(seq), unreadCount: \(unreadCount))" - } - } - } } - public enum ChannelDifference: CustomStringConvertible { + public enum ChannelDifference: /*CustomStringConvertible,*/ ApiSerializeableObject { case channelDifferenceEmpty(flags: Int32, pts: Int32, timeout: Int32?) case channelDifference(flags: Int32, pts: Int32, timeout: Int32?, newMessages: [Api.Message], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User]) case channelDifferenceTooLong(flags: Int32, pts: Int32, timeout: Int32?, topMessage: Int32, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, messages: [Api.Message], chats: [Api.Chat], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .channelDifferenceEmpty(let flags, let pts, let timeout): @@ -15680,25 +13167,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .channelDifferenceEmpty(let flags, let pts, let timeout): - return "(updates.channelDifferenceEmpty flags: \(flags), pts: \(pts), timeout: \(timeout))" - case .channelDifference(let flags, let pts, let timeout, let newMessages, let otherUpdates, let chats, let users): - return "(updates.channelDifference flags: \(flags), pts: \(pts), timeout: \(timeout), newMessages: \(newMessages), otherUpdates: \(otherUpdates), chats: \(chats), users: \(users))" - case .channelDifferenceTooLong(let flags, let pts, let timeout, let topMessage, let readInboxMaxId, let readOutboxMaxId, let unreadCount, let messages, let chats, let users): - return "(updates.channelDifferenceTooLong flags: \(flags), pts: \(pts), timeout: \(timeout), topMessage: \(topMessage), readInboxMaxId: \(readInboxMaxId), readOutboxMaxId: \(readOutboxMaxId), unreadCount: \(unreadCount), messages: \(messages), chats: \(chats), users: \(users))" - } - } - } } } public struct upload { - public enum File: CustomStringConvertible { + public enum File: /*CustomStringConvertible,*/ ApiSerializeableObject { case file(type: Api.storage.FileType, mtime: Int32, bytes: Buffer) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .file(let type, let mtime, let bytes): @@ -15733,19 +13207,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .file(let type, let mtime, let bytes): - return "(upload.file type: \(type), mtime: \(mtime), bytes: \(bytes))" - } - } - } } } public struct storage { - public enum FileType: CustomStringConvertible { + public enum FileType: /*CustomStringConvertible,*/ ApiSerializeableObject { case fileUnknown case fileJpeg case fileGif @@ -15756,7 +13222,6 @@ public struct Api { case filePartial case fileMp4 case fileWebp - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .fileUnknown: @@ -15854,39 +13319,12 @@ public struct Api { return Api.storage.FileType.fileWebp } - public var description: String { - get { - switch self { - case .fileUnknown: - return "(storage.fileUnknown)" - case .fileJpeg: - return "(storage.fileJpeg)" - case .fileGif: - return "(storage.fileGif)" - case .filePng: - return "(storage.filePng)" - case .filePdf: - return "(storage.filePdf)" - case .fileMp3: - return "(storage.fileMp3)" - case .fileMov: - return "(storage.fileMov)" - case .filePartial: - return "(storage.filePartial)" - case .fileMp4: - return "(storage.fileMp4)" - case .fileWebp: - return "(storage.fileWebp)" - } - } - } } } public struct account { - public enum PasswordSettings: CustomStringConvertible { + public enum PasswordSettings: /*CustomStringConvertible,*/ ApiSerializeableObject { case passwordSettings(email: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .passwordSettings(let email): @@ -15911,19 +13349,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .passwordSettings(let email): - return "(account.passwordSettings email: \(email))" - } - } - } } - public enum PasswordInputSettings: CustomStringConvertible { + public enum PasswordInputSettings: /*CustomStringConvertible,*/ ApiSerializeableObject { case passwordInputSettings(flags: Int32, newSalt: Buffer?, newPasswordHash: Buffer?, hint: String?, email: String?) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .passwordInputSettings(let flags, let newSalt, let newPasswordHash, let hint, let email): @@ -15964,19 +13393,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .passwordInputSettings(let flags, let newSalt, let newPasswordHash, let hint, let email): - return "(account.passwordInputSettings flags: \(flags), newSalt: \(newSalt), newPasswordHash: \(newPasswordHash), hint: \(hint), email: \(email))" - } - } - } } - public enum Authorizations: CustomStringConvertible { + public enum Authorizations: /*CustomStringConvertible,*/ ApiSerializeableObject { case authorizations(authorizations: [Api.Authorization]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .authorizations(let authorizations): @@ -16007,20 +13427,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .authorizations(let authorizations): - return "(account.authorizations authorizations: \(authorizations))" - } - } - } } - public enum Password: CustomStringConvertible { + public enum Password: /*CustomStringConvertible,*/ ApiSerializeableObject { case noPassword(newSalt: Buffer, emailUnconfirmedPattern: String) case password(currentSalt: Buffer, newSalt: Buffer, hint: String, hasRecovery: Api.Bool, emailUnconfirmedPattern: String) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .noPassword(let newSalt, let emailUnconfirmedPattern): @@ -16084,21 +13495,10 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .noPassword(let newSalt, let emailUnconfirmedPattern): - return "(account.noPassword newSalt: \(newSalt), emailUnconfirmedPattern: \(emailUnconfirmedPattern))" - case .password(let currentSalt, let newSalt, let hint, let hasRecovery, let emailUnconfirmedPattern): - return "(account.password currentSalt: \(currentSalt), newSalt: \(newSalt), hint: \(hint), hasRecovery: \(hasRecovery), emailUnconfirmedPattern: \(emailUnconfirmedPattern))" - } - } - } } - public enum PrivacyRules: CustomStringConvertible { + public enum PrivacyRules: /*CustomStringConvertible,*/ ApiSerializeableObject { case privacyRules(rules: [Api.PrivacyRule], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .privacyRules(let rules, let users): @@ -16139,21 +13539,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .privacyRules(let rules, let users): - return "(account.privacyRules rules: \(rules), users: \(users))" - } - } - } } } public struct photos { - public enum Photo: CustomStringConvertible { + public enum Photo: /*CustomStringConvertible,*/ ApiSerializeableObject { case photo(photo: Api.Photo, users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .photo(let photo, let users): @@ -16190,20 +13581,11 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .photo(let photo, let users): - return "(photos.photo photo: \(photo), users: \(users))" - } - } - } } - public enum Photos: CustomStringConvertible { + public enum Photos: /*CustomStringConvertible,*/ ApiSerializeableObject { case photos(photos: [Api.Photo], users: [Api.User]) case photosSlice(count: Int32, photos: [Api.Photo], users: [Api.User]) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .photos(let photos, let users): @@ -16281,23 +13663,12 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .photos(let photos, let users): - return "(photos.photos photos: \(photos), users: \(users))" - case .photosSlice(let count, let photos, let users): - return "(photos.photosSlice count: \(count), photos: \(photos), users: \(users))" - } - } - } } } public struct phone { - public enum DhConfig: CustomStringConvertible { + public enum DhConfig: /*CustomStringConvertible,*/ ApiSerializeableObject { case dhConfig(g: Int32, p: String, ringTimeout: Int32, expires: Int32) - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) -> Swift.Bool { switch self { case .dhConfig(let g, let p, let ringTimeout, let expires): @@ -16334,14 +13705,6 @@ public struct Api { } } - public var description: String { - get { - switch self { - case .dhConfig(let g, let p, let ringTimeout, let expires): - return "(phone.dhConfig g: \(g), p: \(p), ringTimeout: \(ringTimeout), expires: \(expires))" - } - } - } } } diff --git a/TelegramCore/ApiGroupOrChannel.swift b/TelegramCore/ApiGroupOrChannel.swift new file mode 100644 index 0000000000..b12c4fc944 --- /dev/null +++ b/TelegramCore/ApiGroupOrChannel.swift @@ -0,0 +1,126 @@ +import Foundation +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif + +private func imageRepresentationsForApiChatPhoto(_ photo: Api.ChatPhoto) -> [TelegramMediaImageRepresentation] { + var telegramPhoto: [TelegramMediaImageRepresentation] = [] + switch photo { + case let .chatPhoto(photoSmall, photoBig): + if let smallLocation = telegramMediaLocationFromApiLocation(photoSmall), let largeLocation = telegramMediaLocationFromApiLocation(photoBig) { + telegramPhoto.append(TelegramMediaImageRepresentation(dimensions: CGSize(width: 80.0, height: 80.0), location: smallLocation, size: nil)) + telegramPhoto.append(TelegramMediaImageRepresentation(dimensions: CGSize(width: 640.0, height: 640.0), location: largeLocation, size: nil)) + } + case .chatPhotoEmpty: + break + } + return telegramPhoto +} + +func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? { + switch chat { + case let .chat(flags, id, title, photo, participantsCount, date, version, migratedTo): + let left = (flags & (1 | 2)) != 0 + return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: id), title: title, photo: imageRepresentationsForApiChatPhoto(photo), participantCount: Int(participantsCount), membership: left ? .Left : .Member, version: Int(version)) + case let .chatEmpty(id): + TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: id), title: "", photo: [], participantCount: 0, membership: .Removed, version: 0) + case let .chatForbidden(id, title): + TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: id), title: title, photo: [], participantCount: 0, membership: .Removed, version: 0) + case let .channel(flags, id, accessHash, title, username, photo, date, version, restrictionReason): + let participationStatus: TelegramChannelParticipationStatus + if (flags & Int32(1 << 1)) != 0 { + participationStatus = .kicked + } else if (flags & Int32(1 << 2)) != 0 { + participationStatus = .left + } else { + participationStatus = .member + } + + let role: TelegramChannelRole + if (flags & Int32(1 << 0)) != 0 { + role = .creator + } else if (flags & Int32(1 << 3)) != 0 { + role = .editor + } else if (flags & Int32(1 << 4)) != 0 { + role = .moderator + } else { + role = .member + } + + let info: TelegramChannelInfo + if (flags & Int32(1 << 8)) != 0 { + var infoFlags = TelegramChannelGroupFlags() + if (flags & Int32(1 << 10)) != 0 { + infoFlags.insert(.everyMemberCanInviteMembers) + } + info = .group(TelegramChannelGroupInfo(flags: infoFlags)) + } else { + var infoFlags = TelegramChannelBroadcastFlags() + if (flags & Int32(1 << 11)) != 0 { + infoFlags.insert(.messagesShouldHaveSignatures) + } + info = .broadcast(TelegramChannelBroadcastInfo(flags: [])) + } + + var channelFlags = TelegramChannelFlags() + if (flags & Int32(1 << 7)) != 0 { + channelFlags.insert(.verified) + } + + let restrictionInfo: PeerAccessRestrictionInfo? + if let restrictionReason = restrictionReason { + restrictionInfo = PeerAccessRestrictionInfo(reason: restrictionReason) + } else { + restrictionInfo = nil + } + + return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: id), accessHash: accessHash, title: title, username: username, photo: imageRepresentationsForApiChatPhoto(photo), creationDate: date, version: version, participationStatus: participationStatus, role: role, info: info, flags: channelFlags, restrictionInfo: restrictionInfo) + case let .channelForbidden(flags, id, accessHash, title): + let info: TelegramChannelInfo + if (flags & Int32(1 << 8)) != 0 { + var infoFlags = TelegramChannelGroupFlags() + info = .group(TelegramChannelGroupInfo(flags: infoFlags)) + } else { + var infoFlags = TelegramChannelBroadcastFlags() + info = .broadcast(TelegramChannelBroadcastInfo(flags: [])) + } + + return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: id), accessHash: accessHash, title: title, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .kicked, role: .member, info: info, flags: TelegramChannelFlags(), restrictionInfo: nil) + } + + return nil +} + +func mergeGroupOrChannel(lhs: Peer?, rhs: Api.Chat) -> Peer? { + switch rhs { + case .chat, .chatEmpty, .chatForbidden, .channelForbidden: + return parseTelegramGroupOrChannel(chat: rhs) + case let .channel(flags, id, accessHash, title, username, photo, date, version, restrictionReason): + if let _ = accessHash { + return parseTelegramGroupOrChannel(chat: rhs) + } else if let lhs = lhs as? TelegramChannel { + var channelFlags = lhs.flags + if (flags & Int32(1 << 7)) != 0 { + channelFlags.insert(.verified) + } else { + let _ = channelFlags.remove(.verified) + } + var info = lhs.info + switch info { + case .broadcast: + break + case let .group(groupInfo): + var infoFlags = TelegramChannelGroupFlags() + if (flags & Int32(1 << 10)) != 0 { + infoFlags.insert(.everyMemberCanInviteMembers) + } + info = .group(TelegramChannelGroupInfo(flags: infoFlags)) + } + return TelegramChannel(id: lhs.id, accessHash: lhs.accessHash, title: title, username: username, photo: imageRepresentationsForApiChatPhoto(photo), creationDate: lhs.creationDate, version: lhs.version, participationStatus: lhs.participationStatus, role: lhs.role, info: info, flags: channelFlags, restrictionInfo: lhs.restrictionInfo) + } else { + return nil + } + } +} diff --git a/TelegramCore/ApiUtils.swift b/TelegramCore/ApiUtils.swift index 558bc6357d..74c62b49d8 100644 --- a/TelegramCore/ApiUtils.swift +++ b/TelegramCore/ApiUtils.swift @@ -1,15 +1,19 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif func apiInputPeer(_ peer: Peer) -> Api.InputPeer? { switch peer { case let user as TelegramUser where user.accessHash != nil: return Api.InputPeer.inputPeerUser(userId: user.id.id, accessHash: user.accessHash!) case let group as TelegramGroup: - if group.id.namespace == Namespaces.Peer.CloudGroup { - return Api.InputPeer.inputPeerChat(chatId: group.id.id) - } else if group.id.namespace == Namespaces.Peer.CloudChannel { - return Api.InputPeer.inputPeerChannel(channelId: group.id.id, accessHash: group.accessHash) + return Api.InputPeer.inputPeerChat(chatId: group.id.id) + case let channel as TelegramChannel: + if let accessHash = channel.accessHash { + return Api.InputPeer.inputPeerChannel(channelId: channel.id.id, accessHash: accessHash) } else { return nil } @@ -19,8 +23,8 @@ func apiInputPeer(_ peer: Peer) -> Api.InputPeer? { } func apiInputChannel(_ peer: Peer) -> Api.InputChannel? { - if let channel = peer as? TelegramGroup, channel.accessHash != 0 { - return Api.InputChannel.inputChannel(channelId: channel.id.id, accessHash: channel.accessHash) + if let channel = peer as? TelegramChannel, let accessHash = channel.accessHash { + return Api.InputChannel.inputChannel(channelId: channel.id.id, accessHash: accessHash) } else { return nil } diff --git a/TelegramCore/ChannelState.swift b/TelegramCore/ChannelState.swift index d712629648..9e87e39d16 100644 --- a/TelegramCore/ChannelState.swift +++ b/TelegramCore/ChannelState.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif final class ChannelState: PeerChatState, Equatable, CustomStringConvertible { let pts: Int32 diff --git a/TelegramCore/CloudFileMediaResource.swift b/TelegramCore/CloudFileMediaResource.swift index 2d9bff2507..3769d3c71d 100644 --- a/TelegramCore/CloudFileMediaResource.swift +++ b/TelegramCore/CloudFileMediaResource.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public class CloudFileMediaResource: MediaResource { public var id: String { diff --git a/TelegramCore/ContactManagement.swift b/TelegramCore/ContactManagement.swift index 42399abf67..894643c05b 100644 --- a/TelegramCore/ContactManagement.swift +++ b/TelegramCore/ContactManagement.swift @@ -1,6 +1,11 @@ import Foundation -import SwiftSignalKit -import Postbox +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac +#else + import Postbox + import SwiftSignalKit +#endif import TelegramCorePrivateModule private func md5(_ data : Data) -> Data { diff --git a/TelegramCore/Download.swift b/TelegramCore/Download.swift index cf18b53831..c6ca21ea94 100644 --- a/TelegramCore/Download.swift +++ b/TelegramCore/Download.swift @@ -1,6 +1,13 @@ import Foundation -import SwiftSignalKit -import MtProtoKit +#if os(macOS) + import PostboxMac + import MtProtoKitMac + import SwiftSignalKitMac +#else + import Postbox + import MtProtoKitDynamic + import SwiftSignalKit +#endif class Download { let datacenterId: Int diff --git a/TelegramCore/DownloadFromCloudLocation.swift b/TelegramCore/DownloadFromCloudLocation.swift index dfd87aba43..793958681f 100644 --- a/TelegramCore/DownloadFromCloudLocation.swift +++ b/TelegramCore/DownloadFromCloudLocation.swift @@ -1,7 +1,14 @@ import Foundation -import Postbox -import SwiftSignalKit -import MtProtoKit + +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac + import MtProtoKitMac +#else + import Postbox + import SwiftSignalKit + import MtProtoKitDynamic +#endif public func multipartDownloadFromCloudLocation(account: Account, location: TelegramCloudMediaLocation, size: Int?, data: Data? = nil, offset: Int = 0) -> Signal { return account.network.download(datacenterId: location.datacenterId) diff --git a/TelegramCore/EnqueueMessage.swift b/TelegramCore/EnqueueMessage.swift index 61b1875b94..d2dbfea7ff 100644 --- a/TelegramCore/EnqueueMessage.swift +++ b/TelegramCore/EnqueueMessage.swift @@ -1,9 +1,19 @@ import Foundation -import SwiftSignalKit -import Postbox +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac +#else + import Postbox + import SwiftSignalKit +#endif -public func enqueueMessage(account: Account, peerId: PeerId, text: String) -> Signal { +public func enqueueMessage(account: Account, peerId: PeerId, text: String, replyMessageId: MessageId?) -> Signal { return account.postbox.modify { modifier -> Void in - modifier.addMessages([StoreMessage(peerId: peerId, namespace: Namespaces.Message.Local, timestamp: Int32(account.network.context.globalTime()), flags: [.Unsent], tags: [], forwardInfo: nil, authorId: account.peerId, text: text, attributes: [], media: [])], location: .Random) + var attributes: [MessageAttribute] = [] + if let replyMessageId = replyMessageId { + attributes.append(ReplyMessageAttribute(messageId: replyMessageId)) + } + + modifier.addMessages([StoreMessage(peerId: peerId, namespace: Namespaces.Message.Local, timestamp: Int32(account.network.context.globalTime()), flags: [.Unsent], tags: [], forwardInfo: nil, authorId: account.peerId, text: text, attributes: attributes, media: [])], location: .Random) } } diff --git a/TelegramCore/Fetch.swift b/TelegramCore/Fetch.swift index 2f75caa251..93949bbbd6 100644 --- a/TelegramCore/Fetch.swift +++ b/TelegramCore/Fetch.swift @@ -1,6 +1,12 @@ import Foundation + +#if os(macOS) +import PostboxMac +import SwiftSignalKitMac +#else import Postbox import SwiftSignalKit +#endif private func fetchCloudMediaLocation(account: Account, cloudLocation: TelegramCloudMediaLocation, size: Int, range: Range) -> Signal { if size <= 0 { diff --git a/TelegramCore/Holes.swift b/TelegramCore/Holes.swift index 2aeed15e11..237cfe4224 100644 --- a/TelegramCore/Holes.swift +++ b/TelegramCore/Holes.swift @@ -1,7 +1,13 @@ import Foundation -import SwiftSignalKit -import Postbox -import MtProtoKit +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac + import MtProtoKitMac +#else + import Postbox + import SwiftSignalKit + import MtProtoKitDynamic +#endif private func messageFilterForTagMask(_ tagMask: MessageTags) -> Api.MessagesFilter? { if tagMask == .PhotoOrVideo { @@ -84,8 +90,9 @@ func fetchMessageHistoryHole(network: Network, postbox: Postbox, hole: MessageHi var peers: [Peer] = [] for chat in chats { - let telegramGroup = TelegramGroup(chat: chat) - peers.append(telegramGroup) + if let groupOrChannel = parseTelegramGroupOrChannel(chat: chat) { + peers.append(groupOrChannel) + } } for user in users { let telegramUser = TelegramUser(user: user) @@ -236,8 +243,9 @@ func fetchChatListHole(network: Network, postbox: Postbox, hole: ChatListHole) - var peers: [Peer] = [] for chat in dialogsChats { - let telegramGroup = TelegramGroup(chat: chat) - peers.append(telegramGroup) + if let groupOrChannel = parseTelegramGroupOrChannel(chat: chat) { + peers.append(groupOrChannel) + } } for user in dialogsUsers { let telegramUser = TelegramUser(user: user) diff --git a/TelegramCore/InlineBotMessageAttribute.swift b/TelegramCore/InlineBotMessageAttribute.swift index 81dae7ca55..5e161344c3 100644 --- a/TelegramCore/InlineBotMessageAttribute.swift +++ b/TelegramCore/InlineBotMessageAttribute.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public class InlineBotMessageAttribute: MessageAttribute { public let peerId: PeerId diff --git a/TelegramCore/Log.swift b/TelegramCore/Log.swift index 3091f2c5a8..2e88c86bbf 100644 --- a/TelegramCore/Log.swift +++ b/TelegramCore/Log.swift @@ -34,9 +34,9 @@ public func trace(_ domain: String, what: @autoclosure() -> String) { queue.async { let result = String(format: "[%@] %d-%d-%d %02d:%02d:%03d %@", arguments: [domain, Int(timeinfo.tm_year) + 1900, Int(timeinfo.tm_mon + 1), Int(timeinfo.tm_yday), Int(timeinfo.tm_hour), Int(timeinfo.tm_min), Int(milliseconds), string]) - #if (arch(i386) || arch(x86_64)) + //#if (arch(i386) || arch(x86_64)) print(result) - #endif + //#endif } } diff --git a/TelegramCore/ManagedChatListHoles.swift b/TelegramCore/ManagedChatListHoles.swift index 827f4aa614..7569169e0c 100644 --- a/TelegramCore/ManagedChatListHoles.swift +++ b/TelegramCore/ManagedChatListHoles.swift @@ -1,6 +1,11 @@ import Foundation -import Postbox -import SwiftSignalKit +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac +#else + import Postbox + import SwiftSignalKit +#endif private final class ManagedChatListHolesState { private var holeDisposables: [ChatListHole: Disposable] = [:] diff --git a/TelegramCore/ManagedMessageHistoryHoles.swift b/TelegramCore/ManagedMessageHistoryHoles.swift index 9009b0d54b..c9cbc767df 100644 --- a/TelegramCore/ManagedMessageHistoryHoles.swift +++ b/TelegramCore/ManagedMessageHistoryHoles.swift @@ -1,6 +1,11 @@ import Foundation -import Postbox -import SwiftSignalKit +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac +#else + import Postbox + import SwiftSignalKit +#endif private final class ManagedMessageHistoryHolesState { private var holeDisposables: [MessageHistoryHolesViewEntry: Disposable] = [:] diff --git a/TelegramCore/ManagedServiceViews.swift b/TelegramCore/ManagedServiceViews.swift index 4b292d4af3..1b5456b8b2 100644 --- a/TelegramCore/ManagedServiceViews.swift +++ b/TelegramCore/ManagedServiceViews.swift @@ -1,6 +1,11 @@ import Foundation -import Postbox -import SwiftSignalKit +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac +#else + import Postbox + import SwiftSignalKit +#endif func managedServiceViews(network: Network, postbox: Postbox, stateManager: StateManager) -> Signal { return Signal { _ in diff --git a/TelegramCore/ManagedSynchronizePeerReadStates.swift b/TelegramCore/ManagedSynchronizePeerReadStates.swift index 3224ffa4bd..2600797017 100644 --- a/TelegramCore/ManagedSynchronizePeerReadStates.swift +++ b/TelegramCore/ManagedSynchronizePeerReadStates.swift @@ -1,6 +1,11 @@ import Foundation -import Postbox -import SwiftSignalKit +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac +#else + import Postbox + import SwiftSignalKit +#endif private final class ManagedSynchronizePeerReadStatesState { private var synchronizeDisposables: [PeerId: (PeerReadStateSynchronizationOperation, Disposable)] = [:] diff --git a/TelegramCore/ManagedUnsentMessageIndices.swift b/TelegramCore/ManagedUnsentMessageIndices.swift index 46a5cb236f..fed672081b 100644 --- a/TelegramCore/ManagedUnsentMessageIndices.swift +++ b/TelegramCore/ManagedUnsentMessageIndices.swift @@ -1,6 +1,11 @@ import Foundation -import Postbox -import SwiftSignalKit +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac +#else + import Postbox + import SwiftSignalKit +#endif private final class ManagedUnsentMessageIndicesState { private var sendDisposables: [MessageIndex: Disposable] = [:] diff --git a/TelegramCore/MultipartFetch.swift b/TelegramCore/MultipartFetch.swift index 73062eb03b..28b6c36c77 100644 --- a/TelegramCore/MultipartFetch.swift +++ b/TelegramCore/MultipartFetch.swift @@ -1,6 +1,17 @@ import Foundation -import Postbox -import SwiftSignalKit +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac +#else + import Postbox + import SwiftSignalKit +#endif + +#if os(macOS) + private typealias SignalKitTimer = SwiftSignalKitMac.Timer +#else + private typealias SignalKitTimer = SwiftSignalKit.Timer +#endif private final class MultipartFetchManager { let parallelParts = 4 @@ -18,7 +29,7 @@ private final class MultipartFetchManager { var fetchingParts: [Int: (Int, Disposable)] = [:] var fetchedParts: [Int: Data] = [:] - var statsTimer: SwiftSignalKit.Timer? + var statsTimer: SignalKitTimer? var receivedSize = 0 var lastStatReport: (timestamp: Double, receivedSize: Int)? @@ -30,7 +41,7 @@ private final class MultipartFetchManager { self.partReady = partReady self.completed = completed - self.statsTimer = SwiftSignalKit.Timer(timeout: 3.0, repeat: true, completion: { [weak self] in + self.statsTimer = SignalKitTimer(timeout: 3.0, repeat: true, completion: { [weak self] in self?.reportStats() }, queue: self.queue) } diff --git a/TelegramCore/Namespaces.swift b/TelegramCore/Namespaces.swift index 7d9ea467b8..ebfa91aaa8 100644 --- a/TelegramCore/Namespaces.swift +++ b/TelegramCore/Namespaces.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public struct Namespaces { public struct Message { diff --git a/TelegramCore/Network.swift b/TelegramCore/Network.swift index e1de64b4bd..b5e139f174 100644 --- a/TelegramCore/Network.swift +++ b/TelegramCore/Network.swift @@ -1,7 +1,13 @@ import Foundation -import MtProtoKit -import Postbox -import SwiftSignalKit +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac + import MtProtoKitMac +#else + import Postbox + import SwiftSignalKit + import MtProtoKitDynamic +#endif import TelegramCorePrivateModule public enum ConnectionStatus { @@ -76,66 +82,85 @@ private class MTProtoConnectionStatusDelegate: NSObject, MTProtoDelegate { } } +private var registeredLoggingFunctions: Void = { + NetworkRegisterLoggingFunction() + registerLoggingFunctions() +}() + +func initializedNetwork(datacenterId: Int, keychain: Keychain) -> Signal { + return Signal { subscriber in + Queue.concurrentDefaultQueue().async { + let _ = registeredLoggingFunctions + + let serialization = Serialization() + + let apiEnvironment = MTApiEnvironment() + + apiEnvironment.apiId = 1 + apiEnvironment.layer = NSNumber(value: Int(serialization.currentLayer())) + + let context = MTContext(serialization: serialization, apiEnvironment: apiEnvironment)! + + let seedAddressList = [ + 1: "149.154.175.50", + 2: "149.154.167.50", + 3: "149.154.175.100", + 4: "149.154.167.91", + 5: "149.154.171.5" + ] + + for (id, ip) in seedAddressList { + context.setSeedAddressSetForDatacenterWithId(id, seedAddressSet: MTDatacenterAddressSet(addressList: [MTDatacenterAddress(ip: ip, port: 443, preferForMedia: false, restrictToTcp: false)])) + } + + context.keychain = keychain + let mtProto = MTProto(context: context, datacenterId: datacenterId)! + + let connectionStatus = Promise(.WaitingForNetwork) + + let requestService = MTRequestMessageService(context: context)! + let connectionStatusDelegate = MTProtoConnectionStatusDelegate() + connectionStatusDelegate.action = { [weak connectionStatus] flags in + if !flags.contains(.NetworkAvailable) { + connectionStatus?.set(single(ConnectionStatus.WaitingForNetwork, NoError.self)) + } else if !flags.contains(.Connected) { + connectionStatus?.set(single(ConnectionStatus.Connecting, NoError.self)) + } else if !flags.intersection([.UpdatingConnectionContext, .PerformingServiceTasks]).isEmpty { + connectionStatus?.set(single(ConnectionStatus.Updating, NoError.self)) + } else { + connectionStatus?.set(single(ConnectionStatus.Online, NoError.self)) + } + } + mtProto.delegate = connectionStatusDelegate + mtProto.add(requestService) + + subscriber.putNext(Network(datacenterId: datacenterId, context: context, mtProto: mtProto, requestService: requestService, connectionStatusDelegate: connectionStatusDelegate, _connectionStatus: connectionStatus)) + subscriber.putCompletion() + } + + return EmptyDisposable + } +} + public class Network { let datacenterId: Int let context: MTContext let mtProto: MTProto let requestService: MTRequestMessageService + private let connectionStatusDelegate: MTProtoConnectionStatusDelegate - private let connectionStatusDelegate = MTProtoConnectionStatusDelegate() - - private let _connectionStatus = Promise(.WaitingForNetwork) + private let _connectionStatus: Promise public var connectionStatus: Signal { return self._connectionStatus.get() |> distinctUntilChanged } - init(datacenterId: Int, keychain: Keychain) { - NetworkRegisterLoggingFunction() - registerLoggingFunctions() - + fileprivate init(datacenterId: Int, context: MTContext, mtProto: MTProto, requestService: MTRequestMessageService, connectionStatusDelegate: MTProtoConnectionStatusDelegate, _connectionStatus: Promise) { self.datacenterId = datacenterId - - let serialization = Serialization() - - let apiEnvironment = MTApiEnvironment() - - apiEnvironment.apiId = 1 - apiEnvironment.layer = NSNumber(value: Int(serialization.currentLayer())) - - self.context = MTContext(serialization: serialization, apiEnvironment: apiEnvironment) - - let seedAddressList = [ - 1: "149.154.175.50", - 2: "149.154.167.50", - 3: "149.154.175.100", - 4: "149.154.167.91", - 5: "149.154.171.5" - ] - - for (id, ip) in seedAddressList { - self.context.setSeedAddressSetForDatacenterWithId(id, seedAddressSet: MTDatacenterAddressSet(addressList: [MTDatacenterAddress(ip: ip, port: 443, preferForMedia: false, restrictToTcp: false)])) - } - - self.context.keychain = keychain - self.mtProto = MTProto(context: self.context, datacenterId: datacenterId) - - self.requestService = MTRequestMessageService(context: self.context) - self.connectionStatusDelegate.action = { [weak self] flags in - if let strongSelf = self { - if !flags.contains(.NetworkAvailable) { - strongSelf._connectionStatus.set(single(ConnectionStatus.WaitingForNetwork, NoError.self)) - } else if !flags.contains(.Connected) { - strongSelf._connectionStatus.set(single(ConnectionStatus.Connecting, NoError.self)) - } else if !flags.intersection([.UpdatingConnectionContext, .PerformingServiceTasks]).isEmpty { - strongSelf._connectionStatus.set(single(ConnectionStatus.Updating, NoError.self)) - } else { - strongSelf._connectionStatus.set(single(ConnectionStatus.Online, NoError.self)) - } - } - } - self.mtProto.delegate = self.connectionStatusDelegate - - self.mtProto.add(self.requestService) + self.context = context + self.mtProto = mtProto + self.requestService = requestService + self.connectionStatusDelegate = connectionStatusDelegate + self._connectionStatus = _connectionStatus } func download(datacenterId: Int) -> Signal { diff --git a/TelegramCore/NetworkLogging.h b/TelegramCore/NetworkLogging.h index 74984f8ac6..406c3c6a00 100644 --- a/TelegramCore/NetworkLogging.h +++ b/TelegramCore/NetworkLogging.h @@ -1,8 +1,7 @@ #ifndef Telegram_NetworkLogging_h #define Telegram_NetworkLogging_h -#import -#import +#import void NetworkRegisterLoggingFunction(); diff --git a/TelegramCore/NetworkLogging.m b/TelegramCore/NetworkLogging.m index 8e487de4a7..412cca6085 100644 --- a/TelegramCore/NetworkLogging.m +++ b/TelegramCore/NetworkLogging.m @@ -1,7 +1,12 @@ #import "NetworkLogging.h" #import -#import + +#if TARGET_OS_MAC || TARGET_OS_OSX +# import +#else +# import +#endif static void (*bridgingTrace)(NSString *, NSString *); void setBridgingTraceFunction(void (*f)(NSString *, NSString *)) { @@ -11,7 +16,7 @@ void setBridgingTraceFunction(void (*f)(NSString *, NSString *)) { #if TARGET_IPHONE_SIMULATOR static bool loggingEnabled = false; #else -static bool loggingEnabled = true; +static bool loggingEnabled = false; #endif static void TGTelegramLoggingFunction(NSString *format, va_list args) { diff --git a/TelegramCore/PeerAccessRestrictionInfo.swift b/TelegramCore/PeerAccessRestrictionInfo.swift new file mode 100644 index 0000000000..3d0749a606 --- /dev/null +++ b/TelegramCore/PeerAccessRestrictionInfo.swift @@ -0,0 +1,26 @@ +import Foundation +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif + +public final class PeerAccessRestrictionInfo: Coding, Equatable { + public let reason: String + + init(reason: String) { + self.reason = reason + } + + public init(decoder: Decoder) { + self.reason = decoder.decodeStringForKey("rsn") + } + + public func encode(_ encoder: Encoder) { + encoder.encodeString(self.reason, forKey: "rsn") + } + + public static func ==(lhs: PeerAccessRestrictionInfo, rhs: PeerAccessRestrictionInfo) -> Bool { + return lhs.reason == rhs.reason + } +} diff --git a/TelegramCore/PeerUtils.swift b/TelegramCore/PeerUtils.swift index 4505fb8cd6..5a7e636d2f 100644 --- a/TelegramCore/PeerUtils.swift +++ b/TelegramCore/PeerUtils.swift @@ -1,53 +1,75 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public extension Peer { public var displayTitle: String { - if let user = self as? TelegramUser { - return user.name - } else if let group = self as? TelegramGroup { - return group.title + switch self { + case let user as TelegramUser: + return user.name + case let group as TelegramGroup: + return group.title + case let channel as TelegramChannel: + return channel.title + default: + return "" } - return "" } public var compactDisplayTitle: String { - if let user = self as? TelegramUser { - if let firstName = user.firstName { - return firstName - } else if let lastName = user.lastName { - return lastName - } else { + switch self { + case let user as TelegramUser: + if let firstName = user.firstName { + return firstName + } else if let lastName = user.lastName { + return lastName + } else { + return "" + } + case let group as TelegramGroup: + return group.title + case let channel as TelegramChannel: + return channel.title + default: return "" - } - } else if let group = self as? TelegramGroup { - return group.title } - return "" } public var displayLetters: [String] { - if let user = self as? TelegramUser { - if let firstName = user.firstName, let lastName = user.lastName, !firstName.isEmpty && !lastName.isEmpty { - return [firstName.substring(to: firstName.index(after: firstName.startIndex)).uppercased(), lastName.substring(to: lastName.index(after: lastName.startIndex)).uppercased()] - } else if let firstName = user.firstName, !firstName.isEmpty { - return [firstName.substring(to: firstName.index(after: firstName.startIndex)).uppercased()] - } else if let lastName = user.lastName, !lastName.isEmpty { - return [lastName.substring(to: lastName.index(after: lastName.startIndex)).uppercased()] - } - - return [] - } else if let group = self as? TelegramGroup { - if group.title.startIndex != group.title.endIndex { - return [group.title.substring(to: group.title.index(after: group.title.startIndex)).uppercased()] - } + switch self { + case let user as TelegramUser: + if let firstName = user.firstName, let lastName = user.lastName, !firstName.isEmpty && !lastName.isEmpty { + return [firstName.substring(to: firstName.index(after: firstName.startIndex)).uppercased(), lastName.substring(to: lastName.index(after: lastName.startIndex)).uppercased()] + } else if let firstName = user.firstName, !firstName.isEmpty { + return [firstName.substring(to: firstName.index(after: firstName.startIndex)).uppercased()] + } else if let lastName = user.lastName, !lastName.isEmpty { + return [lastName.substring(to: lastName.index(after: lastName.startIndex)).uppercased()] + } + + return [] + case let group as TelegramGroup: + if group.title.startIndex != group.title.endIndex { + return [group.title.substring(to: group.title.index(after: group.title.startIndex)).uppercased()] + } else { + return [] + } + case let channel as TelegramChannel: + if channel.title.startIndex != channel.title.endIndex { + return [channel.title.substring(to: channel.title.index(after: channel.title.startIndex)).uppercased()] + } else { + return [] + } + default: + return [] } - return [] } } public extension PeerId { - public var isGroup: Bool { + public var isGroupOrChannel: Bool { switch self.namespace { case Namespaces.Peer.CloudGroup, Namespaces.Peer.CloudChannel: return true @@ -85,4 +107,3 @@ public func peerDisplayTitles(_ peers: [Peer]) -> String { } } - diff --git a/TelegramCore/PhoneNumbers.swift b/TelegramCore/PhoneNumbers.swift index d469afa788..7ad4266986 100644 --- a/TelegramCore/PhoneNumbers.swift +++ b/TelegramCore/PhoneNumbers.swift @@ -5,9 +5,10 @@ private let phoneNumberUtil = NBPhoneNumberUtil() public func formatPhoneNumber(_ string: String) -> String { do { - let number = try phoneNumberUtil.parse("+" + string, defaultRegion: nil) - return try phoneNumberUtil.format(number, numberFormat: .INTERNATIONAL) + return string + //let number = try phoneNumberUtil.parse("+" + string, defaultRegion: nil) + //return try phoneNumberUtil.format(number, numberFormat: .INTERNATIONAL) } catch _ { - return "" + return string } } diff --git a/TelegramCore/RecentPeers.swift b/TelegramCore/RecentPeers.swift index cdaf97d3ed..c79c08817b 100644 --- a/TelegramCore/RecentPeers.swift +++ b/TelegramCore/RecentPeers.swift @@ -1,6 +1,11 @@ import Foundation -import Postbox -import SwiftSignalKit +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac +#else + import Postbox + import SwiftSignalKit +#endif public func recentPeers(account: Account) -> Signal<[Peer], NoError> { let cachedPeers = account.postbox.recentPeers() diff --git a/TelegramCore/ReplyMessageAttribute.swift b/TelegramCore/ReplyMessageAttribute.swift index 517f38eb07..48460b1cae 100644 --- a/TelegramCore/ReplyMessageAttribute.swift +++ b/TelegramCore/ReplyMessageAttribute.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public class ReplyMessageAttribute: MessageAttribute { public let messageId: MessageId diff --git a/TelegramCore/SearchMessages.swift b/TelegramCore/SearchMessages.swift index 2d70627d2c..b884778dc6 100644 --- a/TelegramCore/SearchMessages.swift +++ b/TelegramCore/SearchMessages.swift @@ -1,6 +1,13 @@ import Foundation -import SwiftSignalKit -import Postbox +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac + import MtProtoKitMac +#else + import Postbox + import SwiftSignalKit + import MtProtoKitDynamic +#endif private func locallyRenderedMessage(message: StoreMessage, peers: [PeerId: Peer]) -> Message? { guard case let .Id(id) = message.id else { @@ -58,8 +65,8 @@ public func searchMessages(account: Account, query: String) -> Signal<[Message], } for chat in chats { - if let group = TelegramGroup.merge(modifier.getPeer(chat.peerId) as? TelegramGroup, rhs: chat) { - peers[group.id] = group + if let groupOrChannel = parseTelegramGroupOrChannel(chat: chat) { + peers[groupOrChannel.id] = groupOrChannel } } @@ -77,3 +84,60 @@ public func searchMessages(account: Account, query: String) -> Signal<[Message], return processedSearchResult } + +public func downloadMessage(account: Account, message: MessageId) -> Signal { + let signal: Signal + if message.peerId.namespace == Namespaces.Peer.CloudChannel { + signal = .complete() + } else { + signal = account.network.request(Api.functions.messages.getMessages(id: [message.id])) + } + + return signal + |> retryRequest + |> mapToSignal { result -> Signal in + NSLog("TGNT download message3 \(result)") + let messages: [Api.Message] + let chats: [Api.Chat] + let users: [Api.User] + switch result { + case let .channelMessages(_, _, _, apiMessages, apiChats, apiUsers): + messages = apiMessages + chats = apiChats + users = apiUsers + case let .messages(apiMessages, apiChats, apiUsers): + messages = apiMessages + chats = apiChats + users = apiUsers + case let.messagesSlice(_, apiMessages, apiChats, apiUsers): + messages = apiMessages + chats = apiChats + users = apiUsers + } + + return account.postbox.modify { modifier -> Message? in + var peers: [PeerId: Peer] = [:] + + for user in users { + if let user = TelegramUser.merge(modifier.getPeer(user.peerId) as? TelegramUser, rhs: user) { + peers[user.id] = user + } + } + + for chat in chats { + if let groupOrChannel = mergeGroupOrChannel(lhs: modifier.getPeer(chat.peerId), rhs: chat) { + peers[groupOrChannel.id] = groupOrChannel + } + } + + var renderedMessages: [Message] = [] + for message in messages { + if let message = StoreMessage(apiMessage: message), let renderedMessage = locallyRenderedMessage(message: message, peers: peers) { + renderedMessages.append(renderedMessage) + } + } + + return renderedMessages.first + } + } +} diff --git a/TelegramCore/SendUnsentMessage.swift b/TelegramCore/SendUnsentMessage.swift index 7aa38b052f..a9e79d44a3 100644 --- a/TelegramCore/SendUnsentMessage.swift +++ b/TelegramCore/SendUnsentMessage.swift @@ -1,6 +1,11 @@ import Foundation -import SwiftSignalKit -import Postbox +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac +#else + import Postbox + import SwiftSignalKit +#endif func sendUnsentMessage(network: Network, postbox: Postbox, stateManager: StateManager, message: Message) -> Signal { return postbox.peerWithId(message.id.peerId) @@ -10,7 +15,20 @@ func sendUnsentMessage(network: Network, postbox: Postbox, stateManager: StateMa if let inputPeer = apiInputPeer(peer) { var randomId: Int64 = 0 arc4random_buf(&randomId, 8) - return network.request(Api.functions.messages.sendMessage(flags: 0, peer: inputPeer, replyToMsgId: 0, message: message.text, randomId: randomId, replyMarkup: nil, entities: nil)) + + var replyMessageId: Int32? + for attribute in message.attributes { + if let replyAttribute = attribute as? ReplyMessageAttribute { + replyMessageId = replyAttribute.messageId.id + break + } + } + + var flags: Int32 = 0 + if let replyMessageId = replyMessageId { + flags |= Int32(1 << 0) + } + return network.request(Api.functions.messages.sendMessage(flags: flags, peer: inputPeer, replyToMsgId: replyMessageId, message: message.text, randomId: randomId, replyMarkup: nil, entities: nil)) |> mapError { _ -> NoError in return NoError() } @@ -42,8 +60,14 @@ func sendUnsentMessage(network: Network, postbox: Postbox, stateManager: StateMa media = [] } - var updatedAttributes: [MessageAttribute] = [] + var updatedAttributes: [MessageAttribute] = currentMessage.attributes if let entities = entities, !entities.isEmpty { + for i in 0 ..< updatedAttributes.count { + if updatedAttributes[i] is TextEntitiesMessageAttribute { + updatedAttributes.remove(at: i) + break + } + } updatedAttributes.append(TextEntitiesMessageAttribute(entities: messageTextEntitiesFromApiEntities(entities))) } attributes = updatedAttributes diff --git a/TelegramCore/Serialization.swift b/TelegramCore/Serialization.swift index 7ee3d297cf..cb80e922cb 100644 --- a/TelegramCore/Serialization.swift +++ b/TelegramCore/Serialization.swift @@ -1,5 +1,9 @@ import Foundation -import MtProtoKit +#if os(macOS) + import MtProtoKitMac +#else + import MtProtoKitDynamic +#endif public class BoxedMessage: NSObject { public let body: Any diff --git a/TelegramCore/StateManagement.swift b/TelegramCore/StateManagement.swift index 1de130a30f..dd87725839 100644 --- a/TelegramCore/StateManagement.swift +++ b/TelegramCore/StateManagement.swift @@ -1,7 +1,13 @@ import Foundation -import Postbox -import SwiftSignalKit -import MtProtoKit +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac + import MtProtoKitMac +#else + import Postbox + import SwiftSignalKit + import MtProtoKitDynamic +#endif private enum Event { case Next(T) @@ -147,9 +153,9 @@ private struct MutableState { self.channelStates[peerId] = channelState case let .MergeApiChats(chats): for chat in chats { - if let group = TelegramGroup.merge(peers[chat.peerId] as? TelegramGroup, rhs: chat) { - peers[group.id] = group - insertedPeers[group.id] = group + if let groupOrChannel = mergeGroupOrChannel(lhs: peers[chat.peerId], rhs: chat) { + peers[groupOrChannel.id] = groupOrChannel + insertedPeers[groupOrChannel.id] = groupOrChannel } } case let .MergeApiUsers(users): @@ -558,27 +564,27 @@ private func finalStateWithUpdates(account: Account, state: MutableState, update case let .updateChannelTooLong(_, channelId, _): let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId) if !channelsToPoll.contains(peerId) { - trace("State", what: "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramGroup)?.title ?? "nil")) updateChannelTooLong") + trace("State", what: "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) updateChannelTooLong") channelsToPoll.insert(peerId) } case let .updateDeleteChannelMessages(channelId, messages, pts: pts, ptsCount): let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId) if let previousState = updatedState.channelStates[peerId] { if previousState.pts >= pts { - trace("State", what: "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramGroup)?.title ?? "nil")) skip old delete update") + trace("State", what: "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) skip old delete update") } else if previousState.pts + ptsCount == pts { updatedState.deleteMessages(messages.map({ MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: $0) })) updatedState.updateChannelState(peerId, state: previousState.setPts(pts)) } else { if !channelsToPoll.contains(peerId) { - trace("State", what: "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramGroup)?.title ?? "nil")) delete pts hole") + trace("State", what: "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) delete pts hole") channelsToPoll.insert(peerId) //updatedMissingUpdates = true } } } else { if !channelsToPoll.contains(peerId) { - trace("State", what: "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramGroup)?.title ?? "nil")) state unknown") + trace("State", what: "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) state unknown") channelsToPoll.insert(peerId) } } @@ -588,13 +594,13 @@ private func finalStateWithUpdates(account: Account, state: MutableState, update if let message = StoreMessage(apiMessage: message) { if let previousState = updatedState.channelStates[message.id.peerId] { if previousState.pts >= pts { - trace("State", what: "channel \(message.id.peerId) (\((updatedState.peers[message.id.peerId] as? TelegramGroup)?.title ?? "nil")) skip old message \(message.id) (\(message.text))") + trace("State", what: "channel \(message.id.peerId) (\((updatedState.peers[message.id.peerId] as? TelegramChannel)?.title ?? "nil")) skip old message \(message.id) (\(message.text))") } else if previousState.pts + ptsCount == pts { updatedState.addMessages([message], location: .UpperHistoryBlock) updatedState.updateChannelState(message.id.peerId, state: previousState.setPts(pts)) } else { if !channelsToPoll.contains(message.id.peerId) { - trace("State", what: "channel \(message.id.peerId) (\((updatedState.peers[message.id.peerId] as? TelegramGroup)?.title ?? "nil")) message pts hole") + trace("State", what: "channel \(message.id.peerId) (\((updatedState.peers[message.id.peerId] as? TelegramChannel)?.title ?? "nil")) message pts hole") ; channelsToPoll.insert(message.id.peerId) //updatedMissingUpdates = true @@ -602,7 +608,7 @@ private func finalStateWithUpdates(account: Account, state: MutableState, update } } else { if !channelsToPoll.contains(message.id.peerId) { - trace("State", what: "channel \(message.id.peerId) (\((updatedState.peers[message.id.peerId] as? TelegramGroup)?.title ?? "nil")) state unknown") + trace("State", what: "channel \(message.id.peerId) (\((updatedState.peers[message.id.peerId] as? TelegramChannel)?.title ?? "nil")) state unknown") channelsToPoll.insert(message.id.peerId) } } @@ -975,8 +981,8 @@ private func replayFinalState(_ modifier: Modifier, finalState: MutableState) -> case let .MergeApiChats(chats): var peers: [Peer] = [] for chat in chats { - if let telegramGroup = TelegramGroup.merge(modifier.getPeer(chat.peerId) as? TelegramGroup, rhs: chat) { - peers.append(telegramGroup) + if let groupOrChannel = mergeGroupOrChannel(lhs: modifier.getPeer(chat.peerId), rhs: chat) { + peers.append(groupOrChannel) } } modifier.updatePeers(peers, update: { _, updated in @@ -1055,6 +1061,12 @@ private func pollDifference(_ account: Account) -> Signal { return signal } +#if os(macOS) + private typealias SignalKitTimer = SwiftSignalKitMac.Timer +#else + private typealias SignalKitTimer = SwiftSignalKit.Timer +#endif + public class StateManager { private let stateQueue = Queue() @@ -1064,7 +1076,7 @@ public class StateManager { private let disposable = MetaDisposable() private let updatesDisposable = MetaDisposable() private let actions = ValuePipe>() - private var timer: SwiftSignalKit.Timer? + private var timer: SignalKitTimer? private var collectingUpdateGroups = false private var collectedUpdateGroups: [UpdateGroup] = [] diff --git a/TelegramCore/StoreMessage_Telegram.swift b/TelegramCore/StoreMessage_Telegram.swift index 19eefb54b2..2c49517fd5 100644 --- a/TelegramCore/StoreMessage_Telegram.swift +++ b/TelegramCore/StoreMessage_Telegram.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif func tagsForStoreMessage(_ medias: [Media]) -> MessageTags { var tags = MessageTags() @@ -299,12 +303,14 @@ extension StoreMessage { sourceId = peerId if let channelPost = channelPost { - sourceMessageId = MessageId(peerId: peerId, namespace: Namespaces.Peer.CloudChannel, id: channelPost) + sourceMessageId = MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: channelPost) } } if let authorId = authorId { forwardInfo = StoreMessageForwardInfo(authorId: authorId, sourceId: sourceId, sourceMessageId: sourceMessageId, date: date) + } else if let sourceId = sourceId { + forwardInfo = StoreMessageForwardInfo(authorId: sourceId, sourceId: nil, sourceMessageId: sourceMessageId, date: date) } } } diff --git a/TelegramCore/SynchronizePeerReadState.swift b/TelegramCore/SynchronizePeerReadState.swift index 2bfb918ad9..746834ff20 100644 --- a/TelegramCore/SynchronizePeerReadState.swift +++ b/TelegramCore/SynchronizePeerReadState.swift @@ -1,6 +1,11 @@ import Foundation -import Postbox -import SwiftSignalKit +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac +#else + import Postbox + import SwiftSignalKit +#endif private enum VerifyReadStateError { case Abort diff --git a/TelegramCore/TelegramChannel.swift b/TelegramCore/TelegramChannel.swift new file mode 100644 index 0000000000..c2c340fd29 --- /dev/null +++ b/TelegramCore/TelegramChannel.swift @@ -0,0 +1,269 @@ +import Foundation +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif + +public enum TelegramChannelParticipationStatus { + case member + case left + case kicked + + fileprivate var rawValue: Int32 { + switch self { + case .member: + return 0 + case .left: + return 1 + case .kicked: + return 2 + } + } + + fileprivate init(rawValue: Int32) { + switch rawValue { + case 0: + self = .member + case 1: + self = .left + case 2: + self = .kicked + default: + self = .left + } + } +} + +public enum TelegramChannelRole { + case member + case creator + case editor + case moderator + + fileprivate var rawValue: Int32 { + switch self { + case .member: + return 0 + case .creator: + return 1 + case .editor: + return 2 + case .moderator: + return 3 + } + } + + fileprivate init(rawValue: Int32) { + switch rawValue { + case 0: + self = .member + case 1: + self = .creator + case 2: + self = .editor + case 3: + self = .moderator + default: + self = .member + } + } +} + +public struct TelegramChannelBroadcastFlags: OptionSet { + public var rawValue: Int32 + + public init() { + self.rawValue = 0 + } + + public init(rawValue: Int32) { + self.rawValue = rawValue + } + + public static let messagesShouldHaveSignatures = TelegramChannelBroadcastFlags(rawValue: 1 << 0) +} + +public struct TelegramChannelBroadcastInfo: Equatable { + public let flags: TelegramChannelBroadcastFlags + + public static func ==(lhs: TelegramChannelBroadcastInfo, rhs: TelegramChannelBroadcastInfo) -> Bool { + return lhs.flags == rhs.flags + } +} + +public struct TelegramChannelGroupFlags: OptionSet { + public var rawValue: Int32 + + public init() { + self.rawValue = 0 + } + + public init(rawValue: Int32) { + self.rawValue = rawValue + } + + public static let everyMemberCanInviteMembers = TelegramChannelGroupFlags(rawValue: 1 << 0) +} + +public struct TelegramChannelGroupInfo: Equatable { + public let flags: TelegramChannelGroupFlags + + public static func ==(lhs: TelegramChannelGroupInfo, rhs: TelegramChannelGroupInfo) -> Bool { + return lhs.flags == rhs.flags + } +} + +public enum TelegramChannelInfo: Equatable { + case broadcast(TelegramChannelBroadcastInfo) + case group(TelegramChannelGroupInfo) + + public static func ==(lhs: TelegramChannelInfo, rhs: TelegramChannelInfo) -> Bool { + switch lhs { + case let .broadcast(lhsInfo): + switch rhs { + case .broadcast(lhsInfo): + return true + default: + return false + } + case let .group(lhsInfo): + switch rhs { + case .group(lhsInfo): + return true + default: + return false + } + } + } + + fileprivate func encode(encoder: Encoder) { + switch self { + case let .broadcast(info): + encoder.encodeInt32(0, forKey: "i.t") + encoder.encodeInt32(info.flags.rawValue, forKey: "i.f") + case let .group(info): + encoder.encodeInt32(1, forKey: "i.t") + encoder.encodeInt32(info.flags.rawValue, forKey: "i.f") + } + } + + fileprivate static func decode(decoder: Decoder) -> TelegramChannelInfo { + let type: Int32 = decoder.decodeInt32ForKey("i.t") + if type == 0 { + return .broadcast(TelegramChannelBroadcastInfo(flags: TelegramChannelBroadcastFlags(rawValue: decoder.decodeInt32ForKey("i.f")))) + } else { + return .group(TelegramChannelGroupInfo(flags: TelegramChannelGroupFlags(rawValue: decoder.decodeInt32ForKey("i.f")))) + } + } +} + +public struct TelegramChannelFlags: OptionSet { + public var rawValue: Int32 + + public init() { + self.rawValue = 0 + } + + public init(rawValue: Int32) { + self.rawValue = rawValue + } + + public static let verified = TelegramChannelFlags(rawValue: 1 << 0) +} + +public final class TelegramChannel: Peer { + public let id: PeerId + public let accessHash: Int64? + public let title: String + public let username: String? + public let photo: [TelegramMediaImageRepresentation] + public let creationDate: Int32 + public let version: Int32 + public let participationStatus: TelegramChannelParticipationStatus + public let role: TelegramChannelRole + public let info: TelegramChannelInfo + public let flags: TelegramChannelFlags + public let restrictionInfo: PeerAccessRestrictionInfo? + + public var indexName: PeerIndexNameRepresentation { + return .title(self.title) + } + + public init(id: PeerId, accessHash: Int64?, title: String, username: String?, photo: [TelegramMediaImageRepresentation], creationDate: Int32, version: Int32, participationStatus: TelegramChannelParticipationStatus, role: TelegramChannelRole, info: TelegramChannelInfo, flags: TelegramChannelFlags, restrictionInfo: PeerAccessRestrictionInfo?) { + self.id = id + self.accessHash = accessHash + self.title = title + self.username = username + self.photo = photo + self.creationDate = creationDate + self.version = version + self.participationStatus = participationStatus + self.role = role + self.info = info + self.flags = flags + self.restrictionInfo = restrictionInfo + } + + public init(decoder: Decoder) { + self.id = PeerId(decoder.decodeInt64ForKey("i")) + self.accessHash = decoder.decodeInt64ForKey("ah") + self.title = decoder.decodeStringForKey("t") + self.username = decoder.decodeStringForKey("un") + self.photo = decoder.decodeObjectArrayForKey("ph") + self.creationDate = decoder.decodeInt32ForKey("d") + self.version = decoder.decodeInt32ForKey("v") + self.participationStatus = TelegramChannelParticipationStatus(rawValue: decoder.decodeInt32ForKey("ps")) + self.role = TelegramChannelRole(rawValue: decoder.decodeInt32ForKey("ro")) + self.info = TelegramChannelInfo.decode(decoder: decoder) + self.flags = TelegramChannelFlags(rawValue: decoder.decodeInt32ForKey("fl")) + self.restrictionInfo = decoder.decodeObjectForKey("ri") as? PeerAccessRestrictionInfo + } + + public func encode(_ encoder: Encoder) { + encoder.encodeInt64(self.id.toInt64(), forKey: "i") + if let accessHash = self.accessHash { + encoder.encodeInt64(accessHash, forKey: "ah") + } else { + encoder.encodeNil(forKey: "ah") + } + encoder.encodeString(self.title, forKey: "t") + if let username = self.username { + encoder.encodeString(username, forKey: "un") + } else { + encoder.encodeNil(forKey: "un") + } + encoder.encodeObjectArray(self.photo, forKey: "ph") + encoder.encodeInt32(self.creationDate, forKey: "d") + encoder.encodeInt32(self.version, forKey: "v") + encoder.encodeInt32(self.participationStatus.rawValue, forKey: "ps") + encoder.encodeInt32(self.role.rawValue, forKey: "ro") + self.info.encode(encoder: encoder) + encoder.encodeInt32(self.flags.rawValue, forKey: "fl") + if let restrictionInfo = self.restrictionInfo { + encoder.encodeObject(restrictionInfo, forKey: "ri") + } else { + encoder.encodeNil(forKey: "ri") + } + } + + public func isEqual(_ other: Peer) -> Bool { + guard let other = other as? TelegramChannel else { + return false + } + + if self.id != other.id || self.accessHash != other.accessHash || self.title != other.title || self.username != other.username || self.photo != other.photo { + return false + } + + if self.creationDate != other.creationDate || self.version != other.version || self.participationStatus != other.participationStatus { + return false + } + + if self.role != other.role || self.info != other.info || self.flags != other.flags || self.restrictionInfo != other.restrictionInfo { + return false + } + + return true + } +} diff --git a/TelegramCore/TelegramGroup.swift b/TelegramCore/TelegramGroup.swift index 0dc07802fb..90243d3b76 100644 --- a/TelegramCore/TelegramGroup.swift +++ b/TelegramCore/TelegramGroup.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public enum TelegramGroupMembership: Int32 { case Member @@ -7,9 +11,8 @@ public enum TelegramGroupMembership: Int32 { case Removed } -public final class TelegramGroup: Peer, Coding { +public final class TelegramGroup: Peer { public let id: PeerId - public let accessHash: Int64 public let title: String public let photo: [TelegramMediaImageRepresentation] public let participantCount: Int @@ -20,9 +23,8 @@ public final class TelegramGroup: Peer, Coding { return .title(self.title) } - public init(id: PeerId, accessHash: Int64?, title: String, photo: [TelegramMediaImageRepresentation], participantCount: Int, membership: TelegramGroupMembership, version: Int) { + public init(id: PeerId, title: String, photo: [TelegramMediaImageRepresentation], participantCount: Int, membership: TelegramGroupMembership, version: Int) { self.id = id - self.accessHash = accessHash ?? 0 self.title = title self.photo = photo self.participantCount = participantCount @@ -32,7 +34,6 @@ public final class TelegramGroup: Peer, Coding { public init(decoder: Decoder) { self.id = PeerId(decoder.decodeInt64ForKey("i")) - self.accessHash = decoder.decodeInt64ForKey("ah") self.title = decoder.decodeStringForKey("t") self.photo = decoder.decodeObjectArrayForKey("ph") self.participantCount = Int(decoder.decodeInt32ForKey("pc")) @@ -42,7 +43,6 @@ public final class TelegramGroup: Peer, Coding { public func encode(_ encoder: Encoder) { encoder.encodeInt64(self.id.toInt64(), forKey: "i") - encoder.encodeInt64(accessHash, forKey: "ah") encoder.encodeString(self.title, forKey: "t") encoder.encodeObjectArray(self.photo, forKey: "ph") encoder.encodeInt32(Int32(self.participantCount), forKey: "pc") @@ -55,9 +55,6 @@ public final class TelegramGroup: Peer, Coding { if self.id != other.id { return false } - if self.accessHash != other.accessHash { - return false - } if self.title != other.title { return false } @@ -79,51 +76,3 @@ public final class TelegramGroup: Peer, Coding { } } } - -private func imageRepresentationsForApiChatPhoto(_ photo: Api.ChatPhoto) -> [TelegramMediaImageRepresentation] { - var telegramPhoto: [TelegramMediaImageRepresentation] = [] - switch photo { - case let .chatPhoto(photoSmall, photoBig): - if let smallLocation = telegramMediaLocationFromApiLocation(photoSmall), let largeLocation = telegramMediaLocationFromApiLocation(photoBig) { - telegramPhoto.append(TelegramMediaImageRepresentation(dimensions: CGSize(width: 80.0, height: 80.0), location: smallLocation, size: nil)) - telegramPhoto.append(TelegramMediaImageRepresentation(dimensions: CGSize(width: 640.0, height: 640.0), location: largeLocation, size: nil)) - } - case .chatPhotoEmpty: - break - } - return telegramPhoto -} - -public extension TelegramGroup { - public convenience init(chat: Api.Chat) { - switch chat { - case let .chat(flags, id, title, photo, participantsCount, _, version, _): - let left = (flags & (1 | 2)) != 0 - self.init(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: id), accessHash: nil, title: title, photo: imageRepresentationsForApiChatPhoto(photo), participantCount: Int(participantsCount), membership: left ? .Left : .Member, version: Int(version)) - case let .chatEmpty(id): - self.init(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: id), accessHash: nil, title: "", photo: [], participantCount: 0, membership: .Removed, version: 0) - case let .chatForbidden(id, title): - self.init(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: id), accessHash: nil, title: title, photo: [], participantCount: 0, membership: .Removed, version: 0) - case let .channel(flags, id, accessHash, title, _, photo, date, version, restrictionReason): - let left = (flags & (1 | 2)) != 0 - self.init(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: id), accessHash: accessHash, title: title, photo: imageRepresentationsForApiChatPhoto(photo), participantCount: 0, membership: left ? .Left : .Member, version: Int(version)) - case let .channelForbidden(_, id, accessHash, title): - self.init(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: id), accessHash: accessHash, title: title, photo: [], participantCount: 0, membership: .Left, version: 0) - } - } - - public static func merge(_ lhs: TelegramGroup?, rhs: Api.Chat) -> TelegramGroup? { - switch rhs { - case .chat, .chatEmpty, .chatForbidden, .channelForbidden: - return TelegramGroup(chat: rhs) - case let .channel(_, _, accessHash, title, _, photo, date, _, restrictionReason): - if let _ = accessHash { - return TelegramGroup(chat: rhs) - } else if let lhs = lhs { - return TelegramGroup(id: lhs.id, accessHash: lhs.accessHash, title: title, photo: imageRepresentationsForApiChatPhoto(photo), participantCount: lhs.participantCount, membership: lhs.membership, version: 0) - } else { - return nil - } - } - } -} diff --git a/TelegramCore/TelegramMediaAction.swift b/TelegramCore/TelegramMediaAction.swift index eafaa5fabe..ac66253f00 100644 --- a/TelegramCore/TelegramMediaAction.swift +++ b/TelegramCore/TelegramMediaAction.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public enum TelegramMediaActionType: Coding, Equatable { case unknown diff --git a/TelegramCore/TelegramMediaCloudLocations.swift b/TelegramCore/TelegramMediaCloudLocations.swift index 1e028c61a3..e0df9041ae 100644 --- a/TelegramCore/TelegramMediaCloudLocations.swift +++ b/TelegramCore/TelegramMediaCloudLocations.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public class TelegramCloudFileLocation: TelegramMediaLocation, TelegramCloudMediaLocation { public let datacenterId: Int diff --git a/TelegramCore/TelegramMediaContact.swift b/TelegramCore/TelegramMediaContact.swift index a95d6b971f..17810a3c8f 100644 --- a/TelegramCore/TelegramMediaContact.swift +++ b/TelegramCore/TelegramMediaContact.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public final class TelegramMediaContact: Media { public let id: MediaId? = nil diff --git a/TelegramCore/TelegramMediaFile.swift b/TelegramCore/TelegramMediaFile.swift index a3d820f1cb..cc8695f274 100644 --- a/TelegramCore/TelegramMediaFile.swift +++ b/TelegramCore/TelegramMediaFile.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif private let typeFileName: Int32 = 0 private let typeSticker: Int32 = 1 diff --git a/TelegramCore/TelegramMediaImage.swift b/TelegramCore/TelegramMediaImage.swift index b37f7761e1..7d257ab364 100644 --- a/TelegramCore/TelegramMediaImage.swift +++ b/TelegramCore/TelegramMediaImage.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public final class TelegramMediaImage: Media, Equatable { public let imageId: MediaId diff --git a/TelegramCore/TelegramMediaLocation.swift b/TelegramCore/TelegramMediaLocation.swift index f6fb6b4387..6d1047a4a1 100644 --- a/TelegramCore/TelegramMediaLocation.swift +++ b/TelegramCore/TelegramMediaLocation.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public protocol TelegramMediaLocation: Coding { var uniqueId: String { get } diff --git a/TelegramCore/TelegramMediaMap.swift b/TelegramCore/TelegramMediaMap.swift index 7999ad4937..08b0b7aec6 100644 --- a/TelegramCore/TelegramMediaMap.swift +++ b/TelegramCore/TelegramMediaMap.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public final class NamedGeoPlace: Coding { public let country: String? diff --git a/TelegramCore/TelegramMediaVoiceNote.swift b/TelegramCore/TelegramMediaVoiceNote.swift deleted file mode 100644 index 79ba5e083e..0000000000 --- a/TelegramCore/TelegramMediaVoiceNote.swift +++ /dev/null @@ -1,45 +0,0 @@ -import Foundation -import Postbox - -public final class TelegramMediaVoiceNote: Media { - public let id: MediaId? - public let voiceNoteId: MediaId - public let duration: Int - public let mimeType: String - public let size: Int - public let peerIds: [PeerId] = [] - - public init(voiceNoteId: MediaId, duration: Int, mimeType: String, size: Int) { - self.id = voiceNoteId - self.voiceNoteId = voiceNoteId - self.duration = duration - self.mimeType = mimeType - self.size = size - } - - public init(decoder: Decoder) { - self.voiceNoteId = MediaId(decoder.decodeBytesForKeyNoCopy("i")) - self.id = self.voiceNoteId - self.duration = Int(decoder.decodeInt32ForKey("d")) - self.mimeType = decoder.decodeStringForKey("m") - self.size = Int(decoder.decodeInt32ForKey("s")) - } - - public func encode(_ encoder: Encoder) { - let buffer = WriteBuffer() - self.voiceNoteId.encodeToBuffer(buffer) - encoder.encodeBytes(buffer, forKey: "i") - encoder.encodeInt32(Int32(self.duration), forKey: "d") - encoder.encodeString(self.mimeType, forKey: "m") - encoder.encodeInt32(Int32(self.size), forKey: "s") - } - - public func isEqual(_ other: Media) -> Bool { - if let other = other as? TelegramMediaVoiceNote { - if other.voiceNoteId == self.voiceNoteId && other.duration == self.duration && other.mimeType == self.mimeType && other.size == self.size { - return true - } - } - return false - } -} diff --git a/TelegramCore/TelegramMediaWebpage.swift b/TelegramCore/TelegramMediaWebpage.swift index 7d2cda53a5..127bbc4c72 100644 --- a/TelegramCore/TelegramMediaWebpage.swift +++ b/TelegramCore/TelegramMediaWebpage.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public final class TelegramMediaWebpageLoadedContent: Coding, Equatable { public let url: String diff --git a/TelegramCore/TelegramUser.swift b/TelegramCore/TelegramUser.swift index e79f3888e6..1669b86cc1 100644 --- a/TelegramCore/TelegramUser.swift +++ b/TelegramCore/TelegramUser.swift @@ -1,7 +1,11 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif -public final class TelegramUser: Peer, Coding { +public final class TelegramUser: Peer { public let id: PeerId public let accessHash: Int64? public let firstName: String? @@ -114,10 +118,6 @@ public final class TelegramUser: Peer, Coding { } } -func telegramImageMediaRepresentationFromUserProfilePhoto() { - -} - public extension TelegramUser { public convenience init(user: Api.User) { switch user { diff --git a/TelegramCore/TextEntitiesMessageAttribute.swift b/TelegramCore/TextEntitiesMessageAttribute.swift index e68091b2af..cdbbb1bbd0 100644 --- a/TelegramCore/TextEntitiesMessageAttribute.swift +++ b/TelegramCore/TextEntitiesMessageAttribute.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public enum MessageTextEntityType { case Unknown diff --git a/TelegramCore/UpdateMessageService.swift b/TelegramCore/UpdateMessageService.swift index a4e65f1ec2..26bea42afe 100644 --- a/TelegramCore/UpdateMessageService.swift +++ b/TelegramCore/UpdateMessageService.swift @@ -1,7 +1,13 @@ import Foundation -import MtProtoKit -import Postbox -import SwiftSignalKit +#if os(macOS) + import PostboxMac + import SwiftSignalKitMac + import MtProtoKitMac +#else + import Postbox + import SwiftSignalKit + import MtProtoKitDynamic +#endif class UpdateMessageService: NSObject, MTMessageService { var peerId: PeerId! diff --git a/TelegramCore/UpdatesApiUtils.swift b/TelegramCore/UpdatesApiUtils.swift index 97a603ef8d..6f08c03e10 100644 --- a/TelegramCore/UpdatesApiUtils.swift +++ b/TelegramCore/UpdatesApiUtils.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif extension Api.Message { var id: Int32 { diff --git a/TelegramCore/ViewCountMessageAttribute.swift b/TelegramCore/ViewCountMessageAttribute.swift index 8cb11f4076..456e67c829 100644 --- a/TelegramCore/ViewCountMessageAttribute.swift +++ b/TelegramCore/ViewCountMessageAttribute.swift @@ -1,5 +1,9 @@ import Foundation -import Postbox +#if os(macOS) + import PostboxMac +#else + import Postbox +#endif public class ViewCountMessageAttribute: MessageAttribute { let count: Int diff --git a/TelegramCoreMac/Info.plist b/TelegramCoreMac/Info.plist new file mode 100644 index 0000000000..6c6dba7bb1 --- /dev/null +++ b/TelegramCoreMac/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSHumanReadableCopyright + Copyright © 2016 Peter. All rights reserved. + NSPrincipalClass + + + diff --git a/TelegramCoreMac/TelegramCoreMac.h b/TelegramCoreMac/TelegramCoreMac.h new file mode 100644 index 0000000000..2cef829046 --- /dev/null +++ b/TelegramCoreMac/TelegramCoreMac.h @@ -0,0 +1,19 @@ +// +// TelegramCoreMac.h +// TelegramCoreMac +// +// Created by Peter on 9/5/16. +// Copyright © 2016 Peter. All rights reserved. +// + +#import + +//! Project version number for TelegramCoreMac. +FOUNDATION_EXPORT double TelegramCoreMacVersionNumber; + +//! Project version string for TelegramCoreMac. +FOUNDATION_EXPORT const unsigned char TelegramCoreMacVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + +