@thelacanians/vue-native-cli 0.4.3 → 0.4.5
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/dist/cli.js +102 -32
- package/native/android/README.md +205 -0
- package/native/android/VueNativeCore/build.gradle.kts +113 -0
- package/native/android/VueNativeCore/consumer-rules.pro +12 -0
- package/native/android/VueNativeCore/proguard-rules.pro +33 -0
- package/native/android/VueNativeCore/src/main/AndroidManifest.xml +17 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Bridge/ErrorOverlayView.kt +94 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Bridge/HotReloadManager.kt +105 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Bridge/JSPolyfills.kt +652 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Bridge/JSRuntime.kt +207 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Bridge/NativeBridge.kt +417 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/ComponentRegistry.kt +76 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VActionSheetFactory.kt +78 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VActivityIndicatorFactory.kt +46 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VAlertDialogFactory.kt +84 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VButtonFactory.kt +73 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VCheckboxFactory.kt +93 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VDropdownFactory.kt +125 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VImageFactory.kt +75 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VInputFactory.kt +210 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VKeyboardAvoidingFactory.kt +31 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VListFactory.kt +183 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VModalFactory.kt +105 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VPickerFactory.kt +57 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VPressableFactory.kt +109 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VProgressBarFactory.kt +43 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VRadioFactory.kt +103 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VRefreshControlFactory.kt +73 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VRootFactory.kt +39 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VSafeAreaFactory.kt +48 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VScrollViewFactory.kt +105 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VSectionListFactory.kt +144 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VSegmentedControlFactory.kt +77 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VSliderFactory.kt +74 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VStatusBarFactory.kt +52 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VSwitchFactory.kt +62 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VTextFactory.kt +53 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VVideoFactory.kt +191 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VViewFactory.kt +48 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/Factories/VWebViewFactory.kt +90 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/NativeComponentFactory.kt +40 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Components/VTextNodeView.kt +23 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Helpers/GestureHelper.kt +16 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Helpers/TouchableView.kt +105 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/AnimationModule.kt +292 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/AppStateModule.kt +41 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/AsyncStorageModule.kt +59 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/AudioModule.kt +331 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/BackgroundTaskModule.kt +166 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/BiometryModule.kt +56 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/BluetoothModule.kt +302 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/CalendarModule.kt +198 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/CameraModule.kt +64 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/ClipboardModule.kt +36 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/ContactsModule.kt +288 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/DatabaseModule.kt +229 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/DeviceInfoModule.kt +39 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/FileSystemModule.kt +193 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/GeolocationModule.kt +68 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/HapticsModule.kt +61 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/HttpModule.kt +111 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/IAPModule.kt +302 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/KeyboardModule.kt +26 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/LinkingModule.kt +43 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/NativeModule.kt +27 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/NativeModuleRegistry.kt +92 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/NetworkModule.kt +75 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/NotificationsModule.kt +181 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/OTAModule.kt +255 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/PerformanceModule.kt +147 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/PermissionsModule.kt +126 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/SecureStorageModule.kt +51 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/SensorsModule.kt +134 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/ShareModule.kt +36 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/SocialAuthModule.kt +163 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Modules/WebSocketModule.kt +155 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Styling/StyleEngine.kt +802 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Tags.kt +43 -0
- package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/VueNativeActivity.kt +169 -0
- package/native/android/VueNativeCore/src/main/res/values/ids.xml +8 -0
- package/native/android/app/build.gradle.kts +45 -0
- package/native/android/app/proguard-rules.pro +5 -0
- package/native/android/app/src/main/AndroidManifest.xml +25 -0
- package/native/android/app/src/main/assets/.gitkeep +0 -0
- package/native/android/app/src/main/kotlin/com/vuenative/example/counter/MainActivity.kt +14 -0
- package/native/android/app/src/main/res/layout/activity_main.xml +6 -0
- package/native/android/app/src/main/res/values/strings.xml +3 -0
- package/native/android/app/src/main/res/values/themes.xml +9 -0
- package/native/android/app/src/main/res/xml/network_security_config.xml +8 -0
- package/native/android/build.gradle.kts +6 -0
- package/native/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/native/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/native/android/gradle.properties +4 -0
- package/native/android/gradlew +87 -0
- package/native/android/gradlew.bat +48 -0
- package/native/android/settings.gradle.kts +20 -0
- package/native/ios/VueNativeCore/Package.resolved +23 -0
- package/native/ios/VueNativeCore/Package.swift +32 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Bridge/CertificatePinning.swift +136 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Bridge/ErrorOverlayView.swift +89 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Bridge/HotReloadManager.swift +147 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Bridge/JSPolyfills.swift +711 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Bridge/JSRuntime.swift +421 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Bridge/NativeBridge.swift +906 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Bridge/VueNativeViewController.swift +88 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/ComponentRegistry.swift +193 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VActionSheetFactory.swift +90 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VActivityIndicatorFactory.swift +74 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VAlertDialogFactory.swift +149 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VButtonFactory.swift +93 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VCheckboxFactory.swift +114 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VDropdownFactory.swift +112 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VImageFactory.swift +172 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VInputFactory.swift +357 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VKeyboardAvoidingFactory.swift +99 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VListFactory.swift +250 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VModalFactory.swift +109 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VPickerFactory.swift +96 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VPressableFactory.swift +168 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VProgressBarFactory.swift +39 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VRadioFactory.swift +167 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VRefreshControlFactory.swift +153 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VSafeAreaFactory.swift +56 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VScrollViewFactory.swift +240 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VSectionListFactory.swift +248 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VSegmentedControlFactory.swift +73 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VSliderFactory.swift +63 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VStatusBarFactory.swift +50 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VSwitchFactory.swift +108 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VTextFactory.swift +290 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VVideoFactory.swift +250 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VViewFactory.swift +157 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VWebViewFactory.swift +174 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/NativeComponentFactory.swift +53 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Helpers/Extensions.swift +31 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Helpers/GestureWrapper.swift +107 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Helpers/TouchableView.swift +136 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Helpers/UIColor+Hex.swift +80 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/AnimationModule.swift +283 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/AppStateModule.swift +59 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/AsyncStorageModule.swift +68 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/AudioModule.swift +371 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/BackgroundTaskModule.swift +135 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/BiometryModule.swift +61 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/BluetoothModule.swift +379 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/CalendarModule.swift +154 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/CameraModule.swift +315 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/ClipboardModule.swift +33 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/ContactsModule.swift +173 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/DatabaseModule.swift +259 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/DeviceInfoModule.swift +34 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/FileSystemModule.swift +233 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/GeolocationModule.swift +147 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/HapticsModule.swift +50 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/IAPModule.swift +194 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/KeyboardModule.swift +31 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/LinkingModule.swift +42 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/NativeModule.swift +28 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/NativeModuleRegistry.swift +78 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/NetworkModule.swift +62 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/NotificationsModule.swift +215 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/OTAModule.swift +281 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/PerformanceModule.swift +141 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/PermissionsModule.swift +190 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/SecureStorageModule.swift +118 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/SensorsModule.swift +103 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/ShareModule.swift +48 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/SocialAuthModule.swift +256 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/WebSocketModule.swift +213 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Resources/vue-native-placeholder.js +8 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Styling/StyleEngine.swift +885 -0
- package/native/ios/VueNativeCore/Tests/VueNativeCoreTests/JSRuntimeTests.swift +362 -0
- package/package.json +3 -2
package/dist/cli.js
CHANGED
|
@@ -5,9 +5,12 @@ import { program } from "commander";
|
|
|
5
5
|
|
|
6
6
|
// src/commands/create.ts
|
|
7
7
|
import { Command } from "commander";
|
|
8
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
9
|
-
import { join } from "path";
|
|
8
|
+
import { cp, mkdir, writeFile } from "fs/promises";
|
|
9
|
+
import { join, dirname } from "path";
|
|
10
|
+
import { fileURLToPath } from "url";
|
|
11
|
+
import { existsSync } from "fs";
|
|
10
12
|
import pc from "picocolors";
|
|
13
|
+
var VERSION = "0.4.5";
|
|
11
14
|
var createCommand = new Command("create").description("Create a new Vue Native project").argument("<name>", "project name").option("-t, --template <template>", "project template (blank, tabs, drawer)", "blank").action(async (name, options) => {
|
|
12
15
|
const template = options.template;
|
|
13
16
|
if (!["blank", "tabs", "drawer"].includes(template)) {
|
|
@@ -82,7 +85,8 @@ options:
|
|
|
82
85
|
|
|
83
86
|
packages:
|
|
84
87
|
VueNativeCore:
|
|
85
|
-
|
|
88
|
+
url: https://github.com/abdul-hamid-achik/vue-native
|
|
89
|
+
from: "${VERSION}"
|
|
86
90
|
|
|
87
91
|
targets:
|
|
88
92
|
${xcodeProjectName}:
|
|
@@ -92,6 +96,7 @@ targets:
|
|
|
92
96
|
- Sources
|
|
93
97
|
dependencies:
|
|
94
98
|
- package: VueNativeCore
|
|
99
|
+
product: VueNativeCore
|
|
95
100
|
settings:
|
|
96
101
|
base:
|
|
97
102
|
PRODUCT_BUNDLE_IDENTIFIER: ${bundleId}
|
|
@@ -221,12 +226,20 @@ class AppViewController: VueNativeViewController {
|
|
|
221
226
|
const androidPkgPath = androidPkg.replace(/\./g, "/");
|
|
222
227
|
const androidSrcDir = join(androidAppDir, "src", "main");
|
|
223
228
|
const androidKotlinDir = join(androidSrcDir, "kotlin", androidPkgPath);
|
|
229
|
+
const androidResValuesDir = join(androidSrcDir, "res", "values");
|
|
230
|
+
const androidResXmlDir = join(androidSrcDir, "res", "xml");
|
|
231
|
+
const androidDebugResXmlDir = join(androidAppDir, "src", "debug", "res", "xml");
|
|
232
|
+
const androidGradleWrapperDir = join(androidDir, "gradle", "wrapper");
|
|
224
233
|
await mkdir(androidKotlinDir, { recursive: true });
|
|
234
|
+
await mkdir(androidResValuesDir, { recursive: true });
|
|
235
|
+
await mkdir(androidResXmlDir, { recursive: true });
|
|
236
|
+
await mkdir(androidDebugResXmlDir, { recursive: true });
|
|
237
|
+
await mkdir(androidGradleWrapperDir, { recursive: true });
|
|
225
238
|
await writeFile(join(androidDir, "build.gradle.kts"), `// Top-level build file
|
|
226
239
|
plugins {
|
|
227
|
-
id("com.android.application") version "8.
|
|
228
|
-
id("com.android.library") version "8.
|
|
229
|
-
id("org.jetbrains.kotlin.android") version "
|
|
240
|
+
id("com.android.application") version "8.7.3" apply false
|
|
241
|
+
id("com.android.library") version "8.7.3" apply false
|
|
242
|
+
id("org.jetbrains.kotlin.android") version "2.0.21" apply false
|
|
230
243
|
}
|
|
231
244
|
`);
|
|
232
245
|
await writeFile(join(androidDir, "settings.gradle.kts"), `pluginManagement {
|
|
@@ -242,13 +255,18 @@ dependencyResolutionManagement {
|
|
|
242
255
|
google()
|
|
243
256
|
mavenCentral()
|
|
244
257
|
maven { url = uri("https://jitpack.io") }
|
|
258
|
+
maven {
|
|
259
|
+
url = uri("https://maven.pkg.github.com/abdul-hamid-achik/vue-native")
|
|
260
|
+
credentials {
|
|
261
|
+
username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_ACTOR") ?: ""
|
|
262
|
+
password = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN") ?: ""
|
|
263
|
+
}
|
|
264
|
+
}
|
|
245
265
|
}
|
|
246
266
|
}
|
|
247
267
|
|
|
248
268
|
rootProject.name = "${name}"
|
|
249
269
|
include(":app")
|
|
250
|
-
include(":VueNativeCore")
|
|
251
|
-
project(":VueNativeCore").projectDir = file("../native/android/VueNativeCore")
|
|
252
270
|
`);
|
|
253
271
|
await writeFile(join(androidAppDir, "build.gradle.kts"), `plugins {
|
|
254
272
|
id("com.android.application")
|
|
@@ -257,19 +275,19 @@ project(":VueNativeCore").projectDir = file("../native/android/VueNativeCore")
|
|
|
257
275
|
|
|
258
276
|
android {
|
|
259
277
|
namespace = "${androidPkg}"
|
|
260
|
-
compileSdk =
|
|
278
|
+
compileSdk = 35
|
|
261
279
|
|
|
262
280
|
defaultConfig {
|
|
263
281
|
applicationId = "${androidPkg}"
|
|
264
|
-
minSdk =
|
|
265
|
-
targetSdk =
|
|
282
|
+
minSdk = 24
|
|
283
|
+
targetSdk = 35
|
|
266
284
|
versionCode = 1
|
|
267
285
|
versionName = "1.0"
|
|
268
286
|
}
|
|
269
287
|
|
|
270
288
|
buildTypes {
|
|
271
289
|
release {
|
|
272
|
-
isMinifyEnabled =
|
|
290
|
+
isMinifyEnabled = true
|
|
273
291
|
proguardFiles(
|
|
274
292
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
275
293
|
"proguard-rules.pro"
|
|
@@ -277,6 +295,10 @@ android {
|
|
|
277
295
|
}
|
|
278
296
|
}
|
|
279
297
|
|
|
298
|
+
buildFeatures {
|
|
299
|
+
buildConfig = true
|
|
300
|
+
}
|
|
301
|
+
|
|
280
302
|
compileOptions {
|
|
281
303
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
282
304
|
targetCompatibility = JavaVersion.VERSION_17
|
|
@@ -288,8 +310,17 @@ android {
|
|
|
288
310
|
}
|
|
289
311
|
|
|
290
312
|
dependencies {
|
|
291
|
-
implementation(
|
|
313
|
+
implementation("com.vuenative:core:${VERSION}")
|
|
314
|
+
implementation("androidx.appcompat:appcompat:1.7.0")
|
|
315
|
+
implementation("com.google.android.material:material:1.12.0")
|
|
316
|
+
implementation("androidx.core:core-ktx:1.15.0")
|
|
292
317
|
}
|
|
318
|
+
`);
|
|
319
|
+
await writeFile(join(androidAppDir, "proguard-rules.pro"), `# Vue Native
|
|
320
|
+
-keep class com.vuenative.** { *; }
|
|
321
|
+
|
|
322
|
+
# J2V8
|
|
323
|
+
-keep class com.eclipsesource.v8.** { *; }
|
|
293
324
|
`);
|
|
294
325
|
await writeFile(join(androidSrcDir, "AndroidManifest.xml"), `<?xml version="1.0" encoding="utf-8"?>
|
|
295
326
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
@@ -297,13 +328,15 @@ dependencies {
|
|
|
297
328
|
|
|
298
329
|
<application
|
|
299
330
|
android:allowBackup="true"
|
|
300
|
-
android:label="
|
|
331
|
+
android:label="@string/app_name"
|
|
301
332
|
android:supportsRtl="true"
|
|
302
|
-
android:theme="@style/Theme.
|
|
333
|
+
android:theme="@style/Theme.VueNative"
|
|
303
334
|
android:networkSecurityConfig="@xml/network_security_config">
|
|
304
335
|
<activity
|
|
305
336
|
android:name=".MainActivity"
|
|
306
|
-
android:exported="true"
|
|
337
|
+
android:exported="true"
|
|
338
|
+
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|keyboard|locale|layoutDirection|fontScale|uiMode|density"
|
|
339
|
+
android:windowSoftInputMode="adjustResize">
|
|
307
340
|
<intent-filter>
|
|
308
341
|
<action android:name="android.intent.action.MAIN" />
|
|
309
342
|
<category android:name="android.intent.category.LAUNCHER" />
|
|
@@ -312,9 +345,30 @@ dependencies {
|
|
|
312
345
|
</application>
|
|
313
346
|
</manifest>
|
|
314
347
|
`);
|
|
315
|
-
|
|
316
|
-
|
|
348
|
+
await writeFile(join(androidResValuesDir, "strings.xml"), `<?xml version="1.0" encoding="utf-8"?>
|
|
349
|
+
<resources>
|
|
350
|
+
<string name="app_name">${name}</string>
|
|
351
|
+
</resources>
|
|
352
|
+
`);
|
|
353
|
+
await writeFile(join(androidResValuesDir, "themes.xml"), `<?xml version="1.0" encoding="utf-8"?>
|
|
354
|
+
<resources>
|
|
355
|
+
<style name="Theme.VueNative" parent="Theme.MaterialComponents.Light.NoActionBar">
|
|
356
|
+
<item name="colorPrimary">#4F46E5</item>
|
|
357
|
+
<item name="colorPrimaryVariant">#3730A3</item>
|
|
358
|
+
<item name="colorOnPrimary">#FFFFFF</item>
|
|
359
|
+
<item name="colorSecondary">#10B981</item>
|
|
360
|
+
<item name="colorSecondaryVariant">#059669</item>
|
|
361
|
+
<item name="colorOnSecondary">#FFFFFF</item>
|
|
362
|
+
<item name="android:statusBarColor">@android:color/transparent</item>
|
|
363
|
+
</style>
|
|
364
|
+
</resources>
|
|
365
|
+
`);
|
|
317
366
|
await writeFile(join(androidResXmlDir, "network_security_config.xml"), `<?xml version="1.0" encoding="utf-8"?>
|
|
367
|
+
<network-security-config>
|
|
368
|
+
<base-config cleartextTrafficPermitted="false" />
|
|
369
|
+
</network-security-config>
|
|
370
|
+
`);
|
|
371
|
+
await writeFile(join(androidDebugResXmlDir, "network_security_config.xml"), `<?xml version="1.0" encoding="utf-8"?>
|
|
318
372
|
<network-security-config>
|
|
319
373
|
<domain-config cleartextTrafficPermitted="true">
|
|
320
374
|
<domain includeSubdomains="true">localhost</domain>
|
|
@@ -333,7 +387,7 @@ class MainActivity : VueNativeActivity() {
|
|
|
333
387
|
}
|
|
334
388
|
|
|
335
389
|
override fun getDevServerUrl(): String? {
|
|
336
|
-
return "ws://10.0.2.2:8174"
|
|
390
|
+
return if (BuildConfig.DEBUG) "ws://10.0.2.2:8174" else null
|
|
337
391
|
}
|
|
338
392
|
}
|
|
339
393
|
`);
|
|
@@ -342,6 +396,13 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
|
|
342
396
|
android.useAndroidX=true
|
|
343
397
|
kotlin.code.style=official
|
|
344
398
|
android.nonTransitiveRClass=true
|
|
399
|
+
`);
|
|
400
|
+
await writeFile(join(androidGradleWrapperDir, "gradle-wrapper.properties"), `distributionBase=GRADLE_USER_HOME
|
|
401
|
+
distributionPath=wrapper/dists
|
|
402
|
+
distributionUrl=https\\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
|
403
|
+
networkTimeout=10000
|
|
404
|
+
zipStoreBase=GRADLE_USER_HOME
|
|
405
|
+
zipStorePath=wrapper/dists
|
|
345
406
|
`);
|
|
346
407
|
await writeFile(join(dir, "vue-native.config.ts"), `import { defineConfig } from '@thelacanians/vue-native-cli'
|
|
347
408
|
|
|
@@ -353,8 +414,8 @@ export default defineConfig({
|
|
|
353
414
|
deploymentTarget: '16.0',
|
|
354
415
|
},
|
|
355
416
|
android: {
|
|
356
|
-
minSdk:
|
|
357
|
-
targetSdk:
|
|
417
|
+
minSdk: 24,
|
|
418
|
+
targetSdk: 35,
|
|
358
419
|
},
|
|
359
420
|
})
|
|
360
421
|
`);
|
|
@@ -388,6 +449,13 @@ local.properties
|
|
|
388
449
|
*.keystore
|
|
389
450
|
*.jks
|
|
390
451
|
`);
|
|
452
|
+
const cliDir = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
453
|
+
const bundledNative = join(cliDir, "native");
|
|
454
|
+
if (existsSync(bundledNative)) {
|
|
455
|
+
const nativeDir = join(dir, "native");
|
|
456
|
+
await cp(bundledNative, nativeDir, { recursive: true });
|
|
457
|
+
console.log(pc.dim(" Bundled native/ copied as fallback.\n"));
|
|
458
|
+
}
|
|
391
459
|
console.log(pc.green(" Project created successfully!\n"));
|
|
392
460
|
console.log(pc.white(" Next steps:\n"));
|
|
393
461
|
console.log(pc.white(` cd ${name}`));
|
|
@@ -396,6 +464,8 @@ local.properties
|
|
|
396
464
|
console.log(pc.white(" To run on iOS:"));
|
|
397
465
|
console.log(pc.white(" vue-native run ios\n"));
|
|
398
466
|
console.log(pc.white(" To run on Android:"));
|
|
467
|
+
console.log(pc.dim(" Open android/ in Android Studio, or run:"));
|
|
468
|
+
console.log(pc.dim(" cd android && gradle wrapper && cd .."));
|
|
399
469
|
console.log(pc.white(" vue-native run android\n"));
|
|
400
470
|
} catch (err) {
|
|
401
471
|
console.error(pc.red(`Error creating project: ${err.message}`));
|
|
@@ -738,7 +808,7 @@ const styles = createStyleSheet({
|
|
|
738
808
|
import { Command as Command2 } from "commander";
|
|
739
809
|
import { spawn, execSync } from "child_process";
|
|
740
810
|
import { readFile } from "fs/promises";
|
|
741
|
-
import { existsSync } from "fs";
|
|
811
|
+
import { existsSync as existsSync2 } from "fs";
|
|
742
812
|
import { join as join2 } from "path";
|
|
743
813
|
import { watch } from "chokidar";
|
|
744
814
|
import { WebSocketServer, WebSocket } from "ws";
|
|
@@ -864,10 +934,10 @@ var devCommand = new Command2("dev").description("Start the Vue Native dev serve
|
|
|
864
934
|
console.log(pc2.white(` Hot reload server: ${pc2.bold(`ws://localhost:${port}`)}`));
|
|
865
935
|
const iosDir = join2(cwd, "ios");
|
|
866
936
|
const androidDir = join2(cwd, "android");
|
|
867
|
-
if (
|
|
937
|
+
if (existsSync2(iosDir)) {
|
|
868
938
|
console.log(pc2.dim(` iOS app should connect to ws://localhost:${port}`));
|
|
869
939
|
}
|
|
870
|
-
if (
|
|
940
|
+
if (existsSync2(androidDir)) {
|
|
871
941
|
console.log(pc2.dim(` Android emulator should connect to ws://10.0.2.2:${port}`));
|
|
872
942
|
}
|
|
873
943
|
console.log(pc2.dim(" Waiting for app to connect...\n"));
|
|
@@ -928,7 +998,7 @@ var devCommand = new Command2("dev").description("Start the Vue Native dev serve
|
|
|
928
998
|
// src/commands/run.ts
|
|
929
999
|
import { Command as Command3 } from "commander";
|
|
930
1000
|
import { spawn as spawn2, execSync as execSync2 } from "child_process";
|
|
931
|
-
import { existsSync as
|
|
1001
|
+
import { existsSync as existsSync3, readdirSync, readFileSync } from "fs";
|
|
932
1002
|
import { join as join3 } from "path";
|
|
933
1003
|
import pc3 from "picocolors";
|
|
934
1004
|
function findAppPath(_buildDir) {
|
|
@@ -936,7 +1006,7 @@ function findAppPath(_buildDir) {
|
|
|
936
1006
|
process.env.HOME || "~",
|
|
937
1007
|
"Library/Developer/Xcode/DerivedData"
|
|
938
1008
|
);
|
|
939
|
-
if (
|
|
1009
|
+
if (existsSync3(derivedDataBase)) {
|
|
940
1010
|
try {
|
|
941
1011
|
const projects = readdirSync(derivedDataBase);
|
|
942
1012
|
for (const project of projects.reverse()) {
|
|
@@ -945,7 +1015,7 @@ function findAppPath(_buildDir) {
|
|
|
945
1015
|
project,
|
|
946
1016
|
"Build/Products/Debug-iphonesimulator"
|
|
947
1017
|
);
|
|
948
|
-
if (
|
|
1018
|
+
if (existsSync3(productsDir)) {
|
|
949
1019
|
const entries = readdirSync(productsDir);
|
|
950
1020
|
const app = entries.find((e) => e.endsWith(".app"));
|
|
951
1021
|
if (app) {
|
|
@@ -960,7 +1030,7 @@ function findAppPath(_buildDir) {
|
|
|
960
1030
|
}
|
|
961
1031
|
function readBundleId(iosDir) {
|
|
962
1032
|
const plistPath = join3(iosDir, "Sources", "Info.plist");
|
|
963
|
-
if (
|
|
1033
|
+
if (existsSync3(plistPath)) {
|
|
964
1034
|
try {
|
|
965
1035
|
const content = readFileSync(plistPath, "utf8");
|
|
966
1036
|
const match = content.match(
|
|
@@ -976,7 +1046,7 @@ function readBundleId(iosDir) {
|
|
|
976
1046
|
}
|
|
977
1047
|
function findApkPath(androidDir) {
|
|
978
1048
|
const apkDir = join3(androidDir, "app", "build", "outputs", "apk", "debug");
|
|
979
|
-
if (
|
|
1049
|
+
if (existsSync3(apkDir)) {
|
|
980
1050
|
try {
|
|
981
1051
|
const entries = readdirSync(apkDir);
|
|
982
1052
|
const apk = entries.find((e) => e.endsWith(".apk") && !e.includes("androidTest"));
|
|
@@ -1014,7 +1084,7 @@ var runCommand = new Command3("run").description("Build and run the app").argume
|
|
|
1014
1084
|
function runIOS(cwd, options) {
|
|
1015
1085
|
let xcodeProject = null;
|
|
1016
1086
|
const iosDir = join3(cwd, "ios");
|
|
1017
|
-
if (
|
|
1087
|
+
if (existsSync3(iosDir)) {
|
|
1018
1088
|
for (const ext of [".xcworkspace", ".xcodeproj"]) {
|
|
1019
1089
|
try {
|
|
1020
1090
|
const entries = readdirSync(iosDir);
|
|
@@ -1101,14 +1171,14 @@ function runIOS(cwd, options) {
|
|
|
1101
1171
|
}
|
|
1102
1172
|
function runAndroid(cwd, options) {
|
|
1103
1173
|
const androidDir = join3(cwd, "android");
|
|
1104
|
-
if (!
|
|
1174
|
+
if (!existsSync3(androidDir)) {
|
|
1105
1175
|
console.log(pc3.yellow(" No android/ directory found."));
|
|
1106
1176
|
console.log(pc3.dim(" To add Android support, create an Android project in the android/ directory."));
|
|
1107
1177
|
console.log(pc3.dim(" Bundle has been built to dist/vue-native-bundle.js\n"));
|
|
1108
1178
|
return;
|
|
1109
1179
|
}
|
|
1110
1180
|
const gradlew = join3(androidDir, "gradlew");
|
|
1111
|
-
if (!
|
|
1181
|
+
if (!existsSync3(gradlew)) {
|
|
1112
1182
|
console.error(pc3.red(" \u2717 gradlew not found in android/ directory"));
|
|
1113
1183
|
console.log(pc3.dim(" Make sure your Android project has the Gradle wrapper.\n"));
|
|
1114
1184
|
process.exit(1);
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Vue Native — Android
|
|
2
|
+
|
|
3
|
+
Android implementation of the Vue Native framework. Runs Vue 3 apps on Android using V8 (J2V8) as the JavaScript engine and Android Views with FlexboxLayout for the UI layer.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Vue Bundle (IIFE)
|
|
9
|
+
↓ loaded by JSRuntime (J2V8 / HandlerThread)
|
|
10
|
+
__VN_flushOperations(json) ← batched operations
|
|
11
|
+
↓ NativeBridge.processOperations() [main thread]
|
|
12
|
+
ComponentRegistry → NativeComponentFactory
|
|
13
|
+
↓ createView / updateProp / insertChild
|
|
14
|
+
Android Views (FlexboxLayout, TextView, EditText, RecyclerView…)
|
|
15
|
+
↓
|
|
16
|
+
Android screen
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Module Structure
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
VueNativeCore/
|
|
23
|
+
├── Bridge/
|
|
24
|
+
│ ├── JSRuntime.kt — V8 engine on a dedicated HandlerThread
|
|
25
|
+
│ ├── NativeBridge.kt — Processes batched operations on main thread
|
|
26
|
+
│ ├── JSPolyfills.kt — console, setTimeout, fetch, RAF, performance.now
|
|
27
|
+
│ ├── HotReloadManager.kt — WebSocket connection to Vite dev server
|
|
28
|
+
│ └── ErrorOverlayView.kt — Debug error overlay
|
|
29
|
+
├── Components/
|
|
30
|
+
│ ├── NativeComponentFactory.kt — Factory interface
|
|
31
|
+
│ ├── ComponentRegistry.kt — Singleton factory registry
|
|
32
|
+
│ ├── VTextNodeView.kt — Text node view for VText children
|
|
33
|
+
│ └── Factories/
|
|
34
|
+
│ ├── VViewFactory.kt — FlexboxLayout
|
|
35
|
+
│ ├── VTextFactory.kt — TextView
|
|
36
|
+
│ ├── VButtonFactory.kt — Pressable FlexboxLayout
|
|
37
|
+
│ ├── VInputFactory.kt — EditText with v-model
|
|
38
|
+
│ ├── VScrollViewFactory.kt — ScrollView + FlexboxLayout content
|
|
39
|
+
│ ├── VListFactory.kt — RecyclerView with bridge-managed items
|
|
40
|
+
│ ├── VImageFactory.kt — Coil-based async image loading
|
|
41
|
+
│ ├── VSwitchFactory.kt — SwitchCompat
|
|
42
|
+
│ ├── VSliderFactory.kt — SeekBar
|
|
43
|
+
│ ├── VModalFactory.kt — Dialog overlay
|
|
44
|
+
│ ├── VAlertDialogFactory.kt — AlertDialog.Builder
|
|
45
|
+
│ ├── VProgressBarFactory.kt — Horizontal ProgressBar
|
|
46
|
+
│ ├── VSegmentedControlFactory.kt — RadioGroup
|
|
47
|
+
│ ├── VPickerFactory.kt — DatePicker
|
|
48
|
+
│ ├── VActionSheetFactory.kt — AlertDialog with item list
|
|
49
|
+
│ ├── VStatusBarFactory.kt — WindowInsetsController
|
|
50
|
+
│ ├── VWebViewFactory.kt — WebView
|
|
51
|
+
│ ├── VActivityIndicatorFactory.kt — ProgressBar (circular)
|
|
52
|
+
│ ├── VSafeAreaFactory.kt — WindowInsets-aware container
|
|
53
|
+
│ └── VKeyboardAvoidingFactory.kt — Keyboard-aware container
|
|
54
|
+
├── Styling/
|
|
55
|
+
│ └── StyleEngine.kt — JS style props → Android View properties
|
|
56
|
+
├── Modules/
|
|
57
|
+
│ ├── NativeModule.kt — Interface for all native modules
|
|
58
|
+
│ ├── NativeModuleRegistry.kt
|
|
59
|
+
│ ├── HapticsModule.kt — VibrationEffect
|
|
60
|
+
│ ├── AsyncStorageModule.kt — SharedPreferences KV store
|
|
61
|
+
│ ├── ClipboardModule.kt — ClipboardManager
|
|
62
|
+
│ ├── DeviceInfoModule.kt — Build info + DisplayMetrics
|
|
63
|
+
│ ├── NetworkModule.kt — ConnectivityManager.NetworkCallback
|
|
64
|
+
│ ├── AppStateModule.kt — ProcessLifecycleOwner
|
|
65
|
+
│ ├── LinkingModule.kt — Intent ACTION_VIEW
|
|
66
|
+
│ ├── ShareModule.kt — Intent ACTION_SEND
|
|
67
|
+
│ ├── AnimationModule.kt — ObjectAnimator
|
|
68
|
+
│ ├── KeyboardModule.kt — InputMethodManager
|
|
69
|
+
│ ├── PermissionsModule.kt — ContextCompat.checkSelfPermission
|
|
70
|
+
│ ├── GeolocationModule.kt — FusedLocationProviderClient
|
|
71
|
+
│ ├── NotificationsModule.kt — NotificationCompat + scheduled delivery
|
|
72
|
+
│ ├── HttpModule.kt — OkHttp wrapper for useHttp() composable
|
|
73
|
+
│ ├── BiometryModule.kt — BiometricManager capability check
|
|
74
|
+
│ └── CameraModule.kt — Stub (requires Activity integration)
|
|
75
|
+
├── Helpers/
|
|
76
|
+
│ └── GestureHelper.kt — Touch event helpers
|
|
77
|
+
├── Tags.kt — View tag ID constants
|
|
78
|
+
└── VueNativeActivity.kt — Base Activity for all Vue Native apps
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Quick Start
|
|
82
|
+
|
|
83
|
+
### 1. Add VueNativeCore to your project
|
|
84
|
+
|
|
85
|
+
In your app's `settings.gradle.kts`:
|
|
86
|
+
```kotlin
|
|
87
|
+
include(":VueNativeCore")
|
|
88
|
+
project(":VueNativeCore").projectDir = File("path/to/VueNativeCore")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
In your app's `build.gradle.kts`:
|
|
92
|
+
```kotlin
|
|
93
|
+
dependencies {
|
|
94
|
+
implementation(project(":VueNativeCore"))
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 2. Create your Activity
|
|
99
|
+
|
|
100
|
+
```kotlin
|
|
101
|
+
class MainActivity : VueNativeActivity() {
|
|
102
|
+
// Path to your compiled Vue bundle in src/main/assets/
|
|
103
|
+
override fun getBundleAssetPath(): String = "vue-native-bundle.js"
|
|
104
|
+
|
|
105
|
+
// For hot reload during development (optional)
|
|
106
|
+
// ws://10.0.2.2:5173 connects from emulator to host machine
|
|
107
|
+
override fun getDevServerUrl(): String? = if (BuildConfig.DEBUG) "ws://10.0.2.2:5173" else null
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 3. Build the Vue bundle
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
cd your-vue-native-app
|
|
115
|
+
bun run build # or: npx vite build
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Copy the output file to `app/src/main/assets/vue-native-bundle.js`.
|
|
119
|
+
|
|
120
|
+
### 4. Run
|
|
121
|
+
|
|
122
|
+
Open the Android project in Android Studio and run on an emulator or device.
|
|
123
|
+
|
|
124
|
+
## Development with Hot Reload
|
|
125
|
+
|
|
126
|
+
1. Start the Vite dev server:
|
|
127
|
+
```bash
|
|
128
|
+
bun run dev
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
2. Set `getDevServerUrl()` to `"ws://10.0.2.2:5173"` (emulator) or your machine's IP for a real device.
|
|
132
|
+
|
|
133
|
+
3. The app connects on start and automatically reloads when you save Vue files.
|
|
134
|
+
|
|
135
|
+
## Thread Model
|
|
136
|
+
|
|
137
|
+
| Thread | Purpose |
|
|
138
|
+
|--------|---------|
|
|
139
|
+
| `VueNative-JS` (HandlerThread) | All V8 operations — **never access V8 from other threads** |
|
|
140
|
+
| Main Thread | All Android View operations, bridge operation dispatch |
|
|
141
|
+
| IO Thread (Coroutines) | HTTP requests, WebSocket, image loading |
|
|
142
|
+
|
|
143
|
+
## Adding Custom Native Modules
|
|
144
|
+
|
|
145
|
+
Implement `NativeModule` and register in your subclass of `VueNativeActivity`:
|
|
146
|
+
|
|
147
|
+
```kotlin
|
|
148
|
+
class MyModule : NativeModule {
|
|
149
|
+
override val moduleName = "MyModule"
|
|
150
|
+
|
|
151
|
+
override fun invoke(
|
|
152
|
+
method: String,
|
|
153
|
+
args: List<Any?>,
|
|
154
|
+
bridge: NativeBridge,
|
|
155
|
+
callback: (Any?, String?) -> Unit
|
|
156
|
+
) {
|
|
157
|
+
when (method) {
|
|
158
|
+
"doSomething" -> {
|
|
159
|
+
// ... do work ...
|
|
160
|
+
callback(mapOf("result" to "done"), null)
|
|
161
|
+
}
|
|
162
|
+
else -> callback(null, "Unknown method: $method")
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
```kotlin
|
|
169
|
+
class MainActivity : VueNativeActivity() {
|
|
170
|
+
override fun getBundleAssetPath() = "bundle.js"
|
|
171
|
+
|
|
172
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
173
|
+
super.onCreate(savedInstanceState)
|
|
174
|
+
NativeModuleRegistry.getInstance(this).register(MyModule())
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
From Vue/TypeScript:
|
|
180
|
+
```typescript
|
|
181
|
+
import { NativeBridge } from '@thelacanians/vue-native-runtime'
|
|
182
|
+
|
|
183
|
+
const result = await NativeBridge.invokeNativeModule('MyModule', 'doSomething', [])
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Dependencies
|
|
187
|
+
|
|
188
|
+
| Library | Version | Purpose |
|
|
189
|
+
|---------|---------|---------|
|
|
190
|
+
| `com.eclipsesource.j2v8:j2v8` | 6.2.1 | V8 JavaScript engine |
|
|
191
|
+
| `com.google.android.flexbox:flexbox` | 3.0.0 | CSS Flexbox layout |
|
|
192
|
+
| `io.coil-kt:coil` | 2.7.0 | Async image loading |
|
|
193
|
+
| `com.squareup.okhttp3:okhttp` | 4.12.0 | HTTP (fetch polyfill, hot reload) |
|
|
194
|
+
| `androidx.recyclerview:recyclerview` | 1.3.2 | VList virtualization |
|
|
195
|
+
| `androidx.webkit:webkit` | 1.10.0 | VWebView |
|
|
196
|
+
| `androidx.swiperefreshlayout:swiperefreshlayout` | 1.1.0 | VScrollView pull-to-refresh |
|
|
197
|
+
| `androidx.biometric:biometric` | 1.1.0 | BiometryModule |
|
|
198
|
+
| `com.google.android.gms:play-services-location` | 21.1.0 | GeolocationModule |
|
|
199
|
+
|
|
200
|
+
## Minimum Requirements
|
|
201
|
+
|
|
202
|
+
- Android API 21 (Android 5.0 Lollipop)
|
|
203
|
+
- Kotlin 1.9+
|
|
204
|
+
- Gradle 8.6
|
|
205
|
+
- AGP 8.2.2
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
plugins {
|
|
2
|
+
id("com.android.library")
|
|
3
|
+
id("org.jetbrains.kotlin.android")
|
|
4
|
+
id("maven-publish")
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
android {
|
|
8
|
+
namespace = "com.vuenative.core"
|
|
9
|
+
compileSdk = 35
|
|
10
|
+
|
|
11
|
+
defaultConfig {
|
|
12
|
+
minSdk = 21
|
|
13
|
+
targetSdk = 35
|
|
14
|
+
|
|
15
|
+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
16
|
+
consumerProguardFiles("consumer-rules.pro")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
buildTypes {
|
|
20
|
+
release {
|
|
21
|
+
isMinifyEnabled = false
|
|
22
|
+
proguardFiles(
|
|
23
|
+
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
24
|
+
"proguard-rules.pro"
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
compileOptions {
|
|
30
|
+
sourceCompatibility = JavaVersion.VERSION_17
|
|
31
|
+
targetCompatibility = JavaVersion.VERSION_17
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
kotlinOptions {
|
|
35
|
+
jvmTarget = "17"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Allow lint checks to pass without strict enforcement during development
|
|
39
|
+
lint {
|
|
40
|
+
abortOnError = false
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
dependencies {
|
|
45
|
+
// AndroidX Core
|
|
46
|
+
implementation("androidx.core:core-ktx:1.12.0")
|
|
47
|
+
implementation("androidx.appcompat:appcompat:1.6.1")
|
|
48
|
+
implementation("com.google.android.material:material:1.11.0")
|
|
49
|
+
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
|
|
50
|
+
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
|
51
|
+
implementation("androidx.webkit:webkit:1.10.0")
|
|
52
|
+
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
|
53
|
+
|
|
54
|
+
// J2V8 — JavaScript engine (V8 for Android)
|
|
55
|
+
implementation("com.eclipsesource.j2v8:j2v8:6.2.1@aar")
|
|
56
|
+
|
|
57
|
+
// FlexboxLayout — CSS Flexbox for Android views
|
|
58
|
+
implementation("com.google.android.flexbox:flexbox:3.0.0")
|
|
59
|
+
|
|
60
|
+
// Coil — Image loading
|
|
61
|
+
implementation("io.coil-kt:coil:2.7.0")
|
|
62
|
+
|
|
63
|
+
// OkHttp — HTTP for fetch polyfill
|
|
64
|
+
implementation("com.squareup.okhttp3:okhttp:4.12.0")
|
|
65
|
+
|
|
66
|
+
// Kotlin Coroutines
|
|
67
|
+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
|
|
68
|
+
|
|
69
|
+
// Lifecycle Process (for ProcessLifecycleOwner)
|
|
70
|
+
implementation("androidx.lifecycle:lifecycle-process:2.7.0")
|
|
71
|
+
|
|
72
|
+
// WorkManager (for BackgroundTaskModule)
|
|
73
|
+
implementation("androidx.work:work-runtime-ktx:2.8.1")
|
|
74
|
+
|
|
75
|
+
// Location (for GeolocationModule)
|
|
76
|
+
implementation("com.google.android.gms:play-services-location:21.1.0")
|
|
77
|
+
|
|
78
|
+
// Biometry (for BiometryModule)
|
|
79
|
+
implementation("androidx.biometric:biometric:1.1.0")
|
|
80
|
+
|
|
81
|
+
// Secure Storage (for SecureStorageModule)
|
|
82
|
+
implementation("androidx.security:security-crypto:1.1.0-alpha06")
|
|
83
|
+
|
|
84
|
+
// Google Play Billing (for IAPModule)
|
|
85
|
+
implementation("com.android.billingclient:billing:7.0.0")
|
|
86
|
+
|
|
87
|
+
// Credential Manager + Google Identity (for SocialAuthModule)
|
|
88
|
+
implementation("androidx.credentials:credentials:1.2.2")
|
|
89
|
+
implementation("com.google.android.libraries.identity.googleid:googleid:1.1.1")
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
afterEvaluate {
|
|
93
|
+
publishing {
|
|
94
|
+
publications {
|
|
95
|
+
create<MavenPublication>("release") {
|
|
96
|
+
groupId = "com.vuenative"
|
|
97
|
+
artifactId = "core"
|
|
98
|
+
version = "0.4.5"
|
|
99
|
+
from(components["release"])
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
repositories {
|
|
103
|
+
maven {
|
|
104
|
+
name = "GitHubPackages"
|
|
105
|
+
url = uri("https://maven.pkg.github.com/abdul-hamid-achik/vue-native")
|
|
106
|
+
credentials {
|
|
107
|
+
username = System.getenv("GITHUB_ACTOR")
|
|
108
|
+
password = System.getenv("GITHUB_TOKEN")
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Consumer ProGuard rules for VueNativeCore library.
|
|
2
|
+
# These rules are applied to apps that depend on VueNativeCore.
|
|
3
|
+
|
|
4
|
+
# J2V8 — V8 engine JNI bindings must not be stripped
|
|
5
|
+
-keep class com.eclipsesource.v8.** { *; }
|
|
6
|
+
-keepclasseswithmembers class com.eclipsesource.v8.** {
|
|
7
|
+
native <methods>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
# Keep Vue Native public API
|
|
11
|
+
-keep public class com.vuenative.core.VueNativeActivity { *; }
|
|
12
|
+
-keep public class com.vuenative.core.NativeModule { *; }
|