@synonymdev/react-native-pubky 0.10.5 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,9 +26,11 @@ def isNewArchitectureEnabled() {
26
26
  apply plugin: "com.android.library"
27
27
  apply plugin: "kotlin-android"
28
28
 
29
- if (isNewArchitectureEnabled()) {
30
- apply plugin: "com.facebook.react"
31
- }
29
+ // Disable New Architecture plugin for this library to prevent codegen from
30
+ // generating duplicate React Native core classes
31
+ // if (isNewArchitectureEnabled()) {
32
+ // apply plugin: "com.facebook.react"
33
+ // }
32
34
 
33
35
  def getExtOrDefault(name) {
34
36
  return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["Pubky_" + name]
@@ -60,29 +60,10 @@ class PubkyModule(reactContext: ReactApplicationContext) :
60
60
  }
61
61
 
62
62
  @ReactMethod
63
- fun deleteFile(url: String, promise: Promise) {
63
+ fun deleteFile(url: String, secretKey: String, promise: Promise) {
64
64
  CoroutineScope(Dispatchers.IO).launch {
65
65
  try {
66
- val result = deleteFile(url)
67
- val array = Arguments.createArray().apply {
68
- result.forEach { pushString(it) }
69
- }
70
- withContext(Dispatchers.Main) {
71
- promise.resolve(array)
72
- }
73
- } catch (e: Exception) {
74
- withContext(Dispatchers.Main) {
75
- promise.reject("Error", e.message)
76
- }
77
- }
78
- }
79
- }
80
-
81
- @ReactMethod
82
- fun session(pubky: String, promise: Promise) {
83
- CoroutineScope(Dispatchers.IO).launch {
84
- try {
85
- val result = session(pubky)
66
+ val result = deleteFile(url, secretKey)
86
67
  val array = Arguments.createArray().apply {
87
68
  result.forEach { pushString(it) }
88
69
  }
@@ -244,10 +225,29 @@ class PubkyModule(reactContext: ReactApplicationContext) :
244
225
  }
245
226
 
246
227
  @ReactMethod
247
- fun signOut(secretKey: String, promise: Promise) {
228
+ fun signOut(sessionSecret: String, promise: Promise) {
229
+ CoroutineScope(Dispatchers.IO).launch {
230
+ try {
231
+ val result = signOut(sessionSecret)
232
+ val array = Arguments.createArray().apply {
233
+ result.forEach { pushString(it) }
234
+ }
235
+ withContext(Dispatchers.Main) {
236
+ promise.resolve(array)
237
+ }
238
+ } catch (e: Exception) {
239
+ withContext(Dispatchers.Main) {
240
+ promise.reject("Error", e.message)
241
+ }
242
+ }
243
+ }
244
+ }
245
+
246
+ @ReactMethod
247
+ fun revalidateSession(sessionSecret: String, promise: Promise) {
248
248
  CoroutineScope(Dispatchers.IO).launch {
249
249
  try {
250
- val result = signOut(secretKey)
250
+ val result = revalidateSession(sessionSecret)
251
251
  val array = Arguments.createArray().apply {
252
252
  result.forEach { pushString(it) }
253
253
  }
@@ -263,10 +263,10 @@ class PubkyModule(reactContext: ReactApplicationContext) :
263
263
  }
264
264
 
265
265
  @ReactMethod
266
- fun put(url: String, content: String, promise: Promise) {
266
+ fun put(url: String, content: String, secretKey: String, promise: Promise) {
267
267
  CoroutineScope(Dispatchers.IO).launch {
268
268
  try {
269
- val result = put(url, content)
269
+ val result = put(url, content, secretKey)
270
270
  val array = Arguments.createArray().apply {
271
271
  result.forEach { pushString(it) }
272
272
  }