mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-15 16:42:10 +03:00
Merge pull request #1784 from ecency/bugfix/unmounted
Fixed unmounted component issue
This commit is contained in:
commit
fa889ad09b
@ -143,7 +143,7 @@ android {
|
|||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
|
versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
|
||||||
versionName "3.0.8"
|
versionName "3.0.9"
|
||||||
resValue "string", "build_config_package", "app.esteem.mobile.android"
|
resValue "string", "build_config_package", "app.esteem.mobile.android"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
// react-native-image-crop-picker
|
// react-native-image-crop-picker
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>3.0.8</string>
|
<string>3.0.9</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>2558</string>
|
<string>2559</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true />
|
<true />
|
||||||
<key>NSAppTransportSecurity</key>
|
<key>NSAppTransportSecurity</key>
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>BNDL</string>
|
<string>BNDL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>3.0.8</string>
|
<string>3.0.9</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>2558</string>
|
<string>2559</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -1100,7 +1100,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
CURRENT_PROJECT_VERSION = 2558;
|
CURRENT_PROJECT_VERSION = 2559;
|
||||||
DEAD_CODE_STRIPPING = NO;
|
DEAD_CODE_STRIPPING = NO;
|
||||||
DEVELOPMENT_TEAM = 75B6RXTKGT;
|
DEVELOPMENT_TEAM = 75B6RXTKGT;
|
||||||
HEADER_SEARCH_PATHS = (
|
HEADER_SEARCH_PATHS = (
|
||||||
@ -1176,7 +1176,7 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = Ecency/Ecency.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Ecency/Ecency.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Distribution";
|
CODE_SIGN_IDENTITY = "iPhone Distribution";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
CURRENT_PROJECT_VERSION = 2558;
|
CURRENT_PROJECT_VERSION = 2559;
|
||||||
DEAD_CODE_STRIPPING = NO;
|
DEAD_CODE_STRIPPING = NO;
|
||||||
DEVELOPMENT_TEAM = 75B6RXTKGT;
|
DEVELOPMENT_TEAM = 75B6RXTKGT;
|
||||||
HEADER_SEARCH_PATHS = (
|
HEADER_SEARCH_PATHS = (
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>3.0.8</string>
|
<string>3.0.9</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleURLTypes</key>
|
<key>CFBundleURLTypes</key>
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>BNDL</string>
|
<string>BNDL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>3.0.8</string>
|
<string>3.0.9</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>2558</string>
|
<string>2559</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>3.0.8</string>
|
<string>3.0.9</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>2558</string>
|
<string>2559</string>
|
||||||
<key>NSExtension</key>
|
<key>NSExtension</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionAttributes</key>
|
<key>NSExtensionAttributes</key>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ecency",
|
"name": "ecency",
|
||||||
"version": "3.0.8",
|
"version": "3.0.9",
|
||||||
"displayName": "Ecency",
|
"displayName": "Ecency",
|
||||||
"private": true,
|
"private": true,
|
||||||
"rnpm": {
|
"rnpm": {
|
||||||
|
@ -15,7 +15,7 @@ import PostsView from '../view/postsView';
|
|||||||
import { setFeedPosts } from '../../../redux/actions/postsAction';
|
import { setFeedPosts } from '../../../redux/actions/postsAction';
|
||||||
import { hidePostsThumbnails } from '../../../redux/actions/uiAction';
|
import { hidePostsThumbnails } from '../../../redux/actions/uiAction';
|
||||||
|
|
||||||
let _isLoadingPost = false;
|
import useIsMountedRef from '../../../customHooks/useIsMountedRef';
|
||||||
|
|
||||||
const PostsContainer = ({
|
const PostsContainer = ({
|
||||||
changeForceLoadPostState,
|
changeForceLoadPostState,
|
||||||
@ -51,6 +51,7 @@ const PostsContainer = ({
|
|||||||
filterOptionsValue && filterOptionsValue[selectedFilterIndex],
|
filterOptionsValue && filterOptionsValue[selectedFilterIndex],
|
||||||
);
|
);
|
||||||
const elem = useRef(null);
|
const elem = useRef(null);
|
||||||
|
const isMountedRef = useIsMountedRef();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
@ -119,15 +120,16 @@ const PostsContainer = ({
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (isMountedRef.current) {
|
||||||
setPromotedPosts(_promotedPosts);
|
setPromotedPosts(_promotedPosts);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
|
|
||||||
const _loadPosts = (type) => {
|
const _loadPosts = (type) => {
|
||||||
if (
|
if (
|
||||||
_isLoadingPost ||
|
|
||||||
isLoading ||
|
isLoading ||
|
||||||
!isConnected ||
|
!isConnected ||
|
||||||
(!isLoggedIn && type === 'feed') ||
|
(!isLoggedIn && type === 'feed') ||
|
||||||
@ -136,12 +138,10 @@ const PostsContainer = ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
_isLoadingPost = true;
|
|
||||||
|
|
||||||
if (!isConnected && (refreshing || isLoading)) {
|
if (!isConnected && (refreshing || isLoading)) {
|
||||||
setRefreshing(false);
|
setRefreshing(false);
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
_isLoadingPost = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,6 +182,7 @@ const PostsContainer = ({
|
|||||||
}
|
}
|
||||||
func(options, username, nsfw)
|
func(options, username, nsfw)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
|
if (isMountedRef.current) {
|
||||||
if (result.length > 0) {
|
if (result.length > 0) {
|
||||||
let _posts = result;
|
let _posts = result;
|
||||||
|
|
||||||
@ -215,12 +216,11 @@ const PostsContainer = ({
|
|||||||
}
|
}
|
||||||
setRefreshing(false);
|
setRefreshing(false);
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
_isLoadingPost = false;
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
setRefreshing(false);
|
setRefreshing(false);
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
_isLoadingPost = false;
|
|
||||||
});
|
});
|
||||||
// track filter and tag views
|
// track filter and tag views
|
||||||
if (isAnalytics) {
|
if (isAnalytics) {
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
export default ['rpc.esteem.app', 'api.hive.blog', 'anyx.io', 'api.pharesim.me'];
|
export default ['rpc.esteem.app', 'api.hive.blog', 'anyx.io', 'api.pharesim.me'];
|
||||||
|
|
||||||
export const VALUE = ['rpc.esteem.app', 'api.hive.blog', 'anyx.io', 'api.pharesim.me'];
|
export const VALUE = ['rpc.esteem.app', 'api.hive.blog', 'anyx.io', 'api.pharesim.me'];
|
||||||
|
|
||||||
|
export const SERVER_LIST = [
|
||||||
|
'https://rpc.ecency.com',
|
||||||
|
'https://anyx.io',
|
||||||
|
'https://api.hive.blog',
|
||||||
|
'https://hive-api.arcange.eu',
|
||||||
|
'https://api.deathwing.me',
|
||||||
|
'https://rpc.ausbit.dev',
|
||||||
|
];
|
||||||
|
12
src/customHooks/useIsMountedRef.js
Normal file
12
src/customHooks/useIsMountedRef.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { useEffect, useRef } from 'react';
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
const isMountedRef = useRef(null);
|
||||||
|
useEffect(() => {
|
||||||
|
isMountedRef.current = true;
|
||||||
|
return () => {
|
||||||
|
isMountedRef.current = false;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return isMountedRef;
|
||||||
|
};
|
@ -5,6 +5,7 @@ import { upload } from '../../config/imageApi';
|
|||||||
import serverList from '../../config/serverListApi';
|
import serverList from '../../config/serverListApi';
|
||||||
import { jsonStringify } from '../../utils/jsonUtils';
|
import { jsonStringify } from '../../utils/jsonUtils';
|
||||||
import bugsnag from '../../config/bugsnag';
|
import bugsnag from '../../config/bugsnag';
|
||||||
|
import { SERVER_LIST } from '../../constants/options/api';
|
||||||
|
|
||||||
export const getCurrencyRate = (currency) =>
|
export const getCurrencyRate = (currency) =>
|
||||||
api
|
api
|
||||||
@ -372,19 +373,7 @@ export const uploadImage = (media, username, sign) => {
|
|||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
|
|
||||||
export const getNodes = () =>
|
export const getNodes = () => serverList.get().then((resp) => resp.data.hived || SERVER_LIST);
|
||||||
serverList
|
|
||||||
.get()
|
|
||||||
.then(
|
|
||||||
(resp) =>
|
|
||||||
resp.data.hived || [
|
|
||||||
'https://rpc.ecency.com',
|
|
||||||
'https://api.hive.blog',
|
|
||||||
'https://anyx.io',
|
|
||||||
'https://rpc.esteem.app',
|
|
||||||
'https://api.openhive.network',
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
export const getSCAccessToken = (code) =>
|
export const getSCAccessToken = (code) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
|
@ -25,18 +25,15 @@ import { getDsteemDateErrorMessage } from '../../utils/dsteemUtils';
|
|||||||
|
|
||||||
// Constant
|
// Constant
|
||||||
import AUTH_TYPE from '../../constants/authType';
|
import AUTH_TYPE from '../../constants/authType';
|
||||||
|
import { SERVER_LIST } from '../../constants/options/api';
|
||||||
|
|
||||||
global.Buffer = global.Buffer || require('buffer').Buffer;
|
global.Buffer = global.Buffer || require('buffer').Buffer;
|
||||||
|
|
||||||
const DEFAULT_SERVER = [
|
const DEFAULT_SERVER = SERVER_LIST;
|
||||||
'https://rpc.ecency.com',
|
|
||||||
'https://anyx.io',
|
|
||||||
'https://hive-api.arcange.eu',
|
|
||||||
'https://api.openhive.network',
|
|
||||||
'https://api.hive.blog',
|
|
||||||
];
|
|
||||||
let client = new Client(DEFAULT_SERVER, {
|
let client = new Client(DEFAULT_SERVER, {
|
||||||
timeout: 8000,
|
timeout: 3000,
|
||||||
|
failoverThreshold: 10,
|
||||||
|
consoleOnFailover: true,
|
||||||
rebrandedApi: true,
|
rebrandedApi: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -50,7 +47,9 @@ export const checkClient = async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
client = new Client(selectedServer, {
|
client = new Client(selectedServer, {
|
||||||
timeout: 8000,
|
timeout: 3000,
|
||||||
|
failoverThreshold: 10,
|
||||||
|
consoleOnFailover: true,
|
||||||
rebrandedApi: true,
|
rebrandedApi: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { SERVER_LIST } from '../../constants/options/api';
|
||||||
|
|
||||||
const DEFAULT_SERVER = ['https://rpc.ecency.com', 'https://anyx.io', 'https://api.hive.blog'];
|
const DEFAULT_SERVER = SERVER_LIST;
|
||||||
|
|
||||||
const pickAServer = () => DEFAULT_SERVER.sort(() => 0.5 - Math.random())[0];
|
const pickAServer = () => DEFAULT_SERVER.sort(() => 0.5 - Math.random())[0];
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ import {
|
|||||||
} from '../constants/constants';
|
} from '../constants/constants';
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
api: 'rpc.esteem.app',
|
api: 'rpc.ecency.com',
|
||||||
currency: {
|
currency: {
|
||||||
currency: 'usd',
|
currency: 'usd',
|
||||||
currencyRate: 1,
|
currencyRate: 1,
|
||||||
|
@ -49,6 +49,7 @@ import { encryptKey, decryptKey } from '../../../utils/crypto';
|
|||||||
|
|
||||||
// Component
|
// Component
|
||||||
import SettingsScreen from '../screen/settingsScreen';
|
import SettingsScreen from '../screen/settingsScreen';
|
||||||
|
import { SERVER_LIST } from '../../../constants/options/api';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Props Name Description Value
|
* Props Name Description Value
|
||||||
@ -76,13 +77,7 @@ class SettingsContainer extends Component {
|
|||||||
})
|
})
|
||||||
.catch(() =>
|
.catch(() =>
|
||||||
this.setState({
|
this.setState({
|
||||||
serverList: [
|
serverList: SERVER_LIST,
|
||||||
'https://rpc.ecency.com',
|
|
||||||
'https://api.hive.blog',
|
|
||||||
'https://anyx.io',
|
|
||||||
'https://rpc.esteem.app',
|
|
||||||
'https://api.openhive.network',
|
|
||||||
],
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -123,7 +118,7 @@ class SettingsContainer extends Component {
|
|||||||
let isError = false;
|
let isError = false;
|
||||||
let alertMessage;
|
let alertMessage;
|
||||||
const client = new Client(server, {
|
const client = new Client(server, {
|
||||||
timeout: 8000,
|
timeout: 3000,
|
||||||
rebrandedApi: true,
|
rebrandedApi: true,
|
||||||
});
|
});
|
||||||
dispatch(setApi(''));
|
dispatch(setApi(''));
|
||||||
|
Loading…
Reference in New Issue
Block a user