Skip to content

Commit

Permalink
perf(app): various minor improvements for 0.10 (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert27 authored Oct 19, 2024
1 parent f85d292 commit cd6d11a
Show file tree
Hide file tree
Showing 27 changed files with 151 additions and 117 deletions.
142 changes: 71 additions & 71 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,85 +9,85 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '19 20 * * 3'
push:
branches: ['main']
pull_request:
branches: ['main']
schedule:
- cron: '19 20 * * 3'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
# required for all workflows
security-events: write
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read
# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read
# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
- language: javascript-typescript
build-mode: none
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4
strategy:
fail-fast: false
matrix:
include:
- language: javascript-typescript
build-mode: none
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: '/language:${{matrix.language}}'
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: CI ESLint
on:
push:
branches: [develop, main]
Expand All @@ -13,6 +13,6 @@ jobs:
bun-version: latest
- uses: actions/checkout@v4
- name: Install modules
run: bun install
run: bun install --frozen-lockfile
- name: Run ESLint
run: bunx eslint . --ext .js,.jsx,.ts,.tsx
18 changes: 18 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Prettier
on:
push:
branches: [develop, main]
pull_request:
branches: [develop, main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/checkout@v4
- name: Install modules
run: bun install --frozen-lockfile
- name: Run Prettier
run: bunx prettier . --check
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package.json
ios/
android/
android/
node_modules/
docs/.vitepress/
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ android {
applicationId 'app.neuland'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 175
versionCode 177
versionName "0.10.0"
}
signingConfigs {
Expand Down
2 changes: 1 addition & 1 deletion app.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"android": {
"package": "app.neuland",
"userInterfaceStyle": "automatic",
"versionCode": 175,
"versionCode": 177,
"splash": {
"image": "./src/assets/splash/splashLight.png",
"resizeMode": "contain",
Expand Down
4 changes: 3 additions & 1 deletion docs/components/StoreLinksDe.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<template>
<div class="links" id="links">
<a href="https://apps.apple.com/app/apple-store/id1617096811?pt=124486931&ct=web&mt=8">
<a
href="https://apps.apple.com/app/apple-store/id1617096811?pt=124486931&ct=web&mt=8"
>
<img alt="Download on the App Store" src="/assets/Apple_Badge_DE.svg" />
</a>
<a href="https://play.google.com/store/apps/details?id=app.neuland">
Expand Down
4 changes: 3 additions & 1 deletion docs/components/StoreLinksEn.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<template>
<div class="links" id="links">
<a href="https://apps.apple.com/app/apple-store/id1617096811?pt=124486931&ct=web&mt=8">
<a
href="https://apps.apple.com/app/apple-store/id1617096811?pt=124486931&ct=web&mt=8"
>
<img alt="Download on the App Store" src="/assets/Apple_Badge_EN.svg" />
</a>
<a href="https://play.google.com/store/apps/details?id=app.neuland">
Expand Down
2 changes: 1 addition & 1 deletion docs/de/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ features:
- title: Bibliothek
icon: 📚
details: Reserviere einen Platz direkt in der App oder nutze deinen Bibliotheksausweis, um Bücher an den Terminals auszuleihen.
---
---
2 changes: 1 addition & 1 deletion docs/de/legal/imprint.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Registergericht: Amtsgericht Ingolstadt\
Registernummer: VR 201088

Vertreten durch: Alexander Horn, Timo Weese, Paulina Mair\
Inhaltlich verantwortlich: Alexander Horn
Inhaltlich verantwortlich: Alexander Horn
2 changes: 0 additions & 2 deletions docs/de/legal/privacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ Die Rechtsgrundlage ist Art 6 Abs 1 Zif b DSGVO.

Von der App zwischengespeicherte personenbezogene Daten können jederzeit entweder durch das Abmelden oder das Schließen der App und Löschen der Website- /Appdaten gelöscht werden.



## PRIMUSS Zugangsdaten

Die Zugangsdaten des Nutzers zum PRIMUSS Portal werden von der Neuland App zwischen-gespeichert.
Expand Down
2 changes: 0 additions & 2 deletions docs/en/legal/privacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ Die Rechtsgrundlage ist Art 6 Abs 1 Zif b DSGVO.

Von der App zwischengespeicherte personenbezogene Daten können jederzeit entweder durch das Abmelden oder das Schließen der App und Löschen der Website- /Appdaten gelöscht werden.



## PRIMUSS Zugangsdaten

Die Zugangsdaten des Nutzers zum PRIMUSS Portal werden von der Neuland App zwischen-gespeichert.
Expand Down
3 changes: 2 additions & 1 deletion docs/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const app = express();
app.use(
express.static(path.resolve(__dirname, ".vitepress", "dist"), {
extensions: ["html"],
}));
}),
);

const PORT = 8080;
app.listen(PORT, () => {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx,json,yml, md}": [
"npx prettier --write"
"bunx prettier --write"
],
"*.{js,jsx,ts,tsx}": [
"npx eslint --fix"
"bunx eslint --fix"
]
},
"expo": {
Expand Down
2 changes: 1 addition & 1 deletion src/api/neuland-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { gql, request } from 'graphql-request'

import packageInfo from '../../package.json'

const GRAPHQL_ENDPOINT: string = 'https://api.dev.neuland.app/graphql'
const GRAPHQL_ENDPOINT: string = 'https://api.neuland.app/graphql'
const ASSET_ENDPOINT: string = 'https://assets.neuland.app'
const USER_AGENT = `neuland.app-native/${packageInfo.version} (+${packageInfo.homepage})`

Expand Down
31 changes: 20 additions & 11 deletions src/app/(screens)/changelog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,38 @@ import { Linking, ScrollView, StyleSheet, Text, View } from 'react-native'

export default function Theme(): JSX.Element {
const colors = useTheme().colors as Colors
const changelog: Changelog = changelogData
const changelog = changelogData as Changelog
const { t, i18n } = useTranslation(['settings'])
const sorted = {
const sorted: Changelog = {
version: Object.keys(changelog.version)
.sort((a, b) => Number(b) - Number(a))
.sort((a, b) => {
const [aParts, bParts] = [a, b].map((v) =>
v.split('.').map(Number)
)
for (
let i = 0;
i < Math.max(aParts.length, bParts.length);
i++
) {
const [aPart, bPart] = [aParts[i] ?? 0, bParts[i] ?? 0]
if (aPart !== bPart) return bPart - aPart
}
return 0
})
.reduce(
(
obj: Record<string, (typeof changelog.version)[string]>,
key
) => {
obj[key] = changelog.version[key]
return obj
},
(obj, key) => ({ ...obj, [key]: changelog.version[key] }),
{}
),
}

console.log(sorted)

const sections: FormListSections[] = [
...Object.keys(sorted.version).map((key) => ({
header: `Version ${key}`,
items: sorted.version[key].map((item) => ({
title: item.title[i18n.language as LanguageKey],
icon: item.icon as any,
icon: item.icon,
})),
})),
]
Expand Down
2 changes: 1 addition & 1 deletion src/app/(screens)/lecturer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default function LecturerDetail(): JSX.Element {
disabled: validEmail,
layout: validEmail ? 'column' : 'row',
iconColor:
lecturer?.email.includes('@') ?? false
(lecturer?.email.includes('@') ?? false)
? colors.primary
: undefined,
onPress: () => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/(screens)/libraryCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export default function LibraryCode(): JSX.Element {
title={
isError
? // @ts-expect-error error is type never
error?.message ?? t('error.title')
(error?.message ?? t('error.title'))
: t('error.title')
}
onRefresh={refetchByUser}
Expand Down
Loading

0 comments on commit cd6d11a

Please sign in to comment.