Skip to content

Commit

Permalink
[fixes] fixes deprecation popup and api keys.
Browse files Browse the repository at this point in the history
  • Loading branch information
coderPaddyS committed May 27, 2024
1 parent dce6a85 commit 38eb05a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.method.LinkMovementMethod;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
Expand Down Expand Up @@ -120,11 +121,13 @@ public void onPageScrollStateChanged(int state) {}
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);

if (appPreferencesManager.getOWMApiKey(this) == null) {
new AlertDialog.Builder(this).setTitle("")
.setMessage("Get your own API-Key yo")
.setNeutralButton(android.R.string.ok, null)
.show();
if (appPreferencesManager.getOWMApiKey(this).equals(getString(R.string.settings_API_key_default))) {
TextView textView = new AlertDialog.Builder(this).setTitle(getString(R.string.dialog_app_api_deprecation_title))
.setMessage(R.string.dialog_app_api_deprecation_description)
.setNeutralButton(android.R.string.ok, null)
.show()
.findViewById(android.R.id.message);
textView.setMovementMethod(LinkMovementMethod.getInstance());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,30 +248,6 @@ public boolean usingPersonalKey(Context context) {
}

public String getOWMApiKey(Context context) {
String noKeyString = context.getString(R.string.settings_API_key_default);
String prefValue = preferences.getString("API_key_value", noKeyString);
if (!prefValue.equals(noKeyString)) {
return prefValue;
} else {
String availableKeysString = preferences.getString("availble_keys", "");
List<String> availableKeys = new ArrayList<>(Arrays.asList(availableKeysString.split(",")));

SharedPreferences.Editor editor = preferences.edit();

if(availableKeys.isEmpty() || availableKeysString.isEmpty()) {
// fill list with shuffled keys
availableKeys = new ArrayList<>(Arrays.asList(BuildConfig.DEFAULT_API_KEYS));
Collections.shuffle(availableKeys);
}

// get result and remove from possible keys
String result = availableKeys.get(0);
availableKeys.remove(result);
editor.putString("availble_keys", String.join(",", availableKeys)).commit();

return result;
}
return preferences.getString("API_key_value", context.getString(R.string.settings_API_key_default));
}


}
10 changes: 8 additions & 2 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@
<string name="help_permission_bindservice_description">Die Wetter-App ermöglicht Backups mit unserer Privacy Friendly Backup-App. Um diese Funktionalität zu aktivieren, wird die Berechtigung zum Verbinden mit Diensten benötigt.</string>
<string name="owm_about">Wetterdaten zur Verfügung gestellt von:</string>
<string name="owm_logo_copyright">"Das OpenWeatherMap Logo ist lizensiert unter\n<a href="https://creativecommons.org/licenses/by-sa/3.0/deed.en">Creative Commons BY-SA.</a>"</string>
<string name="dialog_app_api_deprecation_title">App Deprecation and API changes</string>
<string name="dialog_app_api_deprecation_description">Am 1. Juni 2024 deaktiviert Open Weather seine alte API, daher sind die alten API-Schlüssel nicht mehr verwendbar.</string>
<string name="dialog_app_api_deprecation_title">App-Veraltung und API-Änderungen</string>
<string name="dialog_app_api_deprecation_description">
Am 1. Juni 2024 deaktiviert Open Weather seine alte API, daher sind die alten API-Schlüssel nicht mehr verwendbar.
Da die Privacy Friendly Weather App veraltet ist, werden wir uns nicht an API-Änderungen anpassen und die App wird nicht wie erwartet funktionieren.

Wenn Sie diese App weiterhin verwenden möchten, besorgen Sie sich Ihren eigenen API-Schlüssel, indem Sie der <a href="https://openweathermap.org/appid">OpenWeather-Anweisung</a> folgen.
Nachdem Sie Ihren API-Schlüssel erhalten haben, legen Sie ihn in den Einstellungen fest.
</string>
</resources>
3 changes: 2 additions & 1 deletion app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,6 @@
<string name="owm_about">Dati meteo forniti da:</string>
<string name="owm_logo_copyright">"Il logo di OpenWeatherMap è concesso in licenza sotto\n<a href="https://creativecommons.org/licenses/by-sa/3.0/deed.en">la licenza Creative Commons BY-SA.</a>"</string>
<string name="dialog_app_api_deprecation_title">Deprecazione dell\'app e modifiche all\'API</string>
<string name="dialog_app_api_deprecation_description">Dal 1° giugno 2024 Open Weather disattiva la sua vecchia API, pertanto le vecchie chiavi API non sono più utilizzabili.</string>
<string name="dialog_app_api_deprecation_description">Dal 1 giugno 2024 Open Weather disattiva la sua vecchia API, pertanto le vecchie chiavi API non sono più utilizzabili. \n Poiché l\'app Meteo rispettosa della privacy è deprecata, non ci adatteremo ad alcuna modifica dell\'API e l\'app non funzionerà come previsto. Se vuoi continuare a utilizzare questa app, ottieni la tua chiave API seguendo le <a href="https://openweathermap.org/appid">istruzioni OpenWeather</a>. Dopo aver ottenuto la chiave API, impostala nelle impostazioni.
</string>
</resources>
8 changes: 7 additions & 1 deletion app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@
<string name="owm_about">Weather data provided by:</string>
<string name="owm_logo_copyright">"OpenWeatherMap logo is licensed under\n<a href="https://creativecommons.org/licenses/by-sa/3.0/deed.en">Creative Commons BY-SA license.</a>"</string>
<string name="dialog_app_api_deprecation_title">アプリの非推奨と API の変更</string>
<string name="dialog_app_api_deprecation_description">2024 年 6 月 1 日に、Open Weather は古い API を非アクティブ化するため、古い API キーは使用できなくなります。</string>
<string name="dialog_app_api_deprecation_description">
2024 年 6 月 1 日に、Open Weather は古い API を非アクティブ化するため、古い API キーは使用できなくなります。
プライバシー フレンドリーな天気アプリは廃止されるため、API の変更に対応できず、アプリは期待どおりに機能しません。

このアプリを引き続き使用する場合は、<a href="https://openweathermap.org/appid">OpenWeather の手順</a>に従って独自の API キーを取得してください。
APIキーを取得したら、設定でAPIキーを設定します。
</string>

</resources>
8 changes: 7 additions & 1 deletion app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,11 @@
<string name="owm_about">Dados meteorológicos fornecidos por:</string>
<string name="owm_logo_copyright">"O logótipo OpenWeatherMap está licenciado sob\n<a href="https://creativecommons.org/licenses/by-sa/3.0/deed.en">Creative Commons BY-SA licença.</a>"</string>
<string name="dialog_app_api_deprecation_title">Descontinuação de aplicativos e alterações de API</string>
<string name="dialog_app_api_deprecation_description">Em 1º de junho de 2024, o Open Weather desativa sua API antiga, portanto, as chaves da API antigas não podem mais ser usadas.</string>
<string name="dialog_app_api_deprecation_description">
Em 1º de junho de 2024, o Open Weather desativa sua API antiga, portanto, as chaves da API antigas não podem mais ser usadas.
Como o aplicativo Privacy Friendly Weather está obsoleto, não nos ajustaremos a nenhuma alteração na API e o aplicativo não funcionará conforme o esperado.

Se você quiser continuar usando este aplicativo, obtenha sua própria chave de API seguindo as <a href="https://openweathermap.org/appid">instruções do OpenWeather</a>.
Depois de obter sua chave API, defina-a nas configurações.
</string>
</resources>

0 comments on commit 38eb05a

Please sign in to comment.