mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
[Batch Fetching] Add ASBatchFetchingDelegate (#281)
* Add ASBatchFetchingDelegate - In addition to checking remaining leading screens, ASBatchFetching now also calculates a remaining time and consults its delegate if needed. - The delegate can override the decision of ASBatchFetching, for example based on remaining time and average time of past batch requests. * Fix up tests * Update CHANGELOG
This commit is contained in:
27
Source/Details/ASBatchFetchingDelegate.h
Normal file
27
Source/Details/ASBatchFetchingDelegate.h
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// ASBatchFetchingDelegate.h
|
||||
// Texture
|
||||
//
|
||||
// Copyright (c) 2017-present, Pinterest, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@protocol ASBatchFetchingDelegate <NSObject>
|
||||
|
||||
/**
|
||||
* @abstract Determine if batch fetching should begin based on the remaining time.
|
||||
* If the delegate doesn't have enough information to confidently decide, it can take the given hint.
|
||||
*
|
||||
* @param remainingTime The amount of time left for user to reach the end of the scroll view's content.
|
||||
*
|
||||
* @param hint A hint for the delegate to fallback to.
|
||||
*/
|
||||
- (BOOL)shouldFetchBatchWithRemainingTime:(NSTimeInterval)remainingTime hint:(BOOL)hint;
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user