Commit f6c73562c11a3695a1a2e6df1a15a2e832e73c03

Authored by 吴启风
1 parent 7d417b04

feat:修改环境变量为生产环境

lib/common/core/app_consts.dart
... ... @@ -12,6 +12,6 @@ class AppConsts {
12 12  
13 13 /// 先声SDK
14 14 static String xsAppKey = 'a418';
15   - static String xsAppSecretKey = BasicConfig().isTestDev?'1a16f31f2611bf32fb7b3fc38f5b2c81':'c11163aa6c834a028da4a4b30955be99';
16   - static String xsAppService = BasicConfig().isTestDev?'ws://trial.cloud.ssapi.cn:8080':'"wss://api.cloud.ssapi.cn';
  15 + static String xsAppSecretKey = BasicConfig.isTestDev?'1a16f31f2611bf32fb7b3fc38f5b2c81':'c11163aa6c834a028da4a4b30955be99';
  16 + static String xsAppService = BasicConfig.isTestDev?'ws://trial.cloud.ssapi.cn:8080':'"wss://api.cloud.ssapi.cn';
17 17 }
... ...
lib/common/request/basic_config.dart
  1 +import 'package:flutter/cupertino.dart';
  2 +
1 3 class BasicConfig {
2   - bool isTestDev = true;
3   - // bool isTestDev = false;
  4 + // static bool isTestDev = true;
  5 + static bool isTestDev = false;
  6 +
  7 +
  8 + // 暂时未启用
  9 + static bool isEnvProd() {
  10 + bool kReleaseMode = const bool.fromEnvironment('dart.vm.product');
  11 + if (kReleaseMode) {
  12 + debugPrint("dart.vm.product-现在是release环境.");
  13 + } else {
  14 + debugPrint("dart.vm.product-现在是debug环境.");
  15 + }
  16 + return kReleaseMode;
  17 + }
  18 +
4 19 }
... ...
lib/common/request/config.dart
... ... @@ -4,7 +4,7 @@ import 'package:wow_english/common/request/basic_config.dart';
4 4 class RequestConfig {
5 5 static String baseUrlDev = 'http://wow-app.dev.kouyuxingqiu.com/';
6 6 static String baseUrlProd = 'https://app-api.wowenglish.com.cn/';
7   - static String baseUrl = BasicConfig().isTestDev ? baseUrlDev : baseUrlProd;
  7 + static String baseUrl = BasicConfig.isTestDev ? baseUrlDev : baseUrlProd;
8 8  
9 9 static const connectTimeout = Duration(seconds: 15);
10 10 static const successCode = 200;
... ...
lib/utils/log_util.dart
... ... @@ -3,7 +3,7 @@ import 'package:wow_english/common/request/basic_config.dart';
3 3 enum LogLevel { debug, info, warning, error }
4 4  
5 5 class Log {
6   - static LogLevel level = BasicConfig().isTestDev ? LogLevel.debug : LogLevel.error;
  6 + static LogLevel level = BasicConfig.isTestDev ? LogLevel.debug : LogLevel.error;
7 7  
8 8 /// debug
9 9 static void d(Object? object) {
... ...