|
@@ -2567,7 +2567,7 @@ impl BuildRequest {
|
|
|
android_bundle: Option<crate::AndroidSettings>,
|
|
|
}
|
|
|
let hbs_data = AndroidHandlebarsObjects {
|
|
|
- application_id: self.full_mobile_app_name(),
|
|
|
+ application_id: self.bundle_identifier(),
|
|
|
app_name: self.bundled_app_name(),
|
|
|
android_bundle: self.config.bundle.android.clone(),
|
|
|
};
|
|
@@ -2979,30 +2979,26 @@ impl BuildRequest {
|
|
|
kept_features
|
|
|
}
|
|
|
|
|
|
- pub(crate) fn mobile_org(&self) -> String {
|
|
|
- let identifier = self.bundle_identifier();
|
|
|
- let mut split = identifier.splitn(3, '.');
|
|
|
- let sub = split
|
|
|
- .next()
|
|
|
- .expect("Identifier to have at least 3 periods like `com.example.app`");
|
|
|
- let tld = split
|
|
|
- .next()
|
|
|
- .expect("Identifier to have at least 3 periods like `com.example.app`");
|
|
|
- format!("{}.{}", sub, tld)
|
|
|
- }
|
|
|
-
|
|
|
pub(crate) fn bundled_app_name(&self) -> String {
|
|
|
use convert_case::{Case, Casing};
|
|
|
self.executable_name().to_case(Case::Pascal)
|
|
|
}
|
|
|
|
|
|
- pub(crate) fn full_mobile_app_name(&self) -> String {
|
|
|
- format!("{}.{}", self.mobile_org(), self.bundled_app_name())
|
|
|
- }
|
|
|
-
|
|
|
pub(crate) fn bundle_identifier(&self) -> String {
|
|
|
- if let Some(identifier) = self.config.bundle.identifier.clone() {
|
|
|
- return identifier.clone();
|
|
|
+ if let Some(identifier) = &self.config.bundle.identifier {
|
|
|
+ if identifier.contains('.')
|
|
|
+ && !identifier.starts_with('.')
|
|
|
+ && !identifier.ends_with('.')
|
|
|
+ && !identifier.contains("..")
|
|
|
+ {
|
|
|
+ return identifier.clone();
|
|
|
+ } else {
|
|
|
+ // The original `mobile_org` function used `expect` directly.
|
|
|
+ // Maybe it's acceptable for the CLI to panic directly when this error occurs.
|
|
|
+ // And if we change it to a Result type, the `client_connected` function in serve/runner.rs does not return a Result and cannot call `?`,
|
|
|
+ // We also need to handle the error in place, otherwise it will expand the scope of modifications further.
|
|
|
+ panic!("Invalid bundle identifier: {identifier:?}. E.g. `com.example`, `com.example.app`");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
format!("com.example.{}", self.bundled_app_name())
|