Repository navigation
feat(platform): add native Android extension support behind the native-apps flag #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
459e719
feat(app): add native Android extension support
mstankovic-godaddy 20d16a9
Merge branch 'main' into feat/add-native-extension
mstankovic-godaddy 0561a60
Merge branch 'main' into feat/add-native-extension
mstankovic-godaddy cd10b28
feat(platform): register native extensions via DevX Core native-apps API
cblecken-godaddy 1955ef3
test(platform): cover native-app client failure paths; bound error bo…
cblecken-godaddy 5fba3ca
Merge branch 'main' into feat/add-native-extension
mstankovic-godaddy b350cee
Merge branch 'main' into feat/add-native-extension
mstankovic-godaddy 00cb916
feat(platform): omit nativeExtensions unless the native-apps flag is …
mstankovic-godaddy fd2d114
feat(platform): hide add native-extension behind the native-apps flag
mstankovic-godaddy cfc11f6
docs(platform): drop native-extension from stable help and the overvi…
mstankovic-godaddy 5980295
style(platform): format native-apps feature flag changes
mstankovic-godaddy 6e07c7d
Merge branch 'main' into feat/add-native-extension
mstankovic-godaddy 1357d92
remove md file
mstankovic-godaddy 25ace80
CI tests fix
mstankovic-godaddy dcc6652
fix(platform): stop promising a native-app draft and split the releas…
mstankovic-godaddy 7e837f9
PR comments
mstankovic-godaddy 7fb401e
feat(platform): gate native-extension create on accepted agreements a…
mstankovic-godaddy 86ef131
Merge branch 'main' into feat/add-native-extension
mstankovic-godaddy b147dd8
fix(platform): pass base_url by reference to ensure_ready_for_app_ini…
mstankovic-godaddy 5adc7c0
Merge branch 'main' into feat/add-native-extension
mstankovic-godaddy 1fae228
fix(platform): inject TTY state into native-extension onboarding gate
mstankovic-godaddy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| //! Validation for `[native_extension]` manifest configuration. | ||
|
|
||
| pub(super) fn validate( | ||
| errors: &mut Vec<String>, | ||
| path: &str, | ||
| support_contact: &str, | ||
| android_package_name: &str, | ||
| ) { | ||
| if !is_valid_email(support_contact) { | ||
| errors.push(format!( | ||
| "{path}.support_contact must be a valid email address (got {support_contact:?})" | ||
| )); | ||
| } | ||
| if android_package_name.is_empty() { | ||
| errors.push(format!("{path}.android_package_name must be non-empty")); | ||
| } | ||
| } | ||
|
|
||
| /// Match the email shape enforced by DevX Core's Zod v3 `email()` validator. | ||
| fn is_valid_email(value: &str) -> bool { | ||
| if value.starts_with('.') || value.contains("..") { | ||
| return false; | ||
| } | ||
| let Some((local, domain)) = value.split_once('@') else { | ||
| return false; | ||
| }; | ||
| if domain.contains('@') || local.is_empty() { | ||
| return false; | ||
| } | ||
| let Some(last_local) = local.bytes().next_back() else { | ||
| return false; | ||
| }; | ||
| if !local.bytes().all(|byte| { | ||
| byte.is_ascii_alphanumeric() || matches!(byte, b'_' | b'\'' | b'+' | b'-' | b'.') | ||
| }) || !(last_local.is_ascii_alphanumeric() || matches!(last_local, b'_' | b'+' | b'-')) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| let mut labels = domain.split('.').peekable(); | ||
| let Some(first_label) = labels.next() else { | ||
| return false; | ||
| }; | ||
| if labels.peek().is_none() || !is_valid_domain_label(first_label) { | ||
| return false; | ||
| } | ||
| let remaining: Vec<&str> = labels.collect(); | ||
| let Some(top_level_domain) = remaining.last() else { | ||
| return false; | ||
| }; | ||
| remaining.iter().all(|label| is_valid_domain_label(label)) | ||
| && top_level_domain.len() >= 2 | ||
| && top_level_domain | ||
| .bytes() | ||
| .all(|byte| byte.is_ascii_alphabetic()) | ||
| } | ||
|
|
||
| fn is_valid_domain_label(label: &str) -> bool { | ||
| label | ||
| .bytes() | ||
| .next() | ||
| .is_some_and(|byte| byte.is_ascii_alphanumeric()) | ||
| && label | ||
| .bytes() | ||
| .all(|byte| byte.is_ascii_alphanumeric() || byte == b'-') | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::is_valid_email; | ||
|
|
||
| #[test] | ||
| fn rejects_malformed_addresses() { | ||
| for value in [ | ||
| "", | ||
| "not-an-email", | ||
| ".support@example.com", | ||
| "support..team@example.com", | ||
| "support@example", | ||
| "support@example.c", | ||
| ] { | ||
| assert!(!is_valid_email(value), "unexpected valid email: {value:?}"); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn accepts_devx_core_email_shape() { | ||
| for value in [ | ||
| "support@example.com", | ||
| "native.app+alerts@sub.example.co.uk", | ||
| "team_member@example.io", | ||
| ] { | ||
| assert!(is_valid_email(value), "unexpected invalid email: {value:?}"); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,7 @@ mod tests { | |
| dependencies: vec![], | ||
| extensions: None, | ||
| settings: vec![], | ||
| native_extension: None, | ||
| } | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.