forked from parse-community/ParseUI-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPFSignUpView.h
156 lines (124 loc) · 4.95 KB
/
PFSignUpView.h
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
* Copyright (c) 2014, Parse, LLC. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
* copy, modify, and distribute this software in source code or binary form for use
* in connection with the web services and APIs provided by Parse.
*
* As with any software that integrates with the Parse platform, your use of
* this software is subject to the Parse Terms of Service
* [https://www.parse.com/about/terms]. This copyright notice shall be
* included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#import <UIKit/UIKit.h>
#import <ParseUI/ParseUIConstants.h>
NS_ASSUME_NONNULL_BEGIN
/**
`PFSignUpFields` bitmask specifies the sign up elements which are enabled in the view.
@see PFSignUpViewController
@see PFSignUpView
*/
typedef NS_OPTIONS(NSInteger, PFSignUpFields) {
/** Username and password fields. */
PFSignUpFieldsUsernameAndPassword = 0,
/** Email field. */
PFSignUpFieldsEmail = 1 << 0,
/** This field can be used for something else. */
PFSignUpFieldsAdditional = 1 << 1,
/** Sign Up Button */
PFSignUpFieldsSignUpButton = 1 << 2,
/** Dismiss Button */
PFSignUpFieldsDismissButton = 1 << 3,
/** Default value. Combines Username, Password, Email, Sign Up and Dismiss Buttons. */
PFSignUpFieldsDefault = (PFSignUpFieldsUsernameAndPassword |
PFSignUpFieldsEmail |
PFSignUpFieldsSignUpButton |
PFSignUpFieldsDismissButton)
};
/**
`PFSignUpFields`'s accessibity identifiers
@see PFSignUpView
*/
extern NSString *const PFSignUpViewUsernameFieldAccessibilityIdentifier;
extern NSString *const PFSignUpViewEmailFieldAccessibilityIdentifier;
extern NSString *const PFSignUpViewPasswordFieldAccessibilityIdentifier;
extern NSString *const PFSignUpViewAdditionalFieldAccessibilityIdentifier;
extern NSString *const PFSignUpViewSignUpButtonAccessibilityIdentifier;
extern NSString *const PFSignUpViewDismissButtonAccessibilityIdentifier;
@class PFTextField;
/**
The `PFSignUpView` class provides a standard sign up interface for authenticating a `PFUser`.
*/
@interface PFSignUpView : UIScrollView
///--------------------------------------
/// @name Creating SignUp View
///--------------------------------------
/**
Initializes the view with the specified sign up elements.
@param fields A bitmask specifying the sign up elements which are enabled in the view
@return An initialized `PFSignUpView` object or `nil` if the object couldn't be created.
@see PFSignUpFields
*/
- (instancetype)initWithFields:(PFSignUpFields)fields;
/**
The view controller that will present this view.
Used to lay out elements correctly when the presenting view controller has translucent elements.
*/
@property (nullable, nonatomic, weak) UIViewController *presentingViewController;
///--------------------------------------
/// @name Customizing the Logo
///--------------------------------------
/**
The logo. By default, it is the Parse logo.
*/
@property (nullable, nonatomic, strong) UIView *logo;
///--------------------------------------
/// @name Configure Username Behaviour
///--------------------------------------
/**
If email should be used to log in, instead of username
By default, this is set to `NO`.
*/
@property (nonatomic, assign) BOOL emailAsUsername;
///--------------------------------------
/// @name Sign Up Elements
///--------------------------------------
/**
The bitmask which specifies the enabled sign up elements in the view
*/
@property (nonatomic, assign, readonly) PFSignUpFields fields;
/**
The username text field.
*/
@property (nullable, nonatomic, strong, readonly) PFTextField *usernameField;
/**
The password text field.
*/
@property (nullable, nonatomic, strong, readonly) PFTextField *passwordField;
/**
The email text field. It is `nil` if the element is not enabled.
*/
@property (nullable, nonatomic, strong, readonly) PFTextField *emailField;
/**
The additional text field. It is `nil` if the element is not enabled.
This field is intended to be customized.
*/
@property (nullable, nonatomic, strong, readonly) PFTextField *additionalField;
/**
The sign up button. It is `nil` if the element is not enabled.
*/
@property (nullable, nonatomic, strong, readonly) UIButton *signUpButton;
/**
The dismiss button. It is `nil` if the element is not enabled.
*/
@property (nullable, nonatomic, strong, readonly) UIButton *dismissButton;
@end
NS_ASSUME_NONNULL_END