ThreadCount Community edition
Uniform stock management for healthcare linen rooms. Licensed under the GNU AGPL v3.
@@ -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 7
|
||||
versionName "1.2"
|
||||
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,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,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,217 @@
|
||||
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 java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
try {
|
||||
String script = bridgeScript(bridge);
|
||||
WebViewCompat.addDocumentStartJavaScript(web, script, Collections.singleton("https://" + SITE_HOST));
|
||||
Log.i("ThreadCountStaff", "Capacitor bridge registered for https://" + SITE_HOST);
|
||||
} catch (Exception e) {
|
||||
Log.e("ThreadCountStaff", "Could not register the Capacitor bridge for https://" + SITE_HOST + "; 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();
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||