From 089c7054256c29ba103318eaa5774c6c08a0b263 Mon Sep 17 00:00:00 2001 From: noumantahir Date: Wed, 27 Apr 2022 05:00:39 +0500 Subject: [PATCH 01/16] handling hyperlink image press using custom image component --- .../postHtmlRenderer/postHtmlRenderer.tsx | 43 ++++++++++++------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/src/components/postHtmlRenderer/postHtmlRenderer.tsx b/src/components/postHtmlRenderer/postHtmlRenderer.tsx index 9abc58214..2e26c02f7 100644 --- a/src/components/postHtmlRenderer/postHtmlRenderer.tsx +++ b/src/components/postHtmlRenderer/postHtmlRenderer.tsx @@ -7,7 +7,7 @@ import { AutoHeightImage } from '../autoHeightImage/autoHeightImage'; import { useHtmlIframeProps, iframeModel } from '@native-html/iframe-plugin'; import WebView from 'react-native-webview'; import { VideoPlayer } from '..'; -import {useHtmlTableProps } from '@native-html/table-plugin'; +import { useHtmlTableProps } from '@native-html/table-plugin'; import { ScrollView } from 'react-native-gesture-handler'; interface PostHtmlRendererProps { @@ -118,7 +118,7 @@ export const PostHtmlRenderer = memo( default: break; } - } catch (error) {} + } catch (error) { } }; const _onElement = (element: Element) => { @@ -136,12 +136,12 @@ export const PostHtmlRenderer = memo( const data = parseLinkData(tnode); _handleOnLinkPress(data); }; - + //process video link - if(tnode.classes?.indexOf('markdown-video-link') >= 0){ + if (tnode.classes?.indexOf('markdown-video-link') >= 0) { - if(isComment){ + if (isComment) { const imgElement = tnode.children.find((child) => { return child.classes.indexOf('video-thumbnail') > 0 ? true : false; }); @@ -162,6 +162,16 @@ export const PostHtmlRenderer = memo( } } + if (tnode.children.length === 1 && tnode.children[0].tagName === 'img') { + const maxImgWidth = getMaxImageWidth(tnode); + return + } + return ; }; @@ -225,25 +235,26 @@ export const PostHtmlRenderer = memo( //based on number of columns a table have, sets scroll enabled or disable, also adjust table full width - const _tableRenderer = ({TDefaultRenderer, ...props}:CustomRendererProps) => { + const _tableRenderer = ({ TDefaultRenderer, ...props }: CustomRendererProps) => { const tableProps = useHtmlTableProps(props); const isScrollable = tableProps.numOfColumns > 3; - const _tableWidth = isScrollable ? tableProps.numOfColumns * _minTableColWidth: contentWidth; - props.style = {width:_tableWidth}; + const _tableWidth = isScrollable ? tableProps.numOfColumns * _minTableColWidth : contentWidth; + props.style = { width: _tableWidth }; return ( - + - )} + ) + } // iframe renderer for rendering iframes in body const _iframeRenderer = function IframeRenderer(props) { const iframeProps = useHtmlIframeProps(props); - if(isComment){ + if (isComment) { const _onPress = () => { console.log('iframe thumb Pressed:', iframeProps); if (handleVideoPress) { @@ -253,9 +264,9 @@ export const PostHtmlRenderer = memo( return ( ) - }else{ + } else { return ( - Date: Wed, 27 Apr 2022 15:58:16 +0300 Subject: [PATCH 02/16] New translations en-US.json (Finnish) --- src/config/locales/fi-FI.json | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/config/locales/fi-FI.json b/src/config/locales/fi-FI.json index c078251f0..35ed3c353 100644 --- a/src/config/locales/fi-FI.json +++ b/src/config/locales/fi-FI.json @@ -7,9 +7,9 @@ "transfer": "Siirto", "power_up": "Ansaintaan", "transfer_from_savings": "Säästöistä", - "withdraw_savings": "Withdraw Savings", + "withdraw_savings": "Kotiuta säästöihin", "withdraw_vesting": "Power Down", - "open_order": "Open Order", + "open_order": "Avoimet Tilaukset", "fill_order": "Täytä hakemus", "post": "Julkaisu", "comment": "Kommentti", @@ -51,12 +51,12 @@ "to": "Vastaanottaja", "estimated_value_desc": "Ostohinnan mukaan", "estimated_value": "Arvioutu arvo", - "vote_value": "Vote value", - "delegated_hive_power": "Delegated hive power", - "powering_down_hive_power": "Powering down", - "received_hive_power": "Received hive power", - "total_hive_power": "Total hive power", - "savings": "Savings", + "vote_value": "Ääniarvo", + "delegated_hive_power": "Valtuutettu Hive Power", + "powering_down_hive_power": "Tehon alentaminen", + "received_hive_power": "Vastaanotettu Hive Power", + "total_hive_power": "Hive Power yhteensä", + "savings": "Säästöt", "estimated_amount": "Ääniarvo", "amount_information": "Siirrä kytkintä muuttaaksesi määrää", "amount": "Määrä", @@ -76,11 +76,11 @@ "next": "SEURAAVA", "delegate": "Valtuuta", "power_down": "Power Down", - "withdraw_hive": "Withdraw Savings", - "withdraw_hbd": "Withdraw Savings", + "withdraw_hive": "Kotiuta säästöihin", + "withdraw_hbd": "Kotiuta säästöt", "transfer_to_savings": "Säästöihin", "convert": "Muunna", - "convert_request": "Convert Request", + "convert_request": "Muunnospyyntö", "escrow_transfer": "Escrow-siirto", "escrow_dispute": "Escrow-riita", "escrow_release": "Escrow-vapautus", @@ -91,9 +91,9 @@ "fill_transfer_from_savings": "Säästöt Toteutettu", "fill_vesting_withdraw": "PowerDown toteutettu", "ecency": { - "title": "Points", - "name": "Ecency Points", - "buy": "GET POINTS" + "title": "Pisteet", + "name": "Ecency pisteet", + "buy": "Lunasta pisteet" }, "savinghive": { "title": "HIVE säästöt" @@ -744,7 +744,7 @@ "mute": "HILJENNÄ / ESTÄ", "unmute": "POISTA HILJENNYS / ESTO", "report": "ILMIANNA KÄYTTÄJÄ", - "delegate": "DELEGATE HIVE POWER" + "delegate": "VALTUUTA HIVE POWER" }, "communities": { "joined": "Jäsenyys", From 13982a420345d0e0251bb4dcd7d7dad34d80cfc5 Mon Sep 17 00:00:00 2001 From: Feruz M Date: Wed, 27 Apr 2022 16:08:00 +0300 Subject: [PATCH 03/16] New translations en-US.json (Finnish) --- src/config/locales/fi-FI.json | 72 +++++++++++++++++------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/config/locales/fi-FI.json b/src/config/locales/fi-FI.json index 35ed3c353..a86ac1ed4 100644 --- a/src/config/locales/fi-FI.json +++ b/src/config/locales/fi-FI.json @@ -115,23 +115,23 @@ "name": "Hive Power" }, "hive_dollar": { - "name": "Hive Dollar" + "name": "Hive Dollarit" }, "btc": { "title": "BTC", "buy": "OTA BTC", "address": "VASTAANOTA" }, - "last_updated": "Last Updated:", - "updating": "Updating...", - "coin_details": "Details", - "change": "Change", - "activities": "Activities", - "savings_withdrawal": "Pending Withdrawals", - "open_orders": "Open Orders", - "conversions_requested": "Conversions Requested", - "expires": "expires", - "pending_requests": "Pending Requests" + "last_updated": "Viimeksi päivitetty:", + "updating": "Päivitetään...", + "coin_details": "Lisätiedot", + "change": "Muuta", + "activities": "Toiminnat", + "savings_withdrawal": "Odottavat Nostot", + "open_orders": "Avoimet Tilaukset", + "conversions_requested": "Pyydetyt muunnokset", + "expires": "vanhenee", + "pending_requests": "Odottavat pyynnöt" }, "notification": { "vote": "äänesti", @@ -217,7 +217,7 @@ "currency": "Valuutta", "language": "Kieli", "server": "Palvelin", - "color_theme": "Appearance", + "color_theme": "Ulkoasu", "push_notification": "Push-ilmoitus", "notification": { "follow": "Seuraa", @@ -241,9 +241,9 @@ "always_warn": "Kysy aina" }, "theme": { - "system": "Device settings", - "light": "Light", - "dark": "Dark" + "system": "Laitteen asetukset", + "light": "Vaalea", + "dark": "Tumma" }, "feedback_success": "Sähköposti avattu onnistuneesti", "feedback_fail": "Sähköpostipalvelin alhaalla", @@ -304,8 +304,8 @@ "create_a_new_account": "Luo uusi tili", "add_an_existing_account": "Lisää olemassa oleva tili", "accounts": "Tilit", - "refer": "Refer & Earn", - "qr": "QR Scan" + "refer": "Suosittele ja tienaa", + "qr": "QR-koodi" }, "header": { "title": "Kirjaudu mukauttaaksesi syötettäsi", @@ -338,7 +338,7 @@ "limited_lastchar": "Tagi päättyy kirjaimeen tai numeroon", "setting_schedule": "Aikataulutus", "setting_reward": "Palkkio", - "setting_reblog": "Reblog", + "setting_reblog": "Jako", "setting_beneficiary": "Hyötyjä", "setting_thumb": "Aseta pikkukuva", "reward_default": "Oletus 50 % / 50 %", @@ -374,16 +374,16 @@ "draft_save_title": "Tallennetaan luonnosta", "draft_update": "Päivitä nykyinen luonnos", "draft_save_new": "Tallenna uutena luonnoksena", - "label": "Label", - "enter_label_placeholder": "Enter Label (Optional)", + "label": "Nimike", + "enter_label_placeholder": "Syötä Tunniste (Valinnainen)", "url": "URL", - "enter_url_placeholder": "Enter URL", - "link_type_text": "Type of Link", - "preview": "Preview", - "invalid_url_error": "Please insert valid url", - "plain": "Plain", + "enter_url_placeholder": "Kirjoita URL-osoite", + "link_type_text": "Linkin tyyppi", + "preview": "Esikatselu", + "invalid_url_error": "Syötä kelvollinen URL", + "plain": "Yksinkertainen", "video": "Video", - "image": "Image" + "image": "Kuva" }, "snippets": { "label_no_snippets": "Katkelmia ei löytynyt", @@ -406,7 +406,7 @@ "title": "Ladatut kuvat", "title_remove_confirmation": "Poista kuva", "btn_add": "Kuva", - "btn_insert": "INSERT", + "btn_insert": "Lisää", "btn_delete": "POISTA", "message_failed": "Kuvan lataaminen epäonnistui" }, @@ -486,8 +486,8 @@ "restart_ecency": "Haluatko käynnistää Ecencyn uudelleen?", "restart_ecency_desc": "Muutosten käyttöönotto vaatii uudelleenkäynnistyksen.", "invalid_response": "Pyyntöä ei voitu käsitellä, Yritä myöhemmin uudelleen.", - "wallet_updating": "Wallet update in progress, try again as update finishes", - "claim_failed": "Failed to claim rewards, {message}\nTry again or write to support@ecency.com" + "wallet_updating": "Lompakon päivitys käynnissä, yritä uudelleen päivityksen valmistuessa", + "claim_failed": "Palkintojen lunastaminen epäonnistui, {message}\nYritä uudelleen tai kirjoita osoitteeseen support@ecency.com" }, "post": { "reblog_alert": "Haluatko varmasti jakaa?", @@ -567,10 +567,10 @@ "promote": "korosta", "boost": "tehosta", "report": "raportoi", - "pin-blog": "Pin to blog", - "unpin-blog": "Unpin from blog", - "pin-community": "Pin to community", - "unpin-community": "Unpin from community" + "pin-blog": "Kiinnitä blogiin", + "unpin-blog": "Irrota blogista", + "pin-community": "Kiinnitä yhteisölle", + "unpin-community": "Poista kiinnitys yhteisöstä" }, "deep_link": { "no_existing_user": "Käyttäjää ei ole", @@ -624,7 +624,7 @@ "stop": "Lopeta", "sc_power_down_error": "Tätä ominaisuutta ei ole vielä toteutettu Hivesignerin kirjautumisessa", "address_view": "Näytä osoite", - "already_delegated": "Already delegated to ", + "already_delegated": "On jo delegoitu ", "remain_hp": "HP jäljellä", "account_detail_head": "Tilin tiedot", "account_detail_subhead": "Anna HIVE Power -valtuutuksen saajan käyttäjänimi", @@ -638,8 +638,8 @@ "username_alert": "Virhe käyttäjänimessä!", "username_alert_detail": "Valitse toinen käyttäjänimi", "power_down": "Power Down", - "power_down_amount_head": "Withdraw Amount", - "power_down_amount_subhead": "Enter amount for powering down hive power", + "power_down_amount_head": "Nostomäärä", + "power_down_amount_subhead": "Syötä hive power tehonalennuksen määrä", "withdraw_accounts": "Withdraw Accounts", "amount_hp": "Amount (HP)", "powering_down": "Powering Down", From 67a523c4d80f3b242f5503a55ee6d0132d3d92ae Mon Sep 17 00:00:00 2001 From: Feruz M Date: Wed, 27 Apr 2022 16:16:29 +0300 Subject: [PATCH 04/16] New translations en-US.json (Finnish) --- src/config/locales/fi-FI.json | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/config/locales/fi-FI.json b/src/config/locales/fi-FI.json index a86ac1ed4..f3101e716 100644 --- a/src/config/locales/fi-FI.json +++ b/src/config/locales/fi-FI.json @@ -613,7 +613,7 @@ "stop_information": "Haluatko varmasti poistua?", "percent": "Prosentti", "auto_vests": "Automaattiset Ansainnat", - "vests": "Vests", + "vests": "Annot", "save": "TALLENNA", "percent_information": "Prosenttitieto", "next": "SEURAAVA", @@ -640,11 +640,11 @@ "power_down": "Power Down", "power_down_amount_head": "Nostomäärä", "power_down_amount_subhead": "Syötä hive power tehonalennuksen määrä", - "withdraw_accounts": "Withdraw Accounts", - "amount_hp": "Amount (HP)", - "powering_down": "Powering Down", - "powering_down_subheading": "You are currently powering down.", - "powering_down_info": "Next power down is in {days} days, {hp} HIVE" + "withdraw_accounts": "Nostotilit", + "amount_hp": "Määrä (HP)", + "powering_down": "Tehon alentaminen", + "powering_down_subheading": "Olet alentamassa tehoa.", + "powering_down_info": "Seuraavaan tehonalennukseen on {days} päivää, {hp} HIVE" }, "boost": { "title": "Hanki pisteitä", @@ -792,18 +792,18 @@ "load_draft_tooltip": "Lataa viimeisin luonnoksesi tähän" }, "refer": { - "refer_earn": "Refer & Earn", - "refer": "Refer", - "rewarded": "Referral points rewarded", - "not_rewarded": "Referral reward pending", - "delegate_hp": "Delegate HP", - "earned": "Earned Points", - "pending": "Pending Points", - "empty_text": "Refer your loved ones today and earn free points" + "refer_earn": "Suosittele ja tienaa", + "refer": "Suosittele", + "rewarded": "Suosituspisteitä saatu", + "not_rewarded": "Suosituspalkkio odottaa", + "delegate_hp": "Valtuuta HP", + "earned": "Ansaitut Pisteet", + "pending": "Odottavat Pisteet", + "empty_text": "Suosittele tutuillesi ja tienaa ilmaisia pisteitä" }, "qr": { - "qr_scan": "QR Scan", - "open": "Open URL", - "detected_url": "Detected URL" + "qr_scan": "QR-koodi", + "open": "Avaa URL", + "detected_url": "Havaittu URL" } } From b47ef0e54c122d0b6b2f6b90fcd665a90e16fdf1 Mon Sep 17 00:00:00 2001 From: noumantahir Date: Fri, 29 Apr 2022 05:11:44 +0500 Subject: [PATCH 05/16] added work around for iOS bug of colorScheme change on app resume --- src/screens/application/container/applicationContainer.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/screens/application/container/applicationContainer.js b/src/screens/application/container/applicationContainer.js index 15a67b2d9..fad002be4 100644 --- a/src/screens/application/container/applicationContainer.js +++ b/src/screens/application/container/applicationContainer.js @@ -271,9 +271,11 @@ class ApplicationContainer extends Component { }; //change app theme on the fly - _appearanceChangeListener = ({ colorScheme }) => { - console.log('OS color scheme changed', colorScheme); + _appearanceChangeListener = () => { const { dispatch } = this.props; + + //workaround for bug with Appearece package: https://github.com/facebook/react-native/issues/28525#issuecomment-841812810 + const colorScheme = Appearance.getColorScheme(); getTheme().then((darkThemeSetting) => { if (darkThemeSetting === null) { dispatch(isDarkTheme(colorScheme === 'dark')); From 53a2511ac04a71033f84c68a30dde9104f0877d7 Mon Sep 17 00:00:00 2001 From: noumantahir Date: Fri, 29 Apr 2022 05:26:35 +0500 Subject: [PATCH 06/16] added slight active opacity to differ between regular and anchored image --- .../autoHeightImage/autoHeightImage.tsx | 21 +++++++++++-------- .../postHtmlRenderer/postHtmlRenderer.tsx | 1 + 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/components/autoHeightImage/autoHeightImage.tsx b/src/components/autoHeightImage/autoHeightImage.tsx index 904da9e21..fc02c8365 100644 --- a/src/components/autoHeightImage/autoHeightImage.tsx +++ b/src/components/autoHeightImage/autoHeightImage.tsx @@ -2,21 +2,24 @@ import React, { useEffect, useState } from "react"; import { Image } from "react-native"; import EStyleSheet from "react-native-extended-stylesheet"; import FastImage from "react-native-fast-image"; -import { TouchableWithoutFeedback } from "react-native-gesture-handler"; +import { TouchableOpacity } from "react-native-gesture-handler"; + interface AutoHeightImageProps { + contentWidth:number, + imgUrl:string, + isAnchored:boolean, + activeOpacity?:number, + onPress:()=>void, + } export const AutoHeightImage = ({ contentWidth, imgUrl, isAnchored, + activeOpacity, onPress - }:{ - contentWidth:number, - imgUrl:string, - isAnchored:boolean, - onPress:()=>void, - }) => { + }:AutoHeightImageProps) => { const [imgWidth, setImgWidth] = useState(contentWidth); @@ -47,14 +50,14 @@ import { TouchableWithoutFeedback } from "react-native-gesture-handler"; } return ( - + - + ) } \ No newline at end of file diff --git a/src/components/postHtmlRenderer/postHtmlRenderer.tsx b/src/components/postHtmlRenderer/postHtmlRenderer.tsx index 2e26c02f7..e3b25c670 100644 --- a/src/components/postHtmlRenderer/postHtmlRenderer.tsx +++ b/src/components/postHtmlRenderer/postHtmlRenderer.tsx @@ -168,6 +168,7 @@ export const PostHtmlRenderer = memo( contentWidth={maxImgWidth} imgUrl={tnode.children[0].attributes.src} isAnchored={false} + activeOpacity={0.8} onPress={_onPress} /> } From 15d8ac59dda313937cda0f0d069c7dd10fc63c9d Mon Sep 17 00:00:00 2001 From: noumantahir Date: Fri, 29 Apr 2022 05:26:45 +0500 Subject: [PATCH 07/16] method rearrange --- .../postHtmlRenderer/postHtmlRenderer.tsx | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/components/postHtmlRenderer/postHtmlRenderer.tsx b/src/components/postHtmlRenderer/postHtmlRenderer.tsx index e3b25c670..a7da786d4 100644 --- a/src/components/postHtmlRenderer/postHtmlRenderer.tsx +++ b/src/components/postHtmlRenderer/postHtmlRenderer.tsx @@ -121,6 +121,27 @@ export const PostHtmlRenderer = memo( } catch (error) { } }; + + //this method checks if image is a child of table column + //and calculates img width accordingly, + //returns full width if img is not part of table + const getMaxImageWidth = (tnode: TNode) => { + //return full width if not parent exist + if (!tnode.parent || tnode.parent.tagName === 'body') { + return contentWidth; + } + + //return divided width based on number td tags + if (tnode.parent.tagName === 'td' || tnode.parent.tagName === 'th') { + const cols = tnode.parent.parent.children.length; + return contentWidth / cols; + } + + //check next parent + return getMaxImageWidth(tnode.parent); + }; + + const _onElement = (element: Element) => { if (element.tagName === 'img' && element.attribs.src) { const imgUrl = element.attribs.src; @@ -129,6 +150,9 @@ export const PostHtmlRenderer = memo( } }; + + + const _anchorRenderer = ({ InternalRenderer, tnode, ...props }: CustomRendererProps) => { const parsedTnode = parseLinkData(tnode); const _onPress = () => { @@ -178,24 +202,8 @@ export const PostHtmlRenderer = memo( }; - //this method checks if image is a child of table column - //and calculates img width accordingly, - //returns full width if img is not part of table - const getMaxImageWidth = (tnode: TNode) => { - //return full width if not parent exist - if (!tnode.parent || tnode.parent.tagName === 'body') { - return contentWidth; - } - //return divided width based on number td tags - if (tnode.parent.tagName === 'td' || tnode.parent.tagName === 'th') { - const cols = tnode.parent.parent.children.length; - return contentWidth / cols; - } - //check next parent - return getMaxImageWidth(tnode.parent); - }; const _imageRenderer = ({ tnode }: CustomRendererProps) => { const imgUrl = tnode.attributes.src; From 02bfaab1e8fad1efd73c33212e7ef4a2277f4a7b Mon Sep 17 00:00:00 2001 From: noumantahir Date: Fri, 29 Apr 2022 05:29:48 +0500 Subject: [PATCH 08/16] setting default active opacity to 1 --- src/components/autoHeightImage/autoHeightImage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/autoHeightImage/autoHeightImage.tsx b/src/components/autoHeightImage/autoHeightImage.tsx index fc02c8365..9596e79bf 100644 --- a/src/components/autoHeightImage/autoHeightImage.tsx +++ b/src/components/autoHeightImage/autoHeightImage.tsx @@ -50,7 +50,7 @@ import { TouchableOpacity } from "react-native-gesture-handler"; } return ( - + Date: Fri, 29 Apr 2022 05:48:35 +0500 Subject: [PATCH 09/16] updating notificationsMap on markAsRead --- .../notification/container/notificationContainer.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/screens/notification/container/notificationContainer.js b/src/screens/notification/container/notificationContainer.js index 59b7850c8..6b6b2fbb0 100644 --- a/src/screens/notification/container/notificationContainer.js +++ b/src/screens/notification/container/notificationContainer.js @@ -23,7 +23,6 @@ class NotificationContainer extends Component { constructor(props) { super(props); this.state = { - notifications: [], notificationsMap: new Map(), lastNotificationId: null, isRefreshing: true, @@ -133,7 +132,7 @@ class NotificationContainer extends Component { _readAllNotification = () => { const { dispatch, intl, isConnected, currentAccount, pinCode } = this.props; - const { notifications } = this.state; + const { notificationsMap } = this.state; if (!isConnected) { return; @@ -143,7 +142,11 @@ class NotificationContainer extends Component { markNotifications() .then(() => { - const updatedNotifications = notifications.map((item) => ({ ...item, read: 1 })); + notificationsMap.forEach((notifications, key) => { + const updatedNotifications = notifications.map((item) => ({ ...item, read: 1 })); + notificationsMap.set(key, updatedNotifications); + }); + dispatch(updateUnreadActivityCount(0)); markHiveNotifications(currentAccount, pinCode) .then(() => { @@ -152,7 +155,7 @@ class NotificationContainer extends Component { .catch((err) => { bugsnapInstance.notify(err); }); - this.setState({ notifications: updatedNotifications, isRefreshing: false }); + this.setState({ notificationsMap, isRefreshing: false }); }) .catch(() => { Alert.alert( From b4153f0ff104dad9040857dc950d2b05f6998c3d Mon Sep 17 00:00:00 2001 From: noumantahir Date: Sat, 30 Apr 2022 06:15:21 +0500 Subject: [PATCH 10/16] update getActivities method to support fetching new notifications --- .../notification/container/notificationContainer.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/screens/notification/container/notificationContainer.js b/src/screens/notification/container/notificationContainer.js index 6b6b2fbb0..f849121c0 100644 --- a/src/screens/notification/container/notificationContainer.js +++ b/src/screens/notification/container/notificationContainer.js @@ -40,15 +40,15 @@ class NotificationContainer extends Component { } } - _getActivities = (type = 'activities', loadMore = false) => { + _getActivities = (type = 'activities', loadMore = false, loadUnread = false) => { const { lastNotificationId, endOfNotification, isLoading, notificationsMap } = this.state; - const since = loadMore ? lastNotificationId : null; + const since = loadMore && !mapStateToProps ? lastNotificationId : null; if (isLoading) { return; } - if (!endOfNotification || !loadMore) { + if (!endOfNotification || !loadMore || loadUnread) { this.setState({ isRefreshing: !loadMore, isLoading: true, @@ -64,8 +64,12 @@ class NotificationContainer extends Component { isLoading: false, }); } else { + console.log(''); + const stateNotifications = notificationsMap.get(type) || []; const _notifications = loadMore - ? unionBy(notificationsMap.get(type) || [], res, 'id') + ? unionBy(stateNotifications, res, 'id') + : loadUnread + ? unionBy(res, stateNotifications, 'id') : res; notificationsMap.set(type, _notifications); this.setState({ From d715967bdd4f951145bfec0f53a109017b5f6a07 Mon Sep 17 00:00:00 2001 From: noumantahir Date: Sat, 30 Apr 2022 06:15:57 +0500 Subject: [PATCH 11/16] update notifications map on unread activity count increase --- .../container/notificationContainer.js | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/screens/notification/container/notificationContainer.js b/src/screens/notification/container/notificationContainer.js index f849121c0..c85278269 100644 --- a/src/screens/notification/container/notificationContainer.js +++ b/src/screens/notification/container/notificationContainer.js @@ -181,14 +181,25 @@ class NotificationContainer extends Component { }; UNSAFE_componentWillReceiveProps(nextProps) { - const { selectedFilter } = this.state; + const { selectedFilter, notificationsMap } = this.state; const { currentAccount } = this.props; - if ( - currentAccount && - nextProps.currentAccount && - nextProps.currentAccount.name !== currentAccount.name - ) { - this.setState({ endOfNotification: false }, () => this._getActivities(selectedFilter)); + if (currentAccount && nextProps.currentAccount) { + if (nextProps.currentAccount.name !== currentAccount.name) { + this.setState( + { + endOfNotification: false, + notificationsMap: new Map(), + }, + () => this._getActivities(selectedFilter), + ); + } else if ( + nextProps.currentAccount.unread_activity_count > currentAccount.unread_activity_count + ) { + notificationsMap.forEach((value, key) => { + console.log('fetching new activities for ', key); + this._getActivities(key, false, true); + }); + } } } From ea857d36703369486e9ccaa4eea7ae1b523c19a2 Mon Sep 17 00:00:00 2001 From: noumantahir Date: Sat, 30 Apr 2022 22:12:23 +0500 Subject: [PATCH 12/16] removed typo causing infinite scroll to fail --- src/screens/notification/container/notificationContainer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/notification/container/notificationContainer.js b/src/screens/notification/container/notificationContainer.js index c85278269..1d56a3383 100644 --- a/src/screens/notification/container/notificationContainer.js +++ b/src/screens/notification/container/notificationContainer.js @@ -42,7 +42,7 @@ class NotificationContainer extends Component { _getActivities = (type = 'activities', loadMore = false, loadUnread = false) => { const { lastNotificationId, endOfNotification, isLoading, notificationsMap } = this.state; - const since = loadMore && !mapStateToProps ? lastNotificationId : null; + const since = loadMore ? lastNotificationId : null; if (isLoading) { return; From 208e1fdc071872e852280aa560e84eee334668df Mon Sep 17 00:00:00 2001 From: noumantahir Date: Mon, 2 May 2022 02:07:38 +0500 Subject: [PATCH 13/16] loading first wallet load from currentAccount data, later session use fresh data --- src/screens/wallet/screen/walletScreen.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/screens/wallet/screen/walletScreen.tsx b/src/screens/wallet/screen/walletScreen.tsx index 6d1cc0c66..8768443da 100644 --- a/src/screens/wallet/screen/walletScreen.tsx +++ b/src/screens/wallet/screen/walletScreen.tsx @@ -69,7 +69,10 @@ const WalletScreen = ({navigation}) => { //side-effects useEffect(()=>{ AppState.addEventListener('change', _handleAppStateChange); - _fetchData(); + + //if coinsData is empty, initilise wallet without a fresh acount fetch + _fetchData(Object.keys(coinsData).length?true:false); + return _cleanup; },[]) From c220f677981c72065404b1710454848017a4295d Mon Sep 17 00:00:00 2001 From: noumantahir Date: Mon, 2 May 2022 02:11:41 +0500 Subject: [PATCH 14/16] added loading indicator on claim button --- .../wallet/children/children.styles.ts | 108 +++++++++--------- src/screens/wallet/children/coinCard.tsx | 19 ++- src/screens/wallet/screen/walletScreen.tsx | 1 + 3 files changed, 71 insertions(+), 57 deletions(-) diff --git a/src/screens/wallet/children/children.styles.ts b/src/screens/wallet/children/children.styles.ts index 0dcd103b9..d1919d111 100644 --- a/src/screens/wallet/children/children.styles.ts +++ b/src/screens/wallet/children/children.styles.ts @@ -5,7 +5,7 @@ import { isRTL } from '../../../utils/I18nUtils'; export default EStyleSheet.create({ cardContainer: { - backgroundColor:'$primaryLightBackground', + backgroundColor: '$primaryLightBackground', marginVertical: 8, marginHorizontal: 16, borderRadius: 12, @@ -14,37 +14,37 @@ export default EStyleSheet.create({ borderColor: "$primaryLightBackground", } as ViewStyle, - cardHeader:{ - flexDirection:'row', - alignItems:'center', + cardHeader: { + flexDirection: 'row', + alignItems: 'center', paddingHorizontal: 16, - paddingTop:16, + paddingTop: 16, } as ViewStyle, - cardTitleContainer:{ + cardTitleContainer: { marginHorizontal: 8, - flex:1, + flex: 1, } as ViewStyle, - cardValuesContainer:{ + cardValuesContainer: { marginHorizontal: 8, - - justifyContent:'flex-end' + + justifyContent: 'flex-end' } as ViewStyle, - claimContainer:{ - flexDirection:'row', - justifyContent:'center', - alignItems:'center', - marginTop:8 + claimContainer: { + flexDirection: 'row', + justifyContent: 'center', + alignItems: 'center', + marginTop: 8 } as ViewStyle, - claimBtn:{ - flexDirection: 'row', - paddingHorizontal: 16 + claimBtn: { + flexDirection: 'row', + paddingHorizontal: 16 } as ViewStyle, - claimBtnTitle:{ + claimBtnTitle: { color: '$pureWhite', fontSize: 14, fontWeight: 'bold', @@ -62,16 +62,16 @@ export default EStyleSheet.create({ height: 24, } as ViewStyle, - logo:{ - height:24, - width:24, - borderRadius:12, - backgroundColor:'$primaryBlue', + logo: { + height: 24, + width: 24, + borderRadius: 12, + backgroundColor: '$primaryBlue', } as ImageStyle, - menuIcon:{ + menuIcon: { color: '$primaryBlue', - paddingLeft:12, + paddingLeft: 12, } as ViewStyle, header: { @@ -80,52 +80,56 @@ export default EStyleSheet.create({ dotStyle: { backgroundColor: '$primaryDarkText', }, - chartContainer:{ - height:112, + chartContainer: { + height: 112, }, - cardFooter:{ - position:'absolute', - bottom:8, - left: isRTL() ? 16 : 76, - right: isRTL() ? 76 : 16, - paddingTop:8, - flexDirection: isRTL() ? "row-reverse" : "row", - justifyContent:'space-between', - borderColor:'$chartText', - borderTopWidth:EStyleSheet.hairlineWidth, + cardFooter: { + position: 'absolute', + bottom: 8, + left: isRTL() ? 16 : 76, + right: isRTL() ? 76 : 16, + paddingTop: 8, + flexDirection: isRTL() ? "row-reverse" : "row", + justifyContent: 'space-between', + borderColor: '$chartText', + borderTopWidth: EStyleSheet.hairlineWidth, } as ViewStyle, - textDiffPositive:{ - fontSize:18, + textDiffPositive: { + fontSize: 18, color: '$primaryGreen', textAlign: 'left', } as TextStyle, - textDiffNegative:{ - fontSize:16, + textDiffNegative: { + fontSize: 16, color: '$primaryRed', textAlign: 'left', } as TextStyle, - textCurValue:{ - fontSize:16, + textCurValue: { + fontSize: 16, color: '$primaryBlack', fontWeight: '300', textAlign: 'left', } as TextStyle, - textTitle:{ - fontSize:16, + textTitle: { + fontSize: 16, color: '$primaryBlack', fontWeight: '500', textAlign: 'left', }, - textSubtitle:{ - fontSize:14, + textSubtitle: { + fontSize: 14, color: '$primaryDarkText', fontWeight: '300', textAlign: 'left', } as TextStyle, - textSubtitleRight:{ - fontSize:14, + textSubtitleRight: { + fontSize: 14, color: '$primaryDarkText', fontWeight: '300', - textAlign:'right' - } as TextStyle + textAlign: 'right' + } as TextStyle, + claimActivityIndicator: { + marginLeft: 16 + } as ViewStyle + }); \ No newline at end of file diff --git a/src/screens/wallet/children/coinCard.tsx b/src/screens/wallet/children/coinCard.tsx index 0be003196..4ae0e59c2 100644 --- a/src/screens/wallet/children/coinCard.tsx +++ b/src/screens/wallet/children/coinCard.tsx @@ -1,4 +1,4 @@ -import { View, Text, Dimensions, TouchableOpacity } from 'react-native'; +import { View, Text, Dimensions, TouchableOpacity, ActivityIndicator } from 'react-native'; import React, { ComponentType, Fragment, useEffect, useState } from 'react'; import styles from './children.styles'; import { Icon, MainButton, SimpleChart } from '../../../components'; @@ -18,6 +18,7 @@ export interface CoinCardProps { unclaimedRewards: string; enableBuy?: boolean; isClaiming?: boolean; + isLoading?: boolean; footerComponent: ComponentType onCardPress: () => void; onClaimPress: () => void; @@ -37,6 +38,7 @@ export const CoinCard = ({ unclaimedRewards, enableBuy, isClaiming, + isLoading, onCardPress, onClaimPress, }: CoinCardProps) => { @@ -83,11 +85,20 @@ export const CoinCard = ({ const btnTitle = unclaimedRewards ? unclaimedRewards : intl.formatMessage({ id: `wallet.${id}.buy` }); + + const _rightComponent = isLoading ? ( + + ) : ( + + + + ) + return ( {btnTitle} - - - + {_rightComponent} diff --git a/src/screens/wallet/screen/walletScreen.tsx b/src/screens/wallet/screen/walletScreen.tsx index 8768443da..187cb763a 100644 --- a/src/screens/wallet/screen/walletScreen.tsx +++ b/src/screens/wallet/screen/walletScreen.tsx @@ -232,6 +232,7 @@ const WalletScreen = ({navigation}) => { unclaimedRewards={coinData.unclaimedBalance} enableBuy={!coinData.unclaimedBalance && item.id === COIN_IDS.ECENCY} isClaiming={isClaiming} + isLoading={isLoading} onCardPress={_onCardPress} onClaimPress={_onClaimPress} footerComponent={index === 0 && } From efd50f7d8a9eb47ff84147274d150eacde39add3 Mon Sep 17 00:00:00 2001 From: noumantahir Date: Mon, 2 May 2022 02:18:43 +0500 Subject: [PATCH 15/16] added eof --- src/screens/wallet/children/children.styles.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/wallet/children/children.styles.ts b/src/screens/wallet/children/children.styles.ts index d1919d111..9d1c7914a 100644 --- a/src/screens/wallet/children/children.styles.ts +++ b/src/screens/wallet/children/children.styles.ts @@ -132,4 +132,4 @@ export default EStyleSheet.create({ marginLeft: 16 } as ViewStyle -}); \ No newline at end of file +}); From 136403b7fbfcd1ab699c595972921fa79d70cffc Mon Sep 17 00:00:00 2001 From: feruz Date: Wed, 4 May 2022 10:26:10 +0300 Subject: [PATCH 16/16] version increase --- android/app/build.gradle | 2 +- ios/Ecency-tvOS/Info.plist | 4 ++-- ios/Ecency-tvOSTests/Info.plist | 4 ++-- ios/Ecency.xcodeproj/project.pbxproj | 4 ++-- ios/Ecency/Info.plist | 2 +- ios/EcencyTests/Info.plist | 4 ++-- ios/Podfile.lock | 4 ++-- ios/eshare/Info.plist | 4 ++-- package.json | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index d11f94663..b95a797f1 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -144,7 +144,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch - versionName "3.0.28" + versionName "3.0.29" resValue "string", "build_config_package", "app.esteem.mobile.android" multiDexEnabled true // react-native-image-crop-picker diff --git a/ios/Ecency-tvOS/Info.plist b/ios/Ecency-tvOS/Info.plist index 05e6bb018..b65860a17 100644 --- a/ios/Ecency-tvOS/Info.plist +++ b/ios/Ecency-tvOS/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.0.28 + 3.0.29 CFBundleSignature ???? CFBundleVersion - 2807 + 2808 LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/ios/Ecency-tvOSTests/Info.plist b/ios/Ecency-tvOSTests/Info.plist index 1b2842af0..8b73f3a35 100644 --- a/ios/Ecency-tvOSTests/Info.plist +++ b/ios/Ecency-tvOSTests/Info.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 3.0.28 + 3.0.29 CFBundleSignature ???? CFBundleVersion - 2807 + 2808 diff --git a/ios/Ecency.xcodeproj/project.pbxproj b/ios/Ecency.xcodeproj/project.pbxproj index a9e4de07b..918acb8b0 100644 --- a/ios/Ecency.xcodeproj/project.pbxproj +++ b/ios/Ecency.xcodeproj/project.pbxproj @@ -1129,7 +1129,7 @@ CODE_SIGN_IDENTITY = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 2807; + CURRENT_PROJECT_VERSION = 2808; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = 75B6RXTKGT; EXCLUDED_ARCHS = ""; @@ -1208,7 +1208,7 @@ CODE_SIGN_ENTITLEMENTS = Ecency/Ecency.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 2807; + CURRENT_PROJECT_VERSION = 2808; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = 75B6RXTKGT; EXCLUDED_ARCHS = ""; diff --git a/ios/Ecency/Info.plist b/ios/Ecency/Info.plist index e222f26b3..287df88a9 100644 --- a/ios/Ecency/Info.plist +++ b/ios/Ecency/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.0.28 + 3.0.29 CFBundleSignature ???? CFBundleURLTypes diff --git a/ios/EcencyTests/Info.plist b/ios/EcencyTests/Info.plist index efa32abdc..4727762a1 100644 --- a/ios/EcencyTests/Info.plist +++ b/ios/EcencyTests/Info.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 3.0.28 + 3.0.29 CFBundleSignature ???? CFBundleVersion - 2807 + 2808 diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 81b09595e..5ede02c78 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -730,7 +730,7 @@ SPEC CHECKSUMS: boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c BugsnagReactNative: a96bc039e0e4ec317a8b331714393d836ca60557 BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872 - DoubleConversion: cde416483dac037923206447da6e1454df403714 + DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 FBLazyVector: 3bb422f41b18121b71783a905c10e58606f7dc3e FBReactNativeSpec: f2c97f2529dd79c083355182cc158c9f98f4bd6e Firebase: c23a36d9e4cdf7877dfcba8dd0c58add66358999 @@ -742,7 +742,7 @@ SPEC CHECKSUMS: FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1 FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a Folly: b73c3869541e86821df3c387eb0af5f65addfab4 - glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3 + glog: 85ecdd10ee8d8ec362ef519a6a45ff9aa27b2e85 GoogleAppMeasurement: a6a3a066369828db64eda428cb2856dc1cdc7c4e GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 diff --git a/ios/eshare/Info.plist b/ios/eshare/Info.plist index ee7dc3a1f..c7d45db59 100644 --- a/ios/eshare/Info.plist +++ b/ios/eshare/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 3.0.28 + 3.0.29 CFBundleVersion - 2807 + 2808 NSExtension NSExtensionAttributes diff --git a/package.json b/package.json index 3ee6b598f..35eceeba7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ecency", - "version": "3.0.28", + "version": "3.0.29", "displayName": "Ecency", "private": true, "rnpm": {