ThreadCount Community edition
Uniform stock management for healthcare linen rooms: the coordinator app, the phone counter and the staff app, for your own server. Built from 8685140 on 2026-09-13. Licensed under the Functional Source License (FSL-1.1-ALv2).
@@ -0,0 +1,17 @@
|
|||||||
|
node_modules
|
||||||
|
.next
|
||||||
|
.deploy-prev
|
||||||
|
.photos
|
||||||
|
.git
|
||||||
|
.gitea
|
||||||
|
.claude
|
||||||
|
android
|
||||||
|
android-staff
|
||||||
|
androidshell
|
||||||
|
docs
|
||||||
|
patches/*.orig
|
||||||
|
*.aab
|
||||||
|
*.apk
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# Every variable the Community edition reads. docker-compose.yml passes this file to the app and
|
||||||
|
# fills DATABASE_URL, PORT and PHOTO_DIR itself.
|
||||||
|
#
|
||||||
|
# The variables beginning NEXT_PUBLIC_ are compiled into the browser bundle at build time, not read
|
||||||
|
# at runtime — set them before the first `docker compose up --build`, and rebuild if they change.
|
||||||
|
|
||||||
|
# ---- required ----
|
||||||
|
# Signs every session cookie. Generate one per instance (`openssl rand -base64 48`). The server
|
||||||
|
# refuses to start while it still says change-me.
|
||||||
|
SESSION_SECRET=change-me
|
||||||
|
# The bundled database's password (docker-compose.yml only).
|
||||||
|
POSTGRES_PASSWORD=
|
||||||
|
# The address people open the app at, e.g. https://uniforms.example.health. Used in emailed links.
|
||||||
|
NEXT_PUBLIC_SITE_URL=http://localhost:3000
|
||||||
|
# Always "community" on your own server.
|
||||||
|
EDITION=community
|
||||||
|
|
||||||
|
# ---- your documents ----
|
||||||
|
# The staff sign-in and the account screens link to a terms page and a privacy notice. Point them
|
||||||
|
# at your own; until you do they point at threadcount.tech's, which describe the hosted service.
|
||||||
|
NEXT_PUBLIC_TERMS_URL=
|
||||||
|
NEXT_PUBLIC_PRIVACY_URL=
|
||||||
|
|
||||||
|
# ---- transactional mail (optional) ----
|
||||||
|
# With these unset nothing is sent: password resets and approval links are handled at the counter,
|
||||||
|
# and the screens say so rather than claiming otherwise.
|
||||||
|
SMTP_HOST=
|
||||||
|
SMTP_PORT=587
|
||||||
|
SMTP_USER=
|
||||||
|
SMTP_PASS=
|
||||||
|
SMTP_FROM="ThreadCount <no-reply@example.health>"
|
||||||
|
|
||||||
|
# ---- optional ----
|
||||||
|
# 1 hides the create-account form and refuses the sign-up endpoint. Set it once your facility exists.
|
||||||
|
SIGNUPS_DISABLED=
|
||||||
|
# Cloudflare Turnstile on sign-in and sign-up. Set both to enforce it; leave both blank to rely on
|
||||||
|
# the per-address rate limits alone.
|
||||||
|
TURNSTILE_SECRET=
|
||||||
|
NEXT_PUBLIC_TURNSTILE_SITEKEY=
|
||||||
|
# Your own GlitchTip (Sentry-protocol) DSN for error reports. Blank = nothing is reported anywhere.
|
||||||
|
NEXT_PUBLIC_GLITCHTIP_DSN=
|
||||||
|
# Stamped on error reports so a fault can be tied to a build.
|
||||||
|
NEXT_PUBLIC_RELEASE=
|
||||||
|
# Host port docker-compose.yml publishes the app on (the container always listens on 3000).
|
||||||
|
APP_PORT=3000
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
/.pnp
|
||||||
|
.pnp.*
|
||||||
|
.yarn/*
|
||||||
|
!.yarn/patches
|
||||||
|
!.yarn/plugins
|
||||||
|
!.yarn/releases
|
||||||
|
!.yarn/versions
|
||||||
|
|
||||||
|
# testing
|
||||||
|
/coverage
|
||||||
|
|
||||||
|
# next.js
|
||||||
|
/.next/
|
||||||
|
/out/
|
||||||
|
|
||||||
|
# production
|
||||||
|
/build
|
||||||
|
|
||||||
|
# scripts/deploy.sh hardlinks the running build and node_modules in here so a failed deploy can be
|
||||||
|
# undone, and deletes it again when the deploy ends. While one is in flight it is ~100k untracked
|
||||||
|
# files sitting in the work tree, which would otherwise drown `git status` on the production box.
|
||||||
|
/.deploy-prev/
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
||||||
|
*.pem
|
||||||
|
|
||||||
|
# debug
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
.pnpm-debug.log*
|
||||||
|
|
||||||
|
# env files (can opt-in for committing if needed)
|
||||||
|
.env*
|
||||||
|
# written by scripts/deploy.sh on the box
|
||||||
|
.release.json
|
||||||
|
|
||||||
|
# vercel
|
||||||
|
.vercel
|
||||||
|
|
||||||
|
# typescript
|
||||||
|
*.tsbuildinfo
|
||||||
|
next-env.d.ts
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
|
||||||
|
# Android / Capacitor build output. The project itself is committed; its build products are not.
|
||||||
|
android/.gradle/
|
||||||
|
android/build/
|
||||||
|
android/app/build/
|
||||||
|
android/capacitor-cordova-android-plugins/build/
|
||||||
|
android/local.properties
|
||||||
|
android/app/src/main/assets/public/
|
||||||
|
|
||||||
|
# The staff app's native project. Same rules: sources are committed, build output and the
|
||||||
|
# capacitor-copied web assets are not.
|
||||||
|
android-staff/.gradle/
|
||||||
|
android-staff/build/
|
||||||
|
android-staff/app/build/
|
||||||
|
android-staff/capacitor-cordova-android-plugins/build/
|
||||||
|
android-staff/local.properties
|
||||||
|
android-staff/app/src/main/assets/public/
|
||||||
|
*.aab
|
||||||
|
*.apk
|
||||||
|
*.jks
|
||||||
|
*.keystore
|
||||||
|
keystore.properties
|
||||||
|
|
||||||
|
# Photo storage: signatures and damage photographs live on disk, not in the repo or the database.
|
||||||
|
.photos/
|
||||||
|
# session scratch, never committed
|
||||||
|
.scratch/
|
||||||
|
|
||||||
|
# scratch trees made by scripts/publish-community.sh
|
||||||
|
/.community-build.*
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
community 2026-09-13 8685140
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
# ThreadCount, Community edition — one image, built where it runs.
|
||||||
|
#
|
||||||
|
# Built locally by `docker compose build` rather than pulled, and for a reason: everything that
|
||||||
|
# starts NEXT_PUBLIC_ is compiled into the browser bundle, so the address people will open the app
|
||||||
|
# at (NEXT_PUBLIC_SITE_URL) and the optional Turnstile site key have to be known at build time.
|
||||||
|
# docker-compose.yml passes them in from your .env as build arguments.
|
||||||
|
#
|
||||||
|
# Three stages:
|
||||||
|
# deps — node_modules from the lockfile (patch-package runs in postinstall).
|
||||||
|
# builder — the Prisma client and the Next build. Also the image `docker compose run migrate`
|
||||||
|
# uses, because it still has the Prisma CLI.
|
||||||
|
# runner — Next's standalone output only: no compiler, no CLI, a non-root user.
|
||||||
|
|
||||||
|
FROM node:24-bookworm-slim AS deps
|
||||||
|
WORKDIR /app
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
COPY patches ./patches
|
||||||
|
RUN npm ci --ignore-scripts && npx patch-package
|
||||||
|
|
||||||
|
FROM deps AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
ARG NEXT_PUBLIC_SITE_URL=http://localhost:3000
|
||||||
|
ARG NEXT_PUBLIC_TURNSTILE_SITEKEY=
|
||||||
|
ENV NEXT_PUBLIC_SITE_URL=$NEXT_PUBLIC_SITE_URL \
|
||||||
|
NEXT_PUBLIC_TURNSTILE_SITEKEY=$NEXT_PUBLIC_TURNSTILE_SITEKEY \
|
||||||
|
EDITION=community \
|
||||||
|
NEXT_OUTPUT=standalone \
|
||||||
|
NEXT_TELEMETRY_DISABLED=1
|
||||||
|
RUN npx prisma generate && npm run build
|
||||||
|
|
||||||
|
FROM node:24-bookworm-slim AS runner
|
||||||
|
WORKDIR /app
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates curl && rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& groupadd -r threadcount && useradd -r -g threadcount -d /app threadcount \
|
||||||
|
&& mkdir -p /data/photos && chown -R threadcount:threadcount /data
|
||||||
|
ENV NODE_ENV=production \
|
||||||
|
EDITION=community \
|
||||||
|
PHOTO_DIR=/data/photos \
|
||||||
|
PORT=3000 \
|
||||||
|
HOSTNAME=0.0.0.0 \
|
||||||
|
NEXT_TELEMETRY_DISABLED=1
|
||||||
|
COPY --from=builder --chown=threadcount:threadcount /app/.next/standalone ./
|
||||||
|
COPY --from=builder --chown=threadcount:threadcount /app/.next/static ./.next/static
|
||||||
|
COPY --from=builder --chown=threadcount:threadcount /app/public ./public
|
||||||
|
USER threadcount
|
||||||
|
EXPOSE 3000
|
||||||
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 CMD curl -fsS http://127.0.0.1:3000/api/health || exit 1
|
||||||
|
CMD ["node", "server.js"]
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
# Functional Source License, Version 1.1, ALv2 Future License
|
||||||
|
|
||||||
|
## Abbreviation
|
||||||
|
|
||||||
|
FSL-1.1-ALv2
|
||||||
|
|
||||||
|
## Notice
|
||||||
|
|
||||||
|
Copyright 2026 ThreadCount (threadcount.tech)
|
||||||
|
|
||||||
|
## Terms and Conditions
|
||||||
|
|
||||||
|
### Licensor ("We")
|
||||||
|
|
||||||
|
The party offering the Software under these Terms and Conditions.
|
||||||
|
|
||||||
|
### The Software
|
||||||
|
|
||||||
|
The "Software" is each version of the software that we make available under
|
||||||
|
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
||||||
|
Conditions with the Software.
|
||||||
|
|
||||||
|
### License Grant
|
||||||
|
|
||||||
|
Subject to your compliance with this License Grant and the Patents,
|
||||||
|
Redistribution and Trademark clauses below, we hereby grant you the right to
|
||||||
|
use, copy, modify, create derivative works, publicly perform, publicly display
|
||||||
|
and redistribute the Software for any Permitted Purpose identified below.
|
||||||
|
|
||||||
|
### Permitted Purpose
|
||||||
|
|
||||||
|
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
||||||
|
means making the Software available to others in a commercial product or
|
||||||
|
service that:
|
||||||
|
|
||||||
|
1. substitutes for the Software;
|
||||||
|
|
||||||
|
2. substitutes for any other product or service we offer using the Software
|
||||||
|
that exists as of the date we make the Software available; or
|
||||||
|
|
||||||
|
3. offers the same or substantially similar functionality as the Software.
|
||||||
|
|
||||||
|
Permitted Purposes specifically include using the Software:
|
||||||
|
|
||||||
|
1. for your internal use and access;
|
||||||
|
|
||||||
|
2. for non-commercial education;
|
||||||
|
|
||||||
|
3. for non-commercial research; and
|
||||||
|
|
||||||
|
4. in connection with professional services that you provide to a licensee
|
||||||
|
using the Software in accordance with these Terms and Conditions.
|
||||||
|
|
||||||
|
### Patents
|
||||||
|
|
||||||
|
To the extent your use for a Permitted Purpose would necessarily infringe our
|
||||||
|
patents, the license grant above includes a license under our patents. If you
|
||||||
|
make a claim against any party that the Software infringes or contributes to
|
||||||
|
the infringement of any patent, then your patent license to the Software ends
|
||||||
|
immediately.
|
||||||
|
|
||||||
|
### Redistribution
|
||||||
|
|
||||||
|
The Terms and Conditions apply to all copies, modifications and derivatives of
|
||||||
|
the Software.
|
||||||
|
|
||||||
|
If you redistribute any copies, modifications or derivatives of the Software,
|
||||||
|
you must include a copy of or a link to these Terms and Conditions and not
|
||||||
|
remove any copyright notices provided in or with the Software.
|
||||||
|
|
||||||
|
### Disclaimer
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
||||||
|
|
||||||
|
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
||||||
|
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
||||||
|
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
||||||
|
|
||||||
|
### Trademarks
|
||||||
|
|
||||||
|
Except for displaying the License Details and identifying us as the origin of
|
||||||
|
the Software, you have no right under these Terms and Conditions to use our
|
||||||
|
trademarks, trade names, service marks or product names.
|
||||||
|
|
||||||
|
## Grant of Future License
|
||||||
|
|
||||||
|
We hereby irrevocably grant you an additional license to use the Software under
|
||||||
|
the Apache License, Version 2.0 that is effective on the second anniversary of
|
||||||
|
the date we make the Software available. On or after that date, you may use the
|
||||||
|
Software under the Apache License, Version 2.0, in which case the following
|
||||||
|
will apply:
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||||
|
this file except in compliance with the License.
|
||||||
|
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software distributed
|
||||||
|
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||||
|
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations under the License.
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
# ThreadCount
|
||||||
|
|
||||||
|
Uniform stock management for healthcare linen rooms: what is on the shelf, who took it, what it
|
||||||
|
cost the ward, and the supplier orders and stocktakes in between. Written by a hospital uniform
|
||||||
|
coordinator for their own room.
|
||||||
|
|
||||||
|
- **Hosted** at [threadcount.tech](https://threadcount.tech) — free for a room under 60 staff
|
||||||
|
records, paid hosting for a facility, a bundle for a health service. [Pricing](https://threadcount.tech/pricing).
|
||||||
|
- **Community edition** — this repository, for a facility or health service that wants to run it
|
||||||
|
on its own server. The whole product a room uses: the coordinator app, the phone counter and the
|
||||||
|
staff app, with no plans, no ceiling and nothing reported anywhere. Licensed under the
|
||||||
|
[Functional Source License](LICENSE): use it, change it, run it for your own organisation; not a
|
||||||
|
licence to offer it as a service to others.
|
||||||
|
|
||||||
|
What the Community edition leaves out is what belongs to the hosted service: the website, the
|
||||||
|
health-service layer, single sign-on and card payments. [docs/self-hosting.md](docs/self-hosting.md)
|
||||||
|
has the exact list, and how to point the Android apps at your server.
|
||||||
|
|
||||||
|
## Run it yourself
|
||||||
|
|
||||||
|
You need Docker with Compose, a machine with 2 GB of memory, and a hostname with TLS in front of
|
||||||
|
it (any reverse proxy — Caddy, nginx, Traefik). The app sets `Secure` cookies in production, so it
|
||||||
|
will not sign anyone in over plain HTTP from another machine.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone https://gitea.pricehq.tech/kyle/threadcount-community.git
|
||||||
|
cd threadcount-community
|
||||||
|
cp .env.example .env
|
||||||
|
```
|
||||||
|
|
||||||
|
Edit `.env` and set at least:
|
||||||
|
|
||||||
|
| Variable | What it is |
|
||||||
|
|---|---|
|
||||||
|
| `SESSION_SECRET` | Signs every session cookie. `openssl rand -base64 48`. The server refuses to start while it says `change-me`. |
|
||||||
|
| `POSTGRES_PASSWORD` | The bundled database's password. Anything long. |
|
||||||
|
| `NEXT_PUBLIC_SITE_URL` | The address people will open the app at, e.g. `https://uniforms.example.health`. Compiled in at build time, so set it before the first build. |
|
||||||
|
| `EDITION` | `community`. |
|
||||||
|
| `SMTP_HOST`, `SMTP_PORT`, `SMTP_USER`, `SMTP_PASS`, `SMTP_FROM` | Optional. Without them nothing is emailed — password resets and manager approval links then have to be handled at the counter, and the screens say so. |
|
||||||
|
|
||||||
|
Then:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker compose up -d --build
|
||||||
|
```
|
||||||
|
|
||||||
|
The first start creates the database schema. Open your hostname, choose **Create account**, name
|
||||||
|
your facility: you are its first administrator. Load the catalogue and staff register from CSV
|
||||||
|
under Settings › Data (templates are there), and set `SIGNUPS_DISABLED=1` in `.env` once your
|
||||||
|
facility exists so nobody else can create one on your instance.
|
||||||
|
|
||||||
|
Upgrading, backups, restoring, single sign-on, Turnstile, and what the two Android apps can and
|
||||||
|
cannot do against a self-hosted instance: [docs/self-hosting.md](docs/self-hosting.md).
|
||||||
|
|
||||||
|
## Developing
|
||||||
|
|
||||||
|
Node 24 and a Postgres. `npm ci`, put `DATABASE_URL` and `SESSION_SECRET` in `.env`, then
|
||||||
|
`npx prisma migrate deploy && npm run dev`. The end-to-end suites are plain bash and curl against a
|
||||||
|
dev server on port 3111: `scripts/e2e*.sh`. `scripts/check-identity.sh` must stay clean.
|
||||||
|
|
||||||
|
## Licence
|
||||||
|
|
||||||
|
Functional Source License, version 1.1, with Apache 2.0 as the future licence
|
||||||
|
(FSL-1.1-ALv2). In plain words: run it for your own facility or health service, read it, change
|
||||||
|
it, and share your changes; do not offer it to others as a competing uniform-management service.
|
||||||
|
Each release becomes Apache 2.0 two years after it is published. See [LICENSE](LICENSE).
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore
|
||||||
|
|
||||||
|
# Built application files
|
||||||
|
*.apk
|
||||||
|
*.aar
|
||||||
|
*.ap_
|
||||||
|
*.aab
|
||||||
|
|
||||||
|
# Files for the ART/Dalvik VM
|
||||||
|
*.dex
|
||||||
|
|
||||||
|
# Java class files
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
bin/
|
||||||
|
gen/
|
||||||
|
out/
|
||||||
|
# Uncomment the following line in case you need and you don't have the release build type files in your app
|
||||||
|
# release/
|
||||||
|
|
||||||
|
# Gradle files
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Local configuration file (sdk path, etc)
|
||||||
|
local.properties
|
||||||
|
|
||||||
|
# Proguard folder generated by Eclipse
|
||||||
|
proguard/
|
||||||
|
|
||||||
|
# Log Files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Android Studio Navigation editor temp files
|
||||||
|
.navigation/
|
||||||
|
|
||||||
|
# Android Studio captures folder
|
||||||
|
captures/
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
*.iml
|
||||||
|
.idea/workspace.xml
|
||||||
|
.idea/tasks.xml
|
||||||
|
.idea/gradle.xml
|
||||||
|
.idea/assetWizardSettings.xml
|
||||||
|
.idea/dictionaries
|
||||||
|
.idea/libraries
|
||||||
|
# Android Studio 3 in .gitignore file.
|
||||||
|
.idea/caches
|
||||||
|
.idea/modules.xml
|
||||||
|
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
|
||||||
|
.idea/navEditor.xml
|
||||||
|
|
||||||
|
# Keystore files
|
||||||
|
# Uncomment the following lines if you do not want to check your keystore files in.
|
||||||
|
#*.jks
|
||||||
|
#*.keystore
|
||||||
|
|
||||||
|
# External native build folder generated in Android Studio 2.2 and later
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx/
|
||||||
|
|
||||||
|
# Google Services (e.g. APIs or Firebase)
|
||||||
|
# google-services.json
|
||||||
|
|
||||||
|
# Freeline
|
||||||
|
freeline.py
|
||||||
|
freeline/
|
||||||
|
freeline_project_description.json
|
||||||
|
|
||||||
|
# fastlane
|
||||||
|
fastlane/report.xml
|
||||||
|
fastlane/Preview.html
|
||||||
|
fastlane/screenshots
|
||||||
|
fastlane/test_output
|
||||||
|
fastlane/readme.md
|
||||||
|
|
||||||
|
# Version control
|
||||||
|
vcs.xml
|
||||||
|
|
||||||
|
# lint
|
||||||
|
lint/intermediates/
|
||||||
|
lint/generated/
|
||||||
|
lint/outputs/
|
||||||
|
lint/tmp/
|
||||||
|
# lint/reports/
|
||||||
|
|
||||||
|
# Android Profiling
|
||||||
|
*.hprof
|
||||||
|
|
||||||
|
# Cordova plugins for Capacitor
|
||||||
|
capacitor-cordova-android-plugins
|
||||||
|
|
||||||
|
# Copied web assets
|
||||||
|
app/src/main/assets/public
|
||||||
|
|
||||||
|
# Generated Config files
|
||||||
|
app/src/main/assets/capacitor.config.json
|
||||||
|
app/src/main/assets/capacitor.plugins.json
|
||||||
|
app/src/main/res/xml/config.xml
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/build/*
|
||||||
|
!/build/.npmkeep
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
// Release signing. The keystore and its password live in ~/threadcount-keys, outside the repo —
|
||||||
|
// nothing secret is ever committed. Without either file the release build is simply unsigned, so a
|
||||||
|
// fresh clone still builds.
|
||||||
|
//
|
||||||
|
// staff-keystore.properties wins if it exists, so this app can be given its own upload key later
|
||||||
|
// without touching the build; until then it shares the counter app's, which is what Play expects
|
||||||
|
// anyway — with Play App Signing the upload key only authenticates the upload, and two listings
|
||||||
|
// from one publisher sharing one is ordinary. Splitting them is a decision worth making
|
||||||
|
// deliberately, not by default.
|
||||||
|
def keystoreProps = new Properties()
|
||||||
|
def staffKeys = file("${System.getProperty('user.home')}/threadcount-keys/staff-keystore.properties")
|
||||||
|
def sharedKeys = file("${System.getProperty('user.home')}/threadcount-keys/keystore.properties")
|
||||||
|
def keystorePropsFile = staffKeys.exists() ? staffKeys : sharedKeys
|
||||||
|
if (keystorePropsFile.exists()) {
|
||||||
|
keystorePropsFile.withInputStream { keystoreProps.load(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace "tech.threadcount.staff"
|
||||||
|
compileSdk rootProject.ext.compileSdkVersion
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "tech.threadcount.staff"
|
||||||
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
|
// Play permanently reserves a version code the moment a bundle is ingested, even into a
|
||||||
|
// discarded draft — it can never be reused. Bump this for EVERY upload, not every release.
|
||||||
|
// 1 was spent on the first bundle, before the sign-in rework, app links and the video.
|
||||||
|
// 2 was uploaded before the sign-out fixes. Play keeps a code the moment it ingests a
|
||||||
|
// bundle, so neither can ever be reused.
|
||||||
|
versionCode 8
|
||||||
|
versionName "1.3"
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
aaptOptions {
|
||||||
|
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
signingConfigs {
|
||||||
|
release {
|
||||||
|
if (keystoreProps['storeFile']) {
|
||||||
|
storeFile file(keystoreProps['storeFile'])
|
||||||
|
storePassword keystoreProps['storePassword']
|
||||||
|
keyAlias keystoreProps['keyAlias']
|
||||||
|
keyPassword keystoreProps['keyPassword']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
if (keystoreProps['storeFile']) {
|
||||||
|
signingConfig signingConfigs.release
|
||||||
|
}
|
||||||
|
// R8 shrinks and obfuscates, and Gradle folds the resulting mapping.txt into the
|
||||||
|
// bundle, which is what lets Play symbolicate a stack trace instead of showing
|
||||||
|
// a.b.c(). Capacitor ships its plugin keep-rules as consumerProguardFiles, so the
|
||||||
|
// classes the bridge loads reflectively survive; proguard-rules.pro pins the rest.
|
||||||
|
//
|
||||||
|
// Resource shrinking is deliberately left off, as in the counter app: the bundled
|
||||||
|
// splash and welcome are plain files under assets/, which resource shrinking never
|
||||||
|
// inspects, so it would trade a real risk for almost no bytes.
|
||||||
|
minifyEnabled true
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
|
||||||
|
// This app ships no native code at all — the barcode scanner and its MLKit/CameraX
|
||||||
|
// .so files are stripped out by scripts/build-staff-aab.sh before the build. The
|
||||||
|
// block stays so that the day it does, the symbols go with it without anyone having
|
||||||
|
// to remember.
|
||||||
|
ndk {
|
||||||
|
debugSymbolLevel 'FULL'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Devices from Android 15 can run 16 KB memory pages, and Play refuses uploads whose native
|
||||||
|
// libraries are only 4 KB-aligned. Uncompressed + page-aligned .so files satisfy both.
|
||||||
|
packaging {
|
||||||
|
jniLibs {
|
||||||
|
useLegacyPackaging false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
flatDir{
|
||||||
|
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
||||||
|
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
|
||||||
|
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
|
||||||
|
// WebViewCompat / WebViewFeature, for MainActivity.giveTheSiteTheBridge(). The Capacitor
|
||||||
|
// module has this as an implementation dependency, which does not reach this module.
|
||||||
|
implementation "androidx.webkit:webkit:$androidxWebkitVersion"
|
||||||
|
implementation project(':capacitor-android')
|
||||||
|
testImplementation "junit:junit:$junitVersion"
|
||||||
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
||||||
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
||||||
|
implementation project(':capacitor-cordova-android-plugins')
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: 'capacitor.build.gradle'
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
||||||
|
dependencies {
|
||||||
|
implementation project(':capacitor-browser')
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (hasProperty('postBuildExtras')) {
|
||||||
|
postBuildExtras()
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# R8 rules for the ThreadCount Staff shell.
|
||||||
|
#
|
||||||
|
# Capacitor's own AAR already contributes consumerProguardFiles that keep anything extending
|
||||||
|
# com.getcapacitor.Plugin and the @CapacitorPlugin / @PluginMethod members. These rules cover the
|
||||||
|
# things that sit outside that net — everything the bridge, the WebView or the manifest reaches by
|
||||||
|
# name rather than by a reference R8 can see.
|
||||||
|
#
|
||||||
|
# This app carries no plugins at all: scripts/build-staff-aab.sh strips the barcode scanner and
|
||||||
|
# haptics out of the generated gradle files and empties assets/capacitor.plugins.json after every
|
||||||
|
# sync, so there is nothing here to keep for them. Rules naming those packages were inherited from
|
||||||
|
# the counter app's copy and matched nothing.
|
||||||
|
|
||||||
|
# The bridge, its WebView plumbing, and the annotations that drive plugin dispatch.
|
||||||
|
-keep class com.getcapacitor.** { *; }
|
||||||
|
-keep interface com.getcapacitor.** { *; }
|
||||||
|
-keep @interface com.getcapacitor.** { *; }
|
||||||
|
|
||||||
|
# Anything the WebView calls from JavaScript. proguard-android.txt carries this rule too; it is
|
||||||
|
# repeated here because losing it silently breaks every call from the page into the app.
|
||||||
|
-keepclassmembers class * {
|
||||||
|
@android.webkit.JavascriptInterface <methods>;
|
||||||
|
}
|
||||||
|
|
||||||
|
# The activity is named in AndroidManifest.xml, and it subclasses BridgeWebViewClient to keep the
|
||||||
|
# back button honest and to follow an approval link into the right page.
|
||||||
|
-keep class tech.threadcount.staff.** { *; }
|
||||||
|
|
||||||
|
# Keep source file and line numbers in stack traces, and tell Play's symbolicator where to look.
|
||||||
|
# Without these a crash report names the class but not the line that threw.
|
||||||
|
-keepattributes SourceFile,LineNumberTable
|
||||||
|
-renamesourcefileattribute SourceFile
|
||||||
|
|
||||||
|
# Annotations drive both Capacitor's dispatch and AndroidX's lifecycle wiring.
|
||||||
|
-keepattributes *Annotation*,Signature,InnerClasses,EnclosingMethod
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.getcapacitor.myapp;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class ExampleInstrumentedTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void useAppContext() throws Exception {
|
||||||
|
// Context of the app under test.
|
||||||
|
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||||
|
|
||||||
|
assertEquals("com.getcapacitor.app", appContext.getPackageName());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="false"
|
||||||
|
android:enableOnBackInvokedCallback="true"
|
||||||
|
android:fullBackupContent="false"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme">
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:label="@string/title_activity_main"
|
||||||
|
android:theme="@style/AppTheme.NoActionBarLaunch"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:exported="true">
|
||||||
|
|
||||||
|
<meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" />
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<!-- The whole approval flow arrives by email. Without this, tapping "Approve" in a
|
||||||
|
manager's inbox opens Chrome rather than the app they installed. Scoped to /my
|
||||||
|
only: the marketing site and the linen room's own /app must keep opening in a
|
||||||
|
browser. -->
|
||||||
|
<intent-filter android:autoVerify="true">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="https" android:host="threadcount.tech" android:pathPrefix="/my" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
android:authorities="${applicationId}.fileprovider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/file_paths"></meta-data>
|
||||||
|
</provider>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
<!-- Permissions -->
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,265 @@
|
|||||||
|
package tech.threadcount.staff;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.webkit.WebResourceRequest;
|
||||||
|
import android.webkit.WebResourceResponse;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
|
||||||
|
import androidx.activity.OnBackPressedCallback;
|
||||||
|
import androidx.webkit.WebViewCompat;
|
||||||
|
import androidx.webkit.WebViewFeature;
|
||||||
|
|
||||||
|
import com.getcapacitor.Bridge;
|
||||||
|
import com.getcapacitor.BridgeActivity;
|
||||||
|
import com.getcapacitor.BridgeWebViewClient;
|
||||||
|
import com.getcapacitor.JSExport;
|
||||||
|
import com.getcapacitor.PluginHandle;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Back navigation.
|
||||||
|
*
|
||||||
|
* Capacitor 6 leaves the back button alone, and nothing else was handling it, so back finished the
|
||||||
|
* activity from wherever you were standing: halfway through a request, one back gesture and the
|
||||||
|
* app was gone. Here back walks the WebView's history instead — which includes the app's own
|
||||||
|
* client-side routing — and only leaves the app once there is nothing left to go back to.
|
||||||
|
*
|
||||||
|
* The callback's enabled flag is kept in step with canGoBack() rather than left permanently on,
|
||||||
|
* because Android 13+ reads that flag before the gesture starts to decide whether to animate. With
|
||||||
|
* it accurate, a back gesture at the root peels the app away to reveal the home screen (predictive
|
||||||
|
* back, switched on by android:enableOnBackInvokedCallback in the manifest); anywhere else it
|
||||||
|
* stays put and moves the app back one screen.
|
||||||
|
*
|
||||||
|
* Links into the app.
|
||||||
|
*
|
||||||
|
* The manifest claims https://threadcount.tech/my with autoVerify, and the launcher shortcuts are
|
||||||
|
* VIEW intents on three deeper pages, so Android hands this activity a URL rather than a bare
|
||||||
|
* launch. Nothing read it: Capacitor keeps it in Bridge.intentUri and only ever hands it out
|
||||||
|
* through the @capacitor/app plugin, which this app does not carry — so a manager tapping
|
||||||
|
* "Approve" in their email landed on the /my home screen with the token dropped, and the three
|
||||||
|
* shortcuts all opened the same page. Reading the intent here is a dozen lines against a plugin,
|
||||||
|
* an npm dependency and the plugin-stripping this app's build script already has to do.
|
||||||
|
*
|
||||||
|
* Both entry points matter: onCreate for a cold start, onNewIntent because launchMode is
|
||||||
|
* singleTask, so a tap while the app is in the background resumes this instance and delivers the
|
||||||
|
* URL there instead — which is the case that made the email link look completely dead.
|
||||||
|
*/
|
||||||
|
public class MainActivity extends BridgeActivity {
|
||||||
|
|
||||||
|
/** The one host this app will follow a link into, and the one path prefix it owns. */
|
||||||
|
private static final String SITE_HOST = "threadcount.tech";
|
||||||
|
private static final String STAFF_PATH = "/my";
|
||||||
|
/** Set on an intent once its link has been opened, so it is only ever followed once. */
|
||||||
|
private static final String FOLLOWED = "tech.threadcount.staff.LINK_FOLLOWED";
|
||||||
|
|
||||||
|
private OnBackPressedCallback back;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// A device with no WebView never gets a bridge; there is nothing to navigate.
|
||||||
|
if (getBridge() == null) return;
|
||||||
|
|
||||||
|
back = new OnBackPressedCallback(false) {
|
||||||
|
@Override
|
||||||
|
public void handleOnBackPressed() {
|
||||||
|
WebView web = getBridge().getWebView();
|
||||||
|
if (web != null && web.canGoBack()) {
|
||||||
|
web.goBack();
|
||||||
|
} else {
|
||||||
|
// Nothing left in this WebView: hand the gesture back to the system.
|
||||||
|
setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
getOnBackPressedDispatcher().addCallback(this, back);
|
||||||
|
|
||||||
|
// pushState, replaceState and ordinary navigations all land here, which is what makes the
|
||||||
|
// enabled flag above trustworthy in a single-page app.
|
||||||
|
getBridge().setWebViewClient(new BridgeWebViewClient(getBridge()) {
|
||||||
|
@Override
|
||||||
|
public void doUpdateVisitedHistory(WebView view, String url, boolean isReload) {
|
||||||
|
super.doUpdateVisitedHistory(view, url, isReload);
|
||||||
|
syncBack(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||||
|
super.onPageStarted(view, url, favicon);
|
||||||
|
syncBack(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The bundled welcome tells the shell which server to use by navigating to
|
||||||
|
* https://localhost/__server?origin=… — caught here, never loaded, and honoured only
|
||||||
|
* while the WebView is still on the app's own origin (a remote page pointing the app at
|
||||||
|
* another server would be the phishing route). */
|
||||||
|
@Override
|
||||||
|
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
|
||||||
|
Uri u = request.getUrl();
|
||||||
|
if (u != null && "localhost".equals(u.getHost()) && "/__server".equals(u.getPath())) {
|
||||||
|
String from = view.getUrl();
|
||||||
|
if (from != null && from.startsWith("https://localhost")) setServer(u.getQueryParameter("origin"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.shouldOverrideUrlLoading(view, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Capacitor's own version swaps in the bundled "No connection." screen for any main
|
||||||
|
* frame response that isn't 2xx. That is the wrong diagnosis for most of them: the
|
||||||
|
* site answered, and its 404 and its branded 500 (which carries the reference someone
|
||||||
|
* reads out on the phone) are both better pages than a bundled one telling a nurse to
|
||||||
|
* go and check the ward's wifi. A gateway status is the exception — nothing is
|
||||||
|
* answering behind the proxy, which is what the offline screen actually describes.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
|
||||||
|
int status = errorResponse != null ? errorResponse.getStatusCode() : 0;
|
||||||
|
if (status == 502 || status == 503 || status == 504) {
|
||||||
|
super.onReceivedHttpError(view, request, errorResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
syncBack(getBridge().getWebView());
|
||||||
|
|
||||||
|
giveTheSiteTheBridge();
|
||||||
|
|
||||||
|
openLink(getIntent());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put window.Capacitor on the live site.
|
||||||
|
*
|
||||||
|
* The shell opens on its bundled welcome at https://localhost and then hands the WebView to
|
||||||
|
* threadcount.tech. Capacitor 6 installs its JavaScript bridge with addDocumentStartJavaScript
|
||||||
|
* scoped to a single origin — the app's own — and, having done that, drops the request-proxy
|
||||||
|
* path that would otherwise have injected it into pages from the hosts in allowNavigation. So
|
||||||
|
* every /my page arrived with androidBridge (the message channel is registered for
|
||||||
|
* allowNavigation hosts too) but no window.Capacitor: the site took itself for a browser, so
|
||||||
|
* the legal rows promised "a new tab" and loaded the marketing site over the app instead of
|
||||||
|
* handing it to Chrome through the Browser plugin. Found on a Pixel 8 Pro running the Play
|
||||||
|
* build, 2026-09-12 — the same defect as the counter app's, fixed the same way.
|
||||||
|
*
|
||||||
|
* The identical script Bridge assembles is registered for the site's origin as well. On a
|
||||||
|
* WebView too old for document-start scripts Capacitor keeps its proxy injector, which already
|
||||||
|
* covers allowNavigation hosts. The plugin registry is read reflectively (proguard-rules.pro
|
||||||
|
* keeps com.getcapacitor.** intact); if anything fails the app is exactly as it was before.
|
||||||
|
*/
|
||||||
|
private void giveTheSiteTheBridge() {
|
||||||
|
Bridge bridge = getBridge();
|
||||||
|
WebView web = bridge == null ? null : bridge.getWebView();
|
||||||
|
if (web == null) return;
|
||||||
|
if (!WebViewFeature.isFeatureSupported(WebViewFeature.DOCUMENT_START_SCRIPT)) return;
|
||||||
|
Set<String> origins = siteOrigins();
|
||||||
|
try {
|
||||||
|
String script = bridgeScript(bridge);
|
||||||
|
WebViewCompat.addDocumentStartJavaScript(web, script, origins);
|
||||||
|
Log.i("ThreadCountStaff", "Capacitor bridge registered for " + origins);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("ThreadCountStaff", "Could not register the Capacitor bridge for " + origins + "; the site will run as a browser page", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String PREFS = "threadcount";
|
||||||
|
private static final String PREF_SERVER = "server";
|
||||||
|
|
||||||
|
/** The origins the shell hands over to: the hosted service, and the self-hosted server the
|
||||||
|
* welcome screen saved, if any. App Links and shared credentials stay with SITE_HOST. */
|
||||||
|
private Set<String> siteOrigins() {
|
||||||
|
Set<String> s = new HashSet<>();
|
||||||
|
s.add("https://" + SITE_HOST);
|
||||||
|
String own = getSharedPreferences(PREFS, MODE_PRIVATE).getString(PREF_SERVER, "");
|
||||||
|
if (!own.isEmpty()) s.add(own);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Remember a self-hosted server (https origin, host only) or, given nothing, go back to the
|
||||||
|
* hosted service; the bridge is registered for it at once. */
|
||||||
|
private void setServer(String origin) {
|
||||||
|
SharedPreferences.Editor e = getSharedPreferences(PREFS, MODE_PRIVATE).edit();
|
||||||
|
if (origin == null || origin.isEmpty()) { e.remove(PREF_SERVER).apply(); Log.i("ThreadCountStaff", "server reset to hosted"); return; }
|
||||||
|
Uri u = Uri.parse(origin);
|
||||||
|
if (!"https".equals(u.getScheme()) || u.getHost() == null || u.getHost().isEmpty() || (u.getPath() != null && !u.getPath().isEmpty() && !"/".equals(u.getPath()))) {
|
||||||
|
Log.w("ThreadCountStaff", "refused a server that is not a plain https origin");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String clean = "https://" + u.getHost() + (u.getPort() > 0 ? ":" + u.getPort() : "");
|
||||||
|
e.putString(PREF_SERVER, clean).apply();
|
||||||
|
Log.i("ThreadCountStaff", "server set to " + clean);
|
||||||
|
giveTheSiteTheBridge();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Bridge.getJSInjector(), piece for piece, using the public JSExport helpers it calls. */
|
||||||
|
private String bridgeScript(Bridge bridge) throws Exception {
|
||||||
|
String globalJS = JSExport.getGlobalJS(this, bridge.getConfig().isLoggingEnabled(), bridge.isDevMode());
|
||||||
|
String bridgeJS = JSExport.getBridgeJS(this);
|
||||||
|
String pluginJS = JSExport.getPluginJS(pluginsOf(bridge));
|
||||||
|
String cordovaJS = JSExport.getCordovaJS(this);
|
||||||
|
String cordovaPluginsJS = JSExport.getCordovaPluginJS(this);
|
||||||
|
String cordovaPluginsFileJS = JSExport.getCordovaPluginsFileJS(this);
|
||||||
|
String localUrlJS = "window.WEBVIEW_SERVER_URL = '" + bridge.getLocalUrl() + "';";
|
||||||
|
return globalJS + "\n\n" + localUrlJS + "\n\n" + bridgeJS + "\n\n" + pluginJS + "\n\n"
|
||||||
|
+ cordovaJS + "\n\n" + cordovaPluginsFileJS + "\n\n" + cordovaPluginsJS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private static Collection<PluginHandle> pluginsOf(Bridge bridge) throws Exception {
|
||||||
|
Field f = Bridge.class.getDeclaredField("plugins");
|
||||||
|
f.setAccessible(true);
|
||||||
|
Map<String, PluginHandle> plugins = (Map<String, PluginHandle>) f.get(bridge);
|
||||||
|
if (plugins == null || plugins.isEmpty()) throw new IllegalStateException("Bridge has no plugins registered");
|
||||||
|
return plugins.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
super.onNewIntent(intent);
|
||||||
|
openLink(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigates the WebView to a link this app owns. Anything else — another host, a path outside
|
||||||
|
* /my, a plain launch from the icon — is left alone, so the shell's own splash and welcome
|
||||||
|
* still run.
|
||||||
|
*/
|
||||||
|
private void openLink(Intent intent) {
|
||||||
|
String url = staffUrl(intent);
|
||||||
|
if (url == null || getBridge() == null) return;
|
||||||
|
// The launch intent reaches this method twice: BridgeActivity.load() routes it through
|
||||||
|
// onNewIntent while super.onCreate() is still running, and onCreate follows it again
|
||||||
|
// afterwards in case a future Capacitor stops doing that. Marking the intent means
|
||||||
|
// whichever arrives first wins and the other is a no-op, rather than the same page being
|
||||||
|
// loaded twice. A later tap is a different Intent, so it is followed as it should be.
|
||||||
|
if (intent.getBooleanExtra(FOLLOWED, false)) return;
|
||||||
|
intent.putExtra(FOLLOWED, true);
|
||||||
|
WebView web = getBridge().getWebView();
|
||||||
|
if (web != null) web.loadUrl(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String staffUrl(Intent intent) {
|
||||||
|
if (intent == null || !Intent.ACTION_VIEW.equals(intent.getAction())) return null;
|
||||||
|
Uri uri = intent.getData();
|
||||||
|
if (uri == null) return null;
|
||||||
|
if (!"https".equals(uri.getScheme()) || !SITE_HOST.equals(uri.getHost())) return null;
|
||||||
|
String path = uri.getPath();
|
||||||
|
if (path == null || !(path.equals(STAFF_PATH) || path.startsWith(STAFF_PATH + "/"))) return null;
|
||||||
|
return uri.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncBack(WebView view) {
|
||||||
|
if (back != null && view != null) back.setEnabled(view.canGoBack());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,34 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportHeight="108"
|
||||||
|
android:viewportWidth="108">
|
||||||
|
<path
|
||||||
|
android:fillType="evenOdd"
|
||||||
|
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||||
|
android:strokeColor="#00000000"
|
||||||
|
android:strokeWidth="1">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="78.5885"
|
||||||
|
android:endY="90.9159"
|
||||||
|
android:startX="48.7653"
|
||||||
|
android:startY="61.0927"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||||
|
android:strokeColor="#00000000"
|
||||||
|
android:strokeWidth="1" />
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportHeight="108"
|
||||||
|
android:viewportWidth="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#26A69A"
|
||||||
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M9,0L9,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,0L19,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,0L29,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,0L39,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,0L49,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,0L59,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,0L69,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,0L79,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M89,0L89,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M99,0L99,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,9L108,9"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,19L108,19"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,29L108,29"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,39L108,39"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,49L108,49"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,59L108,59"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,69L108,69"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,79L108,79"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,89L108,89"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,99L108,99"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,29L89,29"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,39L89,39"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,49L89,49"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,59L89,59"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,69L89,69"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,79L89,79"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,19L29,89"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,19L39,89"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,19L49,89"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,19L59,89"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,19L69,89"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,19L79,89"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
</vector>
|
||||||
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
<!-- Android 13+ themed icons: the launcher tints this layer to the wallpaper. It is the same
|
||||||
|
mark; the system supplies the colour, so the stepped bars still read. -->
|
||||||
|
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
<!-- Android 13+ themed icons: the launcher tints this layer to the wallpaper. It is the same
|
||||||
|
mark; the system supplies the colour, so the stepped bars still read. -->
|
||||||
|
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 963 B |
|
After Width: | Height: | Size: 881 B |
|
After Width: | Height: | Size: 963 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Android 12 and later ignore windowBackground for the launch screen and use the SplashScreen
|
||||||
|
API instead, which is why the app opened on a white rounded launcher icon rather than ink.
|
||||||
|
Setting the background here makes the very first frame the same ink the bundled splash uses,
|
||||||
|
and the icon is deliberately a transparent drawable: the bundled splash draws the mark itself,
|
||||||
|
one bar at a time, and showing it still first and then redrawing it reads as a stutter. -->
|
||||||
|
<resources>
|
||||||
|
<style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
|
||||||
|
<item name="windowSplashScreenBackground">@color/tcInk</item>
|
||||||
|
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
||||||
|
<item name="postSplashScreenTheme">@style/AppTheme.NoActionBar</item>
|
||||||
|
<item name="android:statusBarColor">@color/tcInk</item>
|
||||||
|
<item name="android:navigationBarColor">@color/tcInk</item>
|
||||||
|
<item name="android:windowLightStatusBar">false</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- The brand palette, so the shell around the WebView is never a colour ThreadCount doesn't use. -->
|
||||||
|
<resources>
|
||||||
|
<color name="colorPrimary">#201E1D</color>
|
||||||
|
<color name="colorPrimaryDark">#201E1D</color>
|
||||||
|
<color name="colorAccent">#EC3013</color>
|
||||||
|
<color name="tcInk">#201E1D</color>
|
||||||
|
<color name="tcPaper">#F3F2F2</color>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- Ink, where the counter app is paper. This is what tells the two apps
|
||||||
|
apart on a home screen. -->
|
||||||
|
<color name="ic_launcher_background">#201E1D</color>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">ThreadCount Staff</string>
|
||||||
|
<string name="title_activity_main">ThreadCount Staff</string>
|
||||||
|
<string name="package_name">tech.threadcount.staff</string>
|
||||||
|
<string name="custom_url_scheme">tech.threadcount.staff</string>
|
||||||
|
|
||||||
|
<!-- Long-press shortcuts. Short labels are what fits under the icon; long labels are what the
|
||||||
|
launcher shows when it has room. -->
|
||||||
|
<string name="shortcut_request_short">Request</string>
|
||||||
|
<string name="shortcut_request_long">Request an item</string>
|
||||||
|
<string name="shortcut_kit_short">My kit</string>
|
||||||
|
<string name="shortcut_kit_long">What I\'m holding</string>
|
||||||
|
<string name="shortcut_shelf_short">Shelf</string>
|
||||||
|
<string name="shortcut_shelf_long">What\'s on the shelf</string>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
<item name="android:background">@null</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- The launch screen is the ink ground the bundled splash then draws the mark on, so the
|
||||||
|
hand-off from native to WebView is invisible. Light status bar content, because every
|
||||||
|
screen the app opens on is ink. -->
|
||||||
|
<style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
|
||||||
|
<item name="android:background">@drawable/splash</item>
|
||||||
|
<item name="android:statusBarColor">@color/tcInk</item>
|
||||||
|
<item name="android:navigationBarColor">@color/tcInk</item>
|
||||||
|
<item name="android:windowLightStatusBar">false</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Nothing about a signed-in linen room belongs in a Google Drive backup or on a transferred
|
||||||
|
device: the WebView holds a live session cookie and an unfinished stocktake. A new device
|
||||||
|
signs in again, which takes ten seconds and is the honest behaviour. -->
|
||||||
|
<data-extraction-rules>
|
||||||
|
<cloud-backup>
|
||||||
|
<exclude domain="root" />
|
||||||
|
<exclude domain="database" />
|
||||||
|
<exclude domain="sharedpref" />
|
||||||
|
<exclude domain="external" />
|
||||||
|
</cloud-backup>
|
||||||
|
<device-transfer>
|
||||||
|
<exclude domain="root" />
|
||||||
|
<exclude domain="database" />
|
||||||
|
<exclude domain="sharedpref" />
|
||||||
|
<exclude domain="external" />
|
||||||
|
</device-transfer>
|
||||||
|
</data-extraction-rules>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<external-path name="my_images" path="." />
|
||||||
|
<cache-path name="my_cache_images" path="." />
|
||||||
|
</paths>
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Long-press the icon. The three things a wearer actually opens the app to do, in the order
|
||||||
|
they do them. Each is a VIEW on the live site, which the app links intent-filter catches, so
|
||||||
|
they land inside the app rather than a browser. -->
|
||||||
|
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<shortcut
|
||||||
|
android:shortcutId="request"
|
||||||
|
android:enabled="true"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:shortcutShortLabel="@string/shortcut_request_short"
|
||||||
|
android:shortcutLongLabel="@string/shortcut_request_long">
|
||||||
|
<intent
|
||||||
|
android:action="android.intent.action.VIEW"
|
||||||
|
android:targetPackage="tech.threadcount.staff"
|
||||||
|
android:targetClass="tech.threadcount.staff.MainActivity"
|
||||||
|
android:data="https://threadcount.tech/my/request" />
|
||||||
|
<categories android:name="android.shortcut.conversation" />
|
||||||
|
</shortcut>
|
||||||
|
|
||||||
|
<shortcut
|
||||||
|
android:shortcutId="kit"
|
||||||
|
android:enabled="true"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:shortcutShortLabel="@string/shortcut_kit_short"
|
||||||
|
android:shortcutLongLabel="@string/shortcut_kit_long">
|
||||||
|
<intent
|
||||||
|
android:action="android.intent.action.VIEW"
|
||||||
|
android:targetPackage="tech.threadcount.staff"
|
||||||
|
android:targetClass="tech.threadcount.staff.MainActivity"
|
||||||
|
android:data="https://threadcount.tech/my/kit" />
|
||||||
|
</shortcut>
|
||||||
|
|
||||||
|
<shortcut
|
||||||
|
android:shortcutId="shelf"
|
||||||
|
android:enabled="true"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:shortcutShortLabel="@string/shortcut_shelf_short"
|
||||||
|
android:shortcutLongLabel="@string/shortcut_shelf_long">
|
||||||
|
<intent
|
||||||
|
android:action="android.intent.action.VIEW"
|
||||||
|
android:targetPackage="tech.threadcount.staff"
|
||||||
|
android:targetClass="tech.threadcount.staff.MainActivity"
|
||||||
|
android:data="https://threadcount.tech/my/shelf" />
|
||||||
|
</shortcut>
|
||||||
|
|
||||||
|
</shortcuts>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.getcapacitor.myapp;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
public class ExampleUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void addition_isCorrect() throws Exception {
|
||||||
|
assertEquals(4, 2 + 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:8.2.1'
|
||||||
|
classpath 'com.google.gms:google-services:4.4.0'
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: "variables.gradle"
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// 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/@capacitor/android/capacitor')
|
||||||
|
|
||||||
|
|
||||||
|
include ':capacitor-browser'
|
||||||
|
project(':capacitor-browser').projectDir = new File('../node_modules/@capacitor/browser/android')
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# Project-wide Gradle settings.
|
||||||
|
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
org.gradle.jvmargs=-Xmx1536m
|
||||||
|
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
|
||||||
|
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||||
|
# Android operating system, and which are packaged with your app's APK
|
||||||
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
|
android.useAndroidX=true
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -0,0 +1,248 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
include ':app'
|
||||||
|
include ':capacitor-cordova-android-plugins'
|
||||||
|
project(':capacitor-cordova-android-plugins').projectDir = new File('./capacitor-cordova-android-plugins/')
|
||||||
|
|
||||||
|
apply from: 'capacitor.settings.gradle'
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
ext {
|
||||||
|
minSdkVersion = 23
|
||||||
|
// Play requires new uploads to target a recent API. 36 matches the counter app.
|
||||||
|
compileSdkVersion = 36
|
||||||
|
targetSdkVersion = 36
|
||||||
|
androidxActivityVersion = '1.9.3'
|
||||||
|
androidxAppCompatVersion = '1.7.0'
|
||||||
|
androidxCoordinatorLayoutVersion = '1.2.0'
|
||||||
|
androidxCoreVersion = '1.15.0'
|
||||||
|
androidxFragmentVersion = '1.8.5'
|
||||||
|
coreSplashScreenVersion = '1.0.1'
|
||||||
|
androidxWebkitVersion = '1.12.1'
|
||||||
|
junitVersion = '4.13.2'
|
||||||
|
androidxJunitVersion = '1.2.1'
|
||||||
|
androidxEspressoCoreVersion = '3.6.1'
|
||||||
|
cordovaAndroidVersion = '10.1.1'
|
||||||
|
|
||||||
|
// Kept in step with the counter app's pins even though this project builds without the
|
||||||
|
// barcode scanner: scripts/build-staff-aab.sh strips the plugin after `cap sync`, and if
|
||||||
|
// that ever stops happening the build should fail loudly on a missing version rather than
|
||||||
|
// quietly fall back to a CameraX whose .so files are only 4 KB-aligned.
|
||||||
|
mlkitBarcodeScanningVersion = '17.3.0'
|
||||||
|
playServicesMlkitBarcodeScanningVersion = '18.3.1'
|
||||||
|
androidxCameraCamera2Version = '1.4.2'
|
||||||
|
androidxCameraCoreVersion = '1.4.2'
|
||||||
|
androidxCameraLifecycleVersion = '1.4.2'
|
||||||
|
androidxCameraViewVersion = '1.4.2'
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore
|
||||||
|
|
||||||
|
# Built application files
|
||||||
|
*.apk
|
||||||
|
*.aar
|
||||||
|
*.ap_
|
||||||
|
*.aab
|
||||||
|
|
||||||
|
# Files for the ART/Dalvik VM
|
||||||
|
*.dex
|
||||||
|
|
||||||
|
# Java class files
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
bin/
|
||||||
|
gen/
|
||||||
|
out/
|
||||||
|
# Uncomment the following line in case you need and you don't have the release build type files in your app
|
||||||
|
# release/
|
||||||
|
|
||||||
|
# Gradle files
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Local configuration file (sdk path, etc)
|
||||||
|
local.properties
|
||||||
|
|
||||||
|
# Proguard folder generated by Eclipse
|
||||||
|
proguard/
|
||||||
|
|
||||||
|
# Log Files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Android Studio Navigation editor temp files
|
||||||
|
.navigation/
|
||||||
|
|
||||||
|
# Android Studio captures folder
|
||||||
|
captures/
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
*.iml
|
||||||
|
.idea/workspace.xml
|
||||||
|
.idea/tasks.xml
|
||||||
|
.idea/gradle.xml
|
||||||
|
.idea/assetWizardSettings.xml
|
||||||
|
.idea/dictionaries
|
||||||
|
.idea/libraries
|
||||||
|
# Android Studio 3 in .gitignore file.
|
||||||
|
.idea/caches
|
||||||
|
.idea/modules.xml
|
||||||
|
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
|
||||||
|
.idea/navEditor.xml
|
||||||
|
|
||||||
|
# Keystore files
|
||||||
|
# Uncomment the following lines if you do not want to check your keystore files in.
|
||||||
|
#*.jks
|
||||||
|
#*.keystore
|
||||||
|
|
||||||
|
# External native build folder generated in Android Studio 2.2 and later
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx/
|
||||||
|
|
||||||
|
# Google Services (e.g. APIs or Firebase)
|
||||||
|
# google-services.json
|
||||||
|
|
||||||
|
# Freeline
|
||||||
|
freeline.py
|
||||||
|
freeline/
|
||||||
|
freeline_project_description.json
|
||||||
|
|
||||||
|
# fastlane
|
||||||
|
fastlane/report.xml
|
||||||
|
fastlane/Preview.html
|
||||||
|
fastlane/screenshots
|
||||||
|
fastlane/test_output
|
||||||
|
fastlane/readme.md
|
||||||
|
|
||||||
|
# Version control
|
||||||
|
vcs.xml
|
||||||
|
|
||||||
|
# lint
|
||||||
|
lint/intermediates/
|
||||||
|
lint/generated/
|
||||||
|
lint/outputs/
|
||||||
|
lint/tmp/
|
||||||
|
# lint/reports/
|
||||||
|
|
||||||
|
# Android Profiling
|
||||||
|
*.hprof
|
||||||
|
|
||||||
|
# Cordova plugins for Capacitor
|
||||||
|
capacitor-cordova-android-plugins
|
||||||
|
|
||||||
|
# Copied web assets
|
||||||
|
app/src/main/assets/public
|
||||||
|
|
||||||
|
# Generated Config files
|
||||||
|
app/src/main/assets/capacitor.config.json
|
||||||
|
app/src/main/assets/capacitor.plugins.json
|
||||||
|
app/src/main/res/xml/config.xml
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/build/*
|
||||||
|
!/build/.npmkeep
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
// Release signing. The keystore and its password live in ~/threadcount-keys, outside the repo —
|
||||||
|
// nothing secret is ever committed. Without that file the release build is simply unsigned, so a
|
||||||
|
// fresh clone still builds a debug APK.
|
||||||
|
def keystorePropsFile = file("${System.getProperty('user.home')}/threadcount-keys/keystore.properties")
|
||||||
|
def keystoreProps = new Properties()
|
||||||
|
if (keystorePropsFile.exists()) {
|
||||||
|
keystorePropsFile.withInputStream { keystoreProps.load(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace "tech.threadcount.app"
|
||||||
|
compileSdk rootProject.ext.compileSdkVersion
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "tech.threadcount.app"
|
||||||
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
|
// Play permanently reserves a version code the moment a bundle is uploaded, even to a
|
||||||
|
// discarded draft — it can never be reused. Bump this for EVERY upload, not every release.
|
||||||
|
// 1 was spent on the build with the missing camera permission; 2 on the one before
|
||||||
|
// onboarding was bundled. 3, 4 and 5 went to Play as drafts — a code is reserved the
|
||||||
|
// moment Play ingests a bundle, warnings and all. 6 adds the mapping file and the native
|
||||||
|
// debug symbols Play asked for.
|
||||||
|
versionCode 10
|
||||||
|
versionName "1.4"
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
aaptOptions {
|
||||||
|
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
||||||
|
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
|
||||||
|
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
signingConfigs {
|
||||||
|
release {
|
||||||
|
if (keystoreProps['storeFile']) {
|
||||||
|
storeFile file(keystoreProps['storeFile'])
|
||||||
|
storePassword keystoreProps['storePassword']
|
||||||
|
keyAlias keystoreProps['keyAlias']
|
||||||
|
keyPassword keystoreProps['keyPassword']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
if (keystoreProps['storeFile']) {
|
||||||
|
signingConfig signingConfigs.release
|
||||||
|
}
|
||||||
|
// R8 shrinks and obfuscates, and Gradle folds the resulting mapping.txt into the
|
||||||
|
// bundle, which is what lets Play symbolicate a stack trace instead of showing
|
||||||
|
// a.b.c(). Capacitor ships its plugin keep-rules as consumerProguardFiles, so the
|
||||||
|
// classes the bridge loads reflectively survive; proguard-rules.pro pins the rest.
|
||||||
|
//
|
||||||
|
// Resource shrinking is deliberately left off: the onboarding splash and welcome are
|
||||||
|
// plain files under assets/, which resource shrinking never inspects, so it would
|
||||||
|
// trade a real risk for almost no bytes.
|
||||||
|
minifyEnabled true
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
|
||||||
|
// Play warns that a bundle with native code has no debug symbols. ThreadCount has no
|
||||||
|
// native code of its own: all three .so files arrive pre-stripped inside Google's
|
||||||
|
// MLKit and CameraX AARs, and llvm-objcopy --only-keep-debug pulls zero .debug_* and
|
||||||
|
// zero .symtab sections out of them. So this currently emits nothing, and there is
|
||||||
|
// nothing it could emit — the warning is unfixable rather than unfixed. It stays
|
||||||
|
// configured so that the day ThreadCount does ship its own native code, the symbols
|
||||||
|
// go with it without anyone having to remember.
|
||||||
|
ndk {
|
||||||
|
debugSymbolLevel 'FULL'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Devices from Android 15 can run 16 KB memory pages, and Play refuses uploads whose native
|
||||||
|
// libraries are only 4 KB-aligned. Uncompressed + page-aligned .so files satisfy both.
|
||||||
|
packaging {
|
||||||
|
jniLibs {
|
||||||
|
useLegacyPackaging false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
flatDir{
|
||||||
|
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
||||||
|
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
|
||||||
|
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
|
||||||
|
// WebViewCompat / WebViewFeature, for MainActivity.giveTheSiteTheBridge(). The Capacitor
|
||||||
|
// module has this as an implementation dependency, which does not reach this module.
|
||||||
|
implementation "androidx.webkit:webkit:$androidxWebkitVersion"
|
||||||
|
implementation project(':capacitor-android')
|
||||||
|
testImplementation "junit:junit:$junitVersion"
|
||||||
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
||||||
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
||||||
|
implementation project(':capacitor-cordova-android-plugins')
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: 'capacitor.build.gradle'
|
||||||
|
|
||||||
|
try {
|
||||||
|
def servicesJSON = file('google-services.json')
|
||||||
|
if (servicesJSON.text) {
|
||||||
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
||||||
|
dependencies {
|
||||||
|
implementation project(':capacitor-mlkit-barcode-scanning')
|
||||||
|
implementation project(':capacitor-browser')
|
||||||
|
implementation project(':capacitor-haptics')
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (hasProperty('postBuildExtras')) {
|
||||||
|
postBuildExtras()
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
# R8 rules for the ThreadCount shell.
|
||||||
|
#
|
||||||
|
# Capacitor's own AAR already contributes consumerProguardFiles that keep anything extending
|
||||||
|
# com.getcapacitor.Plugin and the @CapacitorPlugin / @PluginMethod members. These rules cover the
|
||||||
|
# things that sit outside that net — everything the bridge, the WebView or the manifest reaches by
|
||||||
|
# name rather than by a reference R8 can see.
|
||||||
|
#
|
||||||
|
# The cost of getting this wrong is a build that installs and then fails the moment someone scans,
|
||||||
|
# so the bias here is deliberately towards keeping too much: the bundle is 15 MB of native
|
||||||
|
# libraries, and none of what follows is where the size is.
|
||||||
|
|
||||||
|
# The plugins named in assets/capacitor.plugins.json. Capacitor resolves these by string at
|
||||||
|
# startup, so R8 sees no reference to them at all.
|
||||||
|
-keep class io.capawesome.capacitorjs.plugins.mlkit.barcodescanning.** { *; }
|
||||||
|
-keep class com.capacitorjs.plugins.haptics.** { *; }
|
||||||
|
|
||||||
|
# The bridge, its WebView plumbing, and the annotations that drive plugin dispatch.
|
||||||
|
-keep class com.getcapacitor.** { *; }
|
||||||
|
-keep interface com.getcapacitor.** { *; }
|
||||||
|
-keep @interface com.getcapacitor.** { *; }
|
||||||
|
|
||||||
|
# Anything the WebView calls from JavaScript. proguard-android.txt carries this rule too; it is
|
||||||
|
# repeated here because losing it silently breaks every call from the page into the app.
|
||||||
|
-keepclassmembers class * {
|
||||||
|
@android.webkit.JavascriptInterface <methods>;
|
||||||
|
}
|
||||||
|
|
||||||
|
# The activity is named in AndroidManifest.xml, and it subclasses BridgeWebViewClient to keep the
|
||||||
|
# back button honest.
|
||||||
|
-keep class tech.threadcount.app.** { *; }
|
||||||
|
|
||||||
|
# MLKit resolves its barcode models and CameraX its implementation classes reflectively. Both ship
|
||||||
|
# consumer rules of their own; these are belt and braces on the paths that actually run here.
|
||||||
|
-keep class com.google.mlkit.** { *; }
|
||||||
|
-keep class com.google.android.gms.internal.mlkit_vision_barcode.** { *; }
|
||||||
|
-dontwarn com.google.mlkit.**
|
||||||
|
|
||||||
|
# Keep source file and line numbers in stack traces, and tell Play's symbolicator where to look.
|
||||||
|
# Without these a crash report names the class but not the line that threw.
|
||||||
|
-keepattributes SourceFile,LineNumberTable
|
||||||
|
-renamesourcefileattribute SourceFile
|
||||||
|
|
||||||
|
# Annotations drive both Capacitor's dispatch and AndroidX's lifecycle wiring.
|
||||||
|
-keepattributes *Annotation*,Signature,InnerClasses,EnclosingMethod
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.getcapacitor.myapp;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class ExampleInstrumentedTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void useAppContext() throws Exception {
|
||||||
|
// Context of the app under test.
|
||||||
|
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||||
|
|
||||||
|
assertEquals("com.getcapacitor.app", appContext.getPackageName());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="false"
|
||||||
|
android:enableOnBackInvokedCallback="true"
|
||||||
|
android:fullBackupContent="false"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme">
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:label="@string/title_activity_main"
|
||||||
|
android:theme="@style/AppTheme.NoActionBarLaunch"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:exported="true">
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
android:authorities="${applicationId}.fileprovider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/file_paths"></meta-data>
|
||||||
|
</provider>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
<!-- Permissions -->
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
|
<!-- Reading a barcode with the continuous scanner runs CameraX in this process, which needs the
|
||||||
|
camera permission. Without it hands-free counting fails at runtime while single scans, which
|
||||||
|
Play Services handles in its own UI, still work — a confusing half-broken state. -->
|
||||||
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
|
||||||
|
<!-- Declaring the permission would otherwise make a camera mandatory and hide the app from
|
||||||
|
camera-less tablets. Scanning is one feature, not the whole product: a counter tablet
|
||||||
|
without a camera can still issue, receive and read reports. -->
|
||||||
|
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
||||||
|
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,219 @@
|
|||||||
|
package tech.threadcount.app;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.webkit.WebResourceRequest;
|
||||||
|
import android.webkit.WebResourceResponse;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.activity.OnBackPressedCallback;
|
||||||
|
import androidx.webkit.WebViewCompat;
|
||||||
|
import androidx.webkit.WebViewFeature;
|
||||||
|
|
||||||
|
import com.getcapacitor.Bridge;
|
||||||
|
import com.getcapacitor.BridgeActivity;
|
||||||
|
import com.getcapacitor.BridgeWebViewClient;
|
||||||
|
import com.getcapacitor.JSExport;
|
||||||
|
import com.getcapacitor.PluginHandle;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Back navigation.
|
||||||
|
*
|
||||||
|
* Capacitor 6 leaves the back button alone, and nothing else was handling it, so back finished the
|
||||||
|
* activity from wherever you were standing: three taps into a shelf count, one back gesture and
|
||||||
|
* ThreadCount was gone. Here back walks the WebView's history instead — which includes the app's
|
||||||
|
* own client-side routing — and only leaves the app once there is nothing left to go back to.
|
||||||
|
*
|
||||||
|
* The callback's enabled flag is kept in step with canGoBack() rather than left permanently on,
|
||||||
|
* because Android 13+ reads that flag before the gesture starts to decide whether to animate. With
|
||||||
|
* it accurate, a back gesture at the root peels the app away to reveal the home screen (predictive
|
||||||
|
* back, switched on by android:enableOnBackInvokedCallback in the manifest); anywhere else it
|
||||||
|
* stays put and moves the app back one screen.
|
||||||
|
*/
|
||||||
|
public class MainActivity extends BridgeActivity {
|
||||||
|
|
||||||
|
private OnBackPressedCallback back;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// A device with no WebView never gets a bridge; there is nothing to navigate.
|
||||||
|
if (getBridge() == null) return;
|
||||||
|
|
||||||
|
back = new OnBackPressedCallback(false) {
|
||||||
|
@Override
|
||||||
|
public void handleOnBackPressed() {
|
||||||
|
WebView web = getBridge().getWebView();
|
||||||
|
if (web != null && web.canGoBack()) {
|
||||||
|
web.goBack();
|
||||||
|
} else {
|
||||||
|
// Nothing left in this WebView: hand the gesture back to the system.
|
||||||
|
setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
getOnBackPressedDispatcher().addCallback(this, back);
|
||||||
|
|
||||||
|
// pushState, replaceState and ordinary navigations all land here, which is what makes the
|
||||||
|
// enabled flag above trustworthy in a single-page app.
|
||||||
|
getBridge().setWebViewClient(new BridgeWebViewClient(getBridge()) {
|
||||||
|
@Override
|
||||||
|
public void doUpdateVisitedHistory(WebView view, String url, boolean isReload) {
|
||||||
|
super.doUpdateVisitedHistory(view, url, isReload);
|
||||||
|
syncBack(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||||
|
super.onPageStarted(view, url, favicon);
|
||||||
|
syncBack(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The bundled welcome tells the shell which server to use by navigating to
|
||||||
|
* https://localhost/__server?origin=… — a navigation that never happens, because it is
|
||||||
|
* caught here, and one that only the bundled page may make: a remote page pointing the
|
||||||
|
* app at another server would be the phishing route, so the request is honoured only
|
||||||
|
* while the WebView is still on the app's own origin. */
|
||||||
|
@Override
|
||||||
|
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
|
||||||
|
Uri u = request.getUrl();
|
||||||
|
if (u != null && "localhost".equals(u.getHost()) && "/__server".equals(u.getPath())) {
|
||||||
|
String from = view.getUrl();
|
||||||
|
if (from != null && from.startsWith("https://localhost")) setServer(u.getQueryParameter("origin"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.shouldOverrideUrlLoading(view, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Capacitor's own version swaps in the bundled "No connection." screen for any main
|
||||||
|
* frame response that isn't 2xx. That is the wrong diagnosis for most of them: the
|
||||||
|
* site answered, and its 404 and its branded 500 (which carries the reference someone
|
||||||
|
* reads out on the phone) are both better pages than a bundled one sending a counter
|
||||||
|
* off to check the ward's wifi over a problem that isn't the wifi. A gateway status is
|
||||||
|
* the exception — nothing is answering behind the proxy, which is what the offline
|
||||||
|
* screen actually describes.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
|
||||||
|
int status = errorResponse != null ? errorResponse.getStatusCode() : 0;
|
||||||
|
if (status == 502 || status == 503 || status == 504) {
|
||||||
|
super.onReceivedHttpError(view, request, errorResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
syncBack(getBridge().getWebView());
|
||||||
|
|
||||||
|
giveTheSiteTheBridge();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncBack(WebView view) {
|
||||||
|
if (back != null && view != null) back.setEnabled(view.canGoBack());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Where the app goes unless told otherwise: the hosted service. */
|
||||||
|
private static final String DEFAULT_ORIGIN = "https://threadcount.tech";
|
||||||
|
private static final String PREFS = "threadcount";
|
||||||
|
private static final String PREF_SERVER = "server";
|
||||||
|
|
||||||
|
/** The origins the shell hands over to: the hosted service, and the self-hosted server the
|
||||||
|
* welcome screen saved, if any (Community edition rooms run their own). */
|
||||||
|
private Set<String> siteOrigins() {
|
||||||
|
Set<String> s = new HashSet<>();
|
||||||
|
s.add(DEFAULT_ORIGIN);
|
||||||
|
String own = getSharedPreferences(PREFS, MODE_PRIVATE).getString(PREF_SERVER, "");
|
||||||
|
if (!own.isEmpty()) s.add(own);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Remember a self-hosted server (https origin, host only) or, given nothing, go back to the
|
||||||
|
* hosted service. The bridge is registered for the new origin at once so the first page it
|
||||||
|
* serves already has window.Capacitor. */
|
||||||
|
private void setServer(String origin) {
|
||||||
|
SharedPreferences.Editor e = getSharedPreferences(PREFS, MODE_PRIVATE).edit();
|
||||||
|
if (origin == null || origin.isEmpty()) { e.remove(PREF_SERVER).apply(); Log.i("ThreadCount", "server reset to hosted"); return; }
|
||||||
|
Uri u = Uri.parse(origin);
|
||||||
|
if (!"https".equals(u.getScheme()) || u.getHost() == null || u.getHost().isEmpty() || (u.getPath() != null && !u.getPath().isEmpty() && !"/".equals(u.getPath()))) {
|
||||||
|
Log.w("ThreadCount", "refused a server that is not a plain https origin");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String clean = "https://" + u.getHost() + (u.getPort() > 0 ? ":" + u.getPort() : "");
|
||||||
|
e.putString(PREF_SERVER, clean).apply();
|
||||||
|
Log.i("ThreadCount", "server set to " + clean);
|
||||||
|
giveTheSiteTheBridge();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put window.Capacitor on the live site.
|
||||||
|
*
|
||||||
|
* The shell opens on its bundled welcome at https://localhost and then hands the WebView to
|
||||||
|
* threadcount.tech. Capacitor 6 installs its JavaScript bridge with addDocumentStartJavaScript
|
||||||
|
* scoped to a single origin — the app's own, https://localhost — and, having done that, drops
|
||||||
|
* the request-proxy path that would otherwise have injected it into pages from the hosts in
|
||||||
|
* allowNavigation. So every page the counter actually uses arrived with androidBridge (the
|
||||||
|
* message channel is registered for allowNavigation hosts too) but no window.Capacitor: the
|
||||||
|
* site took itself for a browser, scanned with Chromium's BarcodeDetector instead of MLKit,
|
||||||
|
* never buzzed, could not hand a link to Chrome, and offered a print button that cannot print
|
||||||
|
* here. Found on a Pixel 8 Pro running the Play build, 2026-09-12, by evaluating
|
||||||
|
* typeof window.Capacitor on /m/login: "undefined".
|
||||||
|
*
|
||||||
|
* This registers the identical script — the same seven pieces Bridge assembles, in the same
|
||||||
|
* order — for the site's origin as well. On a WebView too old for document-start scripts
|
||||||
|
* Capacitor keeps its proxy injector, which already covers allowNavigation hosts, so nothing
|
||||||
|
* is added there.
|
||||||
|
*
|
||||||
|
* The plugin registry is the one piece Bridge keeps private; it is read reflectively, and
|
||||||
|
* proguard-rules.pro keeps com.getcapacitor.** intact so the field name survives R8. If any
|
||||||
|
* of this fails the app is exactly as it was before — signed in, working, web scanner — and
|
||||||
|
* says why in logcat rather than crashing a counter mid-shift.
|
||||||
|
*/
|
||||||
|
private void giveTheSiteTheBridge() {
|
||||||
|
Bridge bridge = getBridge();
|
||||||
|
WebView web = bridge == null ? null : bridge.getWebView();
|
||||||
|
if (web == null) return;
|
||||||
|
if (!WebViewFeature.isFeatureSupported(WebViewFeature.DOCUMENT_START_SCRIPT)) return;
|
||||||
|
Set<String> origins = siteOrigins();
|
||||||
|
try {
|
||||||
|
String script = bridgeScript(bridge);
|
||||||
|
WebViewCompat.addDocumentStartJavaScript(web, script, origins);
|
||||||
|
Log.i("ThreadCount", "Capacitor bridge registered for " + origins);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("ThreadCount", "Could not register the Capacitor bridge for " + origins + "; the site will run as a browser page", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Bridge.getJSInjector(), piece for piece, using the public JSExport helpers it calls. */
|
||||||
|
private String bridgeScript(Bridge bridge) throws Exception {
|
||||||
|
String globalJS = JSExport.getGlobalJS(this, bridge.getConfig().isLoggingEnabled(), bridge.isDevMode());
|
||||||
|
String bridgeJS = JSExport.getBridgeJS(this);
|
||||||
|
String pluginJS = JSExport.getPluginJS(pluginsOf(bridge));
|
||||||
|
String cordovaJS = JSExport.getCordovaJS(this);
|
||||||
|
String cordovaPluginsJS = JSExport.getCordovaPluginJS(this);
|
||||||
|
String cordovaPluginsFileJS = JSExport.getCordovaPluginsFileJS(this);
|
||||||
|
String localUrlJS = "window.WEBVIEW_SERVER_URL = '" + bridge.getLocalUrl() + "';";
|
||||||
|
return globalJS + "\n\n" + localUrlJS + "\n\n" + bridgeJS + "\n\n" + pluginJS + "\n\n"
|
||||||
|
+ cordovaJS + "\n\n" + cordovaPluginsFileJS + "\n\n" + cordovaPluginsJS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private static Collection<PluginHandle> pluginsOf(Bridge bridge) throws Exception {
|
||||||
|
Field f = Bridge.class.getDeclaredField("plugins");
|
||||||
|
f.setAccessible(true);
|
||||||
|
Map<String, PluginHandle> plugins = (Map<String, PluginHandle>) f.get(bridge);
|
||||||
|
if (plugins == null || plugins.isEmpty()) throw new IllegalStateException("Bridge has no plugins registered");
|
||||||
|
return plugins.values();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,34 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportHeight="108"
|
||||||
|
android:viewportWidth="108">
|
||||||
|
<path
|
||||||
|
android:fillType="evenOdd"
|
||||||
|
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||||
|
android:strokeColor="#00000000"
|
||||||
|
android:strokeWidth="1">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="78.5885"
|
||||||
|
android:endY="90.9159"
|
||||||
|
android:startX="48.7653"
|
||||||
|
android:startY="61.0927"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||||
|
android:strokeColor="#00000000"
|
||||||
|
android:strokeWidth="1" />
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportHeight="108"
|
||||||
|
android:viewportWidth="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#26A69A"
|
||||||
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M9,0L9,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,0L19,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,0L29,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,0L39,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,0L49,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,0L59,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,0L69,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,0L79,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M89,0L89,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M99,0L99,108"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,9L108,9"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,19L108,19"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,29L108,29"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,39L108,39"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,49L108,49"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,59L108,59"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,69L108,69"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,79L108,79"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,89L108,89"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,99L108,99"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,29L89,29"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,39L89,39"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,49L89,49"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,59L89,59"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,69L89,69"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,79L89,79"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,19L29,89"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,19L39,89"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,19L49,89"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,19L59,89"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,19L69,89"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,19L79,89"
|
||||||
|
android:strokeColor="#33FFFFFF"
|
||||||
|
android:strokeWidth="0.8" />
|
||||||
|
</vector>
|
||||||
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 926 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 926 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.4 KiB |