Giter VIP home page Giter VIP logo

Comments (22)

Aracem avatar Aracem commented on July 23, 2024

I revised the code of Google Plus, Twitter and Facebook social networks and the Fragment is not used for nothing more than fragment.getActivity().

In the documentation of the SocialNetwork class says:
"@param fragment ant not activity or context, as we will need to call startActivityForResult,
we will want to receice on onActivityResult in out SocialNetworkManager
fragment"

But it has no sense because the Activity can pass the onActivityResult with the simple code of:
Fragment fragment = getSupportFragmentManager().findFragmentByTag(SOCIAL_TAG);
if (fragment != null) {
fragment.onActivityResult(requestCode, resultCode, data);
}

ĺike the original Android Social Network library.
If I have to use ASNE inside a Fragments destroys the amaaaazing modularization of the library :(

Anyway, I going to try this .... shitty ... ugly ... shameful patch: extends Fragment and override "getActivity" to return the activity without make a commit, only to test if its possible to use without a real fragment

from asne.

thedumbtechguy avatar thedumbtechguy commented on July 23, 2024

I was having issues with this issue as well. I wrote my own fix like this

protected SocialNetwork(Fragment fragment, Context context) {
        mSocialNetworkManager = fragment;
        mSharedPreferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
}

So I used it like so

FacebookSocialNetwork fbNetwork = new FacebookSocialNetwork(mSocialNetworkManager, ctx, fbScope);

GooglePlusSocialNetwork gpNetwork = new GooglePlusSocialNetwork(mSocialNetworkManager, ctx);

I simply pass the socialNetworkManager fragment from my activity as the fragment and the activity as context. Obviously, the relevant SocialNetworkClasses (I am only using facebook and google) were modified.

from asne.

tylerjroach avatar tylerjroach commented on July 23, 2024

@frostymarvelous Really nice solution!

from asne.

thedumbtechguy avatar thedumbtechguy commented on July 23, 2024

Thanks @tylerjroach

from asne.

Aracem avatar Aracem commented on July 23, 2024

@frostymarvelous can you make a pull request with the solution?

Thank you very much

from asne.

thedumbtechguy avatar thedumbtechguy commented on July 23, 2024

ASAP. My computer died on me this morning.

from asne.

thedumbtechguy avatar thedumbtechguy commented on July 23, 2024

Done. Can someone please review it for me, I couldn't make a build to test it.

from asne.

Aracem avatar Aracem commented on July 23, 2024

Thanks @frostymarvelous We have to wait @gorbin to accept it

from asne.

pierrexn avatar pierrexn commented on July 23, 2024

I try to use your changes to use ASNE into an Activity, but it doens't work, fragment.getActivity() is null

mSocialNetworkManager = new SocialNetworkManager();
ArrayList fbScope = new ArrayList();
fbScope.addAll(Arrays.asList("public_profile, email, user_friends"));
FacebookSocialNetwork fbNetwork = new FacebookSocialNetwork(mSocialNetworkManager, this, fbScope);
mSocialNetworkManager.addSocialNetwork(fbNetwork);

from asne.

thedumbtechguy avatar thedumbtechguy commented on July 23, 2024

@pierrexn did you change SocialNetwork like below as well??

protected SocialNetwork(Fragment socialMediaManager, Context context) {
    //we keep the fragment in case it is needed in future. it also minimises the changes required.
    mSocialNetworkManager = socialMediaManager;
    mSharedPreferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
}

from asne.

pierrexn avatar pierrexn commented on July 23, 2024

yes, it works if i replace in FacebookSocialNetwork, fragment.getActivity() by context

from asne.

thedumbtechguy avatar thedumbtechguy commented on July 23, 2024

O man! I missed it

String applicationID = Utility.getMetadataApplicationId(fragment.getActivity());

should be

 String applicationID = Utility.getMetadataApplicationId(context);

from asne.

thedumbtechguy avatar thedumbtechguy commented on July 23, 2024

@pierrexn fixed with this thedumbtechguy@9c32049

from asne.

amouly avatar amouly commented on July 23, 2024

@Aracem what about this? I need to fix this immediately, how is possible that this fix is not on the build yet?

from asne.

thedumbtechguy avatar thedumbtechguy commented on July 23, 2024

I think he no longer maintains this. We might need another fork.

from asne.

Aracem avatar Aracem commented on July 23, 2024

Yes, as @gorbin says in the Readme:

"Sorry, but I freeze work on project for some time(I hope not long, nearly month) - too busy. I saw all Issues and will resolve them as soon as I can.

I checked project - current maven libs mostly works fine. For now I need help with Issues and open for pull requests - will check them and merge on weekends."

I have more or less ready a PR with Fabric integration that could be good for others. Perhaps is time to create a Fork to continuing the work

from asne.

thedumbtechguy avatar thedumbtechguy commented on July 23, 2024

Let's go ahead and create the Fork. This is a critical library. When Login fails, users run!

from asne.

amouly avatar amouly commented on July 23, 2024

I just need to instantiate the Manager from Activity, not from Fragment.

from asne.

gorbin avatar gorbin commented on July 23, 2024

Hello, guys I'm really sorry, I'm too busy now and cant maintains ASNE, but I check and update it on vacation as soon as posible.
But if you want to pull new features or updated possibilities I check it on my free time. Or I can add somebody to repo owners to update it more quikcly.

I will maintains this repo but only when I'm really can, sorry for this

from asne.

thedumbtechguy avatar thedumbtechguy commented on July 23, 2024

@gorbin Make me and owner on the lib.

It needs some work and I am willing to maintain it.

from asne.

gorbin avatar gorbin commented on July 23, 2024

@frostymarvelous add you as collaborator, thruly there are a lot of work to do.
I am planning update gradle, all dependecies and solve issues.
right now want to update master branch, then work in dev to restore functionality, only after test merge it to master and build release for libs, then update it in central - to restore functionality
You can contact with me via email to discuss plans.

from asne.

thedumbtechguy avatar thedumbtechguy commented on July 23, 2024

Great. Sure thing.

from asne.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.