mirror of
https://github.com/pppscn/SmsForwarder
synced 2024-11-04 06:00:11 +00:00
新增:是否加入SmsF预览体验计划(在线更新每周构建版) #416
This commit is contained in:
parent
65ea7bcf0c
commit
f0ef8e9dcd
@ -39,8 +39,15 @@ android {
|
||||
minSdkVersion build_versions.min_sdk
|
||||
targetSdkVersion build_versions.target_sdk
|
||||
versionCode build_versions.version_code
|
||||
versionName build_versions.version_name
|
||||
//版本号拼接编译日期
|
||||
def date = new Date().format("yyMMdd", TimeZone.getTimeZone("GMT+08"))
|
||||
versionName = "${build_versions.version_name}.${date}"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
//编译时间
|
||||
def time = new Date().format("yyyy-MM-dd HH:mm:ss", TimeZone.getTimeZone("GMT+08"))
|
||||
buildConfigField "String", "BUILD_TIME", "\"${time}\""
|
||||
//Git 的 commit ID
|
||||
buildConfigField "String", "GIT_COMMIT_ID", getGitCommitId()
|
||||
|
||||
multiDexEnabled true
|
||||
//vectorDrawables.useSupportLibrary = true
|
||||
@ -164,12 +171,11 @@ android {
|
||||
android.applicationVariants.configureEach { variant ->
|
||||
// Assigns a different version code for each output APK.
|
||||
variant.outputs.each { output ->
|
||||
def date = new Date().format("yyyyMMdd", TimeZone.getTimeZone("GMT+08"))
|
||||
//noinspection GrDeprecatedAPIUsage
|
||||
def abiName = output.getFilter(com.android.build.OutputFile.ABI)
|
||||
if (abiName == null) abiName = "universal"
|
||||
output.versionCodeOverride = abiCodes.get(abiName, 0) * 100000 + variant.versionCode
|
||||
output.outputFileName = "SmsF_${versionName}_${output.versionCode}_${abiName}_${date}_${variant.name}.apk"
|
||||
output.outputFileName = "SmsF_${versionName}_${output.versionCode}_${abiName}_${variant.name}.apk"
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,3 +323,14 @@ dependencies {
|
||||
apply from: 'x-library.gradle'
|
||||
//walle多渠道打包
|
||||
//apply from: 'multiple-channel.gradle'
|
||||
|
||||
//获取 commit ID
|
||||
static def getGitCommitId() {
|
||||
try {
|
||||
def commitId = 'git rev-parse --short HEAD'.execute().text.trim()
|
||||
return "\"$commitId\""
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace()
|
||||
return "\"\""
|
||||
}
|
||||
}
|
@ -178,7 +178,7 @@ class MainActivity : BaseActivity<ActivityMainBinding?>(), DrawerAdapter.OnItemS
|
||||
//仅当开启自动检查且有网络时自动检查更新/获取提示
|
||||
if (SettingUtils.autoCheckUpdate && NetworkUtils.isHaveInternet()) {
|
||||
showTips(this)
|
||||
XUpdateInit.checkUpdate(this, false)
|
||||
XUpdateInit.checkUpdate(this, false, SettingUtils.joinPreviewProgram)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.idormy.sms.forwarder.App
|
||||
import com.idormy.sms.forwarder.BuildConfig
|
||||
import com.idormy.sms.forwarder.R
|
||||
import com.idormy.sms.forwarder.core.BaseFragment
|
||||
import com.idormy.sms.forwarder.core.webview.AgentWebActivity
|
||||
@ -68,11 +69,19 @@ class AboutFragment : BaseFragment<FragmentAboutBinding?>(), SuperTextView.OnSup
|
||||
binding!!.scbAutoCheckUpdate.setOnCheckedChangeListener { _, isChecked ->
|
||||
SettingUtils.autoCheckUpdate = isChecked
|
||||
}
|
||||
|
||||
binding!!.sbJoinPreviewProgram.isChecked = SettingUtils.joinPreviewProgram
|
||||
binding!!.sbJoinPreviewProgram.setOnCheckedChangeListener { _, isChecked ->
|
||||
SettingUtils.joinPreviewProgram = isChecked
|
||||
if (isChecked) {
|
||||
XToastUtils.success(getString(R.string.join_preview_program_tips))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun initListeners() {
|
||||
binding!!.btnUpdate.setOnClickListener {
|
||||
XUpdateInit.checkUpdate(requireContext(), true)
|
||||
XUpdateInit.checkUpdate(requireContext(), true, SettingUtils.joinPreviewProgram)
|
||||
}
|
||||
binding!!.btnCache.setOnClickListener {
|
||||
HistoryUtils.clearPreference()
|
||||
@ -107,6 +116,8 @@ class AboutFragment : BaseFragment<FragmentAboutBinding?>(), SuperTextView.OnSup
|
||||
AgentWebActivity.goWeb(context, getString(R.string.url_project_gitee))
|
||||
}
|
||||
|
||||
binding!!.menuJoinPreviewProgram.setOnSuperTextViewClickListener(this)
|
||||
binding!!.menuVersion.setOnSuperTextViewClickListener(this)
|
||||
binding!!.menuWechatMiniprogram.setOnSuperTextViewClickListener(this)
|
||||
binding!!.menuDonation.setOnSuperTextViewClickListener(this)
|
||||
binding!!.menuUserProtocol.setOnSuperTextViewClickListener(this)
|
||||
@ -116,6 +127,22 @@ class AboutFragment : BaseFragment<FragmentAboutBinding?>(), SuperTextView.OnSup
|
||||
@SingleClick
|
||||
override fun onClick(v: SuperTextView) {
|
||||
when (v.id) {
|
||||
R.id.menu_join_preview_program -> {
|
||||
XToastUtils.info(getString(R.string.join_preview_program_tips))
|
||||
}
|
||||
|
||||
R.id.menu_version -> {
|
||||
XToastUtils.info(
|
||||
String.format(
|
||||
getString(R.string.about_app_version_tips),
|
||||
AppUtils.getAppVersionName(),
|
||||
AppUtils.getAppVersionCode(),
|
||||
BuildConfig.BUILD_TIME,
|
||||
BuildConfig.GIT_COMMIT_ID
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
R.id.menu_donation -> {
|
||||
previewMarkdown(this, getString(R.string.about_item_donation_link), getString(R.string.url_donation_link), false)
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ object AppUtils {
|
||||
return try {
|
||||
val pm: PackageManager = App.context.packageManager
|
||||
val pi: PackageInfo = pm.getPackageInfo(packageName, 0)
|
||||
pi.versionName
|
||||
pi.versionName ?: ""
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
e.printStackTrace()
|
||||
Log.e("AppUtils", "getAppVersionName: ${e.message}")
|
||||
|
@ -24,6 +24,7 @@ object TaskWorker {
|
||||
|
||||
//初始化相关
|
||||
const val AUTO_CHECK_UPDATE = "auto_check_update"
|
||||
const val JOIN_PREVIEW_PROGRAM = "join_preview_program"
|
||||
const val IS_AGREE_PRIVACY_KEY = "is_agree_privacy_key"
|
||||
|
||||
//数据库
|
||||
@ -180,8 +181,9 @@ const val EVENT_LOAD_APP_LIST = "EVENT_LOAD_APP_LIST"
|
||||
const val EVENT_KEY_SIM_SLOT = "EVENT_KEY_SIM_SLOT"
|
||||
const val EVENT_KEY_PHONE_NUMBERS = "EVENT_KEY_PHONE_NUMBERS"
|
||||
|
||||
//在线升级URL
|
||||
//在线升级&预览计划URL
|
||||
const val KEY_UPDATE_URL = "https://xupdate.ppps.cn/update/checkVersion"
|
||||
const val KEY_PREVIEW_URL = "https://xupdate.ppps.cn/preview/checkVersion"
|
||||
|
||||
//HttpServer相关
|
||||
const val HTTP_SERVER_PORT = 5000
|
||||
|
@ -10,6 +10,9 @@ class SettingUtils private constructor() {
|
||||
//是否启动时检查更新
|
||||
var autoCheckUpdate: Boolean by SharedPreference(AUTO_CHECK_UPDATE, true)
|
||||
|
||||
//是否加入SmsF预览体验计划
|
||||
var joinPreviewProgram: Boolean by SharedPreference(JOIN_PREVIEW_PROGRAM, false)
|
||||
|
||||
//是否同意隐私政策
|
||||
var isAgreePrivacy: Boolean by SharedPreference(IS_AGREE_PRIVACY_KEY, false)
|
||||
|
||||
|
@ -3,6 +3,8 @@ package com.idormy.sms.forwarder.utils.sdkinit
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import com.idormy.sms.forwarder.App
|
||||
import com.idormy.sms.forwarder.BuildConfig
|
||||
import com.idormy.sms.forwarder.utils.KEY_PREVIEW_URL
|
||||
import com.idormy.sms.forwarder.utils.KEY_UPDATE_URL
|
||||
import com.idormy.sms.forwarder.utils.update.CustomUpdateDownloader
|
||||
import com.idormy.sms.forwarder.utils.update.CustomUpdateFailureListener
|
||||
@ -36,17 +38,27 @@ class XUpdateInit private constructor() {
|
||||
//.isAutoMode(false)
|
||||
//设置默认公共请求参数
|
||||
.param("versionCode", UpdateUtils.getVersionCode(application))
|
||||
.param("appKey", application.packageName) //这个必须设置!实现网络请求功能。
|
||||
.param("appKey", application.packageName)
|
||||
//设置预览计划请求参数
|
||||
.param("versionName", UpdateUtils.getVersionName(application))
|
||||
.param("buildTime", BuildConfig.BUILD_TIME)
|
||||
.param("gitCommitId", BuildConfig.GIT_COMMIT_ID)
|
||||
//这个必须设置!实现网络请求功能。
|
||||
.setIUpdateHttpService(XHttpUpdateHttpServiceImpl())
|
||||
.setIUpdateDownLoader(CustomUpdateDownloader()) //这个必须初始化
|
||||
.setIUpdateDownLoader(CustomUpdateDownloader())
|
||||
//这个必须初始化
|
||||
.init(application)
|
||||
}
|
||||
|
||||
/**
|
||||
* 进行版本更新检查
|
||||
*/
|
||||
fun checkUpdate(context: Context, needErrorTip: Boolean) {
|
||||
checkUpdate(context, KEY_UPDATE_URL, needErrorTip)
|
||||
fun checkUpdate(context: Context, needErrorTip: Boolean, joinPreviewProgram: Boolean) {
|
||||
if (joinPreviewProgram) {
|
||||
checkUpdate(context, KEY_PREVIEW_URL, needErrorTip)
|
||||
} else {
|
||||
checkUpdate(context, KEY_UPDATE_URL, needErrorTip)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,7 +73,7 @@ class XUpdateInit private constructor() {
|
||||
return
|
||||
}
|
||||
XUpdate.newBuild(context).updateUrl(url).update()
|
||||
XUpdate.get().setOnUpdateFailureListener(CustomUpdateFailureListener(needErrorTip))
|
||||
XUpdate.get().debug(App.isDebug).setOnUpdateFailureListener(CustomUpdateFailureListener(needErrorTip))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,35 @@
|
||||
android:textColor="@color/xui_config_color_gray_6"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperTextView
|
||||
android:id="@+id/menu_join_preview_program"
|
||||
style="@style/InfoItem.AboutWithBtn"
|
||||
android:layout_marginTop="10dp"
|
||||
app:sLeftTextString="@string/join_preview_program">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_toStartOf="@id/sRightImgId"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.xuexiang.xui.widget.button.switchbutton.SwitchButton
|
||||
android:id="@+id/sb_join_preview_program"
|
||||
style="@style/SwitchButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:ignore="DuplicateSpeakableTextCheck,TouchTargetSizeCheck" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.xuexiang.xui.widget.textview.supertextview.SuperTextView>
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperTextView
|
||||
android:id="@+id/menu_version"
|
||||
style="@style/InfoItem.AboutWithBtn"
|
||||
android:layout_marginTop="15dp"
|
||||
app:sLeftTextString="@string/about_app_version">
|
||||
|
||||
<LinearLayout
|
||||
@ -198,7 +223,7 @@
|
||||
android:id="@+id/copyright"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="@color/xui_config_color_gray_7" />
|
||||
|
@ -41,9 +41,10 @@
|
||||
<string name="menu_help">Help</string>
|
||||
<string name="menu_about">About</string>
|
||||
|
||||
<string name="about_app_version">App Version: %s</string>
|
||||
<string name="about_app_version">AppVer: %s</string>
|
||||
<string name="about_app_version_tips">Version Name: %s\nVersion Code: %s\nBuild Time: %s\nGit Commit ID: %s</string>
|
||||
<string name="about_cache_size">Cache Size: %s</string>
|
||||
<string name="about_frpc_version">Frpc Version:%s</string>
|
||||
<string name="about_frpc_version">FrpcVer: %s</string>
|
||||
<string name="about_item_wechat_miniprogram">WeChat MiniProgram</string>
|
||||
<string name="about_cache_purged">Cache cleared</string>
|
||||
<string name="about_frpc_deleted">Frpc Deleted, App restarting</string>
|
||||
@ -736,9 +737,11 @@
|
||||
<string name="tip_can_not_get_sim_info">The SIM card information in the card slot %s has not been obtained</string>
|
||||
<string name="add">Add</string>
|
||||
<string name="auto_check">Auto check</string>
|
||||
<string name="check_update">Check update</string>
|
||||
<string name="clear_cache">Clear cache</string>
|
||||
<string name="delete_frpc">Delete Frpc</string>
|
||||
<string name="check_update">Check</string>
|
||||
<string name="join_preview_program">Join Preview Program</string>
|
||||
<string name="join_preview_program_tips">Check out weekly builds of SmsF for early access to new features and bug fixes</string>
|
||||
<string name="clear_cache">Clear</string>
|
||||
<string name="delete_frpc">Delete</string>
|
||||
|
||||
<string name="sender_name_status">Channel Name/Status</string>
|
||||
<string name="choose_sender_status">Send Channel/Status</string>
|
||||
|
@ -17,23 +17,21 @@
|
||||
<style name="InfoItem" parent="Container">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">50dp</item>
|
||||
<item name="sLeftViewMarginLeft">10dp</item>
|
||||
<item name="sLeftViewMarginLeft">5dp</item>
|
||||
<item name="sRightViewMarginRight">0dp</item>
|
||||
<item name="sRightIconMarginRight">0dp</item>
|
||||
<item name="sLeftIconMarginLeft">0dp</item>
|
||||
<item name="sLeftTextSize">?attr/xui_config_size_content_text</item>
|
||||
<item name="sLeftTextColor">@color/xui_config_color_title_text</item>
|
||||
<item name="sCenterTextColor">@color/xui_config_color_black</item>
|
||||
<item name="sRightTextColor">@color/xui_config_color_explain_text</item>
|
||||
<item name="sRightTextSize">?attr/xui_config_size_content_text</item>
|
||||
<item name="sLeftTextSize">13sp</item>
|
||||
<item name="sRightTextSize">13sp</item>
|
||||
</style>
|
||||
|
||||
<style name="InfoItem.About">
|
||||
<item name="sLeftViewWidth">110dp</item>
|
||||
<item name="sLeftViewGravity">left_center</item>
|
||||
<item name="sCenterViewGravity">left_center</item>
|
||||
<item name="sCenterViewMarginLeft">25dp</item>
|
||||
<item name="sRightTextSize">?attr/xui_config_size_content_text</item>
|
||||
<item name="sCenterViewMarginLeft">10dp</item>
|
||||
<item name="sRightViewMarginRight">10dp</item>
|
||||
<item name="sRightIconRes">@drawable/icon_arrow_right_grey</item>
|
||||
</style>
|
||||
@ -41,10 +39,8 @@
|
||||
<style name="InfoItem.AboutWithBtn">
|
||||
<item name="sLeftViewGravity">left_center</item>
|
||||
<item name="sCenterViewGravity">left_center</item>
|
||||
<item name="sCenterViewMarginLeft">25dp</item>
|
||||
<item name="sRightTextSize">?attr/xui_config_size_content_text</item>
|
||||
<item name="sCenterViewMarginLeft">10dp</item>
|
||||
<item name="sRightViewMarginRight">10dp</item>
|
||||
<!--<item name="sRightIconRes">@drawable/icon_arrow_right_grey</item>-->
|
||||
</style>
|
||||
|
||||
<style name="PullDownStyle">
|
||||
|
@ -42,6 +42,7 @@
|
||||
<string name="menu_about">关于软件</string>
|
||||
|
||||
<string name="about_app_version">软件版本:%s</string>
|
||||
<string name="about_app_version_tips">版本名称:%s\n版本代码:%s\n构建时间:%s\nGit提交ID:%s</string>
|
||||
<string name="about_cache_size">缓存大小:%s</string>
|
||||
<string name="about_frpc_version">Frpc版本:%s</string>
|
||||
<string name="about_item_wechat_miniprogram">微信小程序</string>
|
||||
@ -738,6 +739,8 @@
|
||||
<string name="add">添加</string>
|
||||
<string name="auto_check">启动时检查</string>
|
||||
<string name="check_update">检查更新</string>
|
||||
<string name="join_preview_program">加入SmsF预览体验计划</string>
|
||||
<string name="join_preview_program_tips">检查SmsF每周构建版更新,率先体验新功能与Bug修复</string>
|
||||
<string name="clear_cache">清理缓存</string>
|
||||
<string name="delete_frpc">删除动态库</string>
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
<string name="menu_about">關於軟體</string>
|
||||
|
||||
<string name="about_app_version">軟體版本:%s</string>
|
||||
<string name="about_app_version_tips">版本名稱:%s\n版本代碼:%s\n構建時間:%s\nGit提交ID:%s</string>
|
||||
<string name="about_cache_size">緩存大小:%s</string>
|
||||
<string name="about_frpc_version">Frpc版本:%s</string>
|
||||
<string name="about_item_wechat_miniprogram">微信小程序</string>
|
||||
@ -738,6 +739,8 @@
|
||||
<string name="add">添加</string>
|
||||
<string name="auto_check">啟動時檢查</string>
|
||||
<string name="check_update">檢查更新</string>
|
||||
<string name="join_preview_program">加入SmsF預覽體驗計劃</string>
|
||||
<string name="join_preview_program_tips">檢查SmsF每周構建版更新,率先體驗新功能與Bug修復</string>
|
||||
<string name="clear_cache">清理緩存</string>
|
||||
<string name="delete_frpc">刪除動態庫</string>
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
<string name="menu_about">关于软件</string>
|
||||
|
||||
<string name="about_app_version">软件版本:%s</string>
|
||||
<string name="about_app_version_tips">版本名称:%s\n版本代码:%s\n构建时间:%s\nGit提交ID:%s</string>
|
||||
<string name="about_cache_size">缓存大小:%s</string>
|
||||
<string name="about_frpc_version">Frpc版本:%s</string>
|
||||
<string name="about_item_wechat_miniprogram">微信小程序</string>
|
||||
@ -738,6 +739,8 @@
|
||||
<string name="add">添加</string>
|
||||
<string name="auto_check">启动时检查</string>
|
||||
<string name="check_update">检查更新</string>
|
||||
<string name="join_preview_program">加入SmsF预览体验计划</string>
|
||||
<string name="join_preview_program_tips">检查SmsF每周构建版更新,率先体验新功能与Bug修复</string>
|
||||
<string name="clear_cache">清理缓存</string>
|
||||
<string name="delete_frpc">删除动态库</string>
|
||||
|
||||
|
@ -29,10 +29,9 @@
|
||||
</style>
|
||||
|
||||
<style name="InfoItem.About">
|
||||
<item name="sLeftViewWidth">110dp</item>
|
||||
<item name="sLeftViewGravity">left_center</item>
|
||||
<item name="sCenterViewGravity">left_center</item>
|
||||
<item name="sCenterViewMarginLeft">25dp</item>
|
||||
<item name="sCenterViewMarginLeft">10dp</item>
|
||||
<item name="sRightTextSize">?attr/xui_config_size_content_text</item>
|
||||
<item name="sRightViewMarginRight">10dp</item>
|
||||
<item name="sRightIconRes">@drawable/icon_arrow_right_grey</item>
|
||||
@ -41,10 +40,9 @@
|
||||
<style name="InfoItem.AboutWithBtn">
|
||||
<item name="sLeftViewGravity">left_center</item>
|
||||
<item name="sCenterViewGravity">left_center</item>
|
||||
<item name="sCenterViewMarginLeft">25dp</item>
|
||||
<item name="sCenterViewMarginLeft">10dp</item>
|
||||
<item name="sRightTextSize">?attr/xui_config_size_content_text</item>
|
||||
<item name="sRightViewMarginRight">10dp</item>
|
||||
<!--<item name="sRightIconRes">@drawable/icon_arrow_right_grey</item>-->
|
||||
</style>
|
||||
|
||||
<style name="PullDownStyle">
|
||||
|
Loading…
Reference in New Issue
Block a user