Skip to content

Commit

Permalink
feat: close app
Browse files Browse the repository at this point in the history
  • Loading branch information
achorein committed Oct 2, 2024
1 parent 783306a commit 3f0d8fa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ class ExpoShareIntentModule : Module() {
ExpoShareIntentSingleton.isPending
}

Function("closeApp") { _: String ->
android.os.Process.killProcess(android.os.Process.myPid())
}

OnNewIntent {
handleShareIntent(it)
}
Expand Down
7 changes: 7 additions & 0 deletions ios/ExpoShareIntentModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public class ExpoShareIntentModule: Module {
// for Android only
return false
}

Function("closeApp") { (key: String) in
exit(0);
return true
}
}

private var initialMedia: [SharedMediaFile]? = nil
Expand All @@ -52,6 +57,8 @@ public class ExpoShareIntentModule: Module {
private var initialText: String? = nil
private var latestText: String? = nil

}

private func handleUrl(url: URL?) -> String? {
let appDomain = Bundle.main.bundleIdentifier!
if let url = url {
Expand Down
4 changes: 4 additions & 0 deletions src/ExpoShareIntentModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ const emitter = ExpoShareIntentModule
? new EventEmitter(ExpoShareIntentModule)
: null;

export function closeApp(): boolean {
return ExpoShareIntentModule.closeApp();
}

export function addErrorListener(
listener: (event: ChangeEventPayload) => void,
): Subscription | null {
Expand Down

0 comments on commit 3f0d8fa

Please sign in to comment.