Skip to content

Commit a0113a8

Browse files
authored
feat(tauri-plugin): add build::mobile::update_info_plist (#13888)
* feat(tauri-plugin): add build::mobile::update_info_plist needed for tauri-apps/plugins-workspace#2870 * Update .changes/update-info-plist.md
1 parent 91508c0 commit a0113a8

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.changes/update-info-plist.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-plugin": minor:feat
3+
---
4+
5+
Added `build::mobile::update_info_plist` to allow a plugin to update the iOS project Info.plist file.

crates/tauri-plugin/src/build/mobile.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ pub fn update_entitlements<F: FnOnce(&mut plist::Dictionary)>(f: F) -> Result<()
3131
Ok(())
3232
}
3333

34+
#[cfg(target_os = "macos")]
35+
pub fn update_info_plist<F: FnOnce(&mut plist::Dictionary)>(f: F) -> Result<()> {
36+
if let (Some(project_path), Ok(app_name)) = (
37+
var_os("TAURI_IOS_PROJECT_PATH").map(PathBuf::from),
38+
std::env::var("TAURI_IOS_APP_NAME"),
39+
) {
40+
update_plist_file(
41+
project_path
42+
.join(format!("{app_name}_iOS"))
43+
.join("Info.plist"),
44+
f,
45+
)?;
46+
}
47+
48+
Ok(())
49+
}
50+
3451
pub fn update_android_manifest(block_identifier: &str, parent: &str, insert: String) -> Result<()> {
3552
if let Some(project_path) = var_os("TAURI_ANDROID_PROJECT_PATH").map(PathBuf::from) {
3653
let manifest_path = project_path.join("app/src/main/AndroidManifest.xml");

0 commit comments

Comments
 (0)