Skip to content

Commit

Permalink
only show 429 response prompt when user has default key installed
Browse files Browse the repository at this point in the history
  • Loading branch information
sleep-yearning committed Dec 31, 2020
1 parent 47f5236 commit 1dd98f4
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.secuso.privacyfriendlyweather.BuildConfig;
import org.secuso.privacyfriendlyweather.R;
import org.secuso.privacyfriendlyweather.activities.CreateKeyActivity;
import org.secuso.privacyfriendlyweather.database.AppDatabase;
Expand All @@ -24,6 +25,7 @@
import org.secuso.privacyfriendlyweather.database.data.CurrentWeatherData;
import org.secuso.privacyfriendlyweather.database.data.Forecast;
import org.secuso.privacyfriendlyweather.database.data.WeekForecast;
import org.secuso.privacyfriendlyweather.preferences.AppPreferencesManager;
import org.secuso.privacyfriendlyweather.ui.updater.ViewUpdater;
import org.secuso.privacyfriendlyweather.weather_api.IDataExtractor;
import org.secuso.privacyfriendlyweather.weather_api.IProcessHttpRequest;
Expand Down Expand Up @@ -195,7 +197,11 @@ public void processSuccessScenario(String response) {
public void processFailScenario(final VolleyError error) {
if (error.networkResponse.statusCode == 429) {
//aufforderung lostreten
if (!CreateKeyActivity.active) {
AppPreferencesManager prefManager = new AppPreferencesManager(PreferenceManager.getDefaultSharedPreferences(context));
if (!CreateKeyActivity.active &&
//don't show if user has own key installed
//TODO test
prefManager.getOWMApiKey(context).equals(BuildConfig.DEFAULT_API_KEY)) {
Intent intent = new Intent(context, CreateKeyActivity.class);
intent.putExtra("429", true);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Expand Down

0 comments on commit 1dd98f4

Please sign in to comment.