Social Media Sign Up

alt tag

Nowadays most of the mobile apps are integrating with the most famous social media platforms (Facebook, Instagram, Twitter, Google Plus and LinkedIn). For the developer, it’s going to be a hassle to communicate with all of these platforms. So, SocialMediaSignUp library makes the magic for you, with only one line of code, you can integrate with the most famous social media platform :

And get the user data without handling anything from your side. SO EASY SO SIMPLE.


Features


Benefits


Installation

For Gradle : Step 1 : Add it in your root build.gradle at the end of repositories:

    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }

Step 2 : Add the dependency

    dependencies {
            implementation 'com.github.ahmed-adel-said:socialmediasignup:v1.0'
    }

For Maven : Step 1 : Add it in your root build.gradle at the end of repositories:

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

Step 2. Add the dependency

    <dependency>
        <groupId>com.github.ahmed-adel-said</groupId>
        <artifactId>socialmediasignup</artifactId>
        <version>-v1.0</version>
    </dependency>

Documentation "The first two points are mandatory":

1. To add your public, secret and application keys for every social media platform, all you have to do is to override the default values that the library has and put or own values in the build.gradle file app of your app module :

android.defaultConfig.manifestPlaceholders = [
        facebookAppId         : "FACEBOOK_APP_ID",
        googleWebClientId     : "GOOGLE_WEB_CLIENT_ID",
        twitterConsumerKey    : "TWITTER_CONSUMER_KEY”,
        twitterConsumerSecret : "TWITTER_CONSUMER_SECRET",
        instagramClientId     : "INSTAGRAM_CLIENT_KEY",
        instagramClientSecret : "INSTAGRAM_CLIENT_SECRET",
        instagramRedirectUri  : "INSTAGRAM_REDIRECT_URI"
]

2. You must add the social media sdk versions by yourself in the build.gradle file of the project module. Since our SocialMediaSignUp library will wait them from you to be your mission to always making the social media sdk versions up-to-date :

ext {
    socialMediaSignUpLibraries = [
            facebookVersion  : '4.30.0',
            googlePlusVersion: '11.8.0',
            twitterVersion   : '3.2.0'
    ]
}
  1. If you want to get user data of any of the five social media platforms, all you have to do is to write this one line of code :

    /**
    * @param socialMediaType is enum class that has types of all social media platforms.
    * @param scopes that can be passed to each social media platform.
    * @param callback that will be fired once there is success, error, or sign out happens during the connection with any social media platform.
    */
    SocialMediaSignUp.getInstance().connectTo(SocialMediaType socialMediaType, List<String> scopes, SocialMediaSignUpCallback callback);
    /**
    * This is only for connecting with LinkedIn social media platform.
    * @param linkedInScope that will be passed to LinkedIn social media platform.
    * @param callback that will be fired once there is success, error, or sign out happened during the connection with LinkedIn social media platform.
    */
    SocialMediaSignUp.getInstance().connectToLinkedIn(Scope linkedInScope, SocialMediaSignUpCallback callback);
  2. While if you want to disconnect the connection between any of the five social media platforms, here is how can you make it :

    /**
    * @param socialMediaType is enum class that has types of all social media platforms.
    * @param callback that will be fired once there is success, error, or sign out happens during the connection with any social media platform.
    */
    SocialMediaSignUp.getInstance().disconnectService(SocialMediaType socialMediaType, SocialMediaSignUpCallback callback);
  3. Here is the SocialMediaType enum class :

    enum SocialMediaType {
        FACEBOOK("facebook"),
        GOOGLE_PLUS("google_plus"),
        TWITTER("twitter"),
        INSTAGRAM("instagram"),
        LINKEDIN("linkedin");
    }
  4. And the SocialMediaSignUpCallback interface :

    public interface SocialMediaSignUpCallback {
    void onSuccess(SocialMediaSignUp.SocialMediaType socialMediaType, SocialMediaUser socialMediaUser);
    void onError(Throwable error);
    void onSignOut(SocialMediaSignUp.SocialMediaType socialMediaType);
    }

Contributing

Any contributions are more than welcomed from other developers to help us make the SDK even better. Before you contribute there are a number of things that you should know please see CONTRIBUTING.md for details.


License

MIT License

Copyright (c) 2018 Ahmed Adel