mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-19 12:10:55 +00:00
no message
This commit is contained in:
parent
e425c69db4
commit
e91ca3f86b
@ -9,6 +9,9 @@
|
|||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
9F10CE8B20613C78002DD61A /* SecretApiLayer73.swift in Sources */ = {isa = PBXBuildFile; fileRef = D018EDFF2044939F00CBB130 /* SecretApiLayer73.swift */; };
|
9F10CE8B20613C78002DD61A /* SecretApiLayer73.swift in Sources */ = {isa = PBXBuildFile; fileRef = D018EDFF2044939F00CBB130 /* SecretApiLayer73.swift */; };
|
||||||
9F10CE8C20613CDB002DD61A /* TelegramDeviceContactImportInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B2F7732052DEF700D3BFB9 /* TelegramDeviceContactImportInfo.swift */; };
|
9F10CE8C20613CDB002DD61A /* TelegramDeviceContactImportInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B2F7732052DEF700D3BFB9 /* TelegramDeviceContactImportInfo.swift */; };
|
||||||
|
9FC8ADA9206BBD000094F7B4 /* SaveSecureIdValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D093D805206539D000BC3599 /* SaveSecureIdValue.swift */; };
|
||||||
|
9FC8ADAB206BBFF10094F7B4 /* RecentWebSessions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC8ADAA206BBFF10094F7B4 /* RecentWebSessions.swift */; };
|
||||||
|
9FC8ADAC206BC00A0094F7B4 /* RecentWebSessions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC8ADAA206BBFF10094F7B4 /* RecentWebSessions.swift */; };
|
||||||
C205FEA81EB3B75900455808 /* ExportMessageLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = C205FEA71EB3B75900455808 /* ExportMessageLink.swift */; };
|
C205FEA81EB3B75900455808 /* ExportMessageLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = C205FEA71EB3B75900455808 /* ExportMessageLink.swift */; };
|
||||||
C205FEA91EB3B75900455808 /* ExportMessageLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = C205FEA71EB3B75900455808 /* ExportMessageLink.swift */; };
|
C205FEA91EB3B75900455808 /* ExportMessageLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = C205FEA71EB3B75900455808 /* ExportMessageLink.swift */; };
|
||||||
C210DD621FBDB90800F673D8 /* SourceReferenceMessageAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = C210DD611FBDB90800F673D8 /* SourceReferenceMessageAttribute.swift */; };
|
C210DD621FBDB90800F673D8 /* SourceReferenceMessageAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = C210DD611FBDB90800F673D8 /* SourceReferenceMessageAttribute.swift */; };
|
||||||
@ -687,6 +690,7 @@
|
|||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
9FC8ADAA206BBFF10094F7B4 /* RecentWebSessions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecentWebSessions.swift; sourceTree = "<group>"; };
|
||||||
C205FEA71EB3B75900455808 /* ExportMessageLink.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExportMessageLink.swift; sourceTree = "<group>"; };
|
C205FEA71EB3B75900455808 /* ExportMessageLink.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExportMessageLink.swift; sourceTree = "<group>"; };
|
||||||
C210DD611FBDB90800F673D8 /* SourceReferenceMessageAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceReferenceMessageAttribute.swift; sourceTree = "<group>"; };
|
C210DD611FBDB90800F673D8 /* SourceReferenceMessageAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceReferenceMessageAttribute.swift; sourceTree = "<group>"; };
|
||||||
C22EE61A1E67418000334C38 /* ToggleChannelSignatures.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToggleChannelSignatures.swift; sourceTree = "<group>"; };
|
C22EE61A1E67418000334C38 /* ToggleChannelSignatures.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToggleChannelSignatures.swift; sourceTree = "<group>"; };
|
||||||
@ -1486,6 +1490,7 @@
|
|||||||
D05A32E31E6F0B2E002760B4 /* RecentAccountSessions.swift */,
|
D05A32E31E6F0B2E002760B4 /* RecentAccountSessions.swift */,
|
||||||
D0FA0ABC1E76C908005BB9B7 /* TwoStepVerification.swift */,
|
D0FA0ABC1E76C908005BB9B7 /* TwoStepVerification.swift */,
|
||||||
D0F53BE81E784A4800117362 /* ChangeAccountPhoneNumber.swift */,
|
D0F53BE81E784A4800117362 /* ChangeAccountPhoneNumber.swift */,
|
||||||
|
9FC8ADAA206BBFF10094F7B4 /* RecentWebSessions.swift */,
|
||||||
);
|
);
|
||||||
name = Settings;
|
name = Settings;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -2157,6 +2162,7 @@
|
|||||||
D0FA8BA11E1F99E1001E855B /* SecretChatFileReference.swift in Sources */,
|
D0FA8BA11E1F99E1001E855B /* SecretChatFileReference.swift in Sources */,
|
||||||
D0223A981EA564BD00211D94 /* MediaResourceNetworkStatsTag.swift in Sources */,
|
D0223A981EA564BD00211D94 /* MediaResourceNetworkStatsTag.swift in Sources */,
|
||||||
D07827BB1E00451F00071108 /* SearchPeers.swift in Sources */,
|
D07827BB1E00451F00071108 /* SearchPeers.swift in Sources */,
|
||||||
|
9FC8ADAB206BBFF10094F7B4 /* RecentWebSessions.swift in Sources */,
|
||||||
D0DC354E1DE368F7000195EB /* RequestChatContextResults.swift in Sources */,
|
D0DC354E1DE368F7000195EB /* RequestChatContextResults.swift in Sources */,
|
||||||
D0BC38771E40BAAA0044D6FE /* ManagedSynchronizePinnedChatsOperations.swift in Sources */,
|
D0BC38771E40BAAA0044D6FE /* ManagedSynchronizePinnedChatsOperations.swift in Sources */,
|
||||||
D0B843851DA6EDC4005F29E1 /* CachedChannelData.swift in Sources */,
|
D0B843851DA6EDC4005F29E1 /* CachedChannelData.swift in Sources */,
|
||||||
@ -2283,6 +2289,8 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
9FC8ADAC206BC00A0094F7B4 /* RecentWebSessions.swift in Sources */,
|
||||||
|
9FC8ADA9206BBD000094F7B4 /* SaveSecureIdValue.swift in Sources */,
|
||||||
9F10CE8C20613CDB002DD61A /* TelegramDeviceContactImportInfo.swift in Sources */,
|
9F10CE8C20613CDB002DD61A /* TelegramDeviceContactImportInfo.swift in Sources */,
|
||||||
9F10CE8B20613C78002DD61A /* SecretApiLayer73.swift in Sources */,
|
9F10CE8B20613C78002DD61A /* SecretApiLayer73.swift in Sources */,
|
||||||
C29340F41F5081280074991E /* UpdateGroupSpecificStickerset.swift in Sources */,
|
C29340F41F5081280074991E /* UpdateGroupSpecificStickerset.swift in Sources */,
|
||||||
|
68
TelegramCore/RecentWebSessions.swift
Normal file
68
TelegramCore/RecentWebSessions.swift
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
import Foundation
|
||||||
|
#if os(macOS)
|
||||||
|
import PostboxMac
|
||||||
|
import SwiftSignalKitMac
|
||||||
|
#else
|
||||||
|
import Postbox
|
||||||
|
import SwiftSignalKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public struct WebAuthorization : Equatable {
|
||||||
|
public let hash: Int64
|
||||||
|
public let botId: PeerId
|
||||||
|
public let domain: String
|
||||||
|
public let browser: String
|
||||||
|
public let platform: String
|
||||||
|
public let dateCreated: Int32
|
||||||
|
public let dateActive: Int32
|
||||||
|
public let ip: String
|
||||||
|
public let region: String
|
||||||
|
|
||||||
|
public static func ==(lhs: WebAuthorization, rhs: WebAuthorization) -> Bool {
|
||||||
|
return lhs.hash == rhs.hash && lhs.botId == rhs.botId && lhs.domain == rhs.domain && lhs.browser == rhs.browser && lhs.platform == rhs.platform && lhs.dateActive == rhs.dateActive && lhs.dateCreated == rhs.dateCreated && lhs.ip == rhs.ip && lhs.region == rhs.region
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func webSessions(network: Network) -> Signal<([WebAuthorization], [PeerId: Peer]), NoError> {
|
||||||
|
return network.request(Api.functions.account.getWebAuthorizations())
|
||||||
|
|> retryRequest
|
||||||
|
|> map { result -> ([WebAuthorization], [PeerId : Peer]) in
|
||||||
|
var sessions: [WebAuthorization] = []
|
||||||
|
var peers:[PeerId : Peer] = [:]
|
||||||
|
switch result {
|
||||||
|
case let .webAuthorizations(authorizations, users):
|
||||||
|
for authorization in authorizations {
|
||||||
|
switch authorization {
|
||||||
|
case let .webAuthorization(hash, botId, domain, browser, platform, dateCreated, dateActive, ip, region):
|
||||||
|
sessions.append(WebAuthorization(hash: hash, botId: PeerId(namespace: Namespaces.Peer.CloudUser, id: botId), domain: domain, browser: browser, platform: platform, dateCreated: dateCreated, dateActive: dateActive, ip: ip, region: region))
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for user in users {
|
||||||
|
let peer = TelegramUser(user: user)
|
||||||
|
peers[peer.id] = peer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (sessions, peers)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public func terminateWebSession(network: Network, hash: Int64) -> Signal<Bool, Void> {
|
||||||
|
return network.request(Api.functions.account.resetWebAuthorization(hash: hash)) |> retryRequest |> map { result in
|
||||||
|
switch result {
|
||||||
|
case .boolFalse:
|
||||||
|
return false
|
||||||
|
case .boolTrue:
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public func terminateAllWebSessions(network: Network) -> Signal<Void, Void> {
|
||||||
|
return network.request(Api.functions.account.resetWebAuthorizations()) |> retryRequest |> map {_ in}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,9 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import Postbox
|
#if os(macOS)
|
||||||
|
import PostboxMac
|
||||||
|
#else
|
||||||
|
import Postbox
|
||||||
|
#endif
|
||||||
|
|
||||||
public struct SecureFileMediaResourceId: MediaResourceId {
|
public struct SecureFileMediaResourceId: MediaResourceId {
|
||||||
let fileId: Int64
|
let fileId: Int64
|
||||||
|
Loading…
x
Reference in New Issue
Block a user