Compare commits

..

No commits in common. "77917dd940ba1788a32d6afe18e4b40e37cbf42f" and "a3253d5a7bf436dbef4194b7d87955bc02ba03ed" have entirely different histories.

4 changed files with 39 additions and 67 deletions

View File

@ -1,20 +0,0 @@
kind: pipeline
type: docker
steps:
- name: build
image: mingc/android-build-box:latest
commands:
- ./gradlew build
- name: code-analysis
image: mingc/android-build-box:latest
failure: ignore
commands:
- ls -la
- ./gradlew sonarqube -Dsonar.projectKey=RFS2 -Dsonar.sources=. -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN
environment:
SONAR_HOST_URL:
from_secret: sonarScannerHostUrl
SONAR_LOGIN:
from_secret: sonarScannerLogin

View File

@ -1,32 +1,31 @@
// TODO
//package bou.amine.apps.readerforselfossv2.android.utils
//
//import bou.amine.apps.readerforselfossv2.android.utils.Config
//import bou.amine.apps.readerforselfossv2.android.utils.parseDate
//import org.junit.Test
//
//class DateUtilsTest {
//
// @Test
// fun parseDateV4() {
//
// Config.apiVersion = 4
// val dateString = "2013-04-07T13:43:00+01:00"
//
// val milliseconds = parseDate(dateString).toEpochMilli()
// val correctMilliseconds : Long = 1365338580000
//
// assert(milliseconds == correctMilliseconds)
// }
//
// @Test
// fun parseDateV1() {
// Config.apiVersion = 0
// val dateString = "2013-04-07 13:43:00"
//
// val milliseconds = parseDate(dateString).toEpochMilli()
// val correctMilliseconds = 1365342180000
//
// assert(milliseconds == correctMilliseconds)
// }
//}
package bou.amine.apps.readerforselfossv2.android.utils
import bou.amine.apps.readerforselfossv2.android.utils.Config
import bou.amine.apps.readerforselfossv2.android.utils.parseDate
import org.junit.Test
class DateUtilsTest {
@Test
fun parseDateV4() {
Config.apiVersion = 4
val dateString = "2013-04-07T13:43:00+01:00"
val milliseconds = parseDate(dateString).toEpochMilli()
val correctMilliseconds : Long = 1365338580000
assert(milliseconds == correctMilliseconds)
}
@Test
fun parseDateV1() {
Config.apiVersion = 0
val dateString = "2013-04-07 13:43:00"
val milliseconds = parseDate(dateString).toEpochMilli()
val correctMilliseconds = 1365342180000
assert(milliseconds == correctMilliseconds)
}
}

View File

@ -6,15 +6,10 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
classpath("com.android.tools.build:gradle:7.2.1")
// sonarquve
classpath("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.4.0.2513")
classpath("com.android.tools.build:gradle:7.2.0")
}
}
apply(plugin = "org.sonarqube")
allprojects {
repositories {
google()

View File

@ -1,6 +1,6 @@
package bou.amine.apps.readerforselfossv2.utils
//import android.text.format.DateUtils
import android.text.format.DateUtils
import bou.amine.apps.readerforselfossv2.rest.SelfossModel
import java.time.Instant
import java.time.LocalDateTime
@ -30,13 +30,11 @@ class DateUtils(private val apiMajorVersion: Int) {
val date = parseDate(dateString)
// TODO:
// return " " + DateUtils.getRelativeTimeSpanString(
// date.toEpochMilli(),
// Instant.now().toEpochMilli(),
// 60000L, // DateUtils.MINUTE_IN_MILLIS,
// 262144 // DateUtils.FORMAT_ABBREV_RELATIVE
// )
return dateString
return " " + DateUtils.getRelativeTimeSpanString(
date.toEpochMilli(),
Instant.now().toEpochMilli(),
60000L, // DateUtils.MINUTE_IN_MILLIS,
262144 // DateUtils.FORMAT_ABBREV_RELATIVE
)
}
}