mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 05:13:58 +00:00
[iOS] Add yellow color opening in up to 15 min
Fixes #1631. Signed-off-by: Matheus Gomes <matheusgomesms@noreply.codeberg.org>
This commit is contained in:
committed by
Yannik Bloscheck
parent
a338a18590
commit
c9de67762c
@@ -66,13 +66,20 @@
|
|||||||
}
|
}
|
||||||
case osm::No: {
|
case osm::No: {
|
||||||
const int minutes = result.GetMinutesUntilOpen();
|
const int minutes = result.GetMinutesUntilOpen();
|
||||||
if (minutes < 60) { // less than 1 hour
|
if (minutes < 15) { // less than 15 minutes
|
||||||
|
_openStatusColor = [UIColor colorNamed:@"Base Colors/Yellow Color"];
|
||||||
NSString * time = [NSString stringWithFormat:@"%d %@", minutes, L(@"minute")];
|
NSString * time = [NSString stringWithFormat:@"%d %@", minutes, L(@"minute")];
|
||||||
_openStatusText = [NSString stringWithFormat:L(@"opens_in"), time];
|
_openStatusText = [NSString stringWithFormat:L(@"opens_in"), time];
|
||||||
} else {
|
}
|
||||||
|
else if (minutes < 60) { // less than an hour (but more than 15 mins)
|
||||||
|
_openStatusColor = [UIColor colorNamed:@"Base Colors/Red Color"];
|
||||||
|
NSString * time = [NSString stringWithFormat:@"%d %@", minutes, L(@"minute")];
|
||||||
|
_openStatusText = [NSString stringWithFormat:L(@"opens_in"), time];
|
||||||
|
}
|
||||||
|
else { // opens later or schedule is unknown
|
||||||
|
_openStatusColor = [UIColor colorNamed:@"Base Colors/Red Color"];
|
||||||
_openStatusText = L(@"closed");
|
_openStatusText = L(@"closed");
|
||||||
}
|
}
|
||||||
_openStatusColor = [UIColor colorNamed:@"Base Colors/Red Color"];
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case osm::Unknown: {
|
case osm::Unknown: {
|
||||||
|
|||||||
@@ -199,8 +199,17 @@ final class PlacePagePreviewViewController: UIViewController {
|
|||||||
let stringTimeInterval = getTimeIntervalString(minutes: minutesUntilOpen)
|
let stringTimeInterval = getTimeIntervalString(minutes: minutesUntilOpen)
|
||||||
let stringTime = stringFromTime(nextTimeOpen)
|
let stringTime = stringFromTime(nextTimeOpen)
|
||||||
|
|
||||||
|
var state: String = L("closed_now")
|
||||||
|
var stateColor = UIColor.BaseColors.red
|
||||||
|
|
||||||
let details: String?
|
let details: String?
|
||||||
if (minutesUntilOpen < 3 * 60) // Less than 3 hours
|
|
||||||
|
if (minutesUntilOpen < 15) { // Less than 15 min
|
||||||
|
state = String(format: L("opens_in"), stringTimeInterval)
|
||||||
|
stateColor = UIColor.BaseColors.yellow
|
||||||
|
details = stringTime
|
||||||
|
}
|
||||||
|
else if (minutesUntilOpen < 3 * 60) // Less than 3 hours
|
||||||
{
|
{
|
||||||
details = String(format: L("opens_in"), stringTimeInterval) + " • " + stringTime
|
details = String(format: L("opens_in"), stringTimeInterval) + " • " + stringTime
|
||||||
}
|
}
|
||||||
@@ -222,8 +231,8 @@ final class PlacePagePreviewViewController: UIViewController {
|
|||||||
details = nil
|
details = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
setScheduleLabel(state: L("closed_now"),
|
setScheduleLabel(state: state,
|
||||||
stateColor: UIColor.BaseColors.red,
|
stateColor: stateColor,
|
||||||
details: details)
|
details: details)
|
||||||
|
|
||||||
@unknown default:
|
@unknown default:
|
||||||
|
|||||||
Reference in New Issue
Block a user