forked from germc/Atlas-iOS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ATLAddressBarViewController.h
147 lines (123 loc) · 6.08 KB
/
ATLAddressBarViewController.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
//
// ATLUIAddressBarController.h
// Atlas
//
// Created by Kevin Coleman on 10/27/14.
// Copyright (c) 2015 Layer. All rights reserved.
//
// 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>
#import "ATLAddressBarView.h"
#import "ATLParticipant.h"
@class ATLAddressBarViewController;
///---------------------------------------
/// @name Delegate
///---------------------------------------
@protocol ATLAddressBarViewControllerDelegate <NSObject>
@optional
/**
@abstract Informs the delegate that a user began searching by typing in the `LYRAddressBarTextView`.
@param addressBarViewController The `ATLAddressBarViewController` presenting the `ATLAddressBarTextView`.
*/
- (void)addressBarViewControllerDidBeginSearching:(ATLAddressBarViewController *)addressBarViewController;
/**
@abstract Informs the delegate that the user made a participant selection.
@param addressBarViewController The `ATLAddressBarViewController` in which the selection occurred.
@param participant The participant who was selected and added to the address bar.
@discussion Upon selection, the participant's full name will be appended to any existing text in the `ATLAddressBarTextView`.
The set of participants represents the identifiers for all currently displayed participants.
*/
- (void)addressBarViewController:(ATLAddressBarViewController *)addressBarViewController didSelectParticipant:(id<ATLParticipant>)participant;
/**
@abstract Informs the delegate that the user removed a participant from the address bar.
@param addressBarViewController The `ATLAddressBarViewController` in which the removal occurred.
@param participant The participant who was removed.
*/
- (void)addressBarViewController:(ATLAddressBarViewController *)addressBarViewController didRemoveParticipant:(id<ATLParticipant>)participant;
/**
@abstract Informs the delegate that the user finished searching.
@param addressBarViewController The `ATLAddressBarViewController` in which the search occurred.
@discussion Searching ends when the user either selects a participant or removes all participants from the `ATLAddressBarTextView`.
*/
- (void)addressBarViewControllerDidEndSearching:(ATLAddressBarViewController *)addressBarViewController;
/**
@abstract Informs the delegate that the user tapped on the `addContactsButton`.
@param addressBarViewController The `ATLAddressBarViewController` in which the tap occurred.
@param addContactsButton The button that was tapped.
*/
- (void)addressBarViewController:(ATLAddressBarViewController *)addressBarViewController didTapAddContactsButton:(UIButton *)addContactsButton;
/**
@abstract Informs the delegate that the user tapped on the controller while in a disabled state.
@param addressBarViewController The `ATLAddressBarViewController` in which the tap occurred.
*/
- (void)addressBarViewControllerDidSelectWhileDisabled:(ATLAddressBarViewController *)addressBarViewController;
/**
@abstract Asks the data source for an NSSet of participants given a search string.
@param addressBarViewController The `ATLAddressBarViewController` in which the tap occurred.
@param searchText The text upon which a participant search should be performed.
@param completion The completion block to be called upon search completion.
@discussion Search should be performed across each `ATLParticipant` object's fullName property.
*/
- (void)addressBarViewController:(ATLAddressBarViewController *)addressBarViewController searchForParticipantsMatchingText:(NSString *)searchText completion:(void (^)(NSArray *participants))completion;
@end
/**
@abstract The `ATLAddressBarViewController` class presents an interface that provides for displaying an address bar
in an `ATLConversationViewController`.
@discussion The class handles displaying the address bar in addition to a table view of participants in response to user search input.
When a participant is selected, the class appends that participant's full name to any existing text currently displayed. It also allows
for the entire participant name to be highlighted in response to a tap. The bar's design and functionality closely correlates with the
design and functionality of the address bar in Messages.
*/
@interface ATLAddressBarViewController : UIViewController
/**
@abstract The object to be informed of specific events that occur within the controller.
*/
@property (nonatomic, weak) id<ATLAddressBarViewControllerDelegate> delegate;
/**
@abstract The `ATLAddressBarView` displays the `ATLAddressBarTextView` in which the actual text input occurs. It also displays
a UIButton object represented by the `addContactButton` property.
*/
@property (nonatomic) ATLAddressBarView *addressBarView;
///------------------------------------
// @name Managing Participant Selection
///------------------------------------
/**
@abstract An ordered set of the currently selected participants.
*/
@property (nonatomic) NSOrderedSet *selectedParticipants;
/**
@abstract Informs the receiver that a selection occurred outside of the controller and a participant should be added to the address
bar.
@param participant The participant to select.
*/
- (void)selectParticipant:(id<ATLParticipant>)participant;
///-------------------------
/// @name Reloading the View
///-------------------------
/**
@abstract Tells the receiver to reload the view with the latest details of the participants.
*/
- (void)reloadView;
///----------------------
/// @name Disabling Input
///----------------------
/**
@abstract Disables user input and searching.
*/
- (void)disable;
/**
@abstract A boolean indicating whether or not the receiver is in a disabled state.
*/
- (BOOL)isDisabled;
@end