capacitor.config.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import { CapacitorConfig } from '@capacitor/cli';
  2. import { updateVersion } from './scripts/sync-version';
  3. updateVersion()
  4. const config: CapacitorConfig = {
  5. appId: 'com.example.app',
  6. appName: 'wallet_app',
  7. webDir: 'dist',
  8. // 开发服务器配置(热更新用)
  9. server: {
  10. url: 'http://192.168.0.59:5173',
  11. cleartext: true, // 允许HTTP明文通信(仅开发环境)
  12. allowNavigation: ['*'] // 允许任意URL导航
  13. },
  14. // 插件配置
  15. plugins: {
  16. SplashScreen: {
  17. launchShowDuration: 3000,
  18. launchAutoHide: true,
  19. backgroundColor: '#ffffffff', // ARGB格式白色背景
  20. androidScaleType: 'CENTER_CROP',
  21. showSpinner: false,
  22. androidSpinnerStyle: 'large',
  23. iosSpinnerStyle: 'small',
  24. spinnerColor: '#999999',
  25. splashFullScreen: true,
  26. splashImmersive: true,
  27. androidSplashResourceName: 'splash',
  28. useDialog: false
  29. },
  30. CapacitorAssets: {
  31. iconBackgroundColor: '#ffffff' // 应用图标背景色
  32. },
  33. // 注意:原JSON中嵌套了重复的"plugins"键,已修正
  34. PushNotifications: {
  35. presentationOptions: ['badge', 'sound', 'alert']
  36. }
  37. },
  38. // 资源文件配置
  39. // assets: {
  40. // splash: {
  41. // src: 'assets/splash.png', // 启动图路径
  42. // android: true,
  43. // ios: true
  44. // }
  45. // },
  46. // iOS专属配置
  47. ios: {
  48. scheme: 'App',
  49. scrollEnabled: true,
  50. },
  51. // Android专属配置
  52. android: {
  53. allowMixedContent: true, // 允许混合HTTP/HTTPS内容
  54. useLegacyBridge: true, // 使用旧版桥接(兼容性)
  55. // 签名证书配置(建议通过环境变量注入敏感信息)
  56. buildOptions: {
  57. keystorePath: 'f62.keystore',
  58. keystoreAlias: 'f62', // // 生成时指定的别名
  59. keystorePassword: 'LkSvN1Ys', // 从环境变量读取
  60. keystoreAliasPassword: 'LkSvN1Ys'
  61. }
  62. }
  63. };
  64. export default config;