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 #213 from ES2-UFPI/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
sosolidkk authored Jun 18, 2019
2 parents a2f6772 + cb05ba6 commit fb7ffe8
Show file tree
Hide file tree
Showing 82 changed files with 4,005 additions and 711 deletions.
11 changes: 0 additions & 11 deletions App.js

This file was deleted.

40 changes: 40 additions & 0 deletions PRIVACY-POLICY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Privacy Policy

[["We" or "I", or Website or App name]] takes your privacy seriously. To better protect your privacy [["we" or "I"]] provide this privacy policy notice explaining the way your personal information is collected and used.


## Collection of Routine Information

This [["website" or "app"]] track basic information about their [["visitors" or "users"]]. This information includes, but is not limited to, IP addresses, [["browser" or "app"]] details, timestamps and referring pages. None of this information can personally identify specific [["visitors" or "user"]] to this [["website" or "app"]]. The information is tracked for routine administration and maintenance purposes.


## Cookies

Where necessary, this [["website" or "app"]] uses cookies to store information about a visitor’s preferences and history in order to better serve the [["visitor" or "user"]] and/or present the [["visitor" or "user"]] with customized content.


## Advertisement and Other Third Parties

Advertising partners and other third parties may use cookies, scripts and/or web beacons to track [["visitors" or "user"]] activities on this [["website" or "app"]] in order to display advertisements and other useful information. Such tracking is done directly by the third parties through their own servers and is subject to their own privacy policies. This [["website" or "app"]] has no access or control over these cookies, scripts and/or web beacons that may be used by third parties. Learn how to [opt out of Google’s cookie usage](http://www.google.com/privacy_ads.html).


## Links to Third Party Websites

[["We" or "I"]] have included links on this [["website" or "app"]] for your use and reference. [["We" or "I"]] are not responsible for the privacy policies on these websites. You should be aware that the privacy policies of these websites may differ from [["our" or "my"]] own.


## Security

The security of your personal information is important to [["us" or "me"]], but remember that no method of transmission over the Internet, or method of electronic storage, is 100% secure. While [["we" or "I"]] strive to use commercially acceptable means to protect your personal information, [["we" or "I"]] cannot guarantee its absolute security.


## Changes To This Privacy Policy

This Privacy Policy is effective as of [[Date]] and will remain in effect except with respect to any changes in its provisions in the future, which will be in effect immediately after being posted on this page.

[["We" or "I"]] reserve the right to update or change [["our" or "my"]] Privacy Policy at any time and you should check this Privacy Policy periodically. If [["we" or "I"]] make any material changes to this Privacy Policy, [["we" or "I"]] will notify you either through the email address you have provided [["us" or "me"]], or by placing a prominent notice on [["our" or "my"]] [["website" or "app"]].


## Contact Information

For any questions or concerns regarding the privacy policy, please send [["us" or "me"]] an email to [[Contact Email Address]].
1 change: 1 addition & 0 deletions __mocks__/@react-native-community/async-storage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default from "@react-native-community/async-storage/jest/async-storage-mock"
96 changes: 96 additions & 0 deletions __mocks__/react-native-firebase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/* eslint-disable */

"use strict"

export class Database {
ref = path => {
if (!this[path]) {
this[path] = new Reference(path)
}
return this[path]
}
}

export class Reference {
constructor(path) {
this.path = path
this.snap = { val: () => this._val() }
this.data = null
}

_val = jest.fn(() => {
return this.data
})

once = jest.fn((param, callback) => {
const promise = new Promise((resolve, reject) => {
if (callback) {
callback(this.snap)
resolve()
} else {
resolve(this.snap)
}
})
RNFirebase.promises.push(promise)
return promise
})

on = jest.fn((param, callback) => {
const promise = new Promise((resolve, reject) => {
if (callback) {
callback(this.snap)
resolve()
} else {
resolve(this.snap)
}
})
RNFirebase.promises.push(promise)
return promise
})

off = jest.fn((param, callback) => {
const promise = Promise.resolve()
RNFirebase.promises.push(promise)
return promise
})

update = jest.fn(data => {
const promise = Promise.resolve()
RNFirebase.promises.push(promise)
return promise
})

remove = jest.fn(() => {
const promise = Promise.resolve()
RNFirebase.promises.push(promise)
return promise
})
}

export class MockFirebase {
constructor() {
this.database = () => {
if (!this.databaseInstance) {
this.databaseInstance = new Database()
}
return this.databaseInstance
}
}
}

export default class RNFirebase {
static initializeApp() {
RNFirebase.firebase = new MockFirebase()
RNFirebase.promises = []
return RNFirebase.firebase
}

static reset() {
RNFirebase.promises = []
RNFirebase.firebase.databaseInstance = null
}

static waitForPromises() {
return Promise.all(RNFirebase.promises)
}
}
13 changes: 0 additions & 13 deletions __tests__/App-test.js

This file was deleted.

31 changes: 31 additions & 0 deletions __tests__/aboutScreen.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react"
import { View, Text, TouchableOpacity, ScrollView, Image } from "react-native"
import { shallow } from "enzyme"
import About from "~/Screens/About/about"
import AboutHeader from "~/Components/About/aboutHeader"

describe("rendering", () => {
let wrapper
beforeEach(() => {
wrapper = shallow(<About />)
})

it("should render 5 text components", () => {
expect(wrapper.find(Text)).toHaveLength(5)
})
it("should render 3 views components", () => {
expect(wrapper.find(View)).toHaveLength(3)
})
it("should render 1 scrollview component", () => {
expect(wrapper.find(ScrollView)).toHaveLength(1)
})
it("should render 1 touchableopacity component", () => {
expect(wrapper.find(TouchableOpacity)).toHaveLength(1)
})
it("should render 1 image component", () => {
expect(wrapper.find(Image)).toHaveLength(1)
})
it("should render AboutHeader component", () => {
expect(wrapper.find(AboutHeader)).toHaveLength(1)
})
})
20 changes: 20 additions & 0 deletions __tests__/createGroup.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react"
import { shallow } from "enzyme"
import { Avatar, Overlay } from "react-native-elements"
import CreateGroup from "../src/Screens/CreateGroup/CreateGroup"

describe("rendering", () => {
let wrapper
beforeEach(() => {
wrapper = shallow(<CreateGroup />)
})
it("should render a overlay", () => {
expect(wrapper.find(Overlay)).toHaveLength(1)
})
it("should render a textInput", () => {
expect(wrapper.find("TextInput")).toHaveLength(1)
})
it("should render a avatar placeholder", () => {
expect(wrapper.find(Avatar)).toHaveLength(1)
})
})
39 changes: 39 additions & 0 deletions __tests__/feedback.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from "react"
import { shallow } from "enzyme"
import Touchable from "react-native-platform-touchable"
import { Icon } from "react-native-elements"
import Feedback from "../src/Screens/Feedback/feedback"

describe("rendering", () => {
let wrapper
beforeEach(() => {
wrapper = shallow(<Feedback />)
})
it("Deveria renderizar 5 Views", () => {
expect(wrapper.find("View")).toHaveLength(5)
})
it("Deveria renderizar 1 StatusBar", () => {
expect(wrapper.find("StatusBar")).toHaveLength(1)
})
it("Deveria renderizar 1 Icon", () => {
expect(wrapper.find(Icon)).toHaveLength(1)
})
it("Deveria renderizar 2 LinearGradient", () => {
expect(wrapper.find("LinearGradient")).toHaveLength(2)
})
it("Deveria renderizar 1 Touchable", () => {
expect(wrapper.find(Touchable)).toHaveLength(1)
})
it("Deveria renderizar 1 TouchableWithoutFeedback", () => {
expect(wrapper.find("TouchableWithoutFeedback")).toHaveLength(1)
})
it("Deveria renderizar 1 TouchableOpacity", () => {
expect(wrapper.find("TouchableOpacity")).toHaveLength(1)
})
it("Deveria renderizar 4 Text", () => {
expect(wrapper.find("Text")).toHaveLength(4)
})
it("Deveria renderizar 1 TextInput", () => {
expect(wrapper.find("TextInput")).toHaveLength(1)
})
})
10 changes: 8 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,23 @@
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:icon="@drawable/icon"
android:allowBackup="false"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/logo_notification" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/notification_color" />
<service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="io.invertase.firebase.messaging.RNFirebaseBackgroundMessagingService" />
<activity
android:screenOrientation="portrait"
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
Expand Down
25 changes: 23 additions & 2 deletions android/app/src/main/java/com/unichat/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
package com.unichat;

import com.facebook.react.ReactActivity;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.graphics.Color;

public class MainActivity extends ReactActivity {

/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
* Returns the name of the main component registered from JavaScript. This is
* used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "Unichat";
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Set the Android background to white after 8 seconds
// to fix the splashscreen flash when the keyboard is shown
new CountDownTimer(8000, 1000) {

public void onTick(long millisUntilFinished) {
}

public void onFinish() {
getWindow().getDecorView().setBackgroundColor(Color.WHITE);
}

}.start();
}
}
Binary file added android/app/src/main/res/drawable-hdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/src/main/res/drawable-ldpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/src/main/res/drawable-mdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/src/main/res/drawable-xhdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions android/app/src/main/res/drawable/background_splash.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/primary" />
<item
android:width="200dp"
android:height="200dp"
android:drawable="@drawable/logo"
android:gravity="center"
/>
</layer-list>
Binary file added android/app/src/main/res/drawable/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/src/main/res/drawable/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Binary file removed android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions android/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<color name="primary">#FFF</color>
<color name="notification_color">#007AFF</color>
</resources>
2 changes: 2 additions & 0 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:windowBackground">@drawable/background_splash</item>
<item name="android:statusBarColor">@color/primary</item>
</style>

</resources>
17 changes: 11 additions & 6 deletions functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ return (exports.sendPushNotification = functions.firestore
},
notification: {
title: contactName,
body: contentTranslated,
body: content,
sound: "default",
android_channel_id: "main-channel",
collapseKey: "unichat",
group: "unichat"
priority: "high",
icon: "logo_notification",
android_channel_id: "unichat",
large_icon: "logo_notification",
show_in_foreground: "true",
content_available: "true"
}
}

Expand All @@ -45,8 +48,10 @@ return (exports.sendPushNotification = functions.firestore
.doc(userId)
.get()
.then(doc => {
const { pushToken } = doc.data()
return admin.messaging().sendToDevice(pushToken, payload)
const { pushToken, notifications } = doc.data()
if (notifications)
return admin.messaging().sendToDevice(pushToken, payload)
else return null
})
}
}))
6 changes: 6 additions & 0 deletions jest/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Enzyme from "enzyme"
import Adapter from "enzyme-adapter-react-16"
import mockAsyncStorage from "@react-native-community/async-storage/jest/async-storage-mock"

Enzyme.configure({ adapter: new Adapter() })
jest.mock("@react-native-community/async-storage", () => mockAsyncStorage)
Loading

0 comments on commit fb7ffe8

Please sign in to comment.