Merge pull request #1524 from esteemapp/android-fixes

Android fixes
This commit is contained in:
Feruz M 2020-01-27 14:00:16 +02:00 committed by GitHub
commit 872dc051b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 78 additions and 40 deletions

View File

@ -208,7 +208,7 @@ dependencies {
implementation project(':react-native-code-push')
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:multidex:2.0.1'
implementation project(':@react-native-community_viewpager')
if (enableHermes) {

View File

@ -8,6 +8,7 @@ import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import androidx.multidex.MultiDexApplication;
//See below, Webview debugging
//import android.webkit.WebView;
@ -18,7 +19,7 @@ import com.reactnativecommunity.viewpager.RNCViewPagerPackage;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
public class MainApplication extends MultiDexApplication implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override

View File

@ -2,5 +2,6 @@
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowExitAnimation">@android:anim/fade_out</item>
<item name="android:windowBackground">@drawable/launch_screen_bitmap</item>
<item name="android:editTextBackground">@android:color/transparent</item>
</style>
</resources>

View File

@ -30,7 +30,7 @@
"@esteemapp/react-native-slider": "^0.12.0",
"@react-native-community/async-storage": "^1.7.1",
"@react-native-community/cameraroll": "^1.3.0",
"@react-native-community/netinfo": "^5.3.2",
"@react-native-community/netinfo": "^5.3.3",
"appcenter": "^2.6.0",
"appcenter-analytics": "^2.6.0",
"appcenter-crashes": "^2.6.0",

View File

@ -197,8 +197,8 @@ class BasicHeaderView extends Component {
size={25}
onPress={() => handleOnPressPreviewButton()}
iconStyle={styles.rightIcon}
iconType="MaterialIcons"
name={isPreviewActive ? 'remove-red-eye' : 'remove-red-eye'}
iconType="MaterialCommunityIcons"
name={isPreviewActive ? 'eye-off' : 'eye'}
/>
{!isLoading ? (
<TextButton

View File

@ -221,7 +221,7 @@ const MarkdownEditorView = ({
{({ isDarkTheme }) => (
<TextInput
multiline
autoCorrect={false}
autoCorrect={true}
onChangeText={_changeText}
onSelectionChange={_handleOnSelectionChange}
placeholder={intl.formatMessage({

View File

@ -69,20 +69,31 @@ class PostHeaderDescription extends PureComponent {
noAction
/>
)}
<Text style={styles.name}>{name}</Text>
<Text style={styles.reputation}>{_reputationText}</Text>
</TouchableOpacity>
{!!tag && (
<TouchableOpacity onPress={() => tagOnPress && tagOnPress()}>
<Tag isPostCardTag={!isPromoted} isPin value={tag} />
</TouchableOpacity>
)}
<Text style={styles.date}>
{isPromoted ? intl.formatMessage({ id: 'post.sponsored' }) : date}
</Text>
{isShowOwnerIndicator && (
<Icon style={styles.ownerIndicator} name="stars" iconType="MaterialIcons" />
)}
<View style={styles.details}>
<View style={styles.primaryDetails}>
<TouchableOpacity
style={styles.avatarNameWrapper}
onPress={() => this._handleOnUserPress(name)}
>
<Text style={styles.name}>{name}</Text>
<Text style={styles.reputation}>{_reputationText}</Text>
</TouchableOpacity>
{!!tag && (
<TouchableOpacity onPress={() => tagOnPress && tagOnPress()}>
<Tag isPostCardTag={!isPromoted} isPin value={tag} />
</TouchableOpacity>
)}
{isShowOwnerIndicator && (
<Icon style={styles.ownerIndicator} name="stars" iconType="MaterialIcons" />
)}
</View>
<View style={styles.secondaryDetails}>
<Text style={styles.date}>
{isPromoted ? intl.formatMessage({ id: 'post.sponsored' }) : date}
</Text>
</View>
</View>
</View>
</View>
);

View File

@ -5,6 +5,16 @@ export default EStyleSheet.create({
flexDirection: 'row',
alignItems: 'center',
},
details: {
flexDirection: 'column',
},
primaryDetails: {
flexDirection: 'row',
},
secondaryDetails: {
flexDirection: 'row',
marginHorizontal: 3,
},
avatar: {
borderColor: '$borderColor',
borderWidth: 1,
@ -12,14 +22,14 @@ export default EStyleSheet.create({
},
name: {
marginHorizontal: 3,
fontSize: 11,
fontSize: 12,
color: '$primaryBlack',
fontFamily: '$primaryFont',
fontWeight: 'bold',
alignSelf: 'center',
},
reputation: {
fontSize: 11,
fontSize: 12,
color: '$primaryDarkGray',
marginRight: 8,
alignSelf: 'center',

View File

@ -1,5 +1,5 @@
/* eslint-disable react/jsx-wrap-multilines */
import React, { useState, useEffect, useCallback } from 'react';
import React, { useState, useEffect, useCallback, useRef } from 'react';
import { FlatList, View, ActivityIndicator, RefreshControl } from 'react-native';
import { useIntl } from 'react-intl';
import { withNavigation } from 'react-navigation';
@ -53,6 +53,7 @@ const PostsView = ({
filterOptionsValue && filterOptionsValue[selectedFilterIndex],
);
const intl = useIntl();
const postsList = useRef(null);
useEffect(() => {
if (isConnected) {
@ -64,6 +65,9 @@ const PostsView = ({
fetchPromotePost();
_loadPosts();
}
return () => {
//unmounting
};
}, [
_getPromotePosts,
_loadPosts,
@ -111,14 +115,19 @@ const PostsView = ({
]);
const _handleOnDropdownSelect = async index => {
if (filterOptions && filterOptions.length > 0) {
await setSelectedFilterValue(filterOptionsValue[index]);
if (index === selectedFilterIndex) {
_scrollTop();
} else {
if (filterOptions && filterOptions.length > 0) {
await setSelectedFilterValue(filterOptionsValue[index]);
}
setSelectedFilterIndex(index);
setPosts([]);
setStartPermlink('');
setStartAuthor('');
setIsNoPost(false);
}
setSelectedFilterIndex(index);
setPosts([]);
setStartPermlink('');
setStartAuthor('');
setIsNoPost(false);
};
const _getPromotePosts = useCallback(async () => {
@ -312,6 +321,10 @@ const PostsView = ({
}
};
const _scrollTop = () => {
postsList.current.scrollToOffset({ x: 0, y: 0, animated: true });
};
return (
<ThemeContainer>
{({ isDarkTheme }) => (
@ -332,6 +345,7 @@ const PostsView = ({
)}
<FlatList
ref={postsList}
data={posts}
showsVerticalScrollIndicator={false}
renderItem={({ item, index }) => {

View File

@ -76,7 +76,7 @@ class UpvoteContainer extends PureComponent {
if (beneficiaries) {
beneficiary.forEach(key => {
beneficiaries.push(
get(key, 'account') + ': ' + (parseFloat(get(key, 'weight')) / 100).toFixed(2) + '%',
`\n ${get(key, 'account')}: ${(parseFloat(get(key, 'weight')) / 100).toFixed(2)}%`,
);
});
}

View File

@ -54,7 +54,7 @@ class UserAvatarView extends Component {
avatarUrl,
currentUsername: { name, avatar },
} = this.props;
const imageSize = size === 'xl' ? 'large' : 'medium';
const imageSize = 'large';
let _size;
const _avatar = username
? {

View File

@ -118,9 +118,10 @@ export const setDraftPost = async (fields, username) => {
body: fields.body,
};
if (draft.some(e => e.username === username)) {
if (draft && draft.some(e => e.username === username)) {
draft = draft.map(item => (item.username === username ? { ...item, ...data } : item));
} else {
draft = [];
draft.push(data);
}
await setItemToStorage(DRAFT_SCHEMA, draft);

View File

@ -274,6 +274,8 @@ class EditorContainer extends Component {
0,
)
.then(() => {
setDraftPost({ title: '', body: '', tags: '' }, currentAccount.name);
dispatch(
toastNotification(
intl.formatMessage({
@ -284,8 +286,6 @@ class EditorContainer extends Component {
this.setState({ isPostSending: false });
setDraftPost({ title: '', body: '', tags: '' }, currentAccount.name);
navigation.navigate({
routeName: ROUTES.SCREENS.POST,
params: {

View File

@ -58,10 +58,10 @@ export const getTimeFromNow = (value, isWithoutUtc) => {
}
if (isWithoutUtc) {
return moment(value).fromNow(true);
return moment(value).fromNow();
}
return moment.utc(value).fromNow(true);
return moment.utc(value).fromNow();
};
export const getFormatedCreatedDate = value => {

View File

@ -1492,10 +1492,10 @@
eslint-plugin-react-native "3.6.0"
prettier "1.16.4"
"@react-native-community/netinfo@^5.3.2":
version "5.3.2"
resolved "https://registry.yarnpkg.com/@react-native-community/netinfo/-/netinfo-5.3.2.tgz#7b6ee417c2a905663e10de176c00eeab09bdd14c"
integrity sha512-npNcLAz6iWzwRNh+0tSFMlR+xkpSz9NWzX+5AxW40KE6qEZGWdE3dtGBKsezMdWD2Fh+6Je6P6hgUEF8xuZrbA==
"@react-native-community/netinfo@^5.3.3":
version "5.3.3"
resolved "https://registry.yarnpkg.com/@react-native-community/netinfo/-/netinfo-5.3.3.tgz#2e627456d83c1d75d4c43ab6cef70fe125b9691d"
integrity sha512-L4BsdIEEuG5rKkVNzjESdJ1wvusn0kflj/FrwctaW+xkLxiFs1+mdBg/mvqqfXvVFuBEphbyXJTFT4aG4Okkow==
"@react-native-community/viewpager@^2.0.1":
version "2.0.2"