mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Support for updated accounts API
Implemented Notification Service Extension
This commit is contained in:
31
NotificationService/Data.swift
Normal file
31
NotificationService/Data.swift
Normal file
@@ -0,0 +1,31 @@
|
||||
import Foundation
|
||||
|
||||
enum Namespaces {
|
||||
struct Peer {
|
||||
static let CloudUser: PeerId.Namespace = 0
|
||||
static let CloudGroup: PeerId.Namespace = 1
|
||||
static let CloudChannel: PeerId.Namespace = 2
|
||||
}
|
||||
}
|
||||
|
||||
struct PeerId {
|
||||
typealias Namespace = Int32
|
||||
typealias Id = Int32
|
||||
|
||||
public let namespace: Namespace
|
||||
public let id: Id
|
||||
|
||||
public init(namespace: Namespace, id: Id) {
|
||||
self.namespace = namespace
|
||||
self.id = id
|
||||
}
|
||||
|
||||
public init(_ n: Int64) {
|
||||
self.namespace = Int32((n >> 32) & 0x7fffffff)
|
||||
self.id = Int32(bitPattern: UInt32(n & 0xffffffff))
|
||||
}
|
||||
|
||||
public func toInt64() -> Int64 {
|
||||
return (Int64(self.namespace) << 32) | Int64(bitPattern: UInt64(UInt32(bitPattern: self.id)))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user