Home telegram - mtContext
Post
Cancel

telegram - mtContext

MTContext

class MTContext

@property (nonatomic, strong) id<MTKeychain> keychain;

@property (nonatomic, strong, readonly) id<MTSerialization> serialization;
@property (nonatomic, strong, readonly) MTApiEnvironment *apiEnvironment;
@property (nonatomic, readonly) bool isTestingEnvironment;
@property (nonatomic, readonly) bool useTempAuthKeys;

- (void)performBatchUpdates:(void (^)(void))block;

- (void)addChangeListener:(id<MTContextChangeListener>)changeListener;
- (void)removeChangeListener:(id<MTContextChangeListener>)changeListener;

- (void)setDiscoverBackupAddressListSignal:(MTSignal *)signal;

- (NSTimeInterval)globalTime;
- (NSTimeInterval)globalTimeDifference;
- (NSTimeInterval)globalTimeOffsetFromUTC;
- (void)setGlobalTimeDifference:(NSTimeInterval)globalTimeDifference;

// set seed address set for datacenter id
- (void)setSeedAddressSetForDatacenterWithId:(NSInteger)datacenterId seedAddressSet:(MTDatacenterAddressSet *)seedAddressSet;

// update address set for datacenter id
- (void)updateAddressSetForDatacenterWithId:(NSInteger)datacenterId addressSet:(MTDatacenterAddressSet *)addressSet forceUpdateSchemes:(bool)forceUpdateSchemes;

// add address for datacenter id
- (void)addAddressForDatacenterWithId:(NSInteger)datacenterId address:(MTDatacenterAddress *)address;

// update transport scheme for datacenter id
- (void)updateTransportSchemeForDatacenterWithId:(NSInteger)datacenterId transportScheme:(MTTransportScheme *)transportScheme media:(bool)media isProxy:(bool)isProxy;

// update auth info for datacenter id
- (void)updateAuthInfoForDatacenterWithId:(NSInteger)datacenterId authInfo:(MTDatacenterAuthInfo *)authInfo;

// query whether password input required for datacenter id
- (bool)isPasswordInputRequiredForDatacenterWithId:(NSInteger)datacenterId;

// update passwd input required for datacenter id
- (bool)updatePasswordInputRequiredForDatacenterWithId:(NSInteger)datacenterId required:(bool)required;

// schedule session cleanup for auth key id
- (void)scheduleSessionCleanupForAuthKeyId:(int64_t)authKeyId sessionInfo:(MTSessionInfo *)sessionInfo;

// collect session ids for cleanup with auth key id
- (void)collectSessionIdsForCleanupWithAuthKeyId:(int64_t)authKeyId completion:(void (^)(NSArray *sessionIds))completion;

// session ids deleted for auth key id
- (void)sessionIdsDeletedForAuthKeyId:(int64_t)authKeyId sessionIds:(NSArray *)sessionIds;

// query known datacenter ids
- (NSArray *)knownDatacenterIds;

// enumerate address sets for datacenters
- (void)enumerateAddressSetsForDatacenters:(void (^)(NSInteger datacenterId, MTDatacenterAddressSet *addressSet, BOOL *stop))block;

// query address set for datacenter id
- (MTDatacenterAddressSet *)addressSetForDatacenterWithId:(NSInteger)datacenterId;

// report transport scheme failure for datacenter id
- (void)reportTransportSchemeFailureForDatacenterId:(NSInteger)datacenterId transportScheme:(MTTransportScheme *)transportScheme;

// report transport scheme success for datacenter id
- (void)reportTransportSchemeSuccessForDatacenterId:(NSInteger)datacenterId transportScheme:(MTTransportScheme *)transportScheme;

// invalidate transport schemes for datacenter ids
- (void)invalidateTransportSchemesForDatacenterIds:(NSArray<NSNumber *> * _Nonnull)datacenterIds;

// invalidate transport schemes for all known datacenter ids
- (void)invalidateTransportSchemesForKnownDatacenterIds;

// choose a transport scheme for connection to datacenter id
- (MTTransportScheme * _Nullable)chooseTransportSchemeForConnectionToDatacenterId:(NSInteger)datacenterId schemes:(NSArray<MTTransportScheme *> * _Nonnull)schemes;

// query transport schemes with specified conditions
- (NSArray<MTTransportScheme *> * _Nonnull)transportSchemesForDatacenterWithId:(NSInteger)datacenterId media:(bool)media enforceMedia:(bool)enforceMedia isProxy:(bool)isProxy;

// discover and update transport scheme for datacenter id 
- (void)transportSchemeForDatacenterWithIdRequired:(NSInteger)datacenterId media:(bool)media;

// invalidate transport schemes with given conditions for datacenter id 
- (void)invalidateTransportSchemeForDatacenterId:(NSInteger)datacenterId transportScheme:(MTTransportScheme *)transportScheme isProbablyHttp:(bool)isProbablyHttp media:(bool)media;

// revalidate transport schemes with given conditions
- (void)revalidateTransportSchemeForDatacenterId:(NSInteger)datacenterId transportScheme:(MTTransportScheme *)transportScheme media:(bool)media;

// query auth info for datacenter id
- (MTDatacenterAuthInfo *)authInfoForDatacenterWithId:(NSInteger)datacenterId;

// public keys for datacenter id
- (NSArray<NSDictionary *> *)publicKeysForDatacenterWithId:(NSInteger)datacenterId;

// update public keys for datacenter id
- (void)updatePublicKeysForDatacenterWithId:(NSInteger)datacenterId publicKeys:(NSArray<NSDictionary *> *)publicKeys;

// fetch public keys for datacenter id
- (void)publicKeysForDatacenterWithIdRequired:(NSInteger)datacenterId;

// remove all auth tokens
- (void)removeAllAuthTokens;

// query auth token for datacenter id
- (id)authTokenForDatacenterWithId:(NSInteger)datacenterId;

// update auth token for datacenter id
- (void)updateAuthTokenForDatacenterWithId:(NSInteger)datacenterId authToken:(id)authToken;

// discover address set for datacenter id
- (void)addressSetForDatacenterWithIdRequired:(NSInteger)datacenterId;

// auth info is required for datacenter with datacenterId
- (void)authInfoForDatacenterWithIdRequired:(NSInteger)datacenterId isCdn:(bool)isCdn;

// temp auth key required for datacenter with datacenterid
- (void)tempAuthKeyForDatacenterWithIdRequired:(NSInteger)datacenterId keyType:(MTDatacenterAuthTempKeyType)keyType;

// auth token for datacenter with datacenterId required
// transfer authorization from masterDatacenterId to datacenterId if needed
- (void)authTokenForDatacenterWithIdRequired:(NSInteger)datacenterId authToken:(id)authToken masterDatacenterId:(NSInteger)masterDatacenterId;
This post is licensed under CC BY 4.0 by the author.