Compare commits

..

2 Commits

Author SHA1 Message Date
openstappsbot
1e82d3de1e refactor: update dependency androidx.test.ext:junit to v1.1.5 2023-07-24 09:05:45 +00:00
Rainer Killinger
81b4d28cc0 Resolve "Adapt App release template to monorepo changes" 2023-07-24 08:01:37 +00:00
237 changed files with 6009 additions and 3798 deletions

View File

@@ -1,5 +0,0 @@
---
'@openstapps/app': major
---
Update to Angular 16.1

View File

@@ -5,7 +5,7 @@
"fixed": [],
"linked": [["@openstapps/*"]],
"access": "restricted",
"baseBranch": "develop",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}

View File

@@ -14,6 +14,7 @@
"@openstapps/minimal-deployment": "2.0.0",
"@openstapps/minimal-plugin": "2.0.0",
"@openstapps/app": "2.0.0",
"@openstapps/app-release-template": "2.0.0",
"@openstapps/api": "2.0.0",
"@openstapps/api-cli": "2.0.0",
"@openstapps/api-plugin": "2.0.0",
@@ -23,13 +24,9 @@
"@openstapps/easy-ast": "2.0.0",
"@openstapps/es-mapping-generator": "2.0.0",
"@openstapps/gitlab-api": "2.0.0",
"@openstapps/logger": "2.0.0",
"@openstapps/app-builder-image": "3.0.0-next.3",
"@openstapps/node-base": "3.0.0-next.3",
"@openstapps/node-builder": "3.0.0-next.3"
"@openstapps/logger": "2.0.0"
},
"changesets": [
"bright-dryers-act",
"cool-jars-kiss",
"cuddly-bobcats-roll",
"dull-news-appear",
@@ -43,14 +40,9 @@
"moody-parrots-develop",
"neat-hats-trade",
"new-pianos-joke",
"pretty-timers-complain",
"proud-wolves-end",
"quick-houses-count",
"rare-squids-bake",
"serious-meals-sin",
"silent-maps-float",
"silly-news-punch",
"smart-ghosts-shout",
"soft-donuts-fail",
"sour-coins-visit",
"spicy-snails-sort",
@@ -59,7 +51,6 @@
"tall-ducks-dream",
"tame-mayflies-hug",
"tame-rings-dream",
"tasty-islands-smell",
"thick-weeks-compete",
"thin-camels-give",
"tidy-buses-reflect",

View File

@@ -1,29 +0,0 @@
---
'@openstapps/projectmanagement': patch
'@openstapps/prettier-config': patch
'@openstapps/es-mapping-generator': patch
'@openstapps/backend-config': patch
'@openstapps/eslint-config': patch
'@openstapps/minimal-deployment': patch
'@openstapps/minimal-connector': patch
'@openstapps/collection-utils': patch
'@openstapps/minimal-plugin': patch
'@openstapps/tsconfig': patch
'@openstapps/node-builder': patch
'@openstapps/api-plugin': patch
'@openstapps/core-tools': patch
'@openstapps/gitlab-api': patch
'@openstapps/app-builder-image': patch
'@openstapps/easy-ast': patch
'@openstapps/database': patch
'@openstapps/node-base': patch
'@openstapps/api-cli': patch
'@openstapps/backend': patch
'@openstapps/logger': patch
'@openstapps/proxy': patch
'@openstapps/core': patch
'@openstapps/app': patch
'@openstapps/api': patch
---
Update to TypeScript 5.1.6

View File

@@ -1,5 +0,0 @@
---
'@openstapps/app': patch
---
Migrate collection helpers to use @openstapps/collection-utils

View File

@@ -1,8 +0,0 @@
---
'@openstapps/app': minor
---
Migrate to Ionic 7
- Migrate uses of `<ion-label>` with inputs to new syntax
- Fix infinite loop in schedule date picker (`datetime.confirm()` to `datetime.cancel()`)

5
.gitignore vendored
View File

@@ -19,11 +19,6 @@ www/
coverage.xml
report-junit.xml
.deploy/
.venv/
# NixOS flake
result
hsperfdata_root
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

View File

@@ -7,18 +7,14 @@
# ```
# To your pipeline.
# https://docs.gitlab.com/ee/ci/pipelines/merge_request_pipelines.html#use-rules-to-add-jobs
.limit_pipelines:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'main' || $CI_COMMIT_BRANCH == 'develop'
when: on_success
- when: never
include:
- local: /backend/backend/.gitlab-ci.yml
- local: /frontend/app/.gitlab-ci.yml
- local: /.gitlab/schedules.gitlab-ci.yml
- local: /.gitlab/publishing.gitlab-ci.yml
rules:
- if: '$CI_COMMIT_MESSAGE =~ /ci: publish release$/'
when: always
variables:
TURBO_CACHE_BYPASS:
@@ -87,7 +83,6 @@ build:
- if: $CI_COMMIT_BRANCH == 'develop'
variables:
DEPLOY_ID: staging
- !reference [.limit_pipelines, rules]
stop review:
stage: build
@@ -126,15 +121,15 @@ unit:
coverage_format: cobertura
path: coverage.xml
rules:
- !reference [.limit_pipelines, rules]
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'main' || $CI_COMMIT_BRANCH == 'develop'
audit:
stage: audit
allow_failure: true
needs: []
script:
- pnpm audit --prod
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'develop'
allow_failure: true
- if: $CI_COMMIT_BRANCH == 'main'
allow_failure: false
- !reference [.limit_pipelines, rules]

View File

@@ -1,6 +1,6 @@
.limit_publish_pipelines:
rules:
- if: '($CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "develop") && $CI_COMMIT_MESSAGE =~ /^ci: publish release/ && $CI_PIPELINE_SOURCE != "schedule"'
.limit_publishing:
- if: $CI_PIPELINE_SOURCE != "schedule"
when: on_success
deploy:
stage: publish
@@ -12,8 +12,7 @@ deploy:
paths:
- ./.deploy
- ./frontend/app/www
rules:
- !reference [.limit_publish_pipelines, rules]
rules: !reference [.limit_publishing]
publish image:
stage: publish
@@ -24,15 +23,14 @@ publish image:
image:
name: gcr.io/kaniko-project/executor:v1.12.1-debug
entrypoint: [""]
variables:
PUBLISH_TAG: next
script:
- >
/kaniko/executor
--context "${CI_PROJECT_DIR}/${DEPLOY_DIR}"
--dockerfile "${CI_PROJECT_DIR}/${DEPLOY_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:$(grep -o '"version": "[^"]*' "${DEPLOY_DIR}/package.json" | cut -d'"' -f4)"
--destination "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${PUBLISH_TAG}"
--destination "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:latest"
rules: !reference [.limit_publishing]
parallel:
matrix:
- IMAGE_NAME: database
@@ -49,11 +47,6 @@ publish image:
DEPLOY_DIR: .deploy/minimal-plugin
- IMAGE_NAME: app
DEPLOY_DIR: frontend/app
rules:
- if: $CI_COMMIT_BRANCH == 'main'
variables:
PUBLISH_TAG: latest
- !reference [.limit_publish_pipelines, rules]
publish packages:
stage: publish
@@ -61,17 +54,18 @@ publish packages:
variables:
GIT_STRATEGY: clone
GIT_DEPTH: 0
PUBLISH_TAG: next
script:
- pnpm install
- pnpm build
- pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_AUTH_TOKEN}"
- pnpm publish -r --publish-branch ${CI_COMMIT_BRANCH} --tag ${PUBLISH_TAG} --no-git-checks # TODO: Git checks...
- pnpm publish -r --publish-branch ${PUBLISH_BRANCH} --tag ${PUBLISH_TAG} --no-git-checks # TODO: Git checks...
rules:
- if: $CI_COMMIT_BRANCH == 'main'
variables:
PUBLISH_BRANCH: main
PUBLISH_TAG: latest
- !reference [.limit_publish_pipelines, rules]
- variables:
PUBLISH_BRANCH: $CI_COMMIT_BRANCH
PUBLISH_TAG: next
publish docs:
stage: publish
@@ -83,6 +77,3 @@ publish docs:
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == 'main'
- !reference [.limit_publish_pipelines, rules]

View File

@@ -1,6 +1,6 @@
.limit_scheduled_pipelines:
rules:
- if: $CI_COMMIT_BRANCH == 'main' && $CI_PIPELINE_SOURCE == "schedule"
.limit_base_image_publishing:
- if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == 'main'
when: always
base image:
image: docker
@@ -21,6 +21,7 @@ base image:
docker push "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}"
cache: {} # disable irrelevant cache for this job
before_script: [] # do not run irrelevant before script for this job
rules: !reference [.limit_base_image_publishing]
parallel:
matrix:
- IMAGE_NAME: node-base
@@ -29,5 +30,4 @@ base image:
DEPLOY_DIR: images/node-builder
- IMAGE_NAME: app-builder
DEPLOY_DIR: images/app-builder
rules:
- !reference [.limit_scheduled_pipelines, rules]

View File

@@ -53,6 +53,12 @@ const config = {
packages: ['**'],
pinVersion: 'workspace:*',
},
{
label: 'App may have some dependency exceptions',
dependencies: ['typescript', '@typescript-eslint/**', 'eslint**'],
packages: ['@openstapps/app'],
isIgnored: true,
},
],
};

View File

@@ -19,4 +19,4 @@ integration:
junit:
- backend/backend/coverage/integration-report-junit.xml
rules:
- !reference [.limit_pipelines, rules]
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'main' || $CI_COMMIT_BRANCH == 'develop'

View File

@@ -1,15 +1,5 @@
# @openstapps/backend
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
- Updated dependencies [23481d0d]
- @openstapps/core-tools@3.0.0-next.4
- @openstapps/logger@3.0.0-next.4
- @openstapps/core@3.0.0-next.4
## 3.0.0-next.0
### Major Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@openstapps/backend",
"description": "A reference implementation for a StApps backend",
"version": "3.0.0-next.4",
"version": "3.0.0-next.0",
"private": true,
"type": "module",
"license": "AGPL-3.0-only",
@@ -99,7 +99,7 @@
"supertest": "6.3.3",
"ts-node": "10.9.1",
"tsup": "6.7.0",
"typescript": "5.1.6"
"typescript": "4.9.5"
},
"tsup": {
"entry": [

View File

@@ -1,7 +0,0 @@
# @openstapps/database
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6

View File

@@ -1,6 +1,6 @@
{
"name": "@openstapps/database",
"version": "3.0.0-next.4",
"version": "2.0.0",
"private": true,
"files": [
"config",

View File

@@ -1,13 +1,5 @@
# @openstapps/proxy
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
- Updated dependencies [23481d0d]
- @openstapps/logger@3.0.0-next.4
## 3.0.0-next.0
### Major Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@openstapps/proxy",
"description": "NGINX proxy that is dynamically configured by a Node.js script",
"version": "3.0.0-next.4",
"version": "3.0.0-next.0",
"private": true,
"type": "module",
"license": "AGPL-3.0-only",
@@ -51,7 +51,7 @@
"is-cidr": "4.0.2",
"mustache": "4.2.0",
"semver": "7.3.8",
"typescript": "5.1.6"
"typescript": "4.9.5"
},
"devDependencies": {
"@openstapps/api-cli": "workspace:*",

View File

@@ -1,11 +1,5 @@
# @openstapps/backend-config
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
## 3.0.0-next.0
### Major Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@openstapps/backend-config",
"description": "Backend Configuration for OpenStApps",
"version": "3.0.0-next.4",
"version": "3.0.0-next.0",
"private": true,
"type": "module",
"license": "GPL-3.0-only",

View File

@@ -1,11 +1,5 @@
# @openstapps/eslint-config
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
## 3.0.0-next.0
### Major Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@openstapps/eslint-config",
"description": "A collection of configuration base files for StApps projects. Just an (unused) experiment for now.",
"version": "3.0.0-next.4",
"version": "3.0.0-next.0",
"type": "commonjs",
"license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/eslint-config.git",
@@ -19,7 +19,7 @@
"@openstapps/tsconfig": "workspace:*",
"@types/node": "18.15.3",
"eslint": "8.43.0",
"typescript": "5.1.6"
"typescript": "4.9.5"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "5.60.1",

View File

@@ -1,11 +1,5 @@
# @openstapps/prettier-config
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
## 3.0.0-next.0
### Major Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@openstapps/prettier-config",
"description": "StApps Prettier Config",
"version": "3.0.0-next.4",
"version": "3.0.0-next.0",
"type": "module",
"license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/prettier-config.git",

View File

@@ -1,22 +1,5 @@
# @openstapps/projectmanagement
## 3.0.0-next.4
### Major Changes
- 11c9d742: Move images to separate packages
Removed builder image due to migration to Kaniko
### Patch Changes
- 4e4c7b5c: Update release configs
- 23481d0d: Update to TypeScript 5.1.6
- Updated dependencies [23481d0d]
- @openstapps/collection-utils@3.0.0-next.4
- @openstapps/gitlab-api@3.0.0-next.4
- @openstapps/logger@3.0.0-next.4
## 3.0.0-next.3
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@openstapps/projectmanagement",
"description": "Main documentation and scripts for maintenance.",
"version": "3.0.0-next.4",
"version": "3.0.0-next.3",
"private": true,
"type": "module",
"license": "GPL-3.0-only",
@@ -65,7 +65,7 @@
"mocha-junit-reporter": "2.2.0",
"ts-node": "10.9.1",
"tsup": "6.7.0",
"typescript": "5.1.6"
"typescript": "4.9.5"
},
"tsup": {
"entry": [

View File

@@ -1,11 +1,5 @@
# @openstapps/tsconfig
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
## 3.0.0-next.0
### Major Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@openstapps/tsconfig",
"description": "The tsconfig for the openstapps project",
"version": "3.0.0-next.4",
"version": "3.0.0-next.0",
"type": "commonjs",
"license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/eslint-config.git",

View File

@@ -1,12 +1,12 @@
{
"compilerOptions": {
"alwaysStrict": true,
"charset": "utf8",
"declaration": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"downlevelIteration": true,
"inlineSourceMap": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
@@ -21,9 +21,9 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "../../../lib/",
"lib": ["ES2022", "DOM"],
"lib": ["ES2021", "DOM"],
"strict": true,
"target": "ES2022"
"target": "ES2021"
},
"ts-node": {
"transpileOnly": true

View File

@@ -1,15 +1,5 @@
# @openstapps/minimal-connector
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
- Updated dependencies [23481d0d]
- @openstapps/logger@3.0.0-next.4
- @openstapps/core@3.0.0-next.4
- @openstapps/api@3.0.0-next.4
## 3.0.0-next.0
### Major Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@openstapps/minimal-connector",
"description": "This is a minimal connector which serves as an example",
"version": "3.0.0-next.4",
"version": "3.0.0-next.0",
"private": true,
"type": "module",
"license": "GPL-3.0-only",
@@ -55,7 +55,7 @@
"nock": "13.3.1",
"ts-node": "10.9.1",
"tsup": "6.7.0",
"typescript": "5.1.6"
"typescript": "4.9.5"
},
"tsup": {
"entry": [

View File

@@ -1,7 +0,0 @@
# @openstapps/minimal-deployment
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6

View File

@@ -1,6 +1,6 @@
{
"name": "@openstapps/minimal-deployment",
"version": "3.0.0-next.4",
"version": "2.0.0",
"private": true,
"files": [
"database",

View File

@@ -1,17 +1,5 @@
# @openstapps/minimal-plugin
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
- Updated dependencies [23481d0d]
- @openstapps/api-plugin@3.0.0-next.4
- @openstapps/core-tools@3.0.0-next.4
- @openstapps/logger@3.0.0-next.4
- @openstapps/core@3.0.0-next.4
- @openstapps/api@3.0.0-next.4
## 3.0.0-next.0
### Major Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@openstapps/minimal-plugin",
"description": "Minimal Plugin",
"version": "3.0.0-next.4",
"version": "3.0.0-next.0",
"private": true,
"type": "module",
"license": "GPL-3.0-only",
@@ -44,7 +44,7 @@
"@types/express": "4.17.17",
"@types/node": "18.15.3",
"tsup": "6.7.0",
"typescript": "5.1.6"
"typescript": "4.9.5"
},
"tsup": {
"entry": [

27
flake.lock generated
View File

@@ -1,27 +0,0 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1689752456,
"narHash": "sha256-VOChdECcEI8ixz8QY+YC4JaNEFwQd1V8bA0G4B28Ki0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7f256d7da238cb627ef189d56ed590739f42f13b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@@ -1,73 +0,0 @@
{
description = "A Nix-flake-based development environment for OpenStApps";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs = { self, nixpkgs }:
let
buildToolsVersion = "30.0.3";
overlays = [
(final: prev: rec {
nodejs = prev.nodejs-18_x;
pnpm = prev.nodePackages.pnpm;
chrome = prev.google-chrome;
firefox = prev.firefox;
webkit = prev.epiphany; # Safari-ish browser
android = prev.androidenv.composeAndroidPackages {
buildToolsVersions = [ "${buildToolsVersion}" ];
platformVersions = [ "32" ];
};
cypress = prev.cypress.overrideAttrs(prev: {
version = "12.17.1";
});
})
];
# TODO: aarch64-linux, x68_64-darwin, aarch64-darwin
supportedSystems = [ "x86_64-linux" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs {
inherit overlays system;
config = {
allowUnfree = true;
android_sdk.accept_license = true;
};
};
});
in
{
devShells = forEachSupportedSystem ({ pkgs }:
let
python = (pkgs.python311.withPackages(ps: with ps; [ brotli fonttools ] ++ (with fonttools.optional-dependencies; [ ufo lxml unicode woff ])));
in
{
default = (pkgs.buildFHSUserEnv {
name = "StApps Dev";
targetPkgs = pkgs: with pkgs; [
nodejs
pnpm
python
docker
# tools
curl
jq
# browsers
firefox
chrome
webkit
cypress
# android
jdk17
android.androidsdk
musl
];
runScript = "bash";
profile = ''
export CYPRESS_INSTALL_BINARY=0
export CYPRESS_RUN_BINARY=${pkgs.cypress}/bin/Cypress
export ANDROID_SDK_ROOT=${pkgs.android.androidsdk}/libexec/android-sdk
export ANDROID_JAVA_HOME=${pkgs.jdk.home}
export DOCKER_HOST=unix:///run/user/1000/docker.sock
{ dockerd-rootless & } 2>/dev/null
'';
}).env;
});
};
}

View File

@@ -9,6 +9,4 @@
last 2 versions
Firefox ESR
not dead
not kaios 2.5
not op_mini all
not IE 9-11
not IE 9-11 # For IE 9-11 support, remove 'not'.

View File

@@ -0,0 +1,17 @@
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

View File

@@ -33,7 +33,6 @@
"unicorn/prefer-object-from-entries": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/no-process-exit": "off",
"unicorn/prefer-event-target": "off",
"unicorn/prevent-abbreviations": [
"warn",
{

View File

@@ -19,4 +19,4 @@ e2e:
- BROWSER: chrome
- BROWSER: firefox
rules:
- !reference [.limit_pipelines, rules]
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'main' || $CI_COMMIT_BRANCH == 'develop'

View File

@@ -0,0 +1,30 @@
build:
stage: build
script:
- npm run build
artifacts:
paths:
- www
except:
- schedules
scheduled-build:
stage: build
script:
- npm run build
only:
- schedules
unit:
stage: test
script:
- npm run check-icons
- npm run test -- --watch=false --no-progress --code-coverage
coverage: '/Statements[^:]*\:[^:]*\s+([\d\.]+)%/'
artifacts:
paths:
- coverage
reports:
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml

11
frontend/app/.npmignore Normal file
View File

@@ -0,0 +1,11 @@
# Ignore all files/folders by default
# See https://stackoverflow.com/a/29932318
/*
# Except these files/folders
!docs
!lib
!LICENSE
!package.json
!package-lock.json
!README.md
!src

View File

@@ -23,5 +23,4 @@ module.exports = {
},
},
],
ignorePath: ['.prettierignore', '../../.gitignore'],
};

View File

@@ -1,29 +1,5 @@
# @openstapps/app
## 3.0.0-next.4
### Major Changes
- 23481d0d: Update to Angular 16.1
### Minor Changes
- 23481d0d: Migrate to Ionic 7
- Migrate uses of `<ion-label>` with inputs to new syntax
- Fix infinite loop in schedule date picker (`datetime.confirm()` to `datetime.cancel()`)
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
- bebee6b4: Migrate collection helpers to use @openstapps/collection-utils
- 107a7c5e: Migrate unit tests to karma-coverage and junit reports.
Fixes an issue where coverage reports would not be generated.
- Updated dependencies [23481d0d]
- @openstapps/collection-utils@3.0.0-next.4
- @openstapps/core@3.0.0-next.4
- @openstapps/api@3.0.0-next.4
## 3.0.0-next.0
### Major Changes

View File

@@ -2,14 +2,6 @@
A few notes to our icon set, for users and future maintainers.
You will need to setup fonttools with python
```shell
python -m venv .venv && .venv/bin/python -m pip install -r requirements.txt
```
Alternatively, anything that puts `fonttools` within your path will do as well.
## Usage
To find icon names, visit the
@@ -81,3 +73,6 @@ npm run minify-icons
Unfortunately, I was unable to find a JS package that could to the job,
and had to rely on the Python module [fonttools](https://github.com/fonttools/fonttools).
That means that you might run into additional issues when running the
above-mentioned command.

View File

@@ -1,70 +1,70 @@
[
{
"pkg": "@capacitor/app",
"classpath": "com.capacitorjs.plugins.app.AppPlugin"
},
{
"pkg": "@capacitor/browser",
"classpath": "com.capacitorjs.plugins.browser.BrowserPlugin"
},
{
"pkg": "@capacitor/device",
"classpath": "com.capacitorjs.plugins.device.DevicePlugin"
},
{
"pkg": "@capacitor/dialog",
"classpath": "com.capacitorjs.plugins.dialog.DialogPlugin"
},
{
"pkg": "@capacitor/filesystem",
"classpath": "com.capacitorjs.plugins.filesystem.FilesystemPlugin"
},
{
"pkg": "@capacitor/geolocation",
"classpath": "com.capacitorjs.plugins.geolocation.GeolocationPlugin"
},
{
"pkg": "@capacitor/haptics",
"classpath": "com.capacitorjs.plugins.haptics.HapticsPlugin"
},
{
"pkg": "@capacitor/keyboard",
"classpath": "com.capacitorjs.plugins.keyboard.KeyboardPlugin"
},
{
"pkg": "@capacitor/local-notifications",
"classpath": "com.capacitorjs.plugins.localnotifications.LocalNotificationsPlugin"
},
{
"pkg": "@capacitor/network",
"classpath": "com.capacitorjs.plugins.network.NetworkPlugin"
},
{
"pkg": "@capacitor/preferences",
"classpath": "com.capacitorjs.plugins.preferences.PreferencesPlugin"
},
{
"pkg": "@capacitor/share",
"classpath": "com.capacitorjs.plugins.share.SharePlugin"
},
{
"pkg": "@capacitor/splash-screen",
"classpath": "com.capacitorjs.plugins.splashscreen.SplashScreenPlugin"
},
{
"pkg": "@capacitor/status-bar",
"classpath": "com.capacitorjs.plugins.statusbar.StatusBarPlugin"
},
{
"pkg": "@hugotomazi/capacitor-navigation-bar",
"classpath": "br.com.tombus.capacitor.plugin.navigationbar.NavigationBarPlugin"
},
{
"pkg": "@transistorsoft/capacitor-background-fetch",
"classpath": "com.transistorsoft.bgfetch.capacitor.BackgroundFetchPlugin"
},
{
"pkg": "capacitor-secure-storage-plugin",
"classpath": "com.whitestein.securestorage.SecureStoragePluginPlugin"
}
{
"pkg": "@capacitor/app",
"classpath": "com.capacitorjs.plugins.app.AppPlugin"
},
{
"pkg": "@capacitor/browser",
"classpath": "com.capacitorjs.plugins.browser.BrowserPlugin"
},
{
"pkg": "@capacitor/device",
"classpath": "com.capacitorjs.plugins.device.DevicePlugin"
},
{
"pkg": "@capacitor/dialog",
"classpath": "com.capacitorjs.plugins.dialog.DialogPlugin"
},
{
"pkg": "@capacitor/filesystem",
"classpath": "com.capacitorjs.plugins.filesystem.FilesystemPlugin"
},
{
"pkg": "@capacitor/geolocation",
"classpath": "com.capacitorjs.plugins.geolocation.GeolocationPlugin"
},
{
"pkg": "@capacitor/haptics",
"classpath": "com.capacitorjs.plugins.haptics.HapticsPlugin"
},
{
"pkg": "@capacitor/keyboard",
"classpath": "com.capacitorjs.plugins.keyboard.KeyboardPlugin"
},
{
"pkg": "@capacitor/local-notifications",
"classpath": "com.capacitorjs.plugins.localnotifications.LocalNotificationsPlugin"
},
{
"pkg": "@capacitor/network",
"classpath": "com.capacitorjs.plugins.network.NetworkPlugin"
},
{
"pkg": "@capacitor/preferences",
"classpath": "com.capacitorjs.plugins.preferences.PreferencesPlugin"
},
{
"pkg": "@capacitor/share",
"classpath": "com.capacitorjs.plugins.share.SharePlugin"
},
{
"pkg": "@capacitor/splash-screen",
"classpath": "com.capacitorjs.plugins.splashscreen.SplashScreenPlugin"
},
{
"pkg": "@capacitor/status-bar",
"classpath": "com.capacitorjs.plugins.statusbar.StatusBarPlugin"
},
{
"pkg": "@hugotomazi/capacitor-navigation-bar",
"classpath": "br.com.tombus.capacitor.plugin.navigationbar.NavigationBarPlugin"
},
{
"pkg": "@transistorsoft/capacitor-background-fetch",
"classpath": "com.transistorsoft.bgfetch.capacitor.BackgroundFetchPlugin"
},
{
"pkg": "capacitor-secure-storage-plugin",
"classpath": "com.whitestein.securestorage.SecureStoragePluginPlugin"
}
]

View File

@@ -1,54 +1,54 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
include ':capacitor-android'
project(':capacitor-android').projectDir = new File('../../../node_modules/.pnpm/@capacitor+android@4.6.1_@capacitor+core@4.6.1/node_modules/@capacitor/android/capacitor')
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
include ':capacitor-app'
project(':capacitor-app').projectDir = new File('../../../node_modules/.pnpm/@capacitor+app@4.1.1_@capacitor+core@4.6.1/node_modules/@capacitor/app/android')
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android')
include ':capacitor-browser'
project(':capacitor-browser').projectDir = new File('../../../node_modules/.pnpm/@capacitor+browser@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/browser/android')
project(':capacitor-browser').projectDir = new File('../node_modules/@capacitor/browser/android')
include ':capacitor-device'
project(':capacitor-device').projectDir = new File('../../../node_modules/.pnpm/@capacitor+device@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/device/android')
project(':capacitor-device').projectDir = new File('../node_modules/@capacitor/device/android')
include ':capacitor-dialog'
project(':capacitor-dialog').projectDir = new File('../../../node_modules/.pnpm/@capacitor+dialog@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/dialog/android')
project(':capacitor-dialog').projectDir = new File('../node_modules/@capacitor/dialog/android')
include ':capacitor-filesystem'
project(':capacitor-filesystem').projectDir = new File('../../../node_modules/.pnpm/@capacitor+filesystem@4.1.4_@capacitor+core@4.6.1/node_modules/@capacitor/filesystem/android')
project(':capacitor-filesystem').projectDir = new File('../node_modules/@capacitor/filesystem/android')
include ':capacitor-geolocation'
project(':capacitor-geolocation').projectDir = new File('../../../node_modules/.pnpm/@capacitor+geolocation@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/geolocation/android')
project(':capacitor-geolocation').projectDir = new File('../node_modules/@capacitor/geolocation/android')
include ':capacitor-haptics'
project(':capacitor-haptics').projectDir = new File('../../../node_modules/.pnpm/@capacitor+haptics@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/haptics/android')
project(':capacitor-haptics').projectDir = new File('../node_modules/@capacitor/haptics/android')
include ':capacitor-keyboard'
project(':capacitor-keyboard').projectDir = new File('../../../node_modules/.pnpm/@capacitor+keyboard@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/keyboard/android')
project(':capacitor-keyboard').projectDir = new File('../node_modules/@capacitor/keyboard/android')
include ':capacitor-local-notifications'
project(':capacitor-local-notifications').projectDir = new File('../../../node_modules/.pnpm/@capacitor+local-notifications@4.1.4_@capacitor+core@4.6.1/node_modules/@capacitor/local-notifications/android')
project(':capacitor-local-notifications').projectDir = new File('../node_modules/@capacitor/local-notifications/android')
include ':capacitor-network'
project(':capacitor-network').projectDir = new File('../../../node_modules/.pnpm/@capacitor+network@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/network/android')
project(':capacitor-network').projectDir = new File('../node_modules/@capacitor/network/android')
include ':capacitor-preferences'
project(':capacitor-preferences').projectDir = new File('../../../node_modules/.pnpm/@capacitor+preferences@4.0.2_@capacitor+core@4.6.1/node_modules/@capacitor/preferences/android')
project(':capacitor-preferences').projectDir = new File('../node_modules/@capacitor/preferences/android')
include ':capacitor-share'
project(':capacitor-share').projectDir = new File('../../../node_modules/.pnpm/@capacitor+share@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/share/android')
project(':capacitor-share').projectDir = new File('../node_modules/@capacitor/share/android')
include ':capacitor-splash-screen'
project(':capacitor-splash-screen').projectDir = new File('../../../node_modules/.pnpm/@capacitor+splash-screen@4.1.2_@capacitor+core@4.6.1/node_modules/@capacitor/splash-screen/android')
project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capacitor/splash-screen/android')
include ':capacitor-status-bar'
project(':capacitor-status-bar').projectDir = new File('../../../node_modules/.pnpm/@capacitor+status-bar@4.1.1_@capacitor+core@4.6.1/node_modules/@capacitor/status-bar/android')
project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android')
include ':hugotomazi-capacitor-navigation-bar'
project(':hugotomazi-capacitor-navigation-bar').projectDir = new File('../../../node_modules/.pnpm/@hugotomazi+capacitor-navigation-bar@2.0.0_@capacitor+core@4.6.1/node_modules/@hugotomazi/capacitor-navigation-bar/android')
project(':hugotomazi-capacitor-navigation-bar').projectDir = new File('../node_modules/@hugotomazi/capacitor-navigation-bar/android')
include ':transistorsoft-capacitor-background-fetch'
project(':transistorsoft-capacitor-background-fetch').projectDir = new File('../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@1.0.2_@capacitor+core@4.6.1/node_modules/@transistorsoft/capacitor-background-fetch/android')
project(':transistorsoft-capacitor-background-fetch').projectDir = new File('../node_modules/@transistorsoft/capacitor-background-fetch/android')
include ':capacitor-secure-storage-plugin'
project(':capacitor-secure-storage-plugin').projectDir = new File('../../../node_modules/.pnpm/capacitor-secure-storage-plugin@0.8.1_@capacitor+core@4.6.1/node_modules/capacitor-secure-storage-plugin/android')
project(':capacitor-secure-storage-plugin').projectDir = new File('../node_modules/capacitor-secure-storage-plugin/android')

0
frontend/app/android/gradlew vendored Executable file → Normal file
View File

View File

@@ -10,7 +10,7 @@ ext {
coreSplashScreenVersion = '1.0.0-rc01'
androidxWebkitVersion = '1.4.0'
junitVersion = '4.13.2'
androidxJunitVersion = '1.1.3'
androidxJunitVersion = '1.1.5'
androidxEspressoCoreVersion = '3.4.0'
cordovaAndroidVersion = '10.1.1'
}

View File

@@ -1,6 +1,7 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"defaultProject": "app",
"newProjectRoot": "projects",
"projects": {
"app": {
@@ -16,17 +17,10 @@
"outputPath": "www",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "zone.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"allowedCommonJsDependencies": [
"moment",
"opening_hours",
"leaflet",
"leaflet.markercluster",
"localforge",
"guid-typescript"
],
"aot": true,
"allowedCommonJsDependencies": ["moment", "opening_hours"],
"assets": [
{
"glob": "**/*",
@@ -50,7 +44,8 @@
},
"./node_modules/leaflet/dist/leaflet.css",
"./node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css"
]
],
"scripts": []
},
"configurations": {
"production": {
@@ -107,6 +102,7 @@
"browserTarget": "app:build:development"
},
"ci": {
"progress": false,
"browserTarget": "app:build"
},
"fake": {
@@ -115,13 +111,21 @@
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "app:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": ["zone.js", "zone.js/testing"],
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"main": "src/test.ts",
"styles": [],
"scripts": [],
"assets": [
{
"glob": "favicon.ico",
@@ -139,6 +143,12 @@
"output": "assets/"
}
]
},
"configurations": {
"ci": {
"progress": false,
"watch": false
}
}
},
"lint": {
@@ -196,6 +206,7 @@
},
"cli": {
"packageManager": "pnpm",
"defaultCollection": "@ionic/angular-toolkit",
"analytics": false
},
"schematics": {

View File

@@ -9,25 +9,25 @@ use_frameworks!
install! 'cocoapods', :disable_input_output_paths => true
def capacitor_pods
pod 'Capacitor', :path => '../../../../node_modules/.pnpm/@capacitor+ios@4.6.1_@capacitor+core@4.6.1/node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../../../node_modules/.pnpm/@capacitor+ios@4.6.1_@capacitor+core@4.6.1/node_modules/@capacitor/ios'
pod 'CapacitorApp', :path => '../../../../node_modules/.pnpm/@capacitor+app@4.1.1_@capacitor+core@4.6.1/node_modules/@capacitor/app'
pod 'CapacitorBrowser', :path => '../../../../node_modules/.pnpm/@capacitor+browser@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/browser'
pod 'CapacitorDevice', :path => '../../../../node_modules/.pnpm/@capacitor+device@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/device'
pod 'CapacitorDialog', :path => '../../../../node_modules/.pnpm/@capacitor+dialog@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/dialog'
pod 'CapacitorFilesystem', :path => '../../../../node_modules/.pnpm/@capacitor+filesystem@4.1.4_@capacitor+core@4.6.1/node_modules/@capacitor/filesystem'
pod 'CapacitorGeolocation', :path => '../../../../node_modules/.pnpm/@capacitor+geolocation@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/geolocation'
pod 'CapacitorHaptics', :path => '../../../../node_modules/.pnpm/@capacitor+haptics@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/haptics'
pod 'CapacitorKeyboard', :path => '../../../../node_modules/.pnpm/@capacitor+keyboard@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/keyboard'
pod 'CapacitorLocalNotifications', :path => '../../../../node_modules/.pnpm/@capacitor+local-notifications@4.1.4_@capacitor+core@4.6.1/node_modules/@capacitor/local-notifications'
pod 'CapacitorNetwork', :path => '../../../../node_modules/.pnpm/@capacitor+network@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/network'
pod 'CapacitorPreferences', :path => '../../../../node_modules/.pnpm/@capacitor+preferences@4.0.2_@capacitor+core@4.6.1/node_modules/@capacitor/preferences'
pod 'CapacitorShare', :path => '../../../../node_modules/.pnpm/@capacitor+share@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/share'
pod 'CapacitorSplashScreen', :path => '../../../../node_modules/.pnpm/@capacitor+splash-screen@4.1.2_@capacitor+core@4.6.1/node_modules/@capacitor/splash-screen'
pod 'CapacitorStatusBar', :path => '../../../../node_modules/.pnpm/@capacitor+status-bar@4.1.1_@capacitor+core@4.6.1/node_modules/@capacitor/status-bar'
pod 'HugotomaziCapacitorNavigationBar', :path => '../../../../node_modules/.pnpm/@hugotomazi+capacitor-navigation-bar@2.0.0_@capacitor+core@4.6.1/node_modules/@hugotomazi/capacitor-navigation-bar'
pod 'TransistorsoftCapacitorBackgroundFetch', :path => '../../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@1.0.2_@capacitor+core@4.6.1/node_modules/@transistorsoft/capacitor-background-fetch'
pod 'CapacitorSecureStoragePlugin', :path => '../../../../node_modules/.pnpm/capacitor-secure-storage-plugin@0.8.1_@capacitor+core@4.6.1/node_modules/capacitor-secure-storage-plugin'
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
pod 'CapacitorBrowser', :path => '../../node_modules/@capacitor/browser'
pod 'CapacitorDevice', :path => '../../node_modules/@capacitor/device'
pod 'CapacitorDialog', :path => '../../node_modules/@capacitor/dialog'
pod 'CapacitorFilesystem', :path => '../../node_modules/@capacitor/filesystem'
pod 'CapacitorGeolocation', :path => '../../node_modules/@capacitor/geolocation'
pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics'
pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard'
pod 'CapacitorLocalNotifications', :path => '../../node_modules/@capacitor/local-notifications'
pod 'CapacitorNetwork', :path => '../../node_modules/@capacitor/network'
pod 'CapacitorPreferences', :path => '../../node_modules/@capacitor/preferences'
pod 'CapacitorShare', :path => '../../node_modules/@capacitor/share'
pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
pod 'HugotomaziCapacitorNavigationBar', :path => '../../node_modules/@hugotomazi/capacitor-navigation-bar'
pod 'TransistorsoftCapacitorBackgroundFetch', :path => '../../node_modules/@transistorsoft/capacitor-background-fetch'
pod 'CapacitorSecureStoragePlugin', :path => '../../node_modules/capacitor-secure-storage-plugin'
pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'
end

View File

@@ -1,4 +1,3 @@
// @ts-check
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
@@ -14,13 +13,10 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Karma configuration file, see the link for more information
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
var isDocker = require('is-docker');
/**
* @param config {import('karma').Config}
*/
module.exports = function (config) {
config.set({
basePath: '',
@@ -29,9 +25,9 @@ module.exports = function (config) {
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'),
require('karma-mocha-reporter'),
require('karma-junit-reporter'),
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
@@ -48,18 +44,19 @@ module.exports = function (config) {
useBrowserName: false,
},
reporters: ['mocha', 'junit', 'coverage'],
singleRun: true,
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['ChromeNoSandbox'],
customLaunchers: {
ChromeNoSandbox: {
base: 'ChromeHeadless',
// We must disable the Chrome sandbox when running Chrome inside Docker,
// see https://hackernoon.com/running-karma-tests-with-headless-chrome-inside-docker-ae4aceb06ed3
flags: isDocker() ? ['--no-sandbox'] : [],
flags: isDocker ? ['--no-sandbox'] : [],
},
},
singleRun: false,
});
};

View File

@@ -0,0 +1,11 @@
import {process} from '@angular/compiler-cli/ngcc';
import path from 'path';
const legacyViewEngineLibraries = [
['@awesome-cordova-plugins', 'calendar'],
['@ionic-native', 'core'],
];
for (const basePath of legacyViewEngineLibraries) {
process({basePath: path.resolve(path.join('node_modules', ...basePath))});
}

View File

@@ -1,7 +1,7 @@
{
"name": "@openstapps/app",
"description": "The generic app tailored to fulfill needs of German universities, written using Ionic Framework.",
"version": "3.0.0-next.4",
"version": "3.0.0-next.0",
"private": true,
"license": "GPL-3.0-only",
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
@@ -31,13 +31,14 @@
"docker:run:android": "sudo docker run -v $PWD:/app --privileged -v /dev/bus/usb:/dev/bus/usb --net=host -it registry.gitlab.com/openstapps/app bash -c \"npm run run:android\"",
"docker:serve": "sudo docker run -p 8100:8100 -p 35729:35729 -p 53703:53703 -v $PWD:/app -it registry.gitlab.com/openstapps/app bash -c \"npm run start:external\"",
"e2e": "ng e2e",
"format": "prettier . -c",
"format:fix": "prettier --write .",
"format": "prettier . -c --ignore-path ../../.gitignore",
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
"licenses": "license-checker --json > src/assets/about/licenses.json && ts-node ./scripts/accumulate-licenses.ts && git add src/assets/about/licenses.json",
"lint": "ng lint && stylelint \"**/*.scss\"",
"lint:fix": "eslint --fix -c .eslintrc.json --ignore-path .eslintignore --ext .ts,.html src/ && stylelint --fix \"**/*.scss\"",
"minify-icons": "ts-node-esm scripts/minify-icon-font.ts",
"postinstall": "jetify && echo \"skipping jetify in production mode\"",
"ng": "ng",
"postinstall": "(jetify && node ngcc-postinstall.mjs) || echo \"skipping jetify in production mode\"",
"preview": "http-server www --p 8101 -o",
"push": "git push && git push origin \"v$npm_package_version\"",
"resources:android": "cordova-res android --skip-config --copy",
@@ -46,19 +47,19 @@
"start": "ionic serve",
"start:external": "ionic serve --external",
"start:prod": "ionic serve --prod",
"test": "ng test --code-coverage",
"test": "ng test --watch=false --code-coverage",
"test:integration": "sh integration-test.sh"
},
"dependencies": {
"@angular/animations": "16.1.4",
"@angular/cdk": "16.1.4",
"@angular/common": "16.1.4",
"@angular/core": "16.1.4",
"@angular/forms": "16.1.4",
"@angular/platform-browser": "16.1.4",
"@angular/router": "16.1.4",
"@asymmetrik/ngx-leaflet": "16.0.1",
"@asymmetrik/ngx-leaflet-markercluster": "16.0.0",
"@angular/animations": "13.4.0",
"@angular/cdk": "13.3.9",
"@angular/common": "13.4.0",
"@angular/core": "13.4.0",
"@angular/forms": "13.4.0",
"@angular/platform-browser": "13.4.0",
"@angular/router": "13.4.0",
"@asymmetrik/ngx-leaflet": "13.0.2",
"@asymmetrik/ngx-leaflet-markercluster": "13.0.1",
"@awesome-cordova-plugins/calendar": "5.45.0",
"@awesome-cordova-plugins/core": "5.45.0",
"@capacitor/app": "4.1.1",
@@ -78,13 +79,12 @@
"@capacitor/status-bar": "4.1.1",
"@hugotomazi/capacitor-navigation-bar": "2.0.0",
"@ionic-native/core": "5.36.0",
"@ionic/angular": "7.1.3",
"@ionic/storage-angular": "4.0.0",
"@ngx-translate/core": "15.0.0",
"@ngx-translate/http-loader": "8.0.0",
"@ionic/angular": "6.7.5",
"@ionic/storage": "4.0.0",
"@ngx-translate/core": "14.0.0",
"@ngx-translate/http-loader": "7.0.0",
"@openid/appauth": "1.3.1",
"@openstapps/api": "workspace:*",
"@openstapps/collection-utils": "workspace:*",
"@openstapps/core": "workspace:*",
"@transistorsoft/capacitor-background-fetch": "1.0.2",
"capacitor-secure-storage-plugin": "0.8.1",
@@ -99,36 +99,36 @@
"material-symbols": "0.10.0",
"moment": "2.29.4",
"ngx-logger": "5.0.12",
"ngx-markdown": "16.0.0",
"ngx-markdown": "13.1.0",
"ngx-moment": "6.0.2",
"opening_hours": "3.8.0",
"rxjs": "7.8.1",
"rxjs": "7.8.0",
"swiper": "8.4.5",
"tslib": "2.4.1",
"zone.js": "0.13.1"
"zone.js": "0.12.0"
},
"devDependencies": {
"@angular-devkit/architect": "0.1601.4",
"@angular-devkit/build-angular": "16.1.4",
"@angular-devkit/core": "16.1.4",
"@angular-devkit/schematics": "16.1.4",
"@angular-eslint/builder": "16.1.0",
"@angular-eslint/eslint-plugin": "16.1.0",
"@angular-eslint/eslint-plugin-template": "16.1.0",
"@angular-eslint/schematics": "16.1.0",
"@angular-eslint/template-parser": "16.1.0",
"@angular/cli": "16.1.4",
"@angular/compiler": "16.1.4",
"@angular/compiler-cli": "16.1.4",
"@angular/language-service": "16.1.4",
"@angular/platform-browser-dynamic": "16.1.4",
"@angular-devkit/architect": "0.1303.11",
"@angular-devkit/build-angular": "13.3.11",
"@angular-devkit/core": "13.3.11",
"@angular-devkit/schematics": "13.3.11",
"@angular-eslint/builder": "13.5.0",
"@angular-eslint/eslint-plugin": "13.5.0",
"@angular-eslint/eslint-plugin-template": "13.5.0",
"@angular-eslint/schematics": "13.5.0",
"@angular-eslint/template-parser": "13.5.0",
"@angular/cli": "13.3.11",
"@angular/compiler": "13.4.0",
"@angular/compiler-cli": "13.4.0",
"@angular/language-service": "13.4.0",
"@angular/platform-browser-dynamic": "13.3.11",
"@capacitor/android": "4.6.1",
"@capacitor/cli": "4.6.1",
"@capacitor/ios": "4.6.1",
"@compodoc/compodoc": "1.1.19",
"@cypress/schematic": "1.7.0",
"@ionic/angular-toolkit": "10.0.0",
"@ionic/cli": "7.1.1",
"@ionic/angular-toolkit": "6.1.0",
"@ionic/cli": "6.20.4",
"@openstapps/prettier-config": "workspace:*",
"@openstapps/tsconfig": "workspace:*",
"@types/fontkit": "1.8.0",
@@ -137,35 +137,33 @@
"@types/jasmine": "4.3.1",
"@types/jasminewd2": "2.0.10",
"@types/jsonpath": "0.2.0",
"@types/karma": "6.3.4",
"@types/karma-coverage": "2.0.1",
"@types/karma-jasmine": "4.0.2",
"@types/leaflet": "1.9.0",
"@types/leaflet.markercluster": "1.5.1",
"@types/node": "18.15.3",
"@typescript-eslint/eslint-plugin": "5.60.1",
"@typescript-eslint/parser": "5.60.1",
"@typescript-eslint/eslint-plugin": "5.49.0",
"@typescript-eslint/parser": "5.49.0",
"cordova-res": "0.15.4",
"cypress": "12.17.1",
"eslint": "8.43.0",
"eslint-plugin-jsdoc": "46.4.2",
"cypress": "12.0.1",
"eslint": "8.33.0",
"eslint-plugin-jsdoc": "39.7.4",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-unicorn": "47.0.0",
"eslint-plugin-unicorn": "45.0.2",
"fontkit": "2.0.2",
"glob": "10.2.7",
"http-server": "14.1.1",
"is-docker": "2.2.1",
"jasmine-core": "5.0.1",
"jasmine-core": "4.5.0",
"jasmine-spec-reporter": "7.0.0",
"jetifier": "2.0.0",
"junit-report-merger": "6.0.2",
"karma": "6.4.2",
"karma-chrome-launcher": "3.2.0",
"karma": "6.4.1",
"karma-chrome-launcher": "3.1.1",
"karma-coverage": "2.2.1",
"karma-jasmine": "5.1.0",
"karma-junit-reporter": "2.0.1",
"karma-mocha-reporter": "2.2.5",
"license-checker": "25.0.1",
"protractor": "7.0.0",
"stylelint": "15.10.1",
"stylelint-config-clean-order": "5.0.1",
"stylelint-config-prettier-scss": "1.0.0",
@@ -173,7 +171,7 @@
"stylelint-config-standard-scss": "10.0.0",
"surge": "0.23.1",
"ts-node": "10.9.1",
"typescript": "5.1.6",
"typescript": "4.6.4",
"webpack-bundle-analyzer": "4.7.0"
},
"prettier": "@openstapps/prettier-config",

View File

@@ -1,7 +0,0 @@
appdirs==1.4.4
Brotli==1.0.9
fonttools==4.41.0
fs==2.4.16
lxml==4.9.3
six==1.16.0
zopfli==0.2.2

View File

@@ -86,9 +86,15 @@ async function minifyIconFont() {
}
glyphs.sort();
const pythonPath = `"${await run('npm config get python')}"`;
console.log(`Using python from npm config ${pythonPath}`);
console.log(await run(`${pythonPath} --version`));
console.log(await run([pythonPath, '-m', 'pip', 'install', 'fonttools[ufo,lxml,unicode,woff]']));
console.log(
await run([
'pyftsubset',
pythonPath,
'-m fontTools.subset',
`"${config.inputPath}"`,
`--unicodes=${glyphs.join(',')}`,
'--no-layout-closure',

View File

@@ -0,0 +1,22 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {chunk} from './chunk';
describe('chunk', function () {
it('should chunk items in the correct sizes', function () {
expect(chunk([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3)).toEqual([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]);
});
});

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Chunk array into smaller arrays of a specified size.
*
* @param array The array to chunk.
* @param chunkSize The size of each chunk.
*/
export function chunk<T>(array: T[], chunkSize = 1): T[][] {
const arrayCopy = [...array];
const out: T[][] = [];
if (chunkSize <= 0) return out;
while (arrayCopy.length > 0) out.push(arrayCopy.splice(0, chunkSize));
return out;
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {differenceBy} from './difference';
describe('differenceBy', function () {
it('should return the difference of two arrays', function () {
const a = [1, 2, 3, 4, 5];
const b = [1, 2, 3];
expect(differenceBy(a, b, it => it)).toEqual([4, 5]);
});
});

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Returns the difference between two arrays.
*/
export function differenceBy<T>(a: T[], b: T[], transform: (item: T) => unknown) {
const disallowed = new Set(b.map(transform));
return a.filter(item => !disallowed.has(transform(item)));
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {get} from './get';
describe('get', function () {
it('should get a simple path', function () {
const object = {
a: {
b: {
c: 'd',
},
},
};
expect(get(object, 'a.b.c')).toBe('d');
});
it('should return undefined for a non-existent path', function () {
const object = {
a: {
b: {
c: 'd',
},
},
};
expect(get(object, 'a.b.c.d')).toBeUndefined();
});
});

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Gets a value from a nested object.
* The path must be key names separated by dots.
* If the path doesn't exist, undefined is returned.
*/
export function get<U = unknown>(object: object, path: string): U {
return path.split('.').reduce(
(accumulator, current) =>
accumulator?.hasOwnProperty(current)
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
(accumulator as any)[current]
: undefined,
object,
) as unknown as U;
}

View File

@@ -0,0 +1,123 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {groupBy, groupByStable, groupByProperty} from './group-by';
describe('groupBy', () => {
it('should group an array by a key', () => {
const array = [
{id: 1, name: 'one'},
{id: 2, name: 'two'},
{id: 3, name: 'three'},
{id: 4, name: 'four'},
{id: 5, name: 'five'},
];
const result = groupBy(array, it => it.name);
expect(result).toEqual({
one: [{id: 1, name: 'one'}],
two: [{id: 2, name: 'two'}],
three: [{id: 3, name: 'three'}],
four: [{id: 4, name: 'four'}],
five: [{id: 5, name: 'five'}],
});
});
it('should handle multiple elements per group', () => {
const array = [
{id: 1, name: 'one'},
{id: 2, name: 'two'},
{id: 3, name: 'three'},
{id: 4, name: 'four'},
{id: 5, name: 'five'},
{id: 6, name: 'one'},
{id: 7, name: 'two'},
{id: 8, name: 'three'},
{id: 9, name: 'four'},
{id: 10, name: 'five'},
];
const result = groupBy(array, it => it.name);
expect(result).toEqual({
one: [
{id: 1, name: 'one'},
{id: 6, name: 'one'},
],
two: [
{id: 2, name: 'two'},
{id: 7, name: 'two'},
],
three: [
{id: 3, name: 'three'},
{id: 8, name: 'three'},
],
four: [
{id: 4, name: 'four'},
{id: 9, name: 'four'},
],
five: [
{id: 5, name: 'five'},
{id: 10, name: 'five'},
],
});
});
});
describe('groupByStable', () => {
const array = [
{id: 2, name: 'two'},
{id: 4, name: 'three'},
{id: 3, name: 'three'},
{id: 1, name: 'one'},
];
const result = groupByStable(array, it => it.name);
it('should group an array by keys', () => {
expect(result.get('one')).toEqual([{id: 1, name: 'one'}]);
expect(result.get('two')).toEqual([{id: 2, name: 'two'}]);
expect(result.get('three')).toEqual([
{id: 4, name: 'three'},
{id: 3, name: 'three'},
]);
});
it('should provide ordered keys', () => {
expect([...result.keys()]).toEqual(['two', 'three', 'one']);
});
});
describe('groupByProperty', function () {
it('should group by property', () => {
const array = [
{id: 1, name: 'one'},
{id: 2, name: 'two'},
{id: 3, name: 'three'},
{id: 4, name: 'four'},
{id: 5, name: 'five'},
];
const result = groupByProperty(array, 'name');
expect(result).toEqual({
one: [{id: 1, name: 'one'}],
two: [{id: 2, name: 'two'}],
three: [{id: 3, name: 'three'}],
four: [{id: 4, name: 'four'}],
five: [{id: 5, name: 'five'}],
});
});
});

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Group an array by a function
*/
export function groupBy<T>(collection: T[], group: (item: T) => string | undefined): Record<string, T[]> {
return collection.reduce((accumulator: Record<string, T[]>, item) => {
const key = group(item) ?? '';
accumulator[key] = accumulator[key] ?? [];
accumulator[key].push(item);
return accumulator;
}, {});
}
/**
* Group an array by a function (returns a Map, whose keys keep order info of items entry)
*/
export function groupByStable<T>(collection: T[], group: (item: T) => string | undefined): Map<string, T[]> {
return collection.reduce((accumulator: Map<string, T[]>, item) => {
const key = group(item) ?? '';
accumulator.set(key, accumulator.get(key) ?? []);
accumulator.get(key)?.push(item);
return accumulator;
}, new Map<string, T[]>());
}
/**
*
*/
export function groupByProperty<T extends object>(collection: T[], property: keyof T): Record<string, T[]> {
return groupBy(collection, item => item[property] as unknown as string);
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {keyBy} from './key-by';
describe('keyBy', function () {
it('should key objects', function () {
const objects = [
{
id: 1,
name: 'foo',
},
{
id: 2,
name: 'bar',
},
];
const result = keyBy(objects, it => it.id);
expect(result).toEqual({
1: {
id: 1,
name: 'foo',
},
2: {
id: 2,
name: 'bar',
},
});
});
});

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Create an object composed of keys generated from the results of running
* each element of collection thru iteratee. The corresponding value of
* each key is the last element responsible for generating the key. The
* iteratee is invoked with one argument: (value).
*/
export function keyBy<T>(collection: T[], key: (item: T) => string | number): Record<string, T> {
return collection.reduce((accumulator, item) => {
accumulator[key(item)] = item;
return accumulator;
}, {} as Record<string | number, T>);
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {mapValues} from './map-values';
describe('map-values', () => {
it('should map values', () => {
const object = {
a: 1,
b: 2,
c: 3,
};
const result = mapValues(object, value => value * 2);
expect(result).toEqual({
a: 2,
b: 4,
c: 6,
});
});
it('should not modify the original object', () => {
const object = {
a: 1,
b: 2,
c: 3,
};
mapValues(object, value => value * 2);
expect(object).toEqual({
a: 1,
b: 2,
c: 3,
});
});
});

View File

@@ -0,0 +1,32 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Maps the values of an object to a new object
*/
export function mapValues<T extends object, U>(
object: T,
transform: (value: T[keyof T], key: keyof T) => U,
): {[key in keyof T]: U} {
const result = {} as {[key in keyof T]: U};
for (const key in object) {
if (object.hasOwnProperty(key)) {
result[key] = transform(object[key], key);
}
}
return result;
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {minBy} from './min';
describe('minBy', function () {
it('should pick the minimum value based on transform', function () {
expect(
minBy(
[
{id: 1, name: 'A'},
{id: 2, name: 'B'},
{id: 3, name: 'C'},
],
it => it.id,
),
).toEqual({id: 1, name: 'A'});
});
it('should not return undefined if there are other choices', function () {
expect(
minBy(
[
{id: undefined, name: 'B'},
{id: 1, name: 'A'},
{id: undefined, name: 'C'},
],
it => it.id,
),
).toEqual({id: 1, name: 'A'});
});
});

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Returns the minimum value of a collection.
*/
export function minBy<T>(array: T[], transform: (item: T) => number | undefined): T {
const transforms = array.map(transform);
const min = Math.min(...(transforms.filter(it => !!it) as number[]));
return array.find((_, i) => transforms[i] === min) as T;
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {omit} from './omit';
describe('omit', function () {
it('should omit keys', function () {
const object = {a: 1, b: 2, c: 3};
const result = omit(object, 'a', 'c');
expect(result).toEqual({b: 2});
});
});

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Returns a new object without the specified keys.
*/
export function omit<T extends object, U extends keyof T>(object: T, ...keys: U[]): Omit<T, U> {
const out = {...object};
for (const key of keys) delete out[key];
return out as Exclude<T, U>;
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {partition} from './partition';
describe('partition', function () {
it('should partition an array', function () {
expect(partition([1, 2, 3, 4], it => it % 2 === 0)).toEqual([
[2, 4],
[1, 3],
]);
});
});

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Partitions a list into two lists. One with the elements that satisfy a predicate,
* and one with the elements that don't satisfy the predicate.
*/
export function partition<T>(array: T[], transform: (item: T) => boolean): [T[], T[]] {
return array.reduce<[T[], T[]]>(
(accumulator, item) => {
accumulator[transform(item) ? 0 : 1].push(item);
return accumulator;
},
[[], []],
);
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {pick} from './pick';
describe('pick', function () {
it('should pick properties', function () {
const object = {a: 1, b: 2, c: 3};
const result = pick(object, ['a', 'c']);
expect(result).toEqual({a: 1, c: 3});
});
});

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Pick a set of properties from an object
*/
export function pick<T extends object, U extends keyof T>(object: T, keys: U[]): Pick<T, U> {
return keys.reduce((accumulator, key) => {
if (object.hasOwnProperty(key)) {
accumulator[key] = object[key];
}
return accumulator;
}, {} as Pick<T, U>);
}
/**
* Pick a set of properties from an object using a predicate function
*/
export function pickBy<T extends object, U extends keyof T>(
object: T,
predicate: (value: T[U], key: U) => boolean,
): Pick<T, U> {
return (Object.keys(object) as U[]).reduce((accumulator, key) => {
if (predicate(object[key], key)) {
accumulator[key] = object[key];
}
return accumulator;
}, {} as Pick<T, U>);
}

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {shuffle} from './shuffle';
describe('shuffle', function () {
it('should shuffle an array', function () {
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const shuffled = shuffle(array);
expect(shuffled).not.toEqual(array);
expect(shuffled).toEqual(jasmine.arrayContaining(array));
});
it('should not modify the original array', function () {
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
shuffle(array);
expect(array).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
});
});

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Shuffles an array
*/
export function shuffle<T>(array: T[]): T[] {
const copy = [...array];
const out = [];
while (copy.length > 0) {
out.push(copy.splice(Math.floor(Math.random() * copy.length), 1)[0]);
}
return out;
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {stringSort, stringSortBy} from './string-sort';
describe('stringSort', () => {
it('should sort an array of strings', () => {
expect(['a', 'c', 'b', 'd'].sort(stringSort)).toEqual(['a', 'b', 'c', 'd']);
});
});
describe('stringSortBy', () => {
it('should sort an array of strings', () => {
expect([{item: 'a'}, {item: 'c'}, {item: 'b'}, {item: 'd'}].sort(stringSortBy(it => it.item))).toEqual([
{item: 'a'},
{item: 'b'},
{item: 'c'},
{item: 'd'},
]);
});
});

View File

@@ -0,0 +1,36 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* sort function for two strings
*/
export function stringSort(a = '', b = ''): number {
if (a < b) return -1;
if (a > b) return 1;
return 0;
}
/**
* sort function for two strings that allows for a custom transform
*/
export function stringSortBy<T>(map: (item: T) => string | undefined): (a: T, b: T) => number {
return (a: T, b: T): number => {
const aValue = map(a) || '';
const bValue = map(b) || '';
if (aValue < bValue) return -1;
if (aValue > bValue) return 1;
return 0;
};
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {sum, sumBy} from './sum';
describe('sum', () => {
it('should return the sum of all elements in the collection', () => {
const collection = [1, 2, 3, 4, 5];
const result = sum(collection);
expect(result).toBe(15);
});
});
describe('sumBy', function () {
it('should return the sum of all elements in the collection', () => {
const collection = [{a: 1}, {a: 2}, {a: 3}, {a: 4}, {a: 5}];
const result = sumBy(collection, it => it.a);
expect(result).toBe(15);
});
});

View File

@@ -0,0 +1,31 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Sum an an array
*/
export function sumBy<T extends object>(
collection: T[],
transform: (value: T) => number | undefined,
): number {
return collection.reduce((accumulator, item) => accumulator + (transform(item) || 0), 0);
}
/**
* Sum an array of numbers
*/
export function sum(collection: Array<number | undefined>): number {
return collection.reduce<number>((accumulator, item) => accumulator + (item || 0), 0);
}

View File

@@ -0,0 +1,74 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Tree, treeGroupBy} from './tree-group';
interface TestItem {
id: number;
path?: string[];
}
describe('tree-group', function () {
it('should create a tree', function () {
const items: Array<TestItem> = [
{
id: 1,
path: ['a', 'b', 'c'],
},
{
id: 2,
path: ['a', 'b', 'd'],
},
];
const tree = treeGroupBy(items, item => item.path ?? []);
const expectedTree: Tree<TestItem> = {
a: {
b: {
c: {_: [items[0]]},
d: {_: [items[1]]},
} as Tree<TestItem>,
} as Tree<TestItem>,
} as Tree<TestItem>;
expect(tree).toEqual(expectedTree);
});
it('should also sort empty paths', () => {
const items: Array<TestItem> = [
{
id: 1,
path: ['a', 'b', 'c'],
},
{
id: 2,
},
];
const tree = treeGroupBy(items, item => item.path ?? []);
const expectedTree: Tree<TestItem> = {
a: {
b: {
c: {_: [items[0]]},
} as Tree<TestItem>,
} as Tree<TestItem>,
_: [items[1]],
} as Tree<TestItem>;
expect(tree).toEqual(expectedTree);
});
});

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
export type Tree<T> = {
[key: string]: Tree<T>;
} & {
_?: T[] | undefined;
};
/**
*
*/
export function treeGroupBy<T>(items: T[], transform: (item: T) => string[]): Tree<T> {
const tree: Tree<T> = {};
for (const item of items) {
let currentTree = tree;
const keys = transform(item);
if (keys.length === 0) {
currentTree._ = currentTree._ || [];
currentTree._.push(item);
}
for (const [i, key] of keys.entries()) {
currentTree = currentTree[key] = (currentTree[key] ?? {}) as Tree<T>;
if (i === keys.length - 1) {
currentTree._ = currentTree._ ?? [];
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
currentTree._.push(item);
}
}
}
return tree;
}

View File

@@ -0,0 +1,24 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {uniqBy} from './uniq';
describe('uniq', function () {
it('should return an array with unique values', function () {
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const result = uniqBy(array, it => it);
expect(result).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
});
});

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Filter out duplicates from an array.
*/
export function uniqBy<T>(array: T[], transform: (item: T) => string | number): T[] {
return Object.values(
array.reduce((accumulator, current) => {
accumulator[transform(current)] = current;
return accumulator;
}, {} as Record<string | number, T>),
);
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {zip} from './zip';
describe('zip', function () {
it('should zip arrays together', function () {
expect(zip([1, 2, 3], [4, 5, 6])).toEqual([
[1, 4],
[2, 5],
[3, 6],
]);
});
});

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Zip two arrays together.
*/
export function zip<T, U>(a: T[], b: U[]): [T, U][] {
return a.map((_, i) => [a[i], b[i]]);
}

View File

@@ -19,6 +19,7 @@
export class AppError extends Error {
/**
* TODO
*
* @param name Name of the error
* @param message Message of the error
*/

View File

@@ -25,12 +25,13 @@ import {SHARED_AXIS_DIRECTIONS} from './material-motion';
*
* ```html
* <div [ngSwitch]='choreographer.state'
* [@animation]='choreographer.animationState'
* [@animation.done]='choreographer.done()'>
* <div *ngSwitchCase='"a"'/>
* <div *ngSwitchCase='"b"'/>
* [@animation]='choreographer.animationState'
* [@animation.done]='choreographer.done()'>
* <div *ngSwitchCase='"a"'/>
* <div *ngSwitchCase='"b"'/>
* </div>
* ```
*
* @see {@link https://material.io/design/motion/the-motion-system.html#shared-axis}
*/
export class SharedAxisChoreographer<T> {

View File

@@ -16,6 +16,7 @@ import {animate, sequence, state, style, transition, trigger} from '@angular/ani
/**
* Fade transition
*
* @see {@link https://material.io/design/motion/the-motion-system.html#fade}
*/
export const materialFade = trigger('materialFade', [
@@ -26,6 +27,7 @@ export const materialFade = trigger('materialFade', [
/**
* Fade transition
*
* @see {@link https://material.io/design/motion/the-motion-system.html#fade}
*/
export const materialManualFade = trigger('materialManualFade', [
@@ -37,6 +39,7 @@ export const materialManualFade = trigger('materialManualFade', [
/**
* Fade through transition
*
* @see {@link https://material.io/design/motion/the-motion-system.html#fade-through}
*/
export const materialFadeThrough = trigger('materialFadeThrough', [
@@ -55,6 +58,7 @@ export const SHARED_AXIS_DIRECTIONS = {
* Shared axis transition along the X-Axis
*
* Needs to be manually choreographed
*
* @see {@link https://material.io/design/motion/the-motion-system.html#shared-axis}
* @see {SharedAxisChoreographer}
*/

View File

@@ -71,6 +71,7 @@ SwiperCore.use([FreeMode, Navigation]);
/**
* Initializes data needed on startup
*
* @param storageProvider provider of the saved data (using framework's storage)
* @param logger TODO
* @param settingsProvider provider of settings (e.g. language that has been set)
@@ -117,6 +118,7 @@ export function initializerFactory(
/**
* TODO
*
* @param http TODO
*/
export function createTranslateLoader(http: HttpClient) {

View File

@@ -36,7 +36,7 @@
</ion-col>
</ion-row>
</ion-grid>
<ion-item *ngSwitchCase="'router link'" [routerLink]="content.link">
<ion-item *ngSwitchCase="'router link'" [routerLink]="content.link" fill="clear">
<ion-icon *ngIf="content.icon" [name]="content.icon" slot="start"></ion-icon>
<ion-label>{{ 'title' | translateSimple : content }}</ion-label>
</ion-item>

View File

@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
@import '../../../../theme/util/mixins';
@import '~src/theme/util/mixins';
ion-text {
margin-inline: var(--spacing-md);

View File

@@ -12,12 +12,14 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Injectable} from '@angular/core';
import {ConfigProvider} from '../config/config.provider';
import {SCAssessment, SCUuid} from '@openstapps/core';
import {DefaultAuthService} from '../auth/default-auth.service';
import {HttpClient} from '@angular/common/http';
import {uniqBy, keyBy} from '@openstapps/collection-utils';
import {uniqBy} from '../../_helpers/collections/uniq';
import {keyBy} from '../../_helpers/collections/key-by';
/**
*

View File

@@ -13,23 +13,21 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, DestroyRef, inject, Input, OnInit, ViewChild} from '@angular/core';
import {Component, Input, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {AssessmentsProvider} from '../assessments.provider';
import {DataDetailComponent, ExternalDataLoadEvent} from '../../data/detail/data-detail.component';
import {NavController, ViewWillEnter} from '@ionic/angular';
import {Subscription} from 'rxjs';
import {DataRoutingService} from '../../data/data-routing.service';
import {SCAssessment} from '@openstapps/core';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
@Component({
selector: 'assessments-detail',
templateUrl: 'assessments-detail.html',
styleUrls: ['assessments-detail.scss'],
})
export class AssessmentsDetailComponent implements ViewWillEnter, OnInit {
destroy$ = inject(DestroyRef);
export class AssessmentsDetailComponent implements ViewWillEnter, OnInit, OnDestroy {
constructor(
readonly route: ActivatedRoute,
readonly assessmentsProvider: AssessmentsProvider,
@@ -38,6 +36,8 @@ export class AssessmentsDetailComponent implements ViewWillEnter, OnInit {
readonly activatedRoute: ActivatedRoute,
) {}
subscriptions: Subscription[] = [];
@Input() dataPathAutoRouting = true;
@ViewChild(DataDetailComponent)
@@ -47,16 +47,19 @@ export class AssessmentsDetailComponent implements ViewWillEnter, OnInit {
ngOnInit() {
if (!this.dataPathAutoRouting) return;
this.dataRoutingService
.pathSelectListener()
.pipe(takeUntilDestroyed(this.destroy$))
.subscribe(item => {
this.subscriptions.push(
this.dataRoutingService.pathSelectListener().subscribe(item => {
void this.navController.navigateBack(['assessments', 'detail', item.uid], {
queryParams: {
token: this.activatedRoute.snapshot.queryParamMap.get('token'),
},
});
});
}),
);
}
ngOnDestroy() {
for (const sub of this.subscriptions) sub.unsubscribe();
}
getItem(event: ExternalDataLoadEvent) {

View File

@@ -13,18 +13,18 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, DestroyRef, inject, Input, OnInit} from '@angular/core';
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
import {SCThings} from '@openstapps/core';
import {Subscription} from 'rxjs';
import {DataRoutingService} from '../../data/data-routing.service';
import {ActivatedRoute, Router} from '@angular/router';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
@Component({
selector: 'assessments-simple-data-list',
templateUrl: 'assessments-simple-data-list.html',
styleUrls: ['assessments-simple-data-list.scss'],
})
export class AssessmentsSimpleDataListComponent implements OnInit {
export class AssessmentsSimpleDataListComponent implements OnInit, OnDestroy {
/**
* All SCThings to display
*/
@@ -44,7 +44,7 @@ export class AssessmentsSimpleDataListComponent implements OnInit {
this._items = new Promise(resolve => resolve(items));
}
destroy$ = inject(DestroyRef);
subscriptions: Subscription[] = [];
constructor(
readonly dataRoutingService: DataRoutingService,
@@ -53,15 +53,18 @@ export class AssessmentsSimpleDataListComponent implements OnInit {
) {}
ngOnInit() {
this.dataRoutingService
.itemSelectListener()
.pipe(takeUntilDestroyed(this.destroy$))
.subscribe(thing => {
this.subscriptions.push(
this.dataRoutingService.itemSelectListener().subscribe(thing => {
void this.router.navigate(['assessments', 'detail', thing.uid], {
queryParams: {
token: this.activatedRoute.snapshot.queryParamMap.get('token'),
},
});
});
}),
);
}
ngOnDestroy() {
for (const subscription of this.subscriptions) subscription.unsubscribe();
}
}

View File

@@ -12,17 +12,19 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {AfterViewInit, Component, DestroyRef, inject, OnInit, ViewChild} from '@angular/core';
import {AfterViewInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {AssessmentsProvider} from '../assessments.provider';
import {SCAssessment, SCCourseOfStudy} from '@openstapps/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Subscription} from 'rxjs';
import {NGXLogger} from 'ngx-logger';
import {materialSharedAxisX} from '../../../animation/material-motion';
import {SharedAxisChoreographer} from '../../../animation/animation-choreographer';
import {DataProvider, DataScope} from '../../data/data.provider';
import {DataRoutingService} from '../../data/data-routing.service';
import {groupBy, mapValues} from '@openstapps/collection-utils';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {groupBy} from '../../../_helpers/collections/group-by';
import {mapValues} from '../../../_helpers/collections/map-values';
@Component({
selector: 'app-assessments-page',
@@ -30,7 +32,7 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
styleUrls: ['assessments-page.scss'],
animations: [materialSharedAxisX],
})
export class AssessmentsPageComponent implements OnInit, AfterViewInit {
export class AssessmentsPageComponent implements OnInit, AfterViewInit, OnDestroy {
assessments: Promise<
Record<
string,
@@ -43,12 +45,12 @@ export class AssessmentsPageComponent implements OnInit, AfterViewInit {
assessmentKeys: string[] = [];
routingSubscription: Subscription;
@ViewChild('segment') segmentView!: HTMLIonSegmentElement;
sharedAxisChoreographer: SharedAxisChoreographer<string> = new SharedAxisChoreographer<string>('', []);
destroy$ = inject(DestroyRef);
constructor(
readonly logger: NGXLogger,
readonly assessmentsProvider: AssessmentsProvider,
@@ -62,17 +64,18 @@ export class AssessmentsPageComponent implements OnInit, AfterViewInit {
this.segmentView.value = this.sharedAxisChoreographer.currentValue;
}
ngOnDestroy() {
this.routingSubscription.unsubscribe();
}
ngOnInit() {
this.dataRoutingService
.itemSelectListener()
.pipe(takeUntilDestroyed(this.destroy$))
.subscribe(thing => {
void this.router.navigate(['assessments', 'detail', thing.uid], {
queryParams: {
token: this.activatedRoute.snapshot.queryParamMap.get('token'),
},
});
this.routingSubscription = this.dataRoutingService.itemSelectListener().subscribe(thing => {
void this.router.navigate(['assessments', 'detail', thing.uid], {
queryParams: {
token: this.activatedRoute.snapshot.queryParamMap.get('token'),
},
});
});
this.activatedRoute.queryParams.subscribe(parameters => {
try {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 StApps
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,29 +12,41 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component} from '@angular/core';
import {OnInit, OnDestroy, Component} from '@angular/core';
import {NavController} from '@ionic/angular';
import {Router} from '@angular/router';
import {AuthActions, IAuthAction} from 'ionic-appauth';
import {Subscription} from 'rxjs';
import {SCAuthorizationProviderType} from '@openstapps/core';
import {AuthHelperService} from '../../auth-helper.service';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {Observable} from 'rxjs';
import {IPAIAAuthAction} from '../../paia/paia-auth-action';
@Component({
templateUrl: 'auth-callback-page.component.html',
styleUrls: ['auth-callback-page.component.scss'],
})
export class AuthCallbackPageComponent {
export class AuthCallbackPageComponent implements OnInit, OnDestroy {
PROVIDER_TYPE: SCAuthorizationProviderType = 'default';
constructor(private navCtrl: NavController, private router: Router, private authHelper: AuthHelperService) {
const provider = this.authHelper.getProvider(this.PROVIDER_TYPE);
const events: Observable<IPAIAAuthAction | IAuthAction> = provider.events$;
private authEvents: Subscription;
events.pipe(takeUntilDestroyed()).subscribe((action: IAuthAction) => this.postCallback(action));
provider.authorizationCallback(window.location.origin + this.router.url);
constructor(
private navCtrl: NavController,
private router: Router,
private authHelper: AuthHelperService,
) {}
ngOnInit() {
this.authEvents = this.authHelper
.getProvider(this.PROVIDER_TYPE)
.events$.subscribe((action: IAuthAction) => this.postCallback(action));
this.authHelper
.getProvider(this.PROVIDER_TYPE)
.authorizationCallback(window.location.origin + this.router.url);
}
ngOnDestroy() {
this.authEvents.unsubscribe();
}
async postCallback(action: IAuthAction) {

Some files were not shown because too many files have changed in this diff Show More