Skip to content

Commit

Permalink
Merge pull request #3781 from Crebs/@W-15432327
Browse files Browse the repository at this point in the history
Fix Deprecations and Warning issues
  • Loading branch information
Crebs authored Dec 6, 2024
2 parents 821bc4f + 555fd9e commit b74ae25
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ - (void)viewDidLoad {
self.view.backgroundColor = [UIColor salesforceSystemBackgroundColor];
}

- (BOOL)shouldAutorotate {
return YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,12 @@ - (UIInterfaceOrientation)sfsdk_interfaceOrientation {
UIDeviceOrientation deviceOrientation = UIDevice.currentDevice.orientation;
UIInterfaceOrientation orientation = (UIInterfaceOrientation)deviceOrientation;
if (!UIDeviceOrientationIsValidInterfaceOrientation(deviceOrientation)) {
orientation = [SFApplicationHelper sharedApplication].windows.firstObject.windowScene.interfaceOrientation;
UIWindowScene *windowScene = (UIWindowScene *)[[[SFApplicationHelper sharedApplication] connectedScenes] anyObject];
if ([windowScene isKindOfClass:[UIWindowScene class]]) {
orientation = windowScene.interfaceOrientation;
} else {
orientation = UIInterfaceOrientationUnknown;
}
}
return orientation;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,6 @@ - (SFSDKLoginHostListViewController *)createLoginHostListViewController {
return loginHostListViewController;
}

- (BOOL)shouldAutorotate {
return YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
static NSString * const kSFOAuthDefaultDomain = @"login.salesforce.com";
static NSString * const kSFOAuthClusterImplementationKey = @"SFOAuthClusterImplementation";

NSException * SFOAuthInvalidIdentifierException() {
NSException * SFOAuthInvalidIdentifierException(void) {
return [[NSException alloc] initWithName:NSInternalInconsistencyException
reason:@"identifier cannot be nil or empty"
userInfo:nil];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ struct KeyValueEncryptedFileStoreInspector: View {
VStack(alignment: .leading) {
Form {
Picker(selection: $selectedIndex, label: Text("Store")) {
ForEach(0 ..< stores.count) {
Text(self.stores[$0])
ForEach(stores.indices, id: \.self) { index in
Text(self.stores[index])
}
}
HStack {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ - (void)oauthCoordinatorDidCancelBrowserAuthentication:(SFOAuthCoordinator *)coo
NSAssert(NO, @"Web Server flow not supported in this class.");
}

- (void)oauthCoordinatorDidBeginNativeAuthentication:(nonnull SFOAuthCoordinator *)coordinator {
NSAssert(NO, @"Web Server flow not supported in this class.");
}

- (void)oauthCoordinatorDidAuthenticate:(SFOAuthCoordinator *)coordinator authInfo:(SFOAuthInfo *)info
{
[SFSDKCoreLogger i:[self class] format:@"%@ with authInfo: %@", NSStringFromSelector(_cmd), info];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ + (NSString *)loginStateDescriptionFromLoginState:(SFUserAccountLoginState)login
}
}

NSString *SFKeyForGlobalScope() {
NSString *SFKeyForGlobalScope(void) {
return SFKeyForUserIdAndScope(nil,nil,nil,SFUserAccountScopeGlobal);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ - (void)layoutSubviews
[self layoutTableView];
}

- (BOOL)shouldAutorotate {
return YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ - (void)viewDidAppear:(BOOL)animated {
[SFSDKViewController refreshAllViews:self.view];
}

- (BOOL)shouldAutorotate{
return self.topViewController.shouldAutorotate;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return self.topViewController.supportedInterfaceOrientations;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@ -(UIViewController *)childViewControllerForStatusBarHidden {
return nil;
}

-(BOOL)shouldAutorotate
{
UIViewController *topViewController = [SFSDKRootController topViewController:self];
if (topViewController!=nil && topViewController!=self)
return [topViewController shouldAutorotate];
return NO;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
UIViewController *topViewController = [SFSDKRootController topViewController:self];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,10 @@ - (void)oauthCoordinatorDidCancelBrowserAuthentication:(SFOAuthCoordinator *)coo
@throw [NSException exceptionWithName:kASWebAuthenticationSessionNotSupportedReasonFormat reason:reason userInfo:nil];
}

- (void)oauthCoordinatorDidBeginNativeAuthentication:(nonnull SFOAuthCoordinator *)coordinator {
[SFLogger log:[self class] level:SFLogLevelDebug format:@"%@ called.", NSStringFromSelector(_cmd)];
NSString *reason = [NSString stringWithFormat:kASWebAuthenticationSessionNotSupportedReasonFormat, NSStringFromSelector(_cmd)];
@throw [NSException exceptionWithName:kASWebAuthenticationSessionNotSupportedReasonFormat reason:reason userInfo:nil];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ @implementation SFSDKWindowManagerTests

- (void)setUp {
[super setUp];
_origApplicationWindow = [UIApplication sharedApplication].keyWindow;
UIWindowScene *windowScene = (UIWindowScene *)[[[UIApplication sharedApplication] connectedScenes] anyObject];
if ([windowScene isKindOfClass:[UIWindowScene class]]) {
_origApplicationWindow = windowScene.windows.firstObject;
}
}

- (void)tearDown {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ - (void)oauthCoordinatorDidCancelBrowserAuthentication:(SFOAuthCoordinator *)coo
XCTFail(@"ASWebAuthenticationSession auth flow is not supported in unit test framework");
}

- (void)oauthCoordinatorDidBeginNativeAuthentication:(nonnull SFOAuthCoordinator *)coordinator {
// ASWebAuthenticationSession auth flow is not supported in unit test framework.
XCTFail(@"ASWebAuthenticationSession auth flow is not supported in unit test framework");
}
@end
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ - (void) testParsePrimingRecordsResponseFromServer {
SFNativeRestRequestListener *listener = [self sendSyncRequest:request];
NSDictionary* response = listener.dataResponse;
@try {
SFSDKPrimingRecordsResponse* parsedResponse = [[SFSDKPrimingRecordsResponse alloc] initWith:response];
(void)[[SFSDKPrimingRecordsResponse alloc] initWith:response];
}
@catch (NSException *exception) {
XCTFail(@"Unexpected error %@", exception);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ @interface ScreenLockManagerTests : XCTestCase
@implementation ScreenLockManagerTests

- (void)setUp {
BOOL _ = [SFSDKKeychainHelper removeAll];
(void)[SFSDKKeychainHelper removeAll];
}

- (void)testShouldNotLock {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,6 @@ - (void)layoutSubviews
[self.resultGrid reloadData];
}

- (BOOL)shouldAutorotate {
return YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ - (id)initWithAppViewController:(ContactListViewController *)appViewController {

#pragma mark - View lifecycle

-(BOOL)shouldAutorotate
{
return NO;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
Expand Down

0 comments on commit b74ae25

Please sign in to comment.