Fix profile picture handling

This commit is contained in:
Niels Andriesse 2021-05-14 10:55:17 +10:00
parent 31f1a2e827
commit cdf27a631a
2 changed files with 3 additions and 3 deletions

View File

@ -74,7 +74,7 @@ public final class FileServerAPIV2 : NSObject {
// MARK: File Storage
@objc(upload:)
public static func objc_upload(file: Data) -> AnyPromise {
return AnyPromise.from(upload(file))
return AnyPromise.from(upload(file).map { String($0) })
}
public static func upload(_ file: Data) -> Promise<UInt64> {

View File

@ -364,8 +364,8 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
AnyPromise *promise = [SNFileServerAPIV2 upload:encryptedAvatarData];
[promise.thenOn(dispatch_get_main_queue(), ^(uint64_t fileID) {
NSString *downloadURL = [NSString stringWithFormat:@"%@/files/%llu", SNFileServerAPIV2.server, fileID];
[promise.thenOn(dispatch_get_main_queue(), ^(NSString *fileID) {
NSString *downloadURL = [NSString stringWithFormat:@"%@/files/%@", SNFileServerAPIV2.server, fileID];
[NSUserDefaults.standardUserDefaults setObject:[NSDate new] forKey:@"lastProfilePictureUpload"];
[self.localUserProfile updateWithProfileKey:newProfileKey dbConnection:self.dbConnection completion:^{
successBlock(downloadURL);