Blame view

HDFwear/3rd/RTKOTASDK/RTKLEFoundation.framework/Headers/RTKAttemptAction.h 1.34 KB
75d24c15   yangbin   123
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  //
  //  RTKAttemptAction.h
  //  RTKLEFoundation
  //
  //  Created by jerome_gu on 2019/1/10.
  //  Copyright © 2019 Realtek. All rights reserved.
  //
  
  #import <Foundation/Foundation.h>
  
  #ifdef RTK_SDK_IS_STATIC_LIBRARY
  #import "RTKLEPackage.h"
  #else
  #import <RTKLEFoundation/RTKLEPackage.h>
  #endif
  
  NS_ASSUME_NONNULL_BEGIN
  
  /**
   * A generic action object which encapsulate action and completion block.
   */
  @interface RTKAttemptAction : NSObject
  
  /**
   * Identifier to identify this action.
   */
  @property (nonatomic, readonly) NSInteger ID;
  @property (nonatomic, readonly) NSInteger subID;
  
  @property (nonatomic) NSUInteger retryCount;
  @property (nonatomic) NSTimeInterval timeoutInterval;
  
  @property (readonly) BOOL isInProgress;
  
  @property (readonly) NSUInteger remainTryCount;
  
  
  - (instancetype)initWithID:(NSInteger)ID subID:(NSInteger)subID action:(BOOL(^)(NSError *_Nullable* err))action completion:(void(^)(BOOL success, NSError*_Nullable err, id _Nullable obj))handler;
  
  - (instancetype)initWithID:(NSInteger)ID action:(BOOL(^)(NSError *_Nullable* err))action completion:(void(^)(BOOL success, NSError*_Nullable err, id _Nullable obj))handler;
  
  - (void)resume;
  
  // will not trigger completion invoked.
  - (void)cancel;
  
  - (void)endCurrentTry;
  
  - (void)endEarlyWithSuccess:(BOOL)success error:(nullable NSError *)error userInfo:(nullable id)info;
  
  @end
  
  NS_ASSUME_NONNULL_END