xamarin / xamarin.social Goto Github PK
View Code? Open in Web Editor NEWXamarin.Social
License: Apache License 2.0
Xamarin.Social
License: Apache License 2.0
Where is the Xamarin.Media namespace defined? The iOS sample references Xamarin.Media ... so it does not compile in an out-of-the-box clone.
If an account goes bad, then we need a way to delete them from the account store.
public static void DeleteAccount (this FacebookService facebook, Account account)
{
var acs = AccountStore.Create ();
// acs.Delete (account);
}
public static async Task<bool> DeauthorizeAccount (this FacebookService facebook, Account account)
{
var acs = AccountStore.Create ();
acs.Delete (account);
var req = facebook.CreateRequest (
"DELETE",
new Uri ("https://graph.facebook.com/me/permissions"),
account);
using (var resp = await req.GetResponseAsync ()) {
return (bool)JsonValue.Parse (resp.GetResponseText ());
}
}
@ermau I wasn't sure where to post this, so I post here.
Why do you keep one instance of ACAccountStore
, but use a new one every time?
I'm looking at GetAccountsAsync
in Twitter5Service
:
public override Task<IEnumerable<Account>> GetAccountsAsync ()
{
if (accountStore == null) {
accountStore = new ACAccountStore ();
}
var store = new ACAccountStore ();
var at = store.FindAccountType (ACAccountType.Twitter);
Note that you're working with store
, while a reference to accountStore
is kept.
I saw threads about ACAccount
s dead without their store, but surely accountStore
is different from store
so it doesn't help?
I'm confused.
public Task<Account> Authenticate (UIViewController context)
{
var authTC = new TaskCompletionSource<Account> ();
authUI = facebook.GetAuthenticateUI (a => {
authTC.SetResult (a);
rootUI.DismissViewController (true, null);
});
rootUI.PresentViewController (authUI, true, null);
return authTC.Task;
}
Needed so that account management UIs can be built
Add a GetGraphNode or similar function to FacebookService.
Right now we have to type:
var req = s.CreateRequest (
"GET",
new Uri ("https://graph.facebook.com/598072388?fields=friends.fields(first_name,name,gender,updated_time)"),
account);
var resp = await req.GetResponseAsync ();
var json = JsonObject.Parse (resp.GetResponseText ());
It would be nice to get that down to 1 line:
public static async Task<JsonObject> GetGraphLinkAsync (this FacebookService facebook, string link, Account account)
{
var req = facebook.CreateRequest (
"GET",
new Uri (link),
account);
using (var resp = await req.GetResponseAsync ()) {
return (JsonObject)JsonObject.Parse (resp.GetResponseText ());
}
}
public static async Task<JsonObject> GetGraphAsync (this FacebookService facebook, string query, Account account)
{
var req = facebook.CreateRequest (
"GET",
new Uri ("https://graph.facebook.com/" + query),
account);
using (var resp = await req.GetResponseAsync ()) {
return (JsonObject)JsonObject.Parse (resp.GetResponseText ());
}
}
Flickr needs to have all of the Urls in FlickrService to be secure https.
Can someone go into FlickrService.cs and change the Urls in the main class and the CreateRequest upload to https?
I've tested it by grabbing the source and it works. So if someone could do this and submit a quick rev of the component, it would get Flickr uploads working again.
According to #11 Xamarin.Social
supports the providers from the iOS Social.framework
.
Does it include any cross-platform API to invoke SLComposeViewController and a corresponding thing in Android?
Is such feature on the roadmap of Xamarin.Social ?
I am trying to run /xamarin-forms-samples/EmployeeDirectory in xamarin studio on my Mac.
The type or namespace name 'Social' does not exist in the namespace 'Xamarin'. Are you missing an assembly reference? (CS0234) (EmployeeDirectory.iOS)
Could not install package 'Xamarin.Social 1.1.7'. You are trying to install this package into a project that targets 'Xamarin.iOS,Version=v1.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
What to do?
Thank you
As you know, the iOS Social.framework has Linked-in integration and many customers expect to have it in the apps.
Are there any plans of adding Linked-in support to Xamarin.Social ?
Is there any contribution guide for adding social networks? (something different from "here is the code. go figure out by yourself")
I was getting a 403 when posting to Facebook to a new test App (Create app - create test of that app)
It seems the permissions returned after authorization were not populated correctly as we were asking for publish_stream scope which AFAIK seems to have been deprecated/broken
I think the line in FacebookServices should be:
Scope = "publish_actions"; // was "publish_stream"; if I use public stream then it just defaults to read-only
This fix seemed to work for me but reading the forums older apps may still support publish_stream
When sharing to Facebook using the FacebookService i get the following error appear when clicking the "Send" button on the share screen
"One of the identified items was in an invalid format."
I have identified the item with the invalid format to be the image I am including, as the share works perfectly if I do not include an image.
Any help is appreciated as I'm probably doing something wrong.
// image data is a byte[] of a .jpg image from CrossMedia plugin
var images = new List<ImageData>();
images.Add(new ImageData(new MemoryStream(imageData), "image/jpeg"));
// Also tried:
//images.Add(new ImageData(File.OpenRead(photo.Path), null));
var item = new Item
{
Text = "Test",
Images = images
};
DependencyService.Get<IFacebookFunctions>().PostToFacebook(item);
It would be nice to have a native looking share ui for Facebook in Xamarin.Social.
Had a user request for WeChat support, which does have English language SDK's for iOS and Android.
This code is failing:
try {
await facebook.GetGraph ("me", account);
return true;
}
catch (System.Net.WebException) {
return false;
}
while this code works:
return facebook.GetGraph ("me", facebookAccount).ContinueWith (t => {
if (t.IsFaulted) {
return false;
}
return true;
});
When trying to catch the WebException when an account is bad.
Need to look at Async code to make sure error paths are done right.
Exception thrown says:
error MT4118: Cannot register two managed types ('Xamarin.Controls.ProgressLabel, Xamarin.Auth.iOS' and 'Xamarin.Controls.ProgressLabel, Xamarin.Social.iOS') with the same native name ('Xamarin_Controls_ProgressLabel').
This happens because both Xamarin.Social.iOS and Xamarin.Auth.iOS have an internal type named "Xamarin.Controls.ProgressiveLabel", which is exported to ObjectiveC (because it inherits from NSObject).
To reproduce just run the sample in the simulator (using 6.3.5+).
The solution is to somehow not have two identically named types.
I can't isolate the issue yet, but I have FoundationResponse.GetResponseText()
crashing my process in some cases:
mono-rt: at <unknown> <0xffffffff>
mono-rt: at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal.copy_from_unmanaged (intptr,int,System.Array,int) <IL 0x00024, 0xffffffff>
mono-rt: at System.Runtime.InteropServices.Marshal.Copy (intptr,byte[],int,int) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs:146
mono-rt: at System.IO.UnmanagedMemoryStream.Read (byte[],int,int) [0x0010b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.IO/UnmanagedMemoryStream.cs:206
mono-rt: at System.IO.StreamReader.ReadBuffer () [0x0000e] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.IO/StreamReader.cs:392
mono-rt: at System.IO.StreamReader.ReadToEnd () [0x0002c] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.IO/StreamReader.cs:580
mono-rt: at Xamarin.Auth.Response.GetResponseText () [0x00046] in /Users/dan/Documents/Projects/stampsy-ipad/external/Xamarin.Social/Xamarin.Auth/src/Xamarin.Auth/Response.cs:93
mono-rt: at Stampsy.Social.ServiceManager.GetResponseJson (System.Threading.Tasks.Task`1<Xamarin.Auth.Response>) [0x00074] in /Users/dan/Documents/Projects/stampsy-ipad/external/sociopath/libs/Stampsy.Social/Services/ServiceManager.cs:101
mono-rt: at Stampsy.Social.ServiceManager/<ParsePageAsync>c__AnonStorey15`1.<>m__2C (System.Threading.Tasks.Task`1<Xamarin.Auth.Response>) [0x00008] in /Users/dan/Documents/Projects/stampsy-ipad/external/sociopath/libs/Stampsy.Social/Services/ServiceManager.cs:129
The link in the readme file for App.net is not valid. Probably since they are no longer on alpha.
I've added Xamarin.Social to both my shared project and my Android project, but when I launch it in Android, it fails with MissingMethodException on the line below. Am I missing something? I have Xamarin.Social (v1.1.8) as well as Xamarin.Auth (v1.6.0.2) in both projects.
await facebook.GetAccountsAsync().ContinueWith(accounts => {...});
System.MissingMethodException: System.Threading.Tasks.Task1<System.Collections.Generic.IEnumerable
1<Xamarin.Auth.Account>> Xamarin.Social.Service.GetAccountsAsync()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] in :0
at BabyBook.NewPicturePage.ShareToFacebook () [0x00013] in <4cd4b87556604d948a627179f832d02f>:0
at BabyBook.NewPicturePage+d__71.MoveNext () [0x00256] in C:\Projects\Mobile Projects\New Solution\Solution1\Pages\NewPicturePage.xaml.cs:326 } System.MissingMethodException
By default all facebook apps are using version 2.0 of the API (can this be changed at their end?) and looks like there's a breaking change that affects GetUsernameAsync() in FacebookService.cs
Currently you check for presence of "username" in the json response and through an exception if not found (see https://forums.xamarin.com/discussion/comment/53902/) looks like in version 2.0 of the API this value is no longer returned (See https://developers.facebook.com/docs/graph-api/reference/v2.0/user) - simply changing to check for "name" gets us through that section, but am seeing 403+ errors when actually share, not sure if related, "name" may be the wrong field to use, or possibly other breaking changes in the API.
Quick fix may be to change all API endpoints to the specific 1.0 Urls
When using PinterestService(), I get the login page and after logging in
all I get is
bad response: missing csrfmiddlewaretoken
Hi,
whenever I try to add an account on thw Xamain.Social Twitter UI, my app freezes and Android asks me whether to close or wait. Below is the minimal application based on the sample app. On the twitter side I added read and write permissions as well as checked "Allow this application to use 'Sign in with Twitter'". I filled in some arbitrary values for website/description and app name, I left callback URL blank.
Tested on Android 4.4 (Api Level 19).
[Activity(Label = "Xamarin.Social Sample", MainLauncher = true)]
public class MainActivity : Activity
{
private static readonly TwitterService Twitter = new TwitterService {
ConsumerKey = "XXX",
ConsumerSecret = "XXX"
//CallbackUrl = new Uri("Callback URL from https://dev.twitter.com/apps")
};
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
Button twitterButton = FindViewById<Button>(Resource.Id.Twitter);
twitterButton.Click += delegate {
Item item = new Item {
Text = "I'm sharing great things using Xamarin!",
};
Intent intent = Twitter.GetShareUI(this, item, null);
StartActivity(intent);
};
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.