Commit bdd7ee995a495823e23ffb22a10bf2928bbdf19a
1 parent
ba96a4bc
隐私协议文案及新入口
Showing
4 changed files
with
86 additions
and
5 deletions
android/app/build.gradle
| @@ -24,6 +24,7 @@ if (flutterVersionName == null) { | @@ -24,6 +24,7 @@ if (flutterVersionName == null) { | ||
| 24 | apply plugin: 'com.android.application' | 24 | apply plugin: 'com.android.application' |
| 25 | apply plugin: 'kotlin-android' | 25 | apply plugin: 'kotlin-android' |
| 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" |
| 27 | +apply from: "../archive_apk.gradle" | ||
| 27 | 28 | ||
| 28 | android { | 29 | android { |
| 29 | namespace "com.kouyuxingqiu.wow_english" | 30 | namespace "com.kouyuxingqiu.wow_english" |
| @@ -71,6 +72,17 @@ android { | @@ -71,6 +72,17 @@ android { | ||
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | buildTypes { | 74 | buildTypes { |
| 75 | + android.applicationVariants.all { | ||
| 76 | + variant -> | ||
| 77 | + variant.outputs.all { | ||
| 78 | + output -> | ||
| 79 | + output.outputFileName = "wow_${buildType.name}" + | ||
| 80 | + "_${defaultConfig.versionName}(${defaultConfig.versionCode})" + | ||
| 81 | + "_" + new Date().format("yyyy-MM-dd_HH-mm", TimeZone.getDefault()) + | ||
| 82 | + ".apk" | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + | ||
| 74 | debug { | 86 | debug { |
| 75 | signingConfig signingConfigs.release | 87 | signingConfig signingConfigs.release |
| 76 | minifyEnabled false | 88 | minifyEnabled false |
android/archive_apk.gradle
0 → 100644
| 1 | +android.applicationVariants.all { variant -> | ||
| 2 | + if (variant.buildType.name != 'release') { | ||
| 3 | + println("archive apk: current buildType=[${variant.buildType.name}], not release, cancel copy.") | ||
| 4 | + return | ||
| 5 | + } | ||
| 6 | + // 我嫌找起来麻烦才写的这个东西,所以直接放到下载文件里, /Users/key/Downloads/kyxq_archive | ||
| 7 | + File desFilePath = new File("${System.properties['user.home']}/Downloads/wow_archive") | ||
| 8 | + if (!desFilePath.exists()) { | ||
| 9 | + println("archive apk: you are not Key, return.") | ||
| 10 | + return | ||
| 11 | + } | ||
| 12 | + // 简化版可以:variant.assemble.doLast | ||
| 13 | + /*variant.assemble.doLast { | ||
| 14 | + println("archive apk: ${variant.outputs[0].outputFile.absolutePath} copy to: ${desFilePath.absolutePath}, exists=${desFilePath.exists()}") | ||
| 15 | + try { | ||
| 16 | + copy { | ||
| 17 | + from variant.outputs[0].outputFile | ||
| 18 | + into desFilePath | ||
| 19 | + } | ||
| 20 | + } catch (Exception e) { | ||
| 21 | + e.printStackTrace() | ||
| 22 | + } | ||
| 23 | + }*/ | ||
| 24 | + | ||
| 25 | + variant.assembleProvider.configure { | ||
| 26 | + doLast { | ||
| 27 | + variant.outputs.all { | ||
| 28 | + println("archive apk: copy from ${outputFile}") | ||
| 29 | + println("archive apk: copy to ${desFilePath.absolutePath}/${outputFileName}") | ||
| 30 | + try { | ||
| 31 | + // 删除同一分钟的编译文件 | ||
| 32 | + File desFile = new File(desFilePath, outputFileName) | ||
| 33 | + if (desFile.exists()) { | ||
| 34 | + boolean delete = desFile.delete() | ||
| 35 | + println("archive apk: the same name File: ${desFile.name} has been deleted(${delete}).") | ||
| 36 | + } | ||
| 37 | + int keepCount = 5 | ||
| 38 | + File[] files = desFilePath.listFiles() | ||
| 39 | + if (files.length >= keepCount) { | ||
| 40 | + // 按最后修改时间排序,升序(最旧的文件在前) | ||
| 41 | + files = files.sort { it.lastModified() } | ||
| 42 | + files.take(files.length - keepCount + 1).each { | ||
| 43 | + boolean delete = it.delete() | ||
| 44 | + println("archive apk: old File: ${it.name} has been deleted(${delete}).") | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + File destFile = new File(desFilePath, outputFileName) | ||
| 48 | + boolean moved = outputFile.renameTo(destFile) | ||
| 49 | + println("archive apk: current archive count=${desFilePath.listFiles().length}. moved=${moved}") | ||
| 50 | + } catch (Exception e) { | ||
| 51 | + e.printStackTrace() | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | +} |
lib/pages/login/loginpage/login_page.dart
| @@ -101,7 +101,7 @@ class _LoginPageView extends StatelessWidget { | @@ -101,7 +101,7 @@ class _LoginPageView extends StatelessWidget { | ||
| 101 | color: const Color(0xFF333333), | 101 | color: const Color(0xFF333333), |
| 102 | )), | 102 | )), |
| 103 | TextSpan( | 103 | TextSpan( |
| 104 | - text: '《用户隐私协议》', | 104 | + text: '《用户协议》', |
| 105 | style: TextStyle( | 105 | style: TextStyle( |
| 106 | fontSize: 12.sp, | 106 | fontSize: 12.sp, |
| 107 | color: const Color(0xFF333333), | 107 | color: const Color(0xFF333333), |
| @@ -110,7 +110,7 @@ class _LoginPageView extends StatelessWidget { | @@ -110,7 +110,7 @@ class _LoginPageView extends StatelessWidget { | ||
| 110 | ..onTap = () { | 110 | ..onTap = () { |
| 111 | Navigator.of(context).pushNamed(AppRouteName.webView, arguments: { | 111 | Navigator.of(context).pushNamed(AppRouteName.webView, arguments: { |
| 112 | 'urlStr': AppConsts.userPrivacyPolicyUrl, | 112 | 'urlStr': AppConsts.userPrivacyPolicyUrl, |
| 113 | - 'webViewTitle': '用户隐私协议' | 113 | + 'webViewTitle': '用户协议' |
| 114 | }); | 114 | }); |
| 115 | }), | 115 | }), |
| 116 | TextSpan( | 116 | TextSpan( |
| @@ -122,7 +122,7 @@ class _LoginPageView extends StatelessWidget { | @@ -122,7 +122,7 @@ class _LoginPageView extends StatelessWidget { | ||
| 122 | ..onTap = () { | 122 | ..onTap = () { |
| 123 | Navigator.of(context).pushNamed(AppRouteName.webView, arguments: { | 123 | Navigator.of(context).pushNamed(AppRouteName.webView, arguments: { |
| 124 | 'urlStr': AppConsts.childrenPrivacyPolicyUrl, | 124 | 'urlStr': AppConsts.childrenPrivacyPolicyUrl, |
| 125 | - 'webViewTitle': '儿童隐私协议' | 125 | + 'webViewTitle': '儿童隐私政策' |
| 126 | }); | 126 | }); |
| 127 | }) | 127 | }) |
| 128 | ]), | 128 | ]), |
lib/pages/user/user_page.dart
| @@ -207,12 +207,25 @@ class _UserView extends StatelessWidget { | @@ -207,12 +207,25 @@ class _UserView extends StatelessWidget { | ||
| 207 | onPressed: () { | 207 | onPressed: () { |
| 208 | pushNamed(AppRouteName.webView, arguments: { | 208 | pushNamed(AppRouteName.webView, arguments: { |
| 209 | 'urlStr': AppConsts.userPrivacyPolicyUrl, | 209 | 'urlStr': AppConsts.userPrivacyPolicyUrl, |
| 210 | - 'webViewTitle': '隐私协议' | 210 | + 'webViewTitle': '用户协议' |
| 211 | }); | 211 | }); |
| 212 | }, | 212 | }, |
| 213 | style: normalButtonStyle, | 213 | style: normalButtonStyle, |
| 214 | child: Text( | 214 | child: Text( |
| 215 | - "隐私协议", | 215 | + "用户协议", |
| 216 | + style: textStyle21sp, | ||
| 217 | + )), | ||
| 218 | + 12.verticalSpace, | ||
| 219 | + OutlinedButton( | ||
| 220 | + onPressed: () { | ||
| 221 | + pushNamed(AppRouteName.webView, arguments: { | ||
| 222 | + 'urlStr': AppConsts.childrenPrivacyPolicyUrl, | ||
| 223 | + 'webViewTitle': '儿童隐私政策' | ||
| 224 | + }); | ||
| 225 | + }, | ||
| 226 | + style: normalButtonStyle, | ||
| 227 | + child: Text( | ||
| 228 | + "儿童隐私政策", | ||
| 216 | style: textStyle21sp, | 229 | style: textStyle21sp, |
| 217 | )), | 230 | )), |
| 218 | 12.verticalSpace, | 231 | 12.verticalSpace, |