From 335e2e857bfcfa973c08734835927db3e034aa0e Mon Sep 17 00:00:00 2001 From: Vladimir Borisov Date: Fri, 27 Sep 2019 16:52:16 +0300 Subject: [PATCH] Log a message when anonymous user tries to use some features --- .../Settings/SectionsList/SectionsList.js | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/routes/Settings/SectionsList/SectionsList.js b/src/routes/Settings/SectionsList/SectionsList.js index 865331933..54145810f 100644 --- a/src/routes/Settings/SectionsList/SectionsList.js +++ b/src/routes/Settings/SectionsList/SectionsList.js @@ -20,10 +20,19 @@ const SectionsList = React.forwardRef(({ className, sections, preferences, onPre onPreferenceChanged(data.name, data.value); }; - // Determines whether the link should be opened in new window or in the current one. - const getTargetFor = url => ['//', 'http://', 'https://', 'file://', 'ftp://', 'mailto:', 'magnet:'].some(scheme => url.startsWith(scheme)) ? - '_blank' : '_self' + const checkUser = (event) => { + if(! preferences.user) { + // Here in Stremio 4 we show a toast with a message, asking the anonymous user to log in/register + console.log('No user found'); + event.preventDefault(); + } + } + // Determines whether the link should be opened in new window or in the current one. + const getTargetFor = url => ['//', 'http://', 'https://', 'file://', 'ftp://', 'mailto:', 'magnet:'] + .some(scheme => url.startsWith(scheme)) ? '_blank' : '_self' + + // TODO: If we get the user data after initialization, these should be wrapped in React.useState and set by React.useEffect const changePasswordUrl = preferences.user && 'https://www.strem.io/reset-password/' + preferences.user.email; const webCalUrl = preferences.user && 'webcal://www.strem.io/calendar/' + preferences.user._id + '.ics'; @@ -51,7 +60,7 @@ const SectionsList = React.forwardRef(({ className, sections, preferences, onPre
-
@@ -61,17 +70,17 @@ const SectionsList = React.forwardRef(({ className, sections, preferences, onPre
-
-
-