diff --git a/CHANGELOG.md b/CHANGELOG.md index 02667c0..2d966c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.6.2 (April 1, 2022) +* twilights indicator fix - hide indicator if position is not available + # 1.6.1 (March 6, 2022) * small bugfix for twilights indicator diff --git a/connect_iq_store/black_cover_ukraine.png b/connect_iq_store/black_cover_ukraine.png new file mode 100644 index 0000000..1ee0eae Binary files /dev/null and b/connect_iq_store/black_cover_ukraine.png differ diff --git a/manifest.xml b/manifest.xml index 6c6178c..03aa40f 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,5 +1,5 @@ - + diff --git a/manifest.xml.beta b/manifest.xml.beta index 7a7453a..1cab3be 100644 --- a/manifest.xml.beta +++ b/manifest.xml.beta @@ -1,5 +1,5 @@ - + diff --git a/manifest.xml.prod b/manifest.xml.prod index 6c6178c..03aa40f 100644 --- a/manifest.xml.prod +++ b/manifest.xml.prod @@ -1,5 +1,5 @@ - + diff --git a/resources/settings/properties.xml b/resources/settings/properties.xml index eeff99f..1a998b0 100644 --- a/resources/settings/properties.xml +++ b/resources/settings/properties.xml @@ -48,6 +48,8 @@ 0xAA0000 0x0000FF + -999 + -999 1573331777 diff --git a/source/SmartArcsView.mc b/source/SmartArcsView.mc index 51a216f..25c524e 100644 --- a/source/SmartArcsView.mc +++ b/source/SmartArcsView.mc @@ -71,7 +71,9 @@ class SmartArcsView extends WatchUi.WatchFace { var sunriseEndAngle = 0; var sunsetStartAngle = 0; var sunsetEndAngle = 0; - + var locationLatitude; + var locationLongitude; + //user settings var bgColor; var handsColor; @@ -379,6 +381,9 @@ class SmartArcsView extends WatchUi.WatchFace { powerSaverRefreshInterval = app.getProperty("powerSaverRefreshInterval"); powerSaverIconColor = app.getProperty("powerSaverIconColor"); + locationLatitude = app.getProperty("locationLatitude"); + locationLongitude = app.getProperty("locationLongitude"); + //ensure that constants will be pre-computed needComputeConstants = true; @@ -1015,7 +1020,21 @@ class SmartArcsView extends WatchUi.WatchFace { if (posInfo != null && posInfo.position != null) { var sc = new SunCalc(); var time_now = Time.now(); - var loc = posInfo.position.toRadians(); + var loc = posInfo.position.toRadians(); + var hasLocation = (loc[0].format("%.2f").equals("3.14") && loc[1].format("%.2f").equals("3.14")) || (loc[0] == 0 && loc[1] == 0) ? false : true; + + if (!hasLocation && locationLatitude != -999) { + loc[0] = locationLatitude; + loc[1] = locationLongitude; + } + + if (hasLocation) { + Application.getApp().setProperty("locationLatitude", loc[0]); + Application.getApp().setProperty("locationLongitude", loc[1]); + locationLatitude = loc[0]; + locationLongitude = loc[1]; + } + sunriseStartAngle = computeSunAngle(sc.calculate(time_now, loc, SunCalc.DAWN)); sunriseEndAngle = computeSunAngle(sc.calculate(time_now, loc, SunCalc.SUNRISE)); sunsetStartAngle = computeSunAngle(sc.calculate(time_now, loc, SunCalc.SUNSET)); @@ -1034,7 +1053,7 @@ class SmartArcsView extends WatchUi.WatchFace { dc.setPenWidth(7); //draw sunrise - if (sunriseColor != offSettingFlag) { + if (sunriseColor != offSettingFlag && locationLatitude != -999) { dc.setColor(sunriseColor, Graphics.COLOR_TRANSPARENT); if (sunriseStartAngle > sunriseEndAngle) { dc.drawArc(screenRadius, screenRadius, screenRadius - 17, Graphics.ARC_CLOCKWISE, sunriseStartAngle, sunriseEndAngle); @@ -1044,7 +1063,7 @@ class SmartArcsView extends WatchUi.WatchFace { } //draw sunset - if (sunsetColor != offSettingFlag) { + if (sunsetColor != offSettingFlag && locationLatitude != -999) { dc.setColor(sunsetColor, Graphics.COLOR_TRANSPARENT); if (sunsetStartAngle > sunsetEndAngle) { dc.drawArc(screenRadius, screenRadius, screenRadius - 13, Graphics.ARC_CLOCKWISE, sunsetStartAngle, sunsetEndAngle);