This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.arch.lifecycle.LiveData; | |
| import android.arch.persistence.room.Dao; | |
| import android.arch.persistence.room.Delete; | |
| import android.arch.persistence.room.Insert; | |
| import android.arch.persistence.room.Query; | |
| import android.arch.persistence.room.Update; | |
| import java.util.ArrayList; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package io.github.rosariopfernandes.aac; | |
| import android.arch.persistence.room.Entity; | |
| import android.arch.persistence.room.PrimaryKey; | |
| /** | |
| * Created by rosariopfernandes on 6/9/17. | |
| */ | |
| @Entity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public LiveData<List<Tarefa>> getTarefas() { | |
| if(tarefas == null) { | |
| carregarDados(); | |
| } | |
| if(tarefas.getValue().size()==0) { | |
| //Transformations.map() | |
| tarefas = Transformations.map(tarefas, new Function<List<Tarefa>, | |
| List<Tarefa>>() { | |
| @Override | |
| public List<Tarefa> apply(List<Tarefa> novasTarefas) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.arch.lifecycle.Lifecycle; | |
| import android.arch.lifecycle.LifecycleActivity; | |
| import android.arch.lifecycle.LifecycleObserver; | |
| import android.arch.lifecycle.Observer; | |
| import android.arch.lifecycle.OnLifecycleEvent; | |
| import android.arch.lifecycle.ViewModelProviders; | |
| import android.os.Bundle; | |
| import android.support.annotation.Nullable; | |
| import android.widget.Toast; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.arch.lifecycle.LiveData; | |
| import android.arch.lifecycle.ViewModel; | |
| import java.util.List; | |
| /** | |
| * Created by rosariopfernandes on 6/9/17. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Created by rosariopfernandes on 6/9/17. | |
| */ | |
| public class Tarefa { | |
| private int id; | |
| private String titulo; | |
| private String tarefa; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.arch.lifecycle.Lifecycle; | |
| import android.arch.lifecycle.LifecycleOwner; | |
| import android.arch.lifecycle.LifecycleObserver; | |
| import android.arch.lifecycle.OnLifecycleEvent; | |
| import android.os.Bundle; | |
| import android.widget.Toast; | |
| public class MainActivity extends AppCompatActivity implements LifecycleOwner { | |
| @Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| const functions = require('firebase-functions');//Importar o Cloud Functions | |
| const Filter = require('bad-words'); //Importar o Bad words | |
| const badWordsFilter = new Filter(['merda','qualquer','palavrão']);//Criar um novo filtro do Bad words | |
| // Função para limpar a base de dados removendo palavrões | |
| exports.limpezaManutencao = functions.database | |
| .ref('/msgs/{Id}').onWrite(event => { | |
| const mensagem = event.data.val(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "msgs":{ | |
| "id123":{ | |
| "texto":"Olá Rosário", | |
| }, | |
| "id456":{ | |
| "texto":"Viste a merda que aconteceu?", | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "functions", | |
| "description": "Firebase Cloud Functions - Limpeza e manutençao da bd", | |
| "dependencies": { | |
| "bad-words": "^1.3.1", | |
| "firebase-admin": "^4.1.1", | |
| "firebase-functions": "^0.5.1" | |
| } | |
| } |