adding android main activity path to cli config (#4294)
Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
b257e7e8ce
commit
86f22983f9
3 files changed
+14
-4
No files matched your search
@@ -2939,13 +2939,18 @@ impl BuildRequest {
|
|||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Write the main activity manually since tao dropped support for it
|
// Write the main activity manually since tao dropped support for it
|
||||||
write(
|
let main_activity = match self.config.application.android_main_activity.as_deref() {
|
||||||
self.wry_android_kotlin_files_out_dir()
|
Some(activity) => std::fs::read_to_string(self.package_manifest_dir().join(activity))
|
||||||
.join("MainActivity.kt"),
|
.context("Failed to locate custom MainActivity.kt")?,
|
||||||
hbs.render_template(
|
_ => hbs.render_template(
|
||||||
include_str!("../../assets/android/MainActivity.kt.hbs"),
|
include_str!("../../assets/android/MainActivity.kt.hbs"),
|
||||||
&hbs_data,
|
&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.
|
// Write the res folder, containing stuff like default icons, colors, and menubars.
|
||||||
|
|||||||
@@ -34,4 +34,8 @@ pub(crate) struct ApplicationConfig {
|
|||||||
/// `dx` will merge any required settings into this file required to build the app
|
/// `dx` will merge any required settings into this file required to build the app
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub(crate) android_manifest: Option<PathBuf>,
|
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>,
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,7 @@ impl Default for DioxusConfig {
|
|||||||
tailwind_output: None,
|
tailwind_output: None,
|
||||||
ios_info_plist: None,
|
ios_info_plist: None,
|
||||||
android_manifest: None,
|
android_manifest: None,
|
||||||
|
android_main_activity: None,
|
||||||
macos_info_plist: None,
|
macos_info_plist: None,
|
||||||
ios_entitlements: None,
|
ios_entitlements: None,
|
||||||
macos_entitlements: None,
|
macos_entitlements: None,
|
||||||
|
|||||||
Reference in new issue
Block a user