diff --git a/app/build.gradle b/app/build.gradle index e90852c3e..39930a73d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,9 +21,12 @@ android { versionCode 81 versionName "0.24.3" multiDexEnabled true - resValue "string", "app_name", "Wulkanowy" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true + + resValue "string", "app_name", "Wulkanowy" + buildConfigField "long", "BUILD_TIMESTAMP", String.valueOf(System.currentTimeMillis()) + manifestPlaceholders = [ firebase_enabled: project.hasProperty("enableFirebase") ] diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index eaef43694..ac8d3be4a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -18,6 +18,18 @@ + + + + + + + + + + + + () { } } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { return DialogErrorBinding.inflate(inflater).apply { binding = this }.root } @@ -114,11 +114,17 @@ class ErrorDialog : BaseDialogFragment() { chooserTitle = getString(R.string.about_feedback), email = "wulkanowyinc@gmail.com", subject = "Zgłoszenie błędu", - body = requireContext().getString(R.string.about_feedback_template, - "${appInfo.systemManufacturer} ${appInfo.systemModel}", appInfo.systemVersion.toString(), appInfo.versionName + body = requireContext().getString( + R.string.about_feedback_template, + "${appInfo.systemManufacturer} ${appInfo.systemModel}", + appInfo.systemVersion.toString(), + "${appInfo.versionName}-${appInfo.buildFlavor}" ) + "\n" + content, onActivityNotFound = { - requireContext().openInternetBrowser("https://github.com/wulkanowy/wulkanowy/issues", ::showMessage) + requireContext().openInternetBrowser( + "https://github.com/wulkanowy/wulkanowy/issues", + ::showMessage + ) } ) } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutFragment.kt index c616c31ee..1c613800d 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/about/AboutFragment.kt @@ -18,6 +18,8 @@ import io.github.wulkanowy.utils.getCompatDrawable import io.github.wulkanowy.utils.openAppInMarket import io.github.wulkanowy.utils.openEmailClient import io.github.wulkanowy.utils.openInternetBrowser +import io.github.wulkanowy.utils.toFormattedString +import io.github.wulkanowy.utils.toLocalDateTime import javax.inject.Inject @AndroidEntryPoint @@ -35,7 +37,9 @@ class AboutFragment : BaseFragment(R.layout.fragment_about override val versionRes: Triple? get() = context?.run { - Triple(getString(R.string.about_version), "${appInfo.versionName} (${appInfo.versionCode})", getCompatDrawable(R.drawable.ic_all_about)) + val buildTimestamp = appInfo.buildTimestamp.toLocalDateTime().toFormattedString("yyyy-MM-dd") + val versionSignature = "${appInfo.versionName}-${appInfo.buildFlavor} (${appInfo.versionCode}), $buildTimestamp" + Triple(getString(R.string.about_version), versionSignature, getCompatDrawable(R.drawable.ic_all_about)) } override val creatorsRes: Triple? @@ -135,11 +139,17 @@ class AboutFragment : BaseFragment(R.layout.fragment_about chooserTitle = getString(R.string.about_feedback), email = "wulkanowyinc@gmail.com", subject = "Zgłoszenie błędu", - body = getString(R.string.about_feedback_template, - "${appInfo.systemManufacturer} ${appInfo.systemModel}", appInfo.systemVersion.toString(), appInfo.versionName + body = getString( + R.string.about_feedback_template, + "${appInfo.systemManufacturer} ${appInfo.systemModel}", + appInfo.systemVersion.toString(), + "${appInfo.versionName}-${appInfo.buildFlavor}" ), onActivityNotFound = { - requireContext().openInternetBrowser("https://github.com/wulkanowy/wulkanowy/issues", ::showMessage) + requireContext().openInternetBrowser( + "https://github.com/wulkanowy/wulkanowy/issues", + ::showMessage + ) } ) } diff --git a/app/src/main/java/io/github/wulkanowy/utils/AppInfo.kt b/app/src/main/java/io/github/wulkanowy/utils/AppInfo.kt index 37a09e74b..82671a7f4 100644 --- a/app/src/main/java/io/github/wulkanowy/utils/AppInfo.kt +++ b/app/src/main/java/io/github/wulkanowy/utils/AppInfo.kt @@ -4,7 +4,9 @@ import android.content.res.Resources import android.os.Build.MANUFACTURER import android.os.Build.MODEL import android.os.Build.VERSION.SDK_INT +import io.github.wulkanowy.BuildConfig.BUILD_TIMESTAMP import io.github.wulkanowy.BuildConfig.DEBUG +import io.github.wulkanowy.BuildConfig.FLAVOR import io.github.wulkanowy.BuildConfig.VERSION_CODE import io.github.wulkanowy.BuildConfig.VERSION_NAME import javax.inject.Inject @@ -17,6 +19,10 @@ open class AppInfo @Inject constructor() { open val versionCode get() = VERSION_CODE + open val buildTimestamp get() = BUILD_TIMESTAMP + + open val buildFlavor get() = FLAVOR + open val versionName get() = VERSION_NAME open val systemVersion get() = SDK_INT