Blame view

lib/common/core/app_config_helper.dart 1.28 KB
28f20da9   吴启风   feat:针对apple审核对支付...
1
  import 'dart:ffi';
caec5687   吴启风   feat:header传应用版本号
2
  import 'dart:io';
28f20da9   吴启风   feat:针对apple审核对支付...
3
  
caec5687   吴启风   feat:header传应用版本号
4
5
  import 'package:flutter/cupertino.dart';
  import 'package:package_info_plus/package_info_plus.dart';
28f20da9   吴启风   feat:针对apple审核对支付...
6
7
8
9
10
11
12
  import 'package:wow_english/common/core/user_util.dart';
  
  import '../../models/app_config_entity.dart';
  import '../request/dao/system_dao.dart';
  
  class AppConfigHelper {
  
cde7505e   吴启风   feat:应用内升级
13
    static AppConfigEntity? configEntityEntity;
28f20da9   吴启风   feat:针对apple审核对支付...
14
  
cde7505e   吴启风   feat:应用内升级
15
    static String _versionCode = '';
caec5687   吴启风   feat:header传应用版本号
16
  
cde7505e   吴启风   feat:应用内升级
17
18
19
20
21
    // 获取用户信息
    static Future<AppConfigEntity?> getAppConfig() async {
      if (configEntityEntity != null) {
        return configEntityEntity;
      }
28f20da9   吴启风   feat:针对apple审核对支付...
22
      configEntityEntity = await SystemDao.getAppConfig();
cde7505e   吴启风   feat:应用内升级
23
      return configEntityEntity;
28f20da9   吴启风   feat:针对apple审核对支付...
24
25
26
27
28
29
    }
  
    // 是否需要隐藏...
    static bool shouldHidePay() {
      return configEntityEntity?.isAppReviewing() == true || UserUtil.getUser()?.phoneNum == "17730280759";
    }
caec5687   吴启风   feat:header传应用版本号
30
31
32
  
    // 获取app版本号
    static Future<String> getAppVersion() async {
cde7505e   吴启风   feat:应用内升级
33
34
      if (_versionCode.isNotEmpty) {
        return _versionCode;
caec5687   吴启风   feat:header传应用版本号
35
36
      }
      PackageInfo packageInfo = await PackageInfo.fromPlatform();
cde7505e   吴启风   feat:应用内升级
37
38
39
      String versionName = packageInfo.version; // 版本号
      String versionCode = packageInfo.buildNumber; // 构建号
      _versionCode = versionCode;
caec5687   吴启风   feat:header传应用版本号
40
  
cde7505e   吴启风   feat:应用内升级
41
      debugPrint('versionName=$versionName versionCode=$versionCode platForm=${Platform.operatingSystem}');
caec5687   吴启风   feat:header传应用版本号
42
43
      return versionCode;
    }
28f20da9   吴启风   feat:针对apple审核对支付...
44
  }