Skip to content
This repository was archived by the owner on Jan 22, 2023. It is now read-only.

Commit b1f5411

Browse files
committed
update build configuration to ease open source transition, if I do it
1 parent 2eec144 commit b1f5411

File tree

5 files changed

+131
-53
lines changed

5 files changed

+131
-53
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ local.properties
1313
**/gen
1414
*~
1515
.DS_Store
16+
secrets.properties

app/build.gradle

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def props = new Properties()
88
if (keystoreProperties.exists()) {
99
props.load(new FileInputStream(keystoreProperties))
1010
} else {
11-
props['keystorefile'] = 'none';
11+
props['keystorefile'] = 'none'
1212
}
1313

1414
android {
@@ -36,6 +36,45 @@ android {
3636
versionCode System.getenv("BUILD_NUMBER") as Integer ?: Integer.parseInt(project.VERSION_CODE)
3737
versionName project.VERSION_NAME
3838
multiDexEnabled true
39+
40+
File secretsExists = new File("secrets.properties")
41+
if (secretsExists.exists()) {
42+
def secretsFile = rootProject.file('secrets.properties')
43+
def secrets = new Properties()
44+
secrets.load(new FileInputStream(secretsFile))
45+
46+
buildConfigField "String", "CONSUMER_KEY", secrets['CONSUMER_KEY']
47+
buildConfigField "String", "CONSUMER_SECRET", secrets['CONSUMER_SECRET']
48+
buildConfigField "String", "YOUTUBE_API_KEY", secrets['YOUTUBE_API_KEY']
49+
buildConfigField "String", "TWEETMARKER_KEY",secrets['TWEETMARKER_KEY']
50+
buildConfigField "String", "TWITLONGER_KEY", secrets['TWITLONGER_KEY']
51+
buildConfigField "String", "GIPHY_API_KEY", secrets['GIPHY_KEY']
52+
buildConfigField "String", "ARTICLE_API_KEY", secrets['ARTICLE_KEY']
53+
buildConfigField "String", "MERCURY_API_KEY", secrets['MERCURY_KEY']
54+
55+
buildConfigField "String", "CONSUMER_KEY_OLD_1", secrets['CONSUMER_KEY_OLD_1'] != null ? secrets['CONSUMER_KEY_OLD_1'] : "\"This is optional.\""
56+
buildConfigField "String", "CONSUMER_SECRET_OLD_1", secrets['CONSUMER_SECRET_OLD_1'] != null ? secrets['CONSUMER_SECRET_OLD_1'] : "\"This is optional.\""
57+
buildConfigField "String", "CONSUMER_KEY_OLD_2", secrets['CONSUMER_KEY_OLD_12'] != null ? secrets['CONSUMER_KEY_OLD_2'] : "\"This is optional.\""
58+
buildConfigField "String", "CONSUMER_SECRET_OLD_2", secrets['CONSUMER_SECRET_OLD_2'] != null ? secrets['CONSUMER_SECRET_OLD_2'] : "\"This is optional.\""
59+
buildConfigField "String", "CONSUMER_KEY_OLD_3", secrets['CONSUMER_KEY_OLD_3'] != null ? secrets['CONSUMER_KEY_OLD_3'] : "\"This is optional.\""
60+
buildConfigField "String", "CONSUMER_SECRET_OLD_3", secrets['CONSUMER_SECRET_OLD_3'] != null ? secrets['CONSUMER_SECRET_OLD_3'] : "\"This is optional.\""
61+
} else {
62+
buildConfigField "String", "CONSUMER_KEY", "\"View Talon's readme to learn about inserting your keys.\""
63+
buildConfigField "String", "CONSUMER_SECRET", "\"View Talon's readme to learn about inserting your keys.\""
64+
buildConfigField "String", "YOUTUBE_API_KEY", "\"View Talon's readme to learn about inserting your keys.\""
65+
buildConfigField "String", "TWEETMARKER_KEY", "\"View Talon's readme to learn about inserting your keys.\""
66+
buildConfigField "String", "TWITLONGER_KEY", "\"View Talon's readme to learn about inserting your keys.\""
67+
buildConfigField "String", "GIPHY_API_KEY", "\"View Talon's readme to learn about inserting your keys.\""
68+
buildConfigField "String", "ARTICLE_API_KEY", "\"View Talon's readme to learn about inserting your keys.\""
69+
buildConfigField "String", "MERCURY_API_KEY", "\"View Talon's readme to learn about inserting your keys.\""
70+
71+
buildConfigField "String", "CONSUMER_KEY_OLD_1", "\"This is optional.\""
72+
buildConfigField "String", "CONSUMER_SECRET_OLD_1", "\"This is optional.\""
73+
buildConfigField "String", "CONSUMER_KEY_OLD_2", "\"This is optional.\""
74+
buildConfigField "String", "CONSUMER_SECRET_OLD_2", "\"This is optional.\""
75+
buildConfigField "String", "CONSUMER_KEY_OLD_3", "\"This is optional.\""
76+
buildConfigField "String", "CONSUMER_SECRET_OLD_3", "\"This is optional.\""
77+
}
3978
}
4079

4180
File keystore = new File(props['keystorefile'])

app/src/main/java/com/klinker/android/twitter_l/APIKeys.java

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,20 @@ public APIKeys(Context c) {
7777

7878
// Key version is stored in the MaterialLogin.KEY_VERSION field.
7979
// Talon Plus
80-
public static String TWITTER_CONSUMER_KEY = "***REMOVED***";
81-
public static String TWITTER_CONSUMER_SECRET = "***REMOVED***";
80+
public static String TWITTER_CONSUMER_KEY = BuildConfig.CONSUMER_KEY_OLD_1;
81+
public static String TWITTER_CONSUMER_SECRET = BuildConfig.CONSUMER_SECRET_OLD_1;
8282

8383
// Talon (Plus)
84-
public static String TWITTER_CONSUMER_KEY_2 = "***REMOVED***";
85-
public static String TWITTER_CONSUMER_SECRET_2 = "***REMOVED***";
84+
public static String TWITTER_CONSUMER_KEY_2 = BuildConfig.CONSUMER_KEY_OLD_2;
85+
public static String TWITTER_CONSUMER_SECRET_2 = BuildConfig.CONSUMER_SECRET_OLD_2;
8686

8787
// Talon - Plus
88-
public static String TWITTER_CONSUMER_KEY_3 = "***REMOVED***";
89-
public static String TWITTER_CONSUMER_SECRET_3 = "***REMOVED***";
88+
public static String TWITTER_CONSUMER_KEY_3 = BuildConfig.CONSUMER_KEY_OLD_3;
89+
public static String TWITTER_CONSUMER_SECRET_3 = BuildConfig.CONSUMER_SECRET_OLD_3;
9090

9191
// Talon Android (June 5th w/ 77,056 downloads)
92-
public static String TWITTER_CONSUMER_KEY_4 = "***REMOVED***";
93-
public static String TWITTER_CONSUMER_SECRET_4 = "***REMOVED***";
92+
public static String TWITTER_CONSUMER_KEY_4 = BuildConfig.CONSUMER_KEY;
93+
public static String TWITTER_CONSUMER_SECRET_4 = BuildConfig.CONSUMER_SECRET;
9494

9595
/**
9696
* For the In-App Youtube Player
@@ -100,22 +100,16 @@ public APIKeys(Context c) {
100100
* Here is how you can get a key for yourself:
101101
* https://developers.google.com/youtube/android/player/register
102102
*/
103-
public static String YOUTUBE_API_KEY = "***REMOVED***";
103+
public static String YOUTUBE_API_KEY = BuildConfig.YOUTUBE_API_KEY;
104104

105105
/**
106106
* These are third party service API keys for Talon.
107107
*
108-
* If you wish to use these services, You will need to get a key as I will not be sharing mine
109-
* for obvious security reasons.
110-
*
111-
* Tweetmarker is a paid service, so if you want a key, you will have to pay $75 a month for it
112-
* For Twitlonger, you must request access to their API for your app. I do not know if he would grant an Open Source Api key or not.
113-
* TwitPic is dead, but I kept its classes in here so that you can still learn from them. The service no longer is supported.
108+
* If you wish to use these services, You will need to get a key for the ones you want to use.
114109
*/
115-
public static final String TWEETMARKER_API_KEY = "***REMOVED***";
116-
public static final String TWITLONGER_API_KEY = "***REMOVED***";
117-
public static final String TWITPIC_API_KEY = "8cd3757bb6acb94c61e3cbf840c91872";
118-
public static final String GIPHY_API_KEY = "***REMOVED***";
119-
public static final String ARTICLE_API_KEY = "***REMOVED***";
120-
public static final String MERCURY_API_KEY = "***REMOVED***";
110+
public static final String TWEETMARKER_API_KEY = BuildConfig.TWEETMARKER_KEY;
111+
public static final String TWITLONGER_API_KEY = BuildConfig.TWITLONGER_KEY;
112+
public static final String GIPHY_API_KEY = BuildConfig.GIPHY_API_KEY;
113+
public static final String ARTICLE_API_KEY = BuildConfig.ARTICLE_API_KEY;
114+
public static final String MERCURY_API_KEY = BuildConfig.MERCURY_API_KEY;
121115
}

readme.md

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,53 @@
22

33
![Main Drawer](Other/Promo\ Stuff/Graphics/Plus/Final\ Promos/Feature\ graphic\ 4.png)
44

5-
This is the Material Design version of Talon, my popular Twitter client.
5+
This is the complete version of the Twitter client that I created for Android. It is 100% open source, the only thing that you will have to do plug in is your own API keys.
66

7-
### Compiling Talon
7+
The code hasn't all aged-well. Most of it was created when I was just learning about coding. It works well though and can probably be considered one of the most popular third party Twitter apps.
88

9-
Please don't try to compile it as an ANT build. I beg you, just use Android Studio or IntelliJ and compile it with Gradle. It will make your life so much easier and I will not be answering questions about dependencies and compiling for Eclipse. We spent a long time changing all of our projects over to Gradle and I want it to help some people.
9+
### Building Talon
1010

11-
To compile it:
12-
13-
1. Check out the project with a *git clone <clone path here>*
14-
2. You can compile it from the command line by CDing into the folder then *./gradlew assembleDebug*
15-
3. Import it to IntelliJ or Android Studio by going to File -> Import Project... then selecting the *build.gradle* file in the root of the project
11+
Before Talon will work, you will need to generate some API keys, for Twitter. I will not be distributing my keys.
1612

1713
To get your Twitter API key, go through these steps:
1814

1915
1. sign in on their developer site (https://apps.twitter.com/)
20-
2. Click *Create New App* You will have to implement a callback url.
16+
2. Click `Create New App`.
2117
3. Choose a name, description, and website. These are all required and unique to your app, but it makes no difference what you call them. Anything will work here.
22-
4. For the callback URL, you can do anything you like, but to have it work out of the box, use: *http://www.talonforandroid.com*
23-
* If you want a different one (stressing that it really DOES NOT matter..) then change it in the LoginActivity under com.klinker.android.twitter.ui.setup
24-
5. Read and accept their *Rules of the Road*, then *Create your Twitter Application*
18+
4. For the callback URL, you can do anything you like, but to have it work out of the box, use: `http://talonfortwitter.com`
19+
* If you want a different one (stressing that it really DOES NOT matter..) then change it in the `LoginFragment`
20+
5. Read and accept their `Rules of the Road`, then `Create your Twitter Application`
2521
6. After it is created, you can change the icon and add some other info from the settings page.
26-
7. You NEED to go to the *Permissions* page of the app and select the *Read, Write and Access direct messages* option, or else you won't be able to do anything but view your timeline.
27-
28-
Once you get signed up and everything, just copy and paste your API key and API secret into the APIKeys class.
29-
30-
If you get TwitLonger or TweetMarker support, you can paste the keys for that into APIKeys class as well. If you do not get them, then those services WILL NOT work.
31-
32-
33-
### Pull Requests
34-
35-
One of the reasons that I decided to open source this wasn't just because people would be able to learn from it. I also need help. There are somethings that I just don't know how to do any better. I don't have experience or knowledge yet to understand what is going wrong with them or why they randomly fail for some people.
36-
37-
I have done the absolute best I can with this app, but the more minds working on it, the better. Chances are if you are here and actually reading the readme, you have far more experience programming than me anyways and know how things can be improved.
22+
7. You NEED to go to the `Permissions` page of the app and select the `Read, Write and Access direct messages` option, or else you won't be able to do anything but view your timeline.
3823

24+
##### Adding API Keys to the App
3925

40-
### Issues
26+
In the `.gitignore` file, I have ignored `secrets.properties` which should contain your keys. Go ahead, copy the `secrets.properties.sample` to `secrets.properties` and fill in the keys in it.
4127

42-
If you think something could be done better, then tell me. I am not saying that I will agree with you on it or that it will ever be the way you think it should be, but there is no hurt in asking.
28+
This allows me to keep the keys out of source control, but still build the app without any hassle.
4329

30+
There are fields for the Twitter keys, as well as some third party services that Talon utilizes. You do not have to generate keys for the third party services. Those services just will not work.
4431

45-
### Wrap Up
32+
##### Providing a Signing Configuration
4633

47-
There isn't to much more I have to say about this. I have put a ton of time and effort into this project and I truly hope that this helps someone out there. Take the leap, try something you never have before, see what you can learn from me and my mistakes.
34+
For release builds, add your keystore simply as `keystore` to the root of the project, then add a `keystore.properties` file to the root with (no quotation marks around these strings!):
4835

49-
Let me know if you have questions and I will answer them to the best of my ability.
36+
```
37+
KEY_SIGNATURE=xxxx
38+
KEY_ALIAS=xxxx
39+
```
5040

51-
Thanks and have fun with Talon!
41+
## Contributing
5242

5343

44+
Please fork this repository and contribute back using [pull requests](https://github.com/klinker24/Talon-for-Twitter/pulls). Features can be requested using [issues](https://github.com/klinker24/Talon-for-Twitter/issues). All code, comments, and critiques are greatly appreciated.
5445

5546

5647
---
5748

5849
## License
5950

60-
Copyright 2016 Luke Klinker
51+
Copyright 2018 Luke Klinker
6152

6253
Licensed under the Apache License, Version 2.0 (the "License");
6354
you may not use this file except in compliance with the License.

secrets.properties.sample

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#
2+
# Twitter's API Keys
3+
# THESE TWO ARE THE ONLY ONES REQUIRED TO RUN THE APP!
4+
# They are easy to obtain from Twitter
5+
#
6+
# Sign in with your Twitter credentials here:
7+
# https://apps.twitter.com/
8+
#
9+
# Then create a new application.
10+
#
11+
# For steps to creating an application, view the Readme.md
12+
#
13+
14+
CONSUMER_KEY=""
15+
CONSUMER_SECRET=""
16+
17+
18+
#
19+
# For the In-App Youtube Player
20+
# It WILL NOT work if you do not obtain a key for yourself.
21+
# It is easy to get one of these though.
22+
#
23+
# Here is how you can get a key for yourself:
24+
# https://developers.google.com/youtube/android/player/register
25+
#
26+
27+
YOUTUBE_API_KEY=""
28+
29+
30+
#
31+
# These are third party service API keys for Talon.
32+
#
33+
# If you wish to use these services, You will need to get a key for them, on your own.
34+
#
35+
36+
TWEETMARKER_KEY=""
37+
TWITLONGER_KEY=""
38+
MERCURY_KEY=""
39+
40+
41+
#
42+
# The Giphy key is their default beta key. You don't have to change it.
43+
#
44+
45+
GIPHY_KEY="dc6zaTOxFJmzC"
46+
47+
48+
#
49+
# This Article key is to use the readability browser. Feel free to use this key,
50+
# it is granted for the open source version of Talon.
51+
#
52+
53+
ARTICLE_KEY="2643c5064704db3ab62ef5b474e4defc"

0 commit comments

Comments
 (0)