@react-native-firebase/storage 26.4.0 → 27.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/RNFBStorage.podspec +9 -4
- package/android/build.gradle +3 -0
- package/android/src/main/java/io/invertase/firebase/storage/RNFBStorageTaskRegistry.kt +88 -0
- package/android/src/test/java/io/invertase/firebase/storage/RNFBStorageTaskRegistryTest.java +25 -0
- package/dist/module/index.js +1 -2
- package/dist/module/index.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/typescript/lib/index.d.ts +1 -1
- package/dist/typescript/lib/types/internal.d.ts +2 -3
- package/dist/typescript/lib/types/internal.d.ts.map +1 -1
- package/dist/typescript/lib/version.d.ts +1 -1
- package/ios/RNFBStorage/RNFBStorageCommon.m +17 -98
- package/ios/RNFBStorage/RNFBStorageErrorCodeMapper.swift +122 -0
- package/ios/RNFBStorage/RNFBStorageErrorSnapshotDictBuilder.swift +70 -0
- package/ios/RNFBStorage/RNFBStorageTaskRegistry.m +28 -35
- package/ios/RNFBStorage/RNFBStorageTaskRegistryStorage.swift +87 -0
- package/ios/RNFBStorage/RNFBStorageTaskStatusMapper.swift +57 -0
- package/ios/RNFBStorage.xcodeproj/project.pbxproj +26 -0
- package/ios/RNFBStorageUnitTests/RNFBStorageErrorCodeMapperFacadeTests.m +91 -0
- package/ios/RNFBStorageUnitTests/RNFBStorageErrorCodeMapperTests.swift +211 -0
- package/ios/RNFBStorageUnitTests/RNFBStorageErrorSnapshotDictBuilderFacadeTests.m +125 -0
- package/ios/RNFBStorageUnitTests/RNFBStorageTaskRegistryStorageTests.swift +154 -0
- package/ios/RNFBStorageUnitTests/RNFBStorageTaskStatusMapperFacadeTests.m +52 -0
- package/ios/RNFBStorageUnitTests/RNFBStorageTaskStatusMapperTests.swift +58 -0
- package/ios/RNFBStorageUnitTests/RNFBStorageUnitTests.xcodeproj/project.pbxproj +50 -0
- package/lib/index.ts +1 -1
- package/lib/types/internal.ts +5 -4
- package/lib/version.ts +1 -1
- package/package.json +4 -4
- package/android/src/main/java/io/invertase/firebase/storage/RNFBStorageTaskRegistry.java +0 -93
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [27.1.0](https://github.com/invertase/react-native-firebase/compare/v27.0.0...v27.1.0) (2026-10-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @react-native-firebase/storage
|
|
9
|
+
|
|
10
|
+
## [27.0.0](https://github.com/invertase/react-native-firebase/compare/v26.4.0...v27.0.0) (2026-10-19)
|
|
11
|
+
|
|
12
|
+
### ⚠ BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
- **app, sdk:** bump Firebase Android 35, Apple 13, and JS 13
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- **app, sdk:** bump Firebase Android 35, Apple 13, and JS 13 ([0ca03d1](https://github.com/invertase/react-native-firebase/commit/0ca03d11b0c271fb37cfbee8a0c3074a21969f0b))
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
- **app, storage:** link Photos framework on tvOS ([56f5c1f](https://github.com/invertase/react-native-firebase/commit/56f5c1fcf83bc89d8cd80f019696e13bc96578dd))
|
|
23
|
+
- **app,database:** resolve platform native module when bundlers apply package exports ([959d91f](https://github.com/invertase/react-native-firebase/commit/959d91fc79d7155d1d9a08e1f836789e6e6d6156))
|
|
24
|
+
|
|
6
25
|
## [26.4.0](https://github.com/invertase/react-native-firebase/compare/v26.3.3...v26.4.0) (2026-09-05)
|
|
7
26
|
|
|
8
27
|
### Bug Fixes
|
package/RNFBStorage.podspec
CHANGED
|
@@ -28,18 +28,23 @@ Pod::Spec.new do |s|
|
|
|
28
28
|
s.ios.deployment_target = firebase_ios_target
|
|
29
29
|
s.macos.deployment_target = firebase_macos_target
|
|
30
30
|
s.tvos.deployment_target = firebase_tvos_target
|
|
31
|
-
s.
|
|
31
|
+
s.swift_version = '5.10'
|
|
32
|
+
s.source_files = 'ios/**/*.{h,m,mm,cpp,swift}'
|
|
32
33
|
s.private_header_files = [
|
|
33
34
|
'ios/RNFBStorage/*.h',
|
|
34
35
|
'ios/generated/**/*.h',
|
|
35
36
|
]
|
|
36
|
-
|
|
37
|
+
# CocoaPods FileList uses FNM_PATHNAME: `ios/*UnitTests/**` does not match nested
|
|
38
|
+
# paths like `ios/RNFBStorageUnitTests/HostStubs/**` (those would compile into the pod).
|
|
39
|
+
s.exclude_files = 'ios/generated/RCTThirdPartyComponentsProvider.*', 'ios/generated/RCTAppDependencyProvider.*', 'ios/generated/RCTModuleProviders.*', 'ios/generated/RCTModulesConformingToProtocolsProvider.*', 'ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.*', 'ios/*UnitTests/**/*'
|
|
37
40
|
|
|
38
41
|
# Must be set before install_modules_dependencies so RN can append use_frameworks
|
|
39
42
|
# HEADER_SEARCH_PATHS (React-debug etc.). Assigning after overwrites those paths
|
|
40
43
|
# and breaks from-source builds: react/timing/primitives.h → react/debug/flags.h.
|
|
44
|
+
# DEFINES_MODULE is required for the generated RNFBStorage-Swift.h interface.
|
|
41
45
|
s.pod_target_xcconfig = {
|
|
42
46
|
'HEADER_SEARCH_PATHS' => '"$(PODS_TARGET_SRCROOT)/ios/generated/RNFBStorageTurboModules" "$(PODS_TARGET_SRCROOT)/ios/generated"',
|
|
47
|
+
"DEFINES_MODULE" => "YES",
|
|
43
48
|
"CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES" => "YES",
|
|
44
49
|
}
|
|
45
50
|
|
|
@@ -61,10 +66,10 @@ Pod::Spec.new do |s|
|
|
|
61
66
|
|
|
62
67
|
# RNFBStorageCommon.m uses PHAsset/PHAssetResource (Photos.framework) for local
|
|
63
68
|
# asset uploads. See RNFBApp.podspec for why this must be declared explicitly
|
|
64
|
-
# rather than relying on Clang autolinking.
|
|
65
|
-
# exist on tvOS.
|
|
69
|
+
# rather than relying on Clang autolinking. PhotoKit is available on tvOS 10+.
|
|
66
70
|
s.ios.frameworks = 'Photos'
|
|
67
71
|
s.osx.frameworks = 'Photos'
|
|
72
|
+
s.tvos.frameworks = 'Photos'
|
|
68
73
|
|
|
69
74
|
if defined?($RNFirebaseAsStaticFramework)
|
|
70
75
|
Pod::UI.puts "#{s.name}: Using overridden static_framework value of '#{$RNFirebaseAsStaticFramework}'"
|
package/android/build.gradle
CHANGED
|
@@ -13,6 +13,7 @@ buildscript {
|
|
|
13
13
|
|
|
14
14
|
dependencies {
|
|
15
15
|
classpath("com.android.tools.build:gradle:8.4.0")
|
|
16
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.findProperty('kotlinVersion') ?: '2.4.0'}")
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
}
|
|
@@ -21,6 +22,8 @@ plugins {
|
|
|
21
22
|
id "io.invertase.gradle.build" version "1.5"
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
apply plugin: "org.jetbrains.kotlin.android"
|
|
26
|
+
|
|
24
27
|
def appProject
|
|
25
28
|
if (findProject(':@react-native-firebase_app')) {
|
|
26
29
|
appProject = project(':@react-native-firebase_app')
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
package io.invertase.firebase.storage
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import io.invertase.firebase.common.RNFBHandleCollisionException
|
|
21
|
+
import io.invertase.firebase.common.RNFBHandleMap
|
|
22
|
+
import java.util.function.Predicate
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Pending upload/download task map. Unique [put]; callers [take] or [takeAllAndCancel] then cancel
|
|
26
|
+
* outside the HandleMap lock.
|
|
27
|
+
*/
|
|
28
|
+
internal class RNFBStorageTaskRegistry {
|
|
29
|
+
private val map = RNFBHandleMap<Int, StoragePendingHandle?>()
|
|
30
|
+
|
|
31
|
+
@Throws(RNFBHandleCollisionException::class)
|
|
32
|
+
fun put(
|
|
33
|
+
taskId: Int,
|
|
34
|
+
handle: StoragePendingHandle?,
|
|
35
|
+
) {
|
|
36
|
+
map.put(taskId, handle)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Unique put. On collision, `cancel()` the incoming handle and leave the existing mapping.
|
|
41
|
+
*
|
|
42
|
+
* @return true if stored
|
|
43
|
+
*/
|
|
44
|
+
fun putOrDiscard(
|
|
45
|
+
taskId: Int,
|
|
46
|
+
handle: StoragePendingHandle?,
|
|
47
|
+
): Boolean {
|
|
48
|
+
if (map.putIfAbsent(taskId, handle)) {
|
|
49
|
+
return true
|
|
50
|
+
}
|
|
51
|
+
handle?.cancel()
|
|
52
|
+
return false
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
fun get(taskId: Int): StoragePendingHandle? = map.get(taskId)
|
|
56
|
+
|
|
57
|
+
fun take(taskId: Int): StoragePendingHandle? = map.take(taskId)
|
|
58
|
+
|
|
59
|
+
fun takeIf(
|
|
60
|
+
taskId: Int,
|
|
61
|
+
shouldTake: Predicate<StoragePendingHandle?>,
|
|
62
|
+
): StoragePendingHandle? = map.takeIf(taskId, shouldTake)
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Cancel outside the HandleMap lock; remove the mapping only when cancel succeeds. Returns `false`
|
|
66
|
+
* when no mapping existed or cancel failed. Trailing unregister is identity-gated so a
|
|
67
|
+
* replacement put after `cancel()` (e.g. production `destroyTask`) is not stolen.
|
|
68
|
+
*
|
|
69
|
+
* Shape: get → cancel → identity takeIf on success (keep mapping when cancel returns false). iOS
|
|
70
|
+
* registry mirrors get → cancel → identity takeIf, but FIRStorage cancel is void so there is no
|
|
71
|
+
* keep-on-false path — see `RNFBStorageTaskRegistry.takeAndCancel:` / helper `setTaskStatus`.
|
|
72
|
+
*/
|
|
73
|
+
fun takeAndCancel(taskId: Int): Boolean {
|
|
74
|
+
val handle = map.get(taskId) ?: return false
|
|
75
|
+
val cancelled = handle.cancel()
|
|
76
|
+
if (cancelled) {
|
|
77
|
+
map.takeIf(taskId) { h -> h === handle }
|
|
78
|
+
}
|
|
79
|
+
return cancelled
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
fun takeAllAndCancel() {
|
|
83
|
+
val remaining = map.takeAll()
|
|
84
|
+
for (handle in remaining) {
|
|
85
|
+
handle?.cancel()
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
package/android/src/test/java/io/invertase/firebase/storage/RNFBStorageTaskRegistryTest.java
CHANGED
|
@@ -115,6 +115,31 @@ public class RNFBStorageTaskRegistryTest {
|
|
|
115
115
|
assertSame(first, registry.get(4));
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
@Test
|
|
119
|
+
public void takeIf_whenPredicateTrue_removesAndReturns() throws Exception {
|
|
120
|
+
RNFBStorageTaskRegistry registry = new RNFBStorageTaskRegistry();
|
|
121
|
+
FakeHandle handle = new FakeHandle();
|
|
122
|
+
registry.put(8, handle);
|
|
123
|
+
assertSame(handle, registry.takeIf(8, h -> h == handle));
|
|
124
|
+
assertNull(registry.get(8));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@Test
|
|
128
|
+
public void takeIf_whenPredicateFalse_leavesMapping() throws Exception {
|
|
129
|
+
RNFBStorageTaskRegistry registry = new RNFBStorageTaskRegistry();
|
|
130
|
+
FakeHandle handle = new FakeHandle();
|
|
131
|
+
FakeHandle other = new FakeHandle();
|
|
132
|
+
registry.put(9, handle);
|
|
133
|
+
assertNull(registry.takeIf(9, h -> h == other));
|
|
134
|
+
assertSame(handle, registry.get(9));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@Test
|
|
138
|
+
public void takeIf_whenMissing_returnsNull() {
|
|
139
|
+
RNFBStorageTaskRegistry registry = new RNFBStorageTaskRegistry();
|
|
140
|
+
assertNull(registry.takeIf(99, h -> true));
|
|
141
|
+
}
|
|
142
|
+
|
|
118
143
|
@Test
|
|
119
144
|
public void takeAndCancel_cancelsAfterTake() throws Exception {
|
|
120
145
|
RNFBStorageTaskRegistry registry = new RNFBStorageTaskRegistry();
|
package/dist/module/index.js
CHANGED
|
@@ -18,12 +18,11 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import { isAndroid, isNumber, isString } from '@react-native-firebase/app/dist/module/common';
|
|
21
|
-
import { FirebaseModule, getOrCreateModularInstance } from '@react-native-firebase/app/dist/module/internal';
|
|
21
|
+
import { FirebaseModule, getOrCreateModularInstance, setReactNativeModule } from '@react-native-firebase/app/dist/module/internal';
|
|
22
22
|
import Reference from "./StorageReference.js";
|
|
23
23
|
import { getGsUrlParts, getHttpUrlParts, handleStorageEvent } from "./utils.js";
|
|
24
24
|
import { version } from "./version.js";
|
|
25
25
|
import fallBackModule from './web/RNFBStorageModule';
|
|
26
|
-
import { setReactNativeModule } from '@react-native-firebase/app/dist/module/internal/nativeModule';
|
|
27
26
|
import "./types/internal.js";
|
|
28
27
|
const nativeEvents = ['storage_event'];
|
|
29
28
|
const nativeModuleName = 'NativeRNFBTurboStorage';
|
package/dist/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isAndroid","isNumber","isString","FirebaseModule","getOrCreateModularInstance","Reference","getGsUrlParts","getHttpUrlParts","handleStorageEvent","version","fallBackModule","
|
|
1
|
+
{"version":3,"names":["isAndroid","isNumber","isString","FirebaseModule","getOrCreateModularInstance","setReactNativeModule","Reference","getGsUrlParts","getHttpUrlParts","handleStorageEvent","version","fallBackModule","nativeEvents","nativeModuleName","config","namespace","hasMultiAppSupport","hasCustomUrlOrRegionSupport","disablePrependCustomUrlOrRegion","turboModule","FirebaseStorageModule","constructor","app","bucketUrl","undefined","_customUrlOrRegion","options","storageBucket","startsWith","Error","storageEvent","emitter","addListener","eventNameForApp","bind","emulatorHost","emulatorPort","_maxUploadRetryTime","native","maxUploadRetryTime","_maxDownloadRetryTime","maxDownloadRetryTime","_maxOperationRetryTime","maxOperationRetryTime","ref","path","refFromURL","url","bucket","parts","storageInstance","setMaxOperationRetryTime","time","setMaxUploadRetryTime","setMaxDownloadRetryTime","useEmulator","host","port","_options","_host","androidBypassEmulatorUrlRemap","firebaseJson","android_bypass_emulator_url_remap","console","log","SDK_VERSION","getStorage","StringFormat","TaskEvent","TaskState","isUrl","test","decodeURIComponent","connectStorageEmulator","storage","storageOrRef","fullPath","child","deleteObject","storageRef","delete","getBlob","_storageRef","_maxDownloadSizeBytes","getBytes","getDownloadURL","getMetadata","getStream","list","result","nextPageToken","listAll","updateMetadata","metadata","uploadBytes","_data","_metadata","uploadBytesResumable","data","put","uploadString","format","putString","putFile","filePath","writeToFile"],"sourceRoot":"../../lib","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,+CAA+C;AAE7F,SACEC,cAAc,EACdC,0BAA0B,EAC1BC,oBAAoB,QACf,iDAAiD;AAGxD,OAAOC,SA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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FirebaseApp } from '@react-native-firebase/app';
|
|
2
2
|
import './types/internal';
|
|
3
3
|
import type { EmulatorMockTokenOptions, FirebaseStorage, FullMetadata, ListOptions, ListResult, SettableMetadata, StorageReference, Task, UploadMetadata, UploadResult, UploadTask } from './types/storage';
|
|
4
|
-
export declare const SDK_VERSION = "
|
|
4
|
+
export declare const SDK_VERSION = "27.1.0";
|
|
5
5
|
export declare function getStorage(app?: FirebaseApp, bucketUrl?: string): FirebaseStorage;
|
|
6
6
|
export type * from './types/storage';
|
|
7
7
|
export { StringFormat, TaskEvent, TaskState } from './StorageStatics';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ModuleConfig } from '@react-native-firebase/app/dist/module/types/internal';
|
|
1
|
+
import type { ModuleConfig, ReactNativeFirebaseEventEmitter } from '@react-native-firebase/app/dist/module/types/internal';
|
|
2
2
|
import type { FirebaseStorage, StorageReference, EmulatorMockTokenOptions, SettableMetadata, UploadMetadata, Task, TaskSnapshot, FullMetadata, ListResult, ListOptions } from './storage';
|
|
3
|
-
import type EventEmitter from 'react-native/Libraries/vendor/emitter/EventEmitter';
|
|
4
3
|
/**
|
|
5
4
|
* Internal Storage type with access to private properties.
|
|
6
5
|
* Used internally by StorageReference and other internal classes.
|
|
@@ -8,7 +7,7 @@ import type EventEmitter from 'react-native/Libraries/vendor/emitter/EventEmitte
|
|
|
8
7
|
export type StorageInternal = FirebaseStorage & {
|
|
9
8
|
native: NativeRNFBTurboStorage;
|
|
10
9
|
_customUrlOrRegion: string | null;
|
|
11
|
-
emitter:
|
|
10
|
+
emitter: ReactNativeFirebaseEventEmitter;
|
|
12
11
|
eventNameForApp: (...args: Array<string | number>) => string;
|
|
13
12
|
_config: ModuleConfig;
|
|
14
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../lib/types/internal.ts"],"names":[],"mappings":"AAi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AElF;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAEvD;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;CAClF;AAED,OAAO,QAAQ,+DAA+D,CAAC;IAC7E,UAAU,gCAAgC;QACxC,sBAAsB,EAAE,sBAAsB,CAAC;KAChD;CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "
|
|
1
|
+
export declare const version = "27.1.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -34,6 +34,16 @@
|
|
|
34
34
|
#import "RNFBStorageCommon.h"
|
|
35
35
|
#import "RNFBUtilsModule.h"
|
|
36
36
|
|
|
37
|
+
#if __has_include(<RNFBStorage/RNFBStorage-Swift.h>)
|
|
38
|
+
#import <RNFBStorage/RNFBStorage-Swift.h>
|
|
39
|
+
#elif __has_include("RNFBStorage-Swift.h")
|
|
40
|
+
#import "RNFBStorage-Swift.h"
|
|
41
|
+
#elif __has_include("RNFBHandleMapStorage-Swift.inc")
|
|
42
|
+
#import "RNFBHandleMapStorage-Swift.inc"
|
|
43
|
+
#else
|
|
44
|
+
#error "RNFBStorage Swift interface not found"
|
|
45
|
+
#endif
|
|
46
|
+
|
|
37
47
|
@implementation RNFBStorageCommon
|
|
38
48
|
|
|
39
49
|
+ (NSData *)NSDataFromUploadString:(NSString *)string format:(NSString *)format {
|
|
@@ -264,22 +274,15 @@
|
|
|
264
274
|
|
|
265
275
|
+ (NSDictionary *)buildErrorSnapshotDict:(NSError *)error
|
|
266
276
|
taskSnapshotDict:(NSMutableDictionary *)taskSnapshotDict {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
@"code" : (NSString *)codeAndMessage[0],
|
|
270
|
-
@"message" : (NSString *)codeAndMessage[1],
|
|
271
|
-
@"nativeErrorMessage" : [error localizedDescription]
|
|
272
|
-
};
|
|
273
|
-
return taskSnapshotDict;
|
|
277
|
+
return [RNFBStorageErrorSnapshotDictBuilder buildErrorSnapshotDict:error
|
|
278
|
+
taskSnapshotDict:taskSnapshotDict];
|
|
274
279
|
}
|
|
275
280
|
|
|
276
281
|
+ (NSDictionary *)buildErrorSnapshotDictFromCodeAndMessage:(NSArray *)codeAndMessage
|
|
277
282
|
taskSnapshotDict:(NSMutableDictionary *)taskSnapshotDict {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
};
|
|
282
|
-
return taskSnapshotDict;
|
|
283
|
+
return [RNFBStorageErrorSnapshotDictBuilder
|
|
284
|
+
buildErrorSnapshotDictFromCodeAndMessage:codeAndMessage
|
|
285
|
+
taskSnapshotDict:taskSnapshotDict];
|
|
283
286
|
}
|
|
284
287
|
|
|
285
288
|
+ (NSDictionary *)metadataToDict:(FIRStorageMetadata *)metadata {
|
|
@@ -390,17 +393,7 @@
|
|
|
390
393
|
}
|
|
391
394
|
|
|
392
395
|
+ (NSString *)getTaskStatus:(FIRStorageTaskStatus)status {
|
|
393
|
-
|
|
394
|
-
return @"running";
|
|
395
|
-
} else if (status == FIRStorageTaskStatusPause) {
|
|
396
|
-
return @"paused";
|
|
397
|
-
} else if (status == FIRStorageTaskStatusSuccess) {
|
|
398
|
-
return @"success";
|
|
399
|
-
} else if (status == FIRStorageTaskStatusFailure) {
|
|
400
|
-
return @"error";
|
|
401
|
-
} else {
|
|
402
|
-
return @"unknown";
|
|
403
|
-
}
|
|
396
|
+
return [RNFBStorageTaskStatusMapper stringForTaskStatus:(NSInteger)status];
|
|
404
397
|
}
|
|
405
398
|
|
|
406
399
|
+ (FIRStorageMetadata *)buildMetadataFromMap:(NSDictionary *)metadata
|
|
@@ -472,81 +465,7 @@
|
|
|
472
465
|
}
|
|
473
466
|
|
|
474
467
|
+ (NSArray *)getErrorCodeMessage:(NSError *)error {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
if (error == nil) {
|
|
478
|
-
return @[ code, @"An unknown error has occurred." ];
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
NSString *message = [error localizedDescription];
|
|
482
|
-
NSDictionary *userInfo = [error userInfo];
|
|
483
|
-
NSError *underlyingError = userInfo[NSUnderlyingErrorKey];
|
|
484
|
-
NSString *underlyingErrorDescription = [underlyingError localizedDescription];
|
|
485
|
-
|
|
486
|
-
switch (error.code) {
|
|
487
|
-
case FIRStorageErrorCodeUnknown:
|
|
488
|
-
if ([underlyingErrorDescription
|
|
489
|
-
isEqualToString:@"The operation couldn’t be completed. Permission denied"]) {
|
|
490
|
-
code = @"invalid-device-file-path";
|
|
491
|
-
message = @"The specified device file path is invalid or is restricted.";
|
|
492
|
-
} else {
|
|
493
|
-
if (userInfo[@"ResponseBody"]) {
|
|
494
|
-
message =
|
|
495
|
-
[NSString stringWithFormat:@"An unknown error has occurred. (underlying reason '%@')",
|
|
496
|
-
userInfo[@"ResponseBody"]];
|
|
497
|
-
} else {
|
|
498
|
-
message = @"An unknown error has occurred.";
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
break;
|
|
502
|
-
case FIRStorageErrorCodeObjectNotFound:
|
|
503
|
-
code = @"object-not-found";
|
|
504
|
-
message = @"No object exists at the desired reference.";
|
|
505
|
-
break;
|
|
506
|
-
case FIRStorageErrorCodeBucketNotFound:
|
|
507
|
-
code = @"bucket-not-found";
|
|
508
|
-
message = @"No bucket is configured for Firebase Storage.";
|
|
509
|
-
break;
|
|
510
|
-
case FIRStorageErrorCodeProjectNotFound:
|
|
511
|
-
code = @"project-not-found";
|
|
512
|
-
message = @"No project is configured for Firebase Storage.";
|
|
513
|
-
break;
|
|
514
|
-
case FIRStorageErrorCodeQuotaExceeded:
|
|
515
|
-
code = @"quota-exceeded";
|
|
516
|
-
message = @"Quota on your Firebase Storage bucket has been exceeded.";
|
|
517
|
-
break;
|
|
518
|
-
case FIRStorageErrorCodeUnauthenticated:
|
|
519
|
-
code = @"unauthenticated";
|
|
520
|
-
message = @"User is unauthenticated. Authenticate and try again.";
|
|
521
|
-
break;
|
|
522
|
-
case FIRStorageErrorCodeUnauthorized:
|
|
523
|
-
code = @"unauthorized";
|
|
524
|
-
message = @"User is not authorized to perform the desired action.";
|
|
525
|
-
break;
|
|
526
|
-
case FIRStorageErrorCodeRetryLimitExceeded:
|
|
527
|
-
code = @"retry-limit-exceeded";
|
|
528
|
-
message = @"The maximum time limit on an operation (upload, download, delete, etc.) has been "
|
|
529
|
-
@"exceeded.";
|
|
530
|
-
break;
|
|
531
|
-
case FIRStorageErrorCodeNonMatchingChecksum:
|
|
532
|
-
code = @"non-matching-checksum";
|
|
533
|
-
message =
|
|
534
|
-
@"File on the client does not match the checksum of the file received by the server.";
|
|
535
|
-
break;
|
|
536
|
-
case FIRStorageErrorCodeDownloadSizeExceeded:
|
|
537
|
-
code = @"download-size-exceeded";
|
|
538
|
-
message =
|
|
539
|
-
@"Size of the downloaded file exceeds the amount of memory allocated for the download.";
|
|
540
|
-
break;
|
|
541
|
-
case FIRStorageErrorCodeCancelled:
|
|
542
|
-
code = @"cancelled";
|
|
543
|
-
message = @"User cancelled the operation.";
|
|
544
|
-
break;
|
|
545
|
-
default:
|
|
546
|
-
break;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
return @[ code, message ];
|
|
468
|
+
return [RNFBStorageErrorCodeMapper codeAndMessageForError:error];
|
|
550
469
|
}
|
|
551
470
|
|
|
552
471
|
@end
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import Foundation
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* `FIRStorageErrorCode` raw value → JS error-code / message mapping previously
|
|
21
|
+
* inline in `+[RNFBStorageCommon getErrorCodeMessage:]`.
|
|
22
|
+
*
|
|
23
|
+
* Raw ints from Firebase Storage `StorageErrorCode`
|
|
24
|
+
* (`@objc(FIRStorageErrorCode)` in `StorageError.swift`):
|
|
25
|
+
* - unknown = -13000, objectNotFound = -13010, …
|
|
26
|
+
*
|
|
27
|
+
* Hardcoded so the Storage unit target does not need FirebaseStorage.
|
|
28
|
+
*/
|
|
29
|
+
@objc(RNFBStorageErrorCodeMapper)
|
|
30
|
+
public final class RNFBStorageErrorCodeMapper: NSObject {
|
|
31
|
+
/// `FIRStorageErrorCodeUnknown`
|
|
32
|
+
private static let codeUnknown = -13000
|
|
33
|
+
/// `FIRStorageErrorCodeObjectNotFound`
|
|
34
|
+
private static let codeObjectNotFound = -13010
|
|
35
|
+
/// `FIRStorageErrorCodeBucketNotFound`
|
|
36
|
+
private static let codeBucketNotFound = -13011
|
|
37
|
+
/// `FIRStorageErrorCodeProjectNotFound`
|
|
38
|
+
private static let codeProjectNotFound = -13012
|
|
39
|
+
/// `FIRStorageErrorCodeQuotaExceeded`
|
|
40
|
+
private static let codeQuotaExceeded = -13013
|
|
41
|
+
/// `FIRStorageErrorCodeUnauthenticated`
|
|
42
|
+
private static let codeUnauthenticated = -13020
|
|
43
|
+
/// `FIRStorageErrorCodeUnauthorized`
|
|
44
|
+
private static let codeUnauthorized = -13021
|
|
45
|
+
/// `FIRStorageErrorCodeRetryLimitExceeded`
|
|
46
|
+
private static let codeRetryLimitExceeded = -13030
|
|
47
|
+
/// `FIRStorageErrorCodeNonMatchingChecksum`
|
|
48
|
+
private static let codeNonMatchingChecksum = -13031
|
|
49
|
+
/// `FIRStorageErrorCodeDownloadSizeExceeded`
|
|
50
|
+
private static let codeDownloadSizeExceeded = -13032
|
|
51
|
+
/// `FIRStorageErrorCodeCancelled`
|
|
52
|
+
private static let codeCancelled = -13040
|
|
53
|
+
|
|
54
|
+
/// Exact pre-port string (U+2019 apostrophe in "couldn't").
|
|
55
|
+
private static let permissionDeniedUnderlying =
|
|
56
|
+
"The operation couldn’t be completed. Permission denied"
|
|
57
|
+
|
|
58
|
+
@objc(codeAndMessageForError:)
|
|
59
|
+
public static func codeAndMessage(for error: NSError?) -> [String] {
|
|
60
|
+
var code = "unknown"
|
|
61
|
+
|
|
62
|
+
guard let error else {
|
|
63
|
+
return [code, "An unknown error has occurred."]
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var message = error.localizedDescription
|
|
67
|
+
let userInfo = error.userInfo
|
|
68
|
+
let underlyingError = userInfo[NSUnderlyingErrorKey] as? NSError
|
|
69
|
+
let underlyingErrorDescription = underlyingError?.localizedDescription
|
|
70
|
+
|
|
71
|
+
switch error.code {
|
|
72
|
+
case codeUnknown:
|
|
73
|
+
if underlyingErrorDescription == permissionDeniedUnderlying {
|
|
74
|
+
code = "invalid-device-file-path"
|
|
75
|
+
message = "The specified device file path is invalid or is restricted."
|
|
76
|
+
} else if let responseBody = userInfo["ResponseBody"] {
|
|
77
|
+
message =
|
|
78
|
+
"An unknown error has occurred. (underlying reason '\(responseBody)')"
|
|
79
|
+
} else {
|
|
80
|
+
message = "An unknown error has occurred."
|
|
81
|
+
}
|
|
82
|
+
case codeObjectNotFound:
|
|
83
|
+
code = "object-not-found"
|
|
84
|
+
message = "No object exists at the desired reference."
|
|
85
|
+
case codeBucketNotFound:
|
|
86
|
+
code = "bucket-not-found"
|
|
87
|
+
message = "No bucket is configured for Firebase Storage."
|
|
88
|
+
case codeProjectNotFound:
|
|
89
|
+
code = "project-not-found"
|
|
90
|
+
message = "No project is configured for Firebase Storage."
|
|
91
|
+
case codeQuotaExceeded:
|
|
92
|
+
code = "quota-exceeded"
|
|
93
|
+
message = "Quota on your Firebase Storage bucket has been exceeded."
|
|
94
|
+
case codeUnauthenticated:
|
|
95
|
+
code = "unauthenticated"
|
|
96
|
+
message = "User is unauthenticated. Authenticate and try again."
|
|
97
|
+
case codeUnauthorized:
|
|
98
|
+
code = "unauthorized"
|
|
99
|
+
message = "User is not authorized to perform the desired action."
|
|
100
|
+
case codeRetryLimitExceeded:
|
|
101
|
+
code = "retry-limit-exceeded"
|
|
102
|
+
message =
|
|
103
|
+
"The maximum time limit on an operation (upload, download, delete, etc.) has been "
|
|
104
|
+
+ "exceeded."
|
|
105
|
+
case codeNonMatchingChecksum:
|
|
106
|
+
code = "non-matching-checksum"
|
|
107
|
+
message =
|
|
108
|
+
"File on the client does not match the checksum of the file received by the server."
|
|
109
|
+
case codeDownloadSizeExceeded:
|
|
110
|
+
code = "download-size-exceeded"
|
|
111
|
+
message =
|
|
112
|
+
"Size of the downloaded file exceeds the amount of memory allocated for the download."
|
|
113
|
+
case codeCancelled:
|
|
114
|
+
code = "cancelled"
|
|
115
|
+
message = "User cancelled the operation."
|
|
116
|
+
default:
|
|
117
|
+
break
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return [code, message]
|
|
121
|
+
}
|
|
122
|
+
}
|