Merge branch 'development' of https://github.com/ecency/ecency-mobile into sa/edit-history

This commit is contained in:
Sadaqat Ali 2022-05-05 15:56:56 +05:00
commit ba4bf2b56b
17 changed files with 285 additions and 225 deletions

View File

@ -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

View File

@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.0.28</string>
<string>3.0.29</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2807</string>
<string>2808</string>
<key>LSRequiresIPhoneOS</key>
<true />
<key>NSAppTransportSecurity</key>

View File

@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>3.0.28</string>
<string>3.0.29</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2807</string>
<string>2808</string>
</dict>
</plist>

View File

@ -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 = "";

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.0.28</string>
<string>3.0.29</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>

View File

@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>3.0.28</string>
<string>3.0.29</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2807</string>
<string>2808</string>
</dict>
</plist>

View File

@ -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

View File

@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>3.0.28</string>
<string>3.0.29</string>
<key>CFBundleVersion</key>
<string>2807</string>
<string>2808</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>

View File

@ -1,6 +1,6 @@
{
"name": "ecency",
"version": "3.0.28",
"version": "3.0.29",
"displayName": "Ecency",
"private": true,
"rnpm": {

View File

@ -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 (
<TouchableWithoutFeedback onPress={onPress} disabled={isAnchored}>
<TouchableOpacity onPress={onPress} disabled={isAnchored} activeOpacity={activeOpacity || 1}>
<FastImage
style={imgStyle}
source={{uri:imgUrl}}
resizeMode={FastImage.resizeMode.contain}
onLoad={_onLoad}
/>
</TouchableWithoutFeedback>
</TouchableOpacity>
)
}

View File

@ -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,52 +118,7 @@ export const PostHtmlRenderer = memo(
default:
break;
}
} catch (error) {}
};
const _onElement = (element: Element) => {
if (element.tagName === 'img' && element.attribs.src) {
const imgUrl = element.attribs.src;
console.log('img element detected', imgUrl);
onElementIsImage(imgUrl);
}
};
const _anchorRenderer = ({ InternalRenderer, tnode, ...props }: CustomRendererProps<TNode>) => {
const parsedTnode = parseLinkData(tnode);
const _onPress = () => {
console.log('Link Pressed:', tnode);
const data = parseLinkData(tnode);
_handleOnLinkPress(data);
};
//process video link
if(tnode.classes?.indexOf('markdown-video-link') >= 0){
if(isComment){
const imgElement = tnode.children.find((child) => {
return child.classes.indexOf('video-thumbnail') > 0 ? true : false;
});
if (!imgElement) {
return <VideoThumb contentWidth={contentWidth} onPress={_onPress} />;
}
} else {
return (
<VideoPlayer
mode={parsedTnode.youtubeId ? 'youtube' : 'uri'}
contentWidth={contentWidth}
uri={parsedTnode.videoHref}
youtubeVideoId={parsedTnode.youtubeId}
startTime={parsedTnode.startTime}
disableAutoplay={true}
/>
);
}
}
return <InternalRenderer tnode={tnode} onPress={_onPress} {...props} />;
} catch (error) { }
};
@ -186,6 +141,70 @@ export const PostHtmlRenderer = memo(
return getMaxImageWidth(tnode.parent);
};
const _onElement = (element: Element) => {
if (element.tagName === 'img' && element.attribs.src) {
const imgUrl = element.attribs.src;
console.log('img element detected', imgUrl);
onElementIsImage(imgUrl);
}
};
const _anchorRenderer = ({ InternalRenderer, tnode, ...props }: CustomRendererProps<TNode>) => {
const parsedTnode = parseLinkData(tnode);
const _onPress = () => {
console.log('Link Pressed:', tnode);
const data = parseLinkData(tnode);
_handleOnLinkPress(data);
};
//process video link
if (tnode.classes?.indexOf('markdown-video-link') >= 0) {
if (isComment) {
const imgElement = tnode.children.find((child) => {
return child.classes.indexOf('video-thumbnail') > 0 ? true : false;
});
if (!imgElement) {
return <VideoThumb contentWidth={contentWidth} onPress={_onPress} />;
}
} else {
return (
<VideoPlayer
mode={parsedTnode.youtubeId ? 'youtube' : 'uri'}
contentWidth={contentWidth}
uri={parsedTnode.videoHref}
youtubeVideoId={parsedTnode.youtubeId}
startTime={parsedTnode.startTime}
disableAutoplay={true}
/>
);
}
}
if (tnode.children.length === 1 && tnode.children[0].tagName === 'img') {
const maxImgWidth = getMaxImageWidth(tnode);
return <AutoHeightImage
contentWidth={maxImgWidth}
imgUrl={tnode.children[0].attributes.src}
isAnchored={false}
activeOpacity={0.8}
onPress={_onPress}
/>
}
return <InternalRenderer tnode={tnode} onPress={_onPress} {...props} />;
};
const _imageRenderer = ({ tnode }: CustomRendererProps<TNode>) => {
const imgUrl = tnode.attributes.src;
const _onPress = () => {
@ -225,25 +244,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<TNode>) => {
const _tableRenderer = ({ TDefaultRenderer, ...props }: CustomRendererProps<TNode>) => {
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 (
<ScrollView horizontal={true} scrollEnabled={isScrollable}>
<TDefaultRenderer {...props} />
</ScrollView>
)}
)
}
// 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,7 +273,7 @@ export const PostHtmlRenderer = memo(
return (
<VideoThumb contentWidth={contentWidth} onPress={_onPress} />
)
}else{
} else {
return (
<VideoPlayer
mode='uri'
@ -281,9 +301,9 @@ export const PostHtmlRenderer = memo(
img: styles.img,
table: styles.table,
tr: { ...styles.tr, width: contentWidth }, //center tag causes tr to have 0 width if not exclusivly set, contentWidth help avoid that
th: { ...styles.th, minWidth: _minTableColWidth},
td: { ...styles.td, minWidth: _minTableColWidth},
div: { ...styles.div, maxWidth:contentWidth }, //makes sure width covers the available horizontal space for view and not exceed the contentWidth if parent bound id not defined
th: { ...styles.th, minWidth: _minTableColWidth },
td: { ...styles.td, minWidth: _minTableColWidth },
div: { ...styles.div, maxWidth: contentWidth }, //makes sure width covers the available horizontal space for view and not exceed the contentWidth if parent bound id not defined
blockquote: styles.blockquote,
code: styles.code,
li: styles.li,

View File

@ -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"
@ -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",
@ -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",
@ -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,13 +638,13 @@
"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",
"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"
"power_down_amount_head": "Nostomäärä",
"power_down_amount_subhead": "Syötä hive power tehonalennuksen määrä",
"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ä",
@ -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",
@ -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"
}
}

View File

@ -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'));

View File

@ -23,7 +23,6 @@ class NotificationContainer extends Component {
constructor(props) {
super(props);
this.state = {
notifications: [],
notificationsMap: new Map(),
lastNotificationId: null,
isRefreshing: true,
@ -41,7 +40,7 @@ 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;
@ -49,7 +48,7 @@ class NotificationContainer extends Component {
return;
}
if (!endOfNotification || !loadMore) {
if (!endOfNotification || !loadMore || loadUnread) {
this.setState({
isRefreshing: !loadMore,
isLoading: true,
@ -65,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({
@ -133,7 +136,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 +146,11 @@ class NotificationContainer extends Component {
markNotifications()
.then(() => {
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 +159,7 @@ class NotificationContainer extends Component {
.catch((err) => {
bugsnapInstance.notify(err);
});
this.setState({ notifications: updatedNotifications, isRefreshing: false });
this.setState({ notificationsMap, isRefreshing: false });
})
.catch(() => {
Alert.alert(
@ -174,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
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
) {
this.setState({ endOfNotification: false }, () => this._getActivities(selectedFilter));
notificationsMap.forEach((value, key) => {
console.log('fetching new activities for ', key);
this._getActivities(key, false, true);
});
}
}
}

View File

@ -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:{
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,
cardFooter: {
position: 'absolute',
bottom: 8,
left: isRTL() ? 16 : 76,
right: isRTL() ? 76 : 16,
paddingTop:8,
paddingTop: 8,
flexDirection: isRTL() ? "row-reverse" : "row",
justifyContent:'space-between',
borderColor:'$chartText',
borderTopWidth:EStyleSheet.hairlineWidth,
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
});

View File

@ -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<any>
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 ? (
<ActivityIndicator color={EStyleSheet.value('$pureWhite')} style={styles.claimActivityIndicator} />
) : (
<View style={styles.claimIconWrapper}>
<Icon name="add" iconType="MaterialIcons" color={EStyleSheet.value('$primaryBlue')} size={23} />
</View>
)
return (
<View style={styles.claimContainer}>
<MainButton
isLoading={isClaiming && claimExpected}
isDisable={isClaiming && claimExpected}
isDisable={isLoading || (isClaiming && claimExpected)}
style={styles.claimBtn}
height={50}
onPress={_onClaimPress}
@ -96,9 +107,7 @@ export const CoinCard = ({
<Text style={styles.claimBtnTitle}>
{btnTitle}
</Text>
<View style={styles.claimIconWrapper}>
<Icon name="add" iconType="MaterialIcons" color={EStyleSheet.value('$primaryBlue')} size={23} />
</View>
{_rightComponent}
</Fragment>
</MainButton>
</View>

View File

@ -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;
},[])
@ -229,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 && <HorizontalIconList options={POINTS} optionsKeys={POINTS_KEYS} />}