1
1
mirror of https://github.com/VKCOM/vk-ios-sdk.git synced 2024-09-17 10:17:08 +03:00

Show sdk screens in separate window. Headers optimized. Warnings enabled

This commit is contained in:
Roman Truba 2016-06-28 18:11:21 +03:00
parent e93fed4968
commit cf82868663
20 changed files with 150 additions and 208 deletions

View File

@ -31,7 +31,6 @@
1ACA6509BAA3CEB2D5C3BA1D /* VKCaptchaViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA608862B093D6D0F46BC4 /* VKCaptchaViewController.m */; };
1ACA656AD2A705875E2C86DC /* VKApiBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA628E1013456A0CB8D71E /* VKApiBase.m */; };
1ACA65FFFA2849D789FFDB88 /* VKApiGroups.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA62BE07D3E456A04ACE24 /* VKApiGroups.m */; };
1ACA66450BE336D6F5AD4683 /* NSData+MD5.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA628625B4301841232A88 /* NSData+MD5.m */; };
1ACA664E3EC08CC26D0E2340 /* VKUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA6F8866BE96889BB9DA68 /* VKUtil.m */; };
1ACA66EB5F29CF88789B1D5F /* VKApiWall.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA6D5C2E0E59A23C3D3B4C /* VKApiWall.m */; };
1ACA68336BEF00F13DEDA870 /* VKUploadMessagesPhotoRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA60EB8A19FBF44B2A0769 /* VKUploadMessagesPhotoRequest.m */; };
@ -81,7 +80,6 @@
F34670D61B8B7CCA003EF74B /* VKUploadImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA6FA4664723004E33ADE4 /* VKUploadImage.m */; };
F34670D71B8B7CD2003EF74B /* VKUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA6F8866BE96889BB9DA68 /* VKUtil.m */; };
F34670D81B8B7CD2003EF74B /* NSString+MD5.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA6108D9F4E0C7644BAC52 /* NSString+MD5.m */; };
F34670D91B8B7CD2003EF74B /* NSData+MD5.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA628625B4301841232A88 /* NSData+MD5.m */; };
F34670DA1B8B7CD2003EF74B /* OrderedDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA69BCB967C1A6450F9935 /* OrderedDictionary.m */; };
F34670DB1B8B7CD9003EF74B /* VKActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA6F9E65F7742733AB46DF /* VKActivity.m */; };
F34670DC1B8B7CD9003EF74B /* VKAuthorizeController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA602BF516D3FC45609A2B /* VKAuthorizeController.m */; };
@ -176,16 +174,17 @@
F34671351B8B7D07003EF74B /* VKCaptchaView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA61750D18E769710C23D2 /* VKCaptchaView.h */; settings = {ATTRIBUTES = (Public, ); }; };
F34671361B8B7D07003EF74B /* VKCaptchaViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA60549B5805BC010388F6 /* VKCaptchaViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
F34671371B8B7D07003EF74B /* VKShareDialogController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA636E76F65CA58F05D4C9 /* VKShareDialogController.h */; settings = {ATTRIBUTES = (Public, ); }; };
F34671381B8B7D07003EF74B /* VKSharedTransitioningObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA6A7961FA6DBB3C1530F9 /* VKSharedTransitioningObject.h */; settings = {ATTRIBUTES = (Public, ); }; };
F34671391B8B7D07003EF74B /* VKUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA671427725230741603BC /* VKUtil.h */; settings = {ATTRIBUTES = (Public, ); }; };
F346713A1B8B7D07003EF74B /* NSData+MD5.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA60466E2608234660028D /* NSData+MD5.h */; settings = {ATTRIBUTES = (Public, ); }; };
F34671381B8B7D07003EF74B /* VKSharedTransitioningObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA6A7961FA6DBB3C1530F9 /* VKSharedTransitioningObject.h */; };
F34671391B8B7D07003EF74B /* VKUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA671427725230741603BC /* VKUtil.h */; };
F346713B1B8B7D07003EF74B /* OrderedDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA6CCE31EAF497A4030D24 /* OrderedDictionary.h */; settings = {ATTRIBUTES = (Public, ); }; };
F346713C1B8B7D07003EF74B /* NSString+MD5.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA6E07E9640D2B9D9B4831 /* NSString+MD5.h */; settings = {ATTRIBUTES = (Public, ); }; };
F346713C1B8B7D07003EF74B /* NSString+MD5.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA6E07E9640D2B9D9B4831 /* NSString+MD5.h */; };
F346713D1B8B7D07003EF74B /* VKUploadImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA68CDC5C08713A61C5AD1 /* VKUploadImage.h */; settings = {ATTRIBUTES = (Public, ); }; };
F346713E1B8B7D07003EF74B /* VKImageParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA62D0E659DB7778EF2633 /* VKImageParameters.h */; settings = {ATTRIBUTES = (Public, ); }; };
F34DECF61D2171E3005495E5 /* SdkAssetCatalog.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F34DECF11D2171A1005495E5 /* SdkAssetCatalog.xcassets */; };
F34DECF71D217260005495E5 /* SdkAssetCatalog.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F34DECF11D2171A1005495E5 /* SdkAssetCatalog.xcassets */; };
F36114A9197685810085898F /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F36114A4197684870085898F /* Localizable.strings */; };
F368F3B61D2290C1009CCB36 /* UIViewController+VKSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = F368F3B51D2290C1009CCB36 /* UIViewController+VKSDK.h */; };
F368F3B81D22910B009CCB36 /* VKAccessToken+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = F368F3B71D22910B009CCB36 /* VKAccessToken+Private.h */; };
F3769D411BDFDC6F00AEC4AF /* VKAuthorizationResult.h in Headers */ = {isa = PBXBuildFile; fileRef = F3769D3F1BDFDC6F00AEC4AF /* VKAuthorizationResult.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3769D421BDFDC6F00AEC4AF /* VKAuthorizationResult.m in Sources */ = {isa = PBXBuildFile; fileRef = F3769D401BDFDC6F00AEC4AF /* VKAuthorizationResult.m */; };
F3769D431BDFDC6F00AEC4AF /* VKAuthorizationResult.m in Sources */ = {isa = PBXBuildFile; fileRef = F3769D401BDFDC6F00AEC4AF /* VKAuthorizationResult.m */; };
@ -335,7 +334,6 @@
/* Begin PBXFileReference section */
1ACA602BF516D3FC45609A2B /* VKAuthorizeController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKAuthorizeController.m; sourceTree = "<group>"; };
1ACA6041B183FB7781AC6F07 /* VKUploadMessagesPhotoRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VKUploadMessagesPhotoRequest.h; sourceTree = "<group>"; };
1ACA60466E2608234660028D /* NSData+MD5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+MD5.h"; sourceTree = "<group>"; };
1ACA60549B5805BC010388F6 /* VKCaptchaViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VKCaptchaViewController.h; sourceTree = "<group>"; };
1ACA6062CBB5C51999B6F516 /* VKObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKObject.m; sourceTree = "<group>"; };
1ACA608862B093D6D0F46BC4 /* VKCaptchaViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKCaptchaViewController.m; sourceTree = "<group>"; };
@ -351,7 +349,6 @@
1ACA61B2E964393FB2431C30 /* VKOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VKOperation.h; sourceTree = "<group>"; };
1ACA61F606614B473B1F8535 /* VKUploadWallPhotoRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKUploadWallPhotoRequest.m; sourceTree = "<group>"; };
1ACA624D02724AC703780337 /* VKResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKResponse.m; sourceTree = "<group>"; };
1ACA628625B4301841232A88 /* NSData+MD5.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+MD5.m"; sourceTree = "<group>"; };
1ACA628E1013456A0CB8D71E /* VKApiBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKApiBase.m; sourceTree = "<group>"; };
1ACA62BE07D3E456A04ACE24 /* VKApiGroups.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKApiGroups.m; sourceTree = "<group>"; };
1ACA62D0E659DB7778EF2633 /* VKImageParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VKImageParameters.h; sourceTree = "<group>"; };
@ -439,6 +436,8 @@
F36114A5197684870085898F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
F36114A8197684A00085898F /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
F36114BF1976CEB80085898F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
F368F3B51D2290C1009CCB36 /* UIViewController+VKSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+VKSDK.h"; sourceTree = "<group>"; };
F368F3B71D22910B009CCB36 /* VKAccessToken+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "VKAccessToken+Private.h"; sourceTree = "<group>"; };
F3769D3F1BDFDC6F00AEC4AF /* VKAuthorizationResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VKAuthorizationResult.h; sourceTree = "<group>"; };
F3769D401BDFDC6F00AEC4AF /* VKAuthorizationResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKAuthorizationResult.m; sourceTree = "<group>"; };
F3769E6E1BE8E41800AEC4AF /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
@ -523,6 +522,7 @@
1ACA6536B0B95A5ADF4F4D7A /* VKShareDialogController.m */,
1ACA6A7961FA6DBB3C1530F9 /* VKSharedTransitioningObject.h */,
1ACA65DA3FA10F23ABA592AA /* VKSharedTransitioningObject.m */,
F368F3B51D2290C1009CCB36 /* UIViewController+VKSDK.h */,
);
path = Views;
sourceTree = "<group>";
@ -654,8 +654,6 @@
1ACA6F81E7D41D5219AB4B25 /* Utils */ = {
isa = PBXGroup;
children = (
1ACA60466E2608234660028D /* NSData+MD5.h */,
1ACA628625B4301841232A88 /* NSData+MD5.m */,
1ACA6E07E9640D2B9D9B4831 /* NSString+MD5.h */,
1ACA6108D9F4E0C7644BAC52 /* NSString+MD5.m */,
1ACA6CCE31EAF497A4030D24 /* OrderedDictionary.h */,
@ -770,6 +768,7 @@
F3EEFFA41827B726000BB525 /* VKPermissions.h */,
F3EEFFA61827B7F1000BB525 /* VKPermissions.m */,
F3EEFFBC1827C582000BB525 /* VKSdkVersion.h */,
F368F3B71D22910B009CCB36 /* VKAccessToken+Private.h */,
);
name = SDK;
sourceTree = "<group>";
@ -781,19 +780,19 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
F34670F51B8B7D07003EF74B /* VKAccessToken.h in Headers */,
F34670F31B8B7D07003EF74B /* VKSdk.h in Headers */,
F34670361B8B7C5A003EF74B /* VKSdkFramework.h in Headers */,
F346710C1B8B7D07003EF74B /* VKRequest.h in Headers */,
F34671001B8B7D07003EF74B /* VKError.h in Headers */,
F34671361B8B7D07003EF74B /* VKCaptchaViewController.h in Headers */,
F34670E61B8B7CE4003EF74B /* VKApiConst.h in Headers */,
F34670F61B8B7D07003EF74B /* VKBatchRequest.h in Headers */,
F346713D1B8B7D07003EF74B /* VKUploadImage.h in Headers */,
F346712D1B8B7D07003EF74B /* VKUploadPhotoRequest.h in Headers */,
F34671391B8B7D07003EF74B /* VKUtil.h in Headers */,
F34671121B8B7D07003EF74B /* VKApi.h in Headers */,
F346710C1B8B7D07003EF74B /* VKRequest.h in Headers */,
F34670F31B8B7D07003EF74B /* VKSdk.h in Headers */,
F346711D1B8B7D07003EF74B /* VKSchool.h in Headers */,
F34671331B8B7D07003EF74B /* VKActivity.h in Headers */,
F34670361B8B7C5A003EF74B /* VKSdkFramework.h in Headers */,
F34671081B8B7D07003EF74B /* VKObject.h in Headers */,
F346711F1B8B7D07003EF74B /* VKCounters.h in Headers */,
F34671171B8B7D07003EF74B /* VKGroup.h in Headers */,
@ -823,7 +822,6 @@
F3769D411BDFDC6F00AEC4AF /* VKAuthorizationResult.h in Headers */,
F34671271B8B7D07003EF74B /* VKUniversity.h in Headers */,
F34671371B8B7D07003EF74B /* VKShareDialogController.h in Headers */,
F34670F51B8B7D07003EF74B /* VKAccessToken.h in Headers */,
F34671211B8B7D07003EF74B /* VKRelative.h in Headers */,
F34670F91B8B7D07003EF74B /* VKSdkVersion.h in Headers */,
F34670FE1B8B7D07003EF74B /* NSError+VKError.h in Headers */,
@ -831,14 +829,16 @@
F34670E21B8B7CE4003EF74B /* VKApiBase.h in Headers */,
F34671191B8B7D07003EF74B /* VKLikes.h in Headers */,
F34671021B8B7D07003EF74B /* VKHTTPClient.h in Headers */,
F346713C1B8B7D07003EF74B /* NSString+MD5.h in Headers */,
F346713A1B8B7D07003EF74B /* NSData+MD5.h in Headers */,
F34671041B8B7D07003EF74B /* VKHTTPOperation.h in Headers */,
F346710E1B8B7D07003EF74B /* VKRequestsScheduler.h in Headers */,
F346710A1B8B7D07003EF74B /* VKOperation.h in Headers */,
8F99D6351C42C6010006DB03 /* VKApiDocs.h in Headers */,
F34671381B8B7D07003EF74B /* VKSharedTransitioningObject.h in Headers */,
F34671061B8B7D07003EF74B /* VKJSONOperation.h in Headers */,
F34671381B8B7D07003EF74B /* VKSharedTransitioningObject.h in Headers */,
F368F3B61D2290C1009CCB36 /* UIViewController+VKSDK.h in Headers */,
F368F3B81D22910B009CCB36 /* VKAccessToken+Private.h in Headers */,
F34671391B8B7D07003EF74B /* VKUtil.h in Headers */,
F346713C1B8B7D07003EF74B /* NSString+MD5.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1063,7 +1063,6 @@
F346710F1B8B7D07003EF74B /* VKRequestsScheduler.m in Sources */,
F34670F41B8B7D07003EF74B /* VKSdk.m in Sources */,
F34671091B8B7D07003EF74B /* VKObject.m in Sources */,
F34670D91B8B7CD2003EF74B /* NSData+MD5.m in Sources */,
F346712A1B8B7D07003EF74B /* VKApiObjectArray.m in Sources */,
F34670E51B8B7CE4003EF74B /* VKApiCaptcha.m in Sources */,
);
@ -1112,7 +1111,6 @@
1ACA6F8C335233B3D05A0F49 /* VKActivity.m in Sources */,
1ACA664E3EC08CC26D0E2340 /* VKUtil.m in Sources */,
1ACA60B9FC0180221C536C9A /* NSString+MD5.m in Sources */,
1ACA66450BE336D6F5AD4683 /* NSData+MD5.m in Sources */,
8F99D6361C42C6010006DB03 /* VKApiDocs.m in Sources */,
1ACA6C11956AB22CAA341CB1 /* OrderedDictionary.m in Sources */,
1ACA656AD2A705875E2C86DC /* VKApiBase.m in Sources */,
@ -1178,6 +1176,11 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = NO;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = NO;
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
CURRENT_PROJECT_VERSION = 1;
@ -1211,6 +1214,11 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = NO;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = NO;
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;

View File

@ -415,6 +415,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
@ -446,6 +447,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (

View File

@ -150,7 +150,7 @@ static NSString *const ALL_USER_FIELDS = @"id,first_name,last_name,sex,bdate,cit
#else
[activityViewController setCompletionHandler:nil];
#endif
if ([VKUtil isOperatingSystemAtLeastIOS8]) {
if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1) {
UIPopoverPresentationController *popover = activityViewController.popoverPresentationController;
popover.sourceView = self.view;
popover.sourceRect = [tableView rectForRowAtIndexPath:indexPath];

View File

@ -26,7 +26,7 @@ static NSString *const TOKEN_KEY = @"my_application_access_token";
static NSString *const NEXT_CONTROLLER_SEGUE_ID = @"START_WORK";
static NSArray *SCOPE = nil;
@interface VKStartScreen () <UIAlertViewDelegate, VKSdkUIDelegate>
@interface VKStartScreen () <UIAlertViewDelegate>
@end
@ -36,7 +36,7 @@ static NSArray *SCOPE = nil;
SCOPE = @[VK_PER_FRIENDS, VK_PER_WALL, VK_PER_AUDIO, VK_PER_PHOTOS, VK_PER_NOHTTPS, VK_PER_EMAIL, VK_PER_MESSAGES];
[super viewDidLoad];
[[VKSdk initializeWithAppId:@"3974615"] registerDelegate:self];
[[VKSdk instance] setUiDelegate:self];
[VKSdk wakeUpSession:SCOPE completeBlock:^(VKAuthorizationState state, NSError *error) {
if (state == VKAuthorizationAuthorized) {
[self startWorking];
@ -70,9 +70,8 @@ static NSArray *SCOPE = nil;
}
- (void)vkSdkNeedCaptchaEnter:(VKError *)captchaError {
VKCaptchaViewController *vc = [VKCaptchaViewController captchaControllerWithError:captchaError];
[vc presentIn:self.navigationController.topViewController];
- (BOOL)vkSdkShouldDisplayCaptchaDialog:(VKError *)captchaError{
return YES;
}
- (void)vkSdkTokenHasExpired:(VKAccessToken *)expiredToken {

View File

@ -33,15 +33,12 @@ FOUNDATION_EXPORT const unsigned char VKSdkFrameworkVersionString[];
#import <VKSdkFramework/VKSdk.h>
#import <VKSdkFramework/VKAccessToken.h>
#import <VKSdkFramework/VKPermissions.h>
#import <VKSdkFramework/VKUtil.h>
#import <VKSdkFramework/VKApi.h>
#import <VKSdkFramework/VKApiConst.h>
#import <VKSdkFramework/VKSdkVersion.h>
#import <VKSdkFramework/VKCaptchaViewController.h>
#import <VKSdkFramework/VKRequest.h>
#import <VKSdkFramework/VKBatchRequest.h>
#import <VKSdkFramework/NSError+VKError.h>
#import <VKSdkFramework/VKApiModels.h>
#import <VKSdkFramework/VKUploadImage.h>
#import <VKSdkFramework/VKShareDialogController.h>
#import <VKSdkFramework/VKActivity.h>
@ -56,7 +53,4 @@ FOUNDATION_EXPORT const unsigned char VKSdkFrameworkVersionString[];
#import <VKSdkFramework/VKHTTPClient.h>
#import <VKSdkFramework/VKHTTPOperation.h>
#import <VKSdkFramework/VKJSONOperation.h>
#import <VKSdkFramework/VKRequestsScheduler.h>
#import <VKSdkFramework/VKSharedTransitioningObject.h>
#import <VKSdkFramework/NSString+MD5.h>
#import <VKSdkFramework/NSData+MD5.h>
#import <VKSdkFramework/VKRequestsScheduler.h>

View File

@ -23,7 +23,6 @@
#import <Foundation/Foundation.h>
#import "VKResponse.h"
#import "VKApiConst.h"
#import "VKObject.h"
/**

View File

@ -21,13 +21,14 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import <NSString+MD5.h>
#import "VKRequest.h"
#import "VKSdk.h"
#import "OrderedDictionary.h"
#import "VKAuthorizeController.h"
#import "VKHTTPClient.h"
#import "VKJSONOperation.h"
#import "VKRequestsScheduler.h"
#import "NSError+VKError.h"
#define SUPPORTED_LANGS_ARRAY @[@"ru", @"en", @"uk", @"es", @"fi", @"de", @"it"]
@ -496,7 +497,7 @@ void vksdk_dispatch_on_main_queue_now(void(^block)(void)) {
//Then we generate "request string" /method/{METHOD_NAME}?{GET_PARAMS}{POST_PARAMS}
NSString *requestString = [NSString stringWithFormat:@"/method/%@?%@", _methodName, [paramsArray componentsJoinedByString:@"&"]];
requestString = [requestString stringByAppendingString:token.secret];
return [requestString MD5];
return [requestString vks_md5];
}
- (BOOL)processCommonError:(VKError *)error {

View File

@ -1,29 +0,0 @@
//
// NSData+MD5.h
//
// Copyright (c) 2014
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import "NSData+MD5.h"
@interface NSData (MD5)
- (NSString *)MD5;
@end

View File

@ -1,43 +0,0 @@
//
// NSData+MD5.m
//
// Copyright (c) 2014
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import <CommonCrypto/CommonDigest.h>
#import <Foundation/Foundation.h>
@implementation NSData (MD5)
- (NSString *)MD5 {
// Create byte array of unsigned chars
unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH];
// Create 16 byte MD5 hash value, store in buffer
CC_MD5(self.bytes, (uint) self.length, md5Buffer);
// Convert unsigned char buffer to NSString of hex values
NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
for (int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
[output appendFormat:@"%02x", md5Buffer[i]];
return output;
}
@end

View File

@ -24,6 +24,6 @@
@interface NSString (MD5)
- (NSString *)MD5;
- (NSString *)vks_md5;
@end

View File

@ -26,7 +26,7 @@
@implementation NSString (MD5)
- (NSString *)MD5 {
- (NSString *)vks_md5 {
// Create pointer to the string as UTF8
const char *ptr = [self UTF8String];

View File

@ -0,0 +1,13 @@
//
// VKAccessToken+Private.h
// VK-ios-sdk
//
// Created by Roman Truba on 28.06.16.
// Copyright © 2016 VK. All rights reserved.
//
@interface VKAccessToken (Private)
- (void)notifyTokenExpired;
@end

View File

@ -24,7 +24,6 @@
//
#import <Foundation/Foundation.h>
#import "VKObject.h"
#import "VKUser.h"
/**

View File

@ -24,7 +24,8 @@
//
#import "VKAccessToken.h"
#import "VKSdk.h"
#import "VKAccessToken+Private.h"
#import "VKUtil.h"
static NSString *const ACCESS_TOKEN = @"access_token";
static NSString *const EXPIRES_IN = @"expires_in";

View File

@ -25,19 +25,6 @@
#import <Foundation/Foundation.h>
#import "VKAccessToken.h"
#import "VKPermissions.h"
#import "VKUtil.h"
#import "VKApi.h"
#import "VKApiConst.h"
#import "VKSdkVersion.h"
#import "VKCaptchaViewController.h"
#import "VKRequest.h"
#import "VKBatchRequest.h"
#import "NSError+VKError.h"
#import "VKApiModels.h"
#import "VKUploadImage.h"
#import "VKShareDialogController.h"
#import "VKActivity.h"
#import "VKAuthorizationResult.h"
/**
@ -70,6 +57,13 @@ typedef NS_OPTIONS(NSUInteger, VKAuthorizationOptions) {
*/
- (void)vkSdkUserAuthorizationFailed;
/**
Calls when user must perform captcha-check.
@param captchaError error returned from API. You can load captcha image from <b>captchaImg</b> property.
*/
- (BOOL)vkSdkShouldDisplayCaptchaDialog:(VKError *)captchaError;
@optional
/**
@ -98,40 +92,6 @@ typedef NS_OPTIONS(NSUInteger, VKAuthorizationOptions) {
@end
/**
SDK UI delegate protocol.
This delegate used for managing UI events, when SDK required user action.
*/
@protocol VKSdkUIDelegate <NSObject>
/**
Pass view controller that should be presented to user. Usually, it's an authorization window.
@param controller view controller that must be shown to user
*/
- (void)vkSdkShouldPresentViewController:(UIViewController *)controller;
/**
Calls when user must perform captcha-check.
If you implementing this method by yourself, call -[VKError answerCaptcha:] method for captchaError with user entered answer.
@param captchaError error returned from API. You can load captcha image from <b>captchaImg</b> property.
*/
- (void)vkSdkNeedCaptchaEnter:(VKError *)captchaError;
@optional
/**
* Called when a controller presented by SDK will be dismissed.
*/
- (void)vkSdkWillDismissViewController:(UIViewController *)controller;
/**
* Called when a controller presented by SDK did dismiss.
*/
- (void)vkSdkDidDismissViewController:(UIViewController *)controller;
@end
/**
Entry point for using VK sdk. Should be initialized at application start.
@ -190,9 +150,6 @@ typedef NS_OPTIONS(NSUInteger, VKAuthorizationOptions) {
/// @name Delegate
///-------------------------------
/// Delegate for managing user interaction, when SDK required
@property(nonatomic, readwrite, weak) id <VKSdkUIDelegate> uiDelegate;
/// Returns a last app_id used for initializing the SDK
@property(nonatomic, readonly, copy) NSString *currentAppId;
@ -329,20 +286,3 @@ Enables or disables scheduling for requests
+ (instancetype)new NS_UNAVAILABLE;
@end
@interface UIViewController (VKController)
- (void)vks_presentViewControllerThroughDelegate;
- (void)vks_viewControllerWillDismiss;
- (void)vks_viewControllerDidDismiss;
@end
@interface VKAccessToken (Private)
- (void)notifyTokenExpired;
@end

View File

@ -39,6 +39,21 @@
#import "VKSdk.h"
#import "VKAuthorizeController.h"
#import "VKRequestsScheduler.h"
#import "UIViewController+VKSDK.h"
#import "VKAccessToken+Private.h"
#import "VKUtil.h"
#import "VKRequest.h"
#import "VKSdkVersion.h"
#import "VKPermissions.h"
#import "NSError+VKError.h"
#import "VKCaptchaViewController.h"
//#import "VKApi.h"
//#import "VKApiConst.h"
//#import "VKBatchRequest.h"
//#import "VKApiModels.h"
//#import "VKUploadImage.h"
//#import "VKShareDialogController.h"
//#import "VKActivity.h"
@interface VKWeakDelegate : NSProxy <VKSdkDelegate>
@property(nonatomic, weak) id <VKSdkDelegate> weakTarget;
@ -51,7 +66,7 @@
@interface VKSdk () <SFSafariViewControllerDelegate>
@property(nonatomic, readonly, strong) NSMutableArray *sdkDelegates;
@property(nonatomic, readonly, strong) NSMutableArray<VKWeakDelegate*> *sdkDelegates;
@property(nonatomic, assign) VKAuthorizationState authState;
@property(nonatomic, assign) VKAuthorizationOptions lastKnownOptions;
@ -60,6 +75,8 @@
@property(nonatomic, readwrite, copy) NSString *apiVersion;
@property(nonatomic, readwrite, strong) VKAccessToken *accessToken;
@property(nonatomic, weak) UIViewController *presentedSafariViewController;
@property(nonatomic, strong) UIWindow *sdkWindow;
@property(nonatomic, strong) UIWindow *keyWindow;
@property(nonatomic, strong) NSSet *permissions;
@end
@ -225,9 +242,7 @@ static NSString *VK_ACCESS_TOKEN_DEFAULTS_KEY = @"VK_ACCESS_TOKEN_DEFAULTS_KEY_D
if (instance.presentedSafariViewController) {
UIViewController *safariVC = instance.presentedSafariViewController;
[safariVC vks_viewControllerWillDismiss];
[safariVC.presentingViewController dismissViewControllerAnimated:YES completion:^{
[safariVC vks_viewControllerDidDismiss];
}];
[safariVC.presentingViewController dismissViewControllerAnimated:YES completion:nil];
instance.presentedSafariViewController = nil;
}
};
@ -589,7 +604,13 @@ static NSString *VK_ACCESS_TOKEN_DEFAULTS_KEY = @"VK_ACCESS_TOKEN_DEFAULTS_KEY_D
@implementation VKError (CaptchaRequest)
- (void)notifyCaptchaRequired {
[[VKSdk instance].uiDelegate vkSdkNeedCaptchaEnter:self];
VKSdk *instance = [VKSdk instance];
VKWeakDelegate *delegate = instance.sdkDelegates.lastObject;
if (delegate == nil || [delegate vkSdkShouldDisplayCaptchaDialog:self]) {
VKCaptchaViewController *captcha = [VKCaptchaViewController captchaControllerWithError:self];
[captcha vks_presentViewControllerThroughDelegate];
}
}
- (void)notifyAuthorizationFailed {
@ -601,20 +622,39 @@ static NSString *VK_ACCESS_TOKEN_DEFAULTS_KEY = @"VK_ACCESS_TOKEN_DEFAULTS_KEY_D
@implementation UIViewController (VKController)
static void vks_dispatch_after(NSTimeInterval seconds, void (^block)(void)) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(seconds * NSEC_PER_SEC)), dispatch_get_main_queue(), block);
}
- (void)vks_presentViewControllerThroughDelegate {
[[VKSdk instance].uiDelegate vkSdkShouldPresentViewController:self];
VKSdk *instance = [VKSdk instance];
if (instance.sdkWindow == nil) {
instance.keyWindow = [UIApplication sharedApplication].keyWindow;
UIWindow *newWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
newWindow.rootViewController = [[UIViewController alloc] initWithNibName:nil bundle:nil];
instance.sdkWindow = newWindow;
}
[instance.sdkWindow makeKeyAndVisible];
//Avoid unbalanced calls
vks_dispatch_after(0.1, ^{
[instance.sdkWindow.rootViewController presentViewController:self animated:YES completion:nil];
});
}
- (void)vks_viewControllerWillDismiss {
if ([[VKSdk instance].uiDelegate respondsToSelector:@selector(vkSdkWillDismissViewController:)]) {
[[VKSdk instance].uiDelegate vkSdkWillDismissViewController:self];
if ([self isKindOfClass:[SFSafariViewController class]]) {
vks_dispatch_after(0.3, ^{
[self vks_viewControllerDidDismiss];
});
}
}
- (void)vks_viewControllerDidDismiss {
if ([[VKSdk instance].uiDelegate respondsToSelector:@selector(vkSdkDidDismissViewController:)]) {
[[VKSdk instance].uiDelegate vkSdkDidDismissViewController:self];
}
VKSdk *instance = [VKSdk instance];
[instance.keyWindow makeKeyWindow];
instance.sdkWindow.hidden = YES;
instance.sdkWindow = nil;
instance.keyWindow = nil;
}
@end

View File

@ -0,0 +1,18 @@
//
// UIViewController+VKSDK.h
// VK-ios-sdk
//
// Created by Roman Truba on 28.06.16.
// Copyright © 2016 VK. All rights reserved.
//
@interface UIViewController (VKController)
- (void)vks_presentViewControllerThroughDelegate;
- (void)vks_viewControllerWillDismiss;
- (void)vks_viewControllerDidDismiss;
@end

View File

@ -22,6 +22,11 @@
#import "VKAuthorizeController.h"
#import "VKBundle.h"
#import "UIViewController+VKSDK.h"
#import "VKUtil.h"
#import "VKSdkVersion.h"
#import "NSError+VKError.h"
#import "VKRequest.h"
NSString *VK_AUTHORIZE_URL_STRING = @"vkauthorize://authorize";

View File

@ -24,6 +24,7 @@
#import "VKCaptchaView.h"
#import "VKUtil.h"
#import "VKSharedTransitioningObject.h"
#import "UIViewController+VKSDK.h"
@interface VKCaptchaViewController ()
@property(nonatomic, strong) VKCaptchaView *captchaView;
@ -57,7 +58,10 @@
}
- (void)captchaDidAnswered {
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
[self vks_viewControllerWillDismiss];
[self.presentingViewController dismissViewControllerAnimated:YES completion:^{
[self vks_viewControllerDidDismiss];
}];
}
- (CGRect)captchaFrameForScreenSize:(CGSize)screenSize {

View File

@ -30,6 +30,8 @@
#import "VKHTTPClient.h"
#import "VKHTTPOperation.h"
#import "VKSharedTransitioningObject.h"
#import "VKPermissions.h"
#import "NSError+VKError.h"
///----------------------------
@ -116,7 +118,7 @@
- (instancetype)initWithPostSettings:(VKPostSettings *)settings;
@end
@interface VKShareDialogControllerInternal : UIViewController <UITextViewDelegate, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, VKSdkDelegate, VKSdkUIDelegate>
@interface VKShareDialogControllerInternal : UIViewController <UITextViewDelegate, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, VKSdkDelegate>
@property(nonatomic, weak) VKShareDialogController *parent;
@property(nonatomic, readonly) UICollectionView *attachmentsScrollView;
@property(nonatomic, strong) UIBarButtonItem *sendButton;
@ -124,7 +126,6 @@
@property(nonatomic, strong) VKPostSettings *postSettings;
@property(nonatomic, assign) BOOL prepared;
@property(nonatomic, weak) id <VKSdkUIDelegate> oldDelegate;
@end
@interface VKHelperNavigationController : UINavigationController
@ -860,14 +861,6 @@ static const CGFloat kAttachmentsViewSize = 100.0f;
[[VKSdk instance] registerDelegate:self];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if (self.oldDelegate) {
[VKSdk instance].uiDelegate = self.oldDelegate;
}
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if (self.prepared) return;
@ -1021,17 +1014,13 @@ static const CGFloat kAttachmentsViewSize = 100.0f;
}
- (void)authorize:(id)sender {
self.oldDelegate = [VKSdk instance].uiDelegate;
[VKSdk instance].uiDelegate = self;
[VKSdk authorize:self.parent.requestedScope];
}
#pragma mark - VK SDK Delegate
- (void)vkSdkNeedCaptchaEnter:(VKError *)captchaError {
VKCaptchaViewController *captcha = [VKCaptchaViewController captchaControllerWithError:captchaError];
[self.navigationController presentViewController:captcha animated:YES completion:nil];
-(BOOL)vkSdkShouldDisplayCaptchaDialog:(VKError *)captchaError {
return YES;
}
- (void)vkSdkShouldPresentViewController:(UIViewController *)controller {
@ -1039,7 +1028,7 @@ static const CGFloat kAttachmentsViewSize = 100.0f;
[self.navigationController presentViewController:controller animated:YES completion:nil];
} else if ([controller isKindOfClass:[UINavigationController class]]) {
UINavigationController *nav = (UINavigationController *) controller;
UIViewController *target = nav.viewControllers[0];
UIViewController *target = nav.topViewController;
nav.viewControllers = @[];
[self.navigationController pushViewController:target animated:YES];
} else {
@ -1059,6 +1048,8 @@ static const CGFloat kAttachmentsViewSize = 100.0f;
[self setAuthorizationState:VKAuthorizationError];
}
#pragma mark -Attachments
- (void)createAttachments {