chore: rename product_id to app_id (#77)
This commit is contained in:
+1
-1
@@ -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
|
||||
";
|
||||
|
||||
@@ -12,7 +12,7 @@ class AppParameters extends ffi.Struct {
|
||||
// ignore: non_constant_identifier_names
|
||||
external ffi.Pointer<Utf8> client_id;
|
||||
// ignore: non_constant_identifier_names
|
||||
external ffi.Pointer<Utf8> product_id;
|
||||
external ffi.Pointer<Utf8> app_id;
|
||||
// ignore: non_constant_identifier_names
|
||||
external ffi.Pointer<Utf8> base_version;
|
||||
// ignore: non_constant_identifier_names
|
||||
@@ -26,7 +26,7 @@ class AppParameters extends ffi.Struct {
|
||||
|
||||
static ffi.Pointer<AppParameters> 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<AppParameters>();
|
||||
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<AppParameters> 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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -11,7 +11,7 @@ void main(List<String> args) async {
|
||||
|
||||
Updater.initUpdaterLibrary(
|
||||
clientId: 'my-client-id',
|
||||
productId: 'product',
|
||||
appId: 'demo',
|
||||
version: '1.0.0',
|
||||
channel: 'stable',
|
||||
updateUrl: null,
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
+2
-2
@@ -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<String>,
|
||||
/// Update URL. Defaults to the default update URL if not set.
|
||||
|
||||
Reference in New Issue
Block a user