diff --git a/.travis.yml b/.travis.yml index 55364d7..bc30847 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,10 @@ android: components: # The BuildTools version used by your project - tools - - build-tools-25.0.2 + - build-tools-27.0.3 # The SDK version used to compile your project - - android-25 + - android-27 # Repos needed - extra-android-m2repository diff --git a/build.gradle b/build.gradle index e7e61ee..13f07f0 100644 --- a/build.gradle +++ b/build.gradle @@ -2,10 +2,11 @@ buildscript { repositories { + google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.2' + classpath 'com.android.tools.build:gradle:3.1.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -14,6 +15,7 @@ buildscript { allprojects { repositories { + google() jcenter() mavenCentral() } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b062be8..2477568 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu May 25 21:57:55 WEST 2017 +#Mon Mar 26 22:13:27 WEST 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip diff --git a/library/build.gradle b/library/build.gradle index 590905b..764e5f7 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" + compileSdkVersion 27 + buildToolsVersion "27.0.3" defaultConfig { minSdkVersion 16 - targetSdkVersion 25 + targetSdkVersion 27 versionCode 1 versionName "1.0" } @@ -21,10 +21,8 @@ android { dependencies { - compile 'com.facebook.android:facebook-android-sdk:[4,5)' + api 'com.facebook.android:facebook-android-sdk:4.33.0' - compile "io.reactivex.rxjava2:rxjava:2.1.0" - - testCompile 'junit:junit:4.12' + implementation "io.reactivex.rxjava2:rxjava:2.1.12" } diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml index 69d392f..13e1a0b 100644 --- a/library/src/main/AndroidManifest.xml +++ b/library/src/main/AndroidManifest.xml @@ -1,46 +1,37 @@ + package="com.youclap.rxfacebook"> - + - - - + android:name=".login.FacebookLoginHandlerActivity" + android:launchMode="singleInstance" + android:theme="@style/Theme.Transparent" /> + + - + android:name="com.facebook.FacebookActivity" + android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" + android:label="@string/app_name" /> + android:name="com.facebook.CustomTabActivity" + android:exported="true"> - + - - + + - + - - diff --git a/library/src/main/java/com/youclap/rxfacebook/RxFacebookInitProvider.java b/library/src/main/java/com/youclap/rxfacebook/RxFacebookInitProvider.java deleted file mode 100644 index 7822be8..0000000 --- a/library/src/main/java/com/youclap/rxfacebook/RxFacebookInitProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.youclap.rxfacebook; - -import android.content.ContentProvider; -import android.content.ContentValues; -import android.content.Context; -import android.database.Cursor; -import android.net.Uri; - -import java.lang.ref.WeakReference; - -/** - * Content provider that does not provider any content. - * It provides an easy way to initialize this library - */ -public class RxFacebookInitProvider extends ContentProvider { - - private static WeakReference mContext; - - /** - * Should only be available package level - * - * @return the context of the application - */ - public static Context getAppContext() { - return mContext.get(); - } - - @Override - public boolean onCreate() { - mContext = new WeakReference<>(getContext()); - return true; - } - - @Override - public Cursor query(Uri uri, String[] strings, String s, String[] strings1, String s1) { - return null; - } - - @Override - public String getType(Uri uri) { - return null; - } - - @Override - public Uri insert(Uri uri, ContentValues contentValues) { - return null; - } - - @Override - public int delete(Uri uri, String s, String[] strings) { - return 0; - } - - @Override - public int update(Uri uri, ContentValues contentValues, String s, String[] strings) { - return 0; - } -} diff --git a/library/src/main/java/com/youclap/rxfacebook/login/RxFacebookLogin.java b/library/src/main/java/com/youclap/rxfacebook/login/RxFacebookLogin.java index 75eec4c..5661cec 100644 --- a/library/src/main/java/com/youclap/rxfacebook/login/RxFacebookLogin.java +++ b/library/src/main/java/com/youclap/rxfacebook/login/RxFacebookLogin.java @@ -1,8 +1,9 @@ package com.youclap.rxfacebook.login; +import android.content.Context; + import com.facebook.FacebookException; import com.facebook.login.LoginResult; -import com.youclap.rxfacebook.RxFacebookInitProvider; import java.util.Collection; @@ -10,8 +11,8 @@ public final class RxFacebookLogin { private static RxFacebookLoginMaybe mLoginObservable; - public static RxFacebookLoginMaybe logInWithReadPermissions(Collection permissions) { - FacebookLoginHandlerActivity.start(RxFacebookInitProvider.getAppContext(), permissions); + public static RxFacebookLoginMaybe logInWithReadPermissions(Context context, Collection permissions) { + FacebookLoginHandlerActivity.start(context, permissions); mLoginObservable = new RxFacebookLoginMaybe(); return mLoginObservable; } diff --git a/library/src/test/java/com/youclap/rxfacebook/ExampleUnitTest.java b/library/src/test/java/com/youclap/rxfacebook/ExampleUnitTest.java deleted file mode 100644 index 06adfd5..0000000 --- a/library/src/test/java/com/youclap/rxfacebook/ExampleUnitTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.youclap.rxfacebook; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - - @Test - public void addition_isCorrect() throws Exception { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/sample/.gitignore b/sample/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/sample/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/sample/build.gradle b/sample/build.gradle deleted file mode 100644 index bb84454..0000000 --- a/sample/build.gradle +++ /dev/null @@ -1,30 +0,0 @@ -apply plugin: 'com.android.application' - -android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" - - defaultConfig { - applicationId "com.youclap.rxfacebook.sample" - minSdkVersion 16 - targetSdkVersion 25 - versionCode 1 - versionName "1.0" - - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } -} - -dependencies { - compile project(path: ':library') - - compile 'com.android.support:appcompat-v7:25.3.1' - compile 'com.android.support.constraint:constraint-layout:1.0.2' - compile 'com.android.support:design:25.3.1' - -} diff --git a/sample/proguard-rules.pro b/sample/proguard-rules.pro deleted file mode 100644 index 6ad1551..0000000 --- a/sample/proguard-rules.pro +++ /dev/null @@ -1,25 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /Users/renatoalmeida/Library/Android/sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml deleted file mode 100644 index f54771b..0000000 --- a/sample/src/main/AndroidManifest.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sample/src/main/java/com/youclap/rxfacebook/sample/MainActivity.java b/sample/src/main/java/com/youclap/rxfacebook/sample/MainActivity.java deleted file mode 100644 index 90a1f33..0000000 --- a/sample/src/main/java/com/youclap/rxfacebook/sample/MainActivity.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.youclap.rxfacebook.sample; - -import com.facebook.CallbackManager; -import com.facebook.login.LoginResult; -import com.youclap.rxfacebook.login.RxFacebookLogin; - -import android.content.Intent; -import android.os.Bundle; -import android.support.design.widget.FloatingActionButton; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; -import android.util.Log; -import android.view.View; - -import java.util.ArrayList; -import java.util.List; - -import io.reactivex.annotations.NonNull; -import io.reactivex.functions.Action; -import io.reactivex.functions.Consumer; - -public class MainActivity extends AppCompatActivity { - - private static final String LOG_TAG = "MainActivity"; - - private CallbackManager callbackManager; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); - - callbackManager = CallbackManager.Factory.create(); - - FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); - fab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(final View view) { - - List perm = new ArrayList<>(); - perm.add("email"); - perm.add("public_profile"); - - RxFacebookLogin.logInWithReadPermissions(perm) - .subscribe(new Consumer() { - @Override - public void accept(@NonNull LoginResult loginResult) throws Exception { - Log.d(LOG_TAG, "accept " + loginResult.getAccessToken()); - } - }, new Consumer() { - @Override - public void accept(@NonNull Throwable throwable) throws Exception { - Log.e(LOG_TAG, "error ", throwable); - } - }, new Action() { - @Override - public void run() throws Exception { - Log.e(LOG_TAG, "onCompleted"); - } - }); - } - }); - } - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - callbackManager.onActivityResult(requestCode, resultCode, data); - } - -} diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml deleted file mode 100644 index bcb03e1..0000000 --- a/sample/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/sample/src/main/res/layout/content_main.xml b/sample/src/main/res/layout/content_main.xml deleted file mode 100644 index 931b63e..0000000 --- a/sample/src/main/res/layout/content_main.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/sample/src/main/res/mipmap-hdpi/ic_launcher.png b/sample/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index cde69bc..0000000 Binary files a/sample/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png b/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 9a078e3..0000000 Binary files a/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/sample/src/main/res/mipmap-mdpi/ic_launcher.png b/sample/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index c133a0c..0000000 Binary files a/sample/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png b/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index efc028a..0000000 Binary files a/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/sample/src/main/res/mipmap-xhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index bfa42f0..0000000 Binary files a/sample/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 3af2608..0000000 Binary files a/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 324e72c..0000000 Binary files a/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 9bec2e6..0000000 Binary files a/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index aee44e1..0000000 Binary files a/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 34947cd..0000000 Binary files a/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/sample/src/main/res/values/colors.xml b/sample/src/main/res/values/colors.xml deleted file mode 100644 index d4f13b8..0000000 --- a/sample/src/main/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - #ff0011 - #7b000a - #3b5998 - diff --git a/sample/src/main/res/values/dimens.xml b/sample/src/main/res/values/dimens.xml deleted file mode 100644 index 59a0b0c..0000000 --- a/sample/src/main/res/values/dimens.xml +++ /dev/null @@ -1,3 +0,0 @@ - - 16dp - diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml deleted file mode 100644 index 7cdf955..0000000 --- a/sample/src/main/res/values/strings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - RxFacebook Sample - - TODO ADD facebook_app_id - TODO ADD fb_login_protocol_scheme - - diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml deleted file mode 100644 index 7c6a69f..0000000 --- a/sample/src/main/res/values/styles.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - -