aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--androidApp/build.gradle.kts2
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt22
-rw-r--r--iosApp/iosApp/Map/MapViewController.swift8
3 files changed, 26 insertions, 6 deletions
diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts
index 655676e..efab132 100644
--- a/androidApp/build.gradle.kts
+++ b/androidApp/build.gradle.kts
@@ -65,6 +65,8 @@ dependencies {
implementation(group = "", name = "WhirlyGlobeMaply", ext = "aar")
implementation("androidx.legacy:legacy-support-v4:1.0.0")
+ debugImplementation("com.squareup.leakcanary:leakcanary-android:2.10")
+
googleImplementation(platform("com.google.firebase:firebase-bom:29.0.3"))
googleImplementation("com.google.firebase:firebase-messaging")
}
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt
index 6cc36bd..aab3cfa 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/reports/UnitReportsFragment.kt
@@ -38,7 +38,8 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.card.MaterialCardView
import io.ktor.utils.io.*
import kotlinx.coroutines.DelicateCoroutinesApi
-import kotlinx.datetime.LocalDateTime
+import kotlinx.datetime.*
+import kotlinx.datetime.TimeZone
import mx.trackermap.TrackerMap.android.R
import mx.trackermap.TrackerMap.android.databinding.UnitDetailsReportsBinding
import mx.trackermap.TrackerMap.android.details.UnitDetailsAdapter
@@ -53,7 +54,9 @@ import org.koin.androidx.viewmodel.ext.android.viewModel
import java.io.*
import java.util.*
import kotlin.math.max
+import kotlin.time.DurationUnit
import kotlin.time.ExperimentalTime
+import kotlin.time.toDuration
@DelicateCoroutinesApi
@ExperimentalTime
@@ -271,7 +274,22 @@ class UnitReportsFragment : Fragment() {
p1, p2
)
(period as? ReportDates.ReportPeriod.Custom)?.let {
- unitReportsViewModel.setReportPeriod(it.withFrom(fromPickedDatetime))
+ val fromInstant = fromPickedDatetime.toInstant(TimeZone.currentSystemDefault())
+ val toInstant = Calendar.getInstance().toInstant().toKotlinInstant()
+ val plusMonth = fromInstant.plus(31.toDuration(DurationUnit.DAYS))
+
+ /* Make ultra sure that user can't select a period longer than a month */
+ unitReportsViewModel.setReportPeriod(
+ if (fromInstant.daysUntil(toInstant, TimeZone.currentSystemDefault()) > 31) {
+ it.withFrom(fromPickedDatetime).withTo(
+ plusMonth.toLocalDateTime(TimeZone.currentSystemDefault()))
+ } else {
+ it.withFrom(fromPickedDatetime)
+ }
+ )
+
+ toDatePicker.datePicker.minDate = fromInstant.toEpochMilliseconds()
+ toDatePicker.datePicker.maxDate = plusMonth.toEpochMilliseconds()
}
}, from.hour, from.minute, false)
diff --git a/iosApp/iosApp/Map/MapViewController.swift b/iosApp/iosApp/Map/MapViewController.swift
index 07b72a6..c7bc91d 100644
--- a/iosApp/iosApp/Map/MapViewController.swift
+++ b/iosApp/iosApp/Map/MapViewController.swift
@@ -231,7 +231,7 @@ class OurMaplyViewController: MaplyViewController {
let vectorDesc: [AnyHashable : Any] = [
kMaplyColor: colorReport,
- kMaplyVecWidth: 15.0,
+ kMaplyVecWidth: 12.0,
kMaplyWideVecImpl: kMaplyWideVecImplPerf
]
@@ -265,9 +265,9 @@ class OurMaplyViewController: MaplyViewController {
if isReport {
// For reports, position, start and end sizes must be different
switch i {
- case markers.startIndex: size = 50.0
- case markers.endIndex - 1: size = 50.0
- default: size = 26.0
+ case markers.startIndex: size = 40.0
+ case markers.endIndex - 1: size = 40.0
+ default: size = 22.0
}
}
screenMarker.size = CGSize(width: size, height: size)