Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Deprecations and Warning issues #3781

Merged
merged 7 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading