1
0
Fork 0

Adds build date to the about page

master
Jeff Boek 2019-02-13 10:58:07 -08:00 committed by Colin Lee
parent 7531bc56f2
commit 2e525813f6
4 changed files with 18 additions and 0 deletions

View File

@ -186,6 +186,9 @@ android.applicationVariants.all { variant ->
} else {
buildConfigField 'boolean', 'TELEMETRY', 'false'
}
def buildDate = Config.generateBuildDate()
buildConfigField 'String', 'BUILD_DATE', '"' + buildDate + '"'
}
// Normally this should use the same version as the glean dependency. But since we are currently using AC snapshots we

View File

@ -10,6 +10,7 @@ import android.content.Context
import android.content.pm.PackageManager
import androidx.annotation.RawRes
import org.mozilla.fenix.R
import org.mozilla.fenix.BuildConfig.BUILD_DATE
import org.mozilla.fenix.ext.replace
import org.mozilla.geckoview.BuildConfig
@ -33,6 +34,8 @@ object AboutPage {
// Nothing to do if we can't find the package name.
}
substitutionMap["%build-date%"] = BUILD_DATE
context.resources.getString(R.string.about_content, appName).also { content ->
substitutionMap["%about-content%"] = content
}

View File

@ -45,5 +45,7 @@ h1#wordmark {
<h1 id="wordmark">Fenix</h1>
<p class="subtitle">%about-version%</p>
%about-content%
<p class="subtitle">Built on: %build-date%</p>
</body>
</html>

View File

@ -1,4 +1,6 @@
import java.text.SimpleDateFormat
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.util.Date
import java.util.Locale
@ -24,4 +26,12 @@ object Config {
// sections we use in the changelog (weeks).
return SimpleDateFormat(".yyww", Locale.US).format(today)
}
@JvmStatic
fun generateBuildDate(): String {
val dateTime = LocalDateTime.now()
val timeFormatter = DateTimeFormatter.ofPattern("h:mm a")
return "${dateTime.dayOfWeek.toString().toLowerCase().capitalize()} ${dateTime.monthValue}/${dateTime.dayOfMonth} @ ${timeFormatter.format(dateTime)}"
}
}