Skip to content

Commit

Permalink
Add option for disabling authorization providers (#598)
Browse files Browse the repository at this point in the history
Co-authored-by: Alekseev Sergei <sn.alekseev@corp.vk.com>
  • Loading branch information
snalexeev and Alekseev Sergei authored Sep 29, 2022
1 parent 854305a commit 552bbf2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions library/Source/VKSdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ typedef NS_OPTIONS(NSUInteger, VKAuthorizationOptions) {
VKAuthorizationOptionsUnlimitedToken = 1 << 0,
///Pass this option to disable usage of SFSafariViewController
VKAuthorizationOptionsDisableSafariController = 1 << 1,
///Pass this option to disable usage of authorization providers
VKAuthorizationOptionsDisableProviders = 1 << 2,
};

/**
Expand Down
4 changes: 3 additions & 1 deletion library/Source/VKSdk.m
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ + (void)authorize:(NSArray *)permissions withOptions:(VKAuthorizationOptions)opt
instance.permissions = [permissionsSet copy];
permissions = [permissionsSet allObjects];

BOOL providersEnabled = !(options & VKAuthorizationOptionsDisableProviders);

BOOL vkApp = [self vkAppMayExists]
&& instance.authState == VKAuthorizationInitialized;
&& instance.authState == VKAuthorizationInitialized && providersEnabled;

BOOL safariEnabled = !(options & VKAuthorizationOptionsDisableSafariController);

Expand Down

0 comments on commit 552bbf2

Please sign in to comment.