From 28a4eeced05577fd6b2734e3f17df3d1a2e2543c Mon Sep 17 00:00:00 2001 From: Petro Cardoso Date: Sun, 28 Jun 2020 22:39:51 -0300 Subject: [PATCH] =?UTF-8?q?:android:=20Redu=C3=A7=C3=A3o=20no=20tamanho=20?= =?UTF-8?q?do=20APK=20de=2010mb=20para=207mb=20:android:=20Proguard=20e=20?= =?UTF-8?q?Hermes=20habilitados=20:zap:=20Melhorias=20de=20performance=20d?= =?UTF-8?q?evido=20ao=20Hermes=20:fire:=20Removido=20RefreshControl=20do?= =?UTF-8?q?=20Card=C3=A1pio=20:truck:=20Reescrita=20de=20diversos=20compon?= =?UTF-8?q?entes=20:lipstick:=20Melhoria=20visual=20nos=20avisos=20de=20er?= =?UTF-8?q?ro=20:bookmark:=20Vers=C3=A3o=201.03?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- android/app/build.gradle | 9 +++++---- android/app/proguard-rules.pro | 3 +++ package.json | 2 +- src/components/Errors.js | 15 ++++++++++----- src/components/Footer.js | 3 ++- src/components/Header.js | 33 ++++++++++++++------------------- src/components/carousel.js | 1 + src/pages/Main/index.js | 34 +++++++++++++++++----------------- src/pages/Main/styles.js | 16 ++++++++-------- 10 files changed, 62 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 3de931a..0672e35 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Logo do Cardápio Mobile UERJ

Cardápio Mobile UERJ

-Atual versão do Cardápio Mobile UERJ. +Atual versão do Cardápio Mobile UERJ. Cardápio Mobile UERJ está sob a licença APACHE. diff --git a/android/app/build.gradle b/android/app/build.gradle index c5edfe4..94e4766 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -78,7 +78,7 @@ import com.android.build.OutputFile */ project.ext.react = [ - enableHermes: false, // clean and rebuild if changing + enableHermes: true, // clean and rebuild if changing ] apply from: "../../node_modules/react-native/react.gradle" @@ -96,7 +96,7 @@ def enableSeparateBuildPerCPUArchitecture = true /** * Run Proguard to shrink the Java bytecode in release builds. */ -def enableProguardInReleaseBuilds = false +def enableProguardInReleaseBuilds = true /** * The preferred build flavor of JavaScriptCore. @@ -132,8 +132,8 @@ android { applicationId "com.cardapiomobileuerj" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 3 - versionName "1.02" + versionCode 4 + versionName "1.03" project.ext.set("archivesBaseName", "cardapio-mobile-uerj-" + defaultConfig.versionName); } splits { @@ -169,6 +169,7 @@ android { // Caution! In production, you need to generate your own keystore file. // see https://facebook.github.io/react-native/docs/signed-apk-android. minifyEnabled enableProguardInReleaseBuilds + shrinkResources enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index 11b0257..fb4140f 100644 --- a/android/app/proguard-rules.pro +++ b/android/app/proguard-rules.pro @@ -8,3 +8,6 @@ # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: +-keep class com.facebook.hermes.unicode.** { *; } +-keep class com.facebook.jni.** { *; } +-keep public class com.horcrux.svg.** {*;} \ No newline at end of file diff --git a/package.json b/package.json index e76de5a..65fd0d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cardapioMobileUerj", - "version": "1.0.0", + "version": "1.03", "author": "Petro Cardoso", "license": "Apache", "private": true, diff --git a/src/components/Errors.js b/src/components/Errors.js index acc36f9..1961111 100644 --- a/src/components/Errors.js +++ b/src/components/Errors.js @@ -19,11 +19,16 @@ const Title = styled.Text` const Column = styled.View` flex: 1; padding: 2%; - margin-top: ${props => (props.margin ? props.margin : 0)}%; - align-items: center; + align-self: center; justify-content: flex-end; `; +const Refresh = styled.TouchableOpacity` + flex: 1; + background-color: #016ba5; + margin-top: 50%; +`; + const Text = styled.Text` font-size: ${Responsive(14)}px; font-weight: bold; @@ -52,10 +57,10 @@ export const ParseErrorHeader = () => ( ); -export const NetworkErrorView = () => ( - +export const NetworkErrorView = props => ( + props.getCardapio()}> Ops... Ocorreu um erro :( {'\n'}Sem conexão disponível. - + ); diff --git a/src/components/Footer.js b/src/components/Footer.js index b697b98..89e6f25 100644 --- a/src/components/Footer.js +++ b/src/components/Footer.js @@ -26,8 +26,9 @@ AccessibilityInfo.isScreenReaderEnabled().then(res => { AccessibilityIsOn = res; }); +const FooterView = Animated.createAnimatedComponent(FooterV); + const Footer = props => { - const FooterView = Animated.createAnimatedComponent(FooterV); return ( { useEffect(() => {}, [props.offline, props.parseError]); return ( - + <> { ]}> {props.loading && } {props.parseError ? ( - + ) : ( { <Text>Você está offline</Text> </RowAbsolute> )} - </Background> + </> ); }; diff --git a/src/components/carousel.js b/src/components/carousel.js index f2cf6ad..ee645e0 100644 --- a/src/components/carousel.js +++ b/src/components/carousel.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import { Animated } from 'react-native'; import Carousel from 'react-native-snap-carousel'; import { Container, diff --git a/src/pages/Main/index.js b/src/pages/Main/index.js index 267c8b6..ba365ee 100644 --- a/src/pages/Main/index.js +++ b/src/pages/Main/index.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import { RefreshControl, StatusBar, Animated } from 'react-native'; +import { StatusBar, Animated } from 'react-native'; import AsyncStorage from '@react-native-community/async-storage'; const cheerio = require('react-native-cheerio'); import { RUapi } from '../../services/axios'; @@ -12,9 +12,8 @@ import About from '../../components/About'; import { ParseErrorView, NetworkErrorView } from '../../components/Errors'; import Header from '../../components/Header'; -import { Refresh, Loading, Background } from './styles'; - -const CardapioView = Animated.createAnimatedComponent(Refresh); +import { Loading, Background, View } from './styles'; +const CardapioView = Animated.createAnimatedComponent(View); export default class Main extends Component { state = { @@ -235,39 +234,40 @@ export default class Main extends Component { return ( <Background> <StatusBar backgroundColor={this.state.about ? '#eaeaea' : '#0080c6'} /> + <About + visible={this.state.about} + setState={state => this.setState(state)} + /> <Header parseError={this.state.parseError} offline={this.state.offline} - getCardapio={this.getCardapio} loading={this.state.loading} height={this.state.headerHeight} /> - <About - visible={this.state.about} - setState={state => this.setState(state)} - /> + <CardapioView accessible={false} importantForAccessibility={'no'} - refreshControl={ - <RefreshControl - refreshing={false} - onRefresh={() => this.getCardapio()} - /> - } style={[ { translateY: this.state.menuHeight, }, ]}> {this.state.networkError && !this.state.offine ? ( - <NetworkErrorView /> + <NetworkErrorView + getCardapio={this.getCardapio} + menuHeight={this.state.menuHeight} + /> ) : this.state.parseError ? ( <ParseErrorView /> ) : this.state.loading ? ( <Loading size={Responsive(60)} color="#fff" /> ) : ( - <CarouselView data={this.state.data} /> + <CarouselView + data={this.state.data} + getCardapio={this.getCardapio} + menuHeight={this.state.menuHeight} + /> )} </CardapioView> <Footer diff --git a/src/pages/Main/styles.js b/src/pages/Main/styles.js index ea4186e..4b6b974 100644 --- a/src/pages/Main/styles.js +++ b/src/pages/Main/styles.js @@ -1,13 +1,5 @@ import styled from 'styled-components/native'; -export const Refresh = styled.ScrollView` - background-color: #016ba5; - border-bottom-left-radius: 40px; - border-bottom-right-radius: 40px; - elevation: 6; - z-index: 2; -`; - export const Loading = styled.ActivityIndicator` margin-top: 50%; `; @@ -16,3 +8,11 @@ export const Background = styled.View` flex: 1; background-color: #01507c; `; + +export const View = styled.ScrollView` + flex: 1; + border-bottom-left-radius: 40px; + border-bottom-right-radius: 40px; + background-color: #016ba5; + elevation: 6; +`;