Skip to content

Commit 304c095

Browse files
committed
Update NativeActivity
1 parent c2fcedb commit 304c095

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

Sources/AndroidNativeActivity/NativeActivity.swift

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import SystemPackage
1919
/// It is created by the framework, and handed to the application's native code as it is being launched.
2020
///
2121
/// [See Also](https://developer.android.com/ndk/reference/group/native-activity#anativeactivity)
22-
public struct NativeActivity: ~Copyable {
22+
@MainActor
23+
public final class NativeActivity {
2324

2425
// MARK: - Properties
2526

@@ -31,6 +32,10 @@ public struct NativeActivity: ~Copyable {
3132
self.pointer = pointer
3233
}
3334

35+
deinit {
36+
ANativeActivity_finish(pointer)
37+
}
38+
3439
// MARK: - Accessors
3540

3641
/// Pointer to the callback function table of the native application.
@@ -247,14 +252,6 @@ public extension NativeActivity {
247252
func hideSoftInput(flags: UInt32) {
248253
ANativeActivity_hideSoftInput(pointer, flags)
249254
}
250-
251-
/// Finish the given activity.
252-
///
253-
/// Calls Activity.finish() on the Java object for the given activity.
254-
/// Note that this method can be called from any thread; it will send a message to the main thread of the process where the Java finish call will take place.
255-
func finish() {
256-
ANativeActivity_finish(pointer)
257-
}
258255
}
259256

260257
#if !os(Android)
@@ -267,8 +264,5 @@ private func ANativeActivity_finish(_ activity: UnsafeMutablePointer<ANativeActi
267264

268265
public typealias ANativeActivity = OpaquePointer
269266
public typealias ANativeActivityCallbacks = OpaquePointer
270-
public typealias JavaVM_ = OpaquePointer
271-
public typealias JNIEnv = OpaquePointer
272-
public typealias jobject = OpaquePointer
273267
public typealias ARect = OpaquePointer
274268
#endif

0 commit comments

Comments
 (0)