catalyst-core 0.0.3-canary.13 → 0.0.3-canary.14
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/changelog.md +4 -0
- package/dist/native/androidProject/app/build.gradle.kts +43 -1
- package/dist/native/androidProject/app/src/main/AndroidManifest.xml +7 -1
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/MainActivity.kt +0 -24
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/SplashActivity.kt +97 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/NotificationConstants.kt +27 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/NotificationUtils.kt +612 -0
- package/dist/native/androidProject/app/src/main/res/layout/activity_splash.xml +20 -0
- package/dist/native/androidProject/app/src/main/res/values/themes.xml +11 -0
- package/dist/native/androidProject/app/src/main/res/values-night/themes.xml +11 -0
- package/dist/native/androidProject/app/src/noFcm/java/io/yourname/androidproject/utils/NotificationManager.kt +158 -0
- package/dist/native/androidProject/app/src/noFcm/java/io/yourname/androidproject/utils/PushNotificationUtils.kt +94 -0
- package/dist/native/androidProject/app/src/withFcm/java/io/yourname/androidproject/utils/NotificationManager.kt +221 -0
- package/dist/native/androidProject/app/src/withFcm/java/io/yourname/androidproject/utils/PushNotificationUtils.kt +378 -0
- package/dist/native/buildAppAndroid.js +5 -12
- package/dist/native/iosnativeWebView/Package.resolved +158 -0
- package/dist/native/iosnativeWebView/Package.swift +26 -0
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/LocalNotificationHandler.swift +293 -0
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/NotificationManager.swift +272 -0
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/PushNotificationHandler.swift +199 -0
- package/dist/native/iosnativeWebView/Sources/Core/Constants/CatalystConstants.swift +113 -0
- package/dist/native/iosnativeWebView/Sources/Core/Constants/ConfigConstants.swift +22 -0
- package/dist/native/iosnativeWebView/Sources/Core/Notifications/NotificationModels.swift +156 -0
- package/dist/native/iosnativeWebView/Sources/Core/Protocols/NotificationHandlerProtocol.swift +34 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/BootTimingUtility.swift +26 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/CacheManager.swift +272 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/CameraTransportUtils.swift +363 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/DeviceInfoUtils.swift +72 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/FilePickerHandler.swift +656 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/FrameworkServerUtils.swift +821 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/ImageHandler.swift +461 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/NotificationHandlerProvider.swift +20 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/NullNotificationHandler.swift +80 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/ResourceURLProtocol.swift +146 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/URLWhitelistManager.swift +238 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/WebKitConfig.swift +12 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeCommandHandler.swift +592 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeDelegateHandler.swift +221 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeFileHandler.swift +340 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeJavaScriptInterface.swift +149 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeMessageValidator.swift +533 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/NativeBridge.swift +245 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashView.swift +95 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashViewModel.swift +86 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebView.swift +155 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewModel.swift +49 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewNavigationDelegate.swift +207 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/iosnativeWebView.entitlements +8 -0
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -141,7 +141,6 @@ dependencies {
|
|
|
141
141
|
androidTestImplementation(libs.androidx.espresso.core)
|
|
142
142
|
implementation("androidx.webkit:webkit:1.12.1")
|
|
143
143
|
implementation("org.json:json:20231013")
|
|
144
|
-
implementation("androidx.core:core-splashscreen:1.0.1")
|
|
145
144
|
|
|
146
145
|
// Ktor Server dependencies for FrameworkServer (~200KB total)
|
|
147
146
|
implementation("io.ktor:ktor-server-core:2.3.7")
|
|
@@ -258,6 +257,49 @@ tasks.register("generateWebViewConfig") {
|
|
|
258
257
|
|
|
259
258
|
extractProperties(webviewConfig)
|
|
260
259
|
|
|
260
|
+
// Extract splash screen configuration with defaults
|
|
261
|
+
if (webviewConfig.has("splashScreen")) {
|
|
262
|
+
val splashConfig = webviewConfig.getJSONObject("splashScreen")
|
|
263
|
+
properties.setProperty("splashScreen.enabled", "true")
|
|
264
|
+
|
|
265
|
+
// Duration in milliseconds
|
|
266
|
+
if (splashConfig.has("duration")) {
|
|
267
|
+
properties.setProperty("splashScreen.duration", splashConfig.get("duration").toString())
|
|
268
|
+
} else {
|
|
269
|
+
properties.setProperty("splashScreen.duration", "1000")
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Background color
|
|
273
|
+
if (splashConfig.has("backgroundColor")) {
|
|
274
|
+
properties.setProperty("splashScreen.backgroundColor", splashConfig.getString("backgroundColor"))
|
|
275
|
+
} else {
|
|
276
|
+
properties.setProperty("splashScreen.backgroundColor", "#ffffff")
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Image dimensions
|
|
280
|
+
if (splashConfig.has("imageWidth")) {
|
|
281
|
+
properties.setProperty("splashScreen.imageWidth", splashConfig.get("imageWidth").toString())
|
|
282
|
+
} else {
|
|
283
|
+
properties.setProperty("splashScreen.imageWidth", "120")
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (splashConfig.has("imageHeight")) {
|
|
287
|
+
properties.setProperty("splashScreen.imageHeight", splashConfig.get("imageHeight").toString())
|
|
288
|
+
} else {
|
|
289
|
+
properties.setProperty("splashScreen.imageHeight", "120")
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Corner radius
|
|
293
|
+
if (splashConfig.has("cornerRadius")) {
|
|
294
|
+
properties.setProperty("splashScreen.cornerRadius", splashConfig.get("cornerRadius").toString())
|
|
295
|
+
} else {
|
|
296
|
+
properties.setProperty("splashScreen.cornerRadius", "20")
|
|
297
|
+
}
|
|
298
|
+
} else {
|
|
299
|
+
// No splash screen configuration, disable it
|
|
300
|
+
properties.setProperty("splashScreen.enabled", "false")
|
|
301
|
+
}
|
|
302
|
+
|
|
261
303
|
// Set production-specific properties for release builds
|
|
262
304
|
if (gradle.startParameter.taskNames.any { it.contains("Release") || it.contains("release") }) {
|
|
263
305
|
properties.setProperty("PRODUCTION_URL", "https://yourwebapp.com") // Replace with your domain
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
android:usesCleartextTraffic="${allowCleartextTraffic}"
|
|
25
25
|
tools:targetApi="31">
|
|
26
26
|
<activity
|
|
27
|
-
android:name="io.yourname.androidproject.
|
|
27
|
+
android:name="io.yourname.androidproject.SplashActivity"
|
|
28
28
|
android:exported="true"
|
|
29
|
+
android:theme="@style/Theme.AndroidProject.Splash"
|
|
29
30
|
android:screenOrientation="portrait">
|
|
30
31
|
<intent-filter>
|
|
31
32
|
<action android:name="android.intent.action.MAIN" />
|
|
@@ -33,6 +34,11 @@
|
|
|
33
34
|
<category android:name="android.intent.category.LAUNCHER" />
|
|
34
35
|
</intent-filter>
|
|
35
36
|
</activity>
|
|
37
|
+
<activity
|
|
38
|
+
android:name="io.yourname.androidproject.MainActivity"
|
|
39
|
+
android:exported="false"
|
|
40
|
+
android:screenOrientation="portrait">
|
|
41
|
+
</activity>
|
|
36
42
|
<provider
|
|
37
43
|
android:name="androidx.core.content.FileProvider"
|
|
38
44
|
android:authorities="io.yourname.androidproject.fileprovider"
|
package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/MainActivity.kt
CHANGED
|
@@ -12,7 +12,6 @@ import io.yourname.androidproject.utils.KeyboardUtil
|
|
|
12
12
|
import kotlinx.coroutines.CoroutineScope
|
|
13
13
|
import kotlinx.coroutines.MainScope
|
|
14
14
|
import kotlinx.coroutines.cancelChildren
|
|
15
|
-
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
|
16
15
|
|
|
17
16
|
class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
|
|
18
17
|
|
|
@@ -25,7 +24,6 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
|
|
|
25
24
|
private lateinit var keyboardUtil: KeyboardUtil
|
|
26
25
|
private var isHardwareAccelerationEnabled = false
|
|
27
26
|
private var currentUrl: String = ""
|
|
28
|
-
private var splashStartTime: Long = 0
|
|
29
27
|
|
|
30
28
|
private fun enableHardwareAcceleration() {
|
|
31
29
|
if (!isHardwareAccelerationEnabled) {
|
|
@@ -51,7 +49,6 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
|
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
54
|
-
val splashScreen = installSplashScreen()
|
|
55
52
|
super.onCreate(savedInstanceState)
|
|
56
53
|
if (BuildConfig.DEBUG) {
|
|
57
54
|
Log.d(TAG, "📱 onCreate started on thread: ${Thread.currentThread().name}")
|
|
@@ -73,10 +70,6 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
|
|
|
73
70
|
// Initialize MetricsMonitor
|
|
74
71
|
metricsMonitor = MetricsMonitor.getInstance(this)
|
|
75
72
|
|
|
76
|
-
// Configure splash screen
|
|
77
|
-
splashStartTime = System.currentTimeMillis()
|
|
78
|
-
configureSplashScreen(splashScreen)
|
|
79
|
-
|
|
80
73
|
// Setup UI
|
|
81
74
|
binding = ActivityMainBinding.inflate(layoutInflater)
|
|
82
75
|
supportActionBar?.hide()
|
|
@@ -204,21 +197,4 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
|
|
|
204
197
|
customWebView.destroy()
|
|
205
198
|
super.onDestroy()
|
|
206
199
|
}
|
|
207
|
-
|
|
208
|
-
private fun configureSplashScreen(splashScreen: androidx.core.splashscreen.SplashScreen) {
|
|
209
|
-
val durationProperty = properties.getProperty("splashScreen.duration")
|
|
210
|
-
|
|
211
|
-
splashScreen.setKeepOnScreenCondition {
|
|
212
|
-
val webViewLoaded = ::customWebView.isInitialized &&
|
|
213
|
-
customWebView.getWebView().progress >= 100
|
|
214
|
-
|
|
215
|
-
if (durationProperty != null) {
|
|
216
|
-
val duration = durationProperty.toLong()
|
|
217
|
-
val timeElapsed = System.currentTimeMillis() - splashStartTime >= duration
|
|
218
|
-
!timeElapsed
|
|
219
|
-
} else {
|
|
220
|
-
!webViewLoaded
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
200
|
}
|
package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/SplashActivity.kt
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
package io.yourname.androidproject
|
|
2
|
+
|
|
3
|
+
import android.content.Intent
|
|
4
|
+
import android.graphics.Color
|
|
5
|
+
import android.os.Bundle
|
|
6
|
+
import android.os.Handler
|
|
7
|
+
import android.os.Looper
|
|
8
|
+
import android.util.TypedValue
|
|
9
|
+
import androidx.appcompat.app.AppCompatActivity
|
|
10
|
+
import androidx.core.content.ContextCompat
|
|
11
|
+
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory
|
|
12
|
+
import androidx.core.graphics.drawable.toBitmap
|
|
13
|
+
import io.yourname.androidproject.databinding.ActivitySplashBinding
|
|
14
|
+
import java.util.Properties
|
|
15
|
+
|
|
16
|
+
class SplashActivity : AppCompatActivity() {
|
|
17
|
+
|
|
18
|
+
private lateinit var binding: ActivitySplashBinding
|
|
19
|
+
private lateinit var properties: Properties
|
|
20
|
+
private var isFinishing = false
|
|
21
|
+
|
|
22
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
23
|
+
super.onCreate(savedInstanceState)
|
|
24
|
+
|
|
25
|
+
properties = Properties()
|
|
26
|
+
try {
|
|
27
|
+
assets.open("webview_config.properties").use { properties.load(it) }
|
|
28
|
+
} catch (e: Exception) {
|
|
29
|
+
startMainActivity()
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!properties.getProperty("splashScreen.enabled", "false").toBoolean()) {
|
|
34
|
+
startMainActivity()
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
binding = ActivitySplashBinding.inflate(layoutInflater)
|
|
39
|
+
setContentView(binding.root)
|
|
40
|
+
|
|
41
|
+
configureSplashScreen()
|
|
42
|
+
startSplashTimer()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private fun configureSplashScreen() {
|
|
46
|
+
val backgroundColor = properties.getProperty("splashScreen.backgroundColor", "#ffffff")
|
|
47
|
+
val imageWidth = properties.getProperty("splashScreen.imageWidth", "120").toIntOrNull() ?: 120
|
|
48
|
+
val imageHeight = properties.getProperty("splashScreen.imageHeight", "120").toIntOrNull() ?: 120
|
|
49
|
+
val cornerRadius = properties.getProperty("splashScreen.cornerRadius", "20").toFloatOrNull() ?: 20f
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
binding.splashContainer.setBackgroundColor(Color.parseColor(backgroundColor))
|
|
53
|
+
} catch (e: Exception) {
|
|
54
|
+
binding.splashContainer.setBackgroundColor(Color.WHITE)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
val widthPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, imageWidth.toFloat(), resources.displayMetrics).toInt()
|
|
58
|
+
val heightPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, imageHeight.toFloat(), resources.displayMetrics).toInt()
|
|
59
|
+
|
|
60
|
+
binding.splashImage.layoutParams.apply {
|
|
61
|
+
width = widthPx
|
|
62
|
+
height = heightPx
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
val drawable = ContextCompat.getDrawable(this,
|
|
66
|
+
resources.getIdentifier("splashscreen", "drawable", packageName).takeIf { it != 0 }
|
|
67
|
+
?: R.mipmap.ic_launcher
|
|
68
|
+
) ?: return
|
|
69
|
+
|
|
70
|
+
if (cornerRadius > 0) {
|
|
71
|
+
val radiusPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, cornerRadius, resources.displayMetrics)
|
|
72
|
+
val roundedDrawable = RoundedBitmapDrawableFactory.create(resources, drawable.toBitmap(widthPx, heightPx))
|
|
73
|
+
roundedDrawable.cornerRadius = radiusPx
|
|
74
|
+
binding.splashImage.setImageDrawable(roundedDrawable)
|
|
75
|
+
} else {
|
|
76
|
+
binding.splashImage.setImageDrawable(drawable)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private fun startSplashTimer() {
|
|
81
|
+
val duration = properties.getProperty("splashScreen.duration")?.toLongOrNull() ?: 1000
|
|
82
|
+
Handler(Looper.getMainLooper()).postDelayed({ dismissSplash() }, duration)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private fun dismissSplash() {
|
|
86
|
+
if (isFinishing) return
|
|
87
|
+
isFinishing = true
|
|
88
|
+
startActivity(Intent(this, MainActivity::class.java))
|
|
89
|
+
finish()
|
|
90
|
+
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private fun startMainActivity() {
|
|
94
|
+
startActivity(Intent(this, MainActivity::class.java))
|
|
95
|
+
finish()
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
package io.yourname.androidproject.utils
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Constants for notification channels
|
|
5
|
+
*/
|
|
6
|
+
object NotificationConstants {
|
|
7
|
+
// Channel IDs
|
|
8
|
+
const val DEFAULT_CHANNEL_ID = "default"
|
|
9
|
+
const val URGENT_CHANNEL_ID = "urgent"
|
|
10
|
+
|
|
11
|
+
// Channel names
|
|
12
|
+
const val DEFAULT_CHANNEL_NAME = "Notifications"
|
|
13
|
+
const val URGENT_CHANNEL_NAME = "Urgent Notifications"
|
|
14
|
+
|
|
15
|
+
// Channel descriptions
|
|
16
|
+
const val DEFAULT_CHANNEL_DESCRIPTION = "General notifications"
|
|
17
|
+
const val URGENT_CHANNEL_DESCRIPTION = "Urgent notifications that require immediate attention"
|
|
18
|
+
|
|
19
|
+
// Default notification messages
|
|
20
|
+
const val DEFAULT_NOTIFICATION_TITLE = "Notification"
|
|
21
|
+
const val DEFAULT_NOTIFICATION_BODY = "You have a new message"
|
|
22
|
+
|
|
23
|
+
// Intent extras
|
|
24
|
+
const val EXTRA_IS_NOTIFICATION = "is_notification"
|
|
25
|
+
const val EXTRA_ACTION = "action"
|
|
26
|
+
const val EXTRA_NOTIFICATION_DATA = "notification_data"
|
|
27
|
+
}
|