Merge pull request #1424 from esteemapp/bugfix/post-android-6

Fixed android 6.0 issue
This commit is contained in:
Feruz M 2019-12-18 19:54:47 +02:00 committed by GitHub
commit 2980390615
4 changed files with 1012 additions and 919 deletions

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

1879
yarn.lock

File diff suppressed because it is too large Load Diff