Skip to content

Commit

Permalink
Merge branch 'hotfix/#187-owm-key-override'
Browse files Browse the repository at this point in the history
* hotfix/#187-owm-key-override:
  #187 Implement OWMKeyOverride setting
  #187 Add OpenWeatherMap API Key Override property, setting and strings

# Conflicts:
#	resources-dut/strings/strings.xml
  • Loading branch information
warmsound committed Apr 11, 2021
2 parents ce3d116 + 3a2bbd8 commit 7e3460e
Show file tree
Hide file tree
Showing 24 changed files with 45 additions and 1 deletion.
2 changes: 2 additions & 0 deletions resources-ces/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-dan/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
1 change: 1 addition & 0 deletions resources-deu/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Sekunden ausblenden</string>
<string id="HideHoursLeadingZeroTitle">Führende Nullen ausblenden</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string><!-- TODO_TRANSLATE -->

<string id="FieldCountTitle">Anzahl der Datenfelder</string>
<string id="DataField1Title">Datenfeld 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-dut/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Versie</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Beweeg Balk Stijl</string>
<string id="HideSecondsTitle">Verberg Seconden</string>
<string id="HideHoursLeadingZeroTitle">Verberg Eerste Nul Bij Uuren</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string><!-- TODO_TRANSLATE -->

<string id="FieldCountTitle">Hoeveelheid Datavelden</string>
<string id="DataField1Title">Data Veld 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-fin/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-fre/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-hrv/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-hun/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-ita/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-kor/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-nob/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
1 change: 1 addition & 0 deletions resources-pol/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<string id="MoveBarStyleTitle">Wygląd Move Bar'a</string>
<string id="HideSecondsTitle">Ukryj Sekundy</string>
<string id="HideHoursLeadingZeroTitle">Ukryj Zero Poprzedzające Godzinę</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string><!-- TODO_TRANSLATE -->

<string id="FieldCountTitle">Liczba Pól z Danymi</string>
<string id="DataField1Title">Pole Danych 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-por/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
1 change: 1 addition & 0 deletions resources-rus/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<string id="MoveBarStyleTitle">Вид полосы подвижности</string>
<string id="HideSecondsTitle">Скрывать секунды</string>
<string id="HideHoursLeadingZeroTitle">Скрывать нули перед часами</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string><!-- TODO_TRANSLATE -->

<string id="FieldCountTitle">Количество полей данных</string>
<string id="DataField1Title">Поле данных 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-slo/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-slv/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-spa/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
1 change: 1 addition & 0 deletions resources-swe/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<string id="MoveBarStyleTitle">Rörelsemätarstil</string>
<string id="HideSecondsTitle">Dölj sekunder</string>
<string id="HideHoursLeadingZeroTitle">Dölj inledande nollor</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string><!-- TODO_TRANSLATE -->

<string id="FieldCountTitle">Antal datafält</string>
<string id="DataField1Title">Datafält 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-zhs/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources-zht/strings/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<strings>

<!-- TODO_TRANSLATE -->
<string id="AppName">Crystal</string>
<string id="AppVersionTitle">App Version</string>

Expand All @@ -15,6 +16,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
2 changes: 2 additions & 0 deletions resources/settings/properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@
<property id="HideSeconds" type="boolean">false</property>
<property id="HideHoursLeadingZero" type="boolean">true</property>

<property id="OWMKeyOverride" type="string"></property>

</properties>
4 changes: 4 additions & 0 deletions resources/settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,8 @@
</settingConfig>
</setting>

<setting propertyKey="@Properties.OWMKeyOverride" title="@Strings.OWMKeyOverride">
<settingConfig type="alphaNumeric" maxLength="32"/>
</setting>

</settings>
1 change: 1 addition & 0 deletions resources/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<string id="MoveBarStyleTitle">Move Bar Style</string>
<string id="HideSecondsTitle">Hide Seconds</string>
<string id="HideHoursLeadingZeroTitle">Hide Hours Leading Zero</string>
<string id="OWMKeyOverride">OpenWeatherMap API Key Override</string>

<string id="FieldCountTitle">Number Of Data Fields</string>
<string id="DataField1Title">Data Field 1</string>
Expand Down
3 changes: 2 additions & 1 deletion source/BackgroundService.mc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class BackgroundService extends Sys.ServiceDelegate {

// 2. Weather.
} else if (pendingWebRequests["OpenWeatherMapCurrent"] != null) {
var owmKeyOverride = App.getApp().getProperty("OWMKeyOverride");
makeWebRequest(
"https://api.openweathermap.org/data/2.5/weather",
{
Expand All @@ -51,7 +52,7 @@ class BackgroundService extends Sys.ServiceDelegate {
// If you intend to use this key in your own app, especially for the One Call API, please create your own
// OWM account, and own key. You should be able to apply for the Open Source Plan to benefit from the same
// lifted limits as Crystal. Thank you.
"appid" => "2651f49cb20de925fc57590709b86ce6",
"appid" => ((owmKeyOverride != null) && (owmKeyOverride.length() == 0)) ? "2651f49cb20de925fc57590709b86ce6" : owmKeyOverride,

"units" => "metric" // Celcius.
},
Expand Down

0 comments on commit 7e3460e

Please sign in to comment.