diff --git a/PokemonGo.RocketAPI.Console/App.config b/PokemonGo.RocketAPI.Console/App.config index 6c961c701..e73221971 100644 --- a/PokemonGo.RocketAPI.Console/App.config +++ b/PokemonGo.RocketAPI.Console/App.config @@ -28,9 +28,6 @@ pw - - - 52.379189 diff --git a/PokemonGo.RocketAPI.Console/Settings.cs b/PokemonGo.RocketAPI.Console/Settings.cs index 24de7aa21..2d96b80b7 100644 --- a/PokemonGo.RocketAPI.Console/Settings.cs +++ b/PokemonGo.RocketAPI.Console/Settings.cs @@ -31,16 +31,6 @@ public class Settings : ISettings public bool UsePokemonToNotCatchFilter => UserSettings.Default.UsePokemonToNotCatchFilter; public int KeepMinDuplicatePokemon => UserSettings.Default.KeepMinDuplicatePokemon; public bool PrioritizeIVOverCP => UserSettings.Default.PrioritizeIVOverCP; - - public string GoogleRefreshToken - { - get { return UserSettings.Default.GoogleRefreshToken; } - set - { - UserSettings.Default.GoogleRefreshToken = value; - UserSettings.Default.Save(); - } - } //Type and amount to keep public ICollection> ItemRecycleFilter => new[] diff --git a/PokemonGo.RocketAPI.Console/UserSettings.Designer.cs b/PokemonGo.RocketAPI.Console/UserSettings.Designer.cs index 194d6aa72..b10f3b0d0 100644 --- a/PokemonGo.RocketAPI.Console/UserSettings.Designer.cs +++ b/PokemonGo.RocketAPI.Console/UserSettings.Designer.cs @@ -59,18 +59,6 @@ public string PtcPassword { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string GoogleRefreshToken { - get { - return ((string)(this["GoogleRefreshToken"])); - } - set { - this["GoogleRefreshToken"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("52.379189")] diff --git a/PokemonGo.RocketAPI.Console/UserSettings.settings b/PokemonGo.RocketAPI.Console/UserSettings.settings index 0d2062a7d..011e6ae6f 100644 --- a/PokemonGo.RocketAPI.Console/UserSettings.settings +++ b/PokemonGo.RocketAPI.Console/UserSettings.settings @@ -11,9 +11,6 @@ pw - - - 52.379189 diff --git a/PokemonGo.RocketAPI/Client.cs b/PokemonGo.RocketAPI/Client.cs index 9a80c0fd0..e7524fa20 100644 --- a/PokemonGo.RocketAPI/Client.cs +++ b/PokemonGo.RocketAPI/Client.cs @@ -123,10 +123,16 @@ public async Task DoGoogleLogin() { _authType = AuthType.Google; + string googleRefreshToken = string.Empty; + if (File.Exists(Directory.GetCurrentDirectory() + "\\Configs\\GoogleAuth.ini")) + { + googleRefreshToken = File.ReadAllText(Directory.GetCurrentDirectory() + "\\Configs\\GoogleAuth.ini"); + } + GoogleLogin.TokenResponseModel tokenResponse; - if (Settings.GoogleRefreshToken != string.Empty) + if (googleRefreshToken != string.Empty) { - tokenResponse = await GoogleLogin.GetAccessToken(Settings.GoogleRefreshToken); + tokenResponse = await GoogleLogin.GetAccessToken(googleRefreshToken); AccessToken = tokenResponse?.id_token; } @@ -134,7 +140,8 @@ public async Task DoGoogleLogin() { var deviceCode = await GoogleLogin.GetDeviceCode(); tokenResponse = await GoogleLogin.GetAccessToken(deviceCode); - Settings.GoogleRefreshToken = tokenResponse?.refresh_token; + googleRefreshToken = tokenResponse?.refresh_token; + File.WriteAllText(Directory.GetCurrentDirectory() + "\\Configs\\GoogleAuth.ini", googleRefreshToken); Logger.Write("Refreshtoken " + tokenResponse?.refresh_token + " saved"); AccessToken = tokenResponse?.id_token; } diff --git a/PokemonGo.RocketAPI/ISettings.cs b/PokemonGo.RocketAPI/ISettings.cs index 5192fab76..de6b0ef3a 100644 --- a/PokemonGo.RocketAPI/ISettings.cs +++ b/PokemonGo.RocketAPI/ISettings.cs @@ -14,7 +14,6 @@ public interface ISettings double DefaultLatitude { get; } double DefaultLongitude { get; } double DefaultAltitude { get; } - string GoogleRefreshToken { get; set; } string PtcPassword { get; } string PtcUsername { get; } float KeepMinIVPercentage { get; }