Skip to content

Commit 76eb6be

Browse files
committed
Merge branch 'main' of github.com:Sjj1024/PakePlus-Android
merge
2 parents 9b331a8 + ef9ac10 commit 76eb6be

File tree

5 files changed

+46
-23
lines changed

5 files changed

+46
-23
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
mv app-debug.apk ${{ env.NAME }}-v${{ env.VERSION }}.apk
5252
5353
- name: Create GitHub Release
54-
uses: softprops/action-gh-release@v2
54+
uses: softprops/action-gh-release@v1
5555
with:
5656
files: app/build/outputs/apk/debug/*.apk
5757
tag_name: '${{ env.NAME }}'

app/src/main/java/com/app/pakeplus/MainActivity.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ import android.webkit.WebResourceRequest
1111
import android.webkit.WebView
1212
import android.webkit.WebViewClient
1313
import androidx.activity.enableEdgeToEdge
14-
//import android.view.Menu
15-
//import android.view.WindowInsets
16-
//import com.google.android.material.snackbar.Snackbar
17-
//import com.google.android.material.navigation.NavigationView
18-
//import androidx.navigation.findNavController
19-
//import androidx.navigation.ui.AppBarConfiguration
20-
//import androidx.navigation.ui.navigateUp
21-
//import androidx.navigation.ui.setupActionBarWithNavController
22-
//import androidx.navigation.ui.setupWithNavController
23-
//import androidx.drawerlayout.widget.DrawerLayout
24-
//import com.app.pakeplus.databinding.ActivityMainBinding
14+
// import android.view.Menu
15+
// import android.view.WindowInsets
16+
// import com.google.android.material.snackbar.Snackbar
17+
// import com.google.android.material.navigation.NavigationView
18+
// import androidx.navigation.findNavController
19+
// import androidx.navigation.ui.AppBarConfiguration
20+
// import androidx.navigation.ui.navigateUp
21+
// import androidx.navigation.ui.setupActionBarWithNavController
22+
// import androidx.navigation.ui.setupWithNavController
23+
// import androidx.drawerlayout.widget.DrawerLayout
24+
// import com.app.pakeplus.databinding.ActivityMainBinding
2525
import androidx.appcompat.app.AppCompatActivity
2626
import androidx.core.view.GestureDetectorCompat
2727
import androidx.core.view.ViewCompat
@@ -59,8 +59,8 @@ class MainActivity : AppCompatActivity() {
5959
setSupportMultipleWindows(true)
6060
}
6161

62-
// webView.settings.userAgentString =
63-
// "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"
62+
// webView.settings.userAgentString = ""
63+
6464
webView.settings.loadWithOverviewMode = true
6565
webView.settings.setSupportZoom(false)
6666

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "Pake Plus Android",
55
"main": "index.js",
66
"scripts": {
7-
"pp:worker": "node ./scripts/ppworker.cjs"
7+
"pp:worker": "node ./scripts/ppworker.cjs",
8+
"restore": "git restore ."
89
},
910
"keywords": [
1011
"pakeplus",

scripts/ppconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@
105105
"fontSize": 16,
106106
"fontWeight": "bold",
107107
"tabBarItem": []
108+
},
109+
"webview": {
110+
"userAgent": "",
111+
"javaScriptEnabled": true,
112+
"domStorageEnabled": true,
113+
"allowFileAccess": true,
114+
"loadWithOverviewMode": true,
115+
"setSupportZoom": true,
116+
"clearCache": true
108117
}
109118
},
110119
"ios": {

scripts/ppworker.cjs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ const updateAppName = async (androidResDir, appName) => {
133133
}
134134
}
135135

136-
const updateWebEnv = async (androidResDir, webUrl, debug) => {
136+
const updateWebEnv = async (androidResDir, webUrl, debug, webview) => {
137137
try {
138+
const { userAgent } = webview
139+
138140
// Assuming MainActivity.kt is in the standard location
139141
const mainActivityPath = path.join(
140142
androidResDir.replace('res', ''),
@@ -167,6 +169,15 @@ const updateWebEnv = async (androidResDir, webUrl, debug) => {
167169
'private var debug = true'
168170
)
169171
}
172+
173+
// update webview userAgent
174+
if (userAgent) {
175+
updatedContent = updatedContent.replace(
176+
'// webView.settings.userAgentString = ""',
177+
`webView.settings.userAgentString = "${userAgent}"`
178+
)
179+
}
180+
170181
await fs.writeFile(mainActivityPath, updatedContent)
171182
console.log(`✅ Updated web URL to: ${webUrl}`)
172183
} catch (error) {
@@ -270,6 +281,7 @@ const updateAndroidId = async (id) => {
270281

271282
// Main execution
272283
const main = async () => {
284+
const { webview } = ppconfig.phone
273285
const {
274286
name,
275287
version,
@@ -282,6 +294,7 @@ const main = async () => {
282294
showName,
283295
debug,
284296
} = ppconfig.android
297+
285298
const outPath = path.resolve(output)
286299
await generateAdaptiveIcons(input, outPath)
287300

@@ -293,7 +306,7 @@ const main = async () => {
293306
await updateAppName(dest, showName)
294307

295308
// Update web URL if provided
296-
await updateWebEnv(dest, webUrl, debug)
309+
await updateWebEnv(dest, webUrl, debug, webview)
297310

298311
// 删除根目录的res
299312
await fs.remove(outPath)
@@ -309,12 +322,12 @@ const main = async () => {
309322
}
310323

311324
// run
312-
try {
313-
;(async () => {
325+
;(async () => {
326+
try {
314327
console.log('🚀 worker start')
315328
await main()
316329
console.log('🚀 worker end')
317-
})()
318-
} catch (error) {
319-
console.error('❌ Worker Error:', error)
320-
}
330+
} catch (error) {
331+
console.error('❌ Worker Error:', error)
332+
}
333+
})()

0 commit comments

Comments
 (0)