mapcomplete/Models/Constants.ts

36 lines
1.7 KiB
TypeScript
Raw Normal View History

import { Utils } from "../Utils";
export default class Constants {
2021-01-09 02:23:52 +01:00
2021-04-06 23:55:18 +02:00
public static vNumber = "0.6.6a";
// The user journey states thresholds when a new feature gets unlocked
public static userJourney = {
addNewPointsUnlock: 0,
2021-03-16 19:35:19 +01:00
moreScreenUnlock: 1,
2021-03-17 14:35:06 +01:00
personalLayoutUnlock: 15,
tagsVisibleAt: 25,
2021-03-16 19:35:19 +01:00
mapCompleteHelpUnlock: 50,
tagsVisibleAndWikiLinked: 30,
themeGeneratorReadOnlyUnlock: 50,
themeGeneratorFullUnlock: 500,
addNewPointWithUnreadMessagesUnlock: 500,
2021-01-06 02:21:50 +01:00
minZoomLevelToAddNewPoints: (Constants.isRetina() ? 18 : 19)
};
/**
* Used by 'PendingChangesUploader', which waits this amount of seconds to upload changes.
* (Note that pendingChanges might upload sooner if the popup is closed or similar)
*/
static updateTimeoutSec: number = 30;
2021-01-06 02:21:50 +01:00
private static isRetina(): boolean {
if (Utils.runningFromConsole) {
return;
}
// The cause for this line of code: https://github.com/pietervdvn/MapComplete/issues/115
// See https://stackoverflow.com/questions/19689715/what-is-the-best-way-to-detect-retina-support-on-a-device-using-javascript
return ((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 75.6dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)').matches)) || (window.devicePixelRatio && window.devicePixelRatio >= 2));
}
2021-01-03 13:50:18 +01:00
2021-03-31 11:39:56 +02:00
}