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

Commit

Permalink
Merge branch 'dev' into evandro#popuptraduzir
Browse files Browse the repository at this point in the history
  • Loading branch information
Mex978 authored May 9, 2019
2 parents 5f3ed9f + ce5f77c commit bc5f581
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 30 deletions.
39 changes: 38 additions & 1 deletion src/Screens/Conversas/conversas.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
Text,
Image,
TouchableOpacity,
BackHandler
BackHandler,
Alert
} from "react-native"
import { ListItem, Icon } from "react-native-elements"
import LinearGradient from "react-native-linear-gradient"
Expand Down Expand Up @@ -76,6 +77,39 @@ export default class Conversas extends Component {
navigation.navigate("ChatScreen", { item })
}

confirmDelete = item => {
Alert.alert(
"Apagar",
"Deseja apagar a conversa?",
[
{ text: "Sim", onPress: () => this.deleteChat(item) },
{
text: "Não",
style: "cancel"
}
],
{ cancelable: false }
)
}

deleteChat = item => {
const { conversas } = this.state

conversas.map(conversa => {
if(conversa.key === item.key) {
this.ref.collection("conversas").doc(item.key).collection("messages")
.get()
.then(snapshot => {
snapshot.docs.forEach(docs => {
docs.ref.delete()
})
})
this.ref.collection("conversas").doc(item.key).delete()
}
return true
})
}

newConversa = () => {
const { navigation } = this.props
navigation.navigate("ContactsScreen")
Expand Down Expand Up @@ -110,6 +144,9 @@ export default class Conversas extends Component {
onPress={() => {
this.goToChat(item.contact)
}}
onLongPress={() => {
this.confirmDelete(item.contact)
}}
style={styles.conversa}
subtitle={
<View style={styles.containerSub}>
Expand Down
29 changes: 0 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1702,14 +1702,6 @@ color-support@^1.1.3:
resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2"
integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==

color@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/color/-/color-3.0.0.tgz#d920b4328d534a3ac8295d68f7bd4ba6c427be9a"
integrity sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w==
dependencies:
color-convert "^1.9.1"
color-string "^1.5.2"

color@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/color/-/color-3.1.0.tgz#d8e9fb096732875774c84bf922815df0308d0ffc"
Expand Down Expand Up @@ -4185,11 +4177,6 @@ locate-path@^3.0.0:
p-locate "^3.0.0"
path-exists "^3.0.0"

lodash.merge@^4.0.0:
version "4.6.1"
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.1.tgz#adc25d9cb99b9391c59624f379fbba60d7111d54"
integrity sha512-AOYza4+Hf5z1/0Hztxpm2/xiPZgi/cjMqdnKTUWTBSKchJlxXXuUSxCCl8rJlf4g6yww/j6mA8nC8Hw/EZWxKQ==

lodash.pad@^4.1.0:
version "4.5.1"
resolved "https://registry.yarnpkg.com/lodash.pad/-/lodash.pad-4.5.1.tgz#4330949a833a7c8da22cc20f6a26c4d59debba70"
Expand Down Expand Up @@ -5648,22 +5635,6 @@ react-native-masked-text@^1.12.2:
moment "2.19.3"
tinymask "^1.0.2"

react-native-material-design-styles@^0.2.6:
version "0.2.7"
resolved "https://registry.yarnpkg.com/react-native-material-design-styles/-/react-native-material-design-styles-0.2.7.tgz#428560ef4d0659db1163c9f9b5476d886ed22d57"
integrity sha512-dEtVROG1zqso3fiElJulOU+8/HwWh2TVIyDICrddlyAuDt5dpowelLpmamkRW1CV8VHRdHY5ZhxGWUOiPvROgw==

react-native-material-ui@^1.30.1:
version "1.30.1"
resolved "https://registry.yarnpkg.com/react-native-material-ui/-/react-native-material-ui-1.30.1.tgz#42b44f1f4dedeeb4f599c64b9f0adfde5a2ea5ea"
integrity sha512-lvcfDMdPRUloVHVNbQR62h2pCoGOlwWEcC5UEzUNlPX7lRZt/A13PLHIj8wSkE4giwg4GZI9LWY0yqCKxsAq/Q==
dependencies:
color "3.0.0"
hoist-non-react-statics "^2.5.5"
lodash.merge "^4.0.0"
prop-types "^15.5.10"
react-native-material-design-styles "^0.2.6"

react-native-power-translator@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/react-native-power-translator/-/react-native-power-translator-1.1.1.tgz#f4bf9a5a13a21618e3bf7f6c587f021677baff6c"
Expand Down

0 comments on commit bc5f581

Please sign in to comment.