Skip to content

Commit

Permalink
Merge pull request #912 from RADAR-base/release-0.7.3
Browse files Browse the repository at this point in the history
Release 0.7.3
  • Loading branch information
mpgxvii authored Jan 13, 2020
2 parents 5422e29 + d277e76 commit c2bdce5
Show file tree
Hide file tree
Showing 28 changed files with 341 additions and 308 deletions.
2 changes: 2 additions & 0 deletions .bettercodehub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
exclude:
- src/assets
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,8 @@ Certain values can be overriden using Firebase Remote Config. Specifically, the
| `protocol_base_url` | Base URL where the protocol definitions are located. | <https://api.github.com/repos/RADAR-base/RADAR-aRMT-protocols/contents> |
| `protocol_branch` | Github branch where the protocol definitions should be read from | `master` |
| `protocol_path` | Path inside a project name that should be read for a protocol | `protocol.json` |
| `kafka_specification_url` | URL of the Kafka topic specification | <https://api.github.com/repos/RADAR-base/radar-schemas/contents/specifications/active/aRMT_1.4.3.yml?ref=master> |
| `kafka_specification_url` | URL of the Kafka topic specification | <https://api.github.com/repos/RADAR-base/radar-schemas/contents/specifications/active/aRMT-1.4.3.yml?ref=master> |
| `platform_instance` | Title of RADAR Base / platform instance | `RADAR-CNS` |
| `questions_hidden` | Specify certain questions of questionnaires to hide. Conditions may be added as well (see below). Example: `{“ESM”: “1,2,3”}` | `{}` |

#### Conditions

Conditions can be added to remote config variables to target specific groups of users. Different condition rule types are supported: app, platform, country/region, user property, date/time, and random percentile. For example a `protocol_branch` config value can be different based on the user property `projectId`.
Expand Down
4 changes: 2 additions & 2 deletions config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="540" id="org.phidatalab.radar_armt" ios-CFBundleIdentifier="org.phidatalab.radar-armt" ios-CFBundleVersion="4" version="0.7.3-alpha" xmlns:android="http://schemas.android.com/apk/res/android">
<widget android-versionCode="541" id="org.phidatalab.radar_armt" ios-CFBundleIdentifier="org.phidatalab.radar-armt" ios-CFBundleVersion="5" version="0.7.3" xmlns:android="http://schemas.android.com/apk/res/android">
<name>RADAR Questionnaire</name>
<description>An application that collects active data for research.</description>
<author email="radar-base@kcl.ac.uk" href="http://radar-base.org/">RADAR-Base</author>
Expand Down Expand Up @@ -141,7 +141,7 @@
<plugin name="cordova-plugin-androidx" spec="^1.0.2" />
<plugin name="cordova-plugin-androidx-adapter" spec="^1.1.0" />
<plugin name="cordova-plugin-background-mode-fixes" spec="^0.7.6" />
<plugin name="com-darryncampbell-cordova-plugin-intent" spec="^1.1.4" />
<plugin name="com-darryncampbell-cordova-plugin-intent" spec="^2.0.0" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.2.0" />
<plugin name="cordova-custom-config" spec="^5.1.0" />
<plugin name="cordova-plugin-ionic-webview" spec="^4.1.3" />
Expand Down
52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,31 @@
"@angular/forms": "^7.2.13",
"@angular/router": "^7.2.13",
"@auth0/angular-jwt": "^3.0.0",
"@ionic-native/android-permissions": "^5.17.0",
"@ionic-native/app-version": "^5.17.0",
"@ionic-native/background-mode": "^5.17.0",
"@ionic-native/barcode-scanner": "^5.17.0",
"@ionic-native/core": "^5.17.0",
"@ionic-native/device": "^5.17.0",
"@ionic-native/dialogs": "^5.17.0",
"@ionic-native/file": "^5.17.0",
"@ionic-native/firebase": "^5.17.0",
"@ionic-native/globalization": "^5.17.0",
"@ionic-native/insomnia": "^5.17.0",
"@ionic-native/keyboard": "^5.17.0",
"@ionic-native/local-notifications": "^5.17.0",
"@ionic-native/mobile-accessibility": "5.17.0",
"@ionic-native/splash-screen": "^5.17.0",
"@ionic-native/status-bar": "^5.17.0",
"@ionic-native/vibration": "^5.17.0",
"@ionic-native/web-intent": "^5.17.0",
"@ionic-native/android-permissions": "^5.19.1",
"@ionic-native/app-version": "^5.19.1",
"@ionic-native/background-mode": "^5.17.1",
"@ionic-native/barcode-scanner": "^5.17.1",
"@ionic-native/core": "^5.17.1",
"@ionic-native/device": "^5.17.1",
"@ionic-native/dialogs": "^5.17.1",
"@ionic-native/file": "^5.17.1",
"@ionic-native/firebase": "^5.19.1",
"@ionic-native/globalization": "^5.19.1",
"@ionic-native/insomnia": "^5.19.1",
"@ionic-native/keyboard": "^5.17.1",
"@ionic-native/local-notifications": "^5.17.1",
"@ionic-native/mobile-accessibility": "5.19.1",
"@ionic-native/splash-screen": "^5.19.1",
"@ionic-native/status-bar": "^5.17.1",
"@ionic-native/vibration": "^5.17.1",
"@ionic-native/web-intent": "^5.19.1",
"@ionic/storage": "^2.2.0",
"angular-svg-round-progressbar": "^3.0.1",
"autoprefixer": "^9.7.1",
"autoprefixer": "^9.7.2",
"avsc": "^5.4.16",
"base64-js": "^1.3.1",
"browserify": "^16.3.0",
"com-darryncampbell-cordova-plugin-intent": "^1.1.4",
"com-darryncampbell-cordova-plugin-intent": "^2.0.0",
"cordova-android": "^8.1.0",
"cordova-android-support-gradle-release": "^3.0.1",
"cordova-custom-config": "^5.1.0",
Expand Down Expand Up @@ -126,17 +126,17 @@
"@angular/platform-browser-dynamic": "^7.2.13",
"@angular/platform-server": "^7.2.13",
"@ionic/app-scripts": "^3.2.4",
"@types/jasmine": "^3.4.4",
"@types/jasmine": "^3.5.0",
"@types/jasminewd2": "^2.0.8",
"@types/node": "^12.7.8",
"@types/node": "^12.12.14",
"codelyzer": "^5.1.2",
"eslint": "^6.5.1",
"eslint": "^6.7.1",
"eslint-scope": "^5.0.0",
"import-sort-cli": "^6.0.0",
"import-sort-parser-babylon": "^6.0.0",
"import-sort-parser-typescript": "^6.0.0",
"import-sort-style-module": "^6.0.0",
"ionic": "^5.4.5",
"ionic": "^5.4.9",
"jasmine": "^3.5.0",
"jasmine-core": "^3.5.0",
"jasmine-spec-reporter": "^4.2.1",
Expand All @@ -145,7 +145,7 @@
"karma-browserstack-launcher": "^1.5.1",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-coverage-istanbul-reporter": "^2.1.0",
"karma-coverage-istanbul-reporter": "^2.1.1",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"karma-requirejs": "^1.1.0",
Expand All @@ -154,7 +154,7 @@
"karma-spec-reporter": "^0.0.32",
"karma-webpack": "^4.0.2",
"node-sass": "^4.12.0",
"postcss": "^7.0.18",
"postcss": "^7.0.23",
"postcss-cli": "^6.1.3",
"postcss-scss": "^2.0.0",
"postcss-sorting": "^5.0.1",
Expand Down
3 changes: 2 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ import { Utility } from './shared/utilities/util'
BrowserModule,
BrowserAnimationsModule,
IonicModule.forRoot(AppComponent, {
mode: 'md'
mode: 'md',
activator: 'none'
}),
IonicStorageModule.forRoot({
name: '__appdb',
Expand Down
4 changes: 0 additions & 4 deletions src/app/core/containers/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ body {
}
}

.button-effect {
display: none !important;
}

// Fonts
h1 {
@include font-title;
Expand Down
7 changes: 5 additions & 2 deletions src/app/core/services/config/config.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {
ProtocolServiceMock,
QuestionnaireServiceMock,
ScheduleServiceMock,
SubjectConfigServiceMock
SubjectConfigServiceMock,
RemoteConfigServiceMock
} from '../../../shared/testing/mock-services'
import { KafkaService } from '../kafka/kafka.service'
import { LocalizationService } from '../misc/localization.service'
Expand All @@ -26,6 +27,7 @@ import { ConfigService } from './config.service'
import { ProtocolService } from './protocol.service'
import { QuestionnaireService } from './questionnaire.service'
import { SubjectConfigService } from './subject-config.service'
import { RemoteConfigService } from './remote-config.service';

describe('ConfigService', () => {
let service
Expand All @@ -49,7 +51,8 @@ describe('ConfigService', () => {
{ provide: LogService, useClass: LogServiceMock },
HttpClient,
HttpHandler,
{ provide: Platform, useClass: PlatformMock }
{ provide: Platform, useClass: PlatformMock },
{ provide: RemoteConfigService, useClass: RemoteConfigServiceMock },
]
})
)
Expand Down
37 changes: 14 additions & 23 deletions src/app/core/services/config/config.service.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import { HttpClient } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { Platform } from 'ionic-angular'
import * as ver from 'semver'

import {
DefaultAppId,
DefaultAppVersion,
DefaultAppleAppStoreAppURL,
DefaultGooglePlaystoreAppURL,
DefaultNotificationRefreshTime,
DefaultPackageName
DefaultNotificationRefreshTime
} from '../../../../assets/data/defaultConfig'
import { ConfigKeys } from '../../../shared/enums/config'
import {
ConfigEventType,
NotificationEventType
} from '../../../shared/enums/events'
import { User } from '../../../shared/models/user'
import { parseVersion } from '../../../shared/utilities/parse-version'
import { TaskType } from '../../../shared/utilities/task-type'
import { KafkaService } from '../kafka/kafka.service'
import { LocalizationService } from '../misc/localization.service'
Expand All @@ -27,6 +22,7 @@ import { AnalyticsService } from '../usage/analytics.service'
import { AppConfigService } from './app-config.service'
import { ProtocolService } from './protocol.service'
import { QuestionnaireService } from './questionnaire.service'
import { RemoteConfigService } from './remote-config.service'
import { SubjectConfigService } from './subject-config.service'

@Injectable()
Expand All @@ -42,8 +38,7 @@ export class ConfigService {
private localization: LocalizationService,
private analytics: AnalyticsService,
private logger: LogService,
private http: HttpClient,
private platform: Platform
private remoteConfig: RemoteConfigService
) {}

fetchConfigState(force?: boolean) {
Expand All @@ -58,7 +53,6 @@ export class ConfigService {
this.subjectConfig
.getEnrolmentDate()
.then(d => this.appConfig.init(d))
this.checkForAppUpdates()
if (newProtocol)
return this.updateConfigStateOnProtocolChange(newProtocol)
if (newAppVersion)
Expand Down Expand Up @@ -145,21 +139,18 @@ export class ConfigService {
}

checkForAppUpdates() {
const playstoreURL = this.platform.is('ios')
? DefaultAppleAppStoreAppURL + DefaultAppId
: DefaultGooglePlaystoreAppURL + DefaultPackageName
return Promise.all([
this.http
.get(playstoreURL, { responseType: 'text' })
.toPromise()
.then(res => parseVersion(res))
.catch(e => DefaultAppVersion),
this.remoteConfig
.read()
.then(config =>
config.getOrDefault(ConfigKeys.APP_VERSION_LATEST, DefaultAppVersion)
),
this.appConfig.getAppVersion()
]).then(([playstoreVersion, currentVersion]) => {
if (ver.gt(playstoreVersion, currentVersion))
throw new Error(ConfigEventType.APP_UPDATE_AVAILABLE)
return
})
])
.then(([playstoreVersion, currentVersion]) =>
ver.gt(ver.clean(playstoreVersion), ver.clean(currentVersion))
)
.catch(() => false)
}

checkParticipantEnrolled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ion-scroll
scrollY="true"
class="layers"
[style.height.%]="show? 75 : 0"
[style.height.vh]="show? 100 : 0"
>

<ng-container *ngIf="(tasks)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const TaskInfoAnimations = [
transition('* => *', animate('350ms ease'))
]),
trigger('moveHour', [
state('false', style({ transform: 'translate3d(90%, 0, 0)' })),
state('false', style({ transform: 'translate3d(105%, 0, 0)' })),
transition('* => *', animate('350ms ease'))
]),
trigger('alignCenterRightExtraInfo', [
Expand Down
52 changes: 30 additions & 22 deletions src/app/pages/home/components/ticker-bar/ticker-bar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export class TickerBarComponent implements OnChanges {
showAffirmation = false
@Input()
noTasksToday = false
@Input()
timeToNextMilli: number
tickerText: string
report: ReportScheduling

Expand Down Expand Up @@ -62,7 +64,7 @@ export class TickerBarComponent implements OnChanges {
this.tickerText =
this.localization.translateKey(LocKeys.TASK_BAR_NEXT_TASK) +
'<b>' +
this.getTimeToNext(this.task.timestamp) +
this.getTimeToNextString() +
'.</b>'
}
}
Expand Down Expand Up @@ -92,26 +94,32 @@ export class TickerBarComponent implements OnChanges {
this.localization.translateKey(LocKeys.TASK_BAR_NO_TASK_2)
}

getTimeToNext(next) {
const now = new Date().getTime()
let deltaStr = ''
const deltaMin = Math.round(getMinutes({ milliseconds: next - now }))
const deltaHour = Math.round(getHours({ minutes: deltaMin }))
if (deltaMin > 59) {
deltaStr =
String(deltaHour) +
' ' +
(deltaHour > 1
? this.localization.translateKey(LocKeys.TASK_TIME_HOUR_MULTIPLE)
: this.localization.translateKey(LocKeys.TASK_TIME_HOUR_SINGLE))
} else {
deltaStr =
String(deltaMin) +
' ' +
(deltaMin > 1
? this.localization.translateKey(LocKeys.TASK_TIME_MINUTE_MULTIPLE)
: this.localization.translateKey(LocKeys.TASK_TIME_MINUTE_SINGLE))
}
return deltaStr
getTimeToNextString() {
const minutes = Math.round(
getMinutes({ milliseconds: this.timeToNextMilli })
)
if (minutes > 59) return this.getHoursToNextString(minutes)
else return this.getMinutesToNextString(minutes)
}

getHoursToNextString(minutes) {
const hour = Math.round(getHours({ minutes: minutes }))
return (
String(hour) +
' ' +
(hour > 1
? this.localization.translateKey(LocKeys.TASK_TIME_HOUR_MULTIPLE)
: this.localization.translateKey(LocKeys.TASK_TIME_HOUR_SINGLE))
)
}

getMinutesToNextString(minutes) {
return (
String(minutes) +
' ' +
(minutes > 1
? this.localization.translateKey(LocKeys.TASK_TIME_MINUTE_MULTIPLE)
: this.localization.translateKey(LocKeys.TASK_TIME_MINUTE_SINGLE))
)
}
}
3 changes: 2 additions & 1 deletion src/app/pages/home/containers/home-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<ticker-bar
[task]="nextTask"
[isNow]="taskIsNow"
[timeToNextMilli]="timeToNextTask"
[showAffirmation]="showCompleted"
[noTasksToday]="(tasksProgress | async)?.numberOfTasks == 0"
></ticker-bar>
Expand All @@ -57,7 +58,7 @@
></task-info>
</div>

<div #taskCalendar [@displayCalendar]="showCalendar">
<div #taskCalendar class="taskCalendar" [@displayCalendar]="showCalendar">
<task-calendar
*ngIf="(sortedTasks | async)?.size"
[show]="showCalendar"
Expand Down
5 changes: 5 additions & 0 deletions src/app/pages/home/containers/home-page.component.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
page-home {
.scroll-content {
overflow: hidden;
display: flex;
flex-flow: column;
}
Expand Down Expand Up @@ -92,4 +93,8 @@ page-home {
.hidden {
display: none;
}

.taskCalendar {
overflow: auto !important;
}
}
2 changes: 2 additions & 0 deletions src/app/pages/home/containers/home-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class HomePageComponent implements OnDestroy {
tasks: Promise<Task[]>
currentDate: Date
nextTask: Task
timeToNextTask: number
tasksProgress: Promise<TasksProgress>
resumeListener: Subscription = new Subscription()

Expand Down Expand Up @@ -109,6 +110,7 @@ export class HomePageComponent implements OnDestroy {
if (task) {
this.nextTask = task
this.taskIsNow = checkTaskIsNow(this.nextTask.timestamp)
this.timeToNextTask = this.nextTask.timestamp - Date.now()
} else {
this.taskIsNow = false
this.nextTask = null
Expand Down
Loading

0 comments on commit c2bdce5

Please sign in to comment.