这是indexloc提供的服务,不要输入任何密码

shorebird_downloader 0.8.0 copy "shorebird_downloader: ^0.8.0" to clipboard
shorebird_downloader: ^0.8.0 copied to clipboard

用于可以自定义 Shorebird 下载的库

shorebird_downloader #

This is a plug-in that supports Shorebird to customize the patch download address and to keep an eye on the download progress.

Of course, in addition to the download function, you still need to get the other patch status related to Shorebird through the shorebird_code_push plugin.

⚠️ At present, an error will be reported when downloading the Android patch through this library and starting it. -> https://github.com/shorebirdtech/shorebird/issues/1449

How To install #

flutter pub add shorebird_downloader

How to use #

Now you can use the following methods to detect patches, download, pop-up prompts to restart, etc.

ShorebirdCheckDownloader(
  customShowUpdateDialog: (currentPatchNumber, nextPatchNumber) =>
      ShorebirdCheckDownloader.showUpdateDialog(
    Get.context!,
    currentPatchNumber,
    nextPatchNumber,
  ),
).checkPatch();
final downloader =
    ShorebirdUrlDownloader(appid: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
await downloader.downloadPatch((size,totol) => print("$size/$totol"));

How to custom download url #

If you feel that shorebird's CDN access is still slow or inaccessible, you can upload the patch to your own server in advance.

You can customize the following code to implement it.

class ShorebirdCustomUrlDownloader extends ShorebirdDownloader {
  ShorebirdUrlDownloader({required super.appid});

  @override
  Future<Patch?> requestPatchInfo() async {

    // TODO: http request custom your server url
    // [number] represents the latest patch number
    // [downloadUrl] represents the latest patch number
    return Patch(number: number, downloadUrl: downloadUrl);
  }
}

Then you can use it as usual.

final downloader =
    ShorebirdCustomUrlDownloader(appid: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
await downloader.downloadPatch((size,totol) => print("$size/$totol"));

uploader #

We now support uploading to the Appwrite server

install uploader #

dart pub global activate shorebird_downloader

uploader to appwrite server #

The first step is to configure your factory files

# pubspec.yaml
appwrite:
  key: xxxxxx
  projectId: xxxxx
  bucketId: xxxx
# shorebird.yaml
app_id: xxxxx

You can use the following command to upload the latest patch to Appwrite.

# in current shorebird project
shorebird_patch_uploader appwrite --platform [ios/android] 

To download updates directly from appwrite, you need to use the following code

final downloader =
    ShorebirdAppwriteDownloader(
      appid: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
      projectId: 'xxxxx',
      bucketId: 'bucketId',
      key: 'key',
      // endPoint: 'custom appwrite endpoint normal is https://cloud.appwrite.io/v1'
    );
await downloader.downloadPatch((size,totol) => print("$size/$totol"));
1
likes
95
points
83
downloads

Publisher

unverified uploader

Weekly Downloads

用于可以自定义 Shorebird 下载的库

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

analyzer, args, crypto, dart_appwrite, darty_json_safe, dio, flutter, logger, package_info_plus, path, path_provider, process_run, pubspec_manager, shorebird_code_push, yaml

More

Packages that depend on shorebird_downloader