summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/private/SDLFileWrapper.m
blob: c6500171d8567d38c46f6c50bec9294756e13814 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
//  SDLFileWrapper.m
//  SmartDeviceLink-iOS
//
//  Created by Joel Fischer on 5/11/16.
//  Copyright © 2016 smartdevicelink. All rights reserved.
//

#import "SDLFileWrapper.h"

#import "SDLError.h"
#import "SDLFile.h"


NS_ASSUME_NONNULL_BEGIN

@implementation SDLFileWrapper

- (instancetype)initWithFile:(SDLFile *)file completionHandler:(SDLFileManagerUploadCompletionHandler)completionHandler {
    self = [super init];
    if (!self) {
        completionHandler(NO, NSNotFound, [NSError sdl_failedToCreateObjectOfClass:[SDLFileWrapper class]]);
        return nil;
    }

    _file = file;
    _completionHandler = completionHandler;

    return self;
}

+ (instancetype)wrapperWithFile:(SDLFile *)file completionHandler:(SDLFileManagerUploadCompletionHandler)completionHandler {
    return [[self alloc] initWithFile:file completionHandler:completionHandler];
}

@end

NS_ASSUME_NONNULL_END