aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Auth/Source/FIRAuthWebViewController.h
blob: 4bf9678cae9287ba1dadc5f2414e6c50a9f4549b (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * Copyright 2017 Google
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#import <UIKit/UIKit.h>

@class FIRAuthWebViewController;

NS_ASSUME_NONNULL_BEGIN

/** @protocol FIRAuthWebViewControllerDelegate
    @brief Defines a delegate for FIRAuthWebViewController
 */
@protocol FIRAuthWebViewControllerDelegate <NSObject>

/** @fn webViewController:canHandleURL:
    @brief Determines if a URL should be handled by the delegate.
    @param URL The URL to handle.
    @return Whether the URL could be handled or not.
 */
- (BOOL)webViewController:(FIRAuthWebViewController *)webViewController canHandleURL:(NSURL *)URL;

/** @fn webViewControllerDidCancel:
    @brief Notifies the delegate that the web view controller is being cancelled by the user.
    @param webViewController The web view controller in question.
 */
- (void)webViewControllerDidCancel:(FIRAuthWebViewController *)webViewController;

/** @fn webViewController:didFailWithError:
    @brief Notifies the delegate that the web view controller failed to load a page.
    @param webViewController The web view controller in question.
    @param error The error that has occurred.
 */
- (void)webViewController:(FIRAuthWebViewController *)webViewController
         didFailWithError:(NSError *)error;

@end

/** @class FIRAuthWebViewController
    @brief Reponsible for creating a UIViewController for presenting a FIRAutWebView.
 */
@interface FIRAuthWebViewController : UIViewController

/** @fn initWithNibName:bundle:
 *  @brief Please call initWithURL:delegate:
 */
- (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil
                         bundle:(nullable NSBundle *)nibBundleOrNil NS_UNAVAILABLE;

/** @fn initWithCoder:
 *  @brief Please call initWithURL:delegate:
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;

- (instancetype)initWithURL:(NSURL *)URL
                   delegate:(__weak id<FIRAuthWebViewControllerDelegate>)delegate
    NS_DESIGNATED_INITIALIZER;

@end

NS_ASSUME_NONNULL_END