mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1015 B
Matlab
38 lines
1015 B
Matlab
8 years ago
|
//
|
||
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "TSSetProfileRequest.h"
|
||
|
#import "NSData+Base64.h"
|
||
|
#import "TSConstants.h"
|
||
|
|
||
|
NS_ASSUME_NONNULL_BEGIN
|
||
|
|
||
|
@implementation TSSetProfileRequest
|
||
|
|
||
|
- (nullable instancetype)initWithProfileName:(NSData *_Nullable)profileNameEncrypted
|
||
|
avatarUrl:(NSString *_Nullable)avatarUrl
|
||
|
avatarDigest:(NSData *_Nullable)avatarDigest
|
||
|
{
|
||
|
|
||
|
self = [super initWithURL:[NSURL URLWithString:textSecureSetProfileAPI]];
|
||
|
|
||
|
self.HTTPMethod = @"PUT";
|
||
|
|
||
|
if (profileNameEncrypted.length > 0) {
|
||
|
self.parameters[@"name"] = [profileNameEncrypted base64EncodedString];
|
||
|
}
|
||
|
if (avatarUrl.length > 0) {
|
||
|
self.parameters[@"avatar"] = [[avatarUrl dataUsingEncoding:NSUTF8StringEncoding] base64EncodedString];
|
||
|
}
|
||
|
if (avatarDigest.length > 0) {
|
||
|
self.parameters[@"avatarDigest"] = [avatarDigest base64EncodedString];
|
||
|
}
|
||
|
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
@end
|
||
|
|
||
|
NS_ASSUME_NONNULL_END
|