Skip to content

Commit

Permalink
Merge pull request #135 from fga-eps-mds/dev
Browse files Browse the repository at this point in the history
Upadte production
  • Loading branch information
zarbielli authored Nov 25, 2018
2 parents ce54d29 + 2496084 commit a71c883
Show file tree
Hide file tree
Showing 149 changed files with 12,660 additions and 1,460 deletions.
3 changes: 3 additions & 0 deletions .expo/packager-info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"devToolsPort": 19002
}
7 changes: 7 additions & 0 deletions .expo/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"hostType": "lan",
"lanType": "ip",
"dev": true,
"minify": false,
"urlRandomness": null
}
File renamed without changes.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.env
.env*
*.env
Config.js

# Xcode
!**/*.xcodeproj
Expand Down Expand Up @@ -72,4 +73,5 @@ package-lock.json

# ReactCommon subdir shouldn't have Xcode project
/ReactCommon/**/*.xcodeproj
RNTester/build
RNTester/build
mobile/screens/tab_navigator/roles/screens/TabNavigator/cadastroEventos/Config.js
19 changes: 15 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# .travis.yml

stages:
- test
- gh-pages
- deploy

jobs:
include:
- stage: test
name: "Running Tests"
language: node_js
node_js:
- '9.3'
Expand All @@ -14,7 +20,8 @@ jobs:
directories:
- ./mobile/node_modules

- stage: deploy gh-pages
- stage: gh-pages
name: "Deploying github pages"
if: branch = master
sudo: required
language: node_js
Expand All @@ -34,23 +41,27 @@ jobs:
- echo "GH_TOKEN=${GH_TOKEN}" >> docs/.env
- docker run -v `pwd`:"/app" -w "/app" --env-file docs/.env lucascst/gh-pages-docker-travis bash -c "cd docs; sh publish.sh"

- stage: production deploy
if: branch = master AND (NOT type = pull_request)
- stage: deploy
name: "Deploying to production"
if: branch = master
node_js:
- '9.3'
script:
- cd mobile
- bash setup-config.sh production
- cp config/app-production.json app.json
- yarn add expo-cli
- yarn expo login -u $EXPO_USERNAME -p $EXPO_PASSWORD
- yarn expo publish --non-interactive

- stage: homologation deploy
- stage: deploy
name: "Deploying to staging"
if: branch = dev
node_js:
- '9.3'
script:
- cd mobile
- bash setup-config.sh staging
- cp config/app-development.json app.json
- yarn add expo-cli
- yarn expo login -u $EXPO_USERNAME -p $EXPO_PASSWORD
Expand Down
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
default:
make build $(IP)
make run
python get-ip-address.py $(IP)
make build
make run $(IP)

build:
python get-ip-address.py $(IP)
docker-compose up -d
docker-compose build

run:
python get-ip-address.py $(IP)
docker-compose up -d
docker-compose exec front bash -c "yarn; bash"

down:
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[![Maintainability](https://api.codeclimate.com/v1/badges/9f8f416c478c348e9dd3/maintainability)](https://codeclimate.com/github/fga-eps-mds/2018.2-FGAPP-FrontEnd/maintainability)

# Integra APP
An application developed by university students, for university students.

[Download the application here!](https://play.google.com/store/apps/details?id=com.unbgama.integra)

You can also test the beta of the application by registering for this link: [https://play.google.com/apps/testing/com.unbgama.integra](https://play.google.com/apps/testing/com.unbgama.integra)

## Requirements
This projects needs some requirements that need to be downloaded.
Expand Down
17 changes: 0 additions & 17 deletions api-mock/.env

This file was deleted.

4 changes: 3 additions & 1 deletion mobile/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,6 @@ package-lock.json

# ReactCommon subdir shouldn't have Xcode project
/ReactCommon/**/*.xcodeproj
RNTester/build
RNTester/build

env-config.js
Binary file removed mobile/.package.json.swp
Binary file not shown.
107 changes: 85 additions & 22 deletions mobile/App.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,104 @@
import * as React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { StyleSheet, Text, View, StatusBar, Platform, BackHandler } from 'react-native';

import {StackNavigator} from 'react-navigation'

import WelcomeScreen from './screens/WelcomeScreen'
import LoginScreen from './screens/LoginScreen'
import SignUpScreen from './screens/SignUpScreen'
import TabHandler from './screens/TabHandler'
import { Notifications, Permissions, Constants } from 'expo';

import { Provider } from 'react-redux';
import { createStore } from 'redux';
import rootReducers from './screens/tab_navigator/indica_ai/reducers';

const store = createStore(rootReducers)

// Importing config variables
require('./env-config');

export default class App extends React.Component<{}> {

async componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', this.handleBackButton);

const localNotification = {
title: 'Confira os produtos próximos de você.',
body: 'Clique para ver ofertas',
ios: { // (optional) (object) — notification configuration specific to iOS.
sound: true,
},
android:{
sound: true,
icon: 'https://res.cloudinary.com/integraappfga/image/upload/v1542241278/IntegraApps_icon.png',
color: '#1CBD24',
priority: 'low', // (optional) (min | low | high | max) — android may present notifications according to the priority, for example a high priority notification will likely to be shown as a heads-up notification.
sticky: false, // (optional) (boolean) — if true, the notification will be sticky and not dismissable by user. The notification must be programmatically dismissed. Default: false.
vibrate: true, // (optional) (boolean or array) — if true, vibrate the device. An array can be supplied to specify the vibration pattern, e.g. - [ 0, 500 ].
// link (optional) (string) — external link to open when notification is selected.
}
};

let t = new Date();
if(t.getHours() >= 12 && t.getMinutes() > 30){
t.setDate(t.getDate()+1); // If it's past lunch time, wait a day
}
t.setHours(12, 30, 0, 0);

const schedulingOptions = {
time: t, // (date or number) — A Date object representing when to fire the notification or a number in Unix epoch time. Example: (new Date()).getTime() + 1000 is one second from now.
repeat: 'day',
};
let result = await Permissions.askAsync(Permissions.NOTIFICATIONS);
if (Constants.isDevice && result.status === 'granted') {
console.log('Notification permissions granted.');
Notifications.scheduleLocalNotificationAsync(localNotification, schedulingOptions);
}
else{
console.log('Notification permissions not granted.');
}
}

componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton);
}

handleBackButton() {
return true;
}

render() {
return (
< AppStackNavigator />
<Provider store={store}>
< AppStackNavigator/>
</Provider>
);
}
}

const AppStackNavigator = StackNavigator({

WelcomeScreen:{
screen:WelcomeScreen,
navigationOptions: ({ navigation }) => ({
header: null,
}),
},
LoginScreen:{
screen:LoginScreen
},
SignUpScreen:{
screen:SignUpScreen
},
TabHandler:{
screen:TabHandler,
navigationOptions: ({ navigation }) => ({
headerLeft: null,
}),
const AppStackNavigator = new StackNavigator({
LoginScreen:{
screen:LoginScreen,
navigationOptions: ({ navigation }) => ({
header: null,

}),
},
SignUpScreen:{
screen:SignUpScreen,
navigationOptions: {
headerStyle:{ position: 'absolute', backgroundColor: 'transparent', zIndex: 100, top: 0, left: 0, right: 0 },
headerTintColor: 'white',
}
},
TabHandler:{
screen:TabHandler
},
},
{
cardStyle: {
paddingTop: Platform.OS === 'ios' ? 0 : StatusBar.currentHeight
}
})

const styles = StyleSheet.create({
Expand Down
8 changes: 7 additions & 1 deletion mobile/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ FROM node:9.3.0-alpine
RUN mkdir /app
WORKDIR /app

RUN apk update && \
apk upgrade && \
apk add git

RUN apk add --no-cache bash
RUN npm install -g react-native-cli

ADD package.json package.json
ADD package.json package.json

RUN npm install -g expo expo-cli --loglevel=error
23 changes: 16 additions & 7 deletions mobile/app.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
{
"expo": {
"name": "Integra",
"icon": "assets/icon.png",
"splash": {
"image": "assets/splash.png",
"backgroundColor": "#BD1C5F"
"description": "Aplicativo de utilitários para a Faculdade do Gama, Universidade de Brasília.",
"githubUrl": "https://github.com/fga-eps-mds/2018.2-FGAPP-FrontEnd",
"orientation": "portrait",
"icon": "./assets/icon.png",
"notification": {
"icon": "./assets/icon.png"
},
"slug": "integra-app",
"sdkVersion": "27.0.0",
"primaryColor": "#BD1C5F",
"githubUrl": "https://github.com/fga-eps-mds/2018.2-FGAPP-FrontEnd",
"packagerOpts": {
"sourceExts": ["ts", "tsx"],
"transformer": "node_modules/react-native-typescript-transformer/index.js"
},
"android": {
"package": "com.unbgama.integra",
"version": "1.0.0",
"slug": "integra-app",
"android":{
"package":"com.unbgama.integra",
"versionCode": 3
}
},
"android": {
"package": "com.codingmechanic.mapcuny",
"config": {
"googleMaps": {"apiKey": "API-KEY-AQUI"}
}
}
}
Binary file added mobile/assets/IntegraApps_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions mobile/config/app-development.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"expo": {
"name": "Integra",
"name": "Integra BETA",
"icon": "assets/icon.png",
"splash": {
"image": "assets/splash.png",
"backgroundColor": "#BD1C5F"
},
"notification": {
"icon": "./assets/icon.png"
},
"slug": "integra-app",
"sdkVersion": "27.0.0",
"primaryColor": "#BD1C5F",
Expand All @@ -16,7 +19,12 @@
},
"android": {
"package": "com.unbgama.integra",
"versionCode": 3
"versionCode": 3,
"config": {
"googleMaps": {
"apiKey": "AIzaSyBtDGKIxbngjRePVN93YgE176CMKBKUgzI"
}
}
}
}
}
10 changes: 9 additions & 1 deletion mobile/config/app-production.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"image": "assets/splash.png",
"backgroundColor": "#BD1C5F"
},
"notification": {
"icon": "./assets/icon.png"
},
"slug": "integra-app",
"sdkVersion": "27.0.0",
"primaryColor": "#BD1C5F",
Expand All @@ -16,7 +19,12 @@
},
"android": {
"package": "com.unbgama.integra",
"versionCode": 2
"versionCode": 2,
"config": {
"googleMaps": {
"apiKey": "AIzaSyBtDGKIxbngjRePVN93YgE176CMKBKUgzI"
}
}
}
}
}
Loading

0 comments on commit a71c883

Please sign in to comment.