adding android main activity path to cli config (#4294)

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
kbz_8andJonathan Kelley authored and GitHub committed 2025-07-23 12:44:10 -07:00
1 parent b257e7e8ce
commit 86f22983f9
3 files changed
+14 -4

No files matched your search

+9 -4
View File
@@ -2939,13 +2939,18 @@ impl BuildRequest {
)?;
// Write the main activity manually since tao dropped support for it
write(
self.wry_android_kotlin_files_out_dir()
.join("MainActivity.kt"),
hbs.render_template(
let main_activity = match self.config.application.android_main_activity.as_deref() {
Some(activity) => std::fs::read_to_string(self.package_manifest_dir().join(activity))
.context("Failed to locate custom MainActivity.kt")?,
_ => hbs.render_template(
include_str!("../../assets/android/MainActivity.kt.hbs"),
&hbs_data,
)?,
};
write(
self.wry_android_kotlin_files_out_dir()
.join("MainActivity.kt"),
main_activity,
)?;
// Write the res folder, containing stuff like default icons, colors, and menubars.
+4
View File
@@ -34,4 +34,8 @@ pub(crate) struct ApplicationConfig {
/// `dx` will merge any required settings into this file required to build the app
#[serde(default)]
pub(crate) android_manifest: Option<PathBuf>,
/// Use this file for the MainActivity.kt associated with the Android app.
#[serde(default)]
pub(crate) android_main_activity: Option<PathBuf>,
}
+1
View File
@@ -21,6 +21,7 @@ impl Default for DioxusConfig {
tailwind_output: None,
ios_info_plist: None,
android_manifest: None,
android_main_activity: None,
macos_info_plist: None,
ios_entitlements: None,
macos_entitlements: None,