Merge tag '11.5.1'

pull/1381/head
Alex Baker 3 years ago
commit c0a3c0e2c6

@ -1,3 +1,25 @@
### 11.5.1 (2021-02-24)
* Fix 'repeat until' date
* Fix repeat dates for UTC+13
([#1374](https://github.com/tasks/tasks/issues/1374))
* F-Droid: Handle null name in Nominatim reverse geocoder
([#1380](https://github.com/tasks/tasks/issues/1380))
* Update translations
* Basque - Sergio Varela
* Croatian - @ggdorman
* Dutch - @fvbommel
* French - @FlorianLeChat
* Hungarian - kaciokos
* Norwegian Bokmål - @comradekingu
* Polish - @alex-ter
* Russian - Nikita Epifanov
* Simplified Chinese - @sr093906
* Spanish - @FlorianLeChat
* Turkish - Oğuz Ersen
* Ukrainian - @IhorHordiichuk
* Urdu - Maaz
### 11.5 (2021-02-17)
* Sync snooze time with Tasks.org, DAVx⁵, CalDAV, EteSync, and DecSync

@ -45,8 +45,8 @@ android {
defaultConfig {
testApplicationId = "org.tasks.test"
applicationId = "org.tasks"
versionCode = 110500
versionName = "11.5"
versionCode = 110501
versionName = "11.5.1"
targetSdkVersion(Versions.targetSdk)
minSdkVersion(Versions.minSdk)
testInstrumentationRunner = "org.tasks.TestRunner"

@ -204,7 +204,7 @@ class RepeatTaskHelper @Inject constructor(
return if (task.hasDueTime()) {
startDate.toDateTime()
} else {
startDate.toDate()
Date(startDate.millis + startDate.offset)
}
}

@ -2,6 +2,7 @@ package org.tasks.location
import android.content.Context
import com.google.gson.JsonElement
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.Dispatchers
@ -49,13 +50,10 @@ class GeocoderNominatim @Inject constructor(
.get("geocoding").asJsonObject
val geometry = feature.get("geometry").asJsonObject
newPlace().apply {
val type = geocoding.get("type").asString
name = if (type.equals("house")) {
"${geocoding.get("housenumber").asString} ${geocoding.get("street").asString}"
} else {
geocoding.get("name").asString
}
address = geocoding.get("label").asString
name = geocoding.getStringOrNull("name")
?: geocoding.getStringOrNull("housenumber")
?.let { "$it ${geocoding.get("street").asString}" }
address = geocoding.getOrNull("label")?.asString
geometry.get("coordinates").asCoordinates.let {
longitude = it.first
latitude = it.second
@ -65,5 +63,9 @@ class GeocoderNominatim @Inject constructor(
private val JsonElement.asCoordinates: Pair<Double, Double>
get() = asJsonArray.let { Pair(it[0].asDouble, it[1].asDouble) }
private fun JsonObject.getStringOrNull(key: String): String? = getOrNull(key)?.asString
private fun JsonObject.getOrNull(key: String) = if (has(key)) get(key) else null
}
}

@ -548,7 +548,6 @@ public class CustomRecurrenceDialog extends DialogFragment {
if (resultCode == RESULT_OK) {
rrule.setUntil(
new DateTime(data.getLongExtra(MyDatePickerDialog.EXTRA_TIMESTAMP, 0L)).toDate());
rrule.setCount(0);
}
updateRepeatUntilOptions();
}

@ -3,8 +3,13 @@ package com.todoroo.astrid.repeats
import com.natpryce.makeiteasy.MakeItEasy.with
import org.junit.Assert.assertEquals
import org.junit.Test
import org.tasks.TestUtilities.withTZ
import org.tasks.makers.TaskMaker.COMPLETION_TIME
import org.tasks.makers.TaskMaker.DUE_DATE
import org.tasks.makers.TaskMaker.RECUR
import org.tasks.makers.TaskMaker.newTask
import org.tasks.time.DateTime
import java.util.*
class RepeatDailyTests : RepeatTests() {
@Test
@ -43,4 +48,96 @@ class RepeatDailyTests : RepeatTests() {
assertEquals(newDayTime(2016, 8, 30, 0, 4), next)
}
@Test
fun allDayRepeatNewYork() = withTZ(NEW_YORK) {
val task = newTask(
with(DUE_DATE, newDay(2021, 2, 24)),
with(RECUR, "FREQ=DAILY;INTERVAL=1")
)
val next = calculateNextDueDate(task)
assertEquals(newDay(2021, 2, 25), next)
}
@Test
fun dueTimeRepeatNewYork() = withTZ(NEW_YORK) {
val next = calculateNextDueDate(
newFromDue("FREQ=DAILY;INTERVAL=1", newDayTime(2021, 2, 24, 13, 30))
)
assertEquals(newDayTime(2021, 2, 25, 13, 30), next)
}
@Test
fun allDayRepeatLondon() = withTZ(LONDON) {
val next = calculateNextDueDate(
newTask(
with(DUE_DATE, newDay(2021, 2, 24)),
with(RECUR, "FREQ=DAILY;INTERVAL=1")
)
)
assertEquals(newDay(2021, 2, 25), next)
}
@Test
fun dueTimeRepeatLondon() = withTZ(LONDON) {
val next = calculateNextDueDate(
newFromDue("FREQ=DAILY;INTERVAL=1", newDayTime(2021, 2, 24, 13, 30))
)
assertEquals(newDayTime(2021, 2, 25, 13, 30), next)
}
@Test
fun allDayRepeatBerlin() = withTZ(BERLIN) {
val next = calculateNextDueDate(
newTask(
with(DUE_DATE, newDay(2021, 2, 24)),
with(RECUR, "FREQ=DAILY;INTERVAL=1")
)
)
assertEquals(newDay(2021, 2, 25), next)
}
@Test
fun dueTimeRepeatBerlin() = withTZ(BERLIN) {
val next = calculateNextDueDate(
newFromDue("FREQ=DAILY;INTERVAL=1", newDayTime(2021, 2, 24, 13, 30))
)
assertEquals(newDayTime(2021, 2, 25, 13, 30), next)
}
@Test
fun allDayRepeatUtcPlus13() = withTZ(APIA) {
val next = calculateNextDueDate(
newTask(
with(DUE_DATE, newDay(2021, 2, 24)),
with(RECUR, "FREQ=DAILY;INTERVAL=1")
)
)
assertEquals(newDay(2021, 2, 25), next)
}
@Test
fun dueTimeRepeatUtcPlus13() = withTZ(APIA) {
val next = calculateNextDueDate(
newFromDue("FREQ=DAILY;INTERVAL=1", newDayTime(2021, 2, 24, 13, 30))
)
assertEquals(newDayTime(2021, 2, 25, 13, 30), next)
}
companion object {
private val BERLIN = TimeZone.getTimeZone("Europe/Berlin")
private val LONDON = TimeZone.getTimeZone("Europe/London")
private val NEW_YORK = TimeZone.getTimeZone("America/New_York")
private val APIA = TimeZone.getTimeZone("Pacific/Apia")
}
}

@ -1,6 +1,7 @@
package org.tasks.location
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test
import org.tasks.TestUtilities.readFile
@ -30,4 +31,30 @@ class GeocoderNominatimTest {
place.address
)
}
@Test
fun residentialGeocode() {
val place = GeocoderNominatim.jsonToPlace(readFile("nominatim/residential.json"))!!
assertNull(place.name)
assertEquals(-9.553143, place.longitude, 0.0)
assertEquals(53.8946414, place.latitude, 0.0)
assertEquals(
"Newport East ED, Westport-Belmullet Municipal District, County Mayo, Connacht, Éire / Ireland",
place.address
)
}
@Test
fun busStopGeocode() {
val place = GeocoderNominatim.jsonToPlace(readFile("nominatim/bus_stop.json"))!!
assertEquals("Blessington Road", place.name)
assertEquals(-6.4154817, place.longitude, 0.0)
assertEquals(53.2751611, place.latitude, 0.0)
assertEquals(
"Blessington Road, Clondalkin ED, Tallaght, South Dublin, County Dublin, Leinster, D24 EP20, Éire / Ireland",
place.address
)
}
}

@ -0,0 +1,44 @@
{
"type": "FeatureCollection",
"geocoding": {
"version": "0.1.0",
"attribution": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright",
"licence": "ODbL",
"query": "53.27478,-6.41509"
},
"features": [
{
"type": "Feature",
"properties": {
"geocoding": {
"place_id": 51801784,
"osm_type": "node",
"osm_id": 4386456055,
"type": "bus_stop",
"accuracy": 0,
"label": "Blessington Road, Clondalkin ED, Tallaght, South Dublin, County Dublin, Leinster, D24 EP20, Éire / Ireland",
"name": "Blessington Road",
"country": "Éire / Ireland",
"postcode": "D24 EP20",
"county": "County Dublin",
"city": "Tallaght",
"district": "Clondalkin ED",
"street": "Blessington Road",
"admin": {
"level5": "Leinster",
"level6": "County Dublin",
"level7": "South Dublin",
"level9": "Clondalkin ED"
}
}
},
"geometry": {
"type": "Point",
"coordinates": [
-6.4154817,
53.2751611
]
}
}
]
}

@ -0,0 +1,42 @@
{
"type": "FeatureCollection",
"geocoding": {
"version": "0.1.0",
"attribution": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright",
"licence": "ODbL",
"query": "53.894495732719,-9.5531306587933"
},
"features": [
{
"type": "Feature",
"properties": {
"geocoding": {
"place_id": 104842902,
"osm_type": "way",
"osm_id": 58918090,
"type": "residential",
"accuracy": 0,
"label": "Newport East ED, Westport-Belmullet Municipal District, County Mayo, Connacht, Éire / Ireland",
"country": "Éire / Ireland",
"county": "County Mayo",
"city": "Westport-Belmullet Municipal District",
"district": "Newport East ED",
"admin": {
"level5": "Connacht",
"level6": "County Mayo",
"level7": "County Mayo",
"level8": "Westport-Belmullet Municipal District",
"level9": "Newport East ED"
}
}
},
"geometry": {
"type": "Point",
"coordinates": [
-9.553143,
53.8946414
]
}
}
]
}

@ -0,0 +1,4 @@
* Fix 'repeat until' date
* Fix repeat dates for UTC+13
* F-Droid: Handle null name in Nominatim reverse geocoder
* Update translations
Loading…
Cancel
Save