1 |
efrain |
1 |
/*
|
|
|
2 |
* Copyright 2018 Google
|
|
|
3 |
*
|
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
|
6 |
* You may obtain a copy of the License at
|
|
|
7 |
*
|
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
9 |
*
|
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
13 |
* See the License for the specific language governing permissions and
|
|
|
14 |
* limitations under the License.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
#import <Foundation/Foundation.h>
|
|
|
18 |
|
|
|
19 |
#import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORLifecycle.h"
|
|
|
20 |
#import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORClock.h"
|
|
|
21 |
#import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORTargets.h"
|
|
|
22 |
|
|
|
23 |
NS_ASSUME_NONNULL_BEGIN
|
|
|
24 |
|
|
|
25 |
/** Options that define a set of upload conditions. This is used to help minimize end user data
|
|
|
26 |
* consumption impact.
|
|
|
27 |
*/
|
|
|
28 |
typedef NS_OPTIONS(NSInteger, GDTCORUploadConditions) {
|
|
|
29 |
|
|
|
30 |
/** An upload shouldn't be attempted, because there's no network. */
|
|
|
31 |
GDTCORUploadConditionNoNetwork = 1 << 0,
|
|
|
32 |
|
|
|
33 |
/** An upload would likely use mobile data. */
|
|
|
34 |
GDTCORUploadConditionMobileData = 1 << 1,
|
|
|
35 |
|
|
|
36 |
/** An upload would likely use wifi data. */
|
|
|
37 |
GDTCORUploadConditionWifiData = 1 << 2,
|
|
|
38 |
|
|
|
39 |
/** An upload uses some sort of network connection, but it's unclear which. */
|
|
|
40 |
GDTCORUploadConditionUnclearConnection = 1 << 3,
|
|
|
41 |
|
|
|
42 |
/** A high priority event has occurred. */
|
|
|
43 |
GDTCORUploadConditionHighPriority = 1 << 4,
|
|
|
44 |
};
|
|
|
45 |
|
|
|
46 |
/** This protocol defines the common interface for uploader implementations. */
|
|
|
47 |
@protocol GDTCORUploader <NSObject, GDTCORLifecycleProtocol>
|
|
|
48 |
|
|
|
49 |
@required
|
|
|
50 |
|
|
|
51 |
/** Uploads events to the backend using this specific backend's chosen format.
|
|
|
52 |
*
|
|
|
53 |
* @param conditions The conditions that the upload attempt is likely to occur under.
|
|
|
54 |
*/
|
|
|
55 |
- (void)uploadTarget:(GDTCORTarget)target withConditions:(GDTCORUploadConditions)conditions;
|
|
|
56 |
|
|
|
57 |
@end
|
|
|
58 |
|
|
|
59 |
NS_ASSUME_NONNULL_END
|