Skip to content

Commit d436ab6

Browse files
committed
Removed the gs scheme constant, because most people don't need this. And revert back the context option with SDWebImageContext prefix, to expose the correct Swift API
1 parent 094f0ba commit d436ab6

File tree

6 files changed

+9
-17
lines changed

6 files changed

+9
-17
lines changed

Storage/FirebaseStorageUI/FUIStorageDefine.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,8 @@
1717
#import <FirebaseStorage/FirebaseStorage.h>
1818
#import <SDWebImage/SDWebImage.h>
1919

20-
/**
21-
* The scheme when identifing the URL is Firebase Storage URL
22-
*/
23-
FOUNDATION_EXPORT NSString * _Nonnull const FUIStorageScheme;
24-
2520
/**
2621
* A UInt64 raw value specify the maximum size of the downloaded image. If the downloaded image
2722
* exceeds this size, an error will be raised in the completion block. (NSNumber *)
2823
*/
29-
FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const FUIStorageMaxImageSize;
24+
FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextFUIStorageMaxImageSize;

Storage/FirebaseStorageUI/FUIStorageDefine.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,4 @@
1616

1717
#import "FUIStorageDefine.h"
1818

19-
NSString * _Nonnull const FUIStorageScheme = @"gs";
20-
21-
SDWebImageContextOption _Nonnull const FUIStorageMaxImageSize = @"firebaseMaxImageSize";
19+
SDWebImageContextOption _Nonnull const SDWebImageContextFUIStorageMaxImageSize = @"FUIStorageMaxImageSize";

Storage/FirebaseStorageUI/FUIStorageImageLoader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ NS_ASSUME_NONNULL_BEGIN
2323
/*
2424
* This Firebase Storage loader is used to load a `Firebase Storage reference` of image record.
2525
* To use the Firebase Storage loader, you can use the API in `UIImageView+FirebaseStorage.h` for simple usage.
26-
* You can also use the native SDWebImage's View Category API, with the URL constructed with `FIRStorageReference`. See `NSURL+SDWebImageFIRStorageLoader.h`
26+
* You can also use the native SDWebImage's View Category API, with the URL constructed with `FIRStorageReference`. See `NSURL+FirebaseStorage.h`
2727
* @code
2828
// Supports HTTP URL as well as Firebase Storage URL globally. Put this in the early setup step like AppDelegate.m
29-
SDImageLoadersManager.loaders = @[SDWebImageDownloader.sharedDownloader, SDWebImageFIRStorageLoader.sharedLoader];
29+
SDImageLoadersManager.loaders = @[SDWebImageDownloader.sharedDownloader, FUIStorageImageLoader.sharedLoader];
3030
// Replace default manager's loader implementation
3131
SDWebImageManager.defaultImageLoader = SDImageLoadersManager.sharedManager;
3232

Storage/FirebaseStorageUI/FUIStorageImageLoader.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ - (BOOL)canRequestImageForURL:(NSURL *)url {
5353
}
5454

5555
UInt64 size;
56-
if (context[FUIStorageMaxImageSize]) {
57-
size = [context[FUIStorageMaxImageSize] unsignedLongLongValue];
56+
if (context[SDWebImageContextFUIStorageMaxImageSize]) {
57+
size = [context[SDWebImageContextFUIStorageMaxImageSize] unsignedLongLongValue];
5858
} else {
5959
size = self.defaultMaxImageSize;
6060
}

Storage/FirebaseStorageUI/NSURL+FirebaseStorage.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
//
1616

1717
#import "NSURL+FirebaseStorage.h"
18-
#import "FUIStorageDefine.h"
1918
#import <objc/runtime.h>
2019

2120
@implementation NSURL (FirebaseStorage)
@@ -33,7 +32,7 @@ + (instancetype)sd_URLWithStorageReference:(FIRStorageReference *)storageRef {
3332
return nil;
3433
}
3534
// gs://bucket/path/to/object.txt
36-
NSURLComponents *components = [[NSURLComponents alloc] initWithString:[NSString stringWithFormat:@"%@://%@/", FUIStorageScheme, storageRef.bucket]];
35+
NSURLComponents *components = [[NSURLComponents alloc] initWithString:[NSString stringWithFormat:@"%@://%@/", @"gs", storageRef.bucket]];
3736
NSString *encodedPath = [storageRef.fullPath stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLPathAllowedCharacterSet]];
3837
components.path = [components.path stringByAppendingString:encodedPath];
3938

Storage/FirebaseStorageUI/UIImageView+FirebaseStorage.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ - (void)sd_setImageWithStorageReference:(FIRStorageReference *)storageRef
124124
if (!mutableContext[SDWebImageContextCustomManager]) {
125125
mutableContext[SDWebImageContextCustomManager] = DefaultWebImageManager();
126126
}
127-
if (!mutableContext[FUIStorageMaxImageSize]) {
128-
mutableContext[FUIStorageMaxImageSize] = @(size);
127+
if (!mutableContext[SDWebImageContextFUIStorageMaxImageSize]) {
128+
mutableContext[SDWebImageContextFUIStorageMaxImageSize] = @(size);
129129
}
130130

131131
[self sd_setImageWithURL:url placeholderImage:placeholder options:options context:[mutableContext copy] progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {

0 commit comments

Comments
 (0)