@viafoura/sdk-react-native 0.1.1 → 0.1.2
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.
- package/android/build.gradle +1 -0
- package/android/src/main/java/expo/modules/viafourasdk/NewCommentView.kt +1 -2
- package/android/src/main/java/expo/modules/viafourasdk/PreviewCommentsView.kt +9 -7
- package/android/src/main/java/expo/modules/viafourasdk/ProfileView.kt +2 -4
- package/android/src/main/java/expo/modules/viafourasdk/ViafouraModule.kt +9 -9
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -27,7 +27,7 @@ import com.viafourasdk.src.model.local.VFTheme
|
|
|
27
27
|
import java.net.URL
|
|
28
28
|
import java.util.UUID
|
|
29
29
|
|
|
30
|
-
class NewCommentView(context: Context,
|
|
30
|
+
class NewCommentView(context: Context, appContext: AppContext) :
|
|
31
31
|
ExpoView(context, appContext), VFCustomUIInterface, VFActionsInterface, VFLayoutInterface {
|
|
32
32
|
|
|
33
33
|
// Props
|
|
@@ -150,4 +150,3 @@ class NewCommentView(context: Context, private val appContext: AppContext) :
|
|
|
150
150
|
onHeightChanged(mapOf("newHeight" to height, "containerId" to containerId))
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
|
|
@@ -26,7 +26,7 @@ import com.viafourasdk.src.model.local.VFSettings
|
|
|
26
26
|
import com.viafourasdk.src.model.local.VFTheme
|
|
27
27
|
import java.net.URL
|
|
28
28
|
|
|
29
|
-
class PreviewCommentsView(context: Context,
|
|
29
|
+
class PreviewCommentsView(context: Context, appContext: AppContext) :
|
|
30
30
|
ExpoView(context, appContext), VFCustomUIInterface, VFActionsInterface, VFLayoutInterface {
|
|
31
31
|
|
|
32
32
|
// Props
|
|
@@ -129,14 +129,16 @@ class PreviewCommentsView(context: Context, private val appContext: AppContext)
|
|
|
129
129
|
override fun onNewAction(actionType: VFActionType, action: VFActionData) {
|
|
130
130
|
when (actionType) {
|
|
131
131
|
VFActionType.writeNewCommentPressed -> {
|
|
132
|
-
val
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
val payload = mutableMapOf<String, Any>()
|
|
133
|
+
action.newCommentAction?.content?.toString()?.let { payload["content"] = it }
|
|
134
|
+
action.newCommentAction?.type?.toString()?.let { payload["actionType"] = it }
|
|
135
|
+
onNewComment(payload)
|
|
135
136
|
}
|
|
136
137
|
VFActionType.openProfilePressed -> {
|
|
137
|
-
val
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
val payload = mutableMapOf<String, Any>()
|
|
139
|
+
action.openProfileAction?.presentationType?.toString()?.let { payload["presentationType"] = it }
|
|
140
|
+
action.openProfileAction?.userUUID?.toString()?.let { payload["userUUID"] = it }
|
|
141
|
+
onOpenProfile(payload)
|
|
140
142
|
}
|
|
141
143
|
VFActionType.trendingArticlePressed -> {
|
|
142
144
|
val url = action.trendingPressedAction?.articleMetadata?.url?.toString() ?: return
|
|
@@ -24,7 +24,7 @@ import com.viafourasdk.src.model.local.VFProfilePresentationType
|
|
|
24
24
|
import com.viafourasdk.src.model.local.VFTheme
|
|
25
25
|
import java.util.UUID
|
|
26
26
|
|
|
27
|
-
class ProfileView(context: Context,
|
|
27
|
+
class ProfileView(context: Context, appContext: AppContext) :
|
|
28
28
|
ExpoView(context, appContext), VFCustomUIInterface, VFActionsInterface, VFLayoutInterface {
|
|
29
29
|
|
|
30
30
|
// Props
|
|
@@ -70,8 +70,7 @@ class ProfileView(context: Context, private val appContext: AppContext) :
|
|
|
70
70
|
|
|
71
71
|
val pres = when (presentationType) {
|
|
72
72
|
"feed" -> VFProfilePresentationType.feed
|
|
73
|
-
|
|
74
|
-
else -> null
|
|
73
|
+
else -> VFProfilePresentationType.profile
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
val uuid = UUID.fromString(requireNotNull(userUUID))
|
|
@@ -131,4 +130,3 @@ class ProfileView(context: Context, private val appContext: AppContext) :
|
|
|
131
130
|
height: Int
|
|
132
131
|
) { /* no-op for profile */ }
|
|
133
132
|
}
|
|
134
|
-
|
|
@@ -36,7 +36,7 @@ class ViafouraModule : Module() {
|
|
|
36
36
|
promise.resolve(null)
|
|
37
37
|
}
|
|
38
38
|
override fun onError(err: NetworkError) {
|
|
39
|
-
promise.reject("E_VF_LOGIN", err.message ?: "Login failed")
|
|
39
|
+
promise.reject("E_VF_LOGIN", err.message ?: "Login failed", null)
|
|
40
40
|
}
|
|
41
41
|
})
|
|
42
42
|
}
|
|
@@ -47,7 +47,7 @@ class ViafouraModule : Module() {
|
|
|
47
47
|
promise.resolve(null)
|
|
48
48
|
}
|
|
49
49
|
override fun onError(err: NetworkError) {
|
|
50
|
-
promise.reject("E_VF_SIGNUP", err.message ?: "Signup failed")
|
|
50
|
+
promise.reject("E_VF_SIGNUP", err.message ?: "Signup failed", null)
|
|
51
51
|
}
|
|
52
52
|
})
|
|
53
53
|
}
|
|
@@ -59,7 +59,7 @@ class ViafouraModule : Module() {
|
|
|
59
59
|
promise.resolve(null)
|
|
60
60
|
}
|
|
61
61
|
override fun onError(err: NetworkError) {
|
|
62
|
-
promise.reject("E_VF_SOCIAL", err.message ?: "Social login failed")
|
|
62
|
+
promise.reject("E_VF_SOCIAL", err.message ?: "Social login failed", null)
|
|
63
63
|
}
|
|
64
64
|
})
|
|
65
65
|
}
|
|
@@ -70,7 +70,7 @@ class ViafouraModule : Module() {
|
|
|
70
70
|
promise.resolve(null)
|
|
71
71
|
}
|
|
72
72
|
override fun onError(err: NetworkError) {
|
|
73
|
-
promise.reject("E_VF_OPENID", err.message ?: "OpenID login failed")
|
|
73
|
+
promise.reject("E_VF_OPENID", err.message ?: "OpenID login failed", null)
|
|
74
74
|
}
|
|
75
75
|
})
|
|
76
76
|
}
|
|
@@ -81,7 +81,7 @@ class ViafouraModule : Module() {
|
|
|
81
81
|
promise.resolve(null)
|
|
82
82
|
}
|
|
83
83
|
override fun onError(err: NetworkError) {
|
|
84
|
-
promise.reject("E_VF_COOKIE", err.message ?: "Cookie login failed")
|
|
84
|
+
promise.reject("E_VF_COOKIE", err.message ?: "Cookie login failed", null)
|
|
85
85
|
}
|
|
86
86
|
})
|
|
87
87
|
}
|
|
@@ -92,7 +92,7 @@ class ViafouraModule : Module() {
|
|
|
92
92
|
promise.resolve(null)
|
|
93
93
|
}
|
|
94
94
|
override fun onError(err: NetworkError) {
|
|
95
|
-
promise.reject("E_VF_RESET", err.message ?: "Password reset failed")
|
|
95
|
+
promise.reject("E_VF_RESET", err.message ?: "Password reset failed", null)
|
|
96
96
|
}
|
|
97
97
|
})
|
|
98
98
|
}
|
|
@@ -102,11 +102,11 @@ class ViafouraModule : Module() {
|
|
|
102
102
|
val context = appContext.reactContext?.applicationContext
|
|
103
103
|
?: appContext.currentActivity?.applicationContext
|
|
104
104
|
if (context == null) {
|
|
105
|
-
promise.reject("E_VF_INIT", "No application context available")
|
|
105
|
+
promise.reject("E_VF_INIT", "No application context available", null)
|
|
106
106
|
return@AsyncFunction
|
|
107
107
|
}
|
|
108
108
|
if (siteUUID.isBlank() || siteDomain.isBlank()) {
|
|
109
|
-
promise.reject("E_VF_INIT", "Invalid Viafoura initialization parameters")
|
|
109
|
+
promise.reject("E_VF_INIT", "Invalid Viafoura initialization parameters", null)
|
|
110
110
|
return@AsyncFunction
|
|
111
111
|
}
|
|
112
112
|
try {
|
|
@@ -114,7 +114,7 @@ class ViafouraModule : Module() {
|
|
|
114
114
|
ViafouraSDK.initialize(context, siteUUID, siteDomain)
|
|
115
115
|
promise.resolve(null)
|
|
116
116
|
} catch (e: Exception) {
|
|
117
|
-
promise.reject("E_VF_INIT", e.message ?: "Viafoura initialization failed")
|
|
117
|
+
promise.reject("E_VF_INIT", e.message ?: "Viafoura initialization failed", e)
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|