Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Stage one of SDK changes to support raw data. #79

Merged
merged 5 commits into from
May 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions DigiMeSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Pod::Spec.new do |s|

s.name = "DigiMeSDK"
s.version = "2.4.2"
s.version = "2.5"
s.summary = "digi.me iOS Consent Access SDK"
s.homepage = "https://github.com/digime/digime-sdk-ios"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "digi.me Ltd." => "ios@digi.me" }
s.platform = :ios, "10.0"
s.dependency "Brotli"
s.dependency "GZIP"

s.swift_version = "4.2"
s.source = {
:git => "https://github.com/digime/digime-sdk-ios.git",
:branch => s.version,
Expand All @@ -19,7 +19,7 @@ Pod::Spec.new do |s|
s.default_subspec = 'Core'

s.subspec 'Core' do |ss|
ss.source_files = "DigiMeSDK/Core/Classes/**/*.{h,m}", "DigiMeSDK/DigiMeSDK.h"
ss.source_files = "DigiMeSDK/Core/Classes/**/*.{h,m,swift}", "DigiMeSDK/DigiMeSDK.h"
ss.resources = ["DigiMeSDK/Core/Assets/*.{der}"]
ss.frameworks = "Foundation", "UIKit", "CoreGraphics", "Security", "StoreKit"
ss.private_header_files = 'DigiMeSDK/Core/Classes/Network/DMEOperation.h',
Expand All @@ -33,21 +33,21 @@ Pod::Spec.new do |s|
end

s.subspec 'Postbox' do |ss|
ss.source_files = "DigiMeSDK/Postbox/Classes/**/*.{h,m}"
ss.source_files = "DigiMeSDK/Postbox/Classes/**/*.{h,m,swift}"
ss.frameworks = "Foundation", "UIKit"
ss.private_header_files = 'DigiMeSDK/Core/Classes/DMEPostboxManager.h'
ss.xcconfig = { 'OTHER_CFLAGS' => '$(inherited) -DDigiMeSDKPostbox' }
ss.dependency "DigiMeSDK/Core"
end

s.subspec 'Repository' do |ss|
ss.source_files = "DigiMeSDK/Repository/Classes/**/*.swift"
ss.source_files = "DigiMeSDK/Repository/Classes/**/*.{h,m,swift}"
ss.frameworks = "Foundation"
ss.dependency "DigiMeSDK/Core"
end

s.subspec 'GuestConsent' do |ss|
ss.source_files = "DigiMeSDK/GuestConsent/Classes/**/*.{h,m}"
ss.source_files = "DigiMeSDK/GuestConsent/Classes/**/*.{h,m,swift}"
ss.resources = ["DigiMeSDK/Core/Assets/*.xcassets"]
ss.frameworks = "Foundation", "UIKit"
ss.private_header_files = 'DigiMeSDK/GuestConsent/Classes/DMEGuestConsentManager.h'
Expand Down
3 changes: 1 addition & 2 deletions DigiMeSDK/Core/Classes/Callbacks/DMEClientCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@

#import "CASession.h"
#import "CAFiles.h"
#import "CAFile.h"
#import "CAAccounts.h"

#pragma once

@class CAPostbox;
@class CAPostbox, CAFile;

NS_ASSUME_NONNULL_BEGIN

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#import "NSError+API.h"
#import "CAAccounts.h"
#import "CAFiles.h"
#import "CAFile.h"

#pragma once

Expand Down
10 changes: 6 additions & 4 deletions DigiMeSDK/Core/Classes/DMEClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#import "DMEAuthorizationManager.h"
#import "DMEClient+Private.h"
#import "DMEDataUnpacker.h"
#import <DigiMeSDK/DigiMeSDK-Swift.h>

@implementation DMEClient
@synthesize privateKeyHex = _privateKeyHex;
Expand Down Expand Up @@ -300,7 +301,7 @@ - (void)getFileWithId:(NSString *)fileId completion:(FileContentCompletionBlock)

if (completion)
{
CAFile *file = [[CAFile alloc] initWithFileId:fileId];
CAFile *file = [[CAFile alloc] initWithFileId:fileId fileContent:[NSData data] fileMetadata:nil];
completion(file, error);
}
else if ([self.downloadDelegate respondsToSelector:@selector(fileRetrieveFailed:error:)])
Expand Down Expand Up @@ -352,10 +353,11 @@ - (void)processFileData:(NSData *)data fileId:(NSString *)fileId completion:(Fil
{
CAFile *file;
NSError *error;
NSData *unpackedData = [DMEDataUnpacker unpackData:data error:&error];
CAFileMetadata *metadata;
NSData *unpackedData = [DMEDataUnpacker unpackData:data resolvedMetadata:&metadata error:&error];
if (unpackedData != nil)
{
file = [CAFile deserialize:unpackedData fileId:fileId error:&error];
file = [[CAFile alloc] initWithFileId:fileId fileContent:unpackedData fileMetadata:metadata];
}

dispatch_async(dispatch_get_main_queue(), ^{
Expand Down Expand Up @@ -433,7 +435,7 @@ - (void)getAccountsWithCompletion:(AccountsCompletionBlock)completion

CAAccounts *accounts;
NSError *error;
NSData *unpackedData = [DMEDataUnpacker unpackData:data error:&error];
NSData *unpackedData = [DMEDataUnpacker unpackData:data resolvedMetadata:NULL error:&error];
if (unpackedData != nil)
{
accounts = [CAAccounts deserialize:unpackedData error:&error];
Expand Down
4 changes: 3 additions & 1 deletion DigiMeSDK/Core/Classes/DMEDataUnpacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

NS_ASSUME_NONNULL_BEGIN

@class CAFileMetadata;

@interface DMEDataUnpacker : NSObject

/**
Expand All @@ -19,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
@param error The optional error which is populated if unpacking fails
@return Unpacked data if successful, otherwise nil
*/
+ (nullable NSData *)unpackData:(NSData *)data error:(NSError * _Nullable __autoreleasing *)error;
+ (nullable NSData *)unpackData:(NSData *)data resolvedMetadata:(CAFileMetadata * _Nullable __autoreleasing *)resolvedMetadata error:(NSError * _Nullable __autoreleasing *)error;

@end

Expand Down
9 changes: 8 additions & 1 deletion DigiMeSDK/Core/Classes/DMEDataUnpacker.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
#import "DMECompressor.h"
#import "DMEDataUnpacker.h"
#import "NSError+SDK.h"
#import <DigiMeSDK/DigiMeSDK-Swift.h>

@implementation DMEDataUnpacker

+ (nullable NSData *)unpackData:(NSData *)data error:(NSError * _Nullable __autoreleasing *)error
+ (nullable NSData *)unpackData:(NSData *)data resolvedMetadata:(CAFileMetadata * _Nullable __autoreleasing *)resolvedMetadata error:(NSError * _Nullable __autoreleasing *)error
{
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:error];

Expand All @@ -23,6 +24,12 @@ + (nullable NSData *)unpackData:(NSData *)data error:(NSError * _Nullable __auto
return nil;
}

NSDictionary *metadataJSON = json[@"fileMetadata"];
if (metadataJSON && resolvedMetadata)
{
*resolvedMetadata = [CAFileMetadata metadataFromJSON:metadataJSON];
}

id fileContent = json[@"fileContent"];
if (!fileContent)
{
Expand Down
4 changes: 4 additions & 0 deletions DigiMeSDK/Core/Classes/Entities/CADataRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@

@protocol CADataRequest <NSObject>

NS_ASSUME_NONNULL_BEGIN

@property (nonatomic, strong, nullable) NSArray<CATimeRange *> *timeRanges;
@property (nonatomic, strong, readonly) NSString *context;

NS_ASSUME_NONNULL_END

@end

#endif /* CADataRequest_h */
55 changes: 0 additions & 55 deletions DigiMeSDK/Core/Classes/Entities/CAFile.h

This file was deleted.

55 changes: 0 additions & 55 deletions DigiMeSDK/Core/Classes/Entities/CAFile.m

This file was deleted.

Loading