From 5680afd46e8172edf2ab724b03a1f9ea5a216a0c Mon Sep 17 00:00:00 2001 From: prameetc Date: Tue, 19 Feb 2019 19:36:52 +0530 Subject: [PATCH 01/36] Android Fixes --- android/app/build.gradle | 2 +- android/app/src/main/AndroidManifest.xml | 1 - .../test/java/co/bitnation/PanthalassaTest.java | 14 -------------- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index f7a76018..e01c5774 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -99,7 +99,7 @@ def enableProguardInReleaseBuilds = false android { compileSdkVersion 25 - buildToolsVersion '25.0.1' + buildToolsVersion '28.0.2' defaultConfig { applicationId 'co.bitnation' minSdkVersion 16 diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 8d8a2bdd..85def04e 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -10,7 +10,6 @@ Date: Fri, 22 Feb 2019 18:48:05 +0530 Subject: [PATCH 02/36] Minor Fixes --- src/global/translations/en.json | 4 ++-- src/global/translations/hi.json | 4 ++-- src/screens/Settings/ProfileScreen/EmptyProfile/index.js | 2 +- src/screens/Settings/ProfileScreen/Profile/index.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/global/translations/en.json b/src/global/translations/en.json index 272becdc..b5f1eb06 100644 --- a/src/global/translations/en.json +++ b/src/global/translations/en.json @@ -282,7 +282,7 @@ "location": "Location", "readyUse": "Congratulations! You're now a World Citizen!", "walletEmpty": "Your account is ready, but your wallet is empty. Please add ETH to your wallet so you can do stuff.", - "openDashboard": "Open Dashboard", + "openDashboard": "Next", "openWallet": "Open ETH Wallet" }, "restore": { @@ -566,7 +566,7 @@ "switchAccounts": "SWITCH ACCOUNT", "connectToDAppHost": "Connect to DApp host", "connectToDAppLogger": "Connect debug logger", - "documents": "Documents", + "documents": "View or Add Documents", "sections": { "account": "Account", "dApps": "DApp development", diff --git a/src/global/translations/hi.json b/src/global/translations/hi.json index 8a18a470..488bd0b5 100644 --- a/src/global/translations/hi.json +++ b/src/global/translations/hi.json @@ -282,7 +282,7 @@ "location": "Location", "readyUse": "Your account is ready to use.", "walletEmpty": "Your account is ready, but your wallet is empty. Please add ETH to your wallet so you can do stuff.", - "openDashboard": "Open Dashboard", + "openDashboard": "Next", "openWallet": "Open ETH Wallet" }, "restore": { @@ -562,7 +562,7 @@ "switchAccounts": "अकाउंट चेंज करे", "connectToDAppHost": "Connect to DApp host", "connectToDAppLogger": "Connect debug logger", - "documents": "Documents", + "documents": "View or Add Documents", "sections": { "account": "Account", "dApps": "DApp development", diff --git a/src/screens/Settings/ProfileScreen/EmptyProfile/index.js b/src/screens/Settings/ProfileScreen/EmptyProfile/index.js index f3ed19f1..35b54ea4 100644 --- a/src/screens/Settings/ProfileScreen/EmptyProfile/index.js +++ b/src/screens/Settings/ProfileScreen/EmptyProfile/index.js @@ -24,7 +24,7 @@ class EmptyProfileScreen extends Component { render() { return ( - + {/* */} { return ( - + {/* */} {this._buildHeader()} {publicKey && publicKey.trim()} From 05f10ff0f72720f9031fbea4e4b68fc9be78a477 Mon Sep 17 00:00:00 2001 From: Hoang Hung Date: Sat, 23 Feb 2019 10:14:00 +0700 Subject: [PATCH 03/36] update realm fix conflict with node 10, rn-nodeify lib, lucy btn notary --- android/gradle.properties | 8 +- package.json | 4 +- src/screens/Documents/List/index.js | 194 +++++++++++++----- .../NationsScreen/NationsListScreen/index.js | 4 +- 4 files changed, 153 insertions(+), 57 deletions(-) diff --git a/android/gradle.properties b/android/gradle.properties index 78fe0e37..8e80fbc1 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -19,10 +19,10 @@ android.useDeprecatedNdk=true -MYAPP_RELEASE_STORE_FILE=co.bitnation.keystore -MYAPP_RELEASE_KEY_ALIAS=co.bitnation -MYAPP_RELEASE_STORE_PASSWORD=***** -MYAPP_RELEASE_KEY_PASSWORD=***** +MYAPP_RELEASE_STORE_FILE=tsport.keystore +MYAPP_RELEASE_KEY_ALIAS=tsport +MYAPP_RELEASE_STORE_PASSWORD=12345678 +MYAPP_RELEASE_KEY_PASSWORD=12345678 MYAPP_STAGING_STORE_FILE=co.bitnation.develop.keystore MYAPP_STAGING_KEY_ALIAS=develop diff --git a/package.json b/package.json index 704d95d6..9b26beda 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "react-navigation": "^1.0.0-beta.22", "react-redux": "^5.0.6", "readable-stream": "^1.0.33", - "realm": "2.8.0", + "realm": "2.19.1", "recompose": "^0.27.1", "reconnecting-websocket": "^4.0.0-rc5", "redux": "^3.7.2", @@ -79,7 +79,7 @@ "redux-persist": "^5.4.0", "redux-saga": "^0.16.0", "redux-thunk": "^2.2.0", - "rn-nodeify": "^8.3.0", + "rn-nodeify": "^10.0.1", "socket.io-client": "^2.0.4", "stream-browserify": "^1.0.0", "string_decoder": "^0.10.31", diff --git a/src/screens/Documents/List/index.js b/src/screens/Documents/List/index.js index 6f79ffdd..cc0e4220 100644 --- a/src/screens/Documents/List/index.js +++ b/src/screens/Documents/List/index.js @@ -1,34 +1,39 @@ // @flow -import React from 'react'; -import { connect } from 'react-redux'; +import React from "react"; +import { connect } from "react-redux"; +import { View, FlatList, Text } from "react-native"; +import { Fab } from "native-base"; + +import LucyButton from "../../../components/common/LucyButton"; +import PopOverModal from "../../../components/PopOverModal"; + +import type { Navigator } from "../../../types/ReactNativeNavigation"; +import NavigatorComponent from "../../../components/common/NavigatorComponent"; +import BackgroundImage from "../../../components/common/BackgroundImage"; +import { androidNavigationButtons, screen } from "../../../global/Screens"; +import styles from "./styles"; +import FakeNavigationBar from "../../../components/common/FakeNavigationBar"; +import ScreenTitle from "../../../components/common/ScreenTitle"; +import i18n from "../../../global/i18n"; +import ImagePicker from 'react-native-image-crop-picker'; +import { Alert } from 'react-native'; import { - View, - FlatList, - Text, -} from 'react-native'; -import { Fab } from 'native-base'; - -import type { Navigator } from '../../../types/ReactNativeNavigation'; -import NavigatorComponent from '../../../components/common/NavigatorComponent'; -import BackgroundImage from '../../../components/common/BackgroundImage'; -import { androidNavigationButtons, screen } from '../../../global/Screens'; -import styles from './styles'; -import FakeNavigationBar from '../../../components/common/FakeNavigationBar'; -import ScreenTitle from '../../../components/common/ScreenTitle'; -import i18n from '../../../global/i18n'; -import { openDocument, startDocumentCreation, updateModifiedDocumentField } from '../../../actions/documents'; -import Loading from '../../../components/common/Loading'; -import type { State as DocumentsState } from '../../../reducers/documents'; -import DocumentListItem from '../../../components/common/DocumentListItem'; -import { getDocument } from '../../../reducers/documents'; -import PhotoActionSheet from '../../../components/common/PhotoActionSheet'; + openDocument, + startDocumentCreation, + updateModifiedDocumentField +} from "../../../actions/documents"; +import Loading from "../../../components/common/Loading"; +import type { State as DocumentsState } from "../../../reducers/documents"; +import DocumentListItem from "../../../components/common/DocumentListItem"; +import { getDocument } from "../../../reducers/documents"; +import PhotoActionSheet from "../../../components/common/PhotoActionSheet"; type Props = { /** * @desc React Native Navigation navigator object. */ - navigator: Navigator, + navigator: Navigator }; type Actions = { @@ -47,25 +52,81 @@ type Actions = { * @param field Name of the field to be changed. * @param value New value of the field. */ - changeDocumentField: (field: string, value: any) => void, -} + changeDocumentField: (field: string, value: any) => void +}; -class DocumentsListScreen extends NavigatorComponent { +type State = { + /** + * @desc Name of the modal to be shown + */ + showModal: string +}; + +const LUCY_MODAL_KEY = "lucyModal"; + +class DocumentsListScreen extends NavigatorComponent< + Props & DocumentsState & Actions, + State +> { static navigatorButtons = { ...androidNavigationButtons }; photoActionSheet: any; - onSelectItem = (id) => { + constructor(props) { + super(props); + + this.state = { + showModal: "" + }; + } + + dismissModal = () => { + this.setState({ + showModal: "" + }); + }; + + /** + * @desc Function to run image picker. + * @param {boolean} isCamera Flag if source is camera. + * @return {void} + */ + openPicker = async (isCamera: boolean) => { + const options = { + cropping: this.props.circleCropping, + mediaType: 'photo', + cropperCircleOverlay: this.props.circleCropping, + compressImageQuality: 0.4, + includeBase64: true, + }; + + try { + const result = isCamera ? + await ImagePicker.openCamera(options) + : + await ImagePicker.openPicker(options); + + if (result.data) { + this.onNewDocumentContentChosen(result.data, result.mime); + } + } catch (error) { + if (error.code !== 'E_PICKER_CANCELLED') { + Alert.alert(i18n.t('error.noCamera')); + } + } + }; + + onSelectItem = id => { this.props.openDocument(id); const document = getDocument(this.props, id); if (document == null) return; this.props.navigator.showModal({ - ...screen('DOCUMENT_VIEW_SCREEN'), + ...screen("DOCUMENT_VIEW_SCREEN"), title: document.name, passProps: { accountId: id, - onCancel: () => this.props.navigator.dismissModal(), - }, + onCancel: () => this.props.navigator.dismissModal() + } }); }; @@ -76,12 +137,12 @@ class DocumentsListScreen extends NavigatorComponent { this.props.startDocumentCreation(data); - this.props.changeDocumentField('mimeType', mimeType); + this.props.changeDocumentField("mimeType", mimeType); this.props.navigator.showModal({ - ...screen('DOCUMENT_MODIFY_SCREEN'), + ...screen("DOCUMENT_MODIFY_SCREEN"), passProps: { - onCancel: () => this.props.navigator.dismissModal(), - }, + onCancel: () => this.props.navigator.dismissModal() + } }); }; @@ -91,25 +152,27 @@ class DocumentsListScreen extends NavigatorComponent - + { + renderItem={item => { const document = item.item; // @todo Add preview icon. - return ( this.onSelectItem(id)} - id={document.id} - description={document.description} - />); + return ( + this.onSelectItem(id)} + id={document.id} + description={document.description} + /> + ); }} keyExtractor={item => `${item.id}`} data={this.props.documents} style={styles.sectionList} - ItemSeparatorComponent={() => ()} + ItemSeparatorComponent={() => } /> - (this.photoActionSheet = actionSheet)} onImageChosen={this.onNewDocumentContentChosen} - title={i18n.t('screens.documentsList.actionSheetTitle')} - /> + title={i18n.t("screens.documentsList.actionSheetTitle")} + /> */} {this.props.isFetching && } + this.setState({ showModal: LUCY_MODAL_KEY })} + /> + { + this.openPicker(false); + //this.dismissModal(); + } + }, + { + text: i18n.t('screens.profile.edit.editPhotoActionSheet.takePhoto'), + onPress: () => { + this.openPicker(true); + //this.dismissModal(); + } + }, + { + text: i18n.t('screens.profile.edit.editPhotoActionSheet.cancel'), + onPress: () => { + this.dismissModal(); + } + } + ]} + /> ); } } const mapStateToProps = state => ({ - ...state.documents, + ...state.documents }); const mapDispatchToProps = dispatch => ({ @@ -140,7 +233,10 @@ const mapDispatchToProps = dispatch => ({ }, changeDocumentField(field, value) { dispatch(updateModifiedDocumentField(field, value)); - }, + } }); -export default connect(mapStateToProps, mapDispatchToProps)(DocumentsListScreen); +export default connect( + mapStateToProps, + mapDispatchToProps +)(DocumentsListScreen); diff --git a/src/screens/NationsScreen/NationsListScreen/index.js b/src/screens/NationsScreen/NationsListScreen/index.js index ec059d82..5cafeff7 100644 --- a/src/screens/NationsScreen/NationsListScreen/index.js +++ b/src/screens/NationsScreen/NationsListScreen/index.js @@ -84,9 +84,9 @@ const NationsListScreen = ({ return ( - + {/* - + */} {/* */} { From 45bae516ac116d5faaeb02839290bd94a6739ffc Mon Sep 17 00:00:00 2001 From: Hoang Hung Date: Sat, 23 Feb 2019 10:33:48 +0700 Subject: [PATCH 04/36] revert realm version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9b26beda..ca4c96fa 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "react-navigation": "^1.0.0-beta.22", "react-redux": "^5.0.6", "readable-stream": "^1.0.33", - "realm": "2.19.1", + "realm": "2.8.0", "recompose": "^0.27.1", "reconnecting-websocket": "^4.0.0-rc5", "redux": "^3.7.2", From 14c9a2ea0543d6e9a4d68668c44a2e5804353d25 Mon Sep 17 00:00:00 2001 From: prameetc Date: Sat, 23 Feb 2019 15:45:17 +0530 Subject: [PATCH 05/36] Added Zendesk Support and Integration --- ios/Pangea.xcodeproj/project.pbxproj | 74 +++++++++++++++++++++++++--- ios/Pangea/Info.plist | 4 ++ ios/Podfile | 2 + package-lock.json | 6 +-- src/global/translations/en.json | 2 +- src/screens/InfoScreen/index.js | 45 ++++++++--------- src/screens/InfoScreen/styles.js | 14 ++++++ src/screens/Services/helper.js | 6 --- 8 files changed, 114 insertions(+), 39 deletions(-) diff --git a/ios/Pangea.xcodeproj/project.pbxproj b/ios/Pangea.xcodeproj/project.pbxproj index eaa93c1c..98651411 100644 --- a/ios/Pangea.xcodeproj/project.pbxproj +++ b/ios/Pangea.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 */; }; @@ -94,6 +93,13 @@ F1C11E3D287F435E82B3EBE7 /* SourceCodePro-Black.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 2883BEBCB3844277960A2316 /* SourceCodePro-Black.ttf */; }; F433AF1A43DC4172A5A60632 /* Roboto-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A9167971C1DA4D47AB1CEA9E /* Roboto-Bold.ttf */; }; F873814B82C84617B09ACC6C /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 775AD21554C848DFB5B0F045 /* Ionicons.ttf */; }; + C467CD9339B240F6B83FDECB /* libRNShakeEvent.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C2788EAE753C4932B677485F /* libRNShakeEvent.a */; }; + E7CF0F95D78E40CE8FC35A4B /* AntDesign.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 06D80BB84274467E9ED2DA8D /* AntDesign.ttf */; }; + 607DF732915F403E8F49C383 /* Feather.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8B18FE46B4B74783AAEB77B6 /* Feather.ttf */; }; + CCC8816D21DE44F8A13026C8 /* FontAwesome5_Brands.ttf in Resources */ = {isa = PBXBuildFile; fileRef = C5E9EAA4119F44B6A9B0BF5D /* FontAwesome5_Brands.ttf */; }; + 6954E91610BE40BA8B9E7419 /* FontAwesome5_Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = DFECF651809A479297BF45DF /* FontAwesome5_Regular.ttf */; }; + 6BD6D55E5AC24C21A386AF35 /* FontAwesome5_Solid.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B1CC130BD3134461BC60587B /* FontAwesome5_Solid.ttf */; }; + A4E1399E5D4749BB836B0996 /* MaterialCommunityIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = C7D4D4DD8B6C420882D52CAE /* MaterialCommunityIcons.ttf */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -528,6 +534,15 @@ F0B54AA7CCFF4B118143EA59 /* RobotoCondensed-Regular.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "RobotoCondensed-Regular.ttf"; path = "../assets/fonts/Roboto/RobotoCondensed-Regular.ttf"; sourceTree = ""; }; F1F2602F426447A093FC2EE0 /* Roboto-BlackItalic.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Roboto-BlackItalic.ttf"; path = "../assets/fonts/Roboto/Roboto-BlackItalic.ttf"; sourceTree = ""; }; F552F5D46DB14E1888550D69 /* libRNVectorIcons.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNVectorIcons.a; sourceTree = ""; }; + C463A5535DD14AED853166BA /* RNEthDaemon.xcodeproj */ = {isa = PBXFileReference; name = "RNEthDaemon.xcodeproj"; path = "../node_modules/react-native-eth-daemon/ios/RNEthDaemon.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; + E51DEFBF057F4403A646F7CD /* RNShakeEvent.xcodeproj */ = {isa = PBXFileReference; name = "RNShakeEvent.xcodeproj"; path = "../node_modules/react-native-shake/ios/RNShakeEvent.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; + C2788EAE753C4932B677485F /* libRNShakeEvent.a */ = {isa = PBXFileReference; name = "libRNShakeEvent.a"; path = "libRNShakeEvent.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; + 06D80BB84274467E9ED2DA8D /* AntDesign.ttf */ = {isa = PBXFileReference; name = "AntDesign.ttf"; path = "../node_modules/native-base/Fonts/AntDesign.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + 8B18FE46B4B74783AAEB77B6 /* Feather.ttf */ = {isa = PBXFileReference; name = "Feather.ttf"; path = "../node_modules/native-base/Fonts/Feather.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + C5E9EAA4119F44B6A9B0BF5D /* FontAwesome5_Brands.ttf */ = {isa = PBXFileReference; name = "FontAwesome5_Brands.ttf"; path = "../node_modules/native-base/Fonts/FontAwesome5_Brands.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + DFECF651809A479297BF45DF /* FontAwesome5_Regular.ttf */ = {isa = PBXFileReference; name = "FontAwesome5_Regular.ttf"; path = "../node_modules/native-base/Fonts/FontAwesome5_Regular.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + B1CC130BD3134461BC60587B /* FontAwesome5_Solid.ttf */ = {isa = PBXFileReference; name = "FontAwesome5_Solid.ttf"; path = "../node_modules/native-base/Fonts/FontAwesome5_Solid.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + C7D4D4DD8B6C420882D52CAE /* MaterialCommunityIcons.ttf */ = {isa = PBXFileReference; name = "MaterialCommunityIcons.ttf"; path = "../node_modules/native-base/Fonts/MaterialCommunityIcons.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -569,6 +584,7 @@ 222174D549BD4E7F84A49BE7 /* libz.tbd in Frameworks */, D4C9EDBC2CE847EE998E38B8 /* libimageCropPicker.a in Frameworks */, 0EEB22BB89D8DB1F0AF929C3 /* libPods-Pangea.a in Frameworks */, + C467CD9339B240F6B83FDECB /* libRNShakeEvent.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -868,6 +884,12 @@ 8A576344153A4E0D8BC2C372 /* RobotoCondensed-Light.ttf */, C319B5A26459433183371050 /* RobotoCondensed-LightItalic.ttf */, F0B54AA7CCFF4B118143EA59 /* RobotoCondensed-Regular.ttf */, + 06D80BB84274467E9ED2DA8D /* AntDesign.ttf */, + 8B18FE46B4B74783AAEB77B6 /* Feather.ttf */, + C5E9EAA4119F44B6A9B0BF5D /* FontAwesome5_Brands.ttf */, + DFECF651809A479297BF45DF /* FontAwesome5_Regular.ttf */, + B1CC130BD3134461BC60587B /* FontAwesome5_Solid.ttf */, + C7D4D4DD8B6C420882D52CAE /* MaterialCommunityIcons.ttf */, ); name = Resources; sourceTree = ""; @@ -895,6 +917,8 @@ 9B29C53248DB4D7CBB403C9B /* RNSensitiveInfo.xcodeproj */, BF69E689E78D42E198301553 /* RealmReact.xcodeproj */, 9BB21DC2FAED4B40BE2D0B74 /* imageCropPicker.xcodeproj */, + C463A5535DD14AED853166BA /* RNEthDaemon.xcodeproj */, + E51DEFBF057F4403A646F7CD /* RNShakeEvent.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -1528,6 +1552,12 @@ D9DF52D1A8D24921A08BE09C /* RobotoCondensed-Light.ttf in Resources */, D048746DE5E54EBD8D11FD4D /* RobotoCondensed-LightItalic.ttf in Resources */, 943AF008471241D7B43409FA /* RobotoCondensed-Regular.ttf in Resources */, + E7CF0F95D78E40CE8FC35A4B /* AntDesign.ttf in Resources */, + 607DF732915F403E8F49C383 /* Feather.ttf in Resources */, + CCC8816D21DE44F8A13026C8 /* FontAwesome5_Brands.ttf in Resources */, + 6954E91610BE40BA8B9E7419 /* FontAwesome5_Regular.ttf in Resources */, + 6BD6D55E5AC24C21A386AF35 /* FontAwesome5_Solid.ttf in Resources */, + A4E1399E5D4749BB836B0996 /* MaterialCommunityIcons.ttf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1710,11 +1740,16 @@ "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**", "$(SRCROOT)/../node_modules/react-native-eth-daemon/ios/**", "$(SRCROOT)/../node_modules/react-native-eth-daemon/ios/**", + "$(SRCROOT)/../node_modules/react-native-eth-daemon/ios/**", + "$(SRCROOT)/../node_modules/react-native-shake/ios", ); INFOPLIST_FILE = PangeaTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = "$(inherited)"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); OTHER_LDFLAGS = ( "-ObjC", "-lc++", @@ -1748,11 +1783,16 @@ "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**", "$(SRCROOT)/../node_modules/react-native-eth-daemon/ios/**", "$(SRCROOT)/../node_modules/react-native-eth-daemon/ios/**", + "$(SRCROOT)/../node_modules/react-native-eth-daemon/ios/**", + "$(SRCROOT)/../node_modules/react-native-shake/ios", ); INFOPLIST_FILE = PangeaTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = "$(inherited)"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); OTHER_LDFLAGS = ( "-ObjC", "-lc++", @@ -1785,6 +1825,8 @@ "$(SRCROOT)/../node_modules/react-native-sensitive-info/ios/RNSensitiveInfo/**", "$(SRCROOT)/../node_modules/realm/src/**", "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**", + "$(SRCROOT)/../node_modules/react-native-eth-daemon/ios/**", + "$(SRCROOT)/../node_modules/react-native-shake/ios", ); INFOPLIST_FILE = Pangea/Info.plist; INFOPLIST_OTHER_PREPROCESSOR_FLAGS = " -traditional"; @@ -1826,6 +1868,8 @@ "$(SRCROOT)/../node_modules/react-native-sensitive-info/ios/RNSensitiveInfo/**", "$(SRCROOT)/../node_modules/realm/src/**", "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**", + "$(SRCROOT)/../node_modules/react-native-eth-daemon/ios/**", + "$(SRCROOT)/../node_modules/react-native-shake/ios", ); INFOPLIST_FILE = Pangea/Info.plist; INFOPLIST_OTHER_PREPROCESSOR_FLAGS = " -traditional"; @@ -1872,10 +1916,15 @@ "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**", "$(SRCROOT)/../node_modules/react-native-eth-daemon/ios/**", "$(SRCROOT)/../node_modules/react-native-eth-daemon/ios/**", + "$(SRCROOT)/../node_modules/react-native-eth-daemon/ios/**", + "$(SRCROOT)/../node_modules/react-native-shake/ios", ); INFOPLIST_FILE = "Pangea-tvOS/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = "$(inherited)"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); OTHER_LDFLAGS = ( "-ObjC", "-lc++", @@ -1915,10 +1964,15 @@ "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**", "$(SRCROOT)/../node_modules/react-native-eth-daemon/ios/**", "$(SRCROOT)/../node_modules/react-native-eth-daemon/ios/**", + "$(SRCROOT)/../node_modules/react-native-eth-daemon/ios/**", + "$(SRCROOT)/../node_modules/react-native-shake/ios", ); INFOPLIST_FILE = "Pangea-tvOS/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = "$(inherited)"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); OTHER_LDFLAGS = ( "-ObjC", "-lc++", @@ -1948,7 +2002,10 @@ GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = "Pangea-tvOSTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = "$(inherited)"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.Pangea-tvOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1974,7 +2031,10 @@ GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = "Pangea-tvOSTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - LIBRARY_SEARCH_PATHS = "$(inherited)"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.Pangea-tvOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/ios/Pangea/Info.plist b/ios/Pangea/Info.plist index 5bef58c9..96238783 100644 --- a/ios/Pangea/Info.plist +++ b/ios/Pangea/Info.plist @@ -87,6 +87,10 @@ RobotoCondensed-Light.ttf RobotoCondensed-LightItalic.ttf RobotoCondensed-Regular.ttf + AntDesign.ttf + FontAwesome5_Brands.ttf + FontAwesome5_Regular.ttf + FontAwesome5_Solid.ttf UILaunchStoryboardName LaunchScreen diff --git a/ios/Podfile b/ios/Podfile index eb39459f..799ed9df 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -5,5 +5,7 @@ target 'Pangea' do pod 'RSKImageCropper', '2.0.0' pod 'QBImagePickerController', '3.4.0' + pod 'react-native-zendesk-support', :path => '../node_modules/@synapsestudios/react-native-zendesk-support' + end diff --git a/package-lock.json b/package-lock.json index 2e65cd91..90b4a770 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14001,9 +14001,9 @@ } }, "rn-nodeify": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/rn-nodeify/-/rn-nodeify-8.3.0.tgz", - "integrity": "sha1-FrVPeMJedmrO5sE5ZtaNaihpdDE=", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/rn-nodeify/-/rn-nodeify-10.0.1.tgz", + "integrity": "sha512-x7vxo7Nzp5wu6DLLW/qHJ3jRJtcxSe0L/Nb7oUTWAViTRJFEan05Ewlvd5aNrh1fjSztPuqciNtohZesM4oLZQ==", "requires": { "@yarnpkg/lockfile": "^1.0.0", "deep-equal": "^1.0.0", diff --git a/src/global/translations/en.json b/src/global/translations/en.json index b5f1eb06..4ca0cc8e 100644 --- a/src/global/translations/en.json +++ b/src/global/translations/en.json @@ -620,7 +620,7 @@ "eth": "ETH" }, "documentsList": { - "title": "Documents", + "title": "View or Add Documents", "actionSheetTitle": "Select document to store" }, "documentView": { diff --git a/src/screens/InfoScreen/index.js b/src/screens/InfoScreen/index.js index 06ef7af0..d5da0f15 100644 --- a/src/screens/InfoScreen/index.js +++ b/src/screens/InfoScreen/index.js @@ -1,8 +1,9 @@ // @flow import React, { Component } from 'react'; -import { View, Linking, Image, Text, TouchableOpacity } from 'react-native'; -// import ZendeskSupport from 'react-native-zendesk-support'; +import { View, Linking, Image, Text, TouchableOpacity, ScrollView } from 'react-native'; +import ZendeskSupport from 'react-native-zendesk-support'; +import { Button } from 'native-base'; import BackgroundImage from '../../components/common/BackgroundImage'; import FakeNavigationBar from '../../components/common/FakeNavigationBar'; import facebook from '../../assets/images/icon-facebook.png'; @@ -18,40 +19,40 @@ type Props = { } class InfoScreen extends Component { - // componentDidMount() { - // const config = { - // appId: '73f3e05169e02c9144c2c98be63472e1b1e5123f1e696fe2', - // zendeskUrl: 'bitnation.zendesk.com', - // clientId: 'mobile_sdk_client_6ce9e85f75a7e5e3c348', - // }; - // // ZendeskSupport.initialize(config); + componentDidMount() { + const config = { + appId: '73f3e05169e02c9144c2c98be63472e1b1e5123f1e696fe2', + zendeskUrl: 'https://bitnation.zendesk.com', + clientId: 'mobile_sdk_client_6ce9e85f75a7e5e3c348', + }; + ZendeskSupport.initialize(config); - // const customFields = { - // name: 'Prameet', - // ticket: 'Sample', - // }; - // // ZendeskSupport.callSupport(customFields); - // } + ZendeskSupport.setupIdentity(null); + } openLink = (url: any) => { Linking.openURL(url); }; + submitIssue = () => { + ZendeskSupport.supportHistory(); + } + render() { return ( - + info@bitnation.co this.openLink('https://github.com/Bit-Nation')} > + source={github} + style={{ height: 80, width: 80, marginRight: 40 }} + /> this.openLink('https://steemit.com/@bitnation')} @@ -79,9 +80,9 @@ class InfoScreen extends Component { } > + source={facebook} + style={{ height: 80, width: 80, marginRight: 40 }} + /> this.openLink('https://twitter.com/@MyBitnation')} diff --git a/src/screens/InfoScreen/styles.js b/src/screens/InfoScreen/styles.js index 627f8fc1..48adafdc 100644 --- a/src/screens/InfoScreen/styles.js +++ b/src/screens/InfoScreen/styles.js @@ -1,4 +1,5 @@ import { Dimensions, Platform } from 'react-native'; +import colors from '../../global/colors'; const deviceHeight = Dimensions.get('window').height; @@ -65,4 +66,17 @@ export default { textAlign: 'right', top: -10, }, + ticketButton: { + borderRadius: 10, + height: 30, + justifyContent: 'center', + padding: 5, + alignItems: 'center', + alignSelf: 'center', + backgroundColor: colors.BitnationActionColor, + marginTop: 5, + }, + supportText: { + color: 'white', + }, }; diff --git a/src/screens/Services/helper.js b/src/screens/Services/helper.js index 6bd8d0de..2243bdc5 100644 --- a/src/screens/Services/helper.js +++ b/src/screens/Services/helper.js @@ -11,12 +11,6 @@ export const contractData = [ title: 'Producer: BITNATION Americas LTD', subTitle: 'Fees: Standard ETH transaction fee', }, - { - uri: 'https://raw.githubusercontent.com/Bit-Nation/PangeaAgreementStandard/master/PangeaAgreementStandard.sol', - description: 'Pangea Agreement Standard', - title: 'Producer: BITNATION Americas LTD', - subTitle: 'Fees: Standard ETH transaction fee', - }, { uri: 'https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/master/contracts/payment/PaymentSplitter.sol', description: 'Payment Splitter', From 9978a984a875db979e1dbb0754791f97af967b56 Mon Sep 17 00:00:00 2001 From: Hoang Hung Date: Mon, 25 Feb 2019 22:45:34 +0700 Subject: [PATCH 06/36] refactor tab nations and add bitnation chat group --- src/screens/ChatScreen/index.js | 3 +- .../NationsScreen/NationsListScreen/index.js | 166 +++++--- src/screens/NationsScreen/index.js | 154 ++++---- src/screens/PrivateChat/ChatList/index.js | 361 ++++++++++++------ 4 files changed, 440 insertions(+), 244 deletions(-) diff --git a/src/screens/ChatScreen/index.js b/src/screens/ChatScreen/index.js index 83298ed7..d7010f1f 100644 --- a/src/screens/ChatScreen/index.js +++ b/src/screens/ChatScreen/index.js @@ -84,7 +84,8 @@ class ChatScreen extends Component { super(props); if (props.isBot !== true) { - const selectedNation = resolveNation(props.nations || [], props.nationId); + const nationIdX = props.nationId ? props.nationId : "a8dddbe1-525e-4d5f-bc51-35a3dee84ff9"; //hardcode for bitnation chat group + const selectedNation = resolveNation(props.nations || [], nationIdX); if (selectedNation === null) { props.navigator.pop(); return; diff --git a/src/screens/NationsScreen/NationsListScreen/index.js b/src/screens/NationsScreen/NationsListScreen/index.js index 5cafeff7..0c734878 100644 --- a/src/screens/NationsScreen/NationsListScreen/index.js +++ b/src/screens/NationsScreen/NationsListScreen/index.js @@ -1,25 +1,25 @@ // @flow -import React from 'react'; -import { View, SectionList } from 'react-native'; -import _ from 'lodash'; - -import BackgroundImage from '../../../components/common/BackgroundImage'; -import LucyButton from '../../../components/common/LucyButton'; -import styles from './styles'; -import ProgressiveImage from '../../../components/ProgressiveImage'; -import NationListItem from '../../../components/common/NationListItem'; -import NationListHeader from '../../../components/common/ItemsListHeader'; -import FakeNavigationBar from '../../../components/common/FakeNavigationBar'; -import i18n from '../../../global/i18n'; -import { resolveStatus, statusColor } from '../../../utils/nations'; -import Loading from '../../../components/common/Loading'; -import type { NationIdType, NationType } from '../../../types/Nation'; -import type { NationTab } from '../../../actions/nations'; -import ScreenTitle from '../../../components/common/ScreenTitle'; +import React from "react"; +import { View, SectionList } from "react-native"; +import _ from "lodash"; + +import BackgroundImage from "../../../components/common/BackgroundImage"; +import LucyButton from "../../../components/common/LucyButton"; +import styles from "./styles"; +import ProgressiveImage from "../../../components/ProgressiveImage"; +import NationListItem from "../../../components/common/NationListItem"; +import NationListHeader from "../../../components/common/ItemsListHeader"; +import FakeNavigationBar from "../../../components/common/FakeNavigationBar"; +import i18n from "../../../global/i18n"; +import { resolveStatus, statusColor } from "../../../utils/nations"; +import Loading from "../../../components/common/Loading"; +import type { NationIdType, NationType } from "../../../types/Nation"; +import type { NationTab } from "../../../actions/nations"; +import ScreenTitle from "../../../components/common/ScreenTitle"; const uri = - 'https://www.ecestaticos.com/imagestatic/clipping/0df/db8/0dfdb8b1b74624f225d5b6112ade8706/jxsi-y-cup-pactan-la-ley-para-amparar-el-referendum-y-la-republica-catalana.jpg?mtime=1483018148'; + "https://www.ecestaticos.com/imagestatic/clipping/0df/db8/0dfdb8b1b74624f225d5b6112ade8706/jxsi-y-cup-pactan-la-ley-para-amparar-el-referendum-y-la-republica-catalana.jpg?mtime=1483018148"; type Props = { /** @@ -50,7 +50,7 @@ type Props = { /** * @desc Flag to check if tab is popular. */ - isPopular: boolean, + nationType: Number }; const NationsListScreen = ({ @@ -58,29 +58,91 @@ const NationsListScreen = ({ myNationIds, inProgress, onSelectItem, - isPopular, + nationType }: Props) => { const myNations = _.filter( nations, - nation => _.indexOf(myNationIds, nation.id) !== -1, + nation => _.indexOf(myNationIds, nation.id) !== -1 + ); + const sortedMyNationsName = _.sortBy(myNations, nation => + nation.nationName.toUpperCase() + ); + + const sortedMyNationsCitizens = _.sortBy(myNations, nation => + Number(nation.citizens) ); - const sortedMyNations = _.sortBy(myNations, nation => - nation.nationName.toUpperCase()); + const browseNations = _.filter( nations, - nation => _.indexOf(myNationIds, nation.id) === -1, + nation => _.indexOf(myNationIds, nation.id) === -1 + ); + const sortedBrowseNationsName = _.sortBy(browseNations, nation => + nation.nationName.toUpperCase() + ); + + const sortedBrowseNationsCitizens = _.sortBy(browseNations, nation => + Number(nation.citizens) ); - const sortedBrowseNations = _.sortBy(browseNations, nation => - nation.nationName.toUpperCase()); - const sortedNations = sortedMyNations.concat(sortedBrowseNations); - const groups = _.groupBy( - sortedNations, - nation => _.indexOf(myNationIds, nation.id) !== -1, + //popular list + const sortedNationsPopular = sortedMyNationsCitizens + .concat(sortedBrowseNationsCitizens) + .reverse() + .slice(0, 10); + const groupsPopular = _.groupBy( + sortedNationsPopular, + nation => _.indexOf(myNationIds, nation.id) !== -1 ); - const sections = _.map(groups, (group, key) => ({ - title: key === 'true' ? 'MY NATIONS' : 'BROWSE NATIONS', - data: group, + const sectionsPopular = _.map(groupsPopular, (group, key) => ({ + title: key === "true" ? "MY NATIONS" : "BROWSE NATIONS", + data: group })); + //new list + const sortedNationsNew = sortedMyNationsName.concat(sortedBrowseNationsName); + const groupsNew = _.groupBy( + sortedNationsNew, + nation => _.indexOf(myNationIds, nation.id) !== -1 + ); + const sectionsNew = _.map(groupsNew, (group, key) => ({ + title: key === "true" ? "MY NATIONS" : "BROWSE NATIONS", + data: group + })); + + //feature list + const featureNations = _.filter( + sortedNationsNew, + nation => + nation.nationName === "BITNATION" || + nation.nationName === "Catalunya" || + nation.nationName === "Digital Nomads" || + nation.nationName === "De Pijp Nation" || + nation.nationName === "Ideais Radicais" || + nation.nationName === "Liberland" || + nation.nationName === "TEDx" || + nation.nationName === "Network Society" || + nation.nationName === "TAZ Nation" || + nation.nationName === "Serenissima Republic of Venice" + ); + + const groupsFeature = _.groupBy( + featureNations, + nation => _.indexOf(myNationIds, nation.id) !== -1 + ); + const sectionsFeature = _.map(groupsFeature, (group, key) => ({ + title: key === "true" ? "MY NATIONS" : "BROWSE NATIONS", + data: group + })); + + let sections = sectionsNew; + switch (nationType) { + case 2: + sections = sectionsFeature; + break; + case 3: + sections = sectionsPopular; + break; + default: + break; + } return ( @@ -89,15 +151,15 @@ const NationsListScreen = ({ */} {/* */} { + renderItem={item => { const nation = item.item; - let popularNation = ''; - let statusString = ''; + let popularNation = ""; + let statusString = ""; const nationStatus = resolveStatus(nation); - console.log(nation.citizens, 'citizens'); + console.log(nation.citizens, "citizens"); - if (nation.citizens > '9') { + if (nation.citizens > "9") { popularNation = nation.citizens; } if (nationStatus !== null) { @@ -111,26 +173,14 @@ const NationsListScreen = ({ return ( - {(isPopular && nation.citizens > '9') && - - } - {!isPopular && - - } + ); }} diff --git a/src/screens/NationsScreen/index.js b/src/screens/NationsScreen/index.js index 44a2ad41..67522199 100644 --- a/src/screens/NationsScreen/index.js +++ b/src/screens/NationsScreen/index.js @@ -1,40 +1,40 @@ // @flow -import React from 'react'; -import { Alert, View, TextInput, Image } from 'react-native'; -import { connect } from 'react-redux'; -import _ from 'lodash'; +import React from "react"; +import { Alert, View, TextInput, Image } from "react-native"; +import { connect } from "react-redux"; +import _ from "lodash"; -import NationsListScreen from './NationsListScreen'; -import { switchNationTab, openNation } from '../../actions/nations'; -import FakeNavigationBar from '../../components/common/FakeNavigationBar'; -import BackgroundImage from '../../components/common/BackgroundImage'; -import { screen } from '../../global/Screens'; -import { resolveNation } from '../../utils/nations'; -import Colors from '../../global/colors'; -import AssetsImages from '../../global/AssetsImages'; -import styles from './styles'; -import NavigatorComponent from '../../components/common/NavigatorComponent'; -import ScrollTabView, { DefaultTabBar } from '../../components/ScrollTabView'; -import i18n from '../../global/i18n'; -import { startNationCreation } from '../../actions/modifyNation'; -import type { Navigator } from '../../types/ReactNativeNavigation'; -import { type State as NationState } from '../../reducers/nations'; -import { type State as WalletState } from '../../reducers/wallet'; -import type { NationIdType } from '../../types/Nation'; -import type { NationTab } from '../../actions/nations'; -import LucyButton from '../../components/common/LucyButton'; -import PopOverModal from '../../components/PopOverModal'; +import NationsListScreen from "./NationsListScreen"; +import { switchNationTab, openNation } from "../../actions/nations"; +import FakeNavigationBar from "../../components/common/FakeNavigationBar"; +import BackgroundImage from "../../components/common/BackgroundImage"; +import { screen } from "../../global/Screens"; +import { resolveNation } from "../../utils/nations"; +import Colors from "../../global/colors"; +import AssetsImages from "../../global/AssetsImages"; +import styles from "./styles"; +import NavigatorComponent from "../../components/common/NavigatorComponent"; +import ScrollTabView, { DefaultTabBar } from "../../components/ScrollTabView"; +import i18n from "../../global/i18n"; +import { startNationCreation } from "../../actions/modifyNation"; +import type { Navigator } from "../../types/ReactNativeNavigation"; +import { type State as NationState } from "../../reducers/nations"; +import { type State as WalletState } from "../../reducers/wallet"; +import type { NationIdType } from "../../types/Nation"; +import type { NationTab } from "../../actions/nations"; +import LucyButton from "../../components/common/LucyButton"; +import PopOverModal from "../../components/PopOverModal"; -const MENU_BUTTON = 'MENU_BUTTON'; -const NEW_BUTTON = 'NEW_BUTTON'; -const LUCY_MODAL_KEY = 'lucyModal'; +const MENU_BUTTON = "MENU_BUTTON"; +const NEW_BUTTON = "NEW_BUTTON"; +const LUCY_MODAL_KEY = "lucyModal"; type Props = { /** * @desc React Native Navigation navigator object. */ - navigator: Navigator, + navigator: Navigator }; type Actions = { @@ -51,7 +51,7 @@ type Actions = { /** * @desc Function to start the process of create a nation */ - startNationCreation: () => void, + startNationCreation: () => void }; type State = { @@ -62,18 +62,18 @@ type State = { /** * @desc Name of the modal to be shown */ - showModal: string, + showModal: string }; class NationsScreen extends NavigatorComponent< Props & Actions & WalletState & NationState, - State, - > { + State +> { constructor(props) { super(props); this.state = { isAppear: false, - showModal: '', + showModal: "" }; this.props.navigator.setButtons({ @@ -81,10 +81,10 @@ class NationsScreen extends NavigatorComponent< { id: MENU_BUTTON, icon: AssetsImages.menuIcon, - buttonColor: Colors.navigationButtonColor, - }, + buttonColor: Colors.navigationButtonColor + } ], - rightButtons: [], + rightButtons: [] }); } @@ -98,8 +98,8 @@ class NationsScreen extends NavigatorComponent< onHandleDeepLink(event) { if (this.state.isAppear) { - const parts = event.link.split('/'); - if (parts[0] === 'push') { + const parts = event.link.split("/"); + if (parts[0] === "push") { this.props.navigator.push(screen(parts[1])); } } @@ -111,34 +111,34 @@ class NationsScreen extends NavigatorComponent< this.showCreatePrivateKeyAlert(); } else { this.props.startNationCreation(); - this.props.navigator.showModal(screen('NATION_CREATE_SCREEN')); + this.props.navigator.showModal(screen("NATION_CREATE_SCREEN")); } } else if (id === MENU_BUTTON) { this.props.navigator.toggleDrawer({ - side: 'left', - animated: true, + side: "left", + animated: true }); } } showCreatePrivateKeyAlert() { Alert.alert( - i18n.t('alerts.walletRequired.title'), - i18n.t('alerts.walletRequired.subtitle'), + i18n.t("alerts.walletRequired.title"), + i18n.t("alerts.walletRequired.subtitle"), [ - { text: i18n.t('alerts.walletRequired.cancel'), style: 'cancel' }, + { text: i18n.t("alerts.walletRequired.cancel"), style: "cancel" }, { - text: i18n.t('alerts.walletRequired.confirm'), - onPress: () => this.props.navigator.switchToTab({ tabIndex: 3 }), - }, + text: i18n.t("alerts.walletRequired.confirm"), + onPress: () => this.props.navigator.switchToTab({ tabIndex: 3 }) + } ], - { cancelable: false }, + { cancelable: false } ); } dismissModal = () => { this.setState({ - showModal: '', + showModal: "" }); }; scrollTabView: any; @@ -151,9 +151,9 @@ class NationsScreen extends NavigatorComponent< } - ref={(c) => { + ref={c => { this.scrollTabView = c; }} > - + - - + + + + @@ -195,42 +201,44 @@ class NationsScreen extends NavigatorComponent< { if (_.isEmpty(this.props.wallets)) { this.showCreatePrivateKeyAlert(); } else { this.props.startNationCreation(); - this.props.navigator.showModal(screen('NATION_CREATE_SCREEN')); + this.props.navigator.showModal( + screen("NATION_CREATE_SCREEN") + ); } - }, + } }, { - text: 'Join a Nation', + text: "Join a Nation", onPress: () => { this.scrollTabView.goToPage(0); this.dismissModal(); - }, + } }, { - text: 'Report a Nation', + text: "Report a Nation", onPress: () => { this.dismissModal(); this.props.navigator.handleDeepLink({ - link: 'push/INFO_SCREEN', + link: "push/INFO_SCREEN" }); - }, - }, + } + } ]} /> ); } - onSelectItem = (id) => { + onSelectItem = id => { const nation = resolveNation(this.props.nations, id); if (!nation) { @@ -239,28 +247,28 @@ class NationsScreen extends NavigatorComponent< this.props.openNation(id); - this.props.navigator.push(screen('NATION_DETAILS_SCREEN')); + this.props.navigator.push(screen("NATION_DETAILS_SCREEN")); }; } const mapStateToProps = state => ({ ...state.nations, - ...state.wallet, + ...state.wallet }); const mapDispatchToProps = dispatch => ({ onSelectTab(index) { - dispatch(switchNationTab(index === 0 ? 'ALL_NATIONS' : 'MY_NATIONS')); + dispatch(switchNationTab(index === 0 ? "ALL_NATIONS" : "MY_NATIONS")); }, openNation(id) { dispatch(openNation(id)); }, startNationCreation() { dispatch(startNationCreation()); - }, + } }); export default connect( mapStateToProps, - mapDispatchToProps, + mapDispatchToProps )(NationsScreen); diff --git a/src/screens/PrivateChat/ChatList/index.js b/src/screens/PrivateChat/ChatList/index.js index ddcca989..91242665 100644 --- a/src/screens/PrivateChat/ChatList/index.js +++ b/src/screens/PrivateChat/ChatList/index.js @@ -1,44 +1,46 @@ // @flow -import React from 'react'; -import { connect } from 'react-redux'; -import { View, SectionList, Share, TextInput, Image } from 'react-native'; -import _ from 'lodash'; -import Dialog from 'react-native-dialog'; - -import { openChat, startNewChat, fetchAllChats } from '../../../actions/chat'; -import BackgroundImage from '../../../components/common/BackgroundImage'; -import styles from './styles'; -import { screen } from '../../../global/Screens'; -import ChatListItem from '../../../components/common/ChatListItem'; -import FakeNavigationBar from '../../../components/common/FakeNavigationBar'; -import Loading from '../../../components/common/Loading'; -import ScrollTabView, { DefaultTabBar } from '../../../components/ScrollTabView'; -import NavigatorComponent from '../../../components/common/NavigatorComponent'; -import LucyButton from '../../../components/common/LucyButton'; -import i18n from '../../../global/i18n'; -import Colors from '../../../global/colors'; +import React from "react"; +import { connect } from "react-redux"; +import { View, SectionList, Share, TextInput, Image } from "react-native"; +import _ from "lodash"; +import Dialog from "react-native-dialog"; + +import { openChat, startNewChat, fetchAllChats } from "../../../actions/chat"; +import BackgroundImage from "../../../components/common/BackgroundImage"; +import styles from "./styles"; +import { screen } from "../../../global/Screens"; +import ChatListItem from "../../../components/common/ChatListItem"; +import FakeNavigationBar from "../../../components/common/FakeNavigationBar"; +import Loading from "../../../components/common/Loading"; +import ScrollTabView, { + DefaultTabBar +} from "../../../components/ScrollTabView"; +import NavigatorComponent from "../../../components/common/NavigatorComponent"; +import LucyButton from "../../../components/common/LucyButton"; +import i18n from "../../../global/i18n"; +import Colors from "../../../global/colors"; import type { ProfileType, ChatType, - GiftedChatMessageType, -} from '../../../types/Chat'; -import type { Navigator } from '../../../types/ReactNativeNavigation'; -import InviteSentModal from './InviteSentModal'; -import { panthalassaIdentityPublicKey } from '../../../services/panthalassa'; -import { imageSource } from '../../../utils/profile'; -import AssetsImages from '../../../global/AssetsImages'; -import MoreMenuModal from '../../../components/common/MoreMenuModal'; -import type { Contact } from '../../../types/Contacts'; - -import PopOverModal from '../../../components/PopOverModal'; - -const MENU_BUTTON = 'MENU_BUTTON'; -const MORE_BUTTON = 'MORE_BUTTON'; -const MORE_MODAL_KEY = 'moreMenu'; -const INVITE_MODAL_KEY = 'invite'; -const CHAT_NAME_MODAL = 'CHAT_NAME_MODAL'; -const LUCY_MODAL_KEY = 'lucyModal'; + GiftedChatMessageType +} from "../../../types/Chat"; +import type { Navigator } from "../../../types/ReactNativeNavigation"; +import InviteSentModal from "./InviteSentModal"; +import { panthalassaIdentityPublicKey } from "../../../services/panthalassa"; +import { imageSource } from "../../../utils/profile"; +import AssetsImages from "../../../global/AssetsImages"; +import MoreMenuModal from "../../../components/common/MoreMenuModal"; +import type { Contact } from "../../../types/Contacts"; + +import PopOverModal from "../../../components/PopOverModal"; + +const MENU_BUTTON = "MENU_BUTTON"; +const MORE_BUTTON = "MORE_BUTTON"; +const MORE_MODAL_KEY = "moreMenu"; +const INVITE_MODAL_KEY = "invite"; +const CHAT_NAME_MODAL = "CHAT_NAME_MODAL"; +const LUCY_MODAL_KEY = "lucyModal"; type Props = { /** @@ -68,12 +70,12 @@ type Props = { startNewChat: ( members: Array, chatName: string | null, - callback: (success: boolean) => void, + callback: (success: boolean) => void ) => void, /** * @desc Function to fetch all chats */ - fetchAllChats: () => void, + fetchAllChats: () => void }; type State = { @@ -104,7 +106,7 @@ type State = { /** * @desc List of contacts selected for creating chat. */ - contacts: Array, + contacts: Array }; class ChatListScreen extends NavigatorComponent { @@ -113,21 +115,21 @@ class ChatListScreen extends NavigatorComponent { { id: MENU_BUTTON, icon: AssetsImages.menuIcon, - buttonColor: Colors.navigationButtonColor, - }, - ], + buttonColor: Colors.navigationButtonColor + } + ] }; constructor(props: Props) { super(props); this.state = { isAppear: false, - publicKey: '', + publicKey: "", profile: null, - showModal: '', + showModal: "", loading: false, contacts: [], - chatName: '', + chatName: "" }; } @@ -141,8 +143,8 @@ class ChatListScreen extends NavigatorComponent { onHandleDeepLink(event) { if (this.state.isAppear) { - const parts = event.link.split('/'); - if (parts[0] === 'push') { + const parts = event.link.split("/"); + if (parts[0] === "push") { this.props.navigator.push(screen(parts[1])); } } @@ -151,44 +153,56 @@ class ChatListScreen extends NavigatorComponent { onNavBarButtonPress(id) { if (id === MORE_BUTTON) { this.setState({ - showModal: MORE_MODAL_KEY, + showModal: MORE_MODAL_KEY }); } else if (id === MENU_BUTTON) { this.props.navigator.toggleDrawer({ - side: 'left', - animated: true, + side: "left", + animated: true }); } } + openNationChat = () => { + const id = "a8dddbe1-525e-4d5f-bc51-35a3dee84ff9"; + const isBot = false; + + this.props.navigator.push({ + ...screen("CHAT_SCREEN"), + passProps: { isBot, nationId: id } + }); + }; + onChatSelected = (chatId: number) => { - if (chatId === '0') { + if (chatId === "0") { this.props.navigator.push({ - ...screen('CHAT_SCREEN'), + ...screen("CHAT_SCREEN"), passProps: { - isBot: true, - }, + isBot: true + } }); + } else if (chatId === "bitnation") { + this.openNationChat(); } else { this.props.openChat(chatId); - this.props.navigator.push(screen('PRIVATE_CHAT_SCREEN')); + this.props.navigator.push(screen("PRIVATE_CHAT_SCREEN")); } }; dismissModal = () => { this.setState({ - publicKey: '', + publicKey: "", profile: null, - showModal: '', + showModal: "", contacts: [], - chatName: '', + chatName: "" }); }; sharePublicKey = async () => { const pubKey = await panthalassaIdentityPublicKey(); Share.share({ - message: pubKey || '', + message: pubKey || "" }).then(() => { this.dismissModal(); }); @@ -196,10 +210,10 @@ class ChatListScreen extends NavigatorComponent { goToContactsPicker = () => { this.props.navigator.showModal({ - ...screen('CONTACTS_PICKER_SCREEN'), + ...screen("CONTACTS_PICKER_SCREEN"), passProps: { - onContactsSelected: this.onSelectContacts, - }, + onContactsSelected: this.onSelectContacts + } }); }; @@ -207,14 +221,14 @@ class ChatListScreen extends NavigatorComponent { this.props.startNewChat( contacts.map(contact => contact.profile.identityKey), chatName, - (success) => { + success => { this.dismissModal(); if (success === false) { this.props.fetchAllChats(); } else { - this.props.navigator.push(screen('CHAT_SCREEN')); + this.props.navigator.push(screen("CHAT_SCREEN")); } - }, + } ); }; @@ -222,7 +236,7 @@ class ChatListScreen extends NavigatorComponent { this.props.navigator.dismissModal(); if (contacts.length === 1) { - this.initiateNewChat(contacts, ''); + this.initiateNewChat(contacts, ""); } else { this.setState({ contacts, showModal: CHAT_NAME_MODAL }); } @@ -237,36 +251,60 @@ class ChatListScreen extends NavigatorComponent { .map(key => this.props.profiles[key]) .filter(x => x != null) .map(profile => profile.name); - const resultedName = partnerNames.join(', '); + const resultedName = partnerNames.join(", "); if (resultedName.length > 0) { return resultedName; } - return 'Unknown account'; + return "Unknown account"; }; render() { const sortedChats = _.sortBy(this.props.chats, chat => - this.buildChatName(chat).toUpperCase()); + this.buildChatName(chat).toUpperCase() + ); const groups = _.groupBy(sortedChats, chat => this.buildChatName(chat) .toUpperCase() - .charAt(0)); - const lucyBot = [{ - id: '0', - name: 'Lucy 1.0', - - members: [], - messages: [], - unreadMessages: null, - }]; + .charAt(0) + ); + const lucyBot = [ + { + id: "0", + name: "Lucy 1.0", + + members: [], + messages: [], + unreadMessages: null + } + ]; const mergerBotGroup = { lucy: lucyBot, - ...groups, + ...groups }; const sections = _.map(mergerBotGroup, (group, key) => ({ title: key, - data: group, + data: group + })); + + const bitnationGroup = [ + { + id: "bitnation", + name: "BITNATION", + + members: [], + messages: [], + unreadMessages: null + } + ]; + + const mergerBinationGroup = { + bitnation: bitnationGroup + }; + + const sectionsGroup = _.map(mergerBinationGroup, (group, key) => ({ + title: key, + data: group })); return ( @@ -277,9 +315,9 @@ class ChatListScreen extends NavigatorComponent { { tabBarTextStyle={styles.tabBarTextStyle} renderTabBar={() => } > - - + + { + renderItem={item => { const chat: ChatType = item.item; let chatImage = AssetsImages.avatarIcon; @@ -313,18 +351,21 @@ class ChatListScreen extends NavigatorComponent { chatImage = AssetsImages.ChatUI.groupChatIcon; } - if (chat.id === '0') { + if (chat.id === "0") { chatImage = AssetsImages.lucyIcon; } - const messagePreview = ((message: GiftedChatMessageType | null) => { + const messagePreview = (( + message: GiftedChatMessageType | null + ) => { if (message == null) return null; if (message.dAppMessage == null) return message.text; // @todo Add preview for DApp messages. - return i18n.t('screens.chat.dAppMessagePreview'); - } - )(chat.messages.length === 0 - ? null - : chat.messages[chat.messages.length - 1]); + return i18n.t("screens.chat.dAppMessagePreview"); + })( + chat.messages.length === 0 + ? null + : chat.messages[chat.messages.length - 1] + ); const lastMessage = chat.messages.length === 0 @@ -334,7 +375,11 @@ class ChatListScreen extends NavigatorComponent { return ( { visible={this.state.showModal === CHAT_NAME_MODAL} > - {i18n.t('screens.chat.chatNameAlert.title')} + {i18n.t("screens.chat.chatNameAlert.title")} this.setState({ chatName: text })} /> this.initiateNewChat(this.state.contacts, this.state.chatName) } /> + + + + { + const chat: ChatType = item.item; + + let chatImage = AssetsImages.avatarIcon; + if (chat.members.length === 1) { + const partner = this.props.profiles[chat.members[0]]; + if (partner != null) { + chatImage = + imageSource(partner.image) || AssetsImages.avatarIcon; + } + } else { + chatImage = AssetsImages.ChatUI.groupChatIcon; + } + + if (chat.id === "0") { + chatImage = AssetsImages.lucyIcon; + } + const messagePreview = (( + message: GiftedChatMessageType | null + ) => { + if (message == null) return null; + if (message.dAppMessage == null) return message.text; + // @todo Add preview for DApp messages. + return i18n.t("screens.chat.dAppMessagePreview"); + })( + chat.messages.length === 0 + ? null + : chat.messages[chat.messages.length - 1] + ); + + const lastMessage = + chat.messages.length === 0 + ? {} + : chat.messages[chat.messages.length - 1]; + const dateString = lastMessage.createdAt; + return ( + + ); + }} + keyExtractor={item => item.id} + sections={sectionsGroup} + style={styles.sectionList} + ItemSeparatorComponent={() => ( + + )} + /> + + + + + {i18n.t("screens.chat.chatNameAlert.title")} + + this.setState({ chatName: text })} + /> + + this.initiateNewChat(this.state.contacts, this.state.chatName) + } + /> + - - this.setState({ showModal: LUCY_MODAL_KEY })} /> + this.setState({ showModal: LUCY_MODAL_KEY })} + /> { this.dismissModal(); this.sharePublicKey(); }, + text: i18n.t("screens.chat.menu.shareIdentityKey"), + onPress: () => { + this.dismissModal(); + this.sharePublicKey(); + } }, { - text: 'Help', + text: "Help", onPress: () => { this.dismissModal(); this.props.navigator.push({ - ...screen('CHAT_SCREEN'), + ...screen("CHAT_SCREEN"), passProps: { - isBot: true, - }, + isBot: true + } }); - }, - }, + } + } ]} /> {this.state.loading === true && } @@ -416,17 +553,17 @@ class ChatListScreen extends NavigatorComponent { const mapStateToProps = state => ({ chats: state.chat.chats, - profiles: state.chat.partnerProfiles, + profiles: state.chat.partnerProfiles }); const mapDispatchToProps = dispatch => ({ openChat: (chatId: number) => dispatch(openChat(chatId)), startNewChat: (members, chatName, callback) => dispatch(startNewChat(members, chatName, callback)), - fetchAllChats: () => dispatch(fetchAllChats()), + fetchAllChats: () => dispatch(fetchAllChats()) }); export default connect( mapStateToProps, - mapDispatchToProps, + mapDispatchToProps )(ChatListScreen); From 7ed8fdbd56ed2fd2e8ffc063cfa09a240d28ec50 Mon Sep 17 00:00:00 2001 From: Hoang Hung Date: Tue, 26 Feb 2019 08:36:03 +0700 Subject: [PATCH 07/36] fix conflict when push screen towhall tab --- src/screens/PrivateChat/ChatList/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/screens/PrivateChat/ChatList/index.js b/src/screens/PrivateChat/ChatList/index.js index 91242665..29c39c4e 100644 --- a/src/screens/PrivateChat/ChatList/index.js +++ b/src/screens/PrivateChat/ChatList/index.js @@ -167,7 +167,7 @@ class ChatListScreen extends NavigatorComponent { const id = "a8dddbe1-525e-4d5f-bc51-35a3dee84ff9"; const isBot = false; - this.props.navigator.push({ + this.props.navigator.showModal({ ...screen("CHAT_SCREEN"), passProps: { isBot, nationId: id } }); @@ -175,7 +175,7 @@ class ChatListScreen extends NavigatorComponent { onChatSelected = (chatId: number) => { if (chatId === "0") { - this.props.navigator.push({ + this.props.navigator.showModal({ ...screen("CHAT_SCREEN"), passProps: { isBot: true @@ -185,7 +185,7 @@ class ChatListScreen extends NavigatorComponent { this.openNationChat(); } else { this.props.openChat(chatId); - this.props.navigator.push(screen("PRIVATE_CHAT_SCREEN")); + this.props.navigator.showModal(screen("PRIVATE_CHAT_SCREEN")); } }; From e357055478ec51b8ec0382c61baebd033bc02590 Mon Sep 17 00:00:00 2001 From: Hoang Hung Date: Tue, 26 Feb 2019 08:56:44 +0700 Subject: [PATCH 08/36] fix conflict when push screen nations tab --- src/screens/NationsScreen/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/screens/NationsScreen/index.js b/src/screens/NationsScreen/index.js index 67522199..3b51f46c 100644 --- a/src/screens/NationsScreen/index.js +++ b/src/screens/NationsScreen/index.js @@ -100,7 +100,7 @@ class NationsScreen extends NavigatorComponent< if (this.state.isAppear) { const parts = event.link.split("/"); if (parts[0] === "push") { - this.props.navigator.push(screen(parts[1])); + this.props.navigator.showModal(screen(parts[1])); } } } @@ -247,7 +247,7 @@ class NationsScreen extends NavigatorComponent< this.props.openNation(id); - this.props.navigator.push(screen("NATION_DETAILS_SCREEN")); + this.props.navigator.showModal(screen("NATION_DETAILS_SCREEN")); }; } From 18027adcbaf9a04dc394aae1965d809efcbb6549 Mon Sep 17 00:00:00 2001 From: Hoang Hung Date: Tue, 26 Feb 2019 09:10:07 +0700 Subject: [PATCH 09/36] fixed crash when no message on bitnation group --- src/screens/ChatScreen/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/screens/ChatScreen/index.js b/src/screens/ChatScreen/index.js index d7010f1f..1b44ca88 100644 --- a/src/screens/ChatScreen/index.js +++ b/src/screens/ChatScreen/index.js @@ -84,7 +84,7 @@ class ChatScreen extends Component { super(props); if (props.isBot !== true) { - const nationIdX = props.nationId ? props.nationId : "a8dddbe1-525e-4d5f-bc51-35a3dee84ff9"; //hardcode for bitnation chat group + const nationIdX = props.nationId ? props.nationId : 'a8dddbe1-525e-4d5f-bc51-35a3dee84ff9'; // hardcode for bitnation chat group const selectedNation = resolveNation(props.nations || [], nationIdX); if (selectedNation === null) { props.navigator.pop(); @@ -234,7 +234,7 @@ class ChatScreen extends Component { this.onSend(messages)} user={sendingUser} bottomOffset={Platform.OS === 'ios' ? 48.5 : 0} From f2d6df32de05e19084a19080dd32b7c43552d24c Mon Sep 17 00:00:00 2001 From: Hoang Hung Date: Tue, 26 Feb 2019 09:33:29 +0700 Subject: [PATCH 10/36] ios fix tabview push replace showModal --- src/screens/MenuScreen/index.js | 105 ++++++++++-------- src/screens/NationsScreen/index.js | 11 +- src/screens/PrivateChat/ChatList/index.js | 43 +++++-- src/screens/Services/index.js | 87 +++++++++------ .../Services/subTabs/DappScreen/index.js | 27 +++-- 5 files changed, 167 insertions(+), 106 deletions(-) diff --git a/src/screens/MenuScreen/index.js b/src/screens/MenuScreen/index.js index d0c34c2c..377854ae 100644 --- a/src/screens/MenuScreen/index.js +++ b/src/screens/MenuScreen/index.js @@ -1,44 +1,54 @@ -import React from 'react'; -import { View, Image, ScrollView, TouchableOpacity, Share } from 'react-native'; -import { connect } from 'react-redux'; -import { Button, Text } from 'native-base'; -import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'; -import i18n from '../../global/i18n'; -import { logout } from '../../actions/accounts'; -import { imageSource } from '../../utils/profile'; -import { getCurrentAccount } from '../../reducers/accounts'; +import React from "react"; +import { + View, + Image, + ScrollView, + TouchableOpacity, + Share, + Platform +} from "react-native"; +import { connect } from "react-redux"; +import { Button, Text } from "native-base"; +import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons"; +import i18n from "../../global/i18n"; +import { logout } from "../../actions/accounts"; +import { imageSource } from "../../utils/profile"; +import { getCurrentAccount } from "../../reducers/accounts"; -import AssetsImages from '../../global/AssetsImages'; -import { screen } from '../../global/Screens'; -import styles from './styles'; +import AssetsImages from "../../global/AssetsImages"; +import { screen } from "../../global/Screens"; +import styles from "./styles"; // import Button from '../../components/common/Button'; -import NavigatorComponent from '../../components/common/NavigatorComponent'; +import NavigatorComponent from "../../components/common/NavigatorComponent"; class MenuScreen extends NavigatorComponent { constructor(props) { super(props); - this.props.navigator.setDrawerEnabled({ side: 'left', enabled: true }); + this.props.navigator.setDrawerEnabled({ side: "left", enabled: true }); } toggleDrawer = () => { this.props.navigator.toggleDrawer({ - side: 'left', + side: "left" }); }; sharePublicKey = () => { Share.share({ - message: this.props.publicKey || '', + message: this.props.publicKey || "" }); }; - onPushScreen = (screenX) => { + onPushScreen = screenX => { this.toggleDrawer(); - // this.props.navigator.handleDeepLink({ - // link: `push/${screen}`, - // }); - this.props.navigator.showModal(screen(screenX)); + if (Platform.OS === "ios") { + this.props.navigator.handleDeepLink({ + link: `push/${screenX}`, + }); + } else { + this.props.navigator.showModal(screen(screenX)); + } }; render() { @@ -56,7 +66,7 @@ class MenuScreen extends NavigatorComponent { this.toggleDrawer()}> @@ -75,25 +85,25 @@ class MenuScreen extends NavigatorComponent { onPress={this.sharePublicKey} > - {' '} - {i18n.t('sidemenu.copyaddress')} + {" "} + {i18n.t("sidemenu.copyaddress")} this.onPushScreen('PROFILE_SCREEN')} + onPress={() => this.onPushScreen("PROFILE_SCREEN")} > - {i18n.t('sidemenu.myprofile')} + {i18n.t("sidemenu.myprofile")} @@ -104,59 +114,62 @@ class MenuScreen extends NavigatorComponent { - {i18n.t('screens.settings.switchAccounts')} + {i18n.t("screens.settings.switchAccounts")} this.onPushScreen('WALLET_SCREEN')} + onPress={() => this.onPushScreen("WALLET_SCREEN")} > - + - {i18n.t('sidemenu.wallet')} + {i18n.t("sidemenu.wallet")} this.onPushScreen('SETTINGS_SCREEN')} + onPress={() => this.onPushScreen("SETTINGS_SCREEN")} > - {' '} - {i18n.t('sidemenu.settings')} + {" "} + {i18n.t("sidemenu.settings")} this.onPushScreen('INFO_SCREEN')} + onPress={() => this.onPushScreen("INFO_SCREEN")} > - {' '} - {i18n.t('sidemenu.contact')} + {" "} + {i18n.t("sidemenu.contact")} @@ -167,13 +180,13 @@ class MenuScreen extends NavigatorComponent { - {' '} - {i18n.t('sidemenu.logout')} + {" "} + {i18n.t("sidemenu.logout")} @@ -186,16 +199,16 @@ class MenuScreen extends NavigatorComponent { const mapStateToProps = state => ({ account: getCurrentAccount(state.accounts), - publicKey: state.accounts.currentAccountIdentityKey, + publicKey: state.accounts.currentAccountIdentityKey }); const mapDispatchToProps = dispatch => ({ logout() { dispatch(logout()); - }, + } }); export default connect( mapStateToProps, - mapDispatchToProps, + mapDispatchToProps )(MenuScreen); diff --git a/src/screens/NationsScreen/index.js b/src/screens/NationsScreen/index.js index 3b51f46c..389d5943 100644 --- a/src/screens/NationsScreen/index.js +++ b/src/screens/NationsScreen/index.js @@ -1,7 +1,7 @@ // @flow import React from "react"; -import { Alert, View, TextInput, Image } from "react-native"; +import { Alert, View, TextInput, Image, Platform } from "react-native"; import { connect } from "react-redux"; import _ from "lodash"; @@ -100,7 +100,7 @@ class NationsScreen extends NavigatorComponent< if (this.state.isAppear) { const parts = event.link.split("/"); if (parts[0] === "push") { - this.props.navigator.showModal(screen(parts[1])); + this.props.navigator.push(screen(parts[1])); } } } @@ -246,8 +246,11 @@ class NationsScreen extends NavigatorComponent< } this.props.openNation(id); - - this.props.navigator.showModal(screen("NATION_DETAILS_SCREEN")); + if (Platform.OS === "android") { + this.props.navigator.showModal(screen("NATION_DETAILS_SCREEN")); + } else { + this.props.navigator.push(screen("NATION_DETAILS_SCREEN")); + } }; } diff --git a/src/screens/PrivateChat/ChatList/index.js b/src/screens/PrivateChat/ChatList/index.js index 29c39c4e..ce93d9a5 100644 --- a/src/screens/PrivateChat/ChatList/index.js +++ b/src/screens/PrivateChat/ChatList/index.js @@ -1,6 +1,7 @@ // @flow import React from "react"; +import { Platform } from "react-native"; import { connect } from "react-redux"; import { View, SectionList, Share, TextInput, Image } from "react-native"; import _ from "lodash"; @@ -167,25 +168,45 @@ class ChatListScreen extends NavigatorComponent { const id = "a8dddbe1-525e-4d5f-bc51-35a3dee84ff9"; const isBot = false; - this.props.navigator.showModal({ - ...screen("CHAT_SCREEN"), - passProps: { isBot, nationId: id } - }); + if (Platform.OS === "android") { + this.props.navigator.showModal({ + ...screen("CHAT_SCREEN"), + passProps: { isBot, nationId: id } + }); + } else { + this.props.navigator.push({ + ...screen("CHAT_SCREEN"), + passProps: { isBot, nationId: id } + }); + } }; onChatSelected = (chatId: number) => { if (chatId === "0") { - this.props.navigator.showModal({ - ...screen("CHAT_SCREEN"), - passProps: { - isBot: true - } - }); + if (Platform.OS === "android") { + this.props.navigator.showModal({ + ...screen("CHAT_SCREEN"), + passProps: { + isBot: true + } + }); + } else { + this.props.navigator.push({ + ...screen("CHAT_SCREEN"), + passProps: { + isBot: true + } + }); + } } else if (chatId === "bitnation") { this.openNationChat(); } else { this.props.openChat(chatId); - this.props.navigator.showModal(screen("PRIVATE_CHAT_SCREEN")); + if (Platform.OS === "android") { + this.props.navigator.showModal(screen("PRIVATE_CHAT_SCREEN")); + } else { + this.props.navigator.push(screen("PRIVATE_CHAT_SCREEN")); + } } }; diff --git a/src/screens/Services/index.js b/src/screens/Services/index.js index f442c990..94836483 100644 --- a/src/screens/Services/index.js +++ b/src/screens/Services/index.js @@ -1,30 +1,48 @@ -import { compose, nest, withHandlers, lifecycle, withState, withProps } from 'recompose'; -import ServiceScreen from './view'; -import Colors from '../../global/colors'; -import AssetsImages from '../../global/AssetsImages'; -import { screen } from '../../global/Screens'; -import webView from './components/WebViewModal/view'; +import { Platform } from "react-native"; +import { + compose, + nest, + withHandlers, + lifecycle, + withState, + withProps +} from "recompose"; +import ServiceScreen from "./view"; +import Colors from "../../global/colors"; +import AssetsImages from "../../global/AssetsImages"; +import { screen } from "../../global/Screens"; +import webView from "./components/WebViewModal/view"; -const MENU_BUTTON = 'MENU_BUTTON'; +const MENU_BUTTON = "MENU_BUTTON"; export default compose( withProps(() => ({ - selectedItem: { uri: 'https://github.com/Bit-Nation/GOVMARKET/blob/master/README.md' }, + selectedItem: { + uri: "https://github.com/Bit-Nation/GOVMARKET/blob/master/README.md" + } })), - withState('showModal', 'setShowModal', ''), - withState('isAppear', 'setIsAppear', false), - withState('isShowWebViewModal', 'setIsShowWebViewModal', false), + withState("showModal", "setShowModal", ""), + withState("isAppear", "setIsAppear", false), + withState("isShowWebViewModal", "setIsShowWebViewModal", false), withHandlers({ - onPressHelp: ({ setShowModal, navigator }) => () => { - setShowModal(''); - navigator.showModal({ - ...screen('CHAT_SCREEN'), - passProps: { - isBot: true, - }, - }); - }, + setShowModal(""); + if (Platform.OS === "android") { + navigator.showModal({ + ...screen("CHAT_SCREEN"), + passProps: { + isBot: true + } + }); + } else { + navigator.push({ + ...screen("CHAT_SCREEN"), + passProps: { + isBot: true + } + }); + } + } }), lifecycle({ componentWillMount() { @@ -33,40 +51,39 @@ export default compose( { id: MENU_BUTTON, icon: AssetsImages.menuIcon, - buttonColor: Colors.navigationButtonColor, - }, + buttonColor: Colors.navigationButtonColor + } ], - rightButtons: [], + rightButtons: [] }); - this.props.navigator.setOnNavigatorEvent((event) => { + this.props.navigator.setOnNavigatorEvent(event => { switch (event.id) { - case 'willAppear': + case "willAppear": this.props.setIsAppear(true); break; - case 'willDisappear': + case "willDisappear": this.props.setIsAppear(false); break; default: break; } - if (event.type === 'NavBarButtonPress') { + if (event.type === "NavBarButtonPress") { if (event.id === MENU_BUTTON) { this.props.navigator.toggleDrawer({ - side: 'left', - animated: true, + side: "left", + animated: true }); } } - if (event.type === 'DeepLink') { + if (event.type === "DeepLink") { if (this.props.isAppear) { - const parts = event.link.split('/'); - if (parts[0] === 'push') { + const parts = event.link.split("/"); + if (parts[0] === "push") { this.props.navigator.push(screen(parts[1])); } } } }); - }, - }), + } + }) )(nest(ServiceScreen, webView)); - diff --git a/src/screens/Services/subTabs/DappScreen/index.js b/src/screens/Services/subTabs/DappScreen/index.js index e90c949d..21eb7013 100644 --- a/src/screens/Services/subTabs/DappScreen/index.js +++ b/src/screens/Services/subTabs/DappScreen/index.js @@ -1,19 +1,26 @@ -import { compose, withHandlers, nest, withState } from 'recompose'; -import SubTabComponent from '../../components/SubTabComponent/view'; -import withSubTabHOC from '../../components/SubTabComponent/index'; -import { screen } from '../../../../global/Screens'; -import webView from '../../components/WebViewModal/view'; +import { Platform } from "react-native"; +import { compose, withHandlers, nest, withState } from "recompose"; +import SubTabComponent from "../../components/SubTabComponent/view"; +import withSubTabHOC from "../../components/SubTabComponent/index"; +import { screen } from "../../../../global/Screens"; +import webView from "../../components/WebViewModal/view"; export default compose( withSubTabHOC, - withState('isShowWebViewModal', 'setIsShowWebViewModal', false), + withState("isShowWebViewModal", "setIsShowWebViewModal", false), withHandlers({ onPressMainButton: ({ setIsShowWebViewModal, navigator }) => ({ uri }) => { - if (uri === 'https://refugees.bitnation.co/blockchain-emergency-id-be-id/') { + if ( + uri === "https://refugees.bitnation.co/blockchain-emergency-id-be-id/" + ) { setIsShowWebViewModal(true); } else { - navigator.showModal(screen('DOCUMENTS_LIST_SCREEN')); + if (Platform.OS === "android") { + navigator.showModal(screen("DOCUMENTS_LIST_SCREEN")); + } else { + navigator.push(screen("DOCUMENTS_LIST_SCREEN")); + } } - }, - }), + } + }) )(nest(SubTabComponent, webView)); From 9e2e561b1b2a80627080f35f4aeb4a30c9152d23 Mon Sep 17 00:00:00 2001 From: Hoang Hung Date: Tue, 26 Feb 2019 10:01:32 +0700 Subject: [PATCH 11/36] Revert "fixed crash when no message on bitnation group" This reverts commit 18027adcbaf9a04dc394aae1965d809efcbb6549. --- src/screens/ChatScreen/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/screens/ChatScreen/index.js b/src/screens/ChatScreen/index.js index 1b44ca88..d7010f1f 100644 --- a/src/screens/ChatScreen/index.js +++ b/src/screens/ChatScreen/index.js @@ -84,7 +84,7 @@ class ChatScreen extends Component { super(props); if (props.isBot !== true) { - const nationIdX = props.nationId ? props.nationId : 'a8dddbe1-525e-4d5f-bc51-35a3dee84ff9'; // hardcode for bitnation chat group + const nationIdX = props.nationId ? props.nationId : "a8dddbe1-525e-4d5f-bc51-35a3dee84ff9"; //hardcode for bitnation chat group const selectedNation = resolveNation(props.nations || [], nationIdX); if (selectedNation === null) { props.navigator.pop(); @@ -234,7 +234,7 @@ class ChatScreen extends Component { this.onSend(messages)} user={sendingUser} bottomOffset={Platform.OS === 'ios' ? 48.5 : 0} From d3b74bc7046d6deaaa41a4ef1cdab15bf3b4799f Mon Sep 17 00:00:00 2001 From: Hoang Hung Date: Tue, 26 Feb 2019 21:41:54 +0700 Subject: [PATCH 12/36] update nation id for bitnation group nation --- src/reducers/nations.js | 46 ++++--- src/screens/ChatScreen/index.js | 153 ++++++++++++---------- src/screens/PrivateChat/ChatList/index.js | 5 +- 3 files changed, 114 insertions(+), 90 deletions(-) diff --git a/src/reducers/nations.js b/src/reducers/nations.js index e7f81ff1..7d702fb0 100644 --- a/src/reducers/nations.js +++ b/src/reducers/nations.js @@ -1,5 +1,5 @@ // @flow -import _ from 'lodash'; +import _ from "lodash"; import { type Action, @@ -11,11 +11,15 @@ import { NATIONS_FETCH_STARTED, REQUEST_JOIN_NATION, REQUEST_LEAVE_NATION, - NATIONS_UPDATED, -} from '../actions/nations'; -import type { NationType, NationIdType, EditingNationType } from '../types/Nation'; -import { resolveNation } from '../utils/nations'; -import { SERVICES_DESTROYED } from '../actions/serviceContainer'; + NATIONS_UPDATED +} from "../actions/nations"; +import type { + NationType, + NationIdType, + EditingNationType +} from "../types/Nation"; +import { resolveNation } from "../utils/nations"; +import { SERVICES_DESTROYED } from "../actions/serviceContainer"; export type State = { +nations: Array, @@ -24,17 +28,18 @@ export type State = { +selectedTab: NationTab, +openedNationId: NationIdType | null, +creatingNation: EditingNationType | null, - +inProgress: boolean, -} + +inProgress: boolean +}; export const initialState: State = { nations: [], myNationIds: [], searchString: null, - selectedTab: 'ALL_NATIONS', + selectedTab: "ALL_NATIONS", openedNationId: null, + groupNationId: null, creatingNation: null, - inProgress: false, + inProgress: false }; /** @@ -50,48 +55,55 @@ export default (state: State = initialState, action: Action): State => { case SWITCH_NATIONS_TAB: return { ...state, - selectedTab: action.tab, + selectedTab: action.tab }; case OPEN_NATION: return { ...state, - openedNationId: action.nationId, + openedNationId: action.nationId }; case NATIONS_FETCH_STARTED: return { ...state, - inProgress: true, + inProgress: true }; case NATIONS_UPDATED: { const myNationIds = _(action.nations) .filter(nation => nation.joined) .map(nation => nation.id) .value(); + const groupNationId = null; + _.forEach(action.nations, (nation) => { + if (nation.nationName === "BITNATION") { + groupNationId = nation.id; + } + }) return { ...state, nations: action.nations, myNationIds, + groupNationId }; } case DONE_FETCH_NATIONS: return { ...state, - inProgress: false, + inProgress: false }; case REQUEST_JOIN_NATION: return { ...state, - inProgress: true, + inProgress: true }; case REQUEST_LEAVE_NATION: return { ...state, - inProgress: true, + inProgress: true }; case CANCEL_LOADING: return { ...state, - inProgress: false, + inProgress: false }; default: return state; diff --git a/src/screens/ChatScreen/index.js b/src/screens/ChatScreen/index.js index 1b44ca88..014abf3c 100644 --- a/src/screens/ChatScreen/index.js +++ b/src/screens/ChatScreen/index.js @@ -1,32 +1,32 @@ // @flow -import React, { Component } from 'react'; -import { View, Platform } from 'react-native'; -import { connect } from 'react-redux'; -import config from 'react-native-config'; -import SocketIOClient from 'socket.io-client'; +import React, { Component } from "react"; +import { View, Platform } from "react-native"; +import { connect } from "react-redux"; +import config from "react-native-config"; +import SocketIOClient from "socket.io-client"; import { GiftedChat, Composer, InputToolbar, - Bubble, -} from 'react-native-gifted-chat'; -import AssetsImages from '../../global/AssetsImages'; + Bubble +} from "react-native-gifted-chat"; +import AssetsImages from "../../global/AssetsImages"; -import BitnationMessage from '../PrivateChat/Chat/BitnationMessage'; -import BitnationInputToolbar from '../PrivateChat/Chat/BitnationInputToolbar'; -import styles from './styles'; +import BitnationMessage from "../PrivateChat/Chat/BitnationMessage"; +import BitnationInputToolbar from "../PrivateChat/Chat/BitnationInputToolbar"; +import styles from "./styles"; -import { showSpinner, hideSpinner } from '../../actions/chat'; -import BackgroundImage from '../../components/common/BackgroundImage'; -import FakeNavigationBar from '../../components/common/FakeNavigationBar'; -import Loading from '../../components/common/Loading'; -import { resolveNation } from '../../utils/nations'; -import deprecatedCreateGiftedChatMessageObject from '../../utils/chat'; -import type { NationIdType, NationType } from '../../types/Nation'; -import type { Navigator } from '../../types/ReactNativeNavigation'; -import LucyBot from '../../../vendor/LucyBot'; -import { getCurrentAccount } from '../../reducers/accounts'; +import { showSpinner, hideSpinner } from "../../actions/chat"; +import BackgroundImage from "../../components/common/BackgroundImage"; +import FakeNavigationBar from "../../components/common/FakeNavigationBar"; +import Loading from "../../components/common/Loading"; +import { resolveNation } from "../../utils/nations"; +import deprecatedCreateGiftedChatMessageObject from "../../utils/chat"; +import type { NationIdType, NationType } from "../../types/Nation"; +import type { Navigator } from "../../types/ReactNativeNavigation"; +import LucyBot from "../../../vendor/LucyBot"; +import { getCurrentAccount } from "../../reducers/accounts"; type Props = { /** @@ -53,6 +53,10 @@ type Props = { * @desc Flag that indicates the loading status */ isFetching: boolean, + /** + * @desc Flag that open screen from group tab + */ + groupDefault: boolean, /** * @desc Function to show spinner */ @@ -77,35 +81,41 @@ type State = { class ChatScreen extends Component { static defaultProps = { isBot: true, + groupDefault: false }; - constructor(props: Props) { super(props); if (props.isBot !== true) { - const nationIdX = props.nationId ? props.nationId : 'a8dddbe1-525e-4d5f-bc51-35a3dee84ff9'; // hardcode for bitnation chat group + const nationIdX = props.groupDefault + ? props.groupNationId + : props.nationId; // hardcode for bitnation chat group const selectedNation = resolveNation(props.nations || [], nationIdX); - if (selectedNation === null) { - props.navigator.pop(); + if (!selectedNation) { + if (Platform.OS === "ios") { + props.navigator.pop(); + } else { + props.navigator.dismissModal(); + } return; } this.nationId = selectedNation.idInSmartContract; // Creating the socket-client instance will automatically connect to the server. this.connection = SocketIOClient(config.CHAT_URL, { - transports: ['websocket'], + transports: ["websocket"], upgrade: false, - query: `token=${config.AUTH_TOKEN}`, + query: `token=${config.AUTH_TOKEN}` }); - this.connection.on('connect', () => { - this.connection.emit('room:join', { - nation_id: this.nationId, + this.connection.on("connect", () => { + this.connection.emit("room:join", { + nation_id: this.nationId }); }); this.state = { messages: [], - joined: false, + joined: false }; } else { // add initial bot message @@ -117,13 +127,13 @@ class ChatScreen extends Component { createdAt: new Date(), user: { _id: 2, - name: 'Lucy 1.0', - avatar: AssetsImages.lucyIcon, - }, + name: "Lucy 1.0", + avatar: AssetsImages.lucyIcon + } // Any additional custom parameters are passed through - }, + } ], - joined: false, + joined: false }; } } @@ -132,30 +142,36 @@ class ChatScreen extends Component { if (this.props.isBot !== true && this.connection) { this.props.showSpinner(); // load initial messages - const URL = `${config.CHAT_URL}/messages/${this.nationId}?auth_token=${config.AUTH_TOKEN}`; + const URL = `${config.CHAT_URL}/messages/${this.nationId}?auth_token=${ + config.AUTH_TOKEN + }`; fetch(URL) .then(response => response.json()) .then( - (json) => { - const messages = deprecatedCreateGiftedChatMessageObject(json.reverse()); + json => { + const messages = deprecatedCreateGiftedChatMessageObject( + json.reverse() + ); this.props.hideSpinner(); this.setState(previousState => ({ - messages: GiftedChat.append(previousState.messages, messages), + messages: GiftedChat.append(previousState.messages, messages) })); }, () => { this.props.hideSpinner(); - }, + } ); // add socket listener - this.connection.on('room:joined', (data) => { + this.connection.on("room:joined", data => { if (data.nation_id >= 0) { this.setState({ joined: true }); - this.connection.on('msg', (messageData) => { - const messages = deprecatedCreateGiftedChatMessageObject([messageData]); + this.connection.on("msg", messageData => { + const messages = deprecatedCreateGiftedChatMessageObject([ + messageData + ]); this.setState(previousState => ({ - messages: GiftedChat.append(previousState.messages, messages), + messages: GiftedChat.append(previousState.messages, messages) })); }); } @@ -178,29 +194,29 @@ class ChatScreen extends Component { createdAt: new Date(), user: { _id: 2, - name: 'Lucy 1.0', - avatar: AssetsImages.lucyIcon, - }, - }, + name: "Lucy 1.0", + avatar: AssetsImages.lucyIcon + } + } ]; // Add user's message this.setState(previousState => ({ - messages: GiftedChat.append(previousState.messages, messages), + messages: GiftedChat.append(previousState.messages, messages) })); // Add Eliza's response this.setState(previousState => ({ - messages: GiftedChat.append(previousState.messages, m), + messages: GiftedChat.append(previousState.messages, m) })); } else if (this.state.joined === true) { const newMessage = { nation_id: this.nationId, msg: messages[0].text, - from: this.props.user ? this.props.user.name : 'anonymous', - userId: this.props.user ? this.props.user.id : 'anonymous', + from: this.props.user ? this.props.user.name : "anonymous", + userId: this.props.user ? this.props.user.id : "anonymous" }; - this.connection.emit('room:msg', newMessage); + this.connection.emit("room:msg", newMessage); } } @@ -208,24 +224,17 @@ class ChatScreen extends Component { connection: any; renderMessage(props) { - return ( - - ); + return ; } renderInputToolbar(props) { - return ( - - ); + return ; } render() { const sendingUser = { - _id: this.props.user ? this.props.user.id : 'anonymous', - name: this.props.user ? this.props.user.name : 'anonymous', + _id: this.props.user ? this.props.user.id : "anonymous", + name: this.props.user ? this.props.user.name : "anonymous" }; return ( @@ -234,10 +243,10 @@ class ChatScreen extends Component { this.onSend(messages)} user={sendingUser} - bottomOffset={Platform.OS === 'ios' ? 48.5 : 0} + bottomOffset={Platform.OS === "ios" ? 48.5 : 0} renderInputToolbar={this.renderInputToolbar} renderMessage={this.renderMessage} /> @@ -250,13 +259,17 @@ class ChatScreen extends Component { const mapStateToProps = state => ({ nations: state.nations.nations, nationId: state.nations.openedNationId, + groupNationId: state.nations.groupNationId, user: getCurrentAccount(state.accounts), - isFetching: state.chat.isFetching, + isFetching: state.chat.isFetching }); const mapDispatchToProps = dispatch => ({ showSpinner: () => dispatch(showSpinner()), - hideSpinner: () => dispatch(hideSpinner()), + hideSpinner: () => dispatch(hideSpinner()) }); -export default connect(mapStateToProps, mapDispatchToProps)(ChatScreen); +export default connect( + mapStateToProps, + mapDispatchToProps +)(ChatScreen); diff --git a/src/screens/PrivateChat/ChatList/index.js b/src/screens/PrivateChat/ChatList/index.js index ce93d9a5..a827a9a1 100644 --- a/src/screens/PrivateChat/ChatList/index.js +++ b/src/screens/PrivateChat/ChatList/index.js @@ -165,18 +165,17 @@ class ChatListScreen extends NavigatorComponent { } openNationChat = () => { - const id = "a8dddbe1-525e-4d5f-bc51-35a3dee84ff9"; const isBot = false; if (Platform.OS === "android") { this.props.navigator.showModal({ ...screen("CHAT_SCREEN"), - passProps: { isBot, nationId: id } + passProps: { isBot, groupDefault: true } }); } else { this.props.navigator.push({ ...screen("CHAT_SCREEN"), - passProps: { isBot, nationId: id } + passProps: { isBot, groupDefault: true } }); } }; From 4719a2d5cb15ffba120609024aa21849cf50555c Mon Sep 17 00:00:00 2001 From: Hoang Hung Date: Wed, 27 Feb 2019 10:31:03 +0700 Subject: [PATCH 13/36] [UI] update some UI change --- src/screens/NationsScreen/index.js | 3 +- src/screens/PrivateChat/ChatList/index.js | 5 +- src/screens/Services/view.js | 132 ++++++++++---------- src/screens/Settings/SettingsList/index.js | 8 +- src/screens/Settings/SettingsList/styles.js | 2 +- 5 files changed, 78 insertions(+), 72 deletions(-) diff --git a/src/screens/NationsScreen/index.js b/src/screens/NationsScreen/index.js index 389d5943..21809714 100644 --- a/src/screens/NationsScreen/index.js +++ b/src/screens/NationsScreen/index.js @@ -154,6 +154,7 @@ class NationsScreen extends NavigatorComponent< placeholder="Search by name, type or category..." placeholderTextColor={Colors.BitnationLinkOrangeColor} autoCapitalize="none" + underlineColorAndroid="transparent" /> - + { - + {/* - + */} ( + showModal, + setShowModal, + onPressHelp, + children, + setIsShowWebViewModal, + navigator +}: Props) => ( {children} @@ -47,11 +50,15 @@ const ServicesScreen = ({ + - } > - + - + - + - + @@ -100,25 +104,25 @@ const ServicesScreen = ({ setShowModal(LUCY_MODAL_KEY)} /> setShowModal('')} - desText='Tailor make your own governance system through choosing dapps, contracts, services and products!' + onCancel={() => setShowModal("")} + desText="Tailor make your own governance system through choosing dapps, contracts, services and products!" options={[ - { - text: 'Start a new Service', - onPress: () => { - setShowModal(''); - setIsShowWebViewModal(true); + { + text: "Start a new Service", + onPress: () => { + setShowModal(""); + setIsShowWebViewModal(true); + } + }, + { + text: "Report a Service", + onPress: () => {} }, - }, - { - text: 'Report a Service', - onPress: () => {}, - }, - { - text: 'Help', - onPress: onPressHelp, - }, - ]} + { + text: "Help", + onPress: onPressHelp + } + ]} /> ); diff --git a/src/screens/Settings/SettingsList/index.js b/src/screens/Settings/SettingsList/index.js index 3239d773..331a654a 100644 --- a/src/screens/Settings/SettingsList/index.js +++ b/src/screens/Settings/SettingsList/index.js @@ -94,12 +94,12 @@ class SettingsListScreen extends NavigatorComponent { - + {/* - + */} { - + */}