added iOS source code
[wl-app.git] / iOS / Pods / GoogleUtilities / GoogleUtilities / AppDelegateSwizzler / Private / GULAppDelegateSwizzler.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 <Foundation/Foundation.h>
18
19 @protocol UIApplicationDelegate;
20
21 NS_ASSUME_NONNULL_BEGIN
22
23 typedef NSString *const GULAppDelegateInterceptorID;
24
25 /** This class contains methods that isa swizzle the app delegate. */
26 @interface GULAppDelegateSwizzler : NSProxy
27
28 /** Registers an app delegate interceptor whose methods will be invoked as they're invoked on the
29  *  original app delegate.
30  *
31  *  @param interceptor An instance of a class that conforms to the UIApplicationDelegate protocol.
32  *      The interceptor is NOT retained.
33  *  @return A unique GULAppDelegateInterceptorID if interceptor was successfully registered; nil
34  *      if it fails.
35  */
36 + (nullable GULAppDelegateInterceptorID)registerAppDelegateInterceptor:
37     (id<UIApplicationDelegate>)interceptor;
38
39 /** Unregisters an interceptor with the given ID if it exists.
40  *
41  *  @param interceptorID The object that was generated when the interceptor was registered.
42  */
43 + (void)unregisterAppDelegateInterceptorWithID:(GULAppDelegateInterceptorID)interceptorID;
44
45 /** This method ensures that the original app delegate has been proxied. Call this before
46  *  registering your interceptor. This method is safe to call multiple times (but it only proxies
47  *  the app delegate once).
48  */
49 + (void)proxyOriginalDelegate NS_EXTENSION_UNAVAILABLE(
50     "App delegate proxy doesn't support extensions.");
51
52 /** Indicates whether app delegate proxy is explicitly disabled or enabled. Enabled by default.
53  *
54  *  @return YES if AppDelegateProxy is Enabled, NO otherwise.
55  */
56 + (BOOL)isAppDelegateProxyEnabled;
57
58 /** Do not initialize this class. */
59 - (instancetype)init NS_UNAVAILABLE;
60
61 NS_ASSUME_NONNULL_END
62
63 @end