mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-08-11 00:30:18 +02:00
Update Ghostgram features
This commit is contained in:
+11
-7
@@ -50,7 +50,7 @@ func _internal_requestChangeAccountPhoneNumberVerification(account: Account, api
|
||||
appSandbox = pushNotificationConfiguration.isSandbox ? .boolTrue : .boolFalse
|
||||
}
|
||||
|
||||
return account.network.request(Api.functions.account.sendChangePhoneCode(phoneNumber: phoneNumber, settings: .codeSettings(flags: flags, logoutTokens: nil, token: token, appSandbox: appSandbox)), automaticFloodWait: false)
|
||||
return account.network.request(Api.functions.account.sendChangePhoneCode(phoneNumber: phoneNumber, settings: .codeSettings(.init(flags: flags, logoutTokens: nil, token: token, appSandbox: appSandbox))), automaticFloodWait: false)
|
||||
|> mapError { error -> RequestChangeAccountPhoneNumberVerificationError in
|
||||
if error.errorDescription.hasPrefix("FLOOD_WAIT") {
|
||||
return .limitExceeded
|
||||
@@ -66,13 +66,15 @@ func _internal_requestChangeAccountPhoneNumberVerification(account: Account, api
|
||||
}
|
||||
|> mapToSignal { sentCode -> Signal<ChangeAccountPhoneNumberData, RequestChangeAccountPhoneNumberVerificationError> in
|
||||
switch sentCode {
|
||||
case let .sentCode(_, type, phoneCodeHash, nextType, codeTimeout):
|
||||
case let .sentCode(sentCodeData):
|
||||
let (type, phoneCodeHash, nextType, codeTimeout) = (sentCodeData.type, sentCodeData.phoneCodeHash, sentCodeData.nextType, sentCodeData.timeout)
|
||||
var parsedNextType: AuthorizationCodeNextType?
|
||||
if let nextType = nextType {
|
||||
parsedNextType = AuthorizationCodeNextType(apiType: nextType)
|
||||
}
|
||||
|
||||
if case let .sentCodeTypeFirebaseSms(_, _, _, _, receipt, pushTimeout, _) = type {
|
||||
|
||||
if case let .sentCodeTypeFirebaseSms(sentCodeTypeFirebaseSmsData) = type {
|
||||
let (receipt, pushTimeout) = (sentCodeTypeFirebaseSmsData.receipt, sentCodeTypeFirebaseSmsData.pushTimeout)
|
||||
return firebaseSecretStream
|
||||
|> map { mapping -> String? in
|
||||
guard let receipt = receipt else {
|
||||
@@ -141,13 +143,15 @@ private func internalResendChangeAccountPhoneNumberVerification(account: Account
|
||||
}
|
||||
|> mapToSignal { sentCode -> Signal<ChangeAccountPhoneNumberData, RequestChangeAccountPhoneNumberVerificationError> in
|
||||
switch sentCode {
|
||||
case let .sentCode(_, type, phoneCodeHash, nextType, codeTimeout):
|
||||
case let .sentCode(sentCodeData):
|
||||
let (type, phoneCodeHash, nextType, codeTimeout) = (sentCodeData.type, sentCodeData.phoneCodeHash, sentCodeData.nextType, sentCodeData.timeout)
|
||||
var parsedNextType: AuthorizationCodeNextType?
|
||||
if let nextType = nextType {
|
||||
parsedNextType = AuthorizationCodeNextType(apiType: nextType)
|
||||
}
|
||||
|
||||
if case let .sentCodeTypeFirebaseSms(_, _, _, _, receipt, pushTimeout, _) = type {
|
||||
|
||||
if case let .sentCodeTypeFirebaseSms(sentCodeTypeFirebaseSmsData) = type {
|
||||
let (receipt, pushTimeout) = (sentCodeTypeFirebaseSmsData.receipt, sentCodeTypeFirebaseSmsData.pushTimeout)
|
||||
return firebaseSecretStream
|
||||
|> map { mapping -> String? in
|
||||
guard let receipt = receipt else {
|
||||
|
||||
+3
-3
@@ -90,7 +90,7 @@ public extension TelegramEngine {
|
||||
var textColor: Int32?
|
||||
for attribute in starGift.attributes {
|
||||
switch attribute {
|
||||
case let .model(_, fileValue, _):
|
||||
case let .model(_, fileValue, _, _):
|
||||
file = fileValue
|
||||
case let .pattern(_, patternFileValue, _):
|
||||
patternFile = patternFileValue
|
||||
@@ -106,7 +106,7 @@ public extension TelegramEngine {
|
||||
let apiEmojiStatus: Api.EmojiStatus
|
||||
var emojiStatus: PeerEmojiStatus?
|
||||
if let file, let patternFile, let innerColor, let outerColor, let patternColor, let textColor {
|
||||
apiEmojiStatus = .inputEmojiStatusCollectible(flags: flags, collectibleId: starGift.id, until: expirationDate)
|
||||
apiEmojiStatus = .inputEmojiStatusCollectible(.init(flags: flags, collectibleId: starGift.id, until: expirationDate))
|
||||
emojiStatus = PeerEmojiStatus(content: .starGift(id: starGift.id, fileId: file.fileId.id, title: starGift.title, slug: starGift.slug, patternFileId: patternFile.fileId.id, innerColor: innerColor, outerColor: outerColor, patternColor: patternColor, textColor: textColor), expirationDate: expirationDate)
|
||||
} else {
|
||||
apiEmojiStatus = .emojiStatusEmpty
|
||||
@@ -143,7 +143,7 @@ public extension TelegramEngine {
|
||||
if let _ = expirationDate {
|
||||
flags |= (1 << 0)
|
||||
}
|
||||
return Api.EmojiStatus.emojiStatus(flags: flags, documentId: file.fileId.id, until: expirationDate)
|
||||
return Api.EmojiStatus.emojiStatus(.init(flags: flags, documentId: file.fileId.id, until: expirationDate))
|
||||
}) ?? Api.EmojiStatus.emojiStatusEmpty))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .single(.boolFalse)
|
||||
|
||||
@@ -22,10 +22,12 @@ public struct TermsOfServiceUpdate: Equatable {
|
||||
extension TermsOfServiceUpdate {
|
||||
init?(apiTermsOfService: Api.help.TermsOfService) {
|
||||
switch apiTermsOfService {
|
||||
case let .termsOfService(_, id, text, entities, minAgeConfirm):
|
||||
case let .termsOfService(termsOfServiceData):
|
||||
let (_, id, text, entities, minAgeConfirm) = (termsOfServiceData.flags, termsOfServiceData.id, termsOfServiceData.text, termsOfServiceData.entities, termsOfServiceData.minAgeConfirm)
|
||||
let idData: String
|
||||
switch id {
|
||||
case let .dataJSON(data):
|
||||
case let .dataJSON(dataJSONData):
|
||||
let data = dataJSONData.data
|
||||
idData = data
|
||||
}
|
||||
self.init(id: idData, text: text, entities: messageTextEntitiesFromApiEntities(entities), ageConfirmation: minAgeConfirm)
|
||||
@@ -34,7 +36,7 @@ extension TermsOfServiceUpdate {
|
||||
}
|
||||
|
||||
func _internal_acceptTermsOfService(account: Account, id: String) -> Signal<Void, NoError> {
|
||||
return account.network.request(Api.functions.help.acceptTermsOfService(id: .dataJSON(data: id)))
|
||||
return account.network.request(Api.functions.help.acceptTermsOfService(id: .dataJSON(.init(data: id))))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .complete()
|
||||
}
|
||||
@@ -50,7 +52,8 @@ func managedTermsOfServiceUpdates(postbox: Postbox, network: Network, stateManag
|
||||
|> mapToSignal { [weak stateManager] result -> Signal<Void, NoError> in
|
||||
var updated: TermsOfServiceUpdate?
|
||||
switch result {
|
||||
case let .termsOfServiceUpdate(_, termsOfService):
|
||||
case let .termsOfServiceUpdate(termsOfServiceUpdateData):
|
||||
let (_, termsOfService) = (termsOfServiceUpdateData.expires, termsOfServiceUpdateData.termsOfService)
|
||||
updated = TermsOfServiceUpdate(apiTermsOfService: termsOfService)
|
||||
case .termsOfServiceUpdateEmpty:
|
||||
break
|
||||
|
||||
+3
-3
@@ -87,9 +87,9 @@ func _internal_updateNameColorAndEmoji(account: Account, nameColor: UpdateNameCo
|
||||
if let _ = backgroundEmojiId {
|
||||
flags |= (1 << 1)
|
||||
}
|
||||
inputRepliesColor = .peerColor(flags: flags, color: color.rawValue, backgroundEmojiId: backgroundEmojiId)
|
||||
inputRepliesColor = .peerColor(.init(flags: flags, color: color.rawValue, backgroundEmojiId: backgroundEmojiId))
|
||||
case let .collectible(collectibleColor):
|
||||
inputRepliesColor = .inputPeerColorCollectible(collectibleId: collectibleColor.collectibleId)
|
||||
inputRepliesColor = .inputPeerColorCollectible(.init(collectibleId: collectibleColor.collectibleId))
|
||||
}
|
||||
|
||||
var flagsProfile: Int32 = 0
|
||||
@@ -102,7 +102,7 @@ func _internal_updateNameColorAndEmoji(account: Account, nameColor: UpdateNameCo
|
||||
|
||||
return combineLatest(
|
||||
account.network.request(Api.functions.account.updateColor(flags: (1 << 2), color: inputRepliesColor)),
|
||||
account.network.request(Api.functions.account.updateColor(flags: (1 << 1) | (1 << 2), color: .peerColor(flags: flagsProfile, color: profileColor?.rawValue ?? 0, backgroundEmojiId: profileBackgroundEmojiId)))
|
||||
account.network.request(Api.functions.account.updateColor(flags: (1 << 1) | (1 << 2), color: .peerColor(.init(flags: flagsProfile, color: profileColor?.rawValue ?? 0, backgroundEmojiId: profileBackgroundEmojiId))))
|
||||
)
|
||||
|> mapError { _ -> UpdateNameColorAndEmojiError in
|
||||
return .generic
|
||||
|
||||
Reference in New Issue
Block a user