diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..48354a3 --- /dev/null +++ b/android/.gitignore @@ -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 diff --git a/android/app/.gitignore b/android/app/.gitignore new file mode 100644 index 0000000..043df80 --- /dev/null +++ b/android/app/.gitignore @@ -0,0 +1,2 @@ +/build/* +!/build/.npmkeep diff --git a/android/app/build.gradle b/android/app/build.gradle new file mode 100644 index 0000000..127652f --- /dev/null +++ b/android/app/build.gradle @@ -0,0 +1,54 @@ +apply plugin: 'com.android.application' + +android { + namespace "com.openproof.app" + compileSdk rootProject.ext.compileSdkVersion + defaultConfig { + applicationId "com.openproof.app" + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion + versionCode 1 + versionName "1.0" + 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:!*~' + } + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +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" + 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") +} diff --git a/android/app/capacitor.build.gradle b/android/app/capacitor.build.gradle new file mode 100644 index 0000000..861def3 --- /dev/null +++ b/android/app/capacitor.build.gradle @@ -0,0 +1,22 @@ +// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN + +android { + compileOptions { + sourceCompatibility JavaVersion.VERSION_21 + targetCompatibility JavaVersion.VERSION_21 + } +} + +apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle" +dependencies { + implementation project(':capacitor-filesystem') + implementation project(':capacitor-keyboard') + implementation project(':capacitor-share') + implementation project(':capacitor-splash-screen') + +} + + +if (hasProperty('postBuildExtras')) { + postBuildExtras() +} diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/android/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java b/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java new file mode 100644 index 0000000..f2c2217 --- /dev/null +++ b/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java @@ -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 Testing documentation + */ +@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()); + } +} diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..340e7df --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/java/com/openproof/app/MainActivity.java b/android/app/src/main/java/com/openproof/app/MainActivity.java new file mode 100644 index 0000000..54ac427 --- /dev/null +++ b/android/app/src/main/java/com/openproof/app/MainActivity.java @@ -0,0 +1,5 @@ +package com.openproof.app; + +import com.getcapacitor.BridgeActivity; + +public class MainActivity extends BridgeActivity {} diff --git a/android/app/src/main/res/drawable-land-hdpi/splash.png b/android/app/src/main/res/drawable-land-hdpi/splash.png new file mode 100644 index 0000000..e31573b Binary files /dev/null and b/android/app/src/main/res/drawable-land-hdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-land-mdpi/splash.png b/android/app/src/main/res/drawable-land-mdpi/splash.png new file mode 100644 index 0000000..f7a6492 Binary files /dev/null and b/android/app/src/main/res/drawable-land-mdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-land-xhdpi/splash.png b/android/app/src/main/res/drawable-land-xhdpi/splash.png new file mode 100644 index 0000000..8077255 Binary files /dev/null and b/android/app/src/main/res/drawable-land-xhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-land-xxhdpi/splash.png b/android/app/src/main/res/drawable-land-xxhdpi/splash.png new file mode 100644 index 0000000..14c6c8f Binary files /dev/null and b/android/app/src/main/res/drawable-land-xxhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-land-xxxhdpi/splash.png b/android/app/src/main/res/drawable-land-xxxhdpi/splash.png new file mode 100644 index 0000000..244ca25 Binary files /dev/null and b/android/app/src/main/res/drawable-land-xxxhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-port-hdpi/splash.png b/android/app/src/main/res/drawable-port-hdpi/splash.png new file mode 100644 index 0000000..74faaa5 Binary files /dev/null and b/android/app/src/main/res/drawable-port-hdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-port-mdpi/splash.png b/android/app/src/main/res/drawable-port-mdpi/splash.png new file mode 100644 index 0000000..e944f4a Binary files /dev/null and b/android/app/src/main/res/drawable-port-mdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-port-xhdpi/splash.png b/android/app/src/main/res/drawable-port-xhdpi/splash.png new file mode 100644 index 0000000..564a82f Binary files /dev/null and b/android/app/src/main/res/drawable-port-xhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-port-xxhdpi/splash.png b/android/app/src/main/res/drawable-port-xxhdpi/splash.png new file mode 100644 index 0000000..bfabe68 Binary files /dev/null and b/android/app/src/main/res/drawable-port-xxhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-port-xxxhdpi/splash.png b/android/app/src/main/res/drawable-port-xxxhdpi/splash.png new file mode 100644 index 0000000..6929071 Binary files /dev/null and b/android/app/src/main/res/drawable-port-xxxhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..c7bd21d --- /dev/null +++ b/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/android/app/src/main/res/drawable/ic_launcher_background.xml b/android/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..d5fccc5 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/res/drawable/splash.png b/android/app/src/main/res/drawable/splash.png new file mode 100644 index 0000000..f7a6492 Binary files /dev/null and b/android/app/src/main/res/drawable/splash.png differ diff --git a/android/app/src/main/res/layout/activity_main.xml b/android/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..b5ad138 --- /dev/null +++ b/android/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..036d09b --- /dev/null +++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..036d09b --- /dev/null +++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..c023e50 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..2127973 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..b441f37 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..72905b8 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..8ed0605 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..9502e47 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..4d1e077 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..df0f158 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..853db04 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..6cdf97c Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..2960cbb Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..8e3093a Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..46de6e2 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..d2ea9ab Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..a40d73e Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/values/ic_launcher_background.xml b/android/app/src/main/res/values/ic_launcher_background.xml new file mode 100644 index 0000000..c5d5899 --- /dev/null +++ b/android/app/src/main/res/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + #FFFFFF + \ No newline at end of file diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..01b6da3 --- /dev/null +++ b/android/app/src/main/res/values/strings.xml @@ -0,0 +1,7 @@ + + + OpenProof + OpenProof + com.openproof.app + com.openproof.app + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..be874e5 --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/xml/file_paths.xml b/android/app/src/main/res/xml/file_paths.xml new file mode 100644 index 0000000..bd0c4d8 --- /dev/null +++ b/android/app/src/main/res/xml/file_paths.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java b/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java new file mode 100644 index 0000000..0297327 --- /dev/null +++ b/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java @@ -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 Testing documentation + */ +public class ExampleUnitTest { + + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 0000000..f1b3b0e --- /dev/null +++ b/android/build.gradle @@ -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.7.2' + classpath 'com.google.gms:google-services:4.4.2' + + // 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 +} diff --git a/android/capacitor.settings.gradle b/android/capacitor.settings.gradle new file mode 100644 index 0000000..bed916e --- /dev/null +++ b/android/capacitor.settings.gradle @@ -0,0 +1,15 @@ +// 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-filesystem' +project(':capacitor-filesystem').projectDir = new File('../node_modules/@capacitor/filesystem/android') + +include ':capacitor-keyboard' +project(':capacitor-keyboard').projectDir = new File('../node_modules/@capacitor/keyboard/android') + +include ':capacitor-share' +project(':capacitor-share').projectDir = new File('../node_modules/@capacitor/share/android') + +include ':capacitor-splash-screen' +project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capacitor/splash-screen/android') diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..2e87c52 --- /dev/null +++ b/android/gradle.properties @@ -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 diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..a4b76b9 Binary files /dev/null and b/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..c1d5e01 --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/android/gradlew b/android/gradlew new file mode 100644 index 0000000..f5feea6 --- /dev/null +++ b/android/gradlew @@ -0,0 +1,252 @@ +#!/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. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# 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/platforms/jvm/plugins-application/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##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || 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=SC2039,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=SC2039,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, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +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" "$@" diff --git a/android/gradlew.bat b/android/gradlew.bat new file mode 100644 index 0000000..9b42019 --- /dev/null +++ b/android/gradlew.bat @@ -0,0 +1,94 @@ +@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 +@rem SPDX-License-Identifier: Apache-2.0 +@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. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +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 diff --git a/android/settings.gradle b/android/settings.gradle new file mode 100644 index 0000000..3b4431d --- /dev/null +++ b/android/settings.gradle @@ -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' \ No newline at end of file diff --git a/android/variables.gradle b/android/variables.gradle new file mode 100644 index 0000000..2c8e408 --- /dev/null +++ b/android/variables.gradle @@ -0,0 +1,16 @@ +ext { + minSdkVersion = 23 + compileSdkVersion = 35 + targetSdkVersion = 35 + androidxActivityVersion = '1.9.2' + androidxAppCompatVersion = '1.7.0' + androidxCoordinatorLayoutVersion = '1.2.0' + androidxCoreVersion = '1.15.0' + androidxFragmentVersion = '1.8.4' + coreSplashScreenVersion = '1.0.1' + androidxWebkitVersion = '1.12.1' + junitVersion = '4.13.2' + androidxJunitVersion = '1.2.1' + androidxEspressoCoreVersion = '3.6.1' + cordovaAndroidVersion = '10.1.1' +} \ No newline at end of file diff --git a/assets/windows/AppxManifest.xml b/assets/windows/AppxManifest.xml index b65eead..33ac603 100644 --- a/assets/windows/AppxManifest.xml +++ b/assets/windows/AppxManifest.xml @@ -8,7 +8,7 @@ + Version="0.9.0.0" /> OpenProof diff --git a/assets/windows/splash-1116x540.png b/assets/windows/splash-1116x540.png new file mode 100644 index 0000000..ee6a587 Binary files /dev/null and b/assets/windows/splash-1116x540.png differ diff --git a/assets/windows/splash-620x300.png b/assets/windows/splash-620x300.png new file mode 100644 index 0000000..c0417ed Binary files /dev/null and b/assets/windows/splash-620x300.png differ diff --git a/assets/windows/splash-868x420.png b/assets/windows/splash-868x420.png new file mode 100644 index 0000000..2195629 Binary files /dev/null and b/assets/windows/splash-868x420.png differ diff --git a/docs/PLATFORM_READINESS.md b/docs/PLATFORM_READINESS.md index 21ad14c..7909358 100644 --- a/docs/PLATFORM_READINESS.md +++ b/docs/PLATFORM_READINESS.md @@ -1,7 +1,7 @@ # OpenProof — Platform Readiness Report -**Version:** 0.1.1 -**Date:** 2026-06-21 +**Version:** 0.9.0 +**Date:** 2026-06-27 ## 1. Platform Coverage @@ -9,10 +9,10 @@ | Requirement | Status | Notes | |-------------|--------|-------| -| PWA manifest | ✅ | `public/manifest.json` — standalone display, theme color #0052FF, background #f8f8f3 | -| Service worker | ✅ | `public/sw.js` — cache-first for static assets, network-first for navigation | -| Install prompt | ✅ | PWA meets installability criteria (manifest + SW + HTTPS) | -| Offline support | ✅ | Cached shell available; core pages work after initial visit | +|| PWA manifest | ✅ | `public/manifest.json` — standalone display, theme color #0081CC, background #000000 | +|| Service worker | ✅ | `public/sw.js` v0.9.0 — cache-first for static assets, network-first for navigation, `/proof/` and `/bundle/` routes cached | +|| Install prompt | ✅ | `PwaInstallPrompt` component — `beforeinstallprompt` handling with branded UI | +|| Offline support | ✅ | Cached shell available; core pages work after initial visit; update flow via SKIP_WAITING message | | Icons (192/512) | ✅ | `public/icon-192x192.png`, `public/icon-512x512.png` | | Apple touch icon | ✅ | `public/apple-touch-icon.png` (180×180) | | Favicon | ✅ | `public/favicon.ico` (16/32/48/64), `public/favicon.png` | @@ -30,9 +30,9 @@ | Store logo (150×150) | ✅ | `assets/windows/store-logo-150.png` | | Store logo (310×310) | ✅ | `assets/windows/store-logo-310.png` | | Store logo (310×150) | ✅ | `assets/windows/store-logo-310x150.png` | -| Splash screen (620×300) | ❌ | Not yet generated. Will be added on first MSIX packaging. | -| Splash screen (868×420) | ❌ | Not yet generated. | -| Splash screen (1116×540) | ❌ | Not yet generated. | +| Splash screen (620×300) | ✅ | `assets/windows/splash-620x300.png` — centered icon on black | +| Splash screen (868×420) | ✅ | `assets/windows/splash-868x420.png` — centered icon on black | +| Splash screen (1116×540) | ✅ | `assets/windows/splash-1116x540.png` — centered icon on black | | MSIX package | 📝 | Documented strategy below — no packaging tooling set up yet. | **MSIX packaging strategy:** @@ -101,15 +101,16 @@ | Play Store icon (512×512) | ✅ | `assets/android/play-store-icon.png` | | Privacy policy | ✅ | `docs/PRIVACY.md` | | Age rating | ✅ | Everyone — documented in `docs/STORE_METADATA.md` | -| APK/AAB package | 📝 | Documented strategy below | +| APK/AAB package | ✅ | Capacitor Android project initialized at `android/` with 4 plugins (Filesystem, Keyboard, Share, SplashScreen). Build via `npm run cap:build:android`. | **Android distribution strategy:** -1. OpenProof is primarily a web app. For Play Store presence: - - Use a Trusted Web Activity (TWA) with Bubblewrap to wrap the PWA. - - Bubblewrap will read `public/manifest.json` for configuration. - - Replace auto-generated icons with canonical icons from `assets/android/`. - - Sign with a release keystore. +1. OpenProof uses Capacitor for native Android packaging: + - Run `npx cap add android` (done — `android/` project exists) + - Build with `npm run cap:build:android` (builds static export, copies to native project, syncs plugins) + - Re-generate adaptive icons from `scripts/generate-icons.cjs` if the source SVG changes + - Sign with a release keystore and generate AAB via Android Studio or `npx cap build android` + - 4 Capacitor plugins configured: Filesystem, Keyboard, Share, SplashScreen 2. App content rating: - Self-assessment: Everyone (no restricted content). - Submit content questionnaire in Play Console using answers from `docs/STORE_METADATA.md`. diff --git a/manualtasksforsparsh.md b/manualtasksforsparsh.md index 9e336bb..c2b451f 100644 --- a/manualtasksforsparsh.md +++ b/manualtasksforsparsh.md @@ -14,21 +14,21 @@ ### Tasks - [ ] **Build the MSIX package** - - Run the Windows App Certification Kit on the project - - Package `public/` static export into MSIX using AppxManifest.xml in `assets/windows/` - - Sign the package with a code signing certificate + - [ ] Run the Windows App Certification Kit on the project + - [ ] Package `out/` static export into MSIX using AppxManifest.xml in `assets/windows/` + - [ ] Sign the package with a code signing certificate - [ ] **Test keyboard shortcuts on Windows** - - Tab through all pages (Create, Verify, About, Proof explorer) - - Enter/Escape on buttons and dialogs - - Ensure skip-to-content link works + - [ ] Tab through all pages (Create, Verify, About, Proof explorer) + - [ ] Enter/Escape on buttons and dialogs + - [ ] Ensure skip-to-content link works - [ ] **Test window resize behavior** - - Test at 800px, 1024px, 1280px, 1440px+ widths - - Verify nav collapses to mobile menu at small widths - - Verify no horizontal scrollbars at any width + - [ ] Test at 800px, 1024px, 1280px, 1440px+ widths + - [ ] Verify nav collapses to mobile menu at small widths + - [ ] Verify no horizontal scrollbars at any width - [ ] **Windows Store validation** - - Submit the signed MSIX to Partner Center - - Complete the Store listing (description, screenshots, category, age rating) - - Pass Windows App Certification Kit tests + - [ ] Submit the signed MSIX to Partner Center + - [ ] Complete the Store listing (description, screenshots, category, age rating) + - [ ] Pass Windows App Certification Kit tests --- @@ -40,32 +40,28 @@ - [ ] Java 17+ for Android builds ### Tasks -- [ ] **Initialize Capacitor Android project** - ```bash - npx cap add android - ``` +- [x] **Initialize Capacitor Android project** — DONE (`npx cap add android`) +- [ ] **Build signed AAB** + - [ ] Open `android/` in Android Studio + - [ ] Generate a signed AAB with your Play Store upload key + - [ ] Test the AAB on a physical device or emulator + - [ ] Run: `npm run cap:build:android` before opening Android Studio (builds static export + syncs) - [ ] **Test share sheet** - - Share a proof URL from the app to other apps (Messages, Email, Notes) - - Verify the URL is correct (`https://proof.kovina.org/proof/`) + - [ ] Share a proof URL from the app to other apps (Messages, Email, Notes) + - [ ] Verify the URL is correct (`https://proof.kovina.org/proof/`) - [ ] **Test file picker on Android** - - Select files from Downloads, Gallery, Google Drive picker - - Select multiple files for bundle proofs - - Verify large files work (up to 100MB) + - [ ] Select files from Downloads, Gallery, Google Drive picker + - [ ] Select multiple files for bundle proofs + - [ ] Verify large files work (up to 100MB) - [ ] **Test background restrictions (Android 12+)** - - Enable battery optimization for the app - - Put app in background, verify it returns to correct state - - Test with "Don't keep activities" developer option enabled -- [ ] **Generate signed AAB** - ```bash - npx cap build android - ``` - - Sign with your Play Store upload key - - Test the AAB on a physical device or emulator + - [ ] Enable battery optimization for the app + - [ ] Put app in background, verify it returns to correct state + - [ ] Test with "Don't keep activities" developer option enabled - [ ] **Play Store listing** - - Create store listing with description, screenshots, feature graphic - - Complete content rating questionnaire - - Set pricing (free) and distribution (all countries) - - Submit for review + - [ ] Create store listing with description, screenshots, feature graphic + - [ ] Complete content rating questionnaire + - [ ] Set pricing (free) and distribution (all countries) + - [ ] Submit for review --- @@ -94,6 +90,17 @@ --- +## PWA — Install & Update UX + +- [ ] **Test install prompt** — PwaInstallPrompt component shows after ~5s on supported browsers +- [ ] **Test install flow** — Click "Install" → standard browser install prompt → app installs +- [ ] **Test "Not now"** — Dismisses the prompt; verify it doesn't reappear on same page load +- [ ] **Test update flow** — Deploy new version → verify "Update available" appears after SW update +- [ ] **Test cache migration** — Old cache (`openproof-v0.8.0` if exists) should be cleaned on SW activate +- [ ] **Test offline proof page** — Visit `/proof/placeholder` offline → should serve cached shell + +--- + ## Domain & DNS - [x] Cloudflare CNAME `proof → cname.vercel-dns.com` — DONE @@ -104,13 +111,37 @@ --- +## v0.9.0 What Was Done (Automated) + +These tasks were completed automatically this session: +- [x] Windows MSIX: Updated AppxManifest.xml version to 0.9.0.0 +- [x] Windows MSIX: Generated splash screens (620x300, 868x420, 1116x540) with centered icon on black +- [x] PWA: Updated manifest theme_color to #0081CC (brand), background_color to #000000 (black) +- [x] PWA: Added `theme-color` meta tag to layout +- [x] PWA: Created `PwaInstallPrompt` component (beforeinstallprompt handling + update flow notification) +- [x] PWA: Added `/proof/` and `/bundle/` routes to SW static cache +- [x] Android: Initialized Capacitor project with `npx cap add android` +- [x] Android: Created `scripts/cap-build.sh` for static export + Capacitor sync +- [x] Android: Updated capacitor.config.json with 4 plugins (Filesystem, Keyboard, Share, SplashScreen) +- [x] Android: Dynamic routes support static export via `generateStaticParams` +- [x] Icons: All platform icons regenerated from canonical SVG +- [x] Footer: Version updated to v0.9.0 +- [x] Lint: 0 errors (6 pre-existing warnings) ✅ +- [x] Typecheck: Pass ✅ +- [x] Build (Vercel mode): Pass ✅ +- [x] Build (Capacitor static export): Pass ✅ +- [x] Updated PLATFORM_READINESS.md to v0.9.0 + +--- + ## Reminders - All icon files were regenerated from `public/icon.svg` (your SVG). If you update the SVG, run: ```bash node scripts/generate-icons.cjs # all PNG variants - node scripts/generate-ico.cjs # ICO files + OG + manifest + node scripts/generate-ico.cjs # ICO files + manifest ``` - Splash screens in `public/splash/` are pre-existing from v0.1.x. If they need updating to match your new icon, provide the splash source. - The Vercel free tier has a 100-deploy-per-day limit. If you hit it, wait 24 hours or upgrade. +- Capacitor build: `npm run cap:build:android` to rebuild web assets and sync to Android project - Contact for everything: sparshsam@gmail.com diff --git a/next.config.mts b/next.config.mts index 5d2473b..9a8c04b 100644 --- a/next.config.mts +++ b/next.config.mts @@ -6,12 +6,12 @@ const __dirname = dirname(fileURLToPath(import.meta.url)); const nextConfig: NextConfig = { outputFileTracingRoot: __dirname, - // Static export: no server required, deployable to any static host + // Static export when building for Capacitor/Electron native platforms + output: process.env.NEXT_PUBLIC_STATIC_EXPORT === "true" ? "export" : undefined, images: { unoptimized: true }, // Improve production build output productionBrowserSourceMaps: false, // Bundle analysis data available on CI - output: undefined, // Optimize performance compiler: { removeConsole: process.env.NODE_ENV === "production" ? { diff --git a/package.json b/package.json index 4c8008e..081db4e 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "cap:add:android": "npx cap add android", "cap:sync": "npx cap sync", "cap:open:android": "npx cap open android", - "cap:build:android": "npm run build && npx cap copy android && npx cap sync android", + "cap:build:android": "bash scripts/cap-build.sh", "export": "next build", "package:msix": "echo 'Run: npx electron-builder --win or manual MSIX packaging via Windows App Certification Kit'" }, @@ -68,5 +68,13 @@ "bugs": { "url": "https://github.com/sparshsam/openproof/issues" }, - "keywords": [] + "keywords": [], + "allowScripts": { + "bufferutil@4.1.0": true, + "keccak@3.0.4": true, + "sharp@0.34.5": true, + "secp256k1@4.0.4": true, + "unrs-resolver@1.12.2": true, + "utf-8-validate@5.0.10": true + } } diff --git a/public/manifest.json b/public/manifest.json index 843c01d..9fe87df 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -9,8 +9,8 @@ "standalone", "browser" ], - "background_color": "#f8f8f3", - "theme_color": "#0052FF", + "background_color": "#000000", + "theme_color": "#0081CC", "orientation": "any", "lang": "en", "dir": "ltr", diff --git a/public/sw.js b/public/sw.js index dc14f0b..6d44a0d 100644 --- a/public/sw.js +++ b/public/sw.js @@ -25,6 +25,8 @@ const STATIC_ASSETS = [ "/apple-touch-icon.png", "/robots.txt", "/sitemap.xml", + "/proof/", + "/bundle/", ]; // Routes that should always be fetched from the network diff --git a/scripts/cap-build.sh b/scripts/cap-build.sh new file mode 100644 index 0000000..03edf21 --- /dev/null +++ b/scripts/cap-build.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# OpenProof Capacitor Android Build Script +# Builds the web app as a static export for Capacitor, then copies to native project + +set -euo pipefail + +echo "=== OpenProof Capacitor Build ===" + +# Build with static export for Capacitor +echo "[1/3] Building static export..." +NEXT_PUBLIC_STATIC_EXPORT=true npx next build 2>&1 + +if [ -d "out" ]; then + echo "[2/3] Copying web assets to Capacitor Android project..." + npx cap copy android 2>&1 + + echo "[3/3] Syncing Capacitor..." + npx cap sync android 2>&1 + + echo "" + echo "✅ Capacitor Android build complete!" + echo "To open in Android Studio: npx cap open android" +else + echo "❌ out/ directory not found. Static export may have failed." + exit 1 +fi diff --git a/src/app/about/page.tsx b/src/app/about/page.tsx index 558a412..509347f 100644 --- a/src/app/about/page.tsx +++ b/src/app/about/page.tsx @@ -315,7 +315,7 @@ export default function AboutPage() { Details AGPL-3.0 - v0.1.4 + v0.9.0 ))} -

— OpenProof v0.1.1 —

+

— OpenProof v0.9.0 —

) : null} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 9a02e73..aece90c 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -5,6 +5,7 @@ import { AppShell } from "@/components/app-shell"; import { ThemeProvider } from "@/components/providers/theme-provider"; import { ErrorBoundary } from "@/components/error-boundary"; import { OfflineNotice } from "@/components/offline-notice"; +import { PwaInstallPrompt } from "@/components/pwa-install-prompt"; import "./globals.css"; const geistMono = Geist_Mono({ @@ -75,6 +76,7 @@ export const metadata: Metadata = { }, other: { "mobile-web-app-capable": "yes", + "theme-color": "#0081CC", }, }; @@ -104,6 +106,7 @@ export default function RootLayout({ {children} + diff --git a/src/app/proof/[hash]/page.tsx b/src/app/proof/[hash]/page.tsx index cdc670a..c773872 100644 --- a/src/app/proof/[hash]/page.tsx +++ b/src/app/proof/[hash]/page.tsx @@ -1,6 +1,12 @@ import type { Metadata } from "next"; import { ProofExplorerClient } from "@/app/proof/[hash]/proof-explorer-client"; +export async function generateStaticParams() { + return [{ hash: "placeholder" }]; +} + +export const dynamicParams = false; + export function generateMetadata(): Metadata { return { title: "OpenProof verification page", diff --git a/src/components/app-shell.tsx b/src/components/app-shell.tsx index dfe286f..fef9d04 100644 --- a/src/components/app-shell.tsx +++ b/src/components/app-shell.tsx @@ -64,7 +64,7 @@ export function AppShell({ children }: { children: React.ReactNode }) {
AGPL-3.0 - v0.8.0 + v0.9.0

diff --git a/src/components/pwa-install-prompt.tsx b/src/components/pwa-install-prompt.tsx new file mode 100644 index 0000000..eaeed58 --- /dev/null +++ b/src/components/pwa-install-prompt.tsx @@ -0,0 +1,142 @@ +"use client"; + +import { useEffect, useState, useCallback } from "react"; + +interface BeforeInstallPromptEvent extends Event { + readonly platforms: string[]; + readonly userChoice: Promise<{ outcome: "accepted" | "dismissed"; platform: string }>; + prompt(): Promise; +} + +declare global { + interface WindowEventMap { + beforeinstallprompt: BeforeInstallPromptEvent; + } +} + +export function PwaInstallPrompt() { + const [deferredPrompt, setDeferredPrompt] = useState(null); + const [showPrompt, setShowPrompt] = useState(false); + const [updateAvailable, setUpdateAvailable] = useState(false); + + // Listen for beforeinstallprompt + useEffect(() => { + const handler = (e: BeforeInstallPromptEvent) => { + e.preventDefault(); + setDeferredPrompt(e); + // Show prompt after a short delay — don't interrupt initial load + setTimeout(() => setShowPrompt(true), 5000); + }; + + window.addEventListener("beforeinstallprompt", handler); + return () => window.removeEventListener("beforeinstallprompt", handler); + }, []); + + // Listen for service worker updates + useEffect(() => { + if (!("serviceWorker" in navigator)) return; + + const handleControllerChange = () => { + window.location.reload(); + }; + + navigator.serviceWorker.addEventListener("controllerchange", handleControllerChange); + + // Check for updates periodically + const interval = setInterval(async () => { + const registration = await navigator.serviceWorker.getRegistration(); + if (registration) { + registration.update(); + } + }, 60 * 60 * 1000); // every hour + + return () => { + navigator.serviceWorker.removeEventListener("controllerchange", handleControllerChange); + clearInterval(interval); + }; + }, []); + + // Listen for updatefound on SW registration + useEffect(() => { + if (!("serviceWorker" in navigator)) return; + + navigator.serviceWorker.ready.then((registration) => { + registration.addEventListener("updatefound", () => { + const newWorker = registration.installing; + if (!newWorker) return; + + newWorker.addEventListener("statechange", () => { + if (newWorker.state === "installed" && navigator.serviceWorker.controller) { + // New version available + setUpdateAvailable(true); + } + }); + }); + }); + }, []); + + const handleInstall = useCallback(async () => { + if (!deferredPrompt) return; + deferredPrompt.prompt(); + const { outcome } = await deferredPrompt.userChoice; + if (outcome === "accepted") { + setShowPrompt(false); + } + setDeferredPrompt(null); + }, [deferredPrompt]); + + const handleDismiss = useCallback(() => { + setShowPrompt(false); + setDeferredPrompt(null); + }, []); + + const handleUpdate = useCallback(() => { + if (!("serviceWorker" in navigator)) return; + navigator.serviceWorker.controller?.postMessage({ type: "SKIP_WAITING" }); + setUpdateAvailable(false); + }, []); + + if (!showPrompt && !updateAvailable) return null; + + return ( + <> + {/* Install prompt */} + {showPrompt && deferredPrompt && ( +

+
+ + Install OpenProof + + +
+
+ )} + + {/* Update available prompt */} + {updateAvailable && ( +
+ +
+ )} + + ); +}