From d4c84ea9cf3abfe34fbcf57d783da8f3d0d36dec Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Wed, 15 Mar 2023 14:11:13 -0500 Subject: [PATCH] chore: rename `product_id` to `app_id` (#77) --- cli/src/main.rs | 2 +- dart_bindings/lib/src/bindings.dart | 8 ++++---- dart_bindings/lib/updater.dart | 4 ++-- dart_cli/bin/dart_cli.dart | 2 +- library/src/config.rs | 6 +++--- library/src/network.rs | 2 +- library/src/yaml.rs | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cli/src/main.rs b/cli/src/main.rs index 6c05e2b..5b60fe5 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -26,7 +26,7 @@ fn main() { vm_path: "libflutter.so".to_owned(), }; let yaml_str = " -product_id: demo +app_id: demo channel: stable base_url: http://localhost:8000 "; diff --git a/dart_bindings/lib/src/bindings.dart b/dart_bindings/lib/src/bindings.dart index 8651b5d..d8590b4 100644 --- a/dart_bindings/lib/src/bindings.dart +++ b/dart_bindings/lib/src/bindings.dart @@ -12,7 +12,7 @@ class AppParameters extends ffi.Struct { // ignore: non_constant_identifier_names external ffi.Pointer client_id; // ignore: non_constant_identifier_names - external ffi.Pointer product_id; + external ffi.Pointer app_id; // ignore: non_constant_identifier_names external ffi.Pointer base_version; // ignore: non_constant_identifier_names @@ -26,7 +26,7 @@ class AppParameters extends ffi.Struct { static ffi.Pointer allocate( {required String clientId, - required String productId, + required String appId, required String version, required String channel, required String? updateUrl, @@ -35,7 +35,7 @@ class AppParameters extends ffi.Struct { required String cacheDir}) { var config = calloc(); config.ref.client_id = clientId.toNativeUtf8(); - config.ref.product_id = productId.toNativeUtf8(); + config.ref.app_id = appId.toNativeUtf8(); config.ref.base_version = version.toNativeUtf8(); config.ref.channel = channel.toNativeUtf8(); if (updateUrl != null) { @@ -49,7 +49,7 @@ class AppParameters extends ffi.Struct { static void free(ffi.Pointer config) { calloc.free(config.ref.client_id); - calloc.free(config.ref.product_id); + calloc.free(config.ref.app_id); calloc.free(config.ref.base_version); calloc.free(config.ref.channel); calloc.free(config.ref.update_url); diff --git a/dart_bindings/lib/updater.dart b/dart_bindings/lib/updater.dart index d2af311..2653144 100644 --- a/dart_bindings/lib/updater.dart +++ b/dart_bindings/lib/updater.dart @@ -51,7 +51,7 @@ class Updater { // inside a Flutter app. static void initUpdaterLibrary({ required String clientId, - required String productId, + required String appId, required String version, required String channel, required String? updateUrl, @@ -60,7 +60,7 @@ class Updater { required String cacheDir, }) { var config = AppParameters.allocate( - productId: productId, + appId: appId, version: version, channel: channel, updateUrl: updateUrl, diff --git a/dart_cli/bin/dart_cli.dart b/dart_cli/bin/dart_cli.dart index 7500a48..631646d 100644 --- a/dart_cli/bin/dart_cli.dart +++ b/dart_cli/bin/dart_cli.dart @@ -11,7 +11,7 @@ void main(List args) async { Updater.initUpdaterLibrary( clientId: 'my-client-id', - productId: 'product', + appId: 'demo', version: '1.0.0', channel: 'stable', updateUrl: null, diff --git a/library/src/config.rs b/library/src/config.rs index 01683f0..e415cfb 100644 --- a/library/src/config.rs +++ b/library/src/config.rs @@ -37,7 +37,7 @@ pub struct ResolvedConfig { is_initialized: bool, pub cache_dir: String, pub channel: String, - pub product_id: String, + pub app_id: String, pub base_version: String, pub original_libapp_path: String, pub vm_path: String, @@ -50,7 +50,7 @@ impl ResolvedConfig { is_initialized: false, cache_dir: String::new(), channel: String::new(), - product_id: String::new(), + app_id: String::new(), base_version: String::new(), original_libapp_path: String::new(), vm_path: String::new(), @@ -76,7 +76,7 @@ pub fn set_config(config: AppConfig, yaml: YamlConfig) { .unwrap_or(DEFAULT_CHANNEL) .to_owned(); lock.cache_dir = config.cache_dir.to_string(); - lock.product_id = yaml.product_id.to_string(); + lock.app_id = yaml.app_id.to_string(); lock.base_version = config.base_version.to_string(); lock.original_libapp_path = config.original_libapp_path.to_string(); lock.vm_path = config.vm_path.to_string(); diff --git a/library/src/network.rs b/library/src/network.rs index e615f04..c1d6871 100644 --- a/library/src/network.rs +++ b/library/src/network.rs @@ -39,7 +39,7 @@ pub fn send_patch_check_request( let client = reqwest::blocking::Client::new(); let mut body = HashMap::new(); body.insert("client_id", state.client_id()); - body.insert("product_id", config.product_id.clone()); + body.insert("app_id", config.app_id.clone()); body.insert("channel", config.channel.clone()); body.insert("base_version", config.base_version.clone()); if let Some(patch) = patch { diff --git a/library/src/yaml.rs b/library/src/yaml.rs index 2218f2c..c00fbaa 100644 --- a/library/src/yaml.rs +++ b/library/src/yaml.rs @@ -3,9 +3,9 @@ use serde::Deserialize; /// Struct for parsing shorebird.yaml. #[derive(Deserialize)] pub struct YamlConfig { - /// Product ID. Required. Generated by Shorebird and included + /// App ID. Required. Generated by Shorebird and included /// in your app to identify which app/channel/version triple to update. - pub product_id: String, + pub app_id: String, /// Update channel name. Defaults to "stable" if not set. pub channel: Option, /// Update URL. Defaults to the default update URL if not set.