added iOS source code
[wl-app.git] / iOS / Pods / GoogleUtilities / GoogleUtilities / AppDelegateSwizzler / Internal / GULAppDelegateSwizzler_Private.h
1 /*
2  * Copyright 2018 Google LLC
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 <GoogleUtilities/GULAppDelegateSwizzler.h>
18 #import <GoogleUtilities/GULMutableDictionary.h>
19
20 @class UIApplication;
21
22 NS_ASSUME_NONNULL_BEGIN
23
24 @interface GULAppDelegateSwizzler ()
25
26 /** Returns the current sharedApplication.
27  *
28  *  @return the current UIApplication if in an app, or nil if in extension or if it doesn't exist.
29  */
30 + (nullable UIApplication *)sharedApplication;
31
32 /** ISA Swizzles the given appDelegate as the original app delegate would be.
33  *
34  *  @param appDelegate The object that needs to be isa swizzled. This should conform to the
35  *      UIApplicationDelegate protocol.
36  */
37 + (void)proxyAppDelegate:(id<UIApplicationDelegate>)appDelegate;
38
39 /** Returns a dictionary containing interceptor IDs mapped to a GULZeroingWeakContainer.
40  *
41  *  @return A dictionary of the form {NSString : GULZeroingWeakContainer}, where the NSString is
42  *      the interceptorID.
43  */
44 + (GULMutableDictionary *)interceptors;
45
46 #ifdef GUL_APP_DELEGATE_TESTING  // Methods only used in tests.
47
48 /** Deletes all the registered interceptors. */
49 + (void)clearInterceptors;
50
51 /** Resets the token that prevents the app delegate proxy from being isa swizzled multiple times. */
52 + (void)resetProxyOriginalDelegateOnceToken;
53
54 /** Returns the original app delegate that was proxied.
55  *
56  *  @return The original app delegate instance that was proxied.
57  */
58 + (id<UIApplicationDelegate>)originalDelegate;
59
60 #endif  // GUL_APP_DELEGATE_TESTING
61
62 @end
63
64 NS_ASSUME_NONNULL_END