blob: 4986aad32a32626c0879dbd44022a4624865ef9b [file] [log] [blame]
Alexandre Lision8521baa2015-03-13 11:08:00 -04001/*
Alexandre Lision9fe374b2016-01-06 10:17:31 -05002 * Copyright (C) 2015-2016 Savoir-faire Linux Inc.
Alexandre Lision8521baa2015-03-13 11:08:00 -04003 * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Alexandre Lision8521baa2015-03-13 11:08:00 -040018 */
Alexandre Lision5855b6a2015-02-03 11:31:05 -050019#import "RingWindowController.h"
Alexandre Lision0f66bd32016-01-18 11:30:45 -050020#import <QuartzCore/QuartzCore.h>
Alexandre Lisionfd0d6c82016-03-29 17:06:54 -040021#include <qrencode.h>
Anthony Léonard79597602017-11-13 15:47:09 -050022#include <memory>
Alexandre Lision0f66bd32016-01-18 11:30:45 -050023
24//Qt
25#import <QItemSelectionModel>
26#import <QItemSelection>
Alexandre Lision5855b6a2015-02-03 11:31:05 -050027
Alexandre Lisionbb5c2462015-07-30 12:55:37 -040028//LRC
Alexandre Lision5855b6a2015-02-03 11:31:05 -050029#import <callmodel.h>
30#import <account.h>
Alexandre Lision91d11e52015-03-20 17:42:05 -040031#import <call.h>
Alexandre Lision0f66bd32016-01-18 11:30:45 -050032#import <recentmodel.h>
Kateryna Kostiuk312f9132017-04-18 12:09:06 -040033#import <AvailableAccountModel.h>
Anthony Léonard79597602017-11-13 15:47:09 -050034#import <api/lrc.h>
Anthony Léonard49cb2912017-11-13 16:15:39 -050035#import <api/account.h>
Olivier Soldano994971f2017-12-05 16:30:12 -050036#import <api/newaccountmodel.h>
37#import <api/newcallmodel.h>
38#import <api/behaviorcontroller.h>
39#import <api/conversation.h>
40
Alexandre Lision5855b6a2015-02-03 11:31:05 -050041
Alexandre Lision624b1a82016-09-11 19:29:01 -040042// Ring
Alexandre Lision745e4d62015-03-22 20:03:10 -040043#import "AppDelegate.h"
Alexandre Lisionc65310c2015-04-23 16:44:23 -040044#import "Constants.h"
Alexandre Lision58cab672015-06-09 15:25:40 -040045#import "CurrentCallVC.h"
Alexandre Lision624b1a82016-09-11 19:29:01 -040046#import "MigrateRingAccountsWC.h"
Alexandre Lision0f66bd32016-01-18 11:30:45 -050047#import "ConversationVC.h"
Alexandre Lisionbfa68f62015-09-10 08:38:42 -040048#import "PreferencesWC.h"
Alexandre Lisiona3a43dc2017-03-30 16:21:30 -040049#import "SmartViewVC.h"
Alexandre Lisionfd0d6c82016-03-29 17:06:54 -040050#import "views/IconButton.h"
Alexandre Lisionbfa68f62015-09-10 08:38:42 -040051#import "views/NSColor+RingTheme.h"
Alexandre Lisione77f6f92016-04-17 23:39:39 -040052#import "views/BackgroundView.h"
Kateryna Kostiuk13b76882017-03-30 09:18:44 -040053#import "ChooseAccountVC.h"
Alexandre Lision2db8f472015-07-22 15:05:46 -040054
Kateryna Kostiuk13b76882017-03-30 09:18:44 -040055@interface RingWindowController () <MigrateRingAccountsDelegate, NSToolbarDelegate>
Alexandre Lision624b1a82016-09-11 19:29:01 -040056
57@property (retain) MigrateRingAccountsWC* migrateWC;
58
59@end
60
Alexandre Lisionbfa68f62015-09-10 08:38:42 -040061@implementation RingWindowController {
Alexandre Lision5855b6a2015-02-03 11:31:05 -050062
Alexandre Lisionfd0d6c82016-03-29 17:06:54 -040063 __unsafe_unretained IBOutlet NSLayoutConstraint* centerYQRCodeConstraint;
64 __unsafe_unretained IBOutlet NSLayoutConstraint* centerYWelcomeContainerConstraint;
65 __unsafe_unretained IBOutlet NSView* welcomeContainer;
Alexandre Lision1abdf582016-02-09 14:21:19 -050066 __unsafe_unretained IBOutlet NSView* callView;
67 __unsafe_unretained IBOutlet NSTextField* ringIDLabel;
68 __unsafe_unretained IBOutlet NSButton* shareButton;
Alexandre Lisionfd0d6c82016-03-29 17:06:54 -040069 __unsafe_unretained IBOutlet NSImageView* qrcodeView;
Alexandre Lision58cab672015-06-09 15:25:40 -040070
Anthony Léonard79597602017-11-13 15:47:09 -050071 std::unique_ptr<lrc::api::Lrc> lrc_;
72
Alexandre Lisionfd0d6c82016-03-29 17:06:54 -040073 PreferencesWC* preferencesWC;
Alexandre Lisiona3a43dc2017-03-30 16:21:30 -040074 IBOutlet SmartViewVC* smartViewVC;
Alexandre Lisione77f6f92016-04-17 23:39:39 -040075
Alexandre Lision0f66bd32016-01-18 11:30:45 -050076 CurrentCallVC* currentCallVC;
77 ConversationVC* offlineVC;
Kateryna Kostiukdb1f3a12017-04-24 12:08:28 -040078 // toolbar menu items
Kateryna Kostiuk13b76882017-03-30 09:18:44 -040079 ChooseAccountVC* chooseAccountVC;
Alexandre Lisionbfa68f62015-09-10 08:38:42 -040080}
Alexandre Lision58cab672015-06-09 15:25:40 -040081
Kateryna Kostiukdb1f3a12017-04-24 12:08:28 -040082static NSString* const kPreferencesIdentifier = @"PreferencesIdentifier";
83NSString* const kChangeAccountToolBarItemIdentifier = @"ChangeAccountToolBarItemIdentifier";
Alexandre Lisionc5148052015-03-04 15:10:35 -050084
Alexandre Lision5855b6a2015-02-03 11:31:05 -050085- (void)windowDidLoad {
86 [super windowDidLoad];
Alexandre Lision4dfcafc2015-08-20 12:43:23 -040087 [self.window setMovableByWindowBackground:YES];
Alexandre Lision58cab672015-06-09 15:25:40 -040088
Alexandre Lisione77f6f92016-04-17 23:39:39 -040089 [self.window setBackgroundColor:[NSColor colorWithRed:242.0/255 green:242.0/255 blue:242.0/255 alpha:1.0]];
Kateryna Kostiuk13b76882017-03-30 09:18:44 -040090 self.window.titleVisibility = NSWindowTitleHidden;
Alexandre Lisione77f6f92016-04-17 23:39:39 -040091
Anthony Léonard79597602017-11-13 15:47:09 -050092 lrc_ = std::make_unique<lrc::api::Lrc>();
93
Alexandre Lision0f66bd32016-01-18 11:30:45 -050094 currentCallVC = [[CurrentCallVC alloc] initWithNibName:@"CurrentCall" bundle:nil];
Anthony Léonard8585cc02017-12-28 14:03:45 -050095 offlineVC = [[ConversationVC alloc] initWithNibName:@"Conversation" bundle:nil delegate:self];
Kateryna Kostiukdb1f3a12017-04-24 12:08:28 -040096 // toolbar items
Anthony Léonard9bebf1d2017-12-21 14:33:51 -050097 chooseAccountVC = [[ChooseAccountVC alloc] initWithNibName:@"ChooseAccount" bundle:nil model:&(lrc_->getAccountModel()) delegate:self];
Alexandre Lision58cab672015-06-09 15:25:40 -040098 [callView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
Alexandre Lision0f66bd32016-01-18 11:30:45 -050099 [[currentCallVC view] setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
100 [[offlineVC view] setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
Alexandre Lision58cab672015-06-09 15:25:40 -0400101
Alexandre Lision0f66bd32016-01-18 11:30:45 -0500102 [callView addSubview:[currentCallVC view] positioned:NSWindowAbove relativeTo:nil];
103 [callView addSubview:[offlineVC view] positioned:NSWindowAbove relativeTo:nil];
Alexandre Lision16d9c0a2015-08-10 12:05:15 -0400104
Alexandre Lision0f66bd32016-01-18 11:30:45 -0500105 [currentCallVC initFrame];
106 [offlineVC initFrame];
Anthony Léonard72128c92017-12-26 16:48:39 -0500107 @try {
108 [smartViewVC setConversationModel: [chooseAccountVC selectedAccount].conversationModel.get()];
109 }
110 @catch (NSException *ex) {
111 NSLog(@"Caught exception %@: %@", [ex name], [ex reason]);
112 }
Alexandre Lisionbb5c2462015-07-30 12:55:37 -0400113
Anthony Léonard49cb2912017-11-13 16:15:39 -0500114 // Fresh run, we need to make sure RingID appears
115 [shareButton sendActionOn:NSLeftMouseDownMask];
116
Olivier Soldano994971f2017-12-05 16:30:12 -0500117 [self connect];
Anthony Léonard49cb2912017-11-13 16:15:39 -0500118 [self updateRingID];
119 // display accounts to select
120 NSToolbar *toolbar = self.window.toolbar;
121 toolbar.delegate = self;
122 [toolbar insertItemWithItemIdentifier:kChangeAccountToolBarItemIdentifier atIndex:1];
Alexandre Lision0f66bd32016-01-18 11:30:45 -0500123}
124
125- (void) connect
126{
Olivier Soldano994971f2017-12-05 16:30:12 -0500127 QObject::connect(&lrc_->getBehaviorController(),
128 &lrc::api::BehaviorController::showCallView,
129 [self](const std::string accountId,
130 const lrc::api::conversation::Info convInfo){
131 auto* accInfo = &lrc_->getAccountModel().getAccountInfo(accountId);
132 [currentCallVC setCurrentCall:convInfo.callId
133 conversation:convInfo.uid
134 account:accInfo];
Anthony Léonard9bebf1d2017-12-21 14:33:51 -0500135 [smartViewVC selectConversation: convInfo model:accInfo->conversationModel.get()];
Olivier Soldano994971f2017-12-05 16:30:12 -0500136 [currentCallVC animateIn];
137 [offlineVC animateOut];
Alexandre Lision0f66bd32016-01-18 11:30:45 -0500138 });
Alexandre Lision210fe212016-01-27 11:15:13 -0500139
Olivier Soldano994971f2017-12-05 16:30:12 -0500140 QObject::connect(&lrc_->getBehaviorController(),
141 &lrc::api::BehaviorController::showIncomingCallView,
142 [self](const std::string accountId,
143 const lrc::api::conversation::Info convInfo){
144 auto* accInfo = &lrc_->getAccountModel().getAccountInfo(accountId);
145 [currentCallVC setCurrentCall:convInfo.callId
146 conversation:convInfo.uid
147 account:accInfo];
Anthony Léonard9bebf1d2017-12-21 14:33:51 -0500148 [smartViewVC selectConversation: convInfo model:accInfo->conversationModel.get()];
Olivier Soldano994971f2017-12-05 16:30:12 -0500149 [currentCallVC animateIn];
Kateryna Kostiukabf4e272017-04-18 14:18:00 -0400150 [offlineVC animateOut];
Kateryna Kostiuk13b76882017-03-30 09:18:44 -0400151 });
Anthony Léonard2382b562017-12-13 15:51:28 -0500152
153 QObject::connect(&lrc_->getBehaviorController(),
154 &lrc::api::BehaviorController::showChatView,
155 [self](const std::string& accountId,
156 const lrc::api::conversation::Info& convInfo){
157 auto& accInfo = lrc_->getAccountModel().getAccountInfo(accountId);
158 [offlineVC setConversationUid:convInfo.uid model:accInfo.conversationModel.get()];
Anthony Léonard9bebf1d2017-12-21 14:33:51 -0500159 [smartViewVC selectConversation: convInfo model:accInfo.conversationModel.get()];
Anthony Léonard2382b562017-12-13 15:51:28 -0500160 [offlineVC animateIn];
161 [currentCallVC animateOut];
162 });
Alexandre Lisionbb5c2462015-07-30 12:55:37 -0400163}
164
165/**
166 * Implement the necessary logic to choose which Ring ID to display.
167 * This tries to choose the "best" ID to show
168 */
169- (void) updateRingID
170{
Anthony Léonard72128c92017-12-26 16:48:39 -0500171 @try {
172 auto& account = [chooseAccountVC selectedAccount];
Alexandre Lisionbb5c2462015-07-30 12:55:37 -0400173
Anthony Léonard72128c92017-12-26 16:48:39 -0500174 [ringIDLabel setStringValue:@""];
Anthony Léonard49cb2912017-11-13 16:15:39 -0500175
Anthony Léonard72128c92017-12-26 16:48:39 -0500176 if(account.profileInfo.type != lrc::api::profile::Type::RING) {
177 self.hideRingID = YES;
178 return;
179 }
180 self.hideRingID = NO;
181 auto& registeredName = account.registeredName;
182 auto& ringID = account.profileInfo.uri;
183 NSString* uriToDisplay = nullptr;
184 if (!registeredName.empty()) {
185 uriToDisplay = @(registeredName.c_str());
186 } else {
187 uriToDisplay = @(ringID.c_str());
188 }
189 [ringIDLabel setStringValue:uriToDisplay];
190 [self drawQRCode:@(ringID.c_str())];
Alexandre Lisionbb5c2462015-07-30 12:55:37 -0400191 }
Anthony Léonard72128c92017-12-26 16:48:39 -0500192 @catch (NSException *ex) {
193 NSLog(@"Caught exception %@: %@", [ex name], [ex reason]);
194 self.hideRingID = NO;
195 [ringIDLabel setStringValue:@"No account available"];
Alexandre Lision313427f2016-11-24 21:04:04 -0500196 }
Alexandre Lision5855b6a2015-02-03 11:31:05 -0500197}
198
Alexandre Lision1abdf582016-02-09 14:21:19 -0500199- (IBAction)shareRingID:(id)sender {
200 NSSharingServicePicker* sharingServicePicker = [[NSSharingServicePicker alloc] initWithItems:[NSArray arrayWithObject:[ringIDLabel stringValue]]];
Alexandre Lisionfd0d6c82016-03-29 17:06:54 -0400201 [sharingServicePicker setDelegate:self];
Alexandre Lision1abdf582016-02-09 14:21:19 -0500202 [sharingServicePicker showRelativeToRect:[sender bounds]
203 ofView:sender
204 preferredEdge:NSMinYEdge];
205}
206
Alexandre Lisionfd0d6c82016-03-29 17:06:54 -0400207- (IBAction)toggleQRCode:(id)sender {
208 // Toggle pressed state of QRCode button
209 [sender setPressed:![sender isPressed]];
Kateryna Kostiuk65ba43e2017-03-30 15:10:04 -0400210 [self showQRCode:[sender isPressed]];
Alexandre Lision313427f2016-11-24 21:04:04 -0500211}
212
213/**
214 * Draw the QRCode in the qrCodeView
215 */
Kateryna Kostiuk65ba43e2017-03-30 15:10:04 -0400216- (void)drawQRCode:(NSString*) uriToDraw
Alexandre Lision313427f2016-11-24 21:04:04 -0500217{
Kateryna Kostiuk65ba43e2017-03-30 15:10:04 -0400218 auto qrCode = QRcode_encodeString(uriToDraw.UTF8String,
Alexandre Lisionfd0d6c82016-03-29 17:06:54 -0400219 0,
220 QR_ECLEVEL_L, // Lowest level of error correction
221 QR_MODE_8, // 8-bit data mode
222 1);
223 if (!qrCode) {
224 return;
225 }
226
Alexandre Lision313427f2016-11-24 21:04:04 -0500227 unsigned char *data = 0;
228 int width;
229 data = qrCode->data;
230 width = qrCode->width;
231 int qr_margin = 3;
232
Alexandre Lisionfd0d6c82016-03-29 17:06:54 -0400233 CGFloat size = qrcodeView.frame.size.width;
234
235 // create context
236 CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
237 CGContextRef ctx = CGBitmapContextCreate(0, size, size, 8, size * 4, colorSpace, kCGImageAlphaPremultipliedLast);
238
239 CGAffineTransform translateTransform = CGAffineTransformMakeTranslation(0, -size);
240 CGAffineTransform scaleTransform = CGAffineTransformMakeScale(1, -1);
241 CGContextConcatCTM(ctx, CGAffineTransformConcat(translateTransform, scaleTransform));
242
Alexandre Lision313427f2016-11-24 21:04:04 -0500243 float zoom = ceil((double)size / (qrCode->width + 2.0 * qr_margin));
Alexandre Lisionfd0d6c82016-03-29 17:06:54 -0400244 CGRect rectDraw = CGRectMake(0, 0, zoom, zoom);
245
246 int ran;
247 for(int i = 0; i < width; ++i) {
248 for(int j = 0; j < width; ++j) {
249 if(*data & 1) {
250 CGContextSetFillColorWithColor(ctx, [NSColor ringDarkGrey].CGColor);
251 rectDraw.origin = CGPointMake((j + qr_margin) * zoom,(i + qr_margin) * zoom);
252 CGContextAddRect(ctx, rectDraw);
253 CGContextFillPath(ctx);
254 } else {
255 CGContextSetFillColorWithColor(ctx, [NSColor windowBackgroundColor].CGColor);
256 rectDraw.origin = CGPointMake((j + qr_margin) * zoom,(i + qr_margin) * zoom);
257 CGContextAddRect(ctx, rectDraw);
258 CGContextFillPath(ctx);
259 }
260 ++data;
261 }
262 }
Alexandre Lision313427f2016-11-24 21:04:04 -0500263
264 // get image
265 auto qrCGImage = CGBitmapContextCreateImage(ctx);
266 auto qrImage = [[NSImage alloc] initWithCGImage:qrCGImage size:qrcodeView.frame.size];
267
268 // some releases
269 CGContextRelease(ctx);
270 CGImageRelease(qrCGImage);
271 CGColorSpaceRelease(colorSpace);
272 QRcode_free(qrCode);
273
274 [qrcodeView setImage:qrImage];
Alexandre Lisionfd0d6c82016-03-29 17:06:54 -0400275}
276
277/**
278 * Start the in/out animation displaying the QRCode
279 * @param show should the QRCode be animated in or out
280 */
281- (void) showQRCode:(BOOL) show
282{
283 static const NSInteger offset = 110;
284 [NSAnimationContext beginGrouping];
285 NSAnimationContext.currentContext.duration = 0.5;
286 [[NSAnimationContext currentContext] setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
287 qrcodeView.animator.alphaValue = show ? 1.0 : 0.0;
288 [centerYQRCodeConstraint.animator setConstant: show ? offset : 0];
289 [centerYWelcomeContainerConstraint.animator setConstant:show ? -offset : 0];
290 [NSAnimationContext endGrouping];
291}
292
Alexandre Lision4a7b95e2015-02-20 10:06:43 -0500293- (IBAction)openPreferences:(id)sender
294{
Alexandre Lisionbfa68f62015-09-10 08:38:42 -0400295 preferencesWC = [[PreferencesWC alloc] initWithWindowNibName:@"PreferencesWindow"];
296 [preferencesWC.window makeKeyAndOrderFront:preferencesWC.window];
Alexandre Lision5855b6a2015-02-03 11:31:05 -0500297}
Alexandre Lision4a7b95e2015-02-20 10:06:43 -0500298
Kateryna Kostiuk882cbac2017-07-05 17:29:00 -0400299- (IBAction)callClickedAtRow:(id)sender
300{
301 NSTabViewItem *selectedTab = [smartViewVC.tabbar selectedTabViewItem];
302 int index = [smartViewVC.tabbar indexOfTabViewItem:selectedTab];
303 switch (index) {
304 case 0:
305 [smartViewVC startCallForRow:sender];
306 break;
Kateryna Kostiuk882cbac2017-07-05 17:29:00 -0400307 default:
308 break;
309 }
310}
Anthony Léonard0a9904c2018-01-11 16:43:47 -0500311
Alexandre Lision624b1a82016-09-11 19:29:01 -0400312#pragma mark - Ring account migration
313
314- (void) migrateRingAccount:(Account*) acc
315{
316 self.migrateWC = [[MigrateRingAccountsWC alloc] initWithDelegate:self actionCode:1];
317 self.migrateWC.account = acc;
318#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9
319 [self.window beginSheet:self.migrateWC.window completionHandler:nil];
320#else
321 [NSApp beginSheet: self.migrateWC.window
322 modalForWindow: self.window
323 modalDelegate: self
324 didEndSelector: nil
325 contextInfo: nil];
326#endif
327}
328
Anthony Léonard49cb2912017-11-13 16:15:39 -0500329// TODO: Reimplement as a blocking loop when new LRC models handle migration
Alexandre Lision624b1a82016-09-11 19:29:01 -0400330- (void)checkAccountsToMigrate
331{
332 auto ringList = AccountModel::instance().accountsToMigrate();
333 if (ringList.length() > 0){
334 Account* acc = ringList.value(0);
335 [self migrateRingAccount:acc];
336 } else {
337 // Fresh run, we need to make sure RingID appears
Alexandre Lision624b1a82016-09-11 19:29:01 -0400338 [shareButton sendActionOn:NSLeftMouseDownMask];
339
340 [self connect];
Kateryna Kostiuka7248462017-04-18 16:15:31 -0400341 [self updateRingID];
Kateryna Kostiuk13b76882017-03-30 09:18:44 -0400342 // display accounts to select
343 NSToolbar *toolbar = self.window.toolbar;
344 toolbar.delegate = self;
345 [toolbar insertItemWithItemIdentifier:kChangeAccountToolBarItemIdentifier atIndex:1];
Alexandre Lision624b1a82016-09-11 19:29:01 -0400346 }
347}
348
349- (void)migrationDidComplete
350{
351 [self checkAccountsToMigrate];
352}
353
354- (void)migrationDidCompleteWithError
355{
356 [self checkAccountsToMigrate];
357}
358
Anthony Léonard9bebf1d2017-12-21 14:33:51 -0500359-(void)selectAccount:(const lrc::api::account::Info&)accInfo
360{
361 // If the selected account has been changed, we close any open panel
362 if ([smartViewVC setConversationModel:accInfo.conversationModel.get()]) {
363 [currentCallVC animateOut];
364 [offlineVC animateOut];
365 }
Anthony Léonard61e3dcf2017-12-27 12:19:52 -0500366
367 // Welcome view informations are also updated
368 [self updateRingID];
Anthony Léonard9bebf1d2017-12-21 14:33:51 -0500369}
370
Anthony Léonard8585cc02017-12-28 14:03:45 -0500371-(void)rightPanelClosed
372{
373 [smartViewVC deselect];
374}
375
Anthony Léonard0a9904c2018-01-11 16:43:47 -0500376-(void)currentConversationTrusted
377{
378 [smartViewVC selectConversationList];
379}
380
Anthony Léonardbee94cc2018-01-16 11:42:40 -0500381-(void) listTypeChanged {
382 [offlineVC animateOut];
383 [currentCallVC animateOut];
384}
385
Kateryna Kostiuk13b76882017-03-30 09:18:44 -0400386#pragma mark - NSToolbarDelegate
Kateryna Kostiukdb1f3a12017-04-24 12:08:28 -0400387- (nullable NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
388{
389 if(itemIdentifier == kChangeAccountToolBarItemIdentifier) {
390 NSToolbarItem *toolbarItem = [[NSToolbarItem alloc] initWithItemIdentifier:kChangeAccountToolBarItemIdentifier];
391 toolbarItem.view = chooseAccountVC.view;
392 return toolbarItem;
Kateryna Kostiuk13b76882017-03-30 09:18:44 -0400393 }
Kateryna Kostiukdb1f3a12017-04-24 12:08:28 -0400394 return nil;
Kateryna Kostiuk13b76882017-03-30 09:18:44 -0400395}
396
Alexandre Lision5855b6a2015-02-03 11:31:05 -0500397@end