Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
Merge pull request #26 from ES2-UFPI/storeMessage#9
Browse files Browse the repository at this point in the history
Store message#9
  • Loading branch information
netochaves authored Apr 16, 2019
2 parents fdfeac5 + d3163d7 commit 0545ba5
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 45 deletions.
2 changes: 2 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true
}
splits {
abi {
Expand Down Expand Up @@ -149,6 +150,7 @@ dependencies {
// Firebase dependencys
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.1'
implementation "com.google.firebase:firebase-firestore:18.2.0"

}

Expand Down
2 changes: 2 additions & 0 deletions android/app/src/main/java/com/unichat/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import io.invertase.firebase.auth.RNFirebaseAuthPackage;
import io.invertase.firebase.firestore.RNFirebaseFirestorePackage;

import java.util.Arrays;
import java.util.List;
Expand All @@ -31,6 +32,7 @@ protected List<ReactPackage> getPackages() {
new VectorIconsPackage(),
new RNFirebasePackage(),
new RNFirebaseAuthPackage(),
new RNFirebaseFirestorePackage(),
new SvgPackage(),
new RNGestureHandlerPackage()
);
Expand Down
39 changes: 8 additions & 31 deletions ios/Unichat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -49,10 +48,6 @@
C013733819F7492F86B74383 /* libRNGestureHandler.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 45942EDDB6694B7DB6AA2C1D /* libRNGestureHandler.a */; };
ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED297162215061F000B7C4FE /* JavaScriptCore.framework */; };
ED2971652150620600B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2971642150620600B7C4FE /* JavaScriptCore.framework */; };
C013733819F7492F86B74383 /* libRNGestureHandler.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 45942EDDB6694B7DB6AA2C1D /* libRNGestureHandler.a */; };
10753C3822CF4FE4BEB06127 /* libRNGestureHandler-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A9F8B20505004B98AB5B69AD /* libRNGestureHandler-tvOS.a */; };
45E4BC3E1782480491763649 /* libRNSVG.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AF667A9D70174E29A65F940D /* libRNSVG.a */; };
225AEA423375468C87A08975 /* libRNSVG-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 05F0EE6956C94A88B15D6F4F /* libRNSVG-tvOS.a */; };
98426CE8528843B3B8777FDD /* libRNVectorIcons.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61D42B04BA224B598D26DB27 /* libRNVectorIcons.a */; };
2F3E060758724E6EB5A4C421 /* libRNVectorIcons-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EAA522D07EF54A05812A4141 /* libRNVectorIcons-tvOS.a */; };
08A4607A7CC94D0E87DC6BCB /* AntDesign.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0C7965D511774E7797FC14C5 /* AntDesign.ttf */; };
Expand Down Expand Up @@ -394,10 +389,10 @@
00E356EE1AD99517003FC87E /* UnichatTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnichatTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* UnichatTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UnichatTests.m; sourceTree = "<group>"; };
05F0EE6956C94A88B15D6F4F /* libRNSVG-tvOS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = "libRNSVG-tvOS.a"; sourceTree = "<group>"; };
05F0EE6956C94A88B15D6F4F /* libRNSVG-tvOS.a */ = {isa = PBXFileReference; name = "libRNSVG-tvOS.a"; path = "libRNSVG-tvOS.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
0C9A24945A99882FB907FF48 /* Pods-Unichat-tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Unichat-tvOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-Unichat-tvOS/Pods-Unichat-tvOS.release.xcconfig"; sourceTree = "<group>"; };
1145456E31D8568778C55A3E /* Pods-Unichat-tvOSTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Unichat-tvOSTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Unichat-tvOSTests/Pods-Unichat-tvOSTests.release.xcconfig"; sourceTree = "<group>"; };
125C0030F7A245F79AAA4BD5 /* RNGestureHandler.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNGestureHandler.xcodeproj; path = "../node_modules/react-native-gesture-handler/ios/RNGestureHandler.xcodeproj"; sourceTree = "<group>"; };
125C0030F7A245F79AAA4BD5 /* RNGestureHandler.xcodeproj */ = {isa = PBXFileReference; name = "RNGestureHandler.xcodeproj"; path = "../node_modules/react-native-gesture-handler/ios/RNGestureHandler.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* Unichat.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Unichat.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -413,7 +408,7 @@
2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; };
390956931BD045F69AC6ED08 /* libRNFirebase.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNFirebase.a; sourceTree = "<group>"; };
3CE7A60A6AEF966A662DAF13 /* libPods-Unichat.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Unichat.a"; sourceTree = BUILT_PRODUCTS_DIR; };
45942EDDB6694B7DB6AA2C1D /* libRNGestureHandler.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNGestureHandler.a; sourceTree = "<group>"; };
45942EDDB6694B7DB6AA2C1D /* libRNGestureHandler.a */ = {isa = PBXFileReference; name = "libRNGestureHandler.a"; path = "libRNGestureHandler.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
4AF20528DA8344300BB7D52F /* Pods-Unichat.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Unichat.release.xcconfig"; path = "Pods/Target Support Files/Pods-Unichat/Pods-Unichat.release.xcconfig"; sourceTree = "<group>"; };
528A391FBE3DD9745B8ECF33 /* Pods-UnichatTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnichatTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-UnichatTests/Pods-UnichatTests.release.xcconfig"; sourceTree = "<group>"; };
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
Expand All @@ -423,22 +418,16 @@
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
889ED91ED8CF4BB8B092167B /* RNFirebase.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFirebase.xcodeproj; path = "../node_modules/react-native-firebase/ios/RNFirebase.xcodeproj"; sourceTree = "<group>"; };
908EAEDC4B7505F0F558C566 /* Pods-Unichat-tvOSTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Unichat-tvOSTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Unichat-tvOSTests/Pods-Unichat-tvOSTests.debug.xcconfig"; sourceTree = "<group>"; };
A3AD7F7807AB44AD87BFC4A5 /* RNSVG.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNSVG.xcodeproj; path = "../node_modules/react-native-svg/ios/RNSVG.xcodeproj"; sourceTree = "<group>"; };
A3AD7F7807AB44AD87BFC4A5 /* RNSVG.xcodeproj */ = {isa = PBXFileReference; name = "RNSVG.xcodeproj"; path = "../node_modules/react-native-svg/ios/RNSVG.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
A612E35522613E5B0023868C /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
A9F8B20505004B98AB5B69AD /* libRNGestureHandler-tvOS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = "libRNGestureHandler-tvOS.a"; sourceTree = "<group>"; };
A9F8B20505004B98AB5B69AD /* libRNGestureHandler-tvOS.a */ = {isa = PBXFileReference; name = "libRNGestureHandler-tvOS.a"; path = "libRNGestureHandler-tvOS.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
AF667A9D70174E29A65F940D /* libRNSVG.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNSVG.a; sourceTree = "<group>"; };
AF667A9D70174E29A65F940D /* libRNSVG.a */ = {isa = PBXFileReference; name = "libRNSVG.a"; path = "libRNSVG.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
B5805629F54E83D532E08063 /* libPods-Unichat-tvOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Unichat-tvOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
C0FB19EA484E5E46D1E3D8C8 /* Pods-Unichat-tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Unichat-tvOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Unichat-tvOS/Pods-Unichat-tvOS.debug.xcconfig"; sourceTree = "<group>"; };
EB982DD01FD60BAA3C457899 /* libPods-Unichat-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Unichat-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; };
125C0030F7A245F79AAA4BD5 /* RNGestureHandler.xcodeproj */ = {isa = PBXFileReference; name = "RNGestureHandler.xcodeproj"; path = "../node_modules/react-native-gesture-handler/ios/RNGestureHandler.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
45942EDDB6694B7DB6AA2C1D /* libRNGestureHandler.a */ = {isa = PBXFileReference; name = "libRNGestureHandler.a"; path = "libRNGestureHandler.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
A9F8B20505004B98AB5B69AD /* libRNGestureHandler-tvOS.a */ = {isa = PBXFileReference; name = "libRNGestureHandler-tvOS.a"; path = "libRNGestureHandler-tvOS.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
A3AD7F7807AB44AD87BFC4A5 /* RNSVG.xcodeproj */ = {isa = PBXFileReference; name = "RNSVG.xcodeproj"; path = "../node_modules/react-native-svg/ios/RNSVG.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
AF667A9D70174E29A65F940D /* libRNSVG.a */ = {isa = PBXFileReference; name = "libRNSVG.a"; path = "libRNSVG.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
05F0EE6956C94A88B15D6F4F /* libRNSVG-tvOS.a */ = {isa = PBXFileReference; name = "libRNSVG-tvOS.a"; path = "libRNSVG-tvOS.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
C50B483D1A264B288825440A /* RNVectorIcons.xcodeproj */ = {isa = PBXFileReference; name = "RNVectorIcons.xcodeproj"; path = "../node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
61D42B04BA224B598D26DB27 /* libRNVectorIcons.a */ = {isa = PBXFileReference; name = "libRNVectorIcons.a"; path = "libRNVectorIcons.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
EAA522D07EF54A05812A4141 /* libRNVectorIcons-tvOS.a */ = {isa = PBXFileReference; name = "libRNVectorIcons-tvOS.a"; path = "libRNVectorIcons-tvOS.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
Expand Down Expand Up @@ -1739,7 +1728,7 @@
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
);
INFOPLIST_FILE = Unichat/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -1751,12 +1740,6 @@
PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.Unichat;
PRODUCT_NAME = Unichat;
VERSIONING_SYSTEM = "apple-generic";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
);
};
name = Debug;
};
Expand All @@ -1770,7 +1753,7 @@
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
);
INFOPLIST_FILE = Unichat/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -1782,12 +1765,6 @@
PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.Unichat;
PRODUCT_NAME = Unichat;
VERSIONING_SYSTEM = "apple-generic";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
);
};
name = Release;
};
Expand Down
13 changes: 0 additions & 13 deletions ios/Unichat/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,6 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>UIAppFonts</key>
<array>
<string>AntDesign.ttf</string>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/MessageInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const styles = StyleSheet.create({
alignContent: "center",
justifyContent: "center",
top: 5,
right: 10,
right: 1,
width: 30,
height: 30,
borderRadius: 30 / 2,
Expand Down
10 changes: 10 additions & 0 deletions src/Screens/Conversas/conversas.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { View, StyleSheet, Dimensions, StatusBar, Text } from "react-native"
import { Avatar, Icon } from "react-native-elements"
import { ScrollView } from "react-native-gesture-handler"
import shortid from "shortid"
import firebase from "react-native-firebase"

import MessageInput from "../../Components/MessageInput"
import Message from "../../Components/mensagem"
Expand All @@ -19,6 +20,8 @@ export default class Conversas extends Component {
messageText: "",
messages: []
}
// This line right here needs to be changed later
this.ref = firebase.firestore().collection("Messages")
}

onChangeHandler = text => {
Expand Down Expand Up @@ -59,6 +62,13 @@ export default class Conversas extends Component {
date: hour,
source: "1"
}

this.ref.add({
content: newMessage.content,
date: newMessage.date,
source: newMessage.source
}).then(() => true).catch(error => error)

this.setState({ messages: [...messages, newMessage] })
this.setState({ messageText: "" })
}
Expand Down

0 comments on commit 0545ba5

Please sign in to comment.