From 8ed75eb43d97e2afeb08e78a46a21dcf8a01b33b Mon Sep 17 00:00:00 2001 From: 1aerostorm Date: Thu, 1 Jun 2023 00:13:54 +0000 Subject: [PATCH 1/4] Desktop app reminder --- app/assets/images/app/linux.png | Bin 0 -> 1462 bytes app/assets/images/app/windows.png | Bin 0 -> 1744 bytes app/components/App.jsx | 16 ++++++ app/components/all.scss | 1 + app/components/elements/app/AppReminder.jsx | 52 +++++++++++++++++++ app/components/elements/app/AppReminder.scss | 14 +++++ app/components/modules/Modals.jsx | 14 +++++ app/components/modules/app/AppDownload.jsx | 26 ++++++++++ app/locales/en.json | 6 +++ app/locales/ru-RU.json | 7 +++ app/redux/User.js | 3 ++ 11 files changed, 139 insertions(+) create mode 100644 app/assets/images/app/linux.png create mode 100644 app/assets/images/app/windows.png create mode 100644 app/components/elements/app/AppReminder.jsx create mode 100644 app/components/elements/app/AppReminder.scss create mode 100644 app/components/modules/app/AppDownload.jsx diff --git a/app/assets/images/app/linux.png b/app/assets/images/app/linux.png new file mode 100644 index 0000000000000000000000000000000000000000..fc1ffd38d2c477123d8be34b63ed473c9e6f704b GIT binary patch literal 1462 zcmV;n1xfmeP)!?lTSYRBX?Zownec zga4R#qXJldl5=<|rG#>?OeLBNnco_4P;e*)@L?@}^Jha1#M?x3LX0pX0%_aQF)nhN z3~DfqMbV$o+1cZZR@4f0aR(CnO>%c`cIHrC`_o z421#yE8=Zp^!&nYyY|B0-ydn4x5}WaQhr2GP!M!F9kQ%>$~5|vc$;XBpFMw39JVLV z#DzWm@gP%!!ma(VW94YXEc^tq%U3AMDW5>Ru?l@R|25dH-B53#0FlC@?1s<3c5AR@ zNk655BgESjsOQ5=wrNn?2rb2}eQF$xSK-ViHOdb#$`q>C>h-S>ZxYQKhAoK+e^j{f zdE_Ulke8@J!3H(#RtmP`JgTpX2pcort~ixrh&PGmgl{81G(Wt3H5+wD17XkW1>3O@ z+`Y6Fl{L3fS#t;RE0dI!sH*>)#utb;NIPfeF3nqpWbOwJHh7$@U1LmmDU4n0lmC5T7KK5;? zD%CwPF<3Bp{NaV+43*Kut2&p(xcvMUuBWH4gpyl4ofh}yn31e8kZt032YJNLW&@KbtC#T5Jn|JJ%SEI44 zCVI#KpQ;TuoLZK!3b(2o4ymV&U5)MaPkZ)3Z!|Tn!f8+N`_ZgW!3`UkEtSOfz)O*7 z$(2*+WKps5aI<&#Ynayu8Tv>!Kms~f21Eu zbEad=^w}6S)r^Sg=KJ$z4Y-uGx=(t?fP-{FZnvQj)mNI}rMPpj2aLn@SP=USuHUM1 z$-upfDe|>;D}_;0XJX`gv#@Z%Sex{{Vcf1E?u8ercvz`wCAc!IYkSMfKlyz#O3TWf z8n}NU@yWHh8yOr*(cy7Ucg2`$_dYK}qzc-CZ;E*zX=M|`$GwB{it7#yJSbW2a4cA< zV&s#T+-JZ_B{(y1V}DO@p+n?yc&y-*;}rTM#<2lWHgOgrHQG%E)X`3FC{jp|?~665 zX%69~L#t@dTXt8*gQ&jl9s{B}$CVpOo6tOMAQr?f#^IyK<+fRZK7a8t(zd5#{FE7T zn%&6gUEu$HaN6iH)N>o-|tFmv#BZvsq+X{Y8g(D z?(Ug=5I>0OREU(#6$4cn-S0`SOlXd;mV#mV%M2@Ake(Z8j=v}kt!~g&Q literal 0 HcmV?d00001 diff --git a/app/assets/images/app/windows.png b/app/assets/images/app/windows.png new file mode 100644 index 0000000000000000000000000000000000000000..193679ffb02193086a0446fd26f88b3af3aad788 GIT binary patch literal 1744 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA3?vioaBc-sEa{HEjtmSN`?>!lvI6;x#X;^) z4C~IxyaaL-l0AZa85pY67#JE_7#My5g&JNkFq8sKd6mGxU^Rn*LA+qju0R{0z8?WT zA+A6LJe%I|Y<|tX=`Gi$x11Z^a;$&Lz3C12#Ul4sLP?oBU* zR=?%i^^kY#bDmA_xHrAy+4xp|9#B0^(Hq?6w z+bw55^XP+*-|ji=`jXlE-O<^_|KRS8%Vtf}5Sq~5P+6RxZN<#W#LB|VxPQy~m5b&~ zR~2lY;>4(sH~08MCcdOMc8p?7>4!cr@|eZ!FE^2L*+K^4?mG0eMWiI&k$O~+(Q#;HBlqgIA1pCaR|+#cmh5a> zBDm_{^oF)4BH;!ezTW3gY&n&5u8jXAOVgY?d;T;XS`?uXpx2hIA=u6^^^#GZ92;Al zT^-||NbyCEOZP0=JdwP(+!9rIzym}-7iFTkx($nBHb zlT4-0hgY;6T&UQW!uz3V%~~s+CJx>Yi-LBFQfwpQIo zCE||q%UMqzSQHv<_V(hr#>E;w^{C;|JM~%5OzyvoS|P>rA+$@!IF0S>EZgJ9&6yIz zxesPduUyxh{AkaepIsAHl`s~H?p`sY%jM&tYgw~hH@a+NIZ&n>w`lj28_Sqm85m+^ ze%IKtAE*IFqiTt3L`h0wNvc(HQ7VvPFfuT-&^0jAH82h_G_o==w=yu+HZZa>FmRr! z@ef5qZhlH;S|x4`Mn@(%0X4XRY$(o8D=AMbN@eiOO-xVqO-#>B&Q>tfGuN}wwNwCF z3AE2l*U(HM5QsBMN(!v>^~=l4^)f-Kff%S-FTW`L*?yC4KoccECWd5`<|bKLx#TC8 z=BDPASXl)Cl@>D?F8{wzK3{erx7`%PhfXy*8a097#yDn z7|ERA%&Jrd3q4~aZzm_7fO1Qqv>lRkXpkpET4qivFbMSYOAB)H6H|)yP0jT4jUto0 tLtXR@O${vc%QN#*^2>|k4Gm08O)d0*Zh2GiYc|j%22WQ%mvv4FO#mY<+6Vvu literal 0 HcmV?d00001 diff --git a/app/components/App.jsx b/app/components/App.jsx index 51fa84ded..582272a79 100644 --- a/app/components/App.jsx +++ b/app/components/App.jsx @@ -12,6 +12,7 @@ import { createGlobalStyle } from 'styled-components' import AppPropTypes from 'app/utils/AppPropTypes'; import Header from 'app/components/modules/Header'; import Footer from 'app/components/modules/Footer'; +import AppReminder from 'app/components/elements/app/AppReminder' import URLLoader from 'app/components/elements/app/URLLoader'; import TooltipManager from 'app/components/elements/common/TooltipManager'; import user from 'app/redux/User'; @@ -32,6 +33,8 @@ import { APP_ICON, VEST_TICKER, } from 'app/client_config'; import session from 'app/utils/session' import { loadGrayHideSettings } from 'app/utils/ContentAccess' +const APP_REMINDER_INTERVAL = 30*24*60*60*1000 + const GlobalStyle = createGlobalStyle` body { fill: currentColor; @@ -97,6 +100,16 @@ class App extends React.Component { } } + showAppReminder = () => { + if (process.env.IS_APP || typeof(localStorage) === 'undefined') { + return false + } + const now = Date.now() + let reminded = localStorage.getItem('app_reminder') || 0 + reminded = parseInt(reminded) + return !reminded || (now - reminded > APP_REMINDER_INTERVAL) + } + constructor(props) { super(props) if (process.env.BROWSER) { @@ -367,6 +380,8 @@ class App extends React.Component { const noHeader = isApp const noFooter = isApp || location.pathname.startsWith('/submit') + const reminder = this.showAppReminder() ? : null + return (
{children} {noFooter ? null :
} + {reminder}
diff --git a/app/components/all.scss b/app/components/all.scss index 31428c46c..c898a4044 100644 --- a/app/components/all.scss +++ b/app/components/all.scss @@ -39,6 +39,7 @@ @import "./elements/VerticalMenu"; @import "./elements/VotesAndComments"; @import "./elements/Voting"; +@import "./elements/app/AppReminder"; @import "./elements/common/YoutubePlayer/YoutubePlayer"; @import "./elements/common/TelegramPlayer/TelegramPlayer"; @import "./elements/common/Button/index"; diff --git a/app/components/elements/app/AppReminder.jsx b/app/components/elements/app/AppReminder.jsx new file mode 100644 index 000000000..b5731d3a2 --- /dev/null +++ b/app/components/elements/app/AppReminder.jsx @@ -0,0 +1,52 @@ +import React from 'react' +import tt from 'counterpart' +import { connect } from 'react-redux' + +import CloseButton from 'react-foundation-components/lib/global/close-button' + +import user from 'app/redux/User' + +class AppReminder extends React.Component { + state = { + hidden: false + } + + hideMe = () => { + const now = Date.now() + localStorage.setItem('app_reminder', now) + this.setState({ + hidden: true + }) + } + + showModal = (e) => { + e.preventDefault() + this.props.showModal() + this.hideMe() + } + + render() { + if (this.state.hidden) { + return null + } + return + { + this.hideMe() + }} + /> + {tt('app_reminder.text')} + + } +} + +export default connect( + state => { + return {} + }, + dispatch => ({ + showModal: () => { + dispatch(user.actions.showAppDownload()) + } + }) +)(AppReminder) diff --git a/app/components/elements/app/AppReminder.scss b/app/components/elements/app/AppReminder.scss new file mode 100644 index 000000000..a704683d9 --- /dev/null +++ b/app/components/elements/app/AppReminder.scss @@ -0,0 +1,14 @@ +.AppReminder { + background-color: #d0edff !important; + color: #333; + border-radius: 5px; + position: fixed; + left: 20px; + bottom: 1px; + padding-right: 5rem; + cursor: pointer; + + .close-button { + margin-top: 4px; + } +} diff --git a/app/components/modules/Modals.jsx b/app/components/modules/Modals.jsx index 781ad920a..de745b5b9 100644 --- a/app/components/modules/Modals.jsx +++ b/app/components/modules/Modals.jsx @@ -10,6 +10,7 @@ import Donate from 'app/components/modules/Donate' import SignUp from 'app/components/modules/SignUp' import ChangeAccount from 'app/components/modules/ChangeAccount' import AddAccount from 'app/components/modules/AddAccount' +import AppDownload from 'app/components/modules/app/AppDownload' import user from 'app/redux/User'; import tr from 'app/redux/Transaction'; import shouldComponentUpdate from 'app/utils/shouldComponentUpdate'; @@ -25,11 +26,13 @@ class Modals extends React.Component { show_promote_post_modal: PropTypes.bool, show_change_account_modal: PropTypes.bool, show_add_account_modal: PropTypes.bool, + show_app_download_modal: PropTypes.bool, hideLogin: PropTypes.func.isRequired, hideConfirm: PropTypes.func.isRequired, hideSignUp: PropTypes.func.isRequired, hideDonate: PropTypes.func.isRequired, hidePromotePost: PropTypes.func.isRequired, + hideAppDownload: PropTypes.func.isRequired, notifications: PropTypes.object, removeNotification: PropTypes.func, }; @@ -53,12 +56,14 @@ class Modals extends React.Component { show_signup_modal, show_change_account_modal, show_add_account_modal, + show_app_download_modal, hideLogin, hideDonate, hideConfirm, hideSignUp, hideChangeAccount, hideAddAccount, + hideAppDownload, notifications, removeNotification, } = this.props; @@ -96,6 +101,10 @@ class Modals extends React.Component { } + {show_app_download_modal && + + + } ); } @@ -114,6 +123,7 @@ export default connect( show_signup_modal: state.user.get('show_signup_modal'), show_change_account_modal: state.user.get('show_change_account_modal'), show_add_account_modal: state.user.get('show_add_account_modal'), + show_app_download_modal: state.user.get('show_app_download_modal'), notifications: state.app.get('notifications'), } }, @@ -146,6 +156,10 @@ export default connect( if (e) e.preventDefault(); dispatch(user.actions.hideAddAccount()) }, + hideAppDownload: e => { + if (e) e.preventDefault() + dispatch(user.actions.hideAppDownload()) + }, // example: addNotification: ({key, message}) => dispatch({type: 'ADD_NOTIFICATION', payload: {key, message}}), removeNotification: (key) => dispatch({type: 'REMOVE_NOTIFICATION', payload: {key}}), diff --git a/app/components/modules/app/AppDownload.jsx b/app/components/modules/app/AppDownload.jsx new file mode 100644 index 000000000..850c3edae --- /dev/null +++ b/app/components/modules/app/AppDownload.jsx @@ -0,0 +1,26 @@ +import React from 'react' +import tt from 'counterpart' + +class AppDownload extends React.Component { + componentDidMount() { + } + + render() { + const updaterHost = 'https://files.golos.app' + const winUrl = new URL('/api/exe/desktop/windows/latest', updaterHost) + const linuxUrl = new URL('/api/exe/desktop/linux/latest', updaterHost) + return
+

{tt('app_download.title')}

+ + + Windows +
+ + + Linux (deb) + +
+ } +} + +export default AppDownload diff --git a/app/locales/en.json b/app/locales/en.json index 08223f114..35ef47ad9 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -1056,6 +1056,12 @@ "mention_comment": " mentioned you in their comment", "message": " sent you a private message" }, + "app_download": { + "title": "Download Golos Desktop" + }, + "app_reminder": { + "text": "Install desktop application for Windows or Linux to receive data directly from blockchain" + }, "app_goto_url": { "goto": "Goto", "wrong_domain_DOMAINS": "This address is not belong to GOLOS Blogs.\nGOLOS Blogs domains are: %(DOMAINS)s\nThis address will be opened in external browser." diff --git a/app/locales/ru-RU.json b/app/locales/ru-RU.json index 4a86d6f3d..d0fa3383b 100644 --- a/app/locales/ru-RU.json +++ b/app/locales/ru-RU.json @@ -1123,6 +1123,13 @@ "mention_comment": " упомянул вас в комментарии", "message": " написал вам сообщение" }, + "app_download": { + "title": "Скачать Golos Desktop", + "download_for": "Скачать для" + }, + "app_reminder": { + "text": "Установите десктоп-приложение для Windows или Linux и получайте информацию напрямую с блокчейна" + }, "app_goto_url": { "goto": "Перейти", "wrong_domain_DOMAINS": "Похоже, эта ссылка не с GOLOS Блогов.\nДомены GOLOS Блогов: %(DOMAINS)s\nЭта ссылка будет открыта во внешнем браузере." diff --git a/app/redux/User.js b/app/redux/User.js index e93493851..24bf2fa97 100644 --- a/app/redux/User.js +++ b/app/redux/User.js @@ -14,6 +14,7 @@ const defaultState = fromJS({ show_open_orders_modal: false, show_change_account_modal: false, show_add_account_modal: false, + show_app_download_modal: false, pub_keys_used: null, locale: DEFAULT_LANGUAGE, nightmodeEnabled: false, @@ -86,6 +87,8 @@ export default createModule({ { action: 'HIDE_CHANGE_ACCOUNT', reducer: state => state.set('show_change_account_modal', false) }, { action: 'SHOW_ADD_ACCOUNT', reducer: state => state.set('show_add_account_modal', true) }, { action: 'HIDE_ADD_ACCOUNT', reducer: state => state.set('show_add_account_modal', false) }, + { action: 'SHOW_APP_DOWNLOAD', reducer: state => state.set('show_app_download_modal', true) }, + { action: 'HIDE_APP_DOWNLOAD', reducer: state => state.set('show_app_download_modal', false) }, { action: 'USERNAME_PASSWORD_LOGIN', reducer: state => state, // saga From ee10268c68bb29d14b6eeff9d0300981c3a887ad Mon Sep 17 00:00:00 2001 From: 1aerostorm Date: Sun, 4 Jun 2023 13:27:48 +0000 Subject: [PATCH 2/4] Desktop - Fix updates error behavior --- app/MainApp.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/MainApp.js b/app/MainApp.js index 88ab8e230..c541122a4 100644 --- a/app/MainApp.js +++ b/app/MainApp.js @@ -50,18 +50,20 @@ async function initState() { } } + let splashTimeout = setTimeout(() => { + closeSplash() + showNodeError() + }, 30000) + try { $STM_Config.add_notify_site = await checkUpdates() } catch (err) { console.error('Cannot check updates', err) + clearTimeout(splashTimeout) + closeSplash() alert('Cannot check updates' + err) } - let splashTimeout = setTimeout(() => { - closeSplash() - showNodeError() - }, 30000) - let onchain let nodeError = null try { From 4f38932d4fd4e881934aafe29a6e40b2b019fa62 Mon Sep 17 00:00:00 2001 From: 1aerostorm Date: Tue, 20 Jun 2023 07:18:48 +0000 Subject: [PATCH 3/4] Fix onlyblog posts - visible in blog's load more --- app/redux/FetchDataSaga.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/redux/FetchDataSaga.js b/app/redux/FetchDataSaga.js index 5b41f058a..5b51a4aaa 100644 --- a/app/redux/FetchDataSaga.js +++ b/app/redux/FetchDataSaga.js @@ -540,6 +540,7 @@ export function* fetchData(action) { args[0].select_authors = [accountname]; } else if (order === 'by_author') { call_name = 'getDiscussionsByBlogAsync'; + args[0].filter_tags = args[0].filter_tags.filter(tag => tag !== 'onlyblog') delete args[0].select_tags; delete args[0].select_categories; delete args[0].prefs From 81be87ce63267acf5152d21463ff6fcfbb8554f1 Mon Sep 17 00:00:00 2001 From: 1aerostorm Date: Fri, 30 Jun 2023 16:54:53 +0000 Subject: [PATCH 4/4] Fix desktop app reminder --- app/components/elements/app/AppReminder.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/components/elements/app/AppReminder.jsx b/app/components/elements/app/AppReminder.jsx index b5731d3a2..7043fc288 100644 --- a/app/components/elements/app/AppReminder.jsx +++ b/app/components/elements/app/AppReminder.jsx @@ -31,7 +31,8 @@ class AppReminder extends React.Component { } return { + onClick={(e) => { + e.stopPropagation() this.hideMe() }} />