Skip to content

Commit

Permalink
added consumer key obfuscation
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearfog committed Jan 7, 2021
1 parent 79738e1 commit c7cb045
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'io.michaelrocks.paranoid'

android {
buildToolsVersion '30.0.2'
Expand Down Expand Up @@ -33,6 +34,10 @@ android {
versionNameSuffix '.DEBUG'
}
}

paranoid {
enabled true
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.LinkedList;
import java.util.List;

import io.michaelrocks.paranoid.Obfuscate;
import twitter4j.DirectMessage;
import twitter4j.GeoLocation;
import twitter4j.IDs;
Expand All @@ -52,8 +53,12 @@
/**
* Backend for twitter API.
*/
@Obfuscate
public class TwitterEngine {

private static final String CONSUMER_KEY = BuildConfig.API_KEY_1;
private static final String CONSUMER_KEY_SECRET = BuildConfig.API_KEY_2;

private static final TwitterEngine mTwitter = new TwitterEngine();

private Twitter twitter;
Expand All @@ -68,14 +73,13 @@ public class TwitterEngine {
private TwitterEngine() {
}


/**
* Initialize Twitter4J instance
*/
private void initTwitter() {
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.setOAuthConsumerKey(BuildConfig.API_KEY_1);
builder.setOAuthConsumerSecret(BuildConfig.API_KEY_2);
builder.setOAuthConsumerKey(CONSUMER_KEY);
builder.setOAuthConsumerSecret(CONSUMER_KEY_SECRET);
// Twitter4J has its own proxy settings
if (settings.isProxyEnabled()) {
builder.setHttpProxyHost(settings.getProxyHost());
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'io.michaelrocks:paranoid-gradle-plugin:0.3.2'
}
}

Expand Down

0 comments on commit c7cb045

Please sign in to comment.