Skip to content

Commit a3f051f

Browse files
committed
feat: native stream fetch & android update
1 parent 1fe9fe3 commit a3f051f

28 files changed

+734
-158
lines changed

.github/workflows/build-capacitor.yml

+19
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ jobs:
6060
- name: Build app bundle
6161
run: npx cap build android --keystorepath release.decrypted.jks --keystorepass "${{ secrets.KEYSTORE_PASSWORD }}" --keystorealias "${{ secrets.KEYSTORE_ALIAS }}" --keystorealiaspass "${{ secrets.KEYSTORE_ALIAS_PASSWORD }}" --androidreleasetype APK
6262

63+
- name: Zip spa bundle
64+
uses: montudor/action-zip@v1
65+
with:
66+
args: zip -qq -r spa.zip dist/spa
67+
6368
- name: Upload an Asset in GitHub Release
6469
uses: "actions/github-script@v6"
6570
with:
@@ -73,3 +78,17 @@ jobs:
7378
release_id: ${{ env.RELEASE_ID }},
7479
data: await fs.readFile('./android/app/build/outputs/apk/release/app-release-signed.apk')
7580
});
81+
await github.rest.repos.uploadReleaseAsset({
82+
name: 'spa_bundle_${{ github.ref_name }}.zip',
83+
owner: context.repo.owner,
84+
repo: context.repo.repo,
85+
release_id: ${{ env.RELEASE_ID }},
86+
data: await fs.readFile('./spa.zip')
87+
});
88+
await github.rest.repos.uploadReleaseAsset({
89+
name: 'version.json',
90+
owner: context.repo.owner,
91+
repo: context.repo.repo,
92+
release_id: ${{ env.RELEASE_ID }},
93+
data: await fs.readFile('./src/version.json')
94+
});

android/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android {
88
minSdkVersion rootProject.ext.minSdkVersion
99
targetSdkVersion rootProject.ext.targetSdkVersion
1010
versionCode 10400
11-
versionName "v1.4.0"
11+
versionName "Alice-v1.4.0-beta"
1212
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1313
aaptOptions {
1414
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.

android/app/capacitor.build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ dependencies {
1212
implementation project(':capacitor-app')
1313
implementation project(':capacitor-clipboard')
1414
implementation project(':capacitor-status-bar')
15+
implementation project(':capawesome-capacitor-live-update')
16+
implementation project(':capacitor-stream-fetch')
1517

1618
}
1719

android/build.gradle

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
4+
5+
ext {
6+
kotlin_version = '1.9.24'
7+
}
58
repositories {
69
google()
710
mavenCentral()
811
}
912
dependencies {
1013
classpath 'com.android.tools.build:gradle:8.7.2'
1114
classpath 'com.google.gms:google-services:4.4.2'
15+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1216

1317
// NOTE: Do not place your application dependencies here; they belong
1418
// in the individual module build.gradle files

android/capacitor.settings.gradle

+6
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ project(':capacitor-clipboard').projectDir = new File('../node_modules/.pnpm/@ca
1010

1111
include ':capacitor-status-bar'
1212
project(':capacitor-status-bar').projectDir = new File('../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/status-bar/android')
13+
14+
include ':capawesome-capacitor-live-update'
15+
project(':capawesome-capacitor-live-update').projectDir = new File('../node_modules/.pnpm/@capawesome+capacitor-live-_20a03f2114908b7e52112a3ad72f2fa4/node_modules/@capawesome/capacitor-live-update/android')
16+
17+
include ':capacitor-stream-fetch'
18+
project(':capacitor-stream-fetch').projectDir = new File('../../../Github/capacitor-stream-fetch/android')

capacitor-http-stream/package.json

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "capacitor-http-stream",
3+
"version": "0.1.0",
4+
"description": "Capacitor plugin for HTTP streaming",
5+
"main": "dist/plugin.cjs.js",
6+
"module": "dist/esm/index.js",
7+
"types": "dist/esm/index.d.ts",
8+
"unpkg": "dist/plugin.js",
9+
"files": [
10+
"android/src/main/",
11+
"android/build.gradle",
12+
"dist/",
13+
"ios/Plugin/",
14+
"CapacitorHttpStream.podspec"
15+
],
16+
"author": "Your Name",
17+
"license": "MIT",
18+
"repository": {
19+
"type": "git",
20+
"url": "git+https://github.com/yourusername/capacitor-http-stream.git"
21+
},
22+
"bugs": {
23+
"url": "https://github.com/yourusername/capacitor-http-stream/issues"
24+
},
25+
"keywords": [
26+
"capacitor",
27+
"plugin",
28+
"native",
29+
"http",
30+
"stream"
31+
],
32+
"scripts": {
33+
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
34+
"verify:ios": "xcodebuild -scheme CapacitorStreamFetch -destination generic/platform=iOS",
35+
"verify:android": "cd android && ./gradlew clean build test && cd ..",
36+
"verify:web": "npm run build",
37+
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
38+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
39+
"eslint": "eslint . --ext ts",
40+
"prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
41+
"swiftlint": "node-swiftlint",
42+
"docgen": "docgen --api CapacitorStreamFetchPlugin --output-readme README.md --output-json dist/docs.json",
43+
"build": "npm run clean && tsc && rollup -c rollup.config.mjs",
44+
"clean": "rimraf ./dist",
45+
"watch": "tsc --watch",
46+
"prepublishOnly": "npm run build"
47+
},
48+
"devDependencies": {
49+
"@capacitor/android": "^7.0.0",
50+
"@capacitor/core": "^7.0.0",
51+
"@capacitor/docgen": "^0.3.0",
52+
"@capacitor/ios": "^7.0.0",
53+
"@ionic/eslint-config": "^0.4.0",
54+
"@ionic/prettier-config": "^4.0.0",
55+
"@ionic/swiftlint-config": "^2.0.0",
56+
"eslint": "^8.57.0",
57+
"prettier": "^3.4.2",
58+
"prettier-plugin-java": "^2.6.6",
59+
"rimraf": "^6.0.1",
60+
"rollup": "^4.30.1",
61+
"swiftlint": "^2.0.0",
62+
"typescript": "~4.1.5"
63+
},
64+
"peerDependencies": {
65+
"@capacitor/core": ">=7.0.0"
66+
},
67+
"capacitor": {
68+
"android": {
69+
"src": "android"
70+
},
71+
"ios": {
72+
"src": "ios"
73+
}
74+
}
75+
}

capacitor.config.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ const config: CapacitorConfig = {
55
appName: 'AIaW',
66
webDir: 'dist/spa',
77
plugins: {
8-
CapacitorHttp: {
9-
enabled: true
10-
},
118
StatusBar: {
12-
overlaysWebView: false
9+
overlaysWebView: false,
10+
backgroundColor: '#00000000'
1311
}
1412
}
1513
}

package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aiaw",
3-
"version": "0.0.1",
3+
"version": "1.4.0-beta",
44
"description": "精心设计的 AI (LLM) 客户端。全功能,轻量级;支持多工作区、插件系统、跨平台、本地优先+实时云同步",
55
"productName": "AI as Workspace",
66
"author": "NitroRCr <[email protected]>",
@@ -34,6 +34,7 @@
3434
"@capacitor/core": "^7.0.1",
3535
"@capacitor/ios": "^7.0.1",
3636
"@capacitor/status-bar": "^7.0.0",
37+
"@capawesome/capacitor-live-update": "^7.1.0",
3738
"@cfworker/json-schema": "^2.0.1",
3839
"@chenfengyuan/vue-qrcode": "^2.0.0",
3940
"@gradio/client": "^1.7.1",
@@ -43,13 +44,14 @@
4344
"@quasar/extras": "^1.16.12",
4445
"@sinclair/typebox": "^0.33.12",
4546
"@tauri-apps/plugin-clipboard-manager": "~2",
46-
"@tauri-apps/plugin-http": "~2",
47-
"@tauri-apps/plugin-os": "~2",
47+
"@tauri-apps/plugin-os": "~2.2.0",
48+
"@tauri-apps/plugin-process": "~2",
4849
"@tauri-apps/plugin-shell": "~2.2.0",
4950
"@tauri-apps/plugin-updater": "~2.5.0",
5051
"@vueuse/core": "^11.0.3",
5152
"@vueuse/rxjs": "^11.0.3",
5253
"ai": "^4.1.34",
54+
"capacitor-stream-fetch": "link:/Users/Nitro/Documents/Github/capacitor-stream-fetch",
5355
"codejar": "^4.2.0",
5456
"codejar-linenumbers": "^1.0.1",
5557
"dexie": "^4.0.11",

pnpm-lock.yaml

+23-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/sync-version.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ async function updateVersions() {
1111
tauriConfig.version = versionData.version.replace('v', '')
1212
await fs.writeFile(tauriConfigPath, JSON.stringify(tauriConfig, null, 2))
1313

14+
const packageJsonPath = new URL('../package.json', import.meta.url)
15+
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'))
16+
packageJson.version = versionData.version.replace('v', '')
17+
await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2))
18+
1419
const gradlePath = new URL('../android/app/build.gradle', import.meta.url)
1520
let gradleContent = await fs.readFile(gradlePath, 'utf-8')
1621

@@ -20,7 +25,7 @@ async function updateVersions() {
2025
)
2126
gradleContent = gradleContent.replace(
2227
/versionName\s+["'][^"']*["']/,
23-
`versionName "${versionData.version}"`
28+
`versionName "${versionData.capChannel}-${versionData.version}"`
2429
)
2530

2631
await fs.writeFile(gradlePath, gradleContent)

src-pwa/register-service-worker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ register(process.env.SERVICE_WORKER_FILE, {
3838
.then(data => {
3939
newVersion = data
4040
version.versionCode <= newVersion.forceUpdateFrom && registration.active && Loading.show({
41-
message: t('registerSW.updating')
41+
message: t('update.updating')
4242
})
4343
})
4444
},

0 commit comments

Comments
 (0)