Skip to content

Commit

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

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

OnNewIntent {
handleShareIntent(it)
}
Expand Down
5 changes: 5 additions & 0 deletions ios/ExpoShareIntentModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,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 Down
4 changes: 4 additions & 0 deletions src/ExpoShareIntentModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export function hasShareIntent(key: string): boolean {
return ExpoShareIntentModule.hasShareIntent(key ?? getShareExtensionKey());
}

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

const emitter = new EventEmitter(
ExpoShareIntentModule ?? NativeModulesProxy.ExpoShareIntentModule,
);
Expand Down

0 comments on commit 5ebadec

Please sign in to comment.