catalyst-core 0.0.3-canary.8 → 0.1.0-canary.1

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 (132) hide show
  1. package/README.md +0 -1
  2. package/bin/catalyst.js +28 -15
  3. package/changelog.md +102 -27
  4. package/dist/native/androidProject/app/build.gradle.kts +91 -11
  5. package/dist/native/androidProject/app/proguard-rules.pro +60 -14
  6. package/dist/native/androidProject/app/src/debug/res/xml/network_security_config.xml +8 -0
  7. package/dist/native/androidProject/app/src/main/AndroidManifest.xml +9 -2
  8. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/BridgeMessageValidator.kt +560 -0
  9. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/CatalystConstants.kt +106 -0
  10. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/CustomWebview.kt +593 -110
  11. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/MainActivity.kt +378 -47
  12. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/MetricsMonitor.kt +341 -0
  13. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/NativeBridge.kt +656 -70
  14. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/SplashActivity.kt +111 -0
  15. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/Utils.kt +73 -8
  16. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/WebCacheManager.kt +69 -8
  17. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/BridgeUtils.kt +33 -11
  18. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/DeviceInfoUtils.kt +73 -0
  19. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/DownloadUtils.kt +35 -14
  20. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/FileUtils.kt +3 -2
  21. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/FrameworkServerUtils.kt +57 -8
  22. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/IntentUtils.kt +31 -6
  23. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/KeyboardUtil.kt +82 -0
  24. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/NetworkUtils.kt +105 -0
  25. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/NotificationConstants.kt +28 -0
  26. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/NotificationUtils.kt +639 -0
  27. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/SafeAreaUtils.kt +62 -0
  28. package/dist/native/androidProject/app/src/main/res/drawable/splashscreen_fallback.png +0 -0
  29. package/dist/native/androidProject/app/src/main/res/layout/activity_main.xml +1 -0
  30. package/dist/native/androidProject/app/src/main/res/layout/activity_splash.xml +20 -0
  31. package/dist/native/androidProject/app/src/main/res/values/strings.xml +1 -1
  32. package/dist/native/androidProject/app/src/main/res/values/themes.xml +11 -0
  33. package/dist/native/androidProject/app/src/main/res/values-night/themes.xml +11 -0
  34. package/dist/native/androidProject/app/src/main/res/xml/network_security_config.xml +12 -0
  35. package/dist/native/androidProject/app/src/noFcm/java/io/yourname/androidproject/utils/NotificationManager.kt +166 -0
  36. package/dist/native/androidProject/app/src/noFcm/java/io/yourname/androidproject/utils/PushNotificationUtils.kt +94 -0
  37. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/BridgeMessageValidatorTest.kt +267 -0
  38. package/dist/native/androidProject/app/src/withFcm/java/io/yourname/androidproject/utils/NotificationManager.kt +224 -0
  39. package/dist/native/androidProject/app/src/withFcm/java/io/yourname/androidproject/utils/PushNotificationUtils.kt +399 -0
  40. package/dist/native/androidProject/build.gradle.kts +6 -0
  41. package/dist/native/androidProject/gradle/libs.versions.toml +3 -1
  42. package/dist/native/androidProject/settings.gradle.kts +1 -1
  43. package/dist/native/androidSetup.js +4 -3
  44. package/dist/native/assets/catalyst.png +0 -0
  45. package/dist/native/bridge/WebBridge.js +20 -3
  46. package/dist/native/bridge/constants/NativeInterfaces.js +23 -8
  47. package/dist/native/bridge/hooks.js +46 -16
  48. package/dist/native/bridge/safeArea.js +5 -0
  49. package/dist/native/bridge/standardizedHooks.js +23 -5
  50. package/dist/native/bridge/useBaseHook.js +1 -2
  51. package/dist/native/bridge/utils/CameraUtils.js +58 -0
  52. package/dist/native/bridge/utils/FileObjectConverter.js +40 -0
  53. package/dist/native/bridge/utils/NativeBridge.js +43 -4
  54. package/dist/native/buildAppAndroid.js +112 -41
  55. package/dist/native/buildAppIos.js +288 -26
  56. package/dist/native/iosnativeWebView/Configurations/Debug.xcconfig +21 -0
  57. package/dist/native/iosnativeWebView/Configurations/Release.xcconfig +24 -0
  58. package/dist/native/iosnativeWebView/Configurations/Shared.xcconfig +55 -0
  59. package/dist/native/iosnativeWebView/Package.resolved +158 -0
  60. package/dist/native/iosnativeWebView/Package.swift +26 -0
  61. package/dist/native/iosnativeWebView/Sources/CatalystNotifications/LocalNotificationHandler.swift +293 -0
  62. package/dist/native/iosnativeWebView/Sources/CatalystNotifications/NotificationManager.swift +299 -0
  63. package/dist/native/iosnativeWebView/Sources/CatalystNotifications/PushNotificationHandler.swift +199 -0
  64. package/dist/native/iosnativeWebView/Sources/Core/Constants/CatalystConstants.swift +115 -0
  65. package/dist/native/iosnativeWebView/Sources/Core/Constants/ConfigConstants.swift +28 -0
  66. package/dist/native/iosnativeWebView/Sources/Core/Notifications/NotificationModels.swift +156 -0
  67. package/dist/native/iosnativeWebView/Sources/Core/Protocols/NotificationHandlerProtocol.swift +35 -0
  68. package/dist/native/iosnativeWebView/Sources/Core/Utils/BootTimingUtility.swift +26 -0
  69. package/dist/native/iosnativeWebView/{iosnativeWebView → Sources/Core/Utils}/CacheManager.swift +59 -37
  70. package/dist/native/iosnativeWebView/Sources/Core/Utils/CameraTransportUtils.swift +363 -0
  71. package/dist/native/iosnativeWebView/Sources/Core/Utils/DeviceInfoUtils.swift +67 -0
  72. package/dist/native/iosnativeWebView/Sources/Core/Utils/FilePickerHandler.swift +1053 -0
  73. package/dist/native/iosnativeWebView/Sources/Core/Utils/FrameworkServerUtils.swift +901 -0
  74. package/dist/native/iosnativeWebView/{iosnativeWebView → Sources/Core/Utils}/ImageHandler.swift +206 -20
  75. package/dist/native/iosnativeWebView/Sources/Core/Utils/NetworkMonitor.swift +112 -0
  76. package/dist/native/iosnativeWebView/Sources/Core/Utils/NotificationHandlerProvider.swift +20 -0
  77. package/dist/native/iosnativeWebView/Sources/Core/Utils/NullNotificationHandler.swift +85 -0
  78. package/dist/native/iosnativeWebView/{iosnativeWebView → Sources/Core/Utils}/ResourceURLProtocol.swift +60 -25
  79. package/dist/native/iosnativeWebView/Sources/Core/Utils/SafeAreaUtils.swift +132 -0
  80. package/dist/native/iosnativeWebView/Sources/Core/Utils/URLWhitelistManager.swift +238 -0
  81. package/dist/native/iosnativeWebView/Sources/Core/Utils/WebKitConfig.swift +43 -0
  82. package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeCommandHandler.swift +644 -0
  83. package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeDelegateHandler.swift +166 -0
  84. package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeFileHandler.swift +340 -0
  85. package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeJavaScriptInterface.swift +149 -0
  86. package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeMessageValidator.swift +593 -0
  87. package/dist/native/iosnativeWebView/Sources/Core/WebView/NativeBridge.swift +326 -0
  88. package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashView.swift +95 -0
  89. package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashViewModel.swift +86 -0
  90. package/dist/native/iosnativeWebView/Sources/Core/WebView/WebView.swift +181 -0
  91. package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewModel.swift +182 -0
  92. package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewNavigationDelegate.swift +395 -0
  93. package/dist/native/iosnativeWebView/iosnativeWebView/AppDelegate.swift +71 -0
  94. package/dist/native/iosnativeWebView/iosnativeWebView/Assets.xcassets/AccentColor.colorset/Contents.json +8 -8
  95. package/dist/native/iosnativeWebView/iosnativeWebView/Assets.xcassets/AppIcon.appiconset/Contents.json +10 -10
  96. package/dist/native/iosnativeWebView/iosnativeWebView/Assets.xcassets/Contents.json +4 -4
  97. package/dist/native/iosnativeWebView/iosnativeWebView/ContentView.swift +65 -10
  98. package/dist/native/iosnativeWebView/iosnativeWebView/Info-Release.plist +21 -0
  99. package/dist/native/iosnativeWebView/iosnativeWebView/Info.plist +13 -0
  100. package/dist/native/iosnativeWebView/iosnativeWebView/Preview Content/Preview Assets.xcassets/Contents.json +4 -4
  101. package/dist/native/iosnativeWebView/iosnativeWebView/iosnativeWebView.entitlements +8 -0
  102. package/dist/native/iosnativeWebView/iosnativeWebView/iosnativeWebViewApp.swift +70 -0
  103. package/dist/native/iosnativeWebView/iosnativeWebView/localhost.p12 +0 -0
  104. package/dist/native/iosnativeWebView/iosnativeWebView.xcodeproj/project.pbxproj +57 -108
  105. package/dist/native/iosnativeWebView/iosnativeWebView.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +159 -0
  106. package/dist/native/renameAndroidProject.js +80 -70
  107. package/dist/native/setupEmulatorIos.js +22 -5
  108. package/dist/native/setupServer.js +11 -10
  109. package/dist/native/terminalProgress.js +10 -10
  110. package/dist/native/utils.js +4 -5
  111. package/dist/otel.js +4 -0
  112. package/dist/scripts/build.js +2 -2
  113. package/dist/scripts/devBuild.js +2 -2
  114. package/dist/scripts/scriptUtils.js +2 -2
  115. package/dist/sentry.js +4 -1
  116. package/dist/server/renderer/document/Body.js +4 -4
  117. package/dist/server/renderer/handler.js +7 -5
  118. package/dist/webpack/development.client.babel.js +1 -1
  119. package/package.json +5 -3
  120. package/dist/native/androidProject/.idea/.name +0 -1
  121. package/dist/native/androidProject/.idea/AndroidProjectSystem.xml +0 -6
  122. package/dist/native/androidProject/.idea/compiler.xml +0 -6
  123. package/dist/native/androidProject/.idea/deploymentTargetSelector.xml +0 -10
  124. package/dist/native/androidProject/.idea/gradle.xml +0 -19
  125. package/dist/native/androidProject/.idea/migrations.xml +0 -10
  126. package/dist/native/androidProject/.idea/misc.xml +0 -5
  127. package/dist/native/androidProject/.idea/runConfigurations.xml +0 -17
  128. package/dist/native/androidProject/.idea/vcs.xml +0 -6
  129. package/dist/native/iosnativeWebView/iosnativeWebView/NativeBridge.swift +0 -217
  130. package/dist/native/iosnativeWebView/iosnativeWebView/WebView.swift +0 -96
  131. package/dist/native/iosnativeWebView/iosnativeWebView/WebViewModel.swift +0 -47
  132. package/dist/native/iosnativeWebView/iosnativeWebView/WebViewNavigationDelegate.swift +0 -140
package/README.md CHANGED
@@ -16,7 +16,6 @@ Catalyst offers a comprehensive suite of features designed for modern web develo
16
16
 
17
17
  This version adds support for Universal app for both Android and iOS. Please checkout [Universal App Documentaion](https://catalyst.1mg.com/public_docs/content/Universal%20App/RunUniversalApp)
18
18
 
19
-
20
19
  ## Installation
21
20
 
22
21
  **System Requirements**
package/bin/catalyst.js CHANGED
@@ -8,9 +8,17 @@ const args = process.argv.slice(2)
8
8
 
9
9
  // Array of valid commands
10
10
  const validCommands = [
11
- "build", "start", "serve", "devBuild", "devServe",
12
- "buildApp", "buildApp:ios", "buildApp:android",
13
- "setupEmulator", "setupEmulator:ios", "setupEmulator:android"
11
+ "build",
12
+ "start",
13
+ "serve",
14
+ "devBuild",
15
+ "devServe",
16
+ "buildApp",
17
+ "buildApp:ios",
18
+ "buildApp:android",
19
+ "setupEmulator",
20
+ "setupEmulator:ios",
21
+ "setupEmulator:android",
14
22
  ]
15
23
 
16
24
  // Map of platform-specific commands to their script paths
@@ -18,17 +26,16 @@ const platformScripts = {
18
26
  "setupEmulator:ios": "../dist/native/setupEmulatorIos.js",
19
27
  "setupEmulator:android": "../dist/native/androidSetup.js",
20
28
  "buildApp:ios": "../dist/native/buildAppIos.js",
21
- "buildApp:android": "../dist/native/buildAppAndroid.js"
29
+ "buildApp:android": "../dist/native/buildAppAndroid.js",
22
30
  }
23
31
 
24
32
  // Helper to check if arg is a platform command
25
33
  const isPlatformCommand = (arg, prefix) => {
26
34
  if (!arg.startsWith(`${prefix}:`)) return false
27
- const platform = arg.split(':')[1]
28
- return ['ios', 'android'].includes(platform) || platform === undefined
35
+ const platform = arg.split(":")[1]
36
+ return ["ios", "android"].includes(platform) || platform === undefined
29
37
  }
30
38
 
31
-
32
39
  // Helper function to run a platform command
33
40
  const runPlatformCommand = (baseCommand, platform) => {
34
41
  const command = `${baseCommand}:${platform}`
@@ -42,7 +49,7 @@ const runPlatformCommand = (baseCommand, platform) => {
42
49
 
43
50
  // Helper function to run commands for all platforms
44
51
  const runAllPlatforms = (baseCommand) => {
45
- const platforms = ['ios', 'android']
52
+ const platforms = ["ios", "android"]
46
53
  for (const platform of platforms) {
47
54
  const result = runPlatformCommand(baseCommand, platform)
48
55
  if (result.status !== 0) {
@@ -54,8 +61,14 @@ const runAllPlatforms = (baseCommand) => {
54
61
  }
55
62
 
56
63
  const scriptIndex = args.findIndex(
57
- (x) => x === "build" || x === "start" || x === "serve" || x === "devBuild" || x === "devServe" ||
58
- isPlatformCommand(x, 'buildApp') || isPlatformCommand(x, 'setupEmulator')
64
+ (x) =>
65
+ x === "build" ||
66
+ x === "start" ||
67
+ x === "serve" ||
68
+ x === "devBuild" ||
69
+ x === "devServe" ||
70
+ isPlatformCommand(x, "buildApp") ||
71
+ isPlatformCommand(x, "setupEmulator")
59
72
  )
60
73
  const script = scriptIndex === -1 ? args[0] : args[scriptIndex]
61
74
  const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : []
@@ -92,17 +105,17 @@ function handleProcessResult(result) {
92
105
  if (result.signal === "SIGKILL") {
93
106
  console.log(
94
107
  "The build failed because the process exited too early. " +
95
- "This probably means the system ran out of memory or someone called " +
96
- "`kill -9` on the process."
108
+ "This probably means the system ran out of memory or someone called " +
109
+ "`kill -9` on the process."
97
110
  )
98
111
  } else if (result.signal === "SIGTERM") {
99
112
  console.log(
100
113
  "The build failed because the process exited too early. " +
101
- "Someone might have called `kill` or `killall`, or the system could " +
102
- "be shutting down."
114
+ "Someone might have called `kill` or `killall`, or the system could " +
115
+ "be shutting down."
103
116
  )
104
117
  }
105
118
  process.exit(1)
106
119
  }
107
120
  process.exit(result.status)
108
- }
121
+ }
package/changelog.md CHANGED
@@ -1,40 +1,115 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.0-canary.1] - 2026-01-12
4
+
5
+ - Universal Merge
6
+
7
+ ## [0.0.3-canary.20] - 2025-12-12
8
+
9
+ - Patch: Allow localhost traffic to be served from http
10
+
11
+ ## [0.0.3-canary.19] - 2025-12-09
12
+
13
+ - Offline fallback support: packages `public/offline.html` into Android/iOS bundles and shows it automatically when connectivity drops (with retry handling)
14
+ - Notification refactor: streamlined config toggle for local vs push, centralized permission/asset handling, and simpler routing into the web app
15
+ - Access control: combined access control config for ios
16
+
17
+ ## [0.0.3-canary.18] - 2025-11-19
18
+
19
+ - Configuration Files
20
+ - Android Native WebView - MainActivity.kt
21
+ - Android Native WebView - CustomWebview.kt
22
+
23
+ ## [0.0.3-canary.17] - 2025-11-19
24
+
25
+ - ✨ Added complete notification system (local & push)
26
+ - 🔔 New useNotification() React hook
27
+ - 📱 Firebase Cloud Messaging conditional build support
28
+ - 🤖 Android notification handling in MainActivity
29
+ - 🔧 5 new notification commands + 5 callbacks in NativeBridge
30
+ - 📦 Auto-processing of notification icons & sounds
31
+ - ⚙️ Conditional dependencies based on notification config
32
+ - 🧹 Updated .gitignore & .npmignore
33
+ - 📋 Enhanced build process with automatic permission injection
34
+ - 🔗 Deep link integration with notifications
35
+
36
+ ## [0.0.3-canary.16] - 2025-11-19
37
+
38
+ - FeaturesGallery Support for File Picker: Enhanced file picker to open native gallery for selecting images and videos
39
+ - HTTPS Framework Server: Enabled HTTPS support for the framework server with self-signed SSL certificate
40
+ - MIME Type Handling: Fixed and improved MIME type detection and handling in the file picker
41
+
42
+ ## [0.0.3-canary.15] - 2025-11-19
43
+
44
+ - Adding Android release support and appInfo key
45
+
46
+ ## [0.0.3-canary.14] - 2025-09-29
47
+
48
+ - Android custom splashscreen
49
+
50
+ ## [0.0.3-canary.13] - 2025-09-28
51
+
52
+ - Multi file support in useFilePicker hook
53
+ - Android multiple app icon support
54
+ - Android whitelisting toggle support
55
+
56
+ ## [0.0.3-canary.12] - 2025-09-26
57
+
58
+ - Universal App Context: Added comprehensive context support for building universal mobile applications
59
+ - OpenTelemetry SDK Integration: Built-in support for observability and performance monitoring with Otel SDK
60
+
61
+ ## [0.0.3-canary.11] - 2025-09-26
62
+
63
+ - Build organization: Store APKs and iOS builds organized by generation date and time for better tracking and management
64
+ - Enhanced Android native support: Add support for native keyboard and webview resizing in Android
65
+ - Device info API web support: Web support in device info API
66
+
67
+ ## [0.0.3-canary.10] - 2025-09-11
68
+
69
+ - **Sentry import bug fix**
70
+ - **Open telemetry SDK**
71
+
72
+ ## [0.0.3-canary.9] - 2025-09-11
73
+
74
+ - **App name configuration**
75
+ - **Device Info API**
76
+ - **Access control configuration**
77
+
3
78
  ## [0.0.3-canary.8] - 2025-01-06
4
79
 
5
- - **App icon configuration**
6
- - **Splash screen integration**
7
- - **Url Whitelisting**
80
+ - **App icon configuration**
81
+ - **Splash screen integration**
82
+ - **Url Whitelisting**
8
83
 
9
84
  ## [0.0.3-canary.7] - 2025-01-06
10
85
 
11
86
  ### 🚀 Features
12
87
 
13
- - **Native API Integration**: Enhanced native module integration for better performance
14
- - **Automated IP Resolution**: Intelligent network detection eliminates manual IP configuration
15
- - **Universal Build System**: Streamlined one-command builds for both Android and iOS platforms
16
- - **Enhanced CLI Interface**: Improved command-line tools for better developer experience
88
+ - **Native API Integration**: Enhanced native module integration for better performance
89
+ - **Automated IP Resolution**: Intelligent network detection eliminates manual IP configuration
90
+ - **Universal Build System**: Streamlined one-command builds for both Android and iOS platforms
91
+ - **Enhanced CLI Interface**: Improved command-line tools for better developer experience
17
92
 
18
93
  ### 🐛 Bug Fixes
19
94
 
20
- - Fixed IP address detection issues on development environments
21
- - Resolved build configuration conflicts between platforms
22
- - Improved error handling and recovery mechanisms
95
+ - Fixed IP address detection issues on development environments
96
+ - Resolved build configuration conflicts between platforms
97
+ - Improved error handling and recovery mechanisms
23
98
 
24
99
  ### 🔧 Improvements
25
100
 
26
- - **Performance**: Optimized native module loading and execution
27
- - **Developer Experience**: Enhanced CLI with better error messages and debugging info
28
- - **Configuration**: Dynamic config updates without requiring restarts
29
- - **Build Process**: Faster and more reliable build pipeline
101
+ - **Performance**: Optimized native module loading and execution
102
+ - **Developer Experience**: Enhanced CLI with better error messages and debugging info
103
+ - **Configuration**: Dynamic config updates without requiring restarts
104
+ - **Build Process**: Faster and more reliable build pipeline
30
105
 
31
106
  ### 🧪 Testing & Validation
32
107
 
33
- - ✅ **Android Build**: Verified APK generation, installation, and runtime behavior
34
- - ✅ **iOS Build**: Tested build process and device compatibility
35
- - ✅ **IP Detection**: Validated automatic network resolution across platforms
36
- - ✅ **Native Modules**: Confirmed API integration and performance benchmarks
37
- - ✅ **CLI Operations**: Tested enhanced command-line workflows and error handling
108
+ - ✅ **Android Build**: Verified APK generation, installation, and runtime behavior
109
+ - ✅ **iOS Build**: Tested build process and device compatibility
110
+ - ✅ **IP Detection**: Validated automatic network resolution across platforms
111
+ - ✅ **Native Modules**: Confirmed API integration and performance benchmarks
112
+ - ✅ **CLI Operations**: Tested enhanced command-line workflows and error handling
38
113
 
39
114
  ### 🔄 Breaking Changes
40
115
 
@@ -42,17 +117,17 @@
42
117
 
43
118
  ### 📝 Technical Details
44
119
 
45
- - Improved native API bridge for better cross-platform communication
46
- - Enhanced error reporting with detailed stack traces and suggestions
47
- - Optimized build configuration for faster development cycles
48
- - Added comprehensive logging for debugging and monitoring
120
+ - Improved native API bridge for better cross-platform communication
121
+ - Enhanced error reporting with detailed stack traces and suggestions
122
+ - Optimized build configuration for faster development cycles
123
+ - Added comprehensive logging for debugging and monitoring
49
124
 
50
125
  ### 🔗 Migration Notes
51
126
 
52
- - No migration steps required
53
- - Existing projects will automatically benefit from improvements
54
- - Optional: Update CLI usage to leverage new enhanced features
127
+ - No migration steps required
128
+ - Existing projects will automatically benefit from improvements
129
+ - Optional: Update CLI usage to leverage new enhanced features
55
130
 
56
131
  ## Version
57
132
 
58
- - Target version: 0.0.3-canary.7
133
+ - Target version: 0.0.3-canary.7
@@ -15,6 +15,22 @@ val keystorePassword: String? by project.properties // Changed from keyStorePas
15
15
  val keyAlias: String? by project.properties
16
16
  val keyPassword: String? by project.properties
17
17
 
18
+ fun isNotificationsEnabled(): Boolean {
19
+ return try {
20
+ if (configPath == null) return false
21
+ val configFile = File(configPath!!)
22
+ if (!configFile.exists()) return false
23
+
24
+ val json = JSONObject(configFile.readText())
25
+ if (!json.has("WEBVIEW_CONFIG")) return false
26
+
27
+ val webviewConfig = json.getJSONObject("WEBVIEW_CONFIG")
28
+ webviewConfig.optJSONObject("notifications")?.optBoolean("enabled", false) ?: false
29
+ } catch (e: Exception) {
30
+ false
31
+ }
32
+ }
33
+
18
34
  fun getLocalIpAddress(): String {
19
35
  return NetworkInterface.getNetworkInterfaces().toList()
20
36
  .flatMap { it.inetAddresses.toList() }
@@ -61,7 +77,6 @@ android {
61
77
 
62
78
  buildTypes {
63
79
  debug {
64
- manifestPlaceholders += mapOf("allowCleartextTraffic" to true)
65
80
  applicationIdSuffix = ".debug"
66
81
  versionNameSuffix = "-debug"
67
82
  isMinifyEnabled = false
@@ -69,7 +84,6 @@ android {
69
84
  buildConfigField("String", "LOCAL_IP", "\"${getLocalIpAddress()}\"")
70
85
  }
71
86
  release {
72
- manifestPlaceholders += mapOf("allowCleartextTraffic" to false)
73
87
  isMinifyEnabled = true
74
88
  isShrinkResources = true
75
89
  proguardFiles(
@@ -129,6 +143,19 @@ android {
129
143
  checkReleaseBuilds = true
130
144
  abortOnError = true
131
145
  }
146
+
147
+ // Conditional source sets based on notifications config
148
+ sourceSets {
149
+ getByName("main") {
150
+ if (isNotificationsEnabled()) {
151
+ logger.info("SourceSet selected: withFcm (notifications enabled)")
152
+ java.srcDirs("src/withFcm/java")
153
+ } else {
154
+ logger.info("SourceSet selected: noFcm (notifications disabled)")
155
+ java.srcDirs("src/noFcm/java")
156
+ }
157
+ }
158
+ }
132
159
  }
133
160
 
134
161
  dependencies {
@@ -139,18 +166,24 @@ dependencies {
139
166
  testImplementation(libs.junit)
140
167
  androidTestImplementation(libs.androidx.junit)
141
168
  androidTestImplementation(libs.androidx.espresso.core)
142
- implementation("androidx.webkit:webkit:1.12.1")
169
+ implementation(libs.androidx.webkit)
143
170
  implementation("org.json:json:20231013")
144
- implementation("androidx.core:core-splashscreen:1.0.1")
145
171
 
146
172
  // Ktor Server dependencies for FrameworkServer (~200KB total)
147
- implementation("io.ktor:ktor-server-core:2.3.7")
148
- implementation("io.ktor:ktor-server-netty:2.3.7")
149
- implementation("io.ktor:ktor-server-content-negotiation:2.3.7")
173
+ implementation("io.ktor:ktor-server-core:3.0.3")
174
+ implementation("io.ktor:ktor-server-netty:3.0.3")
175
+ implementation("io.ktor:ktor-server-content-negotiation:3.0.3")
150
176
  implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
151
-
177
+
152
178
  // SLF4J simple logger for Ktor (optional, can be excluded if needed)
153
179
  implementation("org.slf4j:slf4j-simple:2.0.9")
180
+
181
+ // Notification dependencies - conditional based on config
182
+ if (isNotificationsEnabled()) {
183
+ implementation("androidx.localbroadcastmanager:localbroadcastmanager:1.1.0")
184
+ implementation("com.google.firebase:firebase-messaging:23.4.0")
185
+ implementation("com.google.firebase:firebase-analytics:21.5.0")
186
+ }
154
187
  }
155
188
 
156
189
  // Task to verify local IP
@@ -258,6 +291,49 @@ tasks.register("generateWebViewConfig") {
258
291
 
259
292
  extractProperties(webviewConfig)
260
293
 
294
+ // Extract splash screen configuration with defaults
295
+ if (webviewConfig.has("splashScreen")) {
296
+ val splashConfig = webviewConfig.getJSONObject("splashScreen")
297
+ properties.setProperty("splashScreen.enabled", "true")
298
+
299
+ // Duration in milliseconds
300
+ if (splashConfig.has("duration")) {
301
+ properties.setProperty("splashScreen.duration", splashConfig.get("duration").toString())
302
+ } else {
303
+ properties.setProperty("splashScreen.duration", "1000")
304
+ }
305
+
306
+ // Background color
307
+ if (splashConfig.has("backgroundColor")) {
308
+ properties.setProperty("splashScreen.backgroundColor", splashConfig.getString("backgroundColor"))
309
+ } else {
310
+ properties.setProperty("splashScreen.backgroundColor", "#ffffff")
311
+ }
312
+
313
+ // Image dimensions
314
+ if (splashConfig.has("imageWidth")) {
315
+ properties.setProperty("splashScreen.imageWidth", splashConfig.get("imageWidth").toString())
316
+ } else {
317
+ properties.setProperty("splashScreen.imageWidth", "120")
318
+ }
319
+
320
+ if (splashConfig.has("imageHeight")) {
321
+ properties.setProperty("splashScreen.imageHeight", splashConfig.get("imageHeight").toString())
322
+ } else {
323
+ properties.setProperty("splashScreen.imageHeight", "120")
324
+ }
325
+
326
+ // Corner radius
327
+ if (splashConfig.has("cornerRadius")) {
328
+ properties.setProperty("splashScreen.cornerRadius", splashConfig.get("cornerRadius").toString())
329
+ } else {
330
+ properties.setProperty("splashScreen.cornerRadius", "20")
331
+ }
332
+ } else {
333
+ // No splash screen configuration, disable it
334
+ properties.setProperty("splashScreen.enabled", "false")
335
+ }
336
+
261
337
  // Set production-specific properties for release builds
262
338
  if (gradle.startParameter.taskNames.any { it.contains("Release") || it.contains("release") }) {
263
339
  properties.setProperty("PRODUCTION_URL", "https://yourwebapp.com") // Replace with your domain
@@ -277,6 +353,10 @@ tasks.register("generateWebViewConfig") {
277
353
  }
278
354
  }
279
355
 
356
+ if (isNotificationsEnabled()) {
357
+ apply(plugin = "com.google.gms.google-services")
358
+ }
359
+
280
360
  // Task to create key store if it doesn't exist
281
361
  // Add this task to your build.gradle.kts
282
362
  tasks.register("generateKeystore") {
@@ -292,7 +372,7 @@ tasks.register("generateKeystore") {
292
372
  val keyPass = project.properties["keyPassword"] as? String ?: System.getenv("KEY_PASSWORD") ?: "android"
293
373
  val alias = project.properties["keyAlias"] as? String ?: System.getenv("KEY_ALIAS") ?: "release"
294
374
 
295
- exec {
375
+ project.exec {
296
376
  commandLine = listOf(
297
377
  "keytool",
298
378
  "-genkey",
@@ -321,7 +401,7 @@ tasks.register("createAppBundle") {
321
401
  =======================================================
322
402
  App Bundle created successfully!
323
403
 
324
- Location: ${project.buildDir}/outputs/bundle/release/app-release.aab
404
+ Location: ${layout.buildDirectory.get().asFile}/outputs/bundle/release/app-release.aab
325
405
 
326
406
  Next steps:
327
407
  1. Test your bundle with:
@@ -331,4 +411,4 @@ tasks.register("createAppBundle") {
331
411
  =======================================================
332
412
  """.trimIndent())
333
413
  }
334
- }
414
+ }
@@ -5,17 +5,63 @@
5
5
  # For more details, see
6
6
  # http://developer.android.com/guide/developing/tools/proguard.html
7
7
 
8
- # If your project uses WebView with JS, uncomment the following
9
- # and specify the fully qualified class name to the JavaScript interface
10
- # class:
11
- #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12
- # public *;
13
- #}
14
-
15
- # Uncomment this to preserve the line number information for
16
- # debugging stack traces.
17
- #-keepattributes SourceFile,LineNumberTable
18
-
19
- # If you keep the line number information, uncomment this to
20
- # hide the original source file name.
21
- #-renamesourcefileattribute SourceFile
8
+ # Keep line numbers for debugging
9
+ -keepattributes SourceFile,LineNumberTable
10
+ -renamesourcefileattribute SourceFile
11
+
12
+ # Keep JavaScript interface for WebView
13
+ -keepclassmembers class * {
14
+ @android.webkit.JavascriptInterface <methods>;
15
+ }
16
+
17
+ # Keep NativeBridge class (JavaScript interface)
18
+ -keep class io.yourname.androidproject.NativeBridge {
19
+ public *;
20
+ }
21
+
22
+ # Keep Kotlin coroutines
23
+ -keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
24
+ -keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
25
+ -dontwarn kotlinx.coroutines.**
26
+
27
+ # Keep Ktor
28
+ -keep class io.ktor.** { *; }
29
+ -keepclassmembers class io.ktor.** { volatile <fields>; }
30
+ -dontwarn io.ktor.**
31
+
32
+ # Keep Netty (used by Ktor server)
33
+ -keep class io.netty.** { *; }
34
+ -keepclassmembers class io.netty.** { *; }
35
+ -dontwarn io.netty.**
36
+
37
+ # Suppress warnings for optional Netty dependencies (not needed on Android)
38
+ -dontwarn io.netty.internal.tcnative.**
39
+ -dontwarn org.conscrypt.**
40
+ -dontwarn org.bouncycastle.**
41
+ -dontwarn org.eclipse.jetty.npn.**
42
+ -dontwarn reactor.blockhound.integration.**
43
+ -dontwarn org.apache.log4j.**
44
+ -dontwarn org.apache.logging.log4j.**
45
+
46
+ # Keep WebViewClient overrides
47
+ -keepclassmembers class * extends android.webkit.WebViewClient {
48
+ public void *(android.webkit.WebView, java.lang.String);
49
+ public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
50
+ public boolean *(android.webkit.WebView, java.lang.String);
51
+ }
52
+
53
+ # Keep WebChromeClient overrides
54
+ -keepclassmembers class * extends android.webkit.WebChromeClient {
55
+ public void *(android.webkit.WebView, java.lang.String);
56
+ }
57
+
58
+ # Keep data classes used for caching
59
+ -keep class io.yourname.androidproject.WebCacheManager$CacheEntry { *; }
60
+ -keep class io.yourname.androidproject.WebCacheManager$CacheMetadata { *; }
61
+
62
+ # Remove debug logging in release builds
63
+ -assumenosideeffects class android.util.Log {
64
+ public static *** d(...);
65
+ public static *** v(...);
66
+ public static *** i(...);
67
+ }
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <network-security-config>
3
+ <base-config cleartextTrafficPermitted="true">
4
+ <trust-anchors>
5
+ <certificates src="system" />
6
+ </trust-anchors>
7
+ </base-config>
8
+ </network-security-config>
@@ -21,11 +21,13 @@
21
21
  android:roundIcon="@mipmap/ic_launcher_round"
22
22
  android:supportsRtl="true"
23
23
  android:theme="@style/Theme.AndroidProject"
24
- android:usesCleartextTraffic="${allowCleartextTraffic}"
24
+ android:usesCleartextTraffic="true"
25
+ android:networkSecurityConfig="@xml/network_security_config"
25
26
  tools:targetApi="31">
26
27
  <activity
27
- android:name="io.yourname.androidproject.MainActivity"
28
+ android:name="io.yourname.androidproject.SplashActivity"
28
29
  android:exported="true"
30
+ android:theme="@style/Theme.AndroidProject.Splash"
29
31
  android:screenOrientation="portrait">
30
32
  <intent-filter>
31
33
  <action android:name="android.intent.action.MAIN" />
@@ -33,6 +35,11 @@
33
35
  <category android:name="android.intent.category.LAUNCHER" />
34
36
  </intent-filter>
35
37
  </activity>
38
+ <activity
39
+ android:name="io.yourname.androidproject.MainActivity"
40
+ android:exported="false"
41
+ android:screenOrientation="portrait">
42
+ </activity>
36
43
  <provider
37
44
  android:name="androidx.core.content.FileProvider"
38
45
  android:authorities="io.yourname.androidproject.fileprovider"