diff --git a/VK-ios-sdk.xcodeproj/project.pbxproj b/VK-ios-sdk.xcodeproj/project.pbxproj index 6ee33aa..ebae782 100755 --- a/VK-ios-sdk.xcodeproj/project.pbxproj +++ b/VK-ios-sdk.xcodeproj/project.pbxproj @@ -47,7 +47,6 @@ 1ACA6A08792E4AD2B10F1624 /* VKApiFriends.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA662E0B2D50702F4A11AD /* VKApiFriends.m */; }; 1ACA6A173F4BAA7E9AB43206 /* VKApiCaptcha.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA65061D1745F64BC42C75 /* VKApiCaptcha.m */; }; 1ACA6A898C8C008BCA5FDB67 /* VKSchool.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA66DA84E4941873ADCB4B /* VKSchool.m */; }; - 1ACA6AC9C143AC442155AD90 /* VKAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA673394DB0E515CBA9EFE /* VKAudio.m */; }; 1ACA6AD5392AA08C69341D2B /* VKOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA6FE235BA094D8E3A0189 /* VKOperation.m */; }; 1ACA6AEDDDC5D844B9FE115E /* VKApiObjectArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA68DAFB5BBB634DB0A73B /* VKApiObjectArray.m */; }; 1ACA6B4A1DE944C3C9860528 /* VKApiObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA689B3E716E1BC2A6EBEC /* VKApiObject.m */; }; @@ -140,8 +139,6 @@ F34671121B8B7D07003EF74B /* VKApi.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA6D831AF8E35C6322AB4A /* VKApi.h */; settings = {ATTRIBUTES = (Public, ); }; }; F34671131B8B7D07003EF74B /* VKUser.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA6BF00807A26E3B00BD65 /* VKUser.h */; settings = {ATTRIBUTES = (Public, ); }; }; F34671141B8B7D07003EF74B /* VKUser.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA664E5CDF97EB2648B660 /* VKUser.m */; }; - F34671151B8B7D07003EF74B /* VKAudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA60E2C646C4C6615170CD /* VKAudio.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F34671161B8B7D07003EF74B /* VKAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA673394DB0E515CBA9EFE /* VKAudio.m */; }; F34671171B8B7D07003EF74B /* VKGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA696193D3326E5462985A /* VKGroup.h */; settings = {ATTRIBUTES = (Public, ); }; }; F34671181B8B7D07003EF74B /* VKGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA6C700C815D16F08DD4CD /* VKGroup.m */; }; F34671191B8B7D07003EF74B /* VKLikes.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA630809E85C01C606C974 /* VKLikes.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -207,7 +204,6 @@ F3909FF31A9C7B24006540A6 /* VKApiCaptcha.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 1ACA68234EC488521F154B60 /* VKApiCaptcha.h */; }; F3909FF41A9C7B24006540A6 /* VKApiFriends.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 1ACA6C753D37B145C7D5B400 /* VKApiFriends.h */; }; F3909FF51A9C7B24006540A6 /* VKUser.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 1ACA6BF00807A26E3B00BD65 /* VKUser.h */; }; - F3909FF61A9C7B24006540A6 /* VKAudio.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 1ACA60E2C646C4C6615170CD /* VKAudio.h */; }; F3909FF71A9C7B24006540A6 /* VKGroup.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 1ACA696193D3326E5462985A /* VKGroup.h */; }; F3909FF81A9C7B24006540A6 /* VKLikes.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 1ACA630809E85C01C606C974 /* VKLikes.h */; }; F3909FF91A9C7B24006540A6 /* VKPhoto.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 1ACA6493701E3B36434F3F3A /* VKPhoto.h */; }; @@ -286,7 +282,6 @@ F3909FF31A9C7B24006540A6 /* VKApiCaptcha.h in Copy Files */, F3909FF41A9C7B24006540A6 /* VKApiFriends.h in Copy Files */, F3909FF51A9C7B24006540A6 /* VKUser.h in Copy Files */, - F3909FF61A9C7B24006540A6 /* VKAudio.h in Copy Files */, F3909FF71A9C7B24006540A6 /* VKGroup.h in Copy Files */, F3909FF81A9C7B24006540A6 /* VKLikes.h in Copy Files */, F3909FF91A9C7B24006540A6 /* VKPhoto.h in Copy Files */, @@ -339,7 +334,6 @@ 1ACA608862B093D6D0F46BC4 /* VKCaptchaViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKCaptchaViewController.m; sourceTree = ""; }; 1ACA60B4EF1757B412FE808D /* VKLikes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKLikes.m; sourceTree = ""; }; 1ACA60D48A519E201D9A80E9 /* VKRelative.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKRelative.m; sourceTree = ""; }; - 1ACA60E2C646C4C6615170CD /* VKAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VKAudio.h; sourceTree = ""; }; 1ACA60EB8A19FBF44B2A0769 /* VKUploadMessagesPhotoRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKUploadMessagesPhotoRequest.m; sourceTree = ""; }; 1ACA6108D9F4E0C7644BAC52 /* NSString+MD5.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+MD5.m"; sourceTree = ""; }; 1ACA6120C7B75C0CBB10FDA0 /* VKApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKApi.m; sourceTree = ""; }; @@ -374,7 +368,6 @@ 1ACA66DA84E4941873ADCB4B /* VKSchool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKSchool.m; sourceTree = ""; }; 1ACA671427725230741603BC /* VKUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VKUtil.h; sourceTree = ""; }; 1ACA671DB7C59D529BB25E7E /* VKApiWall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VKApiWall.h; sourceTree = ""; }; - 1ACA673394DB0E515CBA9EFE /* VKAudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VKAudio.m; sourceTree = ""; }; 1ACA677A8949D12D3EBD61A0 /* VKApiConst.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VKApiConst.h; sourceTree = ""; }; 1ACA67F7D247AC33989F7034 /* VKAuthorizeController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VKAuthorizeController.h; sourceTree = ""; }; 1ACA68234EC488521F154B60 /* VKApiCaptcha.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VKApiCaptcha.h; sourceTree = ""; }; @@ -558,8 +551,6 @@ 8F99D6391C42C61A0006DB03 /* VKDocs.m */, 1ACA6BF00807A26E3B00BD65 /* VKUser.h */, 1ACA664E5CDF97EB2648B660 /* VKUser.m */, - 1ACA60E2C646C4C6615170CD /* VKAudio.h */, - 1ACA673394DB0E515CBA9EFE /* VKAudio.m */, 1ACA696193D3326E5462985A /* VKGroup.h */, 1ACA6C700C815D16F08DD4CD /* VKGroup.m */, 1ACA630809E85C01C606C974 /* VKLikes.h */, @@ -797,7 +788,6 @@ F34671341B8B7D07003EF74B /* VKAuthorizeController.h in Headers */, F346711B1B8B7D07003EF74B /* VKPhoto.h in Headers */, 8F99D63A1C42C61A0006DB03 /* VKDocs.h in Headers */, - F34671151B8B7D07003EF74B /* VKAudio.h in Headers */, F34671351B8B7D07003EF74B /* VKCaptchaView.h in Headers */, F346712F1B8B7D07003EF74B /* VKUploadWallPhotoRequest.h in Headers */, F34670F81B8B7D07003EF74B /* VKPermissions.h in Headers */, @@ -921,7 +911,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = VK; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 1150; ORGANIZATIONNAME = VK; TargetAttributes = { F34670301B8B7C5A003EF74B = { @@ -937,10 +927,9 @@ }; buildConfigurationList = F3C75428182133CB00964716 /* Build configuration list for PBXProject "VK-ios-sdk" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( - English, en, Base, ru, @@ -1012,7 +1001,6 @@ F34671051B8B7D07003EF74B /* VKHTTPOperation.m in Sources */, F34670E01B8B7CD9003EF74B /* VKSharedTransitioningObject.m in Sources */, F34670D51B8B7CC7003EF74B /* VKImageParameters.m in Sources */, - F34671161B8B7D07003EF74B /* VKAudio.m in Sources */, F346711E1B8B7D07003EF74B /* VKSchool.m in Sources */, F34671111B8B7D07003EF74B /* VKResponse.m in Sources */, F34671071B8B7D07003EF74B /* VKJSONOperation.m in Sources */, @@ -1119,7 +1107,6 @@ 1ACA6A08792E4AD2B10F1624 /* VKApiFriends.m in Sources */, F3454FD01ABB1D1A00B15E85 /* VKRequestsScheduler.m in Sources */, 1ACA61EE5B7171D4F5726D08 /* VKUser.m in Sources */, - 1ACA6AC9C143AC442155AD90 /* VKAudio.m in Sources */, 1ACA6F1A8CF8466F058EE7BC /* VKGroup.m in Sources */, 1ACA618960A488A476167F98 /* VKLikes.m in Sources */, 1ACA614F27B7C856D2BB49DD /* VKPhoto.m in Sources */, @@ -1174,7 +1161,7 @@ buildSettings = { CLANG_ENABLE_MODULES = NO; CLANG_WARN_UNREACHABLE_CODE = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = ""; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; @@ -1207,7 +1194,7 @@ buildSettings = { CLANG_ENABLE_MODULES = NO; CLANG_WARN_UNREACHABLE_CODE = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -1246,7 +1233,7 @@ "$(inherited)", ); INFOPLIST_FILE = "library/Resources/Resources-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = ""; PRODUCT_BUNDLE_IDENTIFIER = "com.vk.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1266,7 +1253,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = "SDK resources/SDK resources-Prefix.pch"; INFOPLIST_FILE = "library/Resources/Resources-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = ""; PRODUCT_BUNDLE_IDENTIFIER = "com.vk.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1325,22 +1312,36 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -1364,21 +1365,35 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; @@ -1403,7 +1418,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; INSTALL_PATH = /; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_LDFLAGS = "-ObjC"; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; PRIVATE_HEADERS_FOLDER_PATH = "$(PUBLIC_HEADERS_FOLDER_PATH)/Private"; @@ -1425,7 +1440,7 @@ DSTROOT = /tmp/sdk.dst; GCC_PRECOMPILE_PREFIX_HEADER = NO; INSTALL_PATH = /; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_LDFLAGS = "-ObjC"; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; PRIVATE_HEADERS_FOLDER_PATH = "$(PUBLIC_HEADERS_FOLDER_PATH)/Private"; diff --git a/VK-ios-sdk.xcodeproj/xcshareddata/xcschemes/Framework.xcscheme b/VK-ios-sdk.xcodeproj/xcshareddata/xcschemes/Framework.xcscheme index af74597..167abdc 100755 --- a/VK-ios-sdk.xcodeproj/xcshareddata/xcschemes/Framework.xcscheme +++ b/VK-ios-sdk.xcodeproj/xcshareddata/xcschemes/Framework.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -39,17 +48,6 @@ - - - - - - - - + + + + @@ -39,17 +48,6 @@ - - - - - - - - + + + + @@ -23,17 +32,6 @@ - - - - - - - - #import #import -#import \ No newline at end of file +#import diff --git a/library/Source/API/VKApi.h b/library/Source/API/VKApi.h index 5634d8f..096a435 100644 --- a/library/Source/API/VKApi.h +++ b/library/Source/API/VKApi.h @@ -68,6 +68,12 @@ Returns object for preparing requests to groups part of API */ + (VKApiGroups *)groups; +/** +https://vk.com/dev/docs + Returns object for preparing requests to docs part of API +*/ ++ (VKApiDocs *)docs; + /** Create new request with parameters. See documentation for methods here https://vk.com/dev/methods diff --git a/library/Source/API/VKApi.m b/library/Source/API/VKApi.m index 358cf48..cf19428 100755 --- a/library/Source/API/VKApi.m +++ b/library/Source/API/VKApi.m @@ -26,6 +26,7 @@ #import "VKUploadMessagesPhotoRequest.h" @implementation VKApi + + (VKApiUsers *)users { return [VKApiUsers new]; } @@ -46,6 +47,10 @@ return [VKApiGroups new]; } ++ (VKApiDocs *)docs { + return [VKApiDocs new]; +} + + (VKRequest *)requestWithMethod:(NSString *)method andParameters:(NSDictionary *)parameters { return [VKRequest requestWithMethod:method parameters:parameters]; diff --git a/library/Source/API/methods/VKApiDocs.m b/library/Source/API/methods/VKApiDocs.m index bd555f1..3e252db 100644 --- a/library/Source/API/methods/VKApiDocs.m +++ b/library/Source/API/methods/VKApiDocs.m @@ -30,145 +30,172 @@ @implementation VKApiDocs : VKApiBase - (VKRequest *)get { - return [self prepareRequestWithMethodName:@"get" parameters:nil modelClass:[VKDocsArray class]]; + return [self prepareRequestWithMethodName:@"get" + parameters:nil + modelClass:[VKDocsArray class]]; } - (VKRequest *)get:(NSInteger)count { - return [self prepareRequestWithMethodName:@"get" parameters: @{VK_API_COUNT : @(count)} modelClass:[VKDocsArray class]]; + return [self prepareRequestWithMethodName:@"get" + parameters:@{VK_API_COUNT: @(count)} + modelClass:[VKDocsArray class]]; } - (VKRequest *)get:(NSInteger)count andOffset:(NSInteger)offset { - return [self prepareRequestWithMethodName:@"get" - parameters: - @{ - VK_API_COUNT : @(count), - VK_API_OFFSET : @(offset), - } - modelClass:[VKDocsArray class]]; + return [self prepareRequestWithMethodName:@"get" + parameters:@{ + VK_API_COUNT : @(count), + VK_API_OFFSET : @(offset) + } + modelClass:[VKDocsArray class]]; } - (VKRequest *)get:(NSInteger)count andOffset:(NSInteger)offset andOwnerID:(NSInteger)ownerID { - return [self prepareRequestWithMethodName:@"get" - parameters: - @{ - VK_API_COUNT : @(count), - VK_API_OFFSET : @(offset), - VK_API_OWNER_ID : @(ownerID), - } - modelClass:[VKDocsArray class]]; + return [self prepareRequestWithMethodName:@"get" + parameters:@{ + VK_API_COUNT : @(count), + VK_API_OFFSET : @(offset), + VK_API_OWNER_ID : @(ownerID) + } + modelClass:[VKDocsArray class]]; } - (VKRequest *)getByID:(NSArray *)IDs { - return [self prepareRequestWithMethodName:@"getById" parameters:@{@"docs" : IDs} modelClass:[VKDocsArray class]]; + return [self prepareRequestWithMethodName:@"getById" + parameters:@{@"docs" : IDs} + modelClass:[VKDocsArray class]]; } - (VKRequest *)getUploadServer { - return [self prepareRequestWithMethodName:@"getUploadServer" parameters:nil]; + return [self prepareRequestWithMethodName:@"getUploadServer" + parameters:nil]; } - (VKRequest *)getUploadServer:(NSInteger)group_id { - return [self prepareRequestWithMethodName:@"getUploadServer" parameters:@{VK_API_GROUP_ID : [@(group_id) stringValue]}]; + return [self prepareRequestWithMethodName:@"getUploadServer" + parameters:@{VK_API_GROUP_ID : @(group_id)}]; } - (VKRequest *)getWallUploadServer { - return [self prepareRequestWithMethodName:@"getWallUploadServer" parameters:nil]; + return [self prepareRequestWithMethodName:@"getWallUploadServer" + parameters:nil]; } - (VKRequest *)getWallUploadServer:(NSInteger)group_id { - return [self prepareRequestWithMethodName:@"getWallUploadServer" parameters:@{VK_API_GROUP_ID : [@(group_id) stringValue]}]; + return [self prepareRequestWithMethodName:@"getWallUploadServer" + parameters:@{VK_API_GROUP_ID : @(group_id)}]; } - (VKRequest *)save:(NSString *)file { - return [self prepareRequestWithMethodName:@"save" parameters:@{VK_API_FILE : file} modelClass:[VKDocsArray class]]; + return [self prepareRequestWithMethodName:@"save" + parameters:@{VK_API_FILE : file} + modelClass:[VKDocsArray class]]; } - (VKRequest *)save:(NSString *)file andTitle:(NSString *)title { - return [self prepareRequestWithMethodName:@"save" parameters:@{ - VK_API_FILE : file, - VK_API_TITLE : title, - } modelClass:[VKDocsArray class]]; + return [self prepareRequestWithMethodName:@"save" + parameters:@{ + VK_API_FILE : file, + VK_API_TITLE : title, + } + modelClass:[VKDocsArray class]]; } - (VKRequest *)save:(NSString *)file andTitle:(NSString *)title andTags:(NSString *)tags { - return [self prepareRequestWithMethodName:@"save" parameters:@{ - VK_API_FILE : file, - VK_API_TITLE : title, - VK_API_TAGS : tags - } modelClass:[VKDocsArray class]]; + return [self prepareRequestWithMethodName:@"save" + parameters:@{ + VK_API_FILE : file, + VK_API_TITLE : title, + VK_API_TAGS : tags + } + modelClass:[VKDocsArray class]]; } - (VKRequest *)delete:(NSInteger)ownerID andDocID:(NSInteger)docID { - return [self prepareRequestWithMethodName:@"delete" parameters:@{ - VK_API_OWNER_ID : [@(ownerID) stringValue], - VK_API_DOC_ID : [@(docID) stringValue], - }]; + return [self prepareRequestWithMethodName:@"delete" + parameters:@{ + VK_API_OWNER_ID : @(ownerID), + VK_API_DOC_ID : @(docID), + }]; } - (VKRequest *)add:(NSInteger)ownerID andDocID:(NSInteger)docID { - return [self prepareRequestWithMethodName:@"add" parameters:@{ - VK_API_OWNER_ID : [@(ownerID) stringValue], - VK_API_DOC_ID : [@(docID) stringValue] - }]; + return [self prepareRequestWithMethodName:@"add" + parameters:@{ + VK_API_OWNER_ID : @(ownerID), + VK_API_DOC_ID : @(docID) + }]; } - (VKRequest *)add:(NSInteger)ownerID andDocID:(NSInteger)docID andAccessKey:(NSString *)accessKey { - return [self prepareRequestWithMethodName:@"add" parameters:@{ - VK_API_OWNER_ID : [@(ownerID) stringValue], - VK_API_DOC_ID : [@(docID) stringValue], - VK_API_ACCESS_KEY : accessKey - }]; + return [self prepareRequestWithMethodName:@"add" + parameters:@{ + VK_API_OWNER_ID : @(ownerID), + VK_API_DOC_ID : @(docID), + VK_API_ACCESS_KEY : accessKey + }]; } - (VKRequest *)search:(NSString *)query { - return [self prepareRequestWithMethodName:@"search" parameters:@{VK_API_Q : query} modelClass:[VKDocsArray class]]; + return [self prepareRequestWithMethodName:@"search" + parameters:@{VK_API_Q : query} + modelClass:[VKDocsArray class]]; } - (VKRequest *)search:(NSString *)query count:(NSInteger)count { - return [self prepareRequestWithMethodName:@"search" parameters:@{ - VK_API_Q : query, - VK_API_COUNT : [@(count) stringValue] - } modelClass:[VKDocsArray class]]; + return [self prepareRequestWithMethodName:@"search" + parameters:@{ + VK_API_Q : query, + VK_API_COUNT : @(count) + } + modelClass:[VKDocsArray class]]; } - (VKRequest *)search:(NSString *)query count:(NSInteger)count andOffset:(NSInteger)offset { - return [self prepareRequestWithMethodName:@"search" parameters:@{ - VK_API_Q : query, - VK_API_COUNT : [@(count) stringValue], - VK_API_OFFSET : [@(offset) stringValue] - } modelClass:[VKDocsArray class]]; + return [self prepareRequestWithMethodName:@"search" + parameters:@{ + VK_API_Q : query, + VK_API_COUNT : @(count), + VK_API_OFFSET : @(offset) + } + modelClass:[VKDocsArray class]]; } - (VKRequest *)edit:(NSInteger)docID title:(NSString *)title { - return [self prepareRequestWithMethodName:@"edit" parameters:@{ - VK_API_DOC_ID : [@(docID) stringValue], - VK_API_TITLE : title - }]; + return [self prepareRequestWithMethodName:@"edit" + parameters:@{ + VK_API_DOC_ID : @(docID), + VK_API_TITLE : title + }]; } - (VKRequest *)edit:(NSInteger)docID title:(NSString *)title tags:(NSString *)tags { - return [self prepareRequestWithMethodName:@"edit" parameters:@{ - VK_API_DOC_ID : [@(docID) stringValue], - VK_API_TITLE : title, - VK_API_TAGS : tags - }]; + return [self prepareRequestWithMethodName:@"edit" + parameters:@{ + VK_API_DOC_ID : @(docID), + VK_API_TITLE : title, + VK_API_TAGS : tags + }]; } - (VKRequest *)edit:(NSInteger)ownerID docID:(NSInteger)docID title:(NSString *)title { - return [self prepareRequestWithMethodName:@"edit" parameters:@{ - VK_API_OWNER_ID : [@(ownerID) stringValue], - VK_API_DOC_ID : [@(docID) stringValue], - VK_API_TITLE : title - }]; + return [self prepareRequestWithMethodName:@"edit" + parameters:@{ + VK_API_OWNER_ID : @(ownerID), + VK_API_DOC_ID : @(docID), + VK_API_TITLE : title + }]; } - (VKRequest *)edit:(NSInteger)ownerID docID:(NSInteger)docID title:(NSString *)title tags:(NSString *)tags { - return [self prepareRequestWithMethodName:@"edit" parameters:@{ - VK_API_OWNER_ID : [@(ownerID) stringValue], - VK_API_DOC_ID : [@(docID) stringValue], - VK_API_TITLE : title, - VK_API_TAGS : tags - }]; + return [self prepareRequestWithMethodName:@"edit" + parameters:@{ + VK_API_OWNER_ID : @(ownerID), + VK_API_DOC_ID : @(docID), + VK_API_TITLE : title, + VK_API_TAGS : tags + }]; } diff --git a/library/Source/API/methods/VKApiFriends.m b/library/Source/API/methods/VKApiFriends.m index 9b100eb..9a911dc 100755 --- a/library/Source/API/methods/VKApiFriends.m +++ b/library/Source/API/methods/VKApiFriends.m @@ -25,11 +25,15 @@ @implementation VKApiFriends - (VKRequest *)get { - return [self prepareRequestWithMethodName:@"get" parameters:nil modelClass:[VKUsersArray class]]; + return [self prepareRequestWithMethodName:@"get" + parameters:nil + modelClass:[VKUsersArray class]]; } - (VKRequest *)get:(NSDictionary *)params { - return [self prepareRequestWithMethodName:@"get" parameters:params modelClass:[VKUsersArray class]]; + return [self prepareRequestWithMethodName:@"get" + parameters:params + modelClass:[VKUsersArray class]]; } @end diff --git a/library/Source/API/methods/VKApiGroups.m b/library/Source/API/methods/VKApiGroups.m index e1170dd..a61fecf 100755 --- a/library/Source/API/methods/VKApiGroups.m +++ b/library/Source/API/methods/VKApiGroups.m @@ -11,6 +11,8 @@ @implementation VKApiGroups - (VKRequest *)getById:(NSDictionary *)params { - return [self prepareRequestWithMethodName:@"getById" parameters:params modelClass:[VKGroups class]]; + return [self prepareRequestWithMethodName:@"getById" + parameters:params + modelClass:[VKGroups class]]; } @end diff --git a/library/Source/API/methods/VKApiModels.h b/library/Source/API/methods/VKApiModels.h index 7051087..01c1c14 100644 --- a/library/Source/API/methods/VKApiModels.h +++ b/library/Source/API/methods/VKApiModels.h @@ -21,13 +21,11 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #import "VKApiObjectArray.h" -#import "VKAudio.h" #import "VKPhoto.h" #import "VKLikes.h" #import "VKUser.h" #import "VKRelative.h" #import "VKCounters.h" -#import "VKLikes.h" #import "VKSchool.h" #import "VKUniversity.h" #import "VKGroup.h" diff --git a/library/Source/API/methods/VKApiPhotos.m b/library/Source/API/methods/VKApiPhotos.m index 913c662..dd6c63f 100755 --- a/library/Source/API/methods/VKApiPhotos.m +++ b/library/Source/API/methods/VKApiPhotos.m @@ -25,27 +25,36 @@ @implementation VKApiPhotos - (VKRequest *)getUploadServer:(NSInteger)albumId { - return [self prepareRequestWithMethodName:@"getUploadServer" parameters:@{VK_API_ALBUM_ID : @(albumId)}]; + return [self prepareRequestWithMethodName:@"getUploadServer" + parameters:@{VK_API_ALBUM_ID : @(albumId)}]; } - (VKRequest *)getUploadServer:(NSInteger)albumId andGroupId:(NSInteger)groupId { - return [self prepareRequestWithMethodName:@"getUploadServer" parameters:@{VK_API_ALBUM_ID : @(albumId), VK_API_GROUP_ID : @(groupId)}]; + return [self prepareRequestWithMethodName:@"getUploadServer" + parameters:@{VK_API_ALBUM_ID : @(albumId), + VK_API_GROUP_ID : @(groupId)}]; } - (VKRequest *)getWallUploadServer { - return [self prepareRequestWithMethodName:@"getWallUploadServer" parameters:nil]; + return [self prepareRequestWithMethodName:@"getWallUploadServer" + parameters:nil]; } - (VKRequest *)getWallUploadServer:(NSInteger)groupId { - return [self prepareRequestWithMethodName:@"getWallUploadServer" parameters:@{VK_API_GROUP_ID : @(groupId)}]; + return [self prepareRequestWithMethodName:@"getWallUploadServer" + parameters:@{VK_API_GROUP_ID : @(groupId)}]; } - (VKRequest *)saveWallPhoto:(NSDictionary *)params { - return [self prepareRequestWithMethodName:@"saveWallPhoto" parameters:params modelClass:[VKPhotoArray class]]; + return [self prepareRequestWithMethodName:@"saveWallPhoto" + parameters:params + modelClass:[VKPhotoArray class]]; } - (VKRequest *)save:(NSDictionary *)params { - return [self prepareRequestWithMethodName:@"save" parameters:params modelClass:[VKPhotoArray class]]; + return [self prepareRequestWithMethodName:@"save" + parameters:params + modelClass:[VKPhotoArray class]]; } @end diff --git a/library/Source/API/methods/VKApiUsers.m b/library/Source/API/methods/VKApiUsers.m index 6bbf5f5..b25b53c 100755 --- a/library/Source/API/methods/VKApiUsers.m +++ b/library/Source/API/methods/VKApiUsers.m @@ -31,23 +31,29 @@ } - (VKRequest *)get:(NSDictionary *)params { - return [self prepareRequestWithMethodName:@"get" parameters:params modelClass:[VKUsersArray class]]; + return [self prepareRequestWithMethodName:@"get" + parameters:params + modelClass:[VKUsersArray class]]; } #pragma mark search - (VKRequest *)search:(NSDictionary *)params { - return [self prepareRequestWithMethodName:@"search" parameters:params modelClass:[VKUsersArray class]]; + return [self prepareRequestWithMethodName:@"search" + parameters:params + modelClass:[VKUsersArray class]]; } #pragma mark isAppUser - (VKRequest *)isAppUser { - return [self prepareRequestWithMethodName:@"isAppUser" parameters:nil]; + return [self prepareRequestWithMethodName:@"isAppUser" + parameters:nil]; } - (VKRequest *)isAppUser:(NSInteger)userID { - return [self prepareRequestWithMethodName:@"isAppUser" parameters:@{VK_API_USER_ID : @(userID)}]; + return [self prepareRequestWithMethodName:@"isAppUser" + parameters:@{VK_API_USER_ID : @(userID)}]; } #pragma mark subscriptions @@ -57,7 +63,8 @@ } - (VKRequest *)getSubscriptions:(NSDictionary *)params { - return [self prepareRequestWithMethodName:@"getSubscriptions" parameters:params]; + return [self prepareRequestWithMethodName:@"getSubscriptions" + parameters:params]; } #pragma mark followers @@ -67,7 +74,9 @@ } - (VKRequest *)getFollowers:(NSDictionary *)params { - return [self prepareRequestWithMethodName:@"getFollowers" parameters:params modelClass:[VKUsersArray class]]; + return [self prepareRequestWithMethodName:@"getFollowers" + parameters:params + modelClass:[VKUsersArray class]]; } @end diff --git a/library/Source/API/methods/VKApiWall.m b/library/Source/API/methods/VKApiWall.m index 167c454..f2096d4 100755 --- a/library/Source/API/methods/VKApiWall.m +++ b/library/Source/API/methods/VKApiWall.m @@ -24,7 +24,8 @@ @implementation VKApiWall - (VKRequest *)post:(NSDictionary *)params { - return [self prepareRequestWithMethodName:@"post" parameters:params]; + return [self prepareRequestWithMethodName:@"post" + parameters:params]; } @end diff --git a/library/Source/API/models/VKAudio.h b/library/Source/API/models/VKAudio.h deleted file mode 100755 index 0360f6b..0000000 --- a/library/Source/API/models/VKAudio.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// VKAudio.h -// -// Copyright (c) 2014 VK.com -// -// 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 suabstantial 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 "VKApiObjectArray.h" - -@class VKUser; - -@interface VKAudio : VKApiObject - -@property(nonatomic, strong) NSNumber *id; -@property(nonatomic, strong) NSNumber *owner_id; -@property(nonatomic, strong) NSString *artist; -@property(nonatomic, strong) NSString *title; -@property(nonatomic, strong) NSNumber *duration; -@property(nonatomic, strong) NSString *url; -@property(nonatomic, strong) NSNumber *lyrics_id; -@property(nonatomic, strong) NSNumber *album_id; -@property(nonatomic, strong) NSNumber *genre_id; - -@property(nonatomic, assign) BOOL fromCache; -@property(nonatomic, assign) BOOL ignoreCache; - -@end - -@interface VKAudios : VKApiObjectArray -@property(nonatomic, strong) VKUser *user; -@end diff --git a/library/Source/API/models/VKAudio.m b/library/Source/API/models/VKAudio.m deleted file mode 100755 index 97ec625..0000000 --- a/library/Source/API/models/VKAudio.m +++ /dev/null @@ -1,52 +0,0 @@ -// -// VKAudio.m -// -// Copyright (c) 2014 VK.com -// -// 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 suabstantial 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 "VKAudio.h" -#import "VKUser.h" - -@implementation VKAudio -@end - -@implementation VKAudios -- (Class)objectClass { - return [VKAudio class]; -} - -//Parse first user in array (in some cases) -- (NSMutableArray *)parseItems:(NSArray *)toParse asClass:(Class)objectClass { - NSMutableArray *listOfParsedObjects = [NSMutableArray new]; - for (id objectDict in toParse) { - if ([objectDict isKindOfClass:objectClass]) - [listOfParsedObjects addObject:objectDict]; - else if ([objectDict isKindOfClass:[NSDictionary class]]) { - if ([toParse firstObject] == objectDict && objectDict[@"name"]) { - self.user = [[VKUser alloc] initWithDictionary:objectDict]; - } else { - [listOfParsedObjects addObject:[(VKApiObject *) [objectClass alloc] initWithDictionary:objectDict]]; - } - } - else - [listOfParsedObjects addObject:objectDict]; - } - return listOfParsedObjects; -} -@end diff --git a/library/Source/API/models/VKCounters.h b/library/Source/API/models/VKCounters.h index 591cfaa..cf27abf 100755 --- a/library/Source/API/models/VKCounters.h +++ b/library/Source/API/models/VKCounters.h @@ -23,25 +23,20 @@ #import "VKApiObject.h" @interface VKCounters : VKApiObject -@property(nonatomic, strong) NSNumber *friends; -@property(nonatomic, strong) NSNumber *messages; -@property(nonatomic, strong) NSNumber *photos; -@property(nonatomic, strong) NSNumber *videos; -@property(nonatomic, strong) NSNumber *notifications; -@property(nonatomic, strong) NSNumber *groups; -@property(nonatomic, strong) NSNumber *gifts; -@property(nonatomic, strong) NSNumber *events; @property(nonatomic, strong) NSNumber *albums; @property(nonatomic, strong) NSNumber *audios; -@property(nonatomic, strong) NSNumber *online_friends; -@property(nonatomic, strong) NSNumber *mutual_friends; -@property(nonatomic, strong) NSNumber *user_videos; +@property(nonatomic, strong) NSNumber *docs; @property(nonatomic, strong) NSNumber *followers; -@property(nonatomic, strong) NSNumber *user_photos; -@property(nonatomic, strong) NSNumber *subscriptions; -@property(nonatomic, strong) NSNumber *documents; -@property(nonatomic, strong) NSNumber *topics; +@property(nonatomic, strong) NSNumber *friends; +@property(nonatomic, strong) NSNumber *groups; +@property(nonatomic, strong) NSNumber *mutual_friends; +@property(nonatomic, strong) NSNumber *notes; +@property(nonatomic, strong) NSNumber *online_friends; @property(nonatomic, strong) NSNumber *pages; +@property(nonatomic, strong) NSNumber *photos; +@property(nonatomic, strong) NSNumber *topics; +@property(nonatomic, strong) NSNumber *user_videos; +@property(nonatomic, strong) NSNumber *videos; @end diff --git a/library/Source/API/models/VKDocs.h b/library/Source/API/models/VKDocs.h index 1985e15..cc5f92c 100644 --- a/library/Source/API/models/VKDocs.h +++ b/library/Source/API/models/VKDocs.h @@ -24,7 +24,29 @@ #import "VKApiObject.h" #import "VKApiObjectArray.h" -@class VKDocs; +@class VKPhoto; + +@interface VKGraffiti : VKApiObject +@property(nonatomic, strong) NSString *src; +@property(nonatomic, strong) NSNumber *width; +@property(nonatomic, strong) NSNumber *height; +@end + +@interface VKAudioMsg : VKApiObject +@property(nonatomic, strong) NSNumber *duration; +@property(nonatomic, strong) NSArray *waveform; +@property(nonatomic, strong) NSString *link_ogg; +@property(nonatomic, strong) NSString *link_mp3; +@end + +/** + Document preview data. +*/ +@interface VKDocsPreview : VKApiObject +@property(nonatomic, strong) VKPhoto *photo; +@property(nonatomic, strong) VKGraffiti *graffiti; +@property(nonatomic, strong) VKAudioMsg *audio_msg; +@end /** Docs type of VK API. See descriptions here https://vk.com/dev/doc @@ -36,10 +58,9 @@ @property(nonatomic, strong) NSNumber *size; @property(nonatomic, copy) NSString *ext; @property(nonatomic, copy) NSString *url; -@property(nonatomic, copy) NSString *photo_100; -@property(nonatomic, copy) NSString *photo_130; @property(nonatomic, strong) NSNumber *date; @property(nonatomic, strong) NSNumber *type; +@property(nonatomic, strong) VKDocsPreview *preview; @end /** diff --git a/library/Source/API/models/VKDocs.m b/library/Source/API/models/VKDocs.m index a0bf0e8..dd710e2 100644 --- a/library/Source/API/models/VKDocs.m +++ b/library/Source/API/models/VKDocs.m @@ -23,6 +23,15 @@ #import "VKDocs.h" +@implementation VKGraffiti +@end + +@implementation VKAudioMsg +@end + +@implementation VKDocsPreview +@end + @implementation VKDocs @end diff --git a/library/Source/API/models/VKGroup.h b/library/Source/API/models/VKGroup.h index 2e3ba15..4e29670 100755 --- a/library/Source/API/models/VKGroup.h +++ b/library/Source/API/models/VKGroup.h @@ -65,7 +65,46 @@ /** Array of VKGroupLink objects */ -@interface VKGroupLinks : VKApiObjectArray +@interface VKGroupLinks : VKApiObjectArray +@end + +@interface VKAddresses : VKApiObject +@property(nonatomic, assign) BOOL is_enabled; +@property(nonatomic, strong) NSNumber *main_address_id; +@end + +@interface VKBanInfo : VKApiObject +@property(nonatomic, strong) NSNumber *end_date; +@property(nonatomic, strong) NSString *comment; +@end + +@interface VKCoverImage : VKApiObject +@property(nonatomic, strong) NSString *url; +@property(nonatomic, strong) NSNumber *width; +@property(nonatomic, strong) NSNumber *height; +@end + +@interface VKCoverImages : VKApiObjectArray +@end + +@interface VKCover: VKApiObject +@property(nonatomic, strong) NSNumber *enabled; +@property(nonatomic, strong) VKCoverImages *images; +@end + +@interface VKCurrency : VKApiObject +@property(nonatomic, strong) NSNumber *id; +@property(nonatomic, strong) NSString *name; +@end + +@interface VKMarket: VKApiObject +@property(nonatomic, strong) NSNumber *enabled; +@property(nonatomic, strong) NSNumber *price_min; +@property(nonatomic, strong) NSNumber *price_max; +@property(nonatomic, strong) NSNumber *main_album_id; +@property(nonatomic, strong) NSNumber *contact_id; +@property(nonatomic, strong) VKCurrency *currency; +@property(nonatomic, strong) NSString *currency_text; @end /** @@ -76,44 +115,55 @@ @property(nonatomic, strong) NSString *name; @property(nonatomic, strong) NSString *screen_name; @property(nonatomic, strong) NSNumber *is_closed; -@property(nonatomic, strong) NSString *type; +@property(nonatomic, strong) NSString *deactivated; @property(nonatomic, strong) NSNumber *is_admin; @property(nonatomic, strong) NSNumber *admin_level; @property(nonatomic, strong) NSNumber *is_member; -@property(nonatomic, strong) VKCity *city; -@property(nonatomic, strong) VKCountry *country; -@property(nonatomic, strong) VKGeoPlace *place; -@property(nonatomic, strong) NSString *description; -@property(nonatomic, strong) NSString *wiki_page; -@property(nonatomic, strong) NSNumber *members_count; -@property(nonatomic, strong) VKCounters *counters; -@property(nonatomic, strong) NSNumber *start_date; -@property(nonatomic, strong) NSNumber *end_date; -@property(nonatomic, strong) NSNumber *finish_date; -@property(nonatomic, strong) NSNumber *can_post; -@property(nonatomic, strong) NSNumber *can_see_all_posts; -@property(nonatomic, strong) NSNumber *can_create_topic; -@property(nonatomic, strong) NSNumber *can_upload_doc; -@property(nonatomic, strong) NSString *activity; -@property(nonatomic, strong) NSString *status; -@property(nonatomic, strong) VKAudio *status_audio; -@property(nonatomic, strong) VKGroupContacts *contacts; -@property(nonatomic, strong) VKGroupLinks *links; -@property(nonatomic, strong) NSNumber *fixed_post; -@property(nonatomic, strong) NSNumber *verified; -@property(nonatomic, strong) NSString *site; +@property(nonatomic, strong) NSNumber *is_advertiser; +@property(nonatomic, strong) NSNumber *invited_by; +@property(nonatomic, strong) NSString *type; @property(nonatomic, strong) NSString *photo_50; @property(nonatomic, strong) NSString *photo_100; @property(nonatomic, strong) NSString *photo_200; -@property(nonatomic, strong) NSString *photo_max_orig; -@property(nonatomic, strong) NSNumber *is_request; -@property(nonatomic, strong) NSNumber *is_invite; -@property(nonatomic, strong) VKPhotoArray *photos; -@property(nonatomic, strong) NSNumber *photos_count; -@property(nonatomic, strong) NSNumber *invited_by; -@property(nonatomic, assign) NSInteger invite_state; -@property(nonatomic, strong) NSString *deactivated; -@property(nonatomic, strong) NSNumber *blacklisted; + +@property(nonatomic, strong) NSString *activity; +@property(nonatomic, strong) VKAddresses *addresses; +@property(nonatomic, strong) NSNumber *age_limits; +@property(nonatomic, strong) VKBanInfo *ban_info; +@property(nonatomic, strong) NSNumber *can_create_topic; +@property(nonatomic, strong) NSNumber *can_message; +@property(nonatomic, strong) NSNumber *can_post; +@property(nonatomic, strong) NSNumber *can_see_all_posts; +@property(nonatomic, strong) NSNumber *can_upload_doc; +@property(nonatomic, strong) NSNumber *can_upload_video; +@property(nonatomic, strong) VKCity *city; +@property(nonatomic, strong) VKGroupContacts *contacts; +@property(nonatomic, strong) VKCounters *counters; +@property(nonatomic, strong) VKCountry *country; +@property(nonatomic, strong) VKCover *cover; +@property(nonatomic, strong) VKCropPhoto *crop_photo; +@property(nonatomic, strong) NSString *description; +@property(nonatomic, strong) NSNumber *fixed_post; +@property(nonatomic, strong) NSNumber *has_photo; +@property(nonatomic, strong) NSNumber *is_favorite; +@property(nonatomic, strong) NSNumber *is_hidden_from_feed; +@property(nonatomic, strong) NSNumber *is_messages_blocked; +@property(nonatomic, strong) VKGroupLinks *links; +@property(nonatomic, strong) NSNumber *main_album_id; +@property(nonatomic, strong) NSNumber *main_section; +@property(nonatomic, strong) VKMarket *market; +@property(nonatomic, strong) NSNumber *member_status; +@property(nonatomic, strong) NSNumber *members_count; +@property(nonatomic, strong) VKGeoPlace *place; +@property(nonatomic, strong) NSString *public_date_label; +@property(nonatomic, strong) NSString *site; +@property(nonatomic, strong) NSNumber *start_date; +@property(nonatomic, strong) NSNumber *finish_date; +@property(nonatomic, strong) NSString *status; +@property(nonatomic, strong) NSString *trending; +@property(nonatomic, strong) NSNumber *verified; +@property(nonatomic, strong) NSNumber *wall; +@property(nonatomic, strong) NSString *wiki_page; @end diff --git a/library/Source/API/models/VKPhoto.h b/library/Source/API/models/VKPhoto.h index f5acb7e..00e8832 100755 --- a/library/Source/API/models/VKPhoto.h +++ b/library/Source/API/models/VKPhoto.h @@ -24,8 +24,6 @@ #import "VKApiObjectArray.h" #import "VKPhotoSize.h" -@class VKLikes; - /** Photo type of VK API. See descriptions here https://vk.com/dev/photo */ @@ -33,17 +31,13 @@ Photo type of VK API. See descriptions here https://vk.com/dev/photo @property(nonatomic, strong) NSNumber *id; @property(nonatomic, strong) NSNumber *album_id; @property(nonatomic, strong) NSNumber *owner_id; -@property(nonatomic, strong) NSString *photo_75; -@property(nonatomic, strong) NSString *photo_130; -@property(nonatomic, strong) NSString *photo_604; -@property(nonatomic, strong) NSString *photo_807; -@property(nonatomic, strong) NSString *photo_1280; -@property(nonatomic, strong) NSString *photo_2560; -@property(nonatomic, strong) NSNumber *width; -@property(nonatomic, strong) NSNumber *height; +@property(nonatomic, strong) NSNumber *user_id; @property(nonatomic, strong) NSString *text; @property(nonatomic, strong) NSNumber *date; @property(nonatomic, strong) VKPhotoSizes *sizes; +@property(nonatomic, strong) NSNumber *width; +@property(nonatomic, strong) NSNumber *height; + @property(nonatomic, readonly) NSString *attachmentString; @end diff --git a/library/Source/API/models/VKRelative.h b/library/Source/API/models/VKRelative.h index 0a50323..2204b42 100755 --- a/library/Source/API/models/VKRelative.h +++ b/library/Source/API/models/VKRelative.h @@ -25,6 +25,7 @@ @interface VKRelative : VKApiObject @property(nonatomic, strong) NSNumber *id; +@property(nonatomic, strong) NSString *name; @property(nonatomic, strong) NSString *type; @end diff --git a/library/Source/API/models/VKUser.h b/library/Source/API/models/VKUser.h index 2c2ab99..301efa0 100755 --- a/library/Source/API/models/VKUser.h +++ b/library/Source/API/models/VKUser.h @@ -23,7 +23,6 @@ #import #import "VKApiObject.h" #import "VKApiObjectArray.h" -#import "VKAudio.h" #import "VKCounters.h" #import "VKPhoto.h" #import "VKSchool.h" @@ -45,12 +44,12 @@ * User personal information (field 'personal') */ @interface VKPersonal : VKObject -@property(nonatomic, strong) NSArray *langs; @property(nonatomic, strong) NSNumber *political; +@property(nonatomic, strong) NSArray *langs; @property(nonatomic, strong) NSString *religion; -@property(nonatomic, strong) NSNumber *life_main; -@property(nonatomic, strong) NSNumber *people_main; @property(nonatomic, strong) NSString *inspired_by; +@property(nonatomic, strong) NSNumber *people_main; +@property(nonatomic, strong) NSNumber *life_main; @property(nonatomic, strong) NSNumber *smoking; @property(nonatomic, strong) NSNumber *alcohol; @end @@ -73,6 +72,59 @@ @property(nonatomic, strong) NSNumber *instagram; @end +/** + Information about user's career (field 'career') + */ +@interface VKCareer : VKApiObject +@property(nonatomic, strong) NSNumber *group_id; +@property(nonatomic, strong) NSString *company; +@property(nonatomic, strong) NSNumber *country_id; +@property(nonatomic, strong) NSNumber *city_id; +@property(nonatomic, strong) NSString *city_name; +@property(nonatomic, strong) NSNumber *from; +@property(nonatomic, strong) NSNumber *until; +@property(nonatomic, strong) NSString *position; +@end + +/** + Cropped user photo. +*/ +@interface VKCrop: VKApiObject +@property(nonatomic, strong) NSNumber *x; +@property(nonatomic, strong) NSNumber *y; +@property(nonatomic, strong) NSNumber *x2; +@property(nonatomic, strong) NSNumber *y2; +@end + +/** + Data about points used for cropping of profile and preview user photos. +*/ +@interface VKCropPhoto : VKApiObject +@property(nonatomic, strong) VKPhoto *photo; +@property(nonatomic, strong) VKCrop *crop; +@property(nonatomic, strong) VKCrop *rect; +@end + +/** + Information about user's military service. +*/ +@interface VKMilitary: VKApiObject +@property(nonatomic, strong) NSString *unit; +@property(nonatomic, strong) NSNumber *unit_id; +@property(nonatomic, strong) NSNumber *country_id; +@property(nonatomic, strong) NSNumber *from; +@property(nonatomic, strong) NSNumber *until; +@end + +/** + User's occupation +*/ +@interface VKOccupation: VKApiObject +@property(nonatomic, strong) NSString *type; +@property(nonatomic, strong) NSNumber *id; +@property(nonatomic, strong) NSString *name; +@end + /** User type of VK API. See descriptions here https://vk.com/dev/fields */ @@ -80,87 +132,107 @@ @property(nonatomic, strong) NSNumber *id; @property(nonatomic, strong) NSString *first_name; @property(nonatomic, strong) NSString *last_name; -@property(nonatomic, strong) NSString *first_name_acc; -@property(nonatomic, strong) NSString *last_name_acc; -@property(nonatomic, strong) NSString *first_name_gen; -@property(nonatomic, strong) NSString *last_name_gen; -@property(nonatomic, strong) NSString *first_name_dat; -@property(nonatomic, strong) NSString *last_name_dat; -@property(nonatomic, strong) NSString *first_name_ins; -@property(nonatomic, strong) NSString *last_name_ins; -@property(nonatomic, strong) NSString *domain; -@property(nonatomic, strong) VKPersonal *personal; -@property(nonatomic, strong) NSNumber *sex; -@property(nonatomic, strong) NSNumber *invited_by; -@property(nonatomic, strong) NSNumber *online; +@property(nonatomic, strong) NSString *deactivated; +@property(nonatomic, strong) NSNumber *is_closed; +@property(nonatomic, strong) NSNumber *can_access_closed; + +@property(nonatomic, strong) NSString *about; +@property(nonatomic, strong) NSString *activities; @property(nonatomic, strong) NSString *bdate; -@property(nonatomic, strong) VKCity *city; -@property(nonatomic, strong) VKCountry *country; -@property(nonatomic, strong) NSMutableArray *lists; -@property(nonatomic, strong) NSString *screen_name; -@property(nonatomic, strong) NSNumber *has_mobile; -@property(nonatomic, strong) NSNumber *rate; -@property(nonatomic, strong) NSString *mobile_phone; -@property(nonatomic, strong) NSString *home_phone; +@property(nonatomic, assign) BOOL blacklisted; +@property(nonatomic, assign) BOOL blacklisted_by_me; +@property(nonatomic, strong) NSString *books; @property(nonatomic, assign) BOOL can_post; @property(nonatomic, assign) BOOL can_see_all_posts; -@property(nonatomic, strong) NSString *status; -@property(nonatomic, strong) VKAudio *status_audio; -@property(nonatomic, assign) bool status_loaded; -@property(nonatomic, strong) VKLastSeen *last_seen; -@property(nonatomic, strong) NSNumber *relation; -@property(nonatomic, strong) VKUser *relation_partner; -@property(nonatomic, strong) VKCounters *counters; -@property(nonatomic, strong) NSString *nickname; -@property(nonatomic, strong) VKExports *exports; -@property(nonatomic, strong) NSNumber *wall_comments; -@property(nonatomic, assign) BOOL can_write_private_message; @property(nonatomic, assign) BOOL can_see_audio; -@property(nonatomic, strong) NSString *phone; -@property(nonatomic, strong) NSNumber *online_mobile; -@property(nonatomic, strong) NSNumber *faculty; -@property(nonatomic, strong) NSNumber *university; -@property(nonatomic, strong) VKUniversities *universities; -@property(nonatomic, strong) VKSchools *schools; -@property(nonatomic, strong) NSNumber *graduation; -@property(nonatomic, strong) NSNumber *friendState; +@property(nonatomic, assign) BOOL can_see_friend_request; +@property(nonatomic, assign) BOOL can_write_private_message; +@property(nonatomic, strong) VKCareer *career; +@property(nonatomic, strong) VKCity *city; @property(nonatomic, strong) NSNumber *common_count; -@property(nonatomic, strong) NSString *faculty_name; -@property(nonatomic, strong) NSString *university_name; -@property(nonatomic, strong) NSString *books; +@property(nonatomic, strong) VKCounters *counters; +@property(nonatomic, strong) VKCountry *country; +@property(nonatomic, strong) VKCropPhoto *crop_photo; +@property(nonatomic, strong) NSString *domain; +@property(nonatomic, strong) VKExports *exports; + +@property(nonatomic, strong) NSString *first_name_nom; +@property(nonatomic, strong) NSString *first_name_gen; +@property(nonatomic, strong) NSString *first_name_dat; +@property(nonatomic, strong) NSString *first_name_acc; +@property(nonatomic, strong) NSString *first_name_ins; +@property(nonatomic, strong) NSString *first_name_abl; + +@property(nonatomic, strong) NSNumber *followers_count; +@property(nonatomic, strong) NSNumber *friend_status; @property(nonatomic, strong) NSString *games; +@property(nonatomic, assign) BOOL has_mobile; +@property(nonatomic, assign) BOOL has_photo; +@property(nonatomic, strong) NSString *home_phone; +@property(nonatomic, strong) NSString *home_town; @property(nonatomic, strong) NSString *interests; +@property(nonatomic, assign) BOOL is_favorite; +@property(nonatomic, assign) BOOL is_friend; +@property(nonatomic, assign) BOOL is_hidden_from_feed; + +@property(nonatomic, strong) NSString *last_name_nom; +@property(nonatomic, strong) NSString *last_name_gen; +@property(nonatomic, strong) NSString *last_name_dat; +@property(nonatomic, strong) NSString *last_name_acc; +@property(nonatomic, strong) NSString *last_name_ins; +@property(nonatomic, strong) NSString *last_name_abl; + +@property(nonatomic, strong) VKLastSeen *last_seen; +@property(nonatomic, strong) NSString *lists; +@property(nonatomic, strong) NSString *maiden_name; +@property(nonatomic, strong) VKMilitary *military; +@property(nonatomic, strong) NSString *mobile_phone; @property(nonatomic, strong) NSString *movies; -@property(nonatomic, strong) NSString *tv; -@property(nonatomic, strong) NSString *about; @property(nonatomic, strong) NSString *music; -@property(nonatomic, strong) NSString *quoutes; -@property(nonatomic, strong) NSString *activities; -@property(nonatomic, strong) NSString *photo_max; +@property(nonatomic, strong) NSString *nickname; +@property(nonatomic, strong) VKOccupation *occupation; +@property(nonatomic, assign) BOOL online; +@property(nonatomic, assign) BOOL online_mobile; +@property(nonatomic, strong) NSNumber *online_app; +@property(nonatomic, strong) VKPersonal *personal; + @property(nonatomic, strong) NSString *photo_50; @property(nonatomic, strong) NSString *photo_100; @property(nonatomic, strong) NSString *photo_200; @property(nonatomic, strong) NSString *photo_200_orig; @property(nonatomic, strong) NSString *photo_400_orig; +@property(nonatomic, strong) NSString *photo_id; +@property(nonatomic, strong) NSString *photo_max; @property(nonatomic, strong) NSString *photo_max_orig; -@property(nonatomic, strong) VKPhotoArray *photos; -@property(nonatomic, strong) NSNumber *photos_count; + +@property(nonatomic, strong) NSString *quoutes; @property(nonatomic, strong) VKRelativities *relatives; -@property(nonatomic, assign) NSTimeInterval bdateIntervalSort; -@property(nonatomic, strong) NSNumber *verified; -@property(nonatomic, strong) NSString *deactivated; +@property(nonatomic, strong) NSNumber *relation; +@property(nonatomic, strong) VKSchools *schools; +@property(nonatomic, strong) NSString *screen_name; +@property(nonatomic, strong) NSNumber *sex; @property(nonatomic, strong) NSString *site; -@property(nonatomic, strong) NSString *home_town; -@property(nonatomic, strong) NSNumber *blacklisted; -@property(nonatomic, strong) NSNumber *blacklisted_by_me; -@property(nonatomic, strong) NSString *twitter; -@property(nonatomic, strong) NSString *skype; -@property(nonatomic, strong) NSString *facebook; -@property(nonatomic, strong) NSString *instagram; -@property(nonatomic, strong) NSString *livejournal; +@property(nonatomic, strong) NSString *status; +@property(nonatomic, strong) NSNumber *timezone; +@property(nonatomic, assign) BOOL trending; +@property(nonatomic, strong) NSString *tv; + +@property(nonatomic, strong) NSNumber *university; +@property(nonatomic, strong) VKUniversities *universities; +@property(nonatomic, strong) NSString *university_name; +@property(nonatomic, strong) NSNumber *faculty; +@property(nonatomic, strong) NSString *faculty_name; +@property(nonatomic, strong) NSNumber *graduation; + +@property(nonatomic, assign) BOOL verified; @property(nonatomic, strong) NSString *wall_default; -@property(nonatomic, strong) NSNumber *followers_count; +@property(nonatomic, strong) NSString *skype; +@property(nonatomic, strong) NSString *facebook; +@property(nonatomic, strong) NSString *twitter; +@property(nonatomic, strong) NSString *livejournal; +@property(nonatomic, strong) NSString *instagram; + @end /** diff --git a/library/Source/API/models/VKUser.m b/library/Source/API/models/VKUser.m index 92ba10a..0bd13c8 100755 --- a/library/Source/API/models/VKUser.m +++ b/library/Source/API/models/VKUser.m @@ -33,6 +33,13 @@ @end +@implementation VKUsersArray + +-(Class)objectClass { + return [VKUser class]; +} +@end + @implementation VKGeoObject @end @@ -45,9 +52,19 @@ @implementation VKExports @end -@implementation VKUsersArray - --(Class)objectClass { - return [VKUser class]; -} +@implementation VKCareer @end + + +@implementation VKCrop +@end + +@implementation VKCropPhoto +@end + +@implementation VKMilitary +@end + +@implementation VKOccupation +@end + diff --git a/library/Source/API/upload/VKUploadPhotoBase.m b/library/Source/API/upload/VKUploadPhotoBase.m index 3c111f0..0a51612 100755 --- a/library/Source/API/upload/VKUploadPhotoBase.m +++ b/library/Source/API/upload/VKUploadPhotoBase.m @@ -90,37 +90,39 @@ extern inline BOOL VKStateTransitionIsValid(VKOperationState fromState, VKOperat VKRequest *serverRequest = [_uploadRequest getServerRequest]; serverRequest.responseQueue = self.responseQueue; + __weak typeof(self) wself = self; serverRequest.completeBlock = ^(VKResponse *response) { + __strong typeof(self) self = wself; NSData *imageData = nil; - switch (_uploadRequest.imageParameters.imageType) { + switch (self->_uploadRequest.imageParameters.imageType) { case VKImageTypeJpg: - imageData = UIImageJPEGRepresentation(_uploadRequest.image, _uploadRequest.imageParameters.jpegQuality); + imageData = UIImageJPEGRepresentation(self->_uploadRequest.image, self->_uploadRequest.imageParameters.jpegQuality); break; case VKImageTypePng: - imageData = UIImagePNGRepresentation(_uploadRequest.image); + imageData = UIImagePNGRepresentation(self->_uploadRequest.image); break; default: break; } - _uploadRequest.image = nil; + self->_uploadRequest.image = nil; VKRequest *postFileRequest = [VKRequest photoRequestWithPostUrl:response.json[@"upload_url"] - withPhotos:@[[VKUploadImage uploadImageWithData:imageData andParams:_uploadRequest.imageParameters]]]; - postFileRequest.progressBlock = _uploadRequest.progressBlock; + withPhotos:@[[VKUploadImage uploadImageWithData:imageData andParams:self->_uploadRequest.imageParameters]]]; + postFileRequest.progressBlock = self->_uploadRequest.progressBlock; postFileRequest.responseQueue = self.responseQueue; self.lastLoadingRequest = postFileRequest; [postFileRequest executeWithResultBlock:^(VKResponse *response) { - VKRequest *saveRequest = [_uploadRequest getSaveRequest:response]; + VKRequest *saveRequest = [self->_uploadRequest getSaveRequest:response]; saveRequest.responseQueue = self.responseQueue; self.lastLoadingRequest = saveRequest; [saveRequest executeWithResultBlock:^(VKResponse *response) { - response.request = _uploadRequest; + response.request = self->_uploadRequest; - if (_uploadRequest.completeBlock) _uploadRequest.completeBlock(response); + if (self->_uploadRequest.completeBlock) self->_uploadRequest.completeBlock(response); [weakSelf finish]; - } errorBlock:_uploadRequest.errorBlock]; - } errorBlock:_uploadRequest.errorBlock]; + } errorBlock:self.uploadRequest.errorBlock]; + } errorBlock:self.uploadRequest.errorBlock]; }; serverRequest.errorBlock = _uploadRequest.errorBlock; self.lastLoadingRequest = serverRequest; diff --git a/library/Source/Core/VKRequest.m b/library/Source/Core/VKRequest.m index f8dfd6b..c2dd6e3 100755 --- a/library/Source/Core/VKRequest.m +++ b/library/Source/Core/VKRequest.m @@ -297,8 +297,8 @@ void vksdk_dispatch_on_main_queue_now(void(^block)(void)) { } [operation setCompletionBlockWithSuccess:^(VKHTTPOperation *completedOperation, id JSON) { - [_requestTiming loaded]; - if (_executionOperation.isCancelled) { + [self->_requestTiming loaded]; + if (self->_executionOperation.isCancelled) { return; } if ([JSON objectForKey:@"error"]) { @@ -310,9 +310,9 @@ void vksdk_dispatch_on_main_queue_now(void(^block)(void)) { return; } [self provideResponse:JSON responseString:completedOperation.responseString]; - } failure:^(VKHTTPOperation *completedOperation, NSError *error) { - [_requestTiming loaded]; - if (_executionOperation.isCancelled) { + } failure:^(VKHTTPOperation *completedOperation, NSError *error) { + [self->_requestTiming loaded]; + if (self->_executionOperation.isCancelled) { return; } if (completedOperation.response.statusCode == 200) { @@ -322,14 +322,14 @@ void vksdk_dispatch_on_main_queue_now(void(^block)(void)) { if (self.attempts == 0 || ++self.attemptsUsed < self.attempts) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (300 * NSEC_PER_MSEC)), self.responseQueue, ^(void) { - [self executeWithResultBlock:_completeBlock errorBlock:_errorBlock]; + [self executeWithResultBlock:self->_completeBlock errorBlock:self->_errorBlock]; }); return; } VKError *vkErr = [VKError errorWithCode:completedOperation.response ? completedOperation.response.statusCode : error.code]; [self provideError:[error copyWithVkError:vkErr]]; - [_requestTiming finished]; + [self->_requestTiming finished]; }]; operation.successCallbackQueue = operation.failureCallbackQueue = [VKRequest processingQueue]; @@ -423,7 +423,7 @@ void vksdk_dispatch_on_main_queue_now(void(^block)(void)) { if (self.errorBlock) { self.errorBlock(self.error); } - for (VKRequest *postRequest in _postRequestsQueue) { + for (VKRequest *postRequest in self->_postRequestsQueue) { if (postRequest.errorBlock) { postRequest.errorBlock(self.error); } @@ -515,7 +515,7 @@ void vksdk_dispatch_on_main_queue_now(void(^block)(void)) { if (error.apiError.errorCode == 6) { //Too many requests per second dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (_waitMultiplier * NSEC_PER_SEC)), [[self class] processingQueue], ^{ - _waitMultiplier *= ((arc4random() % 10) + 10) / 10.f; + self->_waitMultiplier *= ((arc4random() % 10) + 10) / 10.f; [self repeat]; }); return YES; diff --git a/library/Source/Core/VKRequestsScheduler.m b/library/Source/Core/VKRequestsScheduler.m index 9149e20..2636fea 100755 --- a/library/Source/Core/VKRequestsScheduler.m +++ b/library/Source/Core/VKRequestsScheduler.m @@ -91,24 +91,24 @@ dispatch_async(_schedulerQueue, ^{ NSTimeInterval now = [[NSDate new] timeIntervalSince1970]; NSInteger thisSecond = (NSInteger) now; - if (!_scheduleDict) { - _scheduleDict = [NSMutableDictionary new]; + if (!self->_scheduleDict) { + self->_scheduleDict = [NSMutableDictionary new]; } - NSArray *keysToRemove = [[_scheduleDict allKeys] filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF < %d", thisSecond]]; - [_scheduleDict removeObjectsForKeys:keysToRemove]; - NSInteger countForSecond = [_scheduleDict[@(thisSecond)] integerValue]; - if (countForSecond < _currentLimitPerSecond) { - _scheduleDict[@(thisSecond)] = @(++countForSecond); + NSArray *keysToRemove = [[self->_scheduleDict allKeys] filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF < %d", thisSecond]]; + [self->_scheduleDict removeObjectsForKeys:keysToRemove]; + NSInteger countForSecond = [self->_scheduleDict[@(thisSecond)] integerValue]; + if (countForSecond < self->_currentLimitPerSecond) { + self->_scheduleDict[@(thisSecond)] = @(++countForSecond); [req start]; } else { CGFloat delay = [self currentAvailableInterval], step = delay; - while ([_scheduleDict[@(thisSecond)] integerValue] >= _currentLimitPerSecond) { + while ([self->_scheduleDict[@(thisSecond)] integerValue] >= self->_currentLimitPerSecond) { delay += step; thisSecond = (NSInteger) (now + delay); } - NSInteger nextSecCount = [_scheduleDict[@(thisSecond)] integerValue]; + NSInteger nextSecCount = [self->_scheduleDict[@(thisSecond)] integerValue]; delay += step * nextSecCount; - _scheduleDict[@(thisSecond)] = @(++nextSecCount); + self->_scheduleDict[@(thisSecond)] = @(++nextSecCount); dispatch_sync(dispatch_get_main_queue(), ^{ [req performSelector:@selector(start) withObject:nil afterDelay:delay inModes:@[NSRunLoopCommonModes]]; }); diff --git a/library/Source/VKPermissions.h b/library/Source/VKPermissions.h index 576f350..65bb401 100755 --- a/library/Source/VKPermissions.h +++ b/library/Source/VKPermissions.h @@ -25,7 +25,6 @@ extern NSString *const VK_PER_NOTIFY; extern NSString *const VK_PER_FRIENDS; extern NSString *const VK_PER_PHOTOS; -extern NSString *const VK_PER_AUDIO; extern NSString *const VK_PER_VIDEO; extern NSString *const VK_PER_DOCS; extern NSString *const VK_PER_NOTES; diff --git a/library/Source/VKPermissions.m b/library/Source/VKPermissions.m index 04dc97e..517bf3b 100755 --- a/library/Source/VKPermissions.m +++ b/library/Source/VKPermissions.m @@ -25,7 +25,6 @@ NSString *const VK_PER_NOTIFY = @"notify"; NSString *const VK_PER_FRIENDS = @"friends"; NSString *const VK_PER_PHOTOS = @"photos"; -NSString *const VK_PER_AUDIO = @"audio"; NSString *const VK_PER_VIDEO = @"video"; NSString *const VK_PER_DOCS = @"docs"; NSString *const VK_PER_NOTES = @"notes"; @@ -47,19 +46,18 @@ NSArray *VKParseVkPermissionsFromInteger(NSInteger permissionsValue) { if (permissionsValue & 1) [res addObject:VK_PER_NOTIFY]; if (permissionsValue & 2) [res addObject:VK_PER_FRIENDS]; if (permissionsValue & 4) [res addObject:VK_PER_PHOTOS]; - if (permissionsValue & 8) [res addObject:VK_PER_AUDIO]; - if (permissionsValue & 16) [res addObject:VK_PER_VIDEO]; - if (permissionsValue & 128) [res addObject:VK_PER_PAGES]; - if (permissionsValue & 1024) [res addObject:VK_PER_STATUS]; - if (permissionsValue & 2048) [res addObject:VK_PER_NOTES]; - if (permissionsValue & 4096) [res addObject:VK_PER_MESSAGES]; - if (permissionsValue & 8192) [res addObject:VK_PER_WALL]; - if (permissionsValue & 32768) [res addObject:VK_PER_ADS]; - if (permissionsValue & 65536) [res addObject:VK_PER_OFFLINE]; - if (permissionsValue & 131072) [res addObject:VK_PER_DOCS]; - if (permissionsValue & 262144) [res addObject:VK_PER_GROUPS]; - if (permissionsValue & 524288) [res addObject:VK_PER_NOTIFICATIONS]; - if (permissionsValue & 1048576) [res addObject:VK_PER_STATS]; - if (permissionsValue & 134217728) [res addObject:VK_PER_MARKET]; + if (permissionsValue & 8) [res addObject:VK_PER_VIDEO]; + if (permissionsValue & 16) [res addObject:VK_PER_PAGES]; + if (permissionsValue & 128) [res addObject:VK_PER_STATUS]; + if (permissionsValue & 1024) [res addObject:VK_PER_NOTES]; + if (permissionsValue & 2048) [res addObject:VK_PER_MESSAGES]; + if (permissionsValue & 4096) [res addObject:VK_PER_WALL]; + if (permissionsValue & 8192) [res addObject:VK_PER_ADS]; + if (permissionsValue & 32768) [res addObject:VK_PER_OFFLINE]; + if (permissionsValue & 65536) [res addObject:VK_PER_DOCS]; + if (permissionsValue & 131072) [res addObject:VK_PER_GROUPS]; + if (permissionsValue & 262144) [res addObject:VK_PER_NOTIFICATIONS]; + if (permissionsValue & 524288) [res addObject:VK_PER_STATS]; + if (permissionsValue & 1048576) [res addObject:VK_PER_MARKET]; return res; } diff --git a/library/Source/VKSdk.h b/library/Source/VKSdk.h index 60d45c7..6a7f07b 100755 --- a/library/Source/VKSdk.h +++ b/library/Source/VKSdk.h @@ -275,6 +275,13 @@ Initialize SDK with responder for global SDK events. */ + (VKAccessToken *)accessToken; +/** + Set your own access token + @param token token token token +*/ + ++ (void)setAccessToken:(VKAccessToken *)token; + ///------------------------------- /// @name Other methods ///------------------------------- diff --git a/library/Source/VKSdk.m b/library/Source/VKSdk.m index 112a978..407a869 100644 --- a/library/Source/VKSdk.m +++ b/library/Source/VKSdk.m @@ -251,11 +251,11 @@ static NSString *VK_ACCESS_TOKEN_DEFAULTS_KEY = @"VK_ACCESS_TOKEN_DEFAULTS_KEY_D VKSdk *instance = [self instance]; - void (^hideViews)() = ^{ + void (^hideViews)(void) = ^{ if (instance.presentedSafariViewController) { UIViewController *safariVC = instance.presentedSafariViewController; [safariVC vks_viewControllerWillDismiss]; - void (^dismissBlock)() = ^{ + void (^dismissBlock)(void) = ^{ [safariVC vks_viewControllerDidDismiss]; }; if (safariVC.isBeingDismissed) { @@ -316,7 +316,7 @@ static NSString *VK_ACCESS_TOKEN_DEFAULTS_KEY = @"VK_ACCESS_TOKEN_DEFAULTS_KEY_D NSDictionary *parametersDict = [VKUtil explodeQueryString:parametersString]; BOOL inAppCheck = [[passedUrl host] isEqual:@"oauth.vk.com"]; - void (^throwError)() = ^{ + void (^throwError)(void) = ^{ VKError *error = [VKError errorWithQuery:parametersDict]; if (!validation) { notifyAuthorization(nil, error); @@ -446,7 +446,7 @@ static NSString *VK_ACCESS_TOKEN_DEFAULTS_KEY = @"VK_ACCESS_TOKEN_DEFAULTS_KEY_D } wakeUpBlock(instance.authState, error); - } trackVisitor:firstCall token:token]; + } trackVisitor:firstCall token:token]; } @@ -519,7 +519,7 @@ static NSString *VK_ACCESS_TOKEN_DEFAULTS_KEY = @"VK_ACCESS_TOKEN_DEFAULTS_KEY_D if (infoCallback) { infoCallback(user, [VK_ENSURE_NUM(response.json[@"permissions"]) integerValue], nil); } - } errorBlock:^(NSError *error) { + } errorBlock:^(NSError *error) { if (infoCallback) { infoCallback(nil, 0, error); } diff --git a/library/Source/VKSdkVersion.h b/library/Source/VKSdkVersion.h index 5cba874..0f33d3f 100755 --- a/library/Source/VKSdkVersion.h +++ b/library/Source/VKSdkVersion.h @@ -20,5 +20,5 @@ // 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. -#define VK_SDK_VERSION @"1.4.6" -#define VK_SDK_API_VERSION @"5.40" +#define VK_SDK_VERSION @"1.4.7" +#define VK_SDK_API_VERSION @"5.122" diff --git a/library/Source/Views/VKAuthorizeController.m b/library/Source/Views/VKAuthorizeController.m index 25e2ca2..7fd525c 100755 --- a/library/Source/Views/VKAuthorizeController.m +++ b/library/Source/Views/VKAuthorizeController.m @@ -171,9 +171,11 @@ NSString *VK_AUTHORIZE_URL_STRING = @"vkauthorize://authorize"; } } -- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { - [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; - [self makeViewport]; +- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + [coordinator animateAlongsideTransition:nil completion:^(id _Nonnull context) { + [self makeViewport]; + }]; } - (instancetype)initWith:(NSString *)appId andPermissions:(NSArray *)permissions revokeAccess:(BOOL)revoke displayType:(VKDisplayType)display { @@ -233,7 +235,7 @@ NSString *VK_AUTHORIZE_URL_STRING = @"vkauthorize://authorize"; if ([error code] != NSURLErrorCancelled) { self.warningLabel.hidden = NO; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (500 * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^(void) { - [webView loadRequest:_lastRequest]; + [webView loadRequest:self->_lastRequest]; if (!self.navigationItem.rightBarButtonItem) [self setRightBarButtonActivity]; }); @@ -251,7 +253,7 @@ NSString *VK_AUTHORIZE_URL_STRING = @"vkauthorize://authorize"; - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation { [self makeViewport]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (300 * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^(void) { - _warningLabel.hidden = YES; + self->_warningLabel.hidden = YES; webView.hidden = NO; self.navigationItem.rightBarButtonItem = nil; }); @@ -266,11 +268,11 @@ NSString *VK_AUTHORIZE_URL_STRING = @"vkauthorize://authorize"; - (void)cancelAuthorization:(id)sender { [self dismissWithCompletion:^{ - if (!_validationError) { + if (!self->_validationError) { //Silent cancel [VKSdk processOpenInternalURL:[NSURL URLWithString:@"#"] validation:NO]; } else { - [_validationError.request cancel]; + [self->_validationError.request cancel]; } }]; if (_validationError) { @@ -281,7 +283,7 @@ NSString *VK_AUTHORIZE_URL_STRING = @"vkauthorize://authorize"; } } -- (void)dismissWithCompletion:(void (^)())completion { +- (void)dismissWithCompletion:(void (^)(void))completion { _finished = YES; if (_internalNavigationController.isBeingDismissed) { diff --git a/library/Source/Views/VKCaptchaView.m b/library/Source/Views/VKCaptchaView.m index 01a8e52..0545baf 100755 --- a/library/Source/Views/VKCaptchaView.m +++ b/library/Source/Views/VKCaptchaView.m @@ -74,10 +74,14 @@ CGFloat kCaptchaViewHeight = 138; _captchaTextField.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin; [self addSubview:_captchaTextField]; VKHTTPOperation *operation = [[VKHTTPOperation alloc] initWithURLRequest:[[VKHTTPClient getClient] requestWithMethod:@"GET" path:_error.captchaImg parameters:nil secure:NO]]; + + __weak typeof(self) wself = self; [operation setCompletionBlockWithSuccess:^(VKHTTPOperation *operation, id responseObject) { - [_captchaImage setImage:[UIImage imageWithData:operation.responseData]]; + __strong typeof(self) self = wself; + [self->_captchaImage setImage:[UIImage imageWithData:operation.responseData]]; } failure:^(VKHTTPOperation *operation, NSError *error) { }]; + [[VKHTTPClient getClient] enqueueOperation:operation]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceDidRotate:) name:UIDeviceOrientationDidChangeNotification object:nil]; [self deviceDidRotate:nil]; @@ -87,8 +91,8 @@ CGFloat kCaptchaViewHeight = 138; - (void)deviceDidRotate:(NSNotification *)notification { [UIView animateWithDuration:notification ? 0.3 : 0 animations:^{ - _captchaImage.frame = CGRectMake((self.bounds.size.width - kCaptchaImageWidth) / 2, 5, kCaptchaImageWidth, kCaptchaImageHeight); - _captchaTextField.frame = CGRectMake(_captchaImage.frame.origin.x, _captchaImage.frame.origin.y + kCaptchaImageHeight + 10, kCaptchaImageWidth, kCaptchaViewHeight - kCaptchaImageHeight - 10); + self->_captchaImage.frame = CGRectMake((self.bounds.size.width - kCaptchaImageWidth) / 2, 5, kCaptchaImageWidth, kCaptchaImageHeight); + self->_captchaTextField.frame = CGRectMake(self->_captchaImage.frame.origin.x, self->_captchaImage.frame.origin.y + kCaptchaImageHeight + 10, kCaptchaImageWidth, kCaptchaViewHeight - kCaptchaImageHeight - 10); }]; } diff --git a/library/Source/Views/VKCaptchaViewController.m b/library/Source/Views/VKCaptchaViewController.m index 73f6062..e678f25 100755 --- a/library/Source/Views/VKCaptchaViewController.m +++ b/library/Source/Views/VKCaptchaViewController.m @@ -68,17 +68,17 @@ return captchaFrame; } -- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { - [super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration]; - CGSize screenSize = [UIScreen mainScreen].bounds.size; - if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) { - screenSize = CGSizeMake(MAX(screenSize.width, screenSize.height), MIN(screenSize.width, screenSize.height)); - } else { - screenSize = CGSizeMake(MIN(screenSize.width, screenSize.height), MAX(screenSize.width, screenSize.height)); - } - - - self.captchaView.frame = [self captchaFrameForScreenSize:screenSize]; +- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + [coordinator animateAlongsideTransition:^(id _Nonnull context) { + CGSize screenSize = [UIScreen mainScreen].bounds.size; + if (UIInterfaceOrientationIsLandscape(UIApplication.sharedApplication.statusBarOrientation)) { + screenSize = CGSizeMake(MAX(screenSize.width, screenSize.height), MIN(screenSize.width, screenSize.height)); + } else { + screenSize = CGSizeMake(MIN(screenSize.width, screenSize.height), MAX(screenSize.width, screenSize.height)); + } + self.captchaView.frame = [self captchaFrameForScreenSize:screenSize]; + } completion:nil]; } - (void)presentIn:(UIViewController *)controller { diff --git a/library/Source/Views/VKShareDialogController.m b/library/Source/Views/VKShareDialogController.m index d57a8a6..4666a7e 100755 --- a/library/Source/Views/VKShareDialogController.m +++ b/library/Source/Views/VKShareDialogController.m @@ -253,17 +253,13 @@ static const CGFloat ipadHeight = 500.f; [self rotateToInterfaceOrientation:orientation appear:YES]; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - -- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { - [super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration]; - - [self rotateToInterfaceOrientation:toInterfaceOrientation appear:NO]; +- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + [coordinator animateAlongsideTransition:^(id _Nonnull context) { + [self rotateToInterfaceOrientation:UIApplication.sharedApplication.statusBarOrientation appear:NO]; + } completion:nil]; } -#pragma clang diagnostic pop - - (void)rotateToInterfaceOrientation:(UIInterfaceOrientation)orientation appear:(BOOL)onAppear { if (VK_IS_DEVICE_IPAD) { CGSize viewSize = self.view.frame.size; @@ -334,10 +330,6 @@ static const CGFloat ipadHeight = 500.f; return YES; } -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { - return YES; -} - - (UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleDefault; } @@ -913,15 +905,6 @@ static const CGFloat kAttachmentsViewSize = 100.0f; } } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - -- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { - [super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration]; -} - -#pragma clang diagnostic pop - - (void)prepare { self.postSettings = [VKPostSettings new]; @@ -1117,7 +1100,9 @@ static const CGFloat kAttachmentsViewSize = 100.0f; } VKRequest *req = [VKRequest requestWithMethod:@"photos.getById" parameters:@{@"photos" : [parent.vkImages componentsJoinedByString:@","], @"photo_sizes" : @1} modelClass:[VKPhotoArray class]]; + __weak typeof(self) wself = self; [req executeWithResultBlock:^(VKResponse *res) { + __strong typeof(self) self = wself; VKPhotoArray *photos = res.parsedModel; NSArray *requiredSizes = @[@"p", @"q", @"m"]; for (VKPhoto *photo in photos) { @@ -1153,7 +1138,7 @@ static const CGFloat kAttachmentsViewSize = 100.0f; [self removeAttachIfExists:attach]; [self.attachmentsScrollView reloadData]; }]; - imageLoad.successCallbackQueue = imageProcessingQueue; + imageLoad.successCallbackQueue = self->imageProcessingQueue; [[VKHTTPClient getClient] enqueueOperation:imageLoad]; } [self.attachmentsScrollView performBatchUpdates:^{