From e7c629d717d001683b75475c0a25c76bd55a7f14 Mon Sep 17 00:00:00 2001 From: Tristan Roux Date: Sun, 28 Apr 2019 17:25:20 +0200 Subject: [PATCH] Adding a message saying that signin is disabled when you try to login. --- Opus/Code/UI/Fragments/Queue.cs | 5 +- Opus/Code/UI/Views/AccountPreference.cs | 33 ++++++----- Opus/Resources/Resource.Designer.cs | 79 +++++++++++++------------ Opus/Resources/values-fr/strings.xml | 1 + Opus/Resources/values/strings.xml | 1 + 5 files changed, 63 insertions(+), 56 deletions(-) diff --git a/Opus/Code/UI/Fragments/Queue.cs b/Opus/Code/UI/Fragments/Queue.cs index 5f170a0..d67f58c 100644 --- a/Opus/Code/UI/Fragments/Queue.cs +++ b/Opus/Code/UI/Fragments/Queue.cs @@ -103,7 +103,6 @@ public class Queue : Fragment, RecyclerView.IOnItemTouchListener, PopupMenu.IOnM public void RefreshCurrent() { - System.Console.WriteLine("&Queue Count: " + MusicPlayer.queue.Count + " Adapter Count: " + adapter.ItemCount); ListView.InvalidateItemDecorations(); int first = ((LinearLayoutManager)ListView.GetLayoutManager()).FindFirstVisibleItemPosition(); @@ -112,10 +111,8 @@ public class Queue : Fragment, RecyclerView.IOnItemTouchListener, PopupMenu.IOnM { if(i > 0 && MusicPlayer.queue.Count > i - 1) { - System.Console.WriteLine("&i: " + i); Song song = MusicPlayer.queue[i - 1]; - SongHolder holder = ListView.GetChildViewHolder(((LinearLayoutManager)ListView.GetLayoutManager()).FindViewByPosition(i)) as SongHolder; - if(holder != null) + if (ListView.GetChildViewHolder(((LinearLayoutManager)ListView.GetLayoutManager()).FindViewByPosition(i)) is SongHolder holder) { if (MusicPlayer.CurrentID() > -1 && MusicPlayer.queue[MusicPlayer.CurrentID()] == song) { diff --git a/Opus/Code/UI/Views/AccountPreference.cs b/Opus/Code/UI/Views/AccountPreference.cs index 406adde..c7ed012 100644 --- a/Opus/Code/UI/Views/AccountPreference.cs +++ b/Opus/Code/UI/Views/AccountPreference.cs @@ -4,6 +4,7 @@ using Android.Gms.Auth.Api.SignIn; using Android.Gms.Common.Apis; using Android.Graphics; using Android.Runtime; +using Android.Support.Design.Widget; using Android.Support.V7.Preferences; using Android.Util; using Android.Views; @@ -63,25 +64,29 @@ public class AccountPreference : Preference, IResultCallback } } - private async void LogIn() + private /*async*/ void LogIn() { - GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn) - .RequestIdToken(Preferences.instance.GetString(Resource.String.clientID)) - .RequestServerAuthCode(Preferences.instance.GetString(Resource.String.clientID)) - .RequestEmail() - .RequestScopes(new Scope(YouTubeService.Scope.Youtube)) - .Build(); + Snackbar snackBar = Snackbar.Make(Preferences.instance.FindViewById(Android.Resource.Id.Content), Resource.String.login_disabled, Snackbar.LengthLong); + snackBar.View.FindViewById(Resource.Id.snackbar_text).SetTextColor(Color.White); + snackBar.Show(); - GoogleApiClient googleClient = new GoogleApiClient.Builder(Preferences.instance) - .AddApi(Auth.GOOGLE_SIGN_IN_API, gso) - .Build(); + //GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn) + // .RequestIdToken(Preferences.instance.GetString(Resource.String.clientID)) + // .RequestServerAuthCode(Preferences.instance.GetString(Resource.String.clientID)) + // .RequestEmail() + // .RequestScopes(new Scope(YouTubeService.Scope.Youtube)) + // .Build(); - googleClient.Connect(); + //GoogleApiClient googleClient = new GoogleApiClient.Builder(Preferences.instance) + // .AddApi(Auth.GOOGLE_SIGN_IN_API, gso) + // .Build(); - while (!googleClient.IsConnected) - await Task.Delay(10); + //googleClient.Connect(); - Preferences.instance.StartActivityForResult(Auth.GoogleSignInApi.GetSignInIntent(googleClient), 5981); + //while (!googleClient.IsConnected) + // await Task.Delay(10); + + //Preferences.instance.StartActivityForResult(Auth.GoogleSignInApi.GetSignInIntent(googleClient), 5981); } public void OnSignedIn() diff --git a/Opus/Resources/Resource.Designer.cs b/Opus/Resources/Resource.Designer.cs index d95bafd..6106a47 100644 --- a/Opus/Resources/Resource.Designer.cs +++ b/Opus/Resources/Resource.Designer.cs @@ -7234,8 +7234,8 @@ namespace Opus // aapt resource value: 0x7f0d0136 public const int behavior = 2131558710; - // aapt resource value: 0x7f0d0154 - public const int beta_available = 2131558740; + // aapt resource value: 0x7f0d0155 + public const int beta_available = 2131558741; // aapt resource value: 0x7f0d0081 public const int bottom_sheet_behavior = 2131558529; @@ -7246,14 +7246,14 @@ namespace Opus // aapt resource value: 0x7f0d0130 public const int cancel = 2131558704; - // aapt resource value: 0x7f0d015a - public const int cancelling = 2131558746; + // aapt resource value: 0x7f0d015b + public const int cancelling = 2131558747; // aapt resource value: 0x7f0d00f2 public const int cant_delete = 2131558642; - // aapt resource value: 0x7f0d0157 - public const int cant_play_non_youtube = 2131558743; + // aapt resource value: 0x7f0d0158 + public const int cant_play_non_youtube = 2131558744; // aapt resource value: 0x7f0d00b9 public const int cast = 2131558585; @@ -7471,8 +7471,8 @@ namespace Opus // aapt resource value: 0x7f0d012c public const int completed = 2131558700; - // aapt resource value: 0x7f0d014e - public const int country_blocked = 2131558734; + // aapt resource value: 0x7f0d014f + public const int country_blocked = 2131558735; // aapt resource value: 0x7f0d0116 public const int create_local = 2131558678; @@ -7528,14 +7528,14 @@ namespace Opus // aapt resource value: 0x7f0d00f0 public const int downloading = 2131558640; - // aapt resource value: 0x7f0d0158 - public const int downloading_notification = 2131558744; + // aapt resource value: 0x7f0d0159 + public const int downloading_notification = 2131558745; // aapt resource value: 0x7f0d012a public const int downloading_status = 2131558698; - // aapt resource value: 0x7f0d0155 - public const int downloading_update = 2131558741; + // aapt resource value: 0x7f0d0156 + public const int downloading_update = 2131558742; // aapt resource value: 0x7f0d00d3 public const int edit_metadata = 2131558611; @@ -7702,6 +7702,9 @@ namespace Opus // aapt resource value: 0x7f0d0145 public const int logged_in = 2131558725; + // aapt resource value: 0x7f0d0148 + public const int login_disabled = 2131558728; + // aapt resource value: 0x7f0d0139 public const int max_download = 2131558713; @@ -7819,8 +7822,8 @@ namespace Opus // aapt resource value: 0x7f0d00f6 public const int no_lives = 2131558646; - // aapt resource value: 0x7f0d0149 - public const int no_permission = 2131558729; + // aapt resource value: 0x7f0d014a + public const int no_permission = 2131558730; // aapt resource value: 0x7f0d00f5 public const int no_playlist = 2131558645; @@ -7831,8 +7834,8 @@ namespace Opus // aapt resource value: 0x7f0d00e9 public const int no_song = 2131558633; - // aapt resource value: 0x7f0d014a - public const int no_song_mix = 2131558730; + // aapt resource value: 0x7f0d014b + public const int no_song_mix = 2131558731; // aapt resource value: 0x7f0d00f4 public const int no_track = 2131558644; @@ -7840,8 +7843,8 @@ namespace Opus // aapt resource value: 0x7f0d0144 public const int not_log = 2131558724; - // aapt resource value: 0x7f0d014f - public const int not_streamable = 2131558735; + // aapt resource value: 0x7f0d0150 + public const int not_streamable = 2131558736; // aapt resource value: 0x7f0d00bd public const int nothing = 2131558589; @@ -8011,8 +8014,8 @@ namespace Opus // aapt resource value: 0x7f0d00f1 public const int syncing = 2131558641; - // aapt resource value: 0x7f0d0159 - public const int tap_details = 2131558745; + // aapt resource value: 0x7f0d015a + public const int tap_details = 2131558746; // aapt resource value: 0x7f0d013d public const int theme = 2131558717; @@ -8023,14 +8026,14 @@ namespace Opus // aapt resource value: 0x7f0d00c5 public const int timer = 2131558597; - // aapt resource value: 0x7f0d014c - public const int timout = 2131558732; + // aapt resource value: 0x7f0d014d + public const int timout = 2131558733; // aapt resource value: 0x7f0d0119 public const int title = 2131558681; - // aapt resource value: 0x7f0d0148 - public const int undo = 2131558728; + // aapt resource value: 0x7f0d0149 + public const int undo = 2131558729; // aapt resource value: 0x7f0d0121 public const int undo_change = 2131558689; @@ -8041,29 +8044,29 @@ namespace Opus // aapt resource value: 0x7f0d010e public const int unfork_playlist = 2131558670; - // aapt resource value: 0x7f0d014d - public const int unknow = 2131558733; + // aapt resource value: 0x7f0d014e + public const int unknow = 2131558734; // aapt resource value: 0x7f0d00bc public const int up_next = 2131558588; - // aapt resource value: 0x7f0d0153 - public const int up_to_date = 2131558739; + // aapt resource value: 0x7f0d0154 + public const int up_to_date = 2131558740; // aapt resource value: 0x7f0d012b public const int up_to_date_status = 2131558699; - // aapt resource value: 0x7f0d0151 - public const int update = 2131558737; - // aapt resource value: 0x7f0d0152 - public const int update_message = 2131558738; + public const int update = 2131558738; - // aapt resource value: 0x7f0d0150 - public const int update_no_internet = 2131558736; + // aapt resource value: 0x7f0d0153 + public const int update_message = 2131558739; - // aapt resource value: 0x7f0d0156 - public const int updating = 2131558742; + // aapt resource value: 0x7f0d0151 + public const int update_no_internet = 2131558737; + + // aapt resource value: 0x7f0d0157 + public const int updating = 2131558743; // aapt resource value: 0x7f0d003e public const int v7_preference_off = 2131558462; @@ -8083,8 +8086,8 @@ namespace Opus // aapt resource value: 0x7f0d0134 public const int yes = 2131558708; - // aapt resource value: 0x7f0d014b - public const int youtube_endpoint = 2131558731; + // aapt resource value: 0x7f0d014c + public const int youtube_endpoint = 2131558732; // aapt resource value: 0x7f0d00fd public const int youtube_loading_error = 2131558653; diff --git a/Opus/Resources/values-fr/strings.xml b/Opus/Resources/values-fr/strings.xml index de1b7bd..b3d558f 100644 --- a/Opus/Resources/values-fr/strings.xml +++ b/Opus/Resources/values-fr/strings.xml @@ -182,6 +182,7 @@ Connecté en temps que CONNECTION DECONNECTION + Les connections ont été désactivée suite a une restriction de google. Annuler diff --git a/Opus/Resources/values/strings.xml b/Opus/Resources/values/strings.xml index 9a98251..b4121ac 100644 --- a/Opus/Resources/values/strings.xml +++ b/Opus/Resources/values/strings.xml @@ -182,6 +182,7 @@ Logged in as LOG IN LOG OUT + Login behaviors has been disabled for now due to a restriction from google. Undo