Skip to content
This repository was archived by the owner on Feb 14, 2020. It is now read-only.

Commit 49e194f

Browse files
committed
Modify package to allow for clean package for com.parse
1 parent ee68bdf commit 49e194f

File tree

13 files changed

+57
-41
lines changed

13 files changed

+57
-41
lines changed

README.md

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,50 @@
11
# Parse Twitter Utils for Android
22
[![Build Status][build-status-svg]][build-status-link]
33
[![Coverage Status][coverage-status-svg]][coverage-status-link]
4-
[![Maven Central][maven-svg]][maven-link]
54
[![License][license-svg]][license-link]
65

7-
A utility library to authenticate `ParseUser`s with Twitter. For more information, see our [guide][guide].
6+
A utility library to authenticate `ParseUser`s with Twitter.
87

9-
## Download
10-
Download [the latest JAR][latest] or define in Gradle:
8+
## Dependency
119

12-
```groovy
13-
dependencies {
14-
compile 'com.parse:parsetwitterutils-android:1.10.6'
15-
}
16-
```
17-
18-
Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap].
19-
20-
## Usage
21-
Everything can done through the supplied gradle wrapper:
10+
Add this in your root `build.gradle` file (**not** your module `build.gradle` file):
2211

23-
### Compile a JAR
24-
```
25-
./gradlew clean jarRelease
12+
```gradle
13+
allprojects {
14+
repositories {
15+
...
16+
maven { url "https://jitpack.io" }
17+
}
18+
}
2619
```
27-
Outputs can be found in `Parse/build/libs/`
2820

29-
### Run the Tests
30-
```
31-
./gradlew clean testDebug
21+
Then, add the library to your project `build.gradle`
22+
```gradle
23+
dependencies {
24+
implementation 'com.github.parse-community:ParseTwitterUtils-Android:latest.version.here'
25+
}
3226
```
33-
Results can be found in `Parse/build/reports/`
3427

35-
### Get Code Coverage Reports
28+
## Usage
29+
Extensive docs can be found in the [guide][guide]. The basic steps are:
30+
```java
31+
ParseTwitterUtils.initialize("YOUR CONSUMER KEY", "YOUR CONSUMER SECRET");
3632
```
37-
./gradlew clean jacocoTestReport
33+
Then later, when your user taps the login button:
34+
```java
35+
ParseTwitterUtils.logIn(this, new LogInCallback() {
36+
@Override
37+
public void done(ParseUser user, ParseException err) {
38+
if (user == null) {
39+
Log.d("MyApp", "Uh oh. The user cancelled the Twitter login.");
40+
} else if (user.isNew()) {
41+
Log.d("MyApp", "User signed up and logged in through Twitter!");
42+
} else {
43+
Log.d("MyApp", "User logged in through Twitter!");
44+
}
45+
}
46+
});
3847
```
39-
Results can be found in `Parse/build/reports/`
4048

4149
## How Do I Contribute?
4250
We want to make contributing to this project as easy and transparent as possible. Please refer to the [Contribution Guidelines](CONTRIBUTING.md).

build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ buildscript {
99
}
1010
}
1111

12+
plugins {
13+
id 'com.github.ben-manes.versions' version '0.20.0'
14+
}
15+
1216
allprojects {
1317
repositories {
1418
google()

library/src/main/java/com/parse/ParseTwitterUtils.java renamed to library/src/main/java/com/parse/twitter/ParseTwitterUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public final class ParseTwitterUtils {
2828
private static final String CALLBACK_URL = "twittersdk://";
2929

3030
private static final Object lock = new Object();
31-
/* package for tests */ static boolean isInitialized;
32-
/* package for tests */ static TwitterController controller;
33-
/* package for tests */ static ParseUserDelegate userDelegate = new ParseUserDelegateImpl();
31+
static boolean isInitialized;
32+
static TwitterController controller;
33+
static ParseUserDelegate userDelegate = new ParseUserDelegateImpl();
3434

3535
private static TwitterController getTwitterController() {
3636
synchronized (lock) {
@@ -467,7 +467,7 @@ private ParseTwitterUtils() {
467467
// do nothing
468468
}
469469

470-
/* package for tests */ interface ParseUserDelegate {
470+
interface ParseUserDelegate {
471471
void registerAuthenticationCallback(String authType, AuthenticationCallback callback);
472472
Task<ParseUser> logInWithInBackground(String authType, Map<String, String> authData);
473473
}

library/src/main/java/com/parse/twitter/Twitter.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
import android.os.AsyncTask;
1414
import android.webkit.CookieSyncManager;
1515

16-
import com.parse.oauth.OAuth1FlowDialog;
17-
import com.parse.oauth.OAuth1FlowDialog.FlowResultHandler;
18-
import com.parse.oauth.OAuth1FlowException;
16+
import com.parse.twitter.oauth.OAuth1FlowDialog;
17+
import com.parse.twitter.oauth.OAuth1FlowDialog.FlowResultHandler;
18+
import com.parse.twitter.oauth.OAuth1FlowException;
1919

2020
import oauth.signpost.http.HttpParameters;
2121
import okhttp3.HttpUrl;
@@ -24,9 +24,9 @@
2424

2525
public class Twitter {
2626

27-
static final String REQUEST_TOKEN_URL = "https://api.twitter.com/oauth/request_token";
28-
static final String AUTHORIZE_URL = "https://api.twitter.com/oauth/authenticate";
29-
static final String ACCESS_TOKEN_URL = "https://api.twitter.com/oauth/access_token";
27+
private static final String REQUEST_TOKEN_URL = "https://api.twitter.com/oauth/request_token";
28+
private static final String AUTHORIZE_URL = "https://api.twitter.com/oauth/authenticate";
29+
private static final String ACCESS_TOKEN_URL = "https://api.twitter.com/oauth/access_token";
3030

3131
private static final String VERIFIER_PARAM = "oauth_verifier";
3232
private static final String USER_ID_PARAM = "user_id";

library/src/main/java/com/parse/TwitterController.java renamed to library/src/main/java/com/parse/twitter/TwitterController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import bolts.Task;
2020

21-
/** package */ class TwitterController {
21+
class TwitterController {
2222

2323
private static final String CONSUMER_KEY_KEY = "consumer_key";
2424
private static final String CONSUMER_SECRET_KEY = "consumer_secret";

library/src/main/java/com/parse/internal/gdata/Escaper.java renamed to library/src/main/java/com/parse/twitter/gdata/Escaper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515

1616

17-
package com.parse.internal.gdata;
17+
package com.parse.twitter.gdata;
1818

1919
/**
2020
* An object that converts literal text into a format safe for inclusion in a

library/src/main/java/com/parse/internal/gdata/Preconditions.java renamed to library/src/main/java/com/parse/twitter/gdata/Preconditions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.parse.internal.gdata;
17+
package com.parse.twitter.gdata;
1818

1919
import java.util.NoSuchElementException;
2020

library/src/main/java/com/parse/internal/gdata/UnicodeEscaper.java renamed to library/src/main/java/com/parse/twitter/gdata/UnicodeEscaper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
*/
1515

1616

17-
package com.parse.internal.gdata;
17+
package com.parse.twitter.gdata;
1818

19-
import static com.parse.internal.gdata.Preconditions.checkNotNull;
19+
import static com.parse.twitter.gdata.Preconditions.checkNotNull;
2020

2121
import java.io.IOException;
2222

@@ -252,7 +252,7 @@ protected final String escapeSlow(String s, int index) {
252252
*
253253
*/
254254
public Appendable escape(final Appendable out) {
255-
checkNotNull(out);
255+
Preconditions.checkNotNull(out);
256256

257257
return new Appendable() {
258258
int pendingHighSurrogate = -1;

0 commit comments

Comments
 (0)