From b2113eb0650877727cd562a8f903d3d92b80b192 Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Fri, 7 Feb 2014 14:22:52 +0100 Subject: [PATCH] allow toggle for disabling mobile param --- PocketSharp/Components/Account.cs | 4 ++-- PocketSharp/PocketClient.cs | 18 ++++++++++++++++-- PocketSharp/Properties/AssemblyInfo.cs | 4 ++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/PocketSharp/Components/Account.cs b/PocketSharp/Components/Account.cs index 226bed4..98394ea 100644 --- a/PocketSharp/Components/Account.cs +++ b/PocketSharp/Components/Account.cs @@ -60,7 +60,7 @@ namespace PocketSharp RequestCode = requestCode; } - return new Uri(String.Format(authentificationUri, RequestCode, CallbackUri)); + return new Uri(String.Format(authentificationUri, RequestCode, CallbackUri, isMobileClient ? "1" : "0")); } @@ -122,7 +122,7 @@ namespace PocketSharp RequestCode = requestCode; } - return new Uri(String.Format("{0}&force=signup", String.Format(authentificationUri, RequestCode, CallbackUri))); + return new Uri(String.Format("{0}&force=signup", String.Format(authentificationUri, RequestCode, CallbackUri, isMobileClient ? "1" : "0"))); } } } diff --git a/PocketSharp/PocketClient.cs b/PocketSharp/PocketClient.cs index f479134..78f9b98 100644 --- a/PocketSharp/PocketClient.cs +++ b/PocketSharp/PocketClient.cs @@ -39,7 +39,12 @@ namespace PocketSharp /// /// The authentification URL /// - protected string authentificationUri = "https://getpocket.com/auth/authorize?request_token={0}&redirect_uri={1}&mobile=1"; + protected string authentificationUri = "https://getpocket.com/auth/authorize?request_token={0}&redirect_uri={1}&mobile={2}"; + + /// + /// Indicates, whether this client is used for mobile or desktop + /// + protected bool isMobileClient = true; /// /// callback URLi for API calls @@ -91,11 +96,20 @@ namespace PocketSharp /// The callback URL is called by Pocket after authentication /// The HttpMessage handler. /// Request timeout (in seconds). - public PocketClient(string consumerKey, string accessCode = null, string callbackUri = null, HttpMessageHandler handler = null, int? timeout = null) + /// Indicates, whether this client is used for mobile or desktop + public PocketClient( + string consumerKey, + string accessCode = null, + string callbackUri = null, + HttpMessageHandler handler = null, + int? timeout = null, + bool isMobileClient = true) { // assign public properties ConsumerKey = consumerKey; + this.isMobileClient = isMobileClient; + // assign access code if submitted if (accessCode != null) { diff --git a/PocketSharp/Properties/AssemblyInfo.cs b/PocketSharp/Properties/AssemblyInfo.cs index 8ee8f1e..7eefc62 100644 --- a/PocketSharp/Properties/AssemblyInfo.cs +++ b/PocketSharp/Properties/AssemblyInfo.cs @@ -22,5 +22,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.2")] -[assembly: AssemblyFileVersion("3.0.2")] \ No newline at end of file +[assembly: AssemblyVersion("3.1.0")] +[assembly: AssemblyFileVersion("3.1.0")] \ No newline at end of file