Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configura app para build e release no app center (Android) #24

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ module.exports = {
singleQuote: true,
trailingComma: 'all',
arrowParens: 'avoid',
tabWidth: 4,
tabWidth: 2,
};
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@
Aplicativo desenvolvido para controle de constantes, manuseio e testagem do robô seguidor de linha Tracer.

Será desenvolvido em React-Native...

## 📱 Geração de versão de release

Para gerar a versão de release basta rodar:

```bash
npm run android-release
```

Esse comando irá abrir no simulador uma versão release do aplicativo e o arquivo `.apk` estará disponível na pasta `android/app/build/outputs/apk/release`. Esse arquivo pode ser usado no App center para gerar uma versão do app.
3 changes: 3 additions & 0 deletions android/app/src/main/assets/appcenter-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"app_secret": "a3eb4fac-ad1b-4ae6-bad8-9f1a2b324e44"
}
2 changes: 2 additions & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<resources>
<string name="app_name">MoniTracer</string>
<string name="appCenterCrashes_whenToSendCrashes" moduleConfig="true" translatable="false">DO_NOT_ASK_JAVASCRIPT</string>
<string name="appCenterAnalytics_whenToEnableAnalytics" moduleConfig="true" translatable="false">ALWAYS_SEND</string>
</resources>
18 changes: 14 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ buildscript {
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
Expand All @@ -36,5 +32,19 @@ allprojects {
google()
jcenter()
maven { url 'https://www.jitpack.io' }
exclusiveContent {
// We get React Native's Android binaries exclusively through npm,
// from a local Maven repo inside node_modules/react-native/.
// (The use of exclusiveContent prevents looking elsewhere like Maven Central
// and potentially getting a wrong version.)
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
}
}
207 changes: 207 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
"private": true,
"scripts": {
"android": "react-native run-android",
"android-release": "react-native run-android --variant=release",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
"lint": "eslint . --fix"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.17.5",
"@react-navigation/bottom-tabs": "^6.0.5",
"@react-navigation/native": "^6.0.2",
"@react-navigation/native-stack": "^6.2.2",
"appcenter": "4.4.4",
"appcenter-analytics": "4.4.4",
"appcenter-crashes": "4.4.4",
"axios": "^0.21.1",
"buffer": "^6.0.3",
"react": "17.0.1",
Expand Down
9 changes: 6 additions & 3 deletions src/AppPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ function MyTabs() {
tabBarActiveTintColor: COLORS.thunderWhite,
tabBarInactiveTintColor: COLORS.gray3,

tabBarButton: ['HomePage', 'BluetoothListPage','TestServerPage'].includes(route.name)
tabBarButton: [
'HomePage',
'BluetoothListPage',
'TestServerPage',
].includes(route.name)
? () => {
return null; //Dont show "Home" and "BluetoothListPage" in the bottom tabs (but it is still possible to navigate to them):
}
Expand All @@ -127,8 +131,7 @@ function MyTabs() {

return <Ionicons name={iconName} size={size} color={color} />;
},
})}
>
})}>
{pagesArray.map((element, index) => {
return (
<Tab.Screen
Expand Down
2 changes: 1 addition & 1 deletion src/SplashScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const styles = StyleSheet.create({
width: 150,
height: 260,
margin: 100,
resizeMode: "center",
resizeMode: 'center',
},
container: {
flex: 1,
Expand Down
26 changes: 13 additions & 13 deletions src/async_storage/async_storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import AsyncStorage from '@react-native-async-storage/async-storage';

const CONSTANTS_TOKEN = 'ConstantsList';

export const storeConstants = async (constants) => {
try {
await AsyncStorage.setItem(CONSTANTS_TOKEN,JSON.stringify(constants));
} catch (error) {
console.log(error);
}
export const storeConstants = async constants => {
try {
await AsyncStorage.setItem(CONSTANTS_TOKEN, JSON.stringify(constants));
} catch (error) {
console.log(error);
}
};

export const getConstants = async () => {
try {
const constants = await AsyncStorage.getItem(CONSTANTS_TOKEN);
return JSON.parse(constants);
} catch (error) {
return null;
}
};
try {
const constants = await AsyncStorage.getItem(CONSTANTS_TOKEN);
return JSON.parse(constants);
} catch (error) {
return null;
}
};
Loading