diff --git a/android/app/build.gradle b/android/app/build.gradle index 304ec4a..757c149 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -24,6 +24,7 @@ if (flutterVersionName == null) { apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +apply from: "../archive_apk.gradle" android { namespace "com.kouyuxingqiu.wow_english" @@ -71,6 +72,17 @@ android { } buildTypes { + android.applicationVariants.all { + variant -> + variant.outputs.all { + output -> + output.outputFileName = "wow_${buildType.name}" + + "_${defaultConfig.versionName}(${defaultConfig.versionCode})" + + "_" + new Date().format("yyyy-MM-dd_HH-mm", TimeZone.getDefault()) + + ".apk" + } + } + debug { signingConfig signingConfigs.release minifyEnabled false diff --git a/android/archive_apk.gradle b/android/archive_apk.gradle new file mode 100644 index 0000000..090b1a4 --- /dev/null +++ b/android/archive_apk.gradle @@ -0,0 +1,56 @@ +android.applicationVariants.all { variant -> + if (variant.buildType.name != 'release') { + println("archive apk: current buildType=[${variant.buildType.name}], not release, cancel copy.") + return + } + // 我嫌找起来麻烦才写的这个东西,所以直接放到下载文件里, /Users/key/Downloads/kyxq_archive + File desFilePath = new File("${System.properties['user.home']}/Downloads/wow_archive") + if (!desFilePath.exists()) { + println("archive apk: you are not Key, return.") + return + } + // 简化版可以:variant.assemble.doLast + /*variant.assemble.doLast { + println("archive apk: ${variant.outputs[0].outputFile.absolutePath} copy to: ${desFilePath.absolutePath}, exists=${desFilePath.exists()}") + try { + copy { + from variant.outputs[0].outputFile + into desFilePath + } + } catch (Exception e) { + e.printStackTrace() + } + }*/ + + variant.assembleProvider.configure { + doLast { + variant.outputs.all { + println("archive apk: copy from ${outputFile}") + println("archive apk: copy to ${desFilePath.absolutePath}/${outputFileName}") + try { + // 删除同一分钟的编译文件 + File desFile = new File(desFilePath, outputFileName) + if (desFile.exists()) { + boolean delete = desFile.delete() + println("archive apk: the same name File: ${desFile.name} has been deleted(${delete}).") + } + int keepCount = 5 + File[] files = desFilePath.listFiles() + if (files.length >= keepCount) { + // 按最后修改时间排序,升序(最旧的文件在前) + files = files.sort { it.lastModified() } + files.take(files.length - keepCount + 1).each { + boolean delete = it.delete() + println("archive apk: old File: ${it.name} has been deleted(${delete}).") + } + } + File destFile = new File(desFilePath, outputFileName) + boolean moved = outputFile.renameTo(destFile) + println("archive apk: current archive count=${desFilePath.listFiles().length}. moved=${moved}") + } catch (Exception e) { + e.printStackTrace() + } + } + } + } +} diff --git a/lib/pages/login/loginpage/login_page.dart b/lib/pages/login/loginpage/login_page.dart index 17e943a..28b1d53 100644 --- a/lib/pages/login/loginpage/login_page.dart +++ b/lib/pages/login/loginpage/login_page.dart @@ -101,7 +101,7 @@ class _LoginPageView extends StatelessWidget { color: const Color(0xFF333333), )), TextSpan( - text: '《用户隐私协议》', + text: '《用户协议》', style: TextStyle( fontSize: 12.sp, color: const Color(0xFF333333), @@ -110,7 +110,7 @@ class _LoginPageView extends StatelessWidget { ..onTap = () { Navigator.of(context).pushNamed(AppRouteName.webView, arguments: { 'urlStr': AppConsts.userPrivacyPolicyUrl, - 'webViewTitle': '用户隐私协议' + 'webViewTitle': '用户协议' }); }), TextSpan( @@ -122,7 +122,7 @@ class _LoginPageView extends StatelessWidget { ..onTap = () { Navigator.of(context).pushNamed(AppRouteName.webView, arguments: { 'urlStr': AppConsts.childrenPrivacyPolicyUrl, - 'webViewTitle': '儿童隐私协议' + 'webViewTitle': '儿童隐私政策' }); }) ]), diff --git a/lib/pages/user/user_page.dart b/lib/pages/user/user_page.dart index e70532b..0d8fa27 100644 --- a/lib/pages/user/user_page.dart +++ b/lib/pages/user/user_page.dart @@ -207,12 +207,25 @@ class _UserView extends StatelessWidget { onPressed: () { pushNamed(AppRouteName.webView, arguments: { 'urlStr': AppConsts.userPrivacyPolicyUrl, - 'webViewTitle': '隐私协议' + 'webViewTitle': '用户协议' }); }, style: normalButtonStyle, child: Text( - "隐私协议", + "用户协议", + style: textStyle21sp, + )), + 12.verticalSpace, + OutlinedButton( + onPressed: () { + pushNamed(AppRouteName.webView, arguments: { + 'urlStr': AppConsts.childrenPrivacyPolicyUrl, + 'webViewTitle': '儿童隐私政策' + }); + }, + style: normalButtonStyle, + child: Text( + "儿童隐私政策", style: textStyle21sp, )), 12.verticalSpace,