Skip to content

Commit

Permalink
test: Divert analytics when in test (#470)
Browse files Browse the repository at this point in the history
Because we don't want test-runs of the app
to pollute real-world collection of analytics,

this commit will:
- add a separate metrics collection end-point for the app,
  reserving the production end-point for when the app is
  - deployed to the production web environment, or
  - running on a phone

**Certification**
- [X] I certify that <!-- Check the box to certify: [X] -->
- I have read the [contributing guidelines](
  https://github.com/nodepa/seedlingo/blob/main/.github/CONTRIBUTING.md)
- I license these contributions to the public under Seedlingo's
  [LICENSE](https://github.com/nodepa/seedlingo/blob/main/LICENSE.md)
  and have the rights to do so.

Signed-off-by: toshify <4579559+toshify@users.noreply.github.com>
  • Loading branch information
toshify authored Feb 13, 2024
1 parent 88fdab3 commit 5d0ec3d
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 35 deletions.
5 changes: 3 additions & 2 deletions app/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
apply plugin: 'com.android.application'

android {
namespace "org.nodepa.seedlingo"
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "org.nodepa.seedlingo"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 44
versionName "1.1.6"
versionCode 47
versionName "1.1.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
2 changes: 1 addition & 1 deletion app/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.nodepa.seedlingo">
>

<application
android:allowBackup="true"
Expand Down
4 changes: 2 additions & 2 deletions app/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'com.google.gms:google-services:4.3.13'
classpath 'com.android.tools.build:gradle:8.0.0'
classpath 'com.google.gms:google-services:4.3.15'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
3 changes: 1 addition & 2 deletions app/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ org.gradle.jvmargs=-Xmx1536m
# 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
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

Binary file modified app/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion app/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 14 additions & 4 deletions app/android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# 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"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -205,6 +209,12 @@ set -- \
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.
Expand Down
15 changes: 9 additions & 6 deletions app/android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
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!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
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
Expand Down
16 changes: 8 additions & 8 deletions app/android/variables.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ ext {
minSdkVersion = 22
compileSdkVersion = 33
targetSdkVersion = 33
androidxActivityVersion = '1.4.0'
androidxAppCompatVersion = '1.4.2'
androidxActivityVersion = '1.7.0'
androidxAppCompatVersion = '1.6.1'
androidxCoordinatorLayoutVersion = '1.2.0'
androidxCoreVersion = '1.8.0'
androidxFragmentVersion = '1.4.1'
coreSplashScreenVersion = '1.0.0-rc01'
androidxWebkitVersion = '1.4.0'
androidxCoreVersion = '1.10.0'
androidxFragmentVersion = '1.5.6'
coreSplashScreenVersion = '1.0.0'
androidxWebkitVersion = '1.6.1'
junitVersion = '4.13.2'
androidxJunitVersion = '1.1.3'
androidxEspressoCoreVersion = '3.4.0'
androidxJunitVersion = '1.1.5'
androidxEspressoCoreVersion = '3.5.1'
cordovaAndroidVersion = '10.1.1'
}
10 changes: 5 additions & 5 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "seedlingo",
"version": "1.1.7",
"version": "1.1.8",
"description": "Modern mobile multi-language literacy - A first-language digital learning tool for adults",
"homepage": "https://seedlingo.com/get-started",
"bugs": "https://github.com/nodepa/seedlingo/issues",
Expand All @@ -25,7 +25,7 @@
"scripts": {
"ba": "npm run build:android",
"build": "npm install && npm run lint:tsc && vite build",
"build:android": "npm run build && cap telemetry off && cap sync && node versionsync.mjs && cd android && yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses && ./gradlew assembleRelease && cd app/build/outputs/apk/release && for filename in *.unsigned.apk ; do $ANDROID_HOME/build-tools/33.0.2/zipalign 4 $filename ${filename%unsigned*}unsigned.aligned${filename##*unsigned} && $ANDROID_HOME/build-tools/33.0.2/apksigner sign -v --ks ~/.android/apksign.keystore --out ${filename%.unsigned*}${filename##*unsigned} ${filename%unsigned*}unsigned.aligned${filename##*unsigned} ; done",
"build:android": "npm run build && cap telemetry off && cap sync && node versionsync.mjs && cd android && yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses && ./gradlew assembleRelease && cd app/build/outputs/apk/release && for filename in *.unsigned.apk ; do $ANDROID_HOME/build-tools/34.0.0/zipalign 4 $filename ${filename%unsigned*}unsigned.aligned${filename##*unsigned} && $ANDROID_HOME/build-tools/34.0.0/apksigner sign -v --ks ~/.android/apksign.keystore --out ${filename%.unsigned*}${filename##*unsigned} ${filename%unsigned*}unsigned.aligned${filename##*unsigned} ; done",
"dev": "vite",
"genass": "cd public && pwd && npx pwa-asset-generator --background 'linear-gradient(#19D2FE, #1E64F0)' --padding '0px' --favicon --single-quotes --type png ../src/assets/logo/logo.svg ./logo",
"lint": "eslint --ext .vue,.ts,.tsx,.js,.jsx .",
Expand Down Expand Up @@ -107,4 +107,4 @@
"node": "18.19.0",
"npm": "10.4.0"
}
}
}
6 changes: 5 additions & 1 deletion app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import { createApp } from 'vue';

import { IonicVue } from '@ionic/vue';
import { isPlatform } from '@ionic/vue';
import '@ionic/vue/css/core.css';
import '@ionic/vue/css/normalize.css';
import '@ionic/vue/css/structure.css';
Expand Down Expand Up @@ -47,7 +48,10 @@ app.use(InstructionsDirective, { Badge });
app.use(
createPlausible({
init: {
domain: 'seedlingo.app',
domain:
__AWS_BRANCH__ === 'main' || isPlatform('capacitor')
? 'seedlingo.app'
: 'test.seedlingo.app',
trackLocalhost: true,
},
settings: {
Expand Down

0 comments on commit 5d0ec3d

Please sign in to comment.