Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09b1f161 authored by Romain Hunault's avatar Romain Hunault
Browse files

Add a default OWM key during build

parent abb8ff53
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -6,6 +6,7 @@ stages:
before_script:
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
- chmod +x ./gradlew
- sed -i -e 's/<string name="default_key"><\/string>/<string name="default_key">'${DEFAULT_OWM_KEY}'<\/string>/g' app/src/main/res/values/strings.xml


cache:
cache:
  key: ${CI_PROJECT_ID}
  key: ${CI_PROJECT_ID}
+2 −2
Original line number Original line Diff line number Diff line
@@ -68,7 +68,7 @@ public class OpenWeatherMapProviderService extends WeatherProviderService
        final SharedPreferences preferences
        final SharedPreferences preferences
                = PreferenceManager.getDefaultSharedPreferences(this);
                = PreferenceManager.getDefaultSharedPreferences(this);
        preferences.registerOnSharedPreferenceChangeListener(this);
        preferences.registerOnSharedPreferenceChangeListener(this);
        final String mApiId = preferences.getString(API_KEY, null);
        final String mApiId = preferences.getString(API_KEY, getString(R.string.default_key));
        mOpenWeatherMapService.setApiKey(mApiId);
        mOpenWeatherMapService.setApiKey(mApiId);
    }
    }


@@ -146,7 +146,7 @@ public class OpenWeatherMapProviderService extends WeatherProviderService
    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
        if (key.equals(API_KEY)) {
        if (key.equals(API_KEY)) {
            Logging.logd("API key has changed");
            Logging.logd("API key has changed");
            final String mApiKey = sharedPreferences.getString(key, null);
            final String mApiKey = sharedPreferences.getString(key, getString(R.string.default_key));
            mOpenWeatherMapService.setApiKey(mApiKey);
            mOpenWeatherMapService.setApiKey(mApiKey);
        }
        }
    }
    }
+2 −0
Original line number Original line Diff line number Diff line
@@ -37,4 +37,6 @@
    <string name="prefscreen_disclaimer_summary">The information provided by this application is provided for general information purposes only</string>
    <string name="prefscreen_disclaimer_summary">The information provided by this application is provided for general information purposes only</string>
    <string name="copyright_title">Copyright</string>
    <string name="copyright_title">Copyright</string>
    <string name="copyright_summary">OpenWeatherMap is a registered trademark of OpenWeatherMap Inc, both in the United States and internationally</string>
    <string name="copyright_summary">OpenWeatherMap is a registered trademark of OpenWeatherMap Inc, both in the United States and internationally</string>

    <string name="default_key"></string>
</resources>
</resources>
 No newline at end of file
+1 −1

File changed.

Contains only whitespace changes.