@thelacanians/vue-native-cli 0.4.2 → 0.4.4
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 +43 -23
- package/native/android/README.md +205 -0
- package/native/android/VueNativeCore/build.gradle.kts +100 -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 +160 -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 +132 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Bridge/ErrorOverlayView.swift +92 -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 +891 -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 +91 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VActivityIndicatorFactory.swift +74 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VAlertDialogFactory.swift +150 -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 +112 -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 +246 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VViewFactory.swift +157 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/Factories/VWebViewFactory.swift +172 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Components/NativeComponentFactory.swift +53 -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 +291 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/AppStateModule.swift +65 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/AsyncStorageModule.swift +68 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/AudioModule.swift +366 -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 +387 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/CalendarModule.swift +161 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/CameraModule.swift +318 -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 +138 -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 +49 -0
- package/native/ios/VueNativeCore/Sources/VueNativeCore/Modules/SocialAuthModule.swift +240 -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.4";
|
|
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)) {
|
|
@@ -60,9 +63,12 @@ export default defineConfig({
|
|
|
60
63
|
strict: true,
|
|
61
64
|
jsx: "preserve",
|
|
62
65
|
lib: ["ES2020"],
|
|
63
|
-
types: []
|
|
66
|
+
types: [],
|
|
67
|
+
paths: {
|
|
68
|
+
vue: ["./node_modules/@thelacanians/vue-native-runtime/dist/index.d.ts"]
|
|
69
|
+
}
|
|
64
70
|
},
|
|
65
|
-
include: ["app/**/*"]
|
|
71
|
+
include: ["app/**/*", "env.d.ts"]
|
|
66
72
|
}, null, 2));
|
|
67
73
|
await generateTemplateFiles(dir, name, template);
|
|
68
74
|
const iosDir = join(dir, "ios");
|
|
@@ -79,7 +85,8 @@ options:
|
|
|
79
85
|
|
|
80
86
|
packages:
|
|
81
87
|
VueNativeCore:
|
|
82
|
-
|
|
88
|
+
url: https://github.com/abdul-hamid-achik/vue-native
|
|
89
|
+
from: "${VERSION}"
|
|
83
90
|
|
|
84
91
|
targets:
|
|
85
92
|
${xcodeProjectName}:
|
|
@@ -89,6 +96,7 @@ targets:
|
|
|
89
96
|
- Sources
|
|
90
97
|
dependencies:
|
|
91
98
|
- package: VueNativeCore
|
|
99
|
+
product: VueNativeCore
|
|
92
100
|
settings:
|
|
93
101
|
base:
|
|
94
102
|
PRODUCT_BUNDLE_IDENTIFIER: ${bundleId}
|
|
@@ -239,13 +247,18 @@ dependencyResolutionManagement {
|
|
|
239
247
|
google()
|
|
240
248
|
mavenCentral()
|
|
241
249
|
maven { url = uri("https://jitpack.io") }
|
|
250
|
+
maven {
|
|
251
|
+
url = uri("https://maven.pkg.github.com/abdul-hamid-achik/vue-native")
|
|
252
|
+
credentials {
|
|
253
|
+
username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_ACTOR")
|
|
254
|
+
password = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")
|
|
255
|
+
}
|
|
256
|
+
}
|
|
242
257
|
}
|
|
243
258
|
}
|
|
244
259
|
|
|
245
260
|
rootProject.name = "${name}"
|
|
246
261
|
include(":app")
|
|
247
|
-
include(":VueNativeCore")
|
|
248
|
-
project(":VueNativeCore").projectDir = file("../native/android/VueNativeCore")
|
|
249
262
|
`);
|
|
250
263
|
await writeFile(join(androidAppDir, "build.gradle.kts"), `plugins {
|
|
251
264
|
id("com.android.application")
|
|
@@ -285,7 +298,7 @@ android {
|
|
|
285
298
|
}
|
|
286
299
|
|
|
287
300
|
dependencies {
|
|
288
|
-
implementation(
|
|
301
|
+
implementation("com.vuenative:core:${VERSION}")
|
|
289
302
|
}
|
|
290
303
|
`);
|
|
291
304
|
await writeFile(join(androidSrcDir, "AndroidManifest.xml"), `<?xml version="1.0" encoding="utf-8"?>
|
|
@@ -357,7 +370,7 @@ export default defineConfig({
|
|
|
357
370
|
`);
|
|
358
371
|
await writeFile(join(dir, "env.d.ts"), `/// <reference types="vite/client" />
|
|
359
372
|
declare module '*.vue' {
|
|
360
|
-
import type { DefineComponent } from 'vue'
|
|
373
|
+
import type { DefineComponent } from '@thelacanians/vue-native-runtime'
|
|
361
374
|
const component: DefineComponent<{}, {}, any>
|
|
362
375
|
export default component
|
|
363
376
|
}
|
|
@@ -385,6 +398,13 @@ local.properties
|
|
|
385
398
|
*.keystore
|
|
386
399
|
*.jks
|
|
387
400
|
`);
|
|
401
|
+
const cliDir = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
402
|
+
const bundledNative = join(cliDir, "native");
|
|
403
|
+
if (existsSync(bundledNative)) {
|
|
404
|
+
const nativeDir = join(dir, "native");
|
|
405
|
+
await cp(bundledNative, nativeDir, { recursive: true });
|
|
406
|
+
console.log(pc.dim(" Bundled native/ copied as fallback.\n"));
|
|
407
|
+
}
|
|
388
408
|
console.log(pc.green(" Project created successfully!\n"));
|
|
389
409
|
console.log(pc.white(" Next steps:\n"));
|
|
390
410
|
console.log(pc.white(` cd ${name}`));
|
|
@@ -410,7 +430,7 @@ async function generateTemplateFiles(dir, name, template) {
|
|
|
410
430
|
}
|
|
411
431
|
}
|
|
412
432
|
async function generateBlankTemplate(dir, pagesDir) {
|
|
413
|
-
await writeFile(join(dir, "app", "main.ts"), `import { createApp } from 'vue'
|
|
433
|
+
await writeFile(join(dir, "app", "main.ts"), `import { createApp } from '@thelacanians/vue-native-runtime'
|
|
414
434
|
import { createRouter } from '@thelacanians/vue-native-navigation'
|
|
415
435
|
import App from './App.vue'
|
|
416
436
|
import Home from './pages/Home.vue'
|
|
@@ -485,7 +505,7 @@ const styles = createStyleSheet({
|
|
|
485
505
|
`);
|
|
486
506
|
}
|
|
487
507
|
async function generateTabsTemplate(dir, pagesDir) {
|
|
488
|
-
await writeFile(join(dir, "app", "main.ts"), `import { createApp } from 'vue'
|
|
508
|
+
await writeFile(join(dir, "app", "main.ts"), `import { createApp } from '@thelacanians/vue-native-runtime'
|
|
489
509
|
import App from './App.vue'
|
|
490
510
|
|
|
491
511
|
const app = createApp(App)
|
|
@@ -598,7 +618,7 @@ const styles = createStyleSheet({
|
|
|
598
618
|
`);
|
|
599
619
|
}
|
|
600
620
|
async function generateDrawerTemplate(dir, pagesDir) {
|
|
601
|
-
await writeFile(join(dir, "app", "main.ts"), `import { createApp } from 'vue'
|
|
621
|
+
await writeFile(join(dir, "app", "main.ts"), `import { createApp } from '@thelacanians/vue-native-runtime'
|
|
602
622
|
import App from './App.vue'
|
|
603
623
|
|
|
604
624
|
const app = createApp(App)
|
|
@@ -735,7 +755,7 @@ const styles = createStyleSheet({
|
|
|
735
755
|
import { Command as Command2 } from "commander";
|
|
736
756
|
import { spawn, execSync } from "child_process";
|
|
737
757
|
import { readFile } from "fs/promises";
|
|
738
|
-
import { existsSync } from "fs";
|
|
758
|
+
import { existsSync as existsSync2 } from "fs";
|
|
739
759
|
import { join as join2 } from "path";
|
|
740
760
|
import { watch } from "chokidar";
|
|
741
761
|
import { WebSocketServer, WebSocket } from "ws";
|
|
@@ -861,10 +881,10 @@ var devCommand = new Command2("dev").description("Start the Vue Native dev serve
|
|
|
861
881
|
console.log(pc2.white(` Hot reload server: ${pc2.bold(`ws://localhost:${port}`)}`));
|
|
862
882
|
const iosDir = join2(cwd, "ios");
|
|
863
883
|
const androidDir = join2(cwd, "android");
|
|
864
|
-
if (
|
|
884
|
+
if (existsSync2(iosDir)) {
|
|
865
885
|
console.log(pc2.dim(` iOS app should connect to ws://localhost:${port}`));
|
|
866
886
|
}
|
|
867
|
-
if (
|
|
887
|
+
if (existsSync2(androidDir)) {
|
|
868
888
|
console.log(pc2.dim(` Android emulator should connect to ws://10.0.2.2:${port}`));
|
|
869
889
|
}
|
|
870
890
|
console.log(pc2.dim(" Waiting for app to connect...\n"));
|
|
@@ -925,7 +945,7 @@ var devCommand = new Command2("dev").description("Start the Vue Native dev serve
|
|
|
925
945
|
// src/commands/run.ts
|
|
926
946
|
import { Command as Command3 } from "commander";
|
|
927
947
|
import { spawn as spawn2, execSync as execSync2 } from "child_process";
|
|
928
|
-
import { existsSync as
|
|
948
|
+
import { existsSync as existsSync3, readdirSync, readFileSync } from "fs";
|
|
929
949
|
import { join as join3 } from "path";
|
|
930
950
|
import pc3 from "picocolors";
|
|
931
951
|
function findAppPath(_buildDir) {
|
|
@@ -933,7 +953,7 @@ function findAppPath(_buildDir) {
|
|
|
933
953
|
process.env.HOME || "~",
|
|
934
954
|
"Library/Developer/Xcode/DerivedData"
|
|
935
955
|
);
|
|
936
|
-
if (
|
|
956
|
+
if (existsSync3(derivedDataBase)) {
|
|
937
957
|
try {
|
|
938
958
|
const projects = readdirSync(derivedDataBase);
|
|
939
959
|
for (const project of projects.reverse()) {
|
|
@@ -942,7 +962,7 @@ function findAppPath(_buildDir) {
|
|
|
942
962
|
project,
|
|
943
963
|
"Build/Products/Debug-iphonesimulator"
|
|
944
964
|
);
|
|
945
|
-
if (
|
|
965
|
+
if (existsSync3(productsDir)) {
|
|
946
966
|
const entries = readdirSync(productsDir);
|
|
947
967
|
const app = entries.find((e) => e.endsWith(".app"));
|
|
948
968
|
if (app) {
|
|
@@ -957,7 +977,7 @@ function findAppPath(_buildDir) {
|
|
|
957
977
|
}
|
|
958
978
|
function readBundleId(iosDir) {
|
|
959
979
|
const plistPath = join3(iosDir, "Sources", "Info.plist");
|
|
960
|
-
if (
|
|
980
|
+
if (existsSync3(plistPath)) {
|
|
961
981
|
try {
|
|
962
982
|
const content = readFileSync(plistPath, "utf8");
|
|
963
983
|
const match = content.match(
|
|
@@ -973,7 +993,7 @@ function readBundleId(iosDir) {
|
|
|
973
993
|
}
|
|
974
994
|
function findApkPath(androidDir) {
|
|
975
995
|
const apkDir = join3(androidDir, "app", "build", "outputs", "apk", "debug");
|
|
976
|
-
if (
|
|
996
|
+
if (existsSync3(apkDir)) {
|
|
977
997
|
try {
|
|
978
998
|
const entries = readdirSync(apkDir);
|
|
979
999
|
const apk = entries.find((e) => e.endsWith(".apk") && !e.includes("androidTest"));
|
|
@@ -1011,7 +1031,7 @@ var runCommand = new Command3("run").description("Build and run the app").argume
|
|
|
1011
1031
|
function runIOS(cwd, options) {
|
|
1012
1032
|
let xcodeProject = null;
|
|
1013
1033
|
const iosDir = join3(cwd, "ios");
|
|
1014
|
-
if (
|
|
1034
|
+
if (existsSync3(iosDir)) {
|
|
1015
1035
|
for (const ext of [".xcworkspace", ".xcodeproj"]) {
|
|
1016
1036
|
try {
|
|
1017
1037
|
const entries = readdirSync(iosDir);
|
|
@@ -1098,14 +1118,14 @@ function runIOS(cwd, options) {
|
|
|
1098
1118
|
}
|
|
1099
1119
|
function runAndroid(cwd, options) {
|
|
1100
1120
|
const androidDir = join3(cwd, "android");
|
|
1101
|
-
if (!
|
|
1121
|
+
if (!existsSync3(androidDir)) {
|
|
1102
1122
|
console.log(pc3.yellow(" No android/ directory found."));
|
|
1103
1123
|
console.log(pc3.dim(" To add Android support, create an Android project in the android/ directory."));
|
|
1104
1124
|
console.log(pc3.dim(" Bundle has been built to dist/vue-native-bundle.js\n"));
|
|
1105
1125
|
return;
|
|
1106
1126
|
}
|
|
1107
1127
|
const gradlew = join3(androidDir, "gradlew");
|
|
1108
|
-
if (!
|
|
1128
|
+
if (!existsSync3(gradlew)) {
|
|
1109
1129
|
console.error(pc3.red(" \u2717 gradlew not found in android/ directory"));
|
|
1110
1130
|
console.log(pc3.dim(" Make sure your Android project has the Gradle wrapper.\n"));
|
|
1111
1131
|
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,100 @@
|
|
|
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 = 34
|
|
10
|
+
|
|
11
|
+
defaultConfig {
|
|
12
|
+
minSdk = 21
|
|
13
|
+
targetSdk = 34
|
|
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
|
+
// Location (for GeolocationModule)
|
|
70
|
+
implementation("com.google.android.gms:play-services-location:21.1.0")
|
|
71
|
+
|
|
72
|
+
// Biometry (for BiometryModule)
|
|
73
|
+
implementation("androidx.biometric:biometric:1.1.0")
|
|
74
|
+
|
|
75
|
+
// Secure Storage (for SecureStorageModule)
|
|
76
|
+
implementation("androidx.security:security-crypto:1.1.0-alpha06")
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
afterEvaluate {
|
|
80
|
+
publishing {
|
|
81
|
+
publications {
|
|
82
|
+
create<MavenPublication>("release") {
|
|
83
|
+
groupId = "com.vuenative"
|
|
84
|
+
artifactId = "core"
|
|
85
|
+
version = "0.4.4"
|
|
86
|
+
from(components["release"])
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
repositories {
|
|
90
|
+
maven {
|
|
91
|
+
name = "GitHubPackages"
|
|
92
|
+
url = uri("https://maven.pkg.github.com/abdul-hamid-achik/vue-native")
|
|
93
|
+
credentials {
|
|
94
|
+
username = System.getenv("GITHUB_ACTOR")
|
|
95
|
+
password = System.getenv("GITHUB_TOKEN")
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -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 { *; }
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# J2V8 — keep all V8 classes and JNI methods
|
|
2
|
+
-keep class com.eclipsesource.v8.** { *; }
|
|
3
|
+
-keepclasseswithmembers class com.eclipsesource.v8.** {
|
|
4
|
+
native <methods>;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
# FlexboxLayout
|
|
8
|
+
-keep class com.google.android.flexbox.** { *; }
|
|
9
|
+
|
|
10
|
+
# Coil image loading
|
|
11
|
+
-dontwarn coil.**
|
|
12
|
+
|
|
13
|
+
# OkHttp
|
|
14
|
+
-dontwarn okhttp3.**
|
|
15
|
+
-dontwarn okio.**
|
|
16
|
+
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
|
|
17
|
+
|
|
18
|
+
# Kotlin serialization
|
|
19
|
+
-keepattributes *Annotation*, InnerClasses
|
|
20
|
+
-dontnote kotlinx.serialization.AnnotationsKt
|
|
21
|
+
|
|
22
|
+
# Vue Native Core — keep all public API
|
|
23
|
+
-keep public class com.vuenative.core.VueNativeActivity { *; }
|
|
24
|
+
-keep public class com.vuenative.core.JSRuntime { *; }
|
|
25
|
+
-keep public class com.vuenative.core.NativeBridge { *; }
|
|
26
|
+
-keep public class com.vuenative.core.NativeModule { *; }
|
|
27
|
+
-keep public class com.vuenative.core.NativeModuleRegistry { *; }
|
|
28
|
+
|
|
29
|
+
# Biometric
|
|
30
|
+
-keep class androidx.biometric.** { *; }
|
|
31
|
+
|
|
32
|
+
# SwipeRefreshLayout
|
|
33
|
+
-keep class androidx.swiperefreshlayout.** { *; }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
|
+
|
|
4
|
+
<!-- Permissions used by native modules -->
|
|
5
|
+
<uses-permission android:name="android.permission.INTERNET" />
|
|
6
|
+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
7
|
+
<uses-permission android:name="android.permission.VIBRATE" />
|
|
8
|
+
<uses-permission android:name="android.permission.CAMERA" />
|
|
9
|
+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
|
|
10
|
+
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
|
11
|
+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
12
|
+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
13
|
+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
14
|
+
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
|
15
|
+
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
|
|
16
|
+
|
|
17
|
+
</manifest>
|
package/native/android/VueNativeCore/src/main/kotlin/com/vuenative/core/Bridge/ErrorOverlayView.kt
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
package com.vuenative.core
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.graphics.Color
|
|
5
|
+
import android.graphics.Typeface
|
|
6
|
+
import android.util.TypedValue
|
|
7
|
+
import android.view.Gravity
|
|
8
|
+
import android.view.ViewGroup
|
|
9
|
+
import android.widget.Button
|
|
10
|
+
import android.widget.FrameLayout
|
|
11
|
+
import android.widget.LinearLayout
|
|
12
|
+
import android.widget.ScrollView
|
|
13
|
+
import android.widget.TextView
|
|
14
|
+
import androidx.appcompat.app.AppCompatActivity
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Full-screen debug error overlay shown in DEBUG builds when a JS error occurs.
|
|
18
|
+
*/
|
|
19
|
+
object ErrorOverlayView {
|
|
20
|
+
|
|
21
|
+
fun show(context: Context, error: String) {
|
|
22
|
+
val activity = context as? AppCompatActivity ?: return
|
|
23
|
+
activity.runOnUiThread {
|
|
24
|
+
val decorView = activity.window.decorView as? ViewGroup ?: return@runOnUiThread
|
|
25
|
+
|
|
26
|
+
// Remove existing overlay
|
|
27
|
+
decorView.findViewWithTag<FrameLayout>("vue_native_error_overlay")?.let {
|
|
28
|
+
decorView.removeView(it)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
val dp = context.resources.displayMetrics.density
|
|
32
|
+
|
|
33
|
+
val overlay = FrameLayout(context).apply {
|
|
34
|
+
tag = "vue_native_error_overlay"
|
|
35
|
+
setBackgroundColor(Color.parseColor("#CC1A1A1A"))
|
|
36
|
+
layoutParams = FrameLayout.LayoutParams(
|
|
37
|
+
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
38
|
+
ViewGroup.LayoutParams.MATCH_PARENT
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
val card = LinearLayout(context).apply {
|
|
43
|
+
orientation = LinearLayout.VERTICAL
|
|
44
|
+
setBackgroundColor(Color.parseColor("#FF1A1A1A"))
|
|
45
|
+
setPadding(
|
|
46
|
+
(16 * dp).toInt(), (16 * dp).toInt(),
|
|
47
|
+
(16 * dp).toInt(), (16 * dp).toInt()
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
val title = TextView(context).apply {
|
|
52
|
+
text = "Vue Native JS Error"
|
|
53
|
+
setTextColor(Color.RED)
|
|
54
|
+
setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f)
|
|
55
|
+
setTypeface(null, Typeface.BOLD)
|
|
56
|
+
setPadding(0, 0, 0, (12 * dp).toInt())
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
val scroll = ScrollView(context).apply {
|
|
60
|
+
layoutParams = LinearLayout.LayoutParams(
|
|
61
|
+
ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
val errorText = TextView(context).apply {
|
|
66
|
+
text = error
|
|
67
|
+
setTextColor(Color.parseColor("#FFCC00"))
|
|
68
|
+
setTextSize(TypedValue.COMPLEX_UNIT_SP, 12f)
|
|
69
|
+
setTypeface(Typeface.MONOSPACE)
|
|
70
|
+
setPadding((8 * dp).toInt(), (8 * dp).toInt(), (8 * dp).toInt(), (8 * dp).toInt())
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
val dismiss = Button(context).apply {
|
|
74
|
+
text = "Dismiss"
|
|
75
|
+
setOnClickListener { decorView.removeView(overlay) }
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
scroll.addView(errorText)
|
|
79
|
+
card.addView(title)
|
|
80
|
+
card.addView(scroll)
|
|
81
|
+
card.addView(dismiss)
|
|
82
|
+
|
|
83
|
+
val lp = FrameLayout.LayoutParams(
|
|
84
|
+
FrameLayout.LayoutParams.MATCH_PARENT,
|
|
85
|
+
(400 * dp).toInt(),
|
|
86
|
+
Gravity.CENTER
|
|
87
|
+
).apply {
|
|
88
|
+
setMargins((16 * dp).toInt(), 0, (16 * dp).toInt(), 0)
|
|
89
|
+
}
|
|
90
|
+
overlay.addView(card, lp)
|
|
91
|
+
decorView.addView(overlay)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|