Skip to content

refactor(firebase_storage)!: remove deprecated APIs #4593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,6 @@ class FirebaseStorage extends FirebasePluginPlatform {
return newInstance;
}

// ignore: public_member_api_docs
@Deprecated(
"Constructing Storage is deprecated, use 'FirebaseStorage.instance' or 'FirebaseStorage.instanceFor' instead")
factory FirebaseStorage({FirebaseApp app, String storageBucket}) {
return FirebaseStorage.instanceFor(app: app, bucket: storageBucket);
}

/// Returns a new [Reference].
///
/// If the [path] is empty, the reference will point to the root of the
Expand Down Expand Up @@ -146,69 +139,27 @@ class FirebaseStorage extends FirebasePluginPlatform {
.ref(path);
}

@Deprecated("Deprecated in favor of refFromURL")
// ignore: public_member_api_docs
Future<Reference> getReferenceFromUrl(String url) async {
return refFromURL(url);
}

@Deprecated("Deprecated in favor of get.maxOperationRetryTime")
// ignore: public_member_api_docs
Future<int> getMaxOperationRetryTimeMillis() async {
return maxOperationRetryTime.inMilliseconds;
}

@Deprecated("Deprecated in favor of get.maxUploadRetryTime")
// ignore: public_member_api_docs
Future<int> getMaxUploadRetryTimeMillis() async {
return maxUploadRetryTime.inMilliseconds;
}

@Deprecated("Deprecated in favor of get.maxDownloadRetryTime")
// ignore: public_member_api_docs
Future<int> getMaxDownloadRetryTimeMillis() async {
return maxDownloadRetryTime.inMilliseconds;
}

/// Sets the new maximum operation retry time.
void setMaxOperationRetryTime(Duration time) {
assert(time != null);
assert(!time.isNegative);
return _delegate.setMaxOperationRetryTime(time.inMilliseconds);
}

/// Sets the new maximum operation retry time in milliseconds.
@Deprecated("Deprecated in favor of setMaxUploadRetryTime()")
Future<void> setMaxOperationRetryTimeMillis(int time) async {
return setMaxOperationRetryTime(Duration(milliseconds: time));
}

/// Sets the new maximum upload retry time.
void setMaxUploadRetryTime(Duration time) {
assert(time != null);
assert(!time.isNegative);
return _delegate.setMaxUploadRetryTime(time.inMilliseconds);
}

/// Sets the new maximum upload retry time in milliseconds.
@Deprecated("Deprecated in favor of setMaxUploadRetryTime()")
Future<void> setMaxUploadRetryTimeMillis(int time) async {
return setMaxUploadRetryTime(Duration(milliseconds: time));
}

/// Sets the new maximum download retry time.
void setMaxDownloadRetryTime(Duration time) {
assert(time != null);
assert(!time.isNegative);
return _delegate.setMaxDownloadRetryTime(time.inMilliseconds);
}

/// Sets the new maximum download retry time in milliseconds.
@Deprecated("Deprecated in favor of setMaxDownloadRetryTime()")
Future<void> setMaxDownloadRetryTimeMillis(int time) async {
return setMaxDownloadRetryTime(Duration(milliseconds: time));
}

@override
bool operator ==(dynamic o) =>
o is FirebaseStorage && o.app.name == app.name && o.bucket == bucket;
Expand Down
36 changes: 0 additions & 36 deletions packages/firebase_storage/firebase_storage/lib/src/reference.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,21 @@ class Reference {
/// The storage service associated with this reference.
final FirebaseStorage storage;

@Deprecated("Deprecated in favor of get.storage")
// ignore: public_member_api_docs
FirebaseStorage getStorage() {
return storage;
}

Reference._(this.storage, this._delegate) {
ReferencePlatform.verifyExtends(_delegate);
}

/// The name of the bucket containing this reference's object.
String get bucket => _delegate.bucket;

@Deprecated("Deprecated in favor of get.bucket")
// ignore: public_member_api_docs
Future<String> getBucket() async {
return bucket;
}

/// The full path of this object.
String get fullPath => _delegate.fullPath;

@Deprecated("Deprecated in favor of get.fullPath")
// ignore: public_member_api_docs
Future<String> getPath() async {
return fullPath;
}

/// The short name of this object, which is the last component of the full path.
///
/// For example, if fullPath is 'full/path/image.png', name is 'image.png'.
String get name => _delegate.name;

@Deprecated("Deprecated in favor of get.name")
// ignore: public_member_api_docs
Future<String> getName() async {
return name;
}

/// A reference pointing to the parent location of this reference, or `null`
/// if this reference is the root.
Reference get parent {
Expand All @@ -63,21 +39,9 @@ class Reference {
return Reference._(storage, referenceParentPlatform);
}

@Deprecated("Deprecated in favor of get.parent")
// ignore: public_member_api_docs
Reference getParent() {
return parent;
}

/// A reference to the root of this reference's bucket.
Reference get root => Reference._(storage, _delegate.root);

@Deprecated("Deprecated in favor of get.root")
// ignore: public_member_api_docs
Reference getRoot() {
return root;
}

/// Returns a reference to a relative path from this reference.
///
/// [path] The relative path from this reference. Leading, trailing, and
Expand Down
10 changes: 0 additions & 10 deletions packages/firebase_storage/firebase_storage/lib/src/task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ abstract class Task implements Future<TaskSnapshot> {
TaskPlatform.verifyExtends(_delegate);
}

@Deprecated('events has been deprecated in favor of snapshotEvents')
// ignore: public_member_api_docs
Stream<dynamic> get events {
return snapshotEvents;
}

/// Returns a [Stream] of [TaskSnapshot] events.
///
/// If the task is canceled or fails, the stream will send an error event.
Expand All @@ -33,10 +27,6 @@ abstract class Task implements Future<TaskSnapshot> {
.map((snapshotDelegate) => TaskSnapshot._(storage, snapshotDelegate));
}

@Deprecated("Deprecated in favor of [snapshot]")
// ignore: public_member_api_docs
TaskSnapshot get lastSnapshot => snapshot;

/// The latest [TaskSnapshot] for this task.
TaskSnapshot get snapshot {
return TaskSnapshot._(storage, _delegate.snapshot);
Expand Down