-
-
Notifications
You must be signed in to change notification settings - Fork 404
Osmcal #6743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,051
−18
Merged
Osmcal #6743
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
071eb4d
dao, parser
westnordost 506b199
Merge branch 'master' into osmcal
westnordost c5355e5
fix tests etc
westnordost 1af3785
Merge branch 'master' into osmcal
westnordost 8312294
message type
westnordost 0ad1fcb
modules
westnordost 20c49fc
skeleton for calendar event dialog
westnordost d9e1084
finish
westnordost 227a527
minor fix
westnordost b1e2624
more performant check of weeklyosm/calendar link
westnordost 608b091
no need for parameter
westnordost 450206b
some comments
westnordost 8e92881
unlock calendar earlier
westnordost bbb8d4e
Update app/src/commonMain/kotlin/de/westnordost/streetcomplete/data/o…
westnordost 5b4dae0
use constants, notifications about events up to 35km away
westnordost 92e7d28
move comment
westnordost File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
...nstrumentedTest/kotlin/de/westnordost/streetcomplete/data/osmcal/CalendarEventsDaoTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| package de.westnordost.streetcomplete.data.osmcal | ||
|
|
||
| import de.westnordost.streetcomplete.data.ApplicationDbTestCase | ||
| import de.westnordost.streetcomplete.data.osm.mapdata.LatLon | ||
| import kotlinx.datetime.Clock | ||
| import kotlinx.datetime.Instant | ||
| import kotlin.test.BeforeTest | ||
| import kotlin.test.Test | ||
| import kotlin.test.assertEquals | ||
| import kotlin.time.Duration | ||
| import kotlin.time.Duration.Companion.days | ||
| import kotlin.time.Duration.Companion.hours | ||
|
|
||
| class CalendarEventsDaoTest : ApplicationDbTestCase() { | ||
| private lateinit var dao: CalendarEventsDao | ||
|
|
||
| @BeforeTest fun createDao() { | ||
| dao = CalendarEventsDao(database) | ||
| } | ||
|
|
||
| @Test | ||
| fun putAndGet() { | ||
| val tomorrow = Clock.System.now() + 1.days | ||
| val multiDayEventTomorrow = CalendarEvent( | ||
| id = 123L, | ||
| name = "multi day event", | ||
| startDate = tomorrow, | ||
| endDate = tomorrow + 1.days, | ||
| wholeDay = true, | ||
| position = LatLon(5.0, 1.5), | ||
| venue = "House", | ||
| address = "an address", | ||
| notified = false, | ||
| ) | ||
| val eventSoon = CalendarEvent( | ||
| id = 124L, | ||
| name = "soon event", | ||
| startDate = tomorrow - 23.hours, | ||
| endDate = null, | ||
| wholeDay = false, | ||
| position = LatLon(-5.0, 2.5), | ||
| venue = "House2", | ||
| address = "an address2", | ||
| notified = false, | ||
| ) | ||
| val yesterdayEvent = CalendarEvent( | ||
| id = 125L, | ||
| name = "yesterday event", | ||
| startDate = tomorrow - 2.days, | ||
| endDate = null, | ||
| wholeDay = false, | ||
| position = LatLon(-5.0, 2.5), | ||
| venue = "House3", | ||
| address = "an address3", | ||
| notified = false, | ||
| ) | ||
|
|
||
| dao.putAll(listOf(multiDayEventTomorrow, eventSoon, yesterdayEvent)) | ||
|
|
||
| // getting / marking as read one by one | ||
| assertEquals(2, dao.getUnreadCount()) | ||
| assertEquals(eventSoon, dao.getFirstUnread()) | ||
|
|
||
| dao.markRead(eventSoon.id) | ||
| assertEquals(1, dao.getUnreadCount()) | ||
| assertEquals(multiDayEventTomorrow, dao.getFirstUnread()) | ||
|
|
||
| dao.markRead(multiDayEventTomorrow.id) | ||
| assertEquals(0, dao.getUnreadCount()) | ||
| assertEquals(null, dao.getFirstUnread()) | ||
|
|
||
| // deleting yesterday's event | ||
| assertEquals(1, dao.deleteOld()) | ||
|
|
||
| // new putAll doesn't overwrite existing records | ||
| dao.putAll(listOf(multiDayEventTomorrow, eventSoon, yesterdayEvent)) | ||
| assertEquals(0, dao.getUnreadCount()) | ||
| assertEquals(null, dao.getFirstUnread()) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
app/src/commonMain/composeResources/drawable/location_pin_red.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:width="24dp" | ||
| android:height="24dp" | ||
| android:viewportWidth="24" | ||
| android:viewportHeight="24"> | ||
| <path | ||
| android:pathData="m12,0c-4.418,0 -8,3.582 -8,8 -0,1.316 0.38,2.64 1,3.801l7,12.199 7,-12.199c0.63,-1.167 1,-2.475 1,-3.801 0,-4.418 -3.582,-8 -8,-8zM12,5a3,3 0,0 1,3 3,3 3,0 0,1 -3,3 3,3 0,0 1,-3 -3,3 3,0 0,1 3,-3z" | ||
| android:fillColor="#ee2c2c" | ||
| android:fillType="evenOdd"/> | ||
| </vector> |
41 changes: 41 additions & 0 deletions
41
app/src/commonMain/composeResources/drawable/wire_binding.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| xmlns:aapt="http://schemas.android.com/aapt" | ||
| android:width="36dp" | ||
| android:height="56dp" | ||
| android:viewportWidth="36" | ||
| android:viewportHeight="56"> | ||
| <path | ||
| android:fillColor="#FF000000" | ||
| android:pathData="M18,46m-10,0a10,10 0,1 1,20 0a10,10 0,1 1,-20 0" | ||
| android:fillAlpha="0.2" | ||
| android:fillType="evenOdd"/> | ||
| <path | ||
| android:pathData="M18,0L18,0A6,6 0,0 1,24 6L24,46A6,6 0,0 1,18 52L18,52A6,6 0,0 1,12 46L12,6A6,6 0,0 1,18 0z" | ||
| android:fillType="evenOdd"> | ||
| <aapt:attr name="android:fillColor"> | ||
| <gradient | ||
| android:centerX="20" | ||
| android:centerY="19.999" | ||
| android:gradientRadius="32" | ||
| android:type="radial"> | ||
| <item android:offset="0" android:color="#FFC7C7C7"/> | ||
| <item android:offset="1" android:color="#FF535353"/> | ||
| </gradient> | ||
| </aapt:attr> | ||
| </path> | ||
| <path | ||
| android:pathData="M18,0L18,0A6,6 0,0 1,24 6L24,46A6,6 0,0 1,18 52L18,52A6,6 0,0 1,12 46L12,6A6,6 0,0 1,18 0z" | ||
| android:fillType="evenOdd"> | ||
| <aapt:attr name="android:fillColor"> | ||
| <gradient | ||
| android:startX="17.889" | ||
| android:startY="29.333" | ||
| android:endX="26.111" | ||
| android:endY="29.389" | ||
| android:type="linear"> | ||
| <item android:offset="0" android:color="#00454545"/> | ||
| <item android:offset="1" android:color="#FF262626"/> | ||
| </gradient> | ||
| </aapt:attr> | ||
| </path> | ||
| </vector> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.