This repository has been archived by the owner on May 24, 2022. It is now read-only.
forked from amahule/FBReaderJ
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from itsyash/master
developer specific keys in a separate properties file
- Loading branch information
Showing
6 changed files
with
71 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 49 additions & 7 deletions
56
src/org/geometerplus/android/fbreader/network/bookshare/BookshareDeveloperKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,56 @@ | ||
package org.geometerplus.android.fbreader.network.bookshare; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Properties; | ||
import android.content.Context; | ||
import android.content.res.AssetManager; | ||
import android.content.res.Resources; | ||
|
||
/** | ||
* Enter your developer key here. | ||
* It will be read by other Bookshare classes | ||
* This file reads the developer key from the developer.properties file in | ||
* assets/developerSpecific folder. It will be read by other Bookshare classes. | ||
* You can obtain a developer key from http://developer.bookshare.org | ||
*/ | ||
public class BookshareDeveloperKey { | ||
|
||
// Enter your developer key here | ||
public static final String DEVELOPER_KEY = ""; | ||
public static final String BUGSENSE_KEY = ""; | ||
public static final boolean OPT_OUT_GOOGLE_ANALYTICS = false; | ||
|
||
public static String DEVELOPER_KEY = ""; | ||
public static String BUGSENSE_KEY = ""; | ||
public static boolean OPT_OUT_GOOGLE_ANALYTICS = false; | ||
|
||
public static void initialize(Context applicationContext) { | ||
// TODO Auto-generated method stub | ||
final Context mcontext = applicationContext; | ||
getProperties(mcontext); | ||
|
||
} | ||
|
||
private static void getProperties(Context mcontext) { | ||
// TODO Auto-generated method stub | ||
Resources resources = mcontext.getResources(); | ||
AssetManager assetManager = resources.getAssets(); | ||
|
||
// Read from the /assets directory | ||
try { | ||
InputStream inputStream = assetManager | ||
.open("developerSpecific/developer.properties"); | ||
Properties properties = new Properties(); | ||
properties.load(inputStream); | ||
System.out.println("The properties are now loaded"); | ||
System.out.println("properties: " + properties); | ||
BUGSENSE_KEY = properties.getProperty("bugSenseKey"); | ||
DEVELOPER_KEY = properties.getProperty("developerKey"); | ||
if (properties.getProperty("optOutGoogleAnalytics") | ||
.equalsIgnoreCase("false")) { | ||
OPT_OUT_GOOGLE_ANALYTICS = false; | ||
} else { | ||
OPT_OUT_GOOGLE_ANALYTICS = true; | ||
} | ||
|
||
} catch (IOException e) { | ||
System.err.println("Failed to open developer.property file"); | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters