Skip to content

Commit

Permalink
Merge branch 'dev' into feature/templatestudies
Browse files Browse the repository at this point in the history
  • Loading branch information
rajuAhmed1705 committed Jul 24, 2024
2 parents c4b4dd9 + 30835ba commit 2e67cc0
Show file tree
Hide file tree
Showing 33 changed files with 175 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .fvmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"flutter": "3.22.3"
}
}
36 changes: 25 additions & 11 deletions .github/workflows/all_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- "core/**"
- "designer_v2/**"
- "flutter_common/**"
- '*.gitignore'
- 'melos.yaml'
- 'pubspec.yaml'
- 'pubspec.lock'
- ".github/workflows/all_packages.yml"
- ".github/workflows/init-workspace/**"
workflow_dispatch:
Expand All @@ -16,29 +20,39 @@ concurrency:
cancel-in-progress: true

jobs:
analyze:
static_analysis:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.READY_TO_MERGE_TOKEN }}

- name: Init workspace
uses: ./.github/workflows/init-workspace

- name: Run generate
run: melos run generate

# - name: Run fix # remove until flutter_gen issue is fixed
# run: melos run fix

- name: Run bootstrap
run: melos bootstrap

- name: Run format
run: melos format

- name: Run analyze
run: melos analyze

format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Commit changes if any
uses: stefanzweifel/git-auto-commit-action@v5
with:
fetch-depth: 0
- name: Init workspace
uses: ./.github/workflows/init-workspace
- name: Run format
run: melos format --set-exit-if-changed
commit_message: 'chore: Apply static analysis changes'

test:
runs-on: ubuntu-latest
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/check-uncomitted-changes.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/deploy-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:

app-store-release:
name: Create App Store Release
runs-on: macos-14 # macos-latest
runs-on: macos-latest
steps:
- name: Await potential publishing on Pub.dev
uses: johannesvedder/await-workflow@v1
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Linter

on:
push:

jobs:
linter:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.READY_TO_MERGE_TOKEN }}

- name: Check final newline
uses: johannesvedder/check-final-newline@main
with:
fail_on_missing_newline: 'false'

- name: Restore ignored files
run: |
git checkout -- **/l10n-missing.txt
- name: Commit changes if any
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'lint: Apply final newline changes'
6 changes: 3 additions & 3 deletions .github/workflows/ready_to_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ concurrency:
cancel-in-progress: true

jobs:
check_commit_status:
ready_to_merge:
runs-on: ubuntu-latest
steps:
- name: Check if PR is mergeable
- name: Check if PR is ready to merge
uses: actions/github-script@v7
with:
script: |
// Define a list of workflows that need to finish successfully if run before merging
workflows_to_check = [
"all_packages.yml",
"check-uncommitted-changes.yml",
"linter.yml",
"mega-linter.yml",
"e2e_tests.yml",
"supabase-test.yml",
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ generated/
megalinter-reports/

# FVM Version Cache
.fvm/
.fvm/
2 changes: 1 addition & 1 deletion .markdown_link_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"pattern": "localhost"
}
]
}
}
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 2024-07-24

### Changes

---

Packages with breaking changes:

- There are no breaking changes in this release.

Packages with other changes:

- [`studyu_app` - `v2.7.8`](#studyu_app---v278)
- [`studyu_core` - `v4.4.5`](#studyu_core---v445)
- [`studyu_designer_v2` - `v1.8.3`](#studyu_designer_v2---v183)
- [`studyu_flutter_common` - `v1.8.6`](#studyu_flutter_common---v186)

---

#### `studyu_app` - `v2.7.8`

- **FIX**: safety check.
- **FIX**: outdated cached subject.
- **FIX**: upgrade deps.

#### `studyu_core` - `v4.4.5`

- **FIX**: upgrade deps.

#### `studyu_designer_v2` - `v1.8.3`

- **FIX**: upgrade deps.

#### `studyu_flutter_common` - `v1.8.6`

- **FIX**: upgrade deps.


## 2024-07-15

### Changes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ Henschel F, Manaswini M, Pottbäcker F, Edelman JA, Owoyele B, Danieletto M,
Golden E, Zweig M, Nadkarni G, Böttinger E (2020).
StudyU: a platform for designing and conducting innovative digital N-of-1
trials. arXiv: 2012.1420.
[https://arxiv.org/abs/2012.14201](https://arxiv.org/abs/2012.14201).
[https://arxiv.org/abs/2012.14201](https://arxiv.org/abs/2012.14201)
2 changes: 1 addition & 1 deletion app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,4 @@ app.*.symbols
# snapshot generated screenshots
**/fastlane/screenshots
# scan temporary files
**/fastlane/test_output
**/fastlane/test_output
6 changes: 6 additions & 0 deletions app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.7.8

- **FIX**: safety check.
- **FIX**: outdated cached subject.
- **FIX**: upgrade deps.

## 2.7.7

- **FIX**: upgrade deps.
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
The StudyU Health app is part of the StudyU platform, together with the StudyU designer. With the StudyU designer, scientists are given a web application to digitally specify, publish, and conduct N-of-1 trials. The StudyU app is a smartphone application with innovative user-centric elements for participants to partake in the published trials and assess the effects of different interventions on their health. Thereby, the StudyU platform allows clinicians and researchers worldwide to easily design and conduct digital N-of-1 trials in a safe manner. StudyU has the potential to change the landscape of personalized treatments both for patients and healthy individuals, as a free collaborative tool for researchers, and as a tool that can be integrated in clinical practice.
The StudyU Health app is part of the StudyU platform, together with the StudyU designer. With the StudyU designer, scientists are given a web application to digitally specify, publish, and conduct N-of-1 trials. The StudyU app is a smartphone application with innovative user-centric elements for participants to partake in the published trials and assess the effects of different interventions on their health. Thereby, the StudyU platform allows clinicians and researchers worldwide to easily design and conduct digital N-of-1 trials in a safe manner. StudyU has the potential to change the landscape of personalized treatments both for patients and healthy individuals, as a free collaborative tool for researchers, and as a tool that can be integrated in clinical practice.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Find out the effects of different interventions on your health in a medial study
Find out the effects of different interventions on your health in a medial study
2 changes: 1 addition & 1 deletion app/android/fastlane/metadata/android/en-US/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
StudyU Health
StudyU Health
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

You can customize the launch screen with your own desired assets by replacing the image files in this directory.

You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
2 changes: 2 additions & 0 deletions app/lib/screens/app_onboarding/loading_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class _LoadingScreenState extends State<LoadingScreen> {
subject = await _fetchRemoteSubject(selectedStudyObjectId);
}
} catch (exception) {
debugPrint(
"Could not login and retrieve the study subject: $exception");
if (exception is SocketException) {
subject = await Cache.loadSubject();
StudyULogger.info("Offline mode with cached subject: $subject");
Expand Down
36 changes: 30 additions & 6 deletions app/lib/util/cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,37 @@ class Cache {
assert(subject == (await loadSubject()));
}

static Future<StudySubject> loadSubject() async {
static Future<StudySubject> loadSubject({StudySubject? backupSubject}) async {
// debugPrint("Load subject from cache");
if (await SecureStorage.containsKey(cacheSubjectKey)) {
return StudySubject.fromJson(
jsonDecode((await SecureStorage.read(cacheSubjectKey))!)
as Map<String, dynamic>,
);
final cachedSubjectStr = await SecureStorage.read(cacheSubjectKey);
final cachedSubject =
jsonDecode(cachedSubjectStr!) as Map<String, dynamic>;
try {
return StudySubject.fromJson(cachedSubject);
} catch (e) {
StudyULogger.warning(
"Failed to parse cached subject: $cachedSubjectStr",
);
if (backupSubject != null) {
// Only take progress from cached subject and rest from backup,
// as the cached subject might be outdated or corrupted

// compare IDs to make sure we are not mixing up subjects
// If IDs do not match we should not use the cached subject
if (backupSubject.id != cachedSubject['id']) {
throw Exception(
"Cached subject ID does not match remote subject ID",
);
}
final cachedProgress = (cachedSubject['progress'] as List?)
?.map((e) => SubjectProgress.fromJson(e as Map<String, dynamic>))
.toList();
backupSubject.progress = cachedProgress ?? backupSubject.progress;
return backupSubject;
}
throw Exception("No backup subject provided");
}
} else {
throw Exception("No cached subject found");
}
Expand Down Expand Up @@ -69,7 +93,7 @@ class Cache {
if (!(await SecureStorage.containsKey(cacheSubjectKey))) {
return remoteSubject;
}
final localSubject = await loadSubject();
final localSubject = await loadSubject(backupSubject: remoteSubject);
// local and remote subject are equal, nothing to synchronize
if (localSubject == remoteSubject) return remoteSubject;
// remote subject belongs to a different study
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@
"scale": "2x"
}
]
}
}
4 changes: 2 additions & 2 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1208,14 +1208,14 @@ packages:
path: "../core"
relative: true
source: path
version: "4.4.4"
version: "4.4.5"
studyu_flutter_common:
dependency: "direct main"
description:
path: "../flutter_common"
relative: true
source: path
version: "1.8.5"
version: "1.8.6"
supabase:
dependency: "direct main"
description:
Expand Down
6 changes: 3 additions & 3 deletions app/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: studyu_app
version: 2.7.7
version: 2.7.8
description: Partake in digital N-of-1 trials with the innovative StudyU Health App
publish_to: none
homepage: https://studyu.health
Expand Down Expand Up @@ -39,8 +39,8 @@ dependencies:
sentry_flutter: ^8.4.0
sentry_logging: ^8.4.0
shared_preferences: ^2.2.3
studyu_core: ^4.4.4
studyu_flutter_common: ^1.8.5
studyu_core: ^4.4.5
studyu_flutter_common: ^1.8.6
supabase: ^2.2.4
supabase_flutter: ^2.5.8
timeline_tile: ^2.0.0
Expand Down
2 changes: 1 addition & 1 deletion app/web/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
"purpose": "maskable"
}
]
}
}
4 changes: 4 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.4.5

- **FIX**: upgrade deps.

## 4.4.4

- **FIX**: upgrade deps.
Expand Down
2 changes: 1 addition & 1 deletion core/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: studyu_core
version: 4.4.4
version: 4.4.5
description: This package contains StudyU models and common functions for the app and designer packages
homepage: https://studyu.health
repository: https://github.com/hpi-studyu/studyu
Expand Down
2 changes: 1 addition & 1 deletion database/migration/20230630_migrate-v2_6.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ ALTER TABLE public.app_config
ADD COLUMN analytics jsonb;

ALTER TABLE public.study
DROP COLUMN fhir_questionnaire;
DROP COLUMN fhir_questionnaire;
Loading

0 comments on commit 2e67cc0

Please sign in to comment.