upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/100.md
diff options
context:
space:
mode:
authorgreenart7c3 <115044884+greenart7c3@users.noreply.github.com>2024-03-18 15:10:25 -0300
committerGitHub <noreply@github.com>2024-03-18 15:10:25 -0300
commita2aaa3c00b18e2e11dceae9400cd6fc429562622 (patch)
treeac9853eb35052888d398646181907a474e849ad2 /100.md
parent6b26ebe6c5c9834549aa9adec0d066bc5c6aae88 (diff)
add example of rememberLauncherForActivityResult
Diffstat (limited to '100.md')
-rw-r--r--100.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/100.md b/100.md
index 79ced80..24bf09f 100644
--- a/100.md
+++ b/100.md
@@ -40,6 +40,24 @@ fun isExternalSignerInstalled(context: Context): Boolean {
40 40
41To get the result back from the Signer Application you should use `registerForActivityResult` or `rememberLauncherForActivityResult` in Kotlin. If you are using another framework check the documentation of your framework or a third party library to get the result. 41To get the result back from the Signer Application you should use `registerForActivityResult` or `rememberLauncherForActivityResult` in Kotlin. If you are using another framework check the documentation of your framework or a third party library to get the result.
42 42
43```kotlin
44val launcher = rememberLauncherForActivityResult(
45 contract = ActivityResultContracts.StartActivityForResult(),
46 onResult = { result ->
47 if (result.resultCode != Activity.RESULT_OK) {
48 Toast.makeText(
49 context,
50 "Sign request rejected",
51 Toast.LENGTH_SHORT
52 ).show()
53 } else {
54 val signature = activityResult.data?.getStringExtra("signature")
55 // Do something with signature ...
56 }
57 }
58)
59```
60
43Create the Intent using the **nostrsigner** scheme: 61Create the Intent using the **nostrsigner** scheme:
44 62
45```kotlin 63```kotlin
@@ -52,6 +70,12 @@ Set the Signer package name:
52intent.`package` = "com.example.signer" 70intent.`package` = "com.example.signer"
53``` 71```
54 72
73Send the Intent:
74
75```kotlin
76launcher.launch(intent)
77```
78
55### Methods 79### Methods
56 80
57- **get_public_key** 81- **get_public_key**