From ca1856e203368810f3928aba6420288798f43fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=9D=E3=83=BC=E3=83=AB=20=E3=82=A6=E3=82=A7=E3=83=83?= =?UTF-8?q?=E3=83=96?= Date: Wed, 17 Apr 2019 14:53:34 -0500 Subject: [PATCH] Improved YT sync visuals and accounted for pending email --- .../action/AcquisitionActions.class.php | 19 ++++++++++++------- lib/thirdparty/LBRY.class.php | 9 ++++++++- view/template/acquisition/youtube.php | 4 ++-- view/template/acquisition/youtube_status.php | 18 ++++++++++++------ web/scss/pages/_youtube.scss | 1 - 5 files changed, 34 insertions(+), 17 deletions(-) diff --git a/controller/action/AcquisitionActions.class.php b/controller/action/AcquisitionActions.class.php index 986eed05..49a9629f 100644 --- a/controller/action/AcquisitionActions.class.php +++ b/controller/action/AcquisitionActions.class.php @@ -5,13 +5,15 @@ class AcquisitionActions extends Actions public static function executeYouTube(string $version = '') { $errorMessage = Request::getParam('error_message', ''); + if (Session::getFlash(Session::KEY_YOUTUBE_SYNC_ERROR)) { $errorMessage = Session::getFlash(Session::KEY_YOUTUBE_SYNC_ERROR); } + return ['acquisition/youtube', [ - 'reward' => LBRY::youtubeReward(), - 'error_message' => $errorMessage - ]]; + 'reward' => LBRY::youtubeReward(), + 'error_message' => $errorMessage + ]]; } public static function executeVerify(string $token) @@ -33,6 +35,7 @@ class AcquisitionActions extends Actions } $token = LBRY::connectYoutube($channelName); + if ($token['success'] && $token['data']) { Controller::redirect($token['data']); } else { @@ -44,16 +47,17 @@ class AcquisitionActions extends Actions public static function executeYoutubeStatus(string $token) { $data = LBRY::statusYoutube($token); + if (!$data['success']) { Session::setFlash(Session::KEY_YOUTUBE_SYNC_ERROR, $data['error'] ?? "Error fetching your sync status."); Controller::redirect('/youtube'); } return ['acquisition/youtube_status', [ - 'token' => $token, - 'status_token' => $data, - 'error_message' => Session::getFlash(Session::KEY_YOUTUBE_SYNC_ERROR) - ]]; + 'token' => $token, + 'status_token' => $data, + 'error_message' => Session::getFlash(Session::KEY_YOUTUBE_SYNC_ERROR) + ]]; } public static function actionYoutubeEdit($status_token, $channel_name, $email, $sync_consent) @@ -72,6 +76,7 @@ class AcquisitionActions extends Actions Controller::redirect("/youtube/status/" . $status_token); } } + public static function executeYoutubeEdit() { return ['acquisition/youtube_edit']; diff --git a/lib/thirdparty/LBRY.class.php b/lib/thirdparty/LBRY.class.php index 1df5d1c0..6b4636a1 100644 --- a/lib/thirdparty/LBRY.class.php +++ b/lib/thirdparty/LBRY.class.php @@ -58,7 +58,14 @@ class LBRY return Curl::post(static::getApiUrl('/yt/new'), ['desired_lbry_channel_name' => $channel_name, 'type' => $type], ['json_response' => true]); // Uncomment next line for development and comment other return (this also requires the testnet API) - // return Curl::post(static::getApiUrl('/yt/new'), ['desired_lbry_channel_name' => $channel_name, 'type' => $type, 'return_url' => 'http://localhost:8000/youtube/status/'], ['json_response' => true]); + // return Curl::post(static::getApiUrl('/yt/new'), [ + // 'desired_lbry_channel_name' => $channel_name, + // 'immediate_sync' => true, + // 'return_url' => 'http://localhost:8000/youtube/status/', + // 'type' => $type + // ], [ + // 'json_response' => true + // ]); } // Check the sync status diff --git a/view/template/acquisition/youtube.php b/view/template/acquisition/youtube.php index af8635e1..88ca2049 100644 --- a/view/template/acquisition/youtube.php +++ b/view/template/acquisition/youtube.php @@ -47,6 +47,8 @@ if ($error_message): echo "

" . "The following error occurred: ". $error_message . " For support please send an email to hello@lbry.com." . "

"; endif;?> + +

Connect with your fans while earning money and rewards

@@ -65,8 +67,6 @@ type="submit" value="Claim now" /> - -
diff --git a/view/template/acquisition/youtube_status.php b/view/template/acquisition/youtube_status.php index 5fae46af..9fe58997 100644 --- a/view/template/acquisition/youtube_status.php +++ b/view/template/acquisition/youtube_status.php @@ -6,7 +6,7 @@ - + 0 ?> @@ -50,12 +50,12 @@
  • "> - +

    Agree to sync

  • "> - +

    Claim your credits

    >(to get your credits, download the app and follow these instructions)

  • @@ -81,6 +81,9 @@ case "pending": echo __("Pending Agreement"); break; + case "pendingemail": + echo __("Pending Email Confirmation"); + break; case "queued": echo __("Queued"); break; @@ -99,19 +102,22 @@ case "abandoned": echo __("Cannot sync anymore!"); break; + default: + echo __("—"); + break; } ?> - + - + - + diff --git a/web/scss/pages/_youtube.scss b/web/scss/pages/_youtube.scss index 4ee5d420..d5309be4 100644 --- a/web/scss/pages/_youtube.scss +++ b/web/scss/pages/_youtube.scss @@ -258,7 +258,6 @@ $lbry-yt-blue: mix($lbry-blue-5, $lbry-black, 50%); span { background-color: var(--lbry-gray-3); padding-top: 0.5rem; - padding-left: 0.05rem; // Mobile Safari override @media not all and (min-resolution: 0.001dpcm) {