Commit 8613a1ef authored by Donald's avatar Donald

clean keys for f-droid

parent 553b77cb
......@@ -10,5 +10,4 @@
/build
/captures
/scripts/crowdin.key
/app/src/main/java/com/horaapps/leafpic/SecretConstants.java
app/src/main/java/org/horaapps/leafpic/SecretConstants.java
/app/src/main/assets/secretconstants.properties
......@@ -63,6 +63,7 @@ import org.horaapps.leafpic.Data.CustomAlbumsHandler;
import org.horaapps.leafpic.Data.ImageFileFilter;
import org.horaapps.leafpic.Data.Media;
import org.horaapps.leafpic.R;
import org.horaapps.leafpic.SecretConstants;
import org.horaapps.leafpic.SelectAlbumBottomSheet;
import org.horaapps.leafpic.Views.GridSpacingItemDecoration;
import org.horaapps.leafpic.Views.SharedMediaActivity;
......@@ -186,6 +187,7 @@ public class MainActivity extends SharedMediaActivity {
initUI();
setupUI();
Toast.makeText(this, SecretConstants.getBase64EncodedPublicKey(getApplicationContext()), Toast.LENGTH_SHORT).show();
displayPreFetchedData(getIntent().getExtras());
}
......
package org.horaapps.leafpic;
import android.content.Context;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* Created by dnld on 31/07/16.
*/
public class SecretConstants {
private static String base64EncodedPublicKey;
public static String getBase64EncodedPublicKey(Context context) {
if (base64EncodedPublicKey == null) {
InputStream input;
try {
input = context.getAssets().open("secretconstants.properties");
Properties properties = new Properties();
properties.load(input);
base64EncodedPublicKey = properties.getProperty("gplaykey");
} catch (IOException e) {
// file not found
base64EncodedPublicKey = "";
}
}
return base64EncodedPublicKey;
}
}
package org.horaapps.leafpic;
/**
* Created by dnld on 31/07/16.
*/
public class SecretConstantsExample {
//NOTE: if you want to build this app rename this file as SecretConstants and get your keys.
//you can get a free token at https://www.mapbox.com
public static String MAP_BOX_TOKEN = "pk.################################################";
//needed for iap
public static String PLAY_STORE_KEY = "########################################################################";
}
......@@ -19,7 +19,6 @@ import com.bumptech.glide.Glide;
import com.drew.lang.GeoLocation;
import org.horaapps.leafpic.Data.Media;
import org.horaapps.leafpic.Activities.SettingsActivity;
import org.horaapps.leafpic.SecretConstants;
import org.horaapps.leafpic.Views.ThemedActivity;
import java.lang.reflect.Field;
......@@ -167,6 +166,7 @@ public class AlertDialogsHelper {
final GeoLocation location;
if((location = f.getGeoLocation()) != null) {
PreferenceUtil SP = PreferenceUtil.getInstance(activity.getApplicationContext());
String MAP_BOX_TOKEN = "pk.eyJ1IjoiZG5sZCIsImEiOiJjaXF2NmwzMHUwMDd2aHNtMzlscHVseTVnIn0.oCeek-FdSfAU4yoELHzJYA";
String url;
switch (SP.getInt(activity.getString(org.horaapps.leafpic.R.string.preference_map_provider),
SettingsActivity.GOOGLE_MAPS_PROVIDER)) {
......@@ -177,17 +177,17 @@ public class AlertDialogsHelper {
break;
case SettingsActivity.OSM_MAP_BOX:
url = String.format(Locale.getDefault(),"https://api.mapbox.com/v4/mapbox.streets/%f,%f,15/500x300.jpg?access_token=%s",
location.getLongitude(),location.getLatitude(), SecretConstants.MAP_BOX_TOKEN);
location.getLongitude(),location.getLatitude(), MAP_BOX_TOKEN);
break;
case SettingsActivity.OSM_MAP_BOX_DARK:
url = String.format(Locale.getDefault(),"https://api.mapbox.com/v4/mapbox.dark/%f,%f,15/500x300.jpg?access_token=%s",
location.getLongitude(),location.getLatitude(), SecretConstants.MAP_BOX_TOKEN);
location.getLongitude(),location.getLatitude(), MAP_BOX_TOKEN);
break;
case SettingsActivity.OSM_MAP_BOX_LIGHT:
url = String.format(Locale.getDefault(),"https://api.mapbox.com/v4/mapbox.light/%f,%f,15/500x300.jpg?access_token=%s",
location.getLongitude(),location.getLatitude(), SecretConstants.MAP_BOX_TOKEN);
location.getLongitude(),location.getLatitude(), MAP_BOX_TOKEN);
break;
case SettingsActivity.OSM_TYLER_PROVIDER:
......
......@@ -62,7 +62,7 @@ public class DonateActivity extends ThemedActivity {
cts = new CustomTabService(DonateActivity.this, getPrimaryColor());
scr = (ScrollView)findViewById(org.horaapps.leafpic.R.id.donateAct_scrollView);
mHelper = new IabHelper(this, SecretConstants.PLAY_STORE_KEY);
mHelper = new IabHelper(this, SecretConstants.getBase64EncodedPublicKey(getApplicationContext()));
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment