Skip to content

Commit

Permalink
only show 1 time 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 8e52377 commit 47f5236
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;

import androidx.appcompat.app.AppCompatActivity;

import org.secuso.privacyfriendlyweather.BuildConfig;
import org.secuso.privacyfriendlyweather.database.AppDatabase;
import org.secuso.privacyfriendlyweather.preferences.AppPreferencesManager;
import org.secuso.privacyfriendlyweather.preferences.PrefManager;

/**
Expand All @@ -21,15 +24,19 @@ protected void onCreate(Bundle savedInstanceState) {
database.cityDao().getCityById(0);

prefManager = new PrefManager(this);
AppPreferencesManager prefManager2 = new AppPreferencesManager(PreferenceManager.getDefaultSharedPreferences(this));
if (prefManager.isFirstTimeLaunch()) { //First time go to TutorialActivity
//TODO make DB call async

Intent mainIntent = new Intent(SplashActivity.this, TutorialActivity.class);
SplashActivity.this.startActivity(mainIntent);
} else if (!prefManager.askedForOWMKey()) {
} else if (!prefManager.askedForOWMKey() &&
prefManager2.getOWMApiKey(this).equals(BuildConfig.DEFAULT_API_KEY)) {

Intent keyIntent = new Intent(this, CreateKeyActivity.class);
keyIntent.putExtra("429", false);
this.startActivity(keyIntent);

} else { //otherwise directly start ForecastCityActivity
Intent mainIntent = new Intent(SplashActivity.this, ForecastCityActivity.class);
SplashActivity.this.startActivity(mainIntent);
Expand Down

0 comments on commit 47f5236

Please sign in to comment.