diff --git a/README.md b/README.md index c497d0e..53583bf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Facebook C# SDK for Windows & Windows Phone The Facebook C# SDK for Windows & Windows Phone helps .NET developers build Windows Phone and Windows Store applications that integrate with Facebook. +branch APIv2.5 uses Facebook API v2.5 + [Like us on Facebook at our official page](http://facebook.com/csharpsdk) or [Follow us on twitter @chsarpsdk](http://twitter.com/csharpsdk). ## NuGet diff --git a/Source/Facebook.Client/Controls/WebDialog/WebDialogUserControl.xaml.cs b/Source/Facebook.Client/Controls/WebDialog/WebDialogUserControl.xaml.cs index 77270a0..908b074 100644 --- a/Source/Facebook.Client/Controls/WebDialog/WebDialogUserControl.xaml.cs +++ b/Source/Facebook.Client/Controls/WebDialog/WebDialogUserControl.xaml.cs @@ -183,12 +183,12 @@ public void ShowAppRequestsDialog(WebDialogFinishedDelegate callback, string mes #endif #if WINDOWS_PHONE - dialogWebBrowser.Navigate(new Uri(String.Format("https://m.facebook.com/v2.1/dialog/apprequests?access_token={0}&redirect_uri=fb{2}%3A%2F%2Fsuccess&app_id={1}&message={3}&display=touch{4}&title={5}", Session.ActiveSession.CurrentAccessTokenData.AccessToken, Session.AppId, Session.AppId, message, idBuilder.Length > 4 ? idBuilder.ToString() : String.Empty, title))); + dialogWebBrowser.Navigate(new Uri(String.Format("https://m.facebook.com/v2.5/dialog/apprequests?access_token={0}&redirect_uri=fb{2}%3A%2F%2Fsuccess&app_id={1}&message={3}&display=touch{4}&title={5}", Session.ActiveSession.CurrentAccessTokenData.AccessToken, Session.AppId, Session.AppId, message, idBuilder.Length > 4 ? idBuilder.ToString() : String.Empty, title))); #endif #if WP8 - dialogWebBrowser.Navigate(new Uri(String.Format("https://m.facebook.com/v2.1/dialog/apprequests?access_token={0}&redirect_uri=fbconnect%3A%2F%2Fsuccess&app_id={1}&message={2}&display=touch{3}&title={4}", Session.ActiveSession.CurrentAccessTokenData.AccessToken, Session.AppId, message, idBuilder.Length > 4 ? idBuilder.ToString() : String.Empty, title))); + dialogWebBrowser.Navigate(new Uri(String.Format("https://m.facebook.com/v2.5/dialog/apprequests?access_token={0}&redirect_uri=fbconnect%3A%2F%2Fsuccess&app_id={1}&message={2}&display=touch{3}&title={4}", Session.ActiveSession.CurrentAccessTokenData.AccessToken, Session.AppId, message, idBuilder.Length > 4 ? idBuilder.ToString() : String.Empty, title))); #endif } @@ -204,12 +204,12 @@ internal static void ShowAppRequestDialogViaBrowser(string message, string title } } - Launcher.LaunchUriAsync(new Uri(String.Format("https://m.facebook.com/v2.1/dialog/apprequests?access_token={0}&redirect_uri={2}&app_id={1}&message={5}&display=touch{3}&title={4}&data={6}", Session.ActiveSession.CurrentAccessTokenData.AccessToken, Session.AppId, Session.AppRequestRedirectUri, idBuilder.Length > 4 ? idBuilder.ToString() : String.Empty, title, message, data))); + Launcher.LaunchUriAsync(new Uri(String.Format("https://m.facebook.com/v2.5/dialog/apprequests?access_token={0}&redirect_uri={2}&app_id={1}&message={5}&display=touch{3}&title={4}&data={6}", Session.ActiveSession.CurrentAccessTokenData.AccessToken, Session.AppId, Session.AppRequestRedirectUri, idBuilder.Length > 4 ? idBuilder.ToString() : String.Empty, title, message, data))); } internal static void ShowFeedDialogViaBrowser(string toId = "", string link = "", string linkName = "", string linkCaption = "", string linkDescription = "", string picture = "") { - Launcher.LaunchUriAsync(new Uri(String.Format("https://m.facebook.com/v2.1/dialog/feed?access_token={0}&redirect_uri={2}&app_id={1}&display=touch&to={3}&link={4}&name={5}&caption={6}&description={7}&picture={8}", Session.ActiveSession.CurrentAccessTokenData.AccessToken, Session.AppId, Session.FeedRedirectUri, toId, link, linkName, linkCaption, linkDescription, picture))); + Launcher.LaunchUriAsync(new Uri(String.Format("https://m.facebook.com/v2.5/dialog/feed?access_token={0}&redirect_uri={2}&app_id={1}&display=touch&to={3}&link={4}&name={5}&caption={6}&description={7}&picture={8}", Session.ActiveSession.CurrentAccessTokenData.AccessToken, Session.AppId, Session.FeedRedirectUri, toId, link, linkName, linkCaption, linkDescription, picture))); } @@ -225,11 +225,11 @@ public void ShowFeedDialog(string toId = "", string link = "", string linkName = #endif #if WP8 - dialogWebBrowser.Navigate(new Uri(String.Format("https://m.facebook.com/v2.1/dialog/feed?access_token={0}&redirect_uri=fbconnect%3A%2F%2Fsuccess&app_id={1}&display=touch&to={2}&link={3}&name={4}&caption={5}&description={6}&picture={7}", Session.ActiveSession.CurrentAccessTokenData.AccessToken, Session.AppId, toId, link, linkName, linkCaption, linkDescription, picture))); + dialogWebBrowser.Navigate(new Uri(String.Format("https://m.facebook.com/v2.5/dialog/feed?access_token={0}&redirect_uri=fbconnect%3A%2F%2Fsuccess&app_id={1}&display=touch&to={2}&link={3}&name={4}&caption={5}&description={6}&picture={7}", Session.ActiveSession.CurrentAccessTokenData.AccessToken, Session.AppId, toId, link, linkName, linkCaption, linkDescription, picture))); #endif #if WINDOWS_PHONE - dialogWebBrowser.Navigate(new Uri(String.Format("https://m.facebook.com/v2.1/dialog/feed?access_token={0}&redirect_uri=fb{2}%3A%2F%2Fsuccess&app_id={1}&display=touch&to={3}&link={4}&name={5}&caption={6}&description={7}&picture={8}", Session.ActiveSession.CurrentAccessTokenData.AccessToken, Session.AppId, Session.AppId, toId, link, linkName, linkCaption, linkDescription, picture))); + dialogWebBrowser.Navigate(new Uri(String.Format("https://m.facebook.com/v2.5/dialog/feed?access_token={0}&redirect_uri=fb{2}%3A%2F%2Fsuccess&app_id={1}&display=touch&to={3}&link={4}&name={5}&caption={6}&description={7}&picture={8}", Session.ActiveSession.CurrentAccessTokenData.AccessToken, Session.AppId, Session.AppId, toId, link, linkName, linkCaption, linkDescription, picture))); #endif diff --git a/Source/Facebook.Client/FacebookAppLinkResolver.cs b/Source/Facebook.Client/FacebookAppLinkResolver.cs index 683316f..872bb12 100644 --- a/Source/Facebook.Client/FacebookAppLinkResolver.cs +++ b/Source/Facebook.Client/FacebookAppLinkResolver.cs @@ -13,7 +13,7 @@ async public Task GetAppLinkAsync(string accessToken, string sourceUrl) { FacebookClient _client = new FacebookClient(accessToken); - String finalUrl = String.Format("https://graph.facebook.com/v2.0/?ids={0}&type=al&fields=windows,windows_phone,windows_universal", sourceUrl); + String finalUrl = String.Format("https://graph.facebook.com/v2.5/?ids={0}&type=al&fields=windows,windows_phone,windows_universal", sourceUrl); dynamic appLinkData = await _client.GetTaskAsync(finalUrl); List targets = new List(); diff --git a/Source/Facebook.Client/Session.cs b/Source/Facebook.Client/Session.cs index 7bbe4d8..dd9e01c 100644 --- a/Source/Facebook.Client/Session.cs +++ b/Source/Facebook.Client/Session.cs @@ -480,7 +480,7 @@ async public void LoginWithBehavior(string permissions, FacebookLoginBehavior be Uri uri = new Uri( String.Format( - "https://m.facebook.com/v2.1/dialog/oauth?redirect_uri={0}&display=touch&state=%7B%220is_active_session%22%3A1%2C%22is_open_session%22%3A1%2C%22com.facebook.sdk_client_state%22%3A1%2C%223_method%22%3A%22browser_auth%22%7D&scope={2}&type=user_agent&client_id={1}&sdk=ios", + "https://m.facebook.com/v2.5/dialog/oauth?redirect_uri={0}&display=touch&state=%7B%220is_active_session%22%3A1%2C%22is_open_session%22%3A1%2C%22com.facebook.sdk_client_state%22%3A1%2C%223_method%22%3A%22browser_auth%22%7D&scope={2}&type=user_agent&client_id={1}&sdk=ios", LoginRedirectUri, appId, permissions), UriKind.Absolute); Launcher.LaunchUriAsync(uri); @@ -498,7 +498,7 @@ async public void LoginWithBehavior(string permissions, FacebookLoginBehavior be Uri uri = new Uri( String.Format( - "https://m.facebook.com/v2.1/dialog/oauth?redirect_uri={0}%3A%2F%2Fauthorize&display=touch&state=%7B%220is_active_session%22%3A1%2C%22is_open_session%22%3A1%2C%22com.facebook.sdk_client_state%22%3A1%2C%223_method%22%3A%22browser_auth%22%7D&scope={2}&type=user_agent&client_id={1}&sdk=ios", + "https://m.facebook.com/v2.5/dialog/oauth?redirect_uri={0}%3A%2F%2Fauthorize&display=touch&state=%7B%220is_active_session%22%3A1%2C%22is_open_session%22%3A1%2C%22com.facebook.sdk_client_state%22%3A1%2C%223_method%22%3A%22browser_auth%22%7D&scope={2}&type=user_agent&client_id={1}&sdk=ios", String.Format("fb{0}", appId), appId, permissions), UriKind.Absolute); #else Uri uri = await GetLoginUrl(permissions); @@ -573,7 +573,7 @@ public async static Task CheckAndExtendTokenIfNeeded() if (DateTime.UtcNow - ActiveSession.CurrentAccessTokenData.Issued > TimeSpan.FromHours(24)) // one day { var client = new HttpClient(); - String tokenExtendUri = "https://graph.facebook.com/v2.1"; + String tokenExtendUri = "https://graph.facebook.com/v2.5"; client.BaseAddress = new Uri(tokenExtendUri); var request = new HttpRequestMessage();