This commit is contained in:
Mustafa Buyukcelebi 2019-12-18 22:27:00 +03:00
commit c7331e3812
9 changed files with 1022 additions and 932 deletions

View File

@ -529,4 +529,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: d4edbb9c1c57c5484f4893520a7865260cb898d3 PODFILE CHECKSUM: d4edbb9c1c57c5484f4893520a7865260cb898d3
COCOAPODS: 1.8.4 COCOAPODS: 1.8.3

View File

@ -51,7 +51,7 @@
"react-intl": "^3.3.1", "react-intl": "^3.3.1",
"react-native": "0.61.2", "react-native": "0.61.2",
"react-native-actionsheet": "^2.4.2", "react-native-actionsheet": "^2.4.2",
"react-native-autoheight-webview": "^1.2.2", "react-native-autoheight-webview": "^1.3.4",
"react-native-code-push": "esteemapp/react-native-code-push", "react-native-code-push": "esteemapp/react-native-code-push",
"react-native-config": "luggit/react-native-config#master", "react-native-config": "luggit/react-native-config#master",
"react-native-dark-mode": "^0.1.2", "react-native-dark-mode": "^0.1.2",

View File

@ -1,17 +1,17 @@
export default ` export default `
const images = document.getElementsByTagName("IMG"); var images = document.getElementsByTagName("IMG");
for (i = 0; i < images.length; i++) { for (i = 0; i < images.length; i++) {
const result = { var result = {
type: 'image', type: 'image',
href: images[i].getAttribute("src") || '' href: images[i].getAttribute("src") || ''
} }
const resultStr = JSON.stringify(JSON.stringify(result)); // workaround var resultStr = JSON.stringify(JSON.stringify(result)); // workaround
const message = 'window.ReactNativeWebView.postMessage(' + resultStr + ')'; var message = 'window.ReactNativeWebView.postMessage(' + resultStr + ')';
images[i].setAttribute("onClick", message); images[i].setAttribute("onClick", message);
} }
document.addEventListener('click', function(event) { document.addEventListener('click', function(event) {
let el = event.target; var el = event.target;
// A element can be wrapped with inline element. Look parent elements. // A element can be wrapped with inline element. Look parent elements.
while (el.tagName !== 'A') { while (el.tagName !== 'A') {
if (!el.parentNode) { if (!el.parentNode) {
@ -23,8 +23,8 @@ document.addEventListener('click', function(event) {
return; return;
} }
if (el.getAttribute('target') === '_external') { if (el.getAttribute('target') === '_external') {
const href = el.getAttribute('href'); var href = el.getAttribute('href');
const result = { var result = {
type: '_external', type: '_external',
href href
} }
@ -33,8 +33,8 @@ document.addEventListener('click', function(event) {
return true; return true;
} }
if (el.classList.contains('markdown-external-link')) { if (el.classList.contains('markdown-external-link')) {
const href = el.getAttribute('data-href'); var href = el.getAttribute('data-href');
const result = { var result = {
type: 'markdown-external-link', type: 'markdown-external-link',
href href
} }
@ -43,8 +43,8 @@ document.addEventListener('click', function(event) {
return true; return true;
} }
if (el.classList.contains('markdown-author-link')) { if (el.classList.contains('markdown-author-link')) {
const author = el.getAttribute('data-author'); var author = el.getAttribute('data-author');
const result = { var result = {
type: 'markdown-author-link', type: 'markdown-author-link',
author, author,
} }
@ -53,10 +53,10 @@ document.addEventListener('click', function(event) {
} }
if (el.classList.contains('markdown-post-link')) { if (el.classList.contains('markdown-post-link')) {
let category = el.getAttribute('data-tag'); var category = el.getAttribute('data-tag');
let author = el.getAttribute('data-author'); var author = el.getAttribute('data-author');
let permlink = el.getAttribute('data-permlink'); var permlink = el.getAttribute('data-permlink');
const result = { var result = {
type: 'markdown-post-link', type: 'markdown-post-link',
category, category,
author, author,
@ -66,8 +66,8 @@ document.addEventListener('click', function(event) {
return false; return false;
} }
if (el.classList.contains('markdown-tag-link')) { if (el.classList.contains('markdown-tag-link')) {
let tag = el.getAttribute('data-tag'); var tag = el.getAttribute('data-tag');
const result = { var result = {
type: 'markdown-tag-link', type: 'markdown-tag-link',
tag tag
} }
@ -76,7 +76,7 @@ document.addEventListener('click', function(event) {
} }
if (el.classList.contains('markdown-witnesses-link')) { if (el.classList.contains('markdown-witnesses-link')) {
const result = { var result = {
type: 'markdown-witnesses-link' type: 'markdown-witnesses-link'
} }
window.ReactNativeWebView.postMessage(JSON.stringify(result)); window.ReactNativeWebView.postMessage(JSON.stringify(result));
@ -84,8 +84,8 @@ document.addEventListener('click', function(event) {
} }
if (el.classList.contains('markdown-proposal-link')) { if (el.classList.contains('markdown-proposal-link')) {
let proposal = el.getAttribute('data-proposal'); var proposal = el.getAttribute('data-proposal');
const result = { var result = {
type: 'markdown-proposal-link', type: 'markdown-proposal-link',
proposal proposal
} }
@ -93,14 +93,14 @@ document.addEventListener('click', function(event) {
return false; return false;
} }
if (el.classList.contains('markdown-video-link')) { if (el.classList.contains('markdown-video-link')) {
const embedSrc = '<iframe frameborder="0" allowfullscreen src="' + el.getAttribute('data-embed-src') + '"></iframe>'; var embedSrc = '<iframe frameborder="0" allowfullscreen src="' + el.getAttribute('data-embed-src') + '"></iframe>';
if (embedSrc) { if (embedSrc) {
el.innerHTML = embedSrc; el.innerHTML = embedSrc;
return; return;
} }
const videoHref = el.getAttribute('data-video-href'); var videoHref = el.getAttribute('data-video-href');
if (videoHref) { if (videoHref) {
const result = { var result = {
type: 'markdown-video-link', type: 'markdown-video-link',
videoHref videoHref
} }
@ -109,7 +109,7 @@ document.addEventListener('click', function(event) {
return false; return false;
} }
} }
const author = el.getAttribute('data-author').toString(); var author = el.getAttribute('data-author').toString();
window.ReactNativeWebView.postMessage(JSON.stringify(author)); window.ReactNativeWebView.postMessage(JSON.stringify(author));
}) })
true;`; true;`;

View File

@ -209,8 +209,6 @@ const PostBody = ({
} }
body { body {
color: ${EStyleSheet.value('$primaryBlack')}; color: ${EStyleSheet.value('$primaryBlack')};
display: flex;
align-items: center;
} }
a { a {
color: ${EStyleSheet.value('$primaryBlue')}; color: ${EStyleSheet.value('$primaryBlue')};

View File

@ -46,11 +46,9 @@ const PostsView = ({
const [startPermlink, setStartPermlink] = useState(''); const [startPermlink, setStartPermlink] = useState('');
const [refreshing, setRefreshing] = useState(false); const [refreshing, setRefreshing] = useState(false);
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [isShowFilterBar, setIsShowFilterBar] = useState(true);
const [selectedFilterIndex, setSelectedFilterIndex] = useState(selectedOptionIndex || 0); const [selectedFilterIndex, setSelectedFilterIndex] = useState(selectedOptionIndex || 0);
const [isNoPost, setIsNoPost] = useState(false); const [isNoPost, setIsNoPost] = useState(false);
const [promotedPosts, setPromotedPosts] = useState([]); const [promotedPosts, setPromotedPosts] = useState([]);
const [scrollOffsetY, setScrollOffsetY] = useState(0);
const [selectedFilterValue, setSelectedFilterValue] = useState( const [selectedFilterValue, setSelectedFilterValue] = useState(
filterOptionsValue && filterOptionsValue[selectedFilterIndex], filterOptionsValue && filterOptionsValue[selectedFilterIndex],
); );
@ -333,22 +331,17 @@ const PostsView = ({
); );
}; };
const _handleOnScroll = event => { const _handleOnScroll = () => {
const currentOffset = event.nativeEvent.contentOffset.y;
if (handleOnScroll) { if (handleOnScroll) {
handleOnScroll(); handleOnScroll();
} }
setScrollOffsetY(currentOffset);
setIsShowFilterBar(scrollOffsetY > currentOffset || scrollOffsetY <= 0);
}; };
return ( return (
<ThemeContainer> <ThemeContainer>
{({ isDarkTheme }) => ( {({ isDarkTheme }) => (
<View style={styles.container}> <View style={styles.container}>
{filterOptions && isShowFilterBar && ( {filterOptions && (
<FilterBar <FilterBar
dropdownIconName="arrow-drop-down" dropdownIconName="arrow-drop-down"
//options={filterOptions} //options={filterOptions}

View File

@ -464,7 +464,7 @@ export const getSettings = async () => {
} }
const settingData = { const settingData = {
language: '', language: '',
isDarkTheme: false, isDarkTheme: null,
currency: '', currency: '',
notification: true, notification: true,
server: '', server: '',

View File

@ -461,7 +461,11 @@ class ApplicationContainer extends Component {
const settings = await getSettings(); const settings = await getSettings();
if (settings) { if (settings) {
dispatch(isDarkTheme(nativeThemeInitialMode === 'dark' || settings.isDarkTheme)); dispatch(
isDarkTheme(
settings.isDarkTheme === null ? nativeThemeInitialMode === 'dark' : settings.isDarkTheme,
),
);
this.setState({ isThemeReady: true }); this.setState({ isThemeReady: true });
if (settings.isPinCodeOpen !== '') dispatch(isPinCodeOpen(settings.isPinCodeOpen)); if (settings.isPinCodeOpen !== '') dispatch(isPinCodeOpen(settings.isPinCodeOpen));
if (settings.language !== '') dispatch(setLanguage(settings.language)); if (settings.language !== '') dispatch(setLanguage(settings.language));

View File

@ -5,7 +5,7 @@ import { connect } from 'react-redux';
import { createAppContainer } from 'react-navigation'; import { createAppContainer } from 'react-navigation';
import AppNavitation from '../../../navigation/routes'; import AppNavitation from '../../../navigation/routes';
import { setTopLevelNavigator } from '../../../navigation/service'; import { setTopLevelNavigator, navigate } from '../../../navigation/service';
// Services // Services
import { toastNotification as toastNotificationAction } from '../../../redux/actions/uiAction'; import { toastNotification as toastNotificationAction } from '../../../redux/actions/uiAction';

1879
yarn.lock

File diff suppressed because it is too large Load Diff