growth extras: prices ppp, ads apple, web, apple adhoc, play share, revenuecat, console fill (+ desktop button)

This commit is contained in:
CRTkafa 2026-10-11 16:14:00 +00:00
parent 02d90de77a
commit e778373fb6
65 changed files with 6307 additions and 27 deletions

View file

@ -257,6 +257,39 @@ pub fn dialog_labels(kind: Kind, title: &str) -> (String, String) {
}
}
/// Dialog of `console.fill` (title, text, button): the answers of its dry run (`data` of `console fill --dry --json`),
/// the uncertain ones marked for the owner, and the note that the owner reviews and saves in the browser.
pub fn console_fill_dialog(project: &str, data: &Value) -> (String, String, String) {
let title = data["title"].as_str().unwrap_or("Console form");
let mut s = format!("{title} · {project}\n\nA browser window opens on the console page. Sign in there yourself; storebound fills the fields below and marks the ones you answer.\n\n{}\n", policy::CONSOLE_FILL_NOTE);
let answers = data["answers"].as_array().cloned().unwrap_or_default();
let mut lines: Vec<String> = answers
.iter()
.map(|a| {
let label = a["label"].as_str().unwrap_or_default();
if a["certain"].as_bool() == Some(true) {
format!("- {label}: {}", a["value"].as_str().unwrap_or_default())
} else {
format!("- {label}: you answer this")
}
})
.collect();
if lines.is_empty() {
lines.push("- (no answers from the config: every field is yours)".into());
}
let mut list = String::new();
for (i, l) in lines.iter().enumerate() {
if list.chars().count() + l.chars().count() > DIALOG_CHARS {
list.push_str(&format!("({} more in the app)\n", lines.len() - i));
break;
}
list.push_str(l);
list.push('\n');
}
s.push_str(&format!("\nAnswers ({} for you):\n{list}", data["uncertain"].as_u64().unwrap_or(0)));
(format!("Fill in console: {title}"), s, "Open the browser".to_string())
}
/// Native Apply / Cancel dialog; true on Apply.
async fn confirm_dialog(window: &WebviewWindow, title: String, text: String) -> Res<bool> {
confirm_dialog_with(window, title, text, "Apply".into()).await
@ -304,10 +337,15 @@ pub async fn write_with_confirm(window: WebviewWindow, app: AppHandle, state: St
if dry["ok"] != Value::Bool(true) {
return Ok(json!({ "confirmed": false, "stage": "dry-run", "dryRun": dry }));
}
let summary = if kind == Kind::Owner { owner_summary(&d.title, &d.description, &proj.name) } else { dialog_summary(&d.title, &d.description, &proj.name, d.network, d.destructive) };
let text = format!("{summary}\n\nDry run ({}):\n{}", dry["command"].as_str().unwrap_or_default(), dialog_excerpt(dry["output"].as_str().unwrap_or_default()));
let (title, text, ok) = if method == policy::CONSOLE_FILL {
console_fill_dialog(&proj.name, &dry["data"])
} else {
let summary = if kind == Kind::Owner { owner_summary(&d.title, &d.description, &proj.name) } else { dialog_summary(&d.title, &d.description, &proj.name, d.network, d.destructive) };
let text = format!("{summary}\n\nDry run ({}):\n{}", dry["command"].as_str().unwrap_or_default(), dialog_excerpt(dry["output"].as_str().unwrap_or_default()));
let (title, ok) = dialog_labels(kind, &d.title);
(title, text, ok)
};
let home = app.path().home_dir().ok().map(|h| h.to_string_lossy().to_string());
let (title, ok) = dialog_labels(kind, &d.title);
if !confirm_dialog_with(&window, title, tilde(&text, home.as_deref()), ok).await? {
return Ok(json!({ "confirmed": false, "stage": "dialog", "dryRun": dry }));
}

View file

@ -110,6 +110,12 @@ pub fn sanitize_js_call(method: &str, kind: Option<Kind>, params: &Value) -> Res
/// in its own commands: `project_init`, `project_import_fastlane`); `write_with_confirm` never runs them.
pub const NEW_FOLDER_METHODS: &[&str] = &["project.init", "import.fastlane"];
/// `console.fill`: a write whose real run opens a visible browser on a store console form and lasts until the owner
/// closes it. `write_with_confirm` shows its answers and this note instead of a dry-run log; a cancel (`job_cancel`)
/// stops the command, which closes the browser.
pub const CONSOLE_FILL: &str = "console.fill";
pub const CONSOLE_FILL_NOTE: &str = "Console pages change. This is AI-assisted: review every field in the browser and press Save yourself. storebound never saves, submits or publishes.";
/// Reads that are never kept in the offline cache (big: one rendered image as a data: URL).
pub const NO_CACHE_METHODS: &[&str] = &["project.render"];