1 |
efrain |
1 |
/*
|
|
|
2 |
* Copyright 2019 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/GDTCORPlatform.h"
|
|
|
20 |
|
|
|
21 |
@class GDTCOREvent;
|
|
|
22 |
|
|
|
23 |
NS_ASSUME_NONNULL_BEGIN
|
|
|
24 |
|
|
|
25 |
/** A protocol defining the lifecycle events objects in the library must respond to immediately. */
|
|
|
26 |
@protocol GDTCORLifecycleProtocol <NSObject>
|
|
|
27 |
|
|
|
28 |
@optional
|
|
|
29 |
|
|
|
30 |
/** Indicates an imminent app termination in the rare occurrence when -applicationWillTerminate: has
|
|
|
31 |
* been called.
|
|
|
32 |
*
|
|
|
33 |
* @param app The GDTCORApplication instance.
|
|
|
34 |
*/
|
|
|
35 |
- (void)appWillTerminate:(GDTCORApplication *)app;
|
|
|
36 |
|
|
|
37 |
/** Indicates that the app is moving to background and eventual suspension or the current UIScene is
|
|
|
38 |
* deactivating.
|
|
|
39 |
*
|
|
|
40 |
* @param app The GDTCORApplication instance.
|
|
|
41 |
*/
|
|
|
42 |
- (void)appWillBackground:(GDTCORApplication *)app;
|
|
|
43 |
|
|
|
44 |
/** Indicates that the app is resuming operation or a UIScene is activating.
|
|
|
45 |
*
|
|
|
46 |
* @param app The GDTCORApplication instance.
|
|
|
47 |
*/
|
|
|
48 |
- (void)appWillForeground:(GDTCORApplication *)app;
|
|
|
49 |
|
|
|
50 |
@end
|
|
|
51 |
|
|
|
52 |
/** This class manages the library's response to app lifecycle events.
|
|
|
53 |
*
|
|
|
54 |
* When backgrounding, the library doesn't stop processing events, it's just that several background
|
|
|
55 |
* tasks will end up being created for every event that's sent, and the stateful objects of the
|
|
|
56 |
* library (GDTCORStorage and GDTCORUploadCoordinator instances) will deserialize themselves from
|
|
|
57 |
* and to disk before and after every operation, respectively.
|
|
|
58 |
*/
|
|
|
59 |
@interface GDTCORLifecycle : NSObject <GDTCORApplicationDelegate>
|
|
|
60 |
|
|
|
61 |
@end
|
|
|
62 |
|
|
|
63 |
NS_ASSUME_NONNULL_END
|