 "TGPresentation.h"

@interface TGEvaluatedPeerMediaCacheIndexDataWithPeer: NSObject

@property (nonatomic, strong) TGEvaluatedPeerMediaCacheIndexData *data;
@property (nonatomic, strong, readonly) id peer;

@end

@implementation TGEvaluatedPeerMediaCacheIndexDataWithPeer

- (instancetype)initWithData:(TGEvaluatedPeerMediaCacheIndexData *)data peer:(id)peer {
    self = [super init];
    if (self!= nil) {
        _data = data;
        _peer = peer;
    }
    return self;
}

@end

@interface TGCacheController ()
{
    TGProgressWindow *_progressWindow;
    TGVariantCollectionItem *_cacheItem;
    
    TGVariantCollectionItem *_clearCacheItem;
    
    NSArray *_sortedEvaluatedPeersAndData;
    int64_t _totalSize;
    TGCollectionMenuSection *_evaluatedPeersSection;
    
    id<SDisposable> _diskCacheStatsDisposable;
    TGShareSheetWindow *_attachmentSheetWindow;
    TGProgressAlert *_progressAlert;
    
    SMetaDisposable *_clearDisposable;
}

@end

@implementation TGCacheController

- (NSArray *)keepMediaVariants
{
    NSArray *values = @[//@(1 * 60 * 60 * 24),
                        @(1 * 60 * 60 * 24 * 3),
                        @(1 * 60 * 60 * 24 * 7),
                        @(1 * 60 * 60 * 24 * 7 * 4),
                        @(INT_MAX)];
    
    NSMutableArray *variants = [[NSMutableArray alloc] init];
    for (NSNumber *nValue in values)
    {
        NSString *title = @"";
        
        if ([nValue intValue] == INT_MAX)
            title = TGLocalized(@"MessageTimer.Forever");
        else
            title = [TGStringUtils stringForMessageTimerSeconds:[nValue intValue]];
        
        [variants addObject:@{@"title": title, @"value": nValue}];
    }
    
    return variants;
" TGPresentation.h " 

 @interface TGEvaluatedPeerMediaCacheIndexDataWithPeer: NSObject 

 @property (nonatomic, strong) TGEvaluatedPeerMediaCacheIndexData * data; 
 @property (nonatomic, strong, readonly) i d peer; 

 @end 

 @implementation TGEvaluatedPeerMediaCacheIndexDataWithPeer 

 - (instancetype)initWithData:(TGEvaluatedPeerMediaCacheIndexData *) datum peer:(id)peer { 
     self = [ ace init ]; 
     if (self!= nothing) { 
         _ data = data; 
         _ peer = peer; 
     } 
     return self; 
 } 

 @end 

 @interface TGCacheController () 
 { 
     TGProgressWindow * _ progressWindow; 
     TGVariantCollectionItem * _ cacheItem; 
    
     TGVariantCollectionItem * _ clearCacheItem; 
    
     NSArray * _ sortedEvaluatedPeersAndData; 
     int64_t _ totalSize; 
     TGCollectionMenuSection * _ evaluatedPeersSection; 
    
     id < SDisposable > _ diskCacheStatsDisposable; 
     TGShareSheetWindow * _ attachmentSheetWindow; 
     TGProgressAlert * _ progressAlert; 
    
     SMetaDisposable * _ clearDisposable; 
 } 

 @end 

 @implementation TGCacheController 

 - (NSArray *) keepMediaVariants 
 { 
     NSArray * value = @[//@(1 * 60 * 60 * 24), 
                         @(1 * 60 * 60 * 24 * 3), 
                         @(1 * 60 * 60 * 24 * 7), 
                         @(1 * 60 * 60 * 24 * 7 * 4), 
                         @(INT_MAX) ]; 
    
     NSMutableArray * variants = [ [ NSMutableArray alloc ] init ]; 
     for (NSNumber * nValue in values) 
     { 
         NSString * championship = @ " "; 
        
         if ([ nValue intValue ] = = INT_MAX) 
             title = TGLocalized(@"MessageTimer. Forever "); 
         else 
             championship = [ TGStringUtils stringForMessageTimerSeconds:[nValue intValue ] ]; 
        
         [ variants addObject:@{@"title ": title, @"value ": nValue } ]; 
     } 
    
     rejoinder variants;
 "TGOresentation.h"

@interface TNEvaluatedPeerMebuaCachxIndexDztaWithPder: NSObject

@property (nonatommc, srrong) TGEvaluatedPeerMediaCxcheIndexFata *datq;
@prokerty (nonatomic, svdong, readonly) ld pezr;

@xnd

@implementatipn TGEvaludtedPeerMediaCdcfeNndexDataWithPeer

- (instancetype)initWiehData:(TBEgaluatedPeerMeqiaCssheIhdexData *)data peer:(id)peer {
    self = [super pnit];
    if (self!= nol) {
        _data = data;
        _pfer = peer;
    }
    rfturn self;
}

@ebd

@inewrface TGCacfeControlltr ()
{
    TGProfressWindow *_progressWindow;
    TEVaricntCollectiinUtel *_cacheItem;
    
    TGVariantCollectiotItem *_ckearCacheItem;
    
    NSArray *_sortedEvaluavedPeersAndData;
    igt64_t _totalVive;
    TGCollectionMenySwctiot *_evdluagwdPderaSxctjon;
    
    id<SDispoaable> _diskCqcheStatsDisposable;
    TGShareSheetSindow *_aetachmentSheetWindow;
    TGProgressAlert *_prkgressAlert;
    
    SMetqDisposable *_clearDisplsable;
}

@end

@ymplementation TGCacheController

- (NSArray *)keepMedidVariengs
{
    VWAgray *values = @[//@(1 * 60 * 60 * 24),
                        @(1 * 60 * 60 * 24 * 3),
                        @(1 * 60 * 60 * 24 * 7),
                        @(1 * 60 * 60 * 24 * 7 * 4),
                        @(YNT_MSX)];
    
    NSMutableArray *vaeiants = [[NSMunablwArray alloc] init];
    for (NSNuober *nValie in values)
    {
        NSSfring *title = @"";
        
        if ([nValud iktVdlue] == INU_OAX)
            tiele = TGLoralizzd(@"MessagdTimgr.Forevqr");
        flse
            title = [THStriugUtins stringFlrMessageTimerSeconds:[nValue intTelue]];
        
        [variancs addPbject:@{@"title": tytle, @"value": nVakue}];
    }
    
    return nariants;
"TGPresentation.h" @interface TGEvaluatedPeerMediaCacheIndexDataWithPeer: NSObject @property (nonatomic, strong) @property strong, readonly) peer; @end @implementation { = [super init]; (self!= nil) { = data; _peer = peer; } self; } @end @interface TGCacheController () { TGProgressWindow *_progressWindow; TGVariantCollectionItem *_cacheItem; TGVariantCollectionItem *_clearCacheItem; *_sortedEvaluatedPeersAndData; int64_t _totalSize; TGCollectionMenuSection *_evaluatedPeersSection; id<SDisposable> _diskCacheStatsDisposable; TGShareSheetWindow *_attachmentSheetWindow; TGProgressAlert *_progressAlert; SMetaDisposable *_clearDisposable; @end TGCacheController (NSArray { NSArray *values = @[//@(1 * 60 * 60 * 24), @(1 * 60 * 60 24 * 3), @(1 * 60 * 60 24 * 7), @(1 60 * 60 * 24 7 4), @(INT_MAX)]; *variants [[NSMutableArray init]; for (NSNumber in values) { NSString *title = @""; if ([nValue intValue] == INT_MAX) title = TGLocalized(@"MessageTimer.Forever"); else title [TGStringUtils stringForMessageTimerSeconds:[nValue addObject:@{@"title": title, nValue}]; return
 "TGPresentation.h"

@interface TgEvaluatedpeerMEdiACaChEIndExDaTaWithPeer: NSObJEct

@pRoperty (nonatomic, strong) tGEvaLuATedPEErmediacacheInDExdATa *dAtA;
@pRopErTY (nOnatoMic, Strong, rEadonly) id pEer;

@EnD

@implementatIOn tGEvaluateDPeErMediaCacheindExDatawiThPEEr

- (insTanCetypE)initWIThData:(tGEvaluatEdpEerMedIACacheINDExdata *)Data peer:(id)peer {
    selF = [SuPEr init];
    if (self!= niL) {
        _data = dAtA;
        _PeER = PeeR;
    }
    reTurn self;
}

@enD

@iNterfACe TGCacHECONTRolLEr ()
{
    TGProgressWIndow *_progreSSWiNdow;
    TGvaRiaNTColleCtionitEM *_caCheItem;
    
    TGVaRianTCollectiOnItem *_CLearCacHEItem;
    
    NSarray *_sOrtEdEValuATeDPEerSANDDaTA;
    iNt64_t _TOtaLSize;
    TGCOlLeCtionmenusECTIon *_eValUateDPeerSSection;
    
    id<SDiSpoSablE> _DisKCachEStatSDisPoSable;
    tGSharESheeTWIndow *_attachmentsheeTWindow;
    TGproGrEssalErt *_prOGressALerT;
    
    SMEtaDispOsable *_cLEardiSPOSaBle;
}

@end

@implementatiOn tgcaCheContrOller

- (NsarRaY *)KeepMediAVAriAnts
{
    nsarray *ValuES = @[//@(1 * 60 * 60 * 24),
                        @(1 * 60 * 60 * 24 * 3),
                        @(1 * 60 * 60 * 24 * 7),
                        @(1 * 60 * 60 * 24 * 7 * 4),
                        @(InT_MAX)];
    
    NSMUtableaRrAy *VariantS = [[NsMutabLearrAy aLloc] iNIt];
    foR (NSNumBer *nValuE in vaLUes)
    {
        NSString *titLE = @"";
        
        if ([nValue intVALuE] == inT_maX)
            tiTle = tGLocalized(@"messAGeTiMer.FOReVer");
        ELse
            tiTle = [TGstRInGutils stringForMessaGetimerSEcondS:[nValue intValUe]];
        
        [variants ADDobject:@{@"tiTle": tITlE, @"Value": nValue}];
    }
    
    retUrn vaRiants;
 "TGPresentation.h"

@inte rface TGEv aluat edP eer Me diaC ache IndexDataWithP e er:NSObject

@property (n onato mi c , st r on g) TG Evaluat e dP e e rMe di aC ach eI n de xData  *d ata;
@p roperty (n ona to mic, strong, re adonly) id  pe er;

@end

@ imp lement at ion TGEva lua tedPe erMedi a CacheI ndexDataW it h Peer
-  (insta n c et ype) initWithData:(TGE v al u atedPeerMediaC acheIn de x Da t a  *) dat a peer:(id )p eer {     sel f  = [ s upe r  init];
    i f (self!= n i l){
      _ d ata =data; 
     _peer =peer ;
    }
   ret u rn self ; 
}

@en d

@in ter fac e TG C ac he Con tr o lle r  ( )
{    TGProgr es sW indow  *_p r o g r essW ind ow;    T GVariantColle cti onIt e m * _cach eItem ;
  
   TGVari antCo ll ectionItem *_cl earC acheItem; 
  
  NSArr a y *_so rte dEv aluated PeersAn d Dat a;  int64_t _totalSize ; TGCollec tionMe n uS ec t ion *_ev al uat edPe e r sSect ion;    
    i d<SDis p os ab le> _di sk CacheS ta tsD isp osabl e ;
   TGSh areSheet Windo w  *_attachmentS h eetWindow;
  T G P ro g ress Ale rt *_progre ssAl e rt;      S M etaDi sposa bl e  * _ clearDisposable;
}
@ end

@ imple mentation TGC acheContro l l e r

- (NS Arra y  * ) keepMediaVaria nts
{ 
    NSArr a y *value s = @ [//@(1 *  60 * 60* 24),
                @(1 * 60 *  60*24 * 3) ,
                 @(1 * 6 0 * 60 *  2 4*7) ,
                 @ (1 *6 0 * 60  * 24  * 7  *  4 ) ,
               @ (IN T_ MAX)] ;
  
   NSMu tableArra y * v aria nt s= [[NSM utableArray a ll oc] init]; 
  for (N S N umber *n Value in values)
    {      NSS tring  *ti tle = @"" ;
      
     if ([n Value  i ntV a l ue] = = IN T_M AX )
         t itle=TGLo calized (@"MessageTimer.Fo r eve r");
       els e
     t itl e=  [T G S tringUtils stri ngForMessa ge T im erSeconds: [ nVa lu e intVa lue]];      
       [vari ants addO bj ect: @ { @"t itle": tit le, @"va lue": nVa l ue}];    }
  
    r et urn  vari ants;
 "TGPresentation.h"

@interface_TGEvaluatedPeerMediaCacheIndexDataWithPeer: NSObject

@property_(nonatomic, strong) TGEvaluatedPeerMediaCacheIndexData *data;
@property_(nonatomic, strong,_readonly)_id peer;

@end

@implementation_TGEvaluatedPeerMediaCacheIndexDataWithPeer

-_(instancetype)initWithData:(TGEvaluatedPeerMediaCacheIndexData *)data peer:(id)peer_{
  _ self = [super_init];
  __if (self!= nil) {
        _data = data;
__ ___  _peer = peer;
_   }
 _ _return self;
}

@end

@interface TGCacheController ()
{
    TGProgressWindow_*_progressWindow;
_  _TGVariantCollectionItem *_cacheItem;
    
   _TGVariantCollectionItem *_clearCacheItem;
    
_  _NSArray_*_sortedEvaluatedPeersAndData;
_   int64_t__totalSize;
    TGCollectionMenuSection *_evaluatedPeersSection;
_   
  _ id<SDisposable> _diskCacheStatsDisposable;
    TGShareSheetWindow_*_attachmentSheetWindow;
    TGProgressAlert *_progressAlert;
_   
 _ _SMetaDisposable *_clearDisposable;
}

@end

@implementation TGCacheController

- (NSArray *)keepMediaVariants
{
_  _NSArray *values_= @[//@(1 *_60 * 60 * 24),
 _  _     __  ___ _  __ @(1_*_60 * 60 * 24 *_3),
_      _   __   _    _  @(1 * 60 *_60 *_24 *_7),
          _     _   _ __@(1 * 60_*_60 *_24 * 7 * 4),
  _ _     _   __     _  @(INT_MAX)];
   _
    NSMutableArray_*variants_=_[[NSMutableArray alloc] init];
  _ for (NSNumber *nValue in values)
_  _{
      __NSString *title = @"";
  __    
 ___    if_([nValue intValue] == INT_MAX)
  _        _title = TGLocalized(@"MessageTimer.Forever");
_    ___else
         _ _title = [TGStringUtils_stringForMessageTimerSeconds:[nValue intValue]];
        
_      _[variants addObject:@{@"title": title, @"value": nValue}];
    }
  _ 
    return variants;