diff --git a/android/app/build.gradle b/android/app/build.gradle index 251ab45fb..6ae7d9fe4 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -137,6 +137,7 @@ android { } dependencies { + compile project(':react-native-fast-image') compile project(':react-native-vector-icons') compile fileTree(dir: "libs", include: ["*.jar"]) compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" diff --git a/android/app/src/main/assets/fonts/Roboto.ttf b/android/app/src/main/assets/fonts/Roboto.ttf new file mode 100644 index 000000000..3e6e2e761 Binary files /dev/null and b/android/app/src/main/assets/fonts/Roboto.ttf differ diff --git a/android/app/src/main/assets/fonts/Roboto_medium.ttf b/android/app/src/main/assets/fonts/Roboto_medium.ttf new file mode 100644 index 000000000..aa00de0ef Binary files /dev/null and b/android/app/src/main/assets/fonts/Roboto_medium.ttf differ diff --git a/android/app/src/main/assets/fonts/rubicon-icon-font.ttf b/android/app/src/main/assets/fonts/rubicon-icon-font.ttf new file mode 100644 index 000000000..25e7d92e3 Binary files /dev/null and b/android/app/src/main/assets/fonts/rubicon-icon-font.ttf differ diff --git a/android/app/src/main/java/com/esteem/MainApplication.java b/android/app/src/main/java/com/esteem/MainApplication.java index 51c6bcbd8..d625e6402 100644 --- a/android/app/src/main/java/com/esteem/MainApplication.java +++ b/android/app/src/main/java/com/esteem/MainApplication.java @@ -3,6 +3,7 @@ package com.esteem; import android.app.Application; import com.facebook.react.ReactApplication; +import com.dylanvann.fastimage.FastImageViewPackage; import com.oblador.vectoricons.VectorIconsPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; @@ -24,6 +25,7 @@ public class MainApplication extends Application implements ReactApplication { protected List getPackages() { return Arrays.asList( new MainReactPackage(), + new FastImageViewPackage(), new VectorIconsPackage() ); } diff --git a/android/settings.gradle b/android/settings.gradle index b412cb66b..df23565d5 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,4 +1,6 @@ rootProject.name = 'eSteem' +include ':react-native-fast-image' +project(':react-native-fast-image').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fast-image/android') include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') diff --git a/ios/eSteem.xcodeproj/project.pbxproj b/ios/eSteem.xcodeproj/project.pbxproj index 7096905ee..f4940ce72 100644 --- a/ios/eSteem.xcodeproj/project.pbxproj +++ b/ios/eSteem.xcodeproj/project.pbxproj @@ -5,7 +5,6 @@ }; objectVersion = 46; objects = { - /* Begin PBXBuildFile section */ 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; @@ -61,6 +60,10 @@ F31624561A5F492FA0EACC97 /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 81CB98D1E7EC4EFBABE1CACF /* Ionicons.ttf */; }; F3662FE59ED5455DB030A2F8 /* SimpleLineIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EA05FC2565FA4A058864397B /* SimpleLineIcons.ttf */; }; FF83A7D6C028495BBFB1CE66 /* Foundation.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 631FBEBAA38C47D987E3D463 /* Foundation.ttf */; }; + 1AF2CD16F43F426588739EA1 /* libFastImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F9B5C34A6AFD4A7EAF9FCA5B /* libFastImage.a */; }; + 95F52A0E16D34F3B98D482D0 /* Roboto_medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6637816CC58243EA8CD66369 /* Roboto_medium.ttf */; }; + DE6394B3D03149F08E18FDB4 /* Roboto.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D7C020CD375646989DFB5A00 /* Roboto.ttf */; }; + E8030163FFB34D83B1E185A2 /* rubicon-icon-font.ttf in Resources */ = {isa = PBXBuildFile; fileRef = AADF1241EEAB4F6E8C363CEC /* rubicon-icon-font.ttf */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -397,6 +400,11 @@ D45D48954F524BD6AA0654DA /* FontAwesome.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf"; sourceTree = ""; }; EA05FC2565FA4A058864397B /* SimpleLineIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = SimpleLineIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf"; sourceTree = ""; }; EDAA66611DD74053A67DB5E6 /* Feather.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Feather.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Feather.ttf"; sourceTree = ""; }; + BB460CE5C23F4F18BD70B31E /* FastImage.xcodeproj */ = {isa = PBXFileReference; name = "FastImage.xcodeproj"; path = "../node_modules/react-native-fast-image/ios/FastImage.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; + F9B5C34A6AFD4A7EAF9FCA5B /* libFastImage.a */ = {isa = PBXFileReference; name = "libFastImage.a"; path = "libFastImage.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; + 6637816CC58243EA8CD66369 /* Roboto_medium.ttf */ = {isa = PBXFileReference; name = "Roboto_medium.ttf"; path = "../node_modules/native-base/Fonts/Roboto_medium.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + D7C020CD375646989DFB5A00 /* Roboto.ttf */ = {isa = PBXFileReference; name = "Roboto.ttf"; path = "../node_modules/native-base/Fonts/Roboto.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + AADF1241EEAB4F6E8C363CEC /* rubicon-icon-font.ttf */ = {isa = PBXFileReference; name = "rubicon-icon-font.ttf"; path = "../node_modules/native-base/Fonts/rubicon-icon-font.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -426,6 +434,7 @@ 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 5BA0766B63644D679B1E03EB /* libRNVectorIcons.a in Frameworks */, + 1AF2CD16F43F426588739EA1 /* libFastImage.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -613,6 +622,7 @@ 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 23B20A8D9E714DBC8FCD4CAC /* RNVectorIcons.xcodeproj */, + BB460CE5C23F4F18BD70B31E /* FastImage.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -703,6 +713,9 @@ 4B93197E996E43A48AC65531 /* Octicons.ttf */, B8FDA6A3A2AB4894B988A968 /* SimpleLineIcons.ttf */, 97593E7AD1CE4284BA62C90B /* Zocial.ttf */, + 6637816CC58243EA8CD66369 /* Roboto_medium.ttf */, + D7C020CD375646989DFB5A00 /* Roboto.ttf */, + AADF1241EEAB4F6E8C363CEC /* rubicon-icon-font.ttf */, ); name = Resources; sourceTree = ""; @@ -1189,6 +1202,9 @@ C914988BD09E47C6A810D30F /* Octicons.ttf in Resources */, 9224F9CFABAE48BBB8262C24 /* SimpleLineIcons.ttf in Resources */, D030F1F660404F24B5F24ACB /* Zocial.ttf in Resources */, + 95F52A0E16D34F3B98D482D0 /* Roboto_medium.ttf in Resources */, + DE6394B3D03149F08E18FDB4 /* Roboto.ttf in Resources */, + E8030163FFB34D83B1E185A2 /* rubicon-icon-font.ttf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1314,6 +1330,7 @@ HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", + "$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**", ); INFOPLIST_FILE = eSteemTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; @@ -1321,6 +1338,7 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1339,6 +1357,7 @@ HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", + "$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**", ); INFOPLIST_FILE = eSteemTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; @@ -1346,6 +1365,7 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1366,6 +1386,7 @@ HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", + "$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**", ); INFOPLIST_FILE = eSteem/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1389,6 +1410,7 @@ HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", + "$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**", ); INFOPLIST_FILE = eSteem/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1418,12 +1440,14 @@ HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", + "$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**", ); INFOPLIST_FILE = "eSteem-tvOS/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1452,12 +1476,14 @@ HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", + "$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**", ); INFOPLIST_FILE = "eSteem-tvOS/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1485,12 +1511,14 @@ HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", + "$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**", ); INFOPLIST_FILE = "eSteem-tvOSTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1518,12 +1546,14 @@ HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", + "$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**", ); INFOPLIST_FILE = "eSteem-tvOSTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", diff --git a/ios/eSteem/Info.plist b/ios/eSteem/Info.plist index 86eb332af..9709322f3 100644 --- a/ios/eSteem/Info.plist +++ b/ios/eSteem/Info.plist @@ -36,7 +36,7 @@ NSLocationWhenInUseUsageDescription - + UIAppFonts Entypo.ttf @@ -50,6 +50,9 @@ Octicons.ttf SimpleLineIcons.ttf Zocial.ttf + Roboto_medium.ttf + Roboto.ttf + rubicon-icon-font.ttf UILaunchStoryboardName LaunchScreen diff --git a/package-lock.json b/package-lock.json index 70446bf05..5149b1282 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2613,6 +2613,11 @@ "integrity": "sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=", "dev": true }, + "deep-diff": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/deep-diff/-/deep-diff-0.3.8.tgz", + "integrity": "sha1-wB3mPvsO7JeYgB1Ax+Da4ltYLIQ=" + }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", @@ -7584,6 +7589,14 @@ "lodash": "^4.11.1" } }, + "react-native-fast-image": { + "version": "4.0.14", + "resolved": "https://registry.npmjs.org/react-native-fast-image/-/react-native-fast-image-4.0.14.tgz", + "integrity": "sha512-MeRgL70JxoY/hn8ZRGBsDED9SGvTEeznneL//fWZyLaG0CM+w2CH4QXAMvADnIvu2RFd8WQWNii6c6VOpVe4Tg==", + "requires": { + "prop-types": "^15.5.10" + } + }, "react-native-htmlview": { "version": "0.12.1", "resolved": "https://registry.npmjs.org/react-native-htmlview/-/react-native-htmlview-0.12.1.tgz", @@ -7886,6 +7899,14 @@ "symbol-observable": "^1.2.0" } }, + "redux-logger": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/redux-logger/-/redux-logger-3.0.6.tgz", + "integrity": "sha1-91VZZvMJjzyIYExEnPC69XeCdL8=", + "requires": { + "deep-diff": "^0.3.5" + } + }, "redux-thunk": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.3.0.tgz", diff --git a/package.json b/package.json index 85e82c830..a5646b28c 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "react": "16.4.1", "react-native": "0.56.0", "react-native-circular-action-menu": "^0.5.0", + "react-native-fast-image": "^4.0.14", "react-native-htmlview": "^0.12.1", "react-native-render-html": "^3.10.0", "react-native-scrollable-tab-view": "^0.8.0", @@ -24,6 +25,7 @@ "react-navigation": "^2.8.0", "react-redux": "^5.0.7", "redux": "^4.0.0", + "redux-logger": "^3.0.6", "redux-thunk": "^2.3.0", "remarkable": "^1.7.1", "rn-placeholder": "^1.2.0" diff --git a/src/navigation/Tabs.js b/src/navigation/Tabs.js index 2a989a543..712df5114 100755 --- a/src/navigation/Tabs.js +++ b/src/navigation/Tabs.js @@ -18,6 +18,7 @@ import NotificationPage from '../screens/notifications/notification'; import SinglePostPage from '../screens/single-post/Post'; import LoginPage from '../screens/login/Login'; import AuthorPage from '../screens/author-profile/Author'; +import DiscoverPage from '../screens/discover/Discover'; const HomeScreen = ({ navigation }) => ; @@ -98,6 +99,10 @@ const LoginScreen = ({ navigation }) => ; const AuthorScreen = ({ navigation }) => ; +const DiscoverScreen = ({ navigation }) => ( + +); + const BottomTabs = createBottomTabNavigator( { Home: { @@ -162,6 +167,10 @@ const StacksOverTabs = createStackNavigator( screen: AuthorScreen, path: '/author', }, + Discover: { + screen: DiscoverScreen, + path: 'discover', + }, }, { headerMode: 'none', diff --git a/src/providers/steem/Dsteem.js b/src/providers/steem/Dsteem.js index 1cc4e72f3..4443ae166 100644 --- a/src/providers/steem/Dsteem.js +++ b/src/providers/steem/Dsteem.js @@ -30,6 +30,23 @@ export const getAccount = user => { }); }; +/** + * @method getFollows get account data + * @param user username + */ +export const getFollows = user => { + return new Promise((resolve, reject) => { + client + .call('follow_api', 'get_follow_count', [user]) + .then(result => { + resolve(result); + }) + .catch(err => { + reject(err); + }); + }); +}; + /** * @method getPosts get posts method * @param by get discussions by trending, created, active etc. diff --git a/src/screens/author-profile/Author.js b/src/screens/author-profile/Author.js index 70d164e90..be263b411 100644 --- a/src/screens/author-profile/Author.js +++ b/src/screens/author-profile/Author.js @@ -1,7 +1,9 @@ import * as React from 'react'; -import { StatusBar } from 'react-native'; +import { StatusBar, Dimensions } from 'react-native'; import { Container, + Card, + CardItem, Header, Left, Body, @@ -11,8 +13,13 @@ import { Title, Content, Text, + View, } from 'native-base'; import { getAccount } from '../../providers/steem/Dsteem'; +import ScrollableTabView from 'react-native-scrollable-tab-view'; +import CustomTabBar from '../home/FeedTabs'; +import moment from 'moment'; +import FastImage from 'react-native-fast-image'; class AuthorPage extends React.Component { constructor(props) { @@ -20,14 +27,21 @@ class AuthorPage extends React.Component { this.state = { author: 'author', + about: {}, + follows: {}, }; } componentDidMount() { + let info; + let json_metadata; getAccount(this.props.navigation.state.params.author) .then(author => { + json_metadata = JSON.parse(author[0].json_metadata); + info = json_metadata.profile; this.setState({ author: author[0], + about: info, }); }) .catch(err => {}); @@ -59,7 +73,205 @@ class AuthorPage extends React.Component { - {JSON.stringify(this.state.author)} + +
+ + + + + {this.state.author.name} + + + + + + +
+ + + + + + {this.state.author.name} + + {this.state.about.about} + + + + + + {this.state.author.post_count} Posts + + + + Followers + + + Following + + + + + + + + + + + + + {moment + .utc(this.state.author.created) + .local() + .fromNow()} + + + + + + ( + + )} + > + + + + + + + +
); diff --git a/src/screens/discover/Discover.js b/src/screens/discover/Discover.js new file mode 100644 index 000000000..54de89f43 --- /dev/null +++ b/src/screens/discover/Discover.js @@ -0,0 +1,22 @@ +// TODO: Add top users from Surfer + +import React from 'react'; +import { View, Text } from 'native-base'; + +class DiscoverPage extends React.Component { + constructor(props) { + super(props); + } + + componentDidMount() {} + + render() { + return ( + + Discover + + ); + } +} + +export default DiscoverPage; diff --git a/src/screens/discover/TopUsers.js b/src/screens/discover/TopUsers.js new file mode 100644 index 000000000..e69de29bb diff --git a/src/screens/home/CustomTabBar.js b/src/screens/home/FeedTabs.js similarity index 100% rename from src/screens/home/CustomTabBar.js rename to src/screens/home/FeedTabs.js diff --git a/src/screens/home/home.js b/src/screens/home/home.js index 3bef3b129..c721d5c81 100644 --- a/src/screens/home/home.js +++ b/src/screens/home/home.js @@ -29,7 +29,7 @@ import HotPage from './hot'; import TrendingPage from './trending'; import ScrollableTabView from 'react-native-scrollable-tab-view'; -import CustomTabBar from './CustomTabBar'; +import CustomTabBar from './FeedTabs'; class HomePage extends React.Component { constructor(props) { diff --git a/src/screens/profile/profile.js b/src/screens/profile/profile.js index 246ced489..7837961cb 100644 --- a/src/screens/profile/profile.js +++ b/src/screens/profile/profile.js @@ -1,7 +1,20 @@ import * as React from 'react'; -import { StatusBar } from 'react-native'; +import { StatusBar, Image, Dimensions, AsyncStorage } from 'react-native'; + +import moment from 'moment'; +import FastImage from 'react-native-fast-image'; + +import ScrollableTabView from 'react-native-scrollable-tab-view'; +import CustomTabBar from '../home/FeedTabs'; +import DiscoverPage from '../discover/Discover'; +import { getAccount, getFollows } from '../../providers/steem/Dsteem'; + import { - Container, + Content, + Card, + CardItem, + Thumbnail, + View, Header, Left, Body, @@ -13,36 +26,296 @@ import { } from 'native-base'; class ProfilePage extends React.Component { - static navigationOptions = { - title: 'Profile', - }; + constructor() { + super(); + this.state = { + user: [], + about: {}, + follows: {}, + isLoggedIn: false, + }; + } + + async componentWillMount() { + let isLoggedIn; + await AsyncStorage.getItem('isLoggedIn').then(result => { + isLoggedIn = JSON.parse(result); + if (isLoggedIn == true) { + this.setState({ + isLoggedIn: true, + }); + } else { + } + }); + } + + componentDidMount() { + let user; + let info; + let json_metadata; + AsyncStorage.getItem('user') + .then(result => { + if (!result) { + return false; + } + user = JSON.parse(result); + }) + .then(() => { + getAccount(user.username).then(account => { + json_metadata = JSON.parse(account[0].json_metadata); + info = json_metadata.profile; + this.setState({ + user: account[0], + about: info, + }); + }); + }) + .then(() => { + getFollows(user.username) + .then(result => { + this.setState({ + follows: result, + }); + }) + .catch(err => { + alert(err); + }); + }) + .catch(err => { + alert(err); + }); + } render() { return ( - -
- - - - - Profile - - - - - - -
- Profile -
+ + {this.state.isLoggedIn ? ( + +
+ + + + + {this.state.user.name} + + + + + + +
+ + + + + + {this.state.user.name} + + {this.state.about.about} + + + + + + {this.state.user.post_count} Posts + + + + + {this.state.follows.follower_count}{' '} + Followers + + + + + {this.state.follows.following_count}{' '} + Following + + + + + + + + + {this.state.about.location} + + + + + + {moment + .utc(this.state.user.created) + .local() + .fromNow()} + + + + + + ( + + )} + > + + + + + + + +
+ ) : ( + +
+ + + + + + </Body> + <Right> + <Button transparent> + <Icon name="more" /> + </Button> + </Right> + </Header> + <DiscoverPage /> + </View> + )} + </View> ); } } diff --git a/src/screens/side-menu/LoggedInMenu.js b/src/screens/side-menu/LoggedInMenu.js index 4b1019375..266ba0519 100644 --- a/src/screens/side-menu/LoggedInMenu.js +++ b/src/screens/side-menu/LoggedInMenu.js @@ -15,9 +15,9 @@ import { } from 'native-base'; import styles from './style'; +import FastImage from 'react-native-fast-image'; import { getAccount } from '../../providers/steem/Dsteem'; -const drawerCover = require('../../assets/drawer-cover.png'); const masterKeyMenuOptions = [ { name: 'Home', @@ -194,9 +194,14 @@ export class LoggedInSideBar extends Component { bounces={false} style={{ flex: 1, backgroundColor: '#fff', top: -1 }} > - <Image source={drawerCover} style={styles.drawerCover} /> + <FastImage + source={{ + uri: this.state.json_metadata.cover_image, + priority: FastImage.priority.high, + }} + style={styles.drawerCover} + /> <Thumbnail - square style={styles.drawerImage} source={{ uri: this.state.avatar }} /> diff --git a/src/screens/side-menu/style.js b/src/screens/side-menu/style.js index 625daf970..d14717cea 100644 --- a/src/screens/side-menu/style.js +++ b/src/screens/side-menu/style.js @@ -14,8 +14,8 @@ export default { }, drawerImage: { position: 'absolute', - left: Platform.OS === 'android' ? deviceWidth / 10 : deviceWidth / 30, - top: Platform.OS === 'android' ? deviceHeight / 13 : deviceHeight / 15, + left: Platform.OS === 'android' ? deviceWidth / 12 : deviceWidth / 30, + top: Platform.OS === 'android' ? deviceHeight / 15 : deviceHeight / 15, width: 60, height: 60, resizeMode: 'cover', @@ -36,8 +36,8 @@ export default { }, info: { position: 'absolute', - top: Platform.OS === 'android' ? deviceHeight / 13 : deviceHeight / 5.8, - left: Platform.OS === 'android' ? deviceWidth / 10 : deviceWidth / 40, + top: Platform.OS === 'android' ? deviceHeight / 6 : deviceHeight / 5.8, + left: Platform.OS === 'android' ? deviceWidth / 12 : deviceWidth / 40, }, userLabel: { fontWeight: 'bold', diff --git a/src/screens/single-post/Post.js b/src/screens/single-post/Post.js index f95e6fadf..f1b5445fb 100644 --- a/src/screens/single-post/Post.js +++ b/src/screens/single-post/Post.js @@ -51,9 +51,11 @@ class SinglePostPage extends React.Component { } alterNode(node) { - if (node.name == 'img' || node.name == 'a') { - // console.log(node); + if (node.name == 'img') { + node.attribs.style = `max-width: ${Dimensions.get('window').width}`; } else if (node.name == 'iframe') { + node.attribs.style = `max-width: ${Dimensions.get('window').width}`; + node.attribs.style = `width: ${Dimensions.get('window').width}`; node.attribs.height = 200; } }