@supertokens/rownd-react-native 0.1.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.
Files changed (106) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +554 -0
  3. package/android/build.gradle +153 -0
  4. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  5. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/gradlew +234 -0
  8. package/android/gradlew.bat +89 -0
  9. package/android/src/main/AndroidManifest.xml +4 -0
  10. package/android/src/main/java/com/reactnativerowndplugin/RowndPluginModule.kt +235 -0
  11. package/android/src/main/java/com/reactnativerowndplugin/RowndPluginPackage.kt +25 -0
  12. package/app.plugin.js +3 -0
  13. package/expo/plugin.js +61 -0
  14. package/ios/Rownd.xcodeproj/project.pbxproj +283 -0
  15. package/ios/RowndHelper.swift +62 -0
  16. package/ios/RowndPlugin-Bridging-Header.h +3 -0
  17. package/ios/RowndPlugin.m +31 -0
  18. package/ios/RowndPlugin.swift +233 -0
  19. package/ios/RowndPluginEventEmitter.m +12 -0
  20. package/ios/RowndPluginEventEmitter.swift +19 -0
  21. package/lib/commonjs/components/GlobalContext.js +72 -0
  22. package/lib/commonjs/components/GlobalContext.js.map +1 -0
  23. package/lib/commonjs/components/GlobalContext.types.js +6 -0
  24. package/lib/commonjs/components/GlobalContext.types.js.map +1 -0
  25. package/lib/commonjs/components/GlobalContext.web.js +21 -0
  26. package/lib/commonjs/components/GlobalContext.web.js.map +1 -0
  27. package/lib/commonjs/components/RequireSignIn.js +37 -0
  28. package/lib/commonjs/components/RequireSignIn.js.map +1 -0
  29. package/lib/commonjs/components/SignedIn.js +22 -0
  30. package/lib/commonjs/components/SignedIn.js.map +1 -0
  31. package/lib/commonjs/components/SignedOut.js +22 -0
  32. package/lib/commonjs/components/SignedOut.js.map +1 -0
  33. package/lib/commonjs/constants/action.js +11 -0
  34. package/lib/commonjs/constants/action.js.map +1 -0
  35. package/lib/commonjs/hooks/rownd.js +30 -0
  36. package/lib/commonjs/hooks/rownd.js.map +1 -0
  37. package/lib/commonjs/hooks/rownd.web.js +56 -0
  38. package/lib/commonjs/hooks/rownd.web.js.map +1 -0
  39. package/lib/commonjs/index.js +42 -0
  40. package/lib/commonjs/index.js.map +1 -0
  41. package/lib/commonjs/reducer/rowndReducer.js +67 -0
  42. package/lib/commonjs/reducer/rowndReducer.js.map +1 -0
  43. package/lib/commonjs/types.js +2 -0
  44. package/lib/commonjs/types.js.map +1 -0
  45. package/lib/commonjs/utils/config.js +6 -0
  46. package/lib/commonjs/utils/config.js.map +1 -0
  47. package/lib/commonjs/utils/nativeModule.js +70 -0
  48. package/lib/commonjs/utils/nativeModule.js.map +1 -0
  49. package/lib/module/components/GlobalContext.js +64 -0
  50. package/lib/module/components/GlobalContext.js.map +1 -0
  51. package/lib/module/components/GlobalContext.types.js +2 -0
  52. package/lib/module/components/GlobalContext.types.js.map +1 -0
  53. package/lib/module/components/GlobalContext.web.js +14 -0
  54. package/lib/module/components/GlobalContext.web.js.map +1 -0
  55. package/lib/module/components/RequireSignIn.js +30 -0
  56. package/lib/module/components/RequireSignIn.js.map +1 -0
  57. package/lib/module/components/SignedIn.js +15 -0
  58. package/lib/module/components/SignedIn.js.map +1 -0
  59. package/lib/module/components/SignedOut.js +15 -0
  60. package/lib/module/components/SignedOut.js.map +1 -0
  61. package/lib/module/constants/action.js +5 -0
  62. package/lib/module/constants/action.js.map +1 -0
  63. package/lib/module/hooks/rownd.js +24 -0
  64. package/lib/module/hooks/rownd.js.map +1 -0
  65. package/lib/module/hooks/rownd.web.js +50 -0
  66. package/lib/module/hooks/rownd.web.js.map +1 -0
  67. package/lib/module/index.js +7 -0
  68. package/lib/module/index.js.map +1 -0
  69. package/lib/module/reducer/rowndReducer.js +60 -0
  70. package/lib/module/reducer/rowndReducer.js.map +1 -0
  71. package/lib/module/types.js +2 -0
  72. package/lib/module/types.js.map +1 -0
  73. package/lib/module/utils/config.js +2 -0
  74. package/lib/module/utils/config.js.map +1 -0
  75. package/lib/module/utils/nativeModule.js +55 -0
  76. package/lib/module/utils/nativeModule.js.map +1 -0
  77. package/lib/typescript/components/GlobalContext.d.ts +13 -0
  78. package/lib/typescript/components/GlobalContext.types.d.ts +90 -0
  79. package/lib/typescript/components/GlobalContext.web.d.ts +4 -0
  80. package/lib/typescript/components/RequireSignIn.d.ts +9 -0
  81. package/lib/typescript/components/SignedIn.d.ts +6 -0
  82. package/lib/typescript/components/SignedOut.d.ts +6 -0
  83. package/lib/typescript/constants/action.d.ts +7 -0
  84. package/lib/typescript/hooks/rownd.d.ts +31 -0
  85. package/lib/typescript/hooks/rownd.web.d.ts +2 -0
  86. package/lib/typescript/index.d.ts +6 -0
  87. package/lib/typescript/reducer/rowndReducer.d.ts +4 -0
  88. package/lib/typescript/types.d.ts +21 -0
  89. package/lib/typescript/utils/config.d.ts +7 -0
  90. package/lib/typescript/utils/nativeModule.d.ts +14 -0
  91. package/package.json +167 -0
  92. package/rownd-react-native.podspec +38 -0
  93. package/src/components/GlobalContext.tsx +93 -0
  94. package/src/components/GlobalContext.types.ts +109 -0
  95. package/src/components/GlobalContext.web.tsx +17 -0
  96. package/src/components/RequireSignIn.tsx +35 -0
  97. package/src/components/SignedIn.tsx +17 -0
  98. package/src/components/SignedOut.tsx +17 -0
  99. package/src/constants/action.ts +8 -0
  100. package/src/hooks/rownd.ts +68 -0
  101. package/src/hooks/rownd.web.ts +56 -0
  102. package/src/index.tsx +7 -0
  103. package/src/reducer/rowndReducer.ts +63 -0
  104. package/src/types.ts +32 -0
  105. package/src/utils/config.ts +9 -0
  106. package/src/utils/nativeModule.ts +83 -0
@@ -0,0 +1,235 @@
1
+ package com.reactnativerowndplugin
2
+
3
+ import android.content.res.Configuration
4
+ import android.os.Handler
5
+ import android.os.Looper
6
+ import android.util.Log
7
+ import androidx.compose.ui.graphics.Color
8
+ import androidx.compose.ui.unit.Dp
9
+ import androidx.compose.ui.unit.dp
10
+ import androidx.fragment.app.FragmentActivity
11
+ import com.facebook.react.bridge.*
12
+ import com.facebook.react.modules.core.DeviceEventManagerModule
13
+ import io.rownd.android.*
14
+ import io.rownd.android.Rownd
15
+ import io.rownd.android.RowndConfigureOptions
16
+ import io.rownd.android.RowndSignInHint
17
+ import io.rownd.android.RowndSignInOptions
18
+ import io.rownd.android.models.RowndCustomizations
19
+ import io.rownd.android.models.repos.GlobalState
20
+ import kotlinx.coroutines.*
21
+ import kotlinx.serialization.json.Json
22
+
23
+ class AppCustomizations(app: FragmentActivity) : RowndCustomizations() {
24
+ private var app: FragmentActivity
25
+ open var reactNativeSheetBackgroundColor: Color? = null
26
+
27
+ init {
28
+ this.app = app
29
+ }
30
+
31
+ override val dynamicSheetBackgroundColor: Color
32
+ get() {
33
+ if (reactNativeSheetBackgroundColor != null) {
34
+ return reactNativeSheetBackgroundColor as Color
35
+ }
36
+ val uiMode = app.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
37
+ return if (uiMode == Configuration.UI_MODE_NIGHT_YES) {
38
+ Color(0xff123456)
39
+ } else {
40
+ Color(0xfffedcba)
41
+ }
42
+ }
43
+
44
+ override var sheetCornerBorderRadius: Dp = 25.dp
45
+ }
46
+
47
+
48
+ class RowndPluginModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
49
+ private var uiThreadHandler = Handler(Looper.getMainLooper())
50
+ private var coroutineScope: Job? = null
51
+ private var coroutineScope2: Job? = null
52
+ private var isRowndJSInitialized = false
53
+
54
+ override fun getName(): String {
55
+ return "RowndPlugin"
56
+ }
57
+
58
+ private fun sendEvent(reactContext: ReactContext, eventName: String, params: WritableMap?) {
59
+ reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
60
+ .emit(eventName, params)
61
+ }
62
+
63
+ init {
64
+ coroutineScope = CoroutineScope(Dispatchers.IO).launch {
65
+ Rownd.state.collect {
66
+ uiThreadHandler.post {
67
+ val params = Arguments.createMap().apply {
68
+ putString("state", Json.encodeToString(GlobalState.serializer(), it))
69
+ }
70
+ if (isRowndJSInitialized) {
71
+ sendEvent(reactApplicationContext, "update_state", params)
72
+ } else {
73
+ println("ROWND JS: NOT INITIALIZED YET")
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+
80
+ @ReactMethod
81
+ fun customizations(config: ReadableMap) {
82
+ val appCustomizations = AppCustomizations(reactApplicationContext.currentActivity as FragmentActivity)
83
+
84
+ val sheetBackgroundHexColor: String? = config.getString("sheetBackgroundHexColor")
85
+ if (sheetBackgroundHexColor != null) {
86
+ appCustomizations.reactNativeSheetBackgroundColor = Color(android.graphics.Color.parseColor(sheetBackgroundHexColor))
87
+ }
88
+
89
+ val sheetCornerBorderRadius: String? = config.getString("sheetCornerBorderRadius")
90
+ if (sheetCornerBorderRadius != null && sheetCornerBorderRadius.toDoubleOrNull() != null) {
91
+ appCustomizations.sheetCornerBorderRadius = sheetCornerBorderRadius.toDouble().dp
92
+ }
93
+
94
+ val loadingAnimation: String? = config.getString("loadingAnimation")
95
+ if (loadingAnimation != null) {
96
+ appCustomizations.loadingAnimationJsonString = loadingAnimation
97
+ }
98
+
99
+ Rownd.config.customizations = appCustomizations
100
+ }
101
+
102
+ @ReactMethod
103
+ fun configure(config: ReadableMap) {
104
+ val appKey = config.getString("appKey")
105
+ val supertokens = if (config.hasKey("supertokens")) config.getMap("supertokens") else null
106
+ val appInfo = if (supertokens?.hasKey("appInfo") == true) supertokens.getMap("appInfo") else null
107
+ val apiDomain = appInfo?.getString("apiDomain")
108
+ val apiBasePath = appInfo?.getString("apiBasePath") ?: "/auth"
109
+ val hubUrlOverride = if (config.hasKey("hubUrlOverride")) config.getString("hubUrlOverride") else null
110
+ val deepLinkScheme = if (config.hasKey("deepLinkScheme")) config.getString("deepLinkScheme") else "rowndsupertokens"
111
+
112
+ if (appKey != null && apiDomain != null) {
113
+ Rownd.configure(
114
+ reactApplicationContext.currentActivity as FragmentActivity,
115
+ RowndConfigureOptions(
116
+ appKey = appKey,
117
+ apiDomain = apiDomain,
118
+ apiBasePath = apiBasePath,
119
+ hubUrl = hubUrlOverride,
120
+ deepLinkScheme = deepLinkScheme ?: "rowndsupertokens"
121
+ )
122
+ )
123
+ isRowndJSInitialized = true
124
+ } else {
125
+ Log.e("RowndPlugin", "config.appKey and config.supertokens.appInfo.apiDomain are required")
126
+ }
127
+ }
128
+
129
+ @ReactMethod
130
+ fun handleSignInLink(url: String) {
131
+ val activity = reactApplicationContext.currentActivity ?: return
132
+ activity.intent = android.content.Intent(
133
+ android.content.Intent.ACTION_VIEW,
134
+ android.net.Uri.parse(url)
135
+ )
136
+ try {
137
+ val apiGetter = Rownd.javaClass.getMethod("getSignInLinkApi\$android_release")
138
+ val api = apiGetter.invoke(Rownd)
139
+ val method = api.javaClass.getMethod(
140
+ "signInWithLinkIfPresentOnIntentOrClipboard\$android_release",
141
+ android.app.Activity::class.java
142
+ )
143
+ method.invoke(api, activity)
144
+ } catch (e: Exception) {
145
+ Log.e("RowndPlugin", "handleSignInLink failed", e)
146
+ }
147
+ }
148
+
149
+ @ReactMethod
150
+ fun requestSignIn(signInConfig: ReadableMap) {
151
+ val rowndSignInOptions = RowndSignInOptions()
152
+
153
+ val intentString = signInConfig.getString("intent")
154
+ if (intentString != null) {
155
+ when (intentString) {
156
+ "sign_in" -> {
157
+ rowndSignInOptions.intent = RowndSignInIntent.SignIn
158
+ }
159
+ "sign_up" -> {
160
+ rowndSignInOptions.intent = RowndSignInIntent.SignUp
161
+ }
162
+ else -> {
163
+ println("ROWND: Invalid intent type")
164
+ }
165
+ }
166
+ }
167
+
168
+ val postSignInRedirect = signInConfig.getString("postSignInRedirect")
169
+ if (postSignInRedirect != null) {
170
+ rowndSignInOptions.postSignInRedirect = postSignInRedirect
171
+ }
172
+
173
+ fun requestSignInHub() {
174
+ Rownd.requestSignIn(signInOptions = rowndSignInOptions)
175
+ }
176
+
177
+ val method = signInConfig.getString("method")
178
+ if (method != null) {
179
+ when (method) {
180
+ "google" -> Rownd.requestSignIn(with = RowndSignInHint.Google, signInOptions = rowndSignInOptions)
181
+ "apple" -> {
182
+ println("ROWND: Apple sign is setup through the Rownd hub")
183
+ requestSignInHub()
184
+ }
185
+ "email" -> requestSignInHub()
186
+ "phone" -> requestSignInHub()
187
+ "guest" -> Rownd.requestSignIn(with = RowndSignInHint.Guest, signInOptions = rowndSignInOptions)
188
+ "anonymous" -> Rownd.requestSignIn(with = RowndSignInHint.Guest, signInOptions = rowndSignInOptions)
189
+ else -> {
190
+ requestSignInHub()
191
+ }
192
+ }
193
+ } else {
194
+ requestSignInHub()
195
+ }
196
+ }
197
+
198
+ @ReactMethod
199
+ fun signOut() {
200
+ Rownd.signOut()
201
+ }
202
+
203
+ @ReactMethod
204
+ fun manageAccount() {
205
+ Rownd.manageAccount()
206
+ }
207
+
208
+ @ReactMethod
209
+ @Suppress("UNCHECKED_CAST")
210
+ fun setUserData(data: ReadableMap) {
211
+ Rownd.user.set(data.toHashMap() as Map<String, Any>)
212
+ }
213
+
214
+ @ReactMethod
215
+ fun setUserDataValue(key: String, array: ReadableMap) {
216
+ val value = array.toHashMap().entries.find { it.key == "value" }?.value
217
+ if (value != null) {
218
+ Rownd.user.set(key, value)
219
+ } else {
220
+ println("ROWND ANDROID PLUGIN: Missing content for value")
221
+ }
222
+ }
223
+
224
+ @ReactMethod
225
+ fun getAccessToken(promise: Promise) {
226
+ coroutineScope = CoroutineScope(Dispatchers.IO).launch {
227
+ try {
228
+ promise.resolve(Rownd.getAccessToken() ?: "")
229
+ } catch (e: Throwable) {
230
+ promise.reject("ROWND PLUGIN MODULE ERROR: ${e.message}")
231
+ }
232
+ }
233
+ }
234
+
235
+ }
@@ -0,0 +1,25 @@
1
+ package com.reactnativerowndplugin
2
+ import androidx.fragment.app.FragmentActivity
3
+ import com.facebook.react.ReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.uimanager.ViewManager
7
+ import io.rownd.android.Rownd
8
+
9
+
10
+ class RowndPluginPackage : ReactPackage {
11
+ override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
12
+ return listOf(RowndPluginModule(reactContext))
13
+ }
14
+
15
+ override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
16
+ return emptyList()
17
+ }
18
+
19
+ companion object {
20
+ @JvmStatic
21
+ fun preInit(activity: FragmentActivity) {
22
+ Rownd._registerActivityLifecycle(activity)
23
+ }
24
+ }
25
+ }
package/app.plugin.js ADDED
@@ -0,0 +1,3 @@
1
+ const { withRowndSDK } = require('./expo/plugin');
2
+
3
+ module.exports = (config) => withRowndSDK(config);
package/expo/plugin.js ADDED
@@ -0,0 +1,61 @@
1
+ const { withMainActivity, withInfoPlist } = require('expo/config-plugins');
2
+
3
+ const withRowndMainActivity = (config) => {
4
+ return withMainActivity(config, async (actConfig) => {
5
+ let mainActivityString = actConfig.modResults.contents;
6
+
7
+ if (!mainActivityString.includes('RowndPluginPackage.preInit')) {
8
+ const regex = /super.onCreate\(\w+\);?/;
9
+ mainActivityString = mainActivityString.replace(
10
+ regex,
11
+ `super.onCreate(savedInstanceState);\n RowndPluginPackage.preInit(this);\n`
12
+ );
13
+ }
14
+
15
+ if (
16
+ !mainActivityString.includes(
17
+ 'com.reactnativerowndplugin.RowndPluginPackage'
18
+ )
19
+ ) {
20
+ const regex = /import\s+\S+\n/;
21
+ mainActivityString = mainActivityString.replace(
22
+ regex,
23
+ `import com.reactnativerowndplugin.RowndPluginPackage;\n$&`
24
+ );
25
+ }
26
+
27
+ const newConfig = {
28
+ ...actConfig,
29
+ modResults: {
30
+ ...actConfig.modResults,
31
+ contents: mainActivityString,
32
+ },
33
+ };
34
+
35
+ return newConfig;
36
+ });
37
+ };
38
+
39
+ const withRowndPlist = (config) => {
40
+ return withInfoPlist(config, async (actConfig) => {
41
+ const LSApplicationQueriesSchemes =
42
+ actConfig.modResults?.LSApplicationQueriesSchemes || [];
43
+ const additionalSchemes = ['googlegmail', 'ms-outlook', 'ymail'];
44
+ additionalSchemes.forEach((scheme) => {
45
+ if (!LSApplicationQueriesSchemes.includes(scheme)) {
46
+ LSApplicationQueriesSchemes.push(scheme);
47
+ }
48
+ });
49
+
50
+ return {
51
+ ...actConfig,
52
+ modResults: {
53
+ ...actConfig?.modResults,
54
+ LSApplicationQueriesSchemes,
55
+ },
56
+ };
57
+ });
58
+ };
59
+
60
+ module.exports.withRowndSDK = (config) =>
61
+ withRowndMainActivity(withRowndPlist(config));
@@ -0,0 +1,283 @@
1
+ // !$*UTF8*$!
2
+ {
3
+ archiveVersion = 1;
4
+ classes = {
5
+ };
6
+ objectVersion = 46;
7
+ objects = {
8
+
9
+ /* Begin PBXBuildFile section */
10
+ 5E555C0D2413F4C50049A1A2 /* ReactNative.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* ReactNative.m */; };
11
+ F4FF95D7245B92E800C19C63 /* ReactNative.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* ReactNative.swift */; };
12
+ /* End PBXBuildFile section */
13
+
14
+ /* Begin PBXCopyFilesBuildPhase section */
15
+ 58B511D91A9E6C8500147676 /* CopyFiles */ = {
16
+ isa = PBXCopyFilesBuildPhase;
17
+ buildActionMask = 2147483647;
18
+ dstPath = "include/$(PRODUCT_NAME)";
19
+ dstSubfolderSpec = 16;
20
+ files = (
21
+ );
22
+ runOnlyForDeploymentPostprocessing = 0;
23
+ };
24
+ /* End PBXCopyFilesBuildPhase section */
25
+
26
+ /* Begin PBXFileReference section */
27
+ 134814201AA4EA6300B7C361 /* libReactNative.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReactNative.a; sourceTree = BUILT_PRODUCTS_DIR; };
28
+ B3E7B5891CC2AC0600A0062D /* ReactNative.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReactNative.m; sourceTree = "<group>"; };
29
+ F4FF95D5245B92E700C19C63 /* ReactNative-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ReactNative-Bridging-Header.h"; sourceTree = "<group>"; };
30
+ F4FF95D6245B92E800C19C63 /* ReactNative.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReactNative.swift; sourceTree = "<group>"; };
31
+ /* End PBXFileReference section */
32
+
33
+ /* Begin PBXFrameworksBuildPhase section */
34
+ 58B511D81A9E6C8500147676 /* Frameworks */ = {
35
+ isa = PBXFrameworksBuildPhase;
36
+ buildActionMask = 2147483647;
37
+ files = (
38
+ );
39
+ runOnlyForDeploymentPostprocessing = 0;
40
+ };
41
+ /* End PBXFrameworksBuildPhase section */
42
+
43
+ /* Begin PBXGroup section */
44
+ 134814211AA4EA7D00B7C361 /* Products */ = {
45
+ isa = PBXGroup;
46
+ children = (
47
+ 134814201AA4EA6300B7C361 /* libReactNative.a */,
48
+ );
49
+ name = Products;
50
+ sourceTree = "<group>";
51
+ };
52
+ 58B511D21A9E6C8500147676 = {
53
+ isa = PBXGroup;
54
+ children = (
55
+ F4FF95D6245B92E800C19C63 /* ReactNative.swift */,
56
+ B3E7B5891CC2AC0600A0062D /* ReactNative.m */,
57
+ F4FF95D5245B92E700C19C63 /* ReactNative-Bridging-Header.h */,
58
+ 134814211AA4EA7D00B7C361 /* Products */,
59
+ );
60
+ sourceTree = "<group>";
61
+ };
62
+ /* End PBXGroup section */
63
+
64
+ /* Begin PBXNativeTarget section */
65
+ 58B511DA1A9E6C8500147676 /* ReactNative */ = {
66
+ isa = PBXNativeTarget;
67
+ buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ReactNative" */;
68
+ buildPhases = (
69
+ 58B511D71A9E6C8500147676 /* Sources */,
70
+ 58B511D81A9E6C8500147676 /* Frameworks */,
71
+ 58B511D91A9E6C8500147676 /* CopyFiles */,
72
+ );
73
+ buildRules = (
74
+ );
75
+ dependencies = (
76
+ );
77
+ name = ReactNative;
78
+ productName = RCTDataManager;
79
+ productReference = 134814201AA4EA6300B7C361 /* libReactNative.a */;
80
+ productType = "com.apple.product-type.library.static";
81
+ };
82
+ /* End PBXNativeTarget section */
83
+
84
+ /* Begin PBXProject section */
85
+ 58B511D31A9E6C8500147676 /* Project object */ = {
86
+ isa = PBXProject;
87
+ attributes = {
88
+ LastUpgradeCheck = 0920;
89
+ ORGANIZATIONNAME = Facebook;
90
+ TargetAttributes = {
91
+ 58B511DA1A9E6C8500147676 = {
92
+ CreatedOnToolsVersion = 6.1.1;
93
+ };
94
+ };
95
+ };
96
+ buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "ReactNative" */;
97
+ compatibilityVersion = "Xcode 3.2";
98
+ developmentRegion = English;
99
+ hasScannedForEncodings = 0;
100
+ knownRegions = (
101
+ English,
102
+ en,
103
+ );
104
+ mainGroup = 58B511D21A9E6C8500147676;
105
+ productRefGroup = 58B511D21A9E6C8500147676;
106
+ projectDirPath = "";
107
+ projectRoot = "";
108
+ targets = (
109
+ 58B511DA1A9E6C8500147676 /* ReactNative */,
110
+ );
111
+ };
112
+ /* End PBXProject section */
113
+
114
+ /* Begin PBXSourcesBuildPhase section */
115
+ 58B511D71A9E6C8500147676 /* Sources */ = {
116
+ isa = PBXSourcesBuildPhase;
117
+ buildActionMask = 2147483647;
118
+ files = (
119
+ F4FF95D7245B92E800C19C63 /* ReactNative.swift in Sources */,
120
+ B3E7B58A1CC2AC0600A0062D /* ReactNative.m in Sources */,
121
+ );
122
+ runOnlyForDeploymentPostprocessing = 0;
123
+ };
124
+ /* End PBXSourcesBuildPhase section */
125
+
126
+ /* Begin XCBuildConfiguration section */
127
+ 58B511ED1A9E6C8500147676 /* Debug */ = {
128
+ isa = XCBuildConfiguration;
129
+ buildSettings = {
130
+ ALWAYS_SEARCH_USER_PATHS = NO;
131
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
132
+ CLANG_CXX_LIBRARY = "libc++";
133
+ CLANG_ENABLE_MODULES = YES;
134
+ CLANG_ENABLE_OBJC_ARC = YES;
135
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
136
+ CLANG_WARN_BOOL_CONVERSION = YES;
137
+ CLANG_WARN_COMMA = YES;
138
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
139
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
140
+ CLANG_WARN_EMPTY_BODY = YES;
141
+ CLANG_WARN_ENUM_CONVERSION = YES;
142
+ CLANG_WARN_INFINITE_RECURSION = YES;
143
+ CLANG_WARN_INT_CONVERSION = YES;
144
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
145
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
146
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
147
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
148
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
149
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
150
+ CLANG_WARN_UNREACHABLE_CODE = YES;
151
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
152
+ COPY_PHASE_STRIP = NO;
153
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
154
+ ENABLE_TESTABILITY = YES;
155
+ "EXCLUDED_ARCHS[sdk=*]" = arm64;
156
+ GCC_C_LANGUAGE_STANDARD = gnu99;
157
+ GCC_DYNAMIC_NO_PIC = NO;
158
+ GCC_NO_COMMON_BLOCKS = YES;
159
+ GCC_OPTIMIZATION_LEVEL = 0;
160
+ GCC_PREPROCESSOR_DEFINITIONS = (
161
+ "DEBUG=1",
162
+ "$(inherited)",
163
+ );
164
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
165
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
166
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
167
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
168
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
169
+ GCC_WARN_UNUSED_FUNCTION = YES;
170
+ GCC_WARN_UNUSED_VARIABLE = YES;
171
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
172
+ MTL_ENABLE_DEBUG_INFO = YES;
173
+ ONLY_ACTIVE_ARCH = YES;
174
+ SDKROOT = iphoneos;
175
+ };
176
+ name = Debug;
177
+ };
178
+ 58B511EE1A9E6C8500147676 /* Release */ = {
179
+ isa = XCBuildConfiguration;
180
+ buildSettings = {
181
+ ALWAYS_SEARCH_USER_PATHS = NO;
182
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
183
+ CLANG_CXX_LIBRARY = "libc++";
184
+ CLANG_ENABLE_MODULES = YES;
185
+ CLANG_ENABLE_OBJC_ARC = YES;
186
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
187
+ CLANG_WARN_BOOL_CONVERSION = YES;
188
+ CLANG_WARN_COMMA = YES;
189
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
190
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
191
+ CLANG_WARN_EMPTY_BODY = YES;
192
+ CLANG_WARN_ENUM_CONVERSION = YES;
193
+ CLANG_WARN_INFINITE_RECURSION = YES;
194
+ CLANG_WARN_INT_CONVERSION = YES;
195
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
196
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
197
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
198
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
199
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
200
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
201
+ CLANG_WARN_UNREACHABLE_CODE = YES;
202
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
203
+ COPY_PHASE_STRIP = YES;
204
+ ENABLE_NS_ASSERTIONS = NO;
205
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
206
+ "EXCLUDED_ARCHS[sdk=*]" = arm64;
207
+ GCC_C_LANGUAGE_STANDARD = gnu99;
208
+ GCC_NO_COMMON_BLOCKS = YES;
209
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
210
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
211
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
212
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
213
+ GCC_WARN_UNUSED_FUNCTION = YES;
214
+ GCC_WARN_UNUSED_VARIABLE = YES;
215
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
216
+ MTL_ENABLE_DEBUG_INFO = NO;
217
+ SDKROOT = iphoneos;
218
+ VALIDATE_PRODUCT = YES;
219
+ };
220
+ name = Release;
221
+ };
222
+ 58B511F01A9E6C8500147676 /* Debug */ = {
223
+ isa = XCBuildConfiguration;
224
+ buildSettings = {
225
+ HEADER_SEARCH_PATHS = (
226
+ "$(inherited)",
227
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
228
+ "$(SRCROOT)/../../../React/**",
229
+ "$(SRCROOT)/../../react-native/React/**",
230
+ );
231
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
232
+ OTHER_LDFLAGS = "-ObjC";
233
+ PRODUCT_NAME = ReactNative;
234
+ SKIP_INSTALL = YES;
235
+ SWIFT_OBJC_BRIDGING_HEADER = "ReactNative-Bridging-Header.h";
236
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
237
+ SWIFT_VERSION = 5.0;
238
+ };
239
+ name = Debug;
240
+ };
241
+ 58B511F11A9E6C8500147676 /* Release */ = {
242
+ isa = XCBuildConfiguration;
243
+ buildSettings = {
244
+ HEADER_SEARCH_PATHS = (
245
+ "$(inherited)",
246
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
247
+ "$(SRCROOT)/../../../React/**",
248
+ "$(SRCROOT)/../../react-native/React/**",
249
+ );
250
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
251
+ OTHER_LDFLAGS = "-ObjC";
252
+ PRODUCT_NAME = ReactNative;
253
+ SKIP_INSTALL = YES;
254
+ SWIFT_OBJC_BRIDGING_HEADER = "ReactNative-Bridging-Header.h";
255
+ SWIFT_VERSION = 5.0;
256
+ };
257
+ name = Release;
258
+ };
259
+ /* End XCBuildConfiguration section */
260
+
261
+ /* Begin XCConfigurationList section */
262
+ 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "ReactNative" */ = {
263
+ isa = XCConfigurationList;
264
+ buildConfigurations = (
265
+ 58B511ED1A9E6C8500147676 /* Debug */,
266
+ 58B511EE1A9E6C8500147676 /* Release */,
267
+ );
268
+ defaultConfigurationIsVisible = 0;
269
+ defaultConfigurationName = Release;
270
+ };
271
+ 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ReactNative" */ = {
272
+ isa = XCConfigurationList;
273
+ buildConfigurations = (
274
+ 58B511F01A9E6C8500147676 /* Debug */,
275
+ 58B511F11A9E6C8500147676 /* Release */,
276
+ );
277
+ defaultConfigurationIsVisible = 0;
278
+ defaultConfigurationName = Release;
279
+ };
280
+ /* End XCConfigurationList section */
281
+ };
282
+ rootObject = 58B511D31A9E6C8500147676 /* Project object */;
283
+ }
@@ -0,0 +1,62 @@
1
+ //
2
+ // RowndHelper.swift
3
+ // rownd-react-native
4
+ //
5
+ // Created by Michael Murray on 11/4/22.
6
+ //
7
+ import Foundation
8
+ import Rownd
9
+ import Lottie
10
+
11
+ extension UIViewController {
12
+ var colorScheme: UIUserInterfaceStyle {
13
+ if #available(iOS 13.0, *) {
14
+ return self.traitCollection.userInterfaceStyle
15
+ }
16
+ else {
17
+ return UIUserInterfaceStyle.unspecified
18
+ }
19
+ }
20
+
21
+ }
22
+
23
+ class AppCustomizations : RowndCustomizations {
24
+ override var sheetBackgroundColor: UIColor {
25
+ if let color = reactNativeSheetBackgroundColor {
26
+ return color
27
+ }
28
+ switch(UIViewController().colorScheme) {
29
+ case .light, .unspecified:
30
+ return .white
31
+ case .dark:
32
+ return .systemGray6
33
+ @unknown default:
34
+ return .white
35
+ }
36
+ }
37
+ open var reactNativeSheetBackgroundColor: UIColor? = nil
38
+ }
39
+
40
+
41
+ func colorWithHexString(hexString: String, alpha:CGFloat = 1.0) -> UIColor {
42
+ // Convert hex string to an integer
43
+ let hexint = Int(intFromHexString(hexStr: hexString))
44
+ let red = CGFloat((hexint & 0xff0000) >> 16) / 255.0
45
+ let green = CGFloat((hexint & 0xff00) >> 8) / 255.0
46
+ let blue = CGFloat((hexint & 0xff) >> 0) / 255.0
47
+
48
+ // Create color object, specifying alpha as well
49
+ let color = UIColor(red: red, green: green, blue: blue, alpha: alpha)
50
+ return color
51
+ }
52
+
53
+ func intFromHexString(hexStr: String) -> UInt32 {
54
+ var hexInt: UInt32 = 0
55
+ // Create scanner
56
+ let scanner: Scanner = Scanner(string: hexStr)
57
+ // Tell scanner to skip the # character
58
+ scanner.charactersToBeSkipped = CharacterSet(charactersIn: "#")
59
+ // Scan hex value
60
+ hexInt = UInt32(bitPattern: scanner.scanInt32(representation: .hexadecimal) ?? 0)
61
+ return hexInt
62
+ }
@@ -0,0 +1,3 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTViewManager.h>
3
+