Skip to content

Commit 1649d0d

Browse files
committed
Add showServerPicker property
1 parent 650e8fc commit 1649d0d

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Login/SFLoginViewController.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,12 @@ NS_SWIFT_NAME(SalesforceLoginViewController)
9191
/** Specify visibility of nav bar. This property will be used to hide/show the nav bar*/
9292
@property (nonatomic) BOOL showNavbar NS_SWIFT_NAME(showsNavigationBar);
9393

94-
/** Specifiy the visibility of the settings icon. This property will be used to hide/show the settings icon*/
94+
/** Specify the visibility of the settings icon. This property will be used to hide/show the settings icon*/
9595
@property (nonatomic) BOOL showSettingsIcon NS_SWIFT_NAME(showsSettingsIcon);
9696

97+
/// Specify the visibility of the server picker option in the settings menu.
98+
@property (nonatomic) BOOL showServerPicker NS_SWIFT_NAME(showsServerPicker);
99+
97100
/** Specify all display properties in a config. All the above properties are backed by
98101
a config object */
99102
@property (nonatomic, strong, nonnull) SFSDKLoginViewControllerConfig *config;

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Login/SFLoginViewController.m

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,14 @@ - (void)setShowSettingsIcon:(BOOL)showSettingsIcon {
184184
self.config.showSettingsIcon = showSettingsIcon;
185185
}
186186

187+
- (BOOL)showServerPicker {
188+
return self.config.showServerPicker;
189+
}
190+
191+
- (void)setShowServerPicker:(BOOL)showServerPicker {
192+
self.config.showServerPicker = showServerPicker;
193+
}
194+
187195
- (SFSDKLoginViewControllerConfig *)config {
188196
return _config;
189197
}
@@ -260,7 +268,11 @@ - (UIBarButtonItem *)createSettingsButton {
260268

261269
// Don't show the change server option if there are no hosts to switch to.
262270
SFManagedPreferences *managedPreferences = [SFManagedPreferences sharedPreferences];
263-
if (!managedPreferences.onlyShowAuthorizedHosts || managedPreferences.loginHosts.count != 0) {
271+
if (managedPreferences.onlyShowAuthorizedHosts && managedPreferences.loginHosts.count == 0) {
272+
self.showServerPicker = NO;
273+
}
274+
275+
if (self.showServerPicker) {
264276
[menuActions addObject:[UIAction actionWithTitle:[SFSDKResourceUtils localizedString:@"LOGIN_CHOOSE_SERVER"]
265277
image:nil
266278
identifier:nil

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Login/SFSDKLoginViewControllerConfig.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,17 @@ NS_SWIFT_NAME(SalesforceLoginViewControllerConfig)
4343
/** Specify visibility of nav bar. This property will be used to hide/show the nav bar*/
4444
@property (nonatomic) BOOL showNavbar NS_SWIFT_NAME(showsNavigationBar);
4545

46-
/** Specifiy the visibility of the settings icon. This property will be used to hide/show the settings icon*/
46+
/** Specify the visibility of the settings icon. This property will be used to hide/show the settings icon*/
4747
@property (nonatomic) BOOL showSettingsIcon NS_SWIFT_NAME(showsSettingsIcon);
4848

49-
/** Specifiy the visibility of the back icon. This property value can be changed by changing the value of shouldAuthenticate in bootconfig or by subclasssing SFLoginViewController.
49+
/// Specify the visibility of the server picker option in the settings menu.
50+
@property (nonatomic) BOOL showServerPicker NS_SWIFT_NAME(showsServerPicker);
51+
52+
/** Specify the visibility of the back icon. This property value can be changed by changing the value of shouldAuthenticate in bootconfig or by subclasssing SFLoginViewController.
5053
*/
5154
@property (nonatomic,readonly) BOOL shouldDisplayBackButton NS_SWIFT_NAME(showsBackButton);
5255

53-
/** Specifiy a delegate for LoginViewController. */
56+
/** Specify a delegate for LoginViewController. */
5457
@property (nonatomic, weak, nullable) id<SFLoginViewControllerDelegate> delegate;
5558

5659
@property (nonatomic, copy, nullable) SFLoginViewControllerCreationBlock loginViewControllerCreationBlock;

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Login/SFSDKLoginViewControllerConfig.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ - (instancetype)init {
4545
self.navBarFont = nil;
4646
_showNavbar = YES;
4747
_showSettingsIcon = YES;
48+
_showServerPicker = YES;
4849
}
4950
return self;
5051
}

0 commit comments

Comments
 (0)