Skip to content

Commit

Permalink
feat!: allow specifying android activity in binding macro (#723)
Browse files Browse the repository at this point in the history
* feat!: allow specifying android activity in binding macro

* Update .changes/android-activity.md
  • Loading branch information
amrbashir authored Apr 14, 2023
1 parent 1bd483c commit b78b961
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changes/android-activity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": "minor"
---

**Breaking change**: All ow specifying the android activity in `android_binding` macro, instead of hard-coded `TauriActivity`.
20 changes: 10 additions & 10 deletions src/platform_impl/android/ndk_glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,29 @@ pub static PACKAGE: OnceCell<&str> = OnceCell::new();

#[macro_export]
macro_rules! android_binding {
($domain:ident, $package:ident, $setup: ident, $main: ident) => {
($domain:ident, $package:ident, $activity:ident, $setup:ident, $main:ident) => {
fn __store_package_name__() {
PACKAGE.get_or_init(move || generate_package_name!($domain, $package));
}

android_fn!(
$domain,
$package,
TauriActivity,
$activity,
create,
[JObject],
__VOID__,
[$setup, $main],
__store_package_name__,
);
android_fn!($domain, $package, TauriActivity, start, [JObject]);
android_fn!($domain, $package, TauriActivity, stop, [JObject]);
android_fn!($domain, $package, TauriActivity, resume, [JObject]);
android_fn!($domain, $package, TauriActivity, pause, [JObject]);
android_fn!($domain, $package, TauriActivity, save, [JObject]);
android_fn!($domain, $package, TauriActivity, destroy, [JObject]);
android_fn!($domain, $package, TauriActivity, memory, [JObject]);
android_fn!($domain, $package, TauriActivity, focus, [i32]);
android_fn!($domain, $package, $activity, start, [JObject]);
android_fn!($domain, $package, $activity, stop, [JObject]);
android_fn!($domain, $package, $activity, resume, [JObject]);
android_fn!($domain, $package, $activity, pause, [JObject]);
android_fn!($domain, $package, $activity, save, [JObject]);
android_fn!($domain, $package, $activity, destroy, [JObject]);
android_fn!($domain, $package, $activity, memory, [JObject]);
android_fn!($domain, $package, $activity, focus, [i32]);
};
}

Expand Down

0 comments on commit b78b961

Please sign in to comment.