Skip to content

Commit

Permalink
Merge branch 'release/2.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
iSoron committed Jan 31, 2024
2 parents 6116ef9 + 02e9e23 commit d10538e
Show file tree
Hide file tree
Showing 248 changed files with 1,102 additions and 1,235 deletions.
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ updates:
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@ on:
jobs:
Test:
runs-on: self-hosted
timeout-minutes: 30
steps:
- name: Check out source code
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Build project
run: ./build.sh build

- name: Run Android tests
run: ./build.sh android-tests-parallel 24 25 26 28 30 31
run: ./build.sh android-tests-parallel 28 29 30 32 33 34

- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: build
path: |
Expand Down
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@
.idea
.secret
build
build/
captures
local.properties
node_modules
*xcuserdata*
*.sketch
/design
/releases
/screenshots
crowdin.yml
kotlin-js-store
16 changes: 0 additions & 16 deletions .secret/decrypt.sh

This file was deleted.

Binary file removed .secret/secret
Binary file not shown.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## [2.2.0] -- 2024-01-30
### Added
- Add support for Android 14 (@iSoron, @hiqua)
- Allow user to change app language (@leondzn)

### Fixed
- Implement workaround to make notifications non-dismissible in Android 14 (@iSoron, #1872)
- Fix splash screen background color in dark mode (@SIKV, #1888)

## [2.1.3] -- 2023-08-28
### Fixed
- Use text input on Samsung devices (@iSoron, #1719)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ show you how your habits improved over time. It is completely ad-free and open
source.

<p align="center">
<a href="https://play.google.com/store/apps/details?id=org.isoron.uhabits&utm_source=global_co&utm_medium=prtnr&utm_content=Mar2515&utm_campaign=PartBadge&pcampaignid=MKT-AC-global-none-all-co-pr-py-PartBadges-Oct1515-1"><img alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/apps/en-play-badge-border.png" height="75px"/></a>
<a href="https://f-droid.org/app/org.isoron.uhabits"><img alt="Get it on F-Droid" src="https://i.imgur.com/baSPE7X.png" height="75px"/></a>
<a href="https://play.google.com/store/apps/details?id=org.isoron.uhabits&utm_source=global_co&utm_medium=prtnr&utm_content=Mar2515&utm_campaign=PartBadge&pcampaignid=MKT-AC-global-none-all-co-pr-py-PartBadges-Oct1515-1"><img alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png" height="80px"/></a>
<a href="https://f-droid.org/app/org.isoron.uhabits"><img alt="Get it on F-Droid" src="https://f-droid.org/badge/get-it-on.png" height="80px"/></a>
</p>

## Screenshots
Expand Down
7 changes: 3 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
plugins {
val kotlinVersion = "1.6.10"
id("com.android.application") version ("7.0.3") apply (false)
val kotlinVersion = "1.9.21"
id("com.android.application") version "8.1.4" apply (false)
id("org.jetbrains.kotlin.android") version kotlinVersion apply (false)
id("org.jetbrains.kotlin.kapt") version kotlinVersion apply (false)
id("org.jetbrains.kotlin.android.extensions") version kotlinVersion apply (false)
id("org.jetbrains.kotlin.multiplatform") version kotlinVersion apply (false)
id("org.jlleitschuh.gradle.ktlint") version "10.2.1"
id("org.jlleitschuh.gradle.ktlint") version "11.6.1"
}

apply {
Expand Down
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ android_setup() {
$AVDMANAGER delete avd --name $AVDNAME

log_info "Creating new Android virtual device (API $API)..."
(echo "y" | $SDKMANAGER --install "system-images;android-$API;default;x86_64") || return 1
(echo "y" | $SDKMANAGER --install "system-images;android-$API;google_apis;x86_64") || return 1
$AVDMANAGER create avd \
--name $AVDNAME \
--package "system-images;android-$API;default;x86_64" \
--package "system-images;android-$API;google_apis;x86_64" \
--device "Nexus 4" || return 1

flock -u 10
Expand Down Expand Up @@ -181,7 +181,7 @@ android_test() {
OUT_INSTRUMENT=${ANDROID_OUTPUTS_DIR}/instrument-${API}.txt
OUT_LOGCAT=${ANDROID_OUTPUTS_DIR}/logcat-${API}.txt
FAILED_TESTS=""
for i in {1..5}; do
for i in {1..10}; do
log_info "Running $size instrumented tests (attempt $i)..."
$ADB shell am instrument \
-r -e coverage true -e size "$size" $FAILED_TESTS \
Expand Down
2 changes: 1 addition & 1 deletion docs/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The repository will be downloaded to the directory `uhabits`.
2. When the IDE asks you for the project location, select `uhabits` and click "Ok".
3. Android Studio will spend some time indexing the project. When this is complete, click the toolbar icon "Sync Project with Gradle File", located near the right corner of the top toolbar.
4. The operation will likely fail several times due to missing Android SDK components. Each time it fails, click the link "Install missing platforms", "Install build tools", etc, and try again.
5. To test the application, create a virtual Android device using the menu "Tools" and "AVD Manager". The default options should work fine, but free to customize the device.
5. To test the application, create a virtual Android device using the menu "Tools" and "AVD Manager". The default options should work fine, but feel free to customize the device.
6. Click the menu "Run" and "uhabits-android". The application should launch.


Expand Down
54 changes: 14 additions & 40 deletions docs/TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,25 @@

Loop Habit Tracker has a fairly large number of automated tests to reduce the chance of bugs being silently introduced in our code base. The tests are divided into three categories:

* **Small tests:** These tests run very quickly on the developer's computer, inside a JVM, and do not need an Android emulator or device. They typically test the correctness of core functions of the application, such as the computation of scores and streaks.
* **Medium tests:** These tests require an Android emulator or device, but they are still quite fast to run, since only individual classes are tested. The app itself does not need to be launched. Examples include *view tests*, which render our custom views on the device and compare them against prerendered images.
* **Large tests:** These are end-to-end tests, which launch the application on an Android emulator and interact with it by touching the screen, much like a regular user.
- **Unit tests:** These tests run very quickly on the developer's computer, inside a JVM, and do not need an Android emulator or device. They typically test the correctness of core functions of the application, such as the computation of scores and streaks.
- **Instrumented tests:** These tests require an Android emulator or device. _Medium_ instrumented tests are still quite fast to run, since only individual classes are tested. The app itself does not need to be launched. Examples include _view tests_, which render our custom views on the device and compare them against prerendered images. _Large_ instrumented tests launch the application on an Android emulator and interact with it by touching the screen, much like a regular user.

## Running small tests
## Running unit tests

Small tests can be launched by running `./gradlew test` or by right-clicking a particular class/method in Android Studio and selecting "Run testMethod()" or "Run ClassTest". An alternative way is to use `build.sh`, the script used by our continuous integration server. By running `./build.sh build`, the script will automatically build and run all small tests.
Unit tests can be launched by running `./gradlew test` or by right-clicking a particular class/method in Android Studio and selecting "Run testMethod()" or "Run ClassTest". An alternative way is to use `build.sh`, the script used by our continuous integration server. By running `./build.sh build`, the script will automatically build and run all small tests.

## Running medium tests
## Running instrumented tests

To run medium tests, it is recommended to use the `build.sh` script:
To run medium tests, it is recommended to use the `build.sh` script.

./build.sh build
./build.sh medium-tests
1. Run `./build.sh android-setup API` to create the emulator, where `API` is the desired API level.
2. Run `./build.sh android-tests API` to run the tests on a single API.
3. Run `./build.sh android-tests-parallel API API...` to run the tests on multiple APIs in parallel.

Note that instrumented tests are designed to run on a clean install, inside an emulator. They will not work on actual devices. All tests are also designed for a particular screen size, namely the Nexus 4 configuration (4.7" 768x1280 xhdpi), and a particular locale, namely English (US). Furthermore:

For this script to succeed, make sure that an emulator is currently running, or that a device (with developer mode activated) is connected via USB.
- No additional apps should be installed on the device;
- The homescreen must look exactly like it was when the emulator was originally created, with no additional icons or widgets;
- All animations must be manually disabled.

**WARNING!** This script will uninstall the app prior to testing it, and therefore delete all user data!


If there are failing view tests (that is, if some custom views do not render exactly like the prerendered images we have), then the script `./build.sh fetch-images` can be used to download both the actual and the expected images from the device. The images will be downloaded from the device into the folder `tmp/`. After verifying the differences, if you feel that the actual images are actually fine and should replace the prerendered ones, then run `./build.sh accept-images`.

## Running large tests

Large tests are significantly more complicated to run. In particular, they require:

* An Android emulator; they will **not** work on actual devices;
* A vanilla x86 AOSP image; they will **not** work with Google API images;
* A particular screen size, namely the Nexus 4 configuration on Android Studio (4.7 768x1280 xhdpi);
* A particular locale, namely English (US).

Furthermore:

* No additional apps should be installed on the device;
* The homescreen must look exactly like it was when the emulator was originally created, with no additional icons or widgets;
* Developer mode must be activated, and all animations must be manually disabled.

Only the following Android versions are supported by our test suite:

* Android 7.0 (API 24)
* Android 7.1.1 (API 25)
* Android 8.0 (API 26)
* Android 8.1 (API 27)
* Android 9.0 (API 28)
* Android 10.0 (API 29)

After creating an emulator and configuring it exactly as described above, launch it, wait for it to finish booting up, then run `./build.sh large-tests`. As mentioned before, this script will uninstall the app before testing it, and therefore will delete all the user data.
If there are failing view tests (that is, if some custom views do not render exactly like the prerendered images we have), then both the actual and expected images will be automatically downloaded from the device to the folder `uhabits-android/build/outputs`. After verifying the differences, if you feel that the actual images are actually fine and should replace the prerendered ones, then run `./build.sh android-accept-images`.
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ org.gradle.daemon=true
org.gradle.jvmargs=-Xms2048m -Xmx2048m
android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 0 additions & 2 deletions landing/.gitignore

This file was deleted.

27 changes: 0 additions & 27 deletions landing/Makefile

This file was deleted.

27 changes: 0 additions & 27 deletions landing/README.md

This file was deleted.

1 change: 0 additions & 1 deletion landing/assets/faq.html

This file was deleted.

Binary file removed landing/assets/images/f-droid.png
Binary file not shown.
Binary file removed landing/assets/images/google-play.png
Binary file not shown.
Binary file removed landing/assets/images/hero-background-filter.jpg
Binary file not shown.
7 changes: 0 additions & 7 deletions landing/assets/lib/css/bootstrap.min.css

This file was deleted.

1 change: 0 additions & 1 deletion landing/assets/lib/css/bootstrap.min.css.map

This file was deleted.

7 changes: 0 additions & 7 deletions landing/assets/lib/js/bootstrap.bundle.min.js

This file was deleted.

1 change: 0 additions & 1 deletion landing/assets/lib/js/bootstrap.bundle.min.js.map

This file was deleted.

2 changes: 0 additions & 2 deletions landing/assets/lib/js/jquery.min.js

This file was deleted.

Binary file removed landing/assets/screenshots/uhabits1.png
Binary file not shown.
Binary file removed landing/assets/screenshots/uhabits1_th.png
Binary file not shown.
Binary file removed landing/assets/screenshots/uhabits2.png
Binary file not shown.
Binary file removed landing/assets/screenshots/uhabits2_th.png
Binary file not shown.
Binary file removed landing/assets/screenshots/uhabits3.png
Binary file not shown.
Binary file removed landing/assets/screenshots/uhabits3_th.png
Binary file not shown.
Binary file removed landing/assets/screenshots/uhabits4.png
Binary file not shown.
Binary file removed landing/assets/screenshots/uhabits4_th.png
Binary file not shown.
Binary file removed landing/assets/screenshots/uhabits5.png
Binary file not shown.
Binary file removed landing/assets/screenshots/uhabits5_th.png
Binary file not shown.
Binary file removed landing/assets/screenshots/uhabits6.png
Binary file not shown.
Binary file removed landing/assets/screenshots/uhabits6_th.png
Binary file not shown.
106 changes: 0 additions & 106 deletions landing/src/index.haml

This file was deleted.

Loading

0 comments on commit d10538e

Please sign in to comment.