Skip to content

Commit

Permalink
Merge pull request #250 from RADAR-base/staging-app
Browse files Browse the repository at this point in the history
Release 0.5.10-alpha
  • Loading branch information
mpgxvii authored Jan 22, 2019
2 parents c67c205 + 74939fb commit c30922d
Show file tree
Hide file tree
Showing 29 changed files with 664 additions and 1,084 deletions.
188 changes: 93 additions & 95 deletions config.xml
Original file line number Diff line number Diff line change
@@ -1,97 +1,95 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="513" id="org.phidatalab.radar_armt" version="0.5.9-alpha"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>RADAR Questionnaire</name>
<description>An application that collects active data for research.</description>
<author email="[email protected]" href="http://radar-cns.org/">RADAR-CNS</author>
<content src="index.html" />
<access origin="*" />
<access origin="*" subdomains="true" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<icon src="resources/android/icon/drawable-xhdpi-icon.png" />
<preference name="DisallowOverscroll" value="true" />
<preference name="BackgroundColor" value="0xff6d9aa5" />
<preference name="Orientation" value="portrait" />
<platform name="android">
<allow-intent href="market:*" />
<preference name="android-minSdkVersion" value="21" />
<preference name="AndroidLaunchMode" value="singleTop" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenBackgroundColor" value="0xff6d9aa5" />
<preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value="1000" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="SplashScreenSpinnerColor" value="0xffffffff" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<allow-navigation href="*" />
<allow-navigation href="http://10.40.189.168:8101" />
<allow-navigation href="http://10.40.189.168:8100" />
<allow-navigation href="http://10.40.177.195:8101" />
<allow-navigation href="http://10.40.177.195:8100" />
<allow-navigation href="http://10.40.140.19:8100" />
<allow-navigation href="http://172.20.10.5:8100" />
<allow-navigation href="http://10.41.163.140:8100" />
<allow-navigation href="http://10.40.230.126:8100" />
<allow-navigation href="http://10.40.149.14:8100" />
<allow-navigation href="http://10.40.149.14:8101" />
<allow-navigation href="http://172.20.10.5:8101" />
<allow-navigation href="http://10.236.23.88:8100" />
<allow-navigation href="http://172.20.20.20:8100" />
<allow-navigation href="http://10.0.0.150:8100" />
<allow-navigation href="http://10.35.12.253:8100" />
<allow-navigation href="http://10.35.12.253:8101" />
<allow-navigation href="http://169.254.164.7:8100" />
<allow-navigation href="http://10.131.139.253:8101" />
<allow-navigation href="http://10.131.139.253:8100" />
<allow-navigation href="http://10.40.221.18:8101" />
<plugin name="cordova-android-support-gradle-release" spec="^1.4.2">
<variable name="ANDROID_SUPPORT_VERSION" value="27.+" />
</plugin>
<plugin name="cordova-plugin-android-permissions" spec="^0.11.0" />
<plugin name="cordova-plugin-camera" spec="^3.0.0" />
<plugin name="cordova-plugin-console" spec="^1.1.0" />
<plugin name="cordova-plugin-device" spec="^1.1.7" />
<plugin name="cordova-plugin-dialogs" spec="^1.3.4" />
<plugin name="cordova-plugin-media-capture" spec="^3.0.1" />
<plugin name="cordova-plugin-opensmile" spec="^2.0.3" />
<plugin name="cordova-plugin-splashscreen" spec="^4.1.0" />
<plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
<plugin name="cordova-plugin-vibration" spec="^2.1.6" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-sqlite-storage" spec="^2.3.1" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="phonegap-plugin-barcodescanner" spec="^7.0.2" />
<plugin name="cordova-plugin-local-notification" spec="^0.9.0-beta.3" />
<plugin name="cordova-plugin-app-version" spec="^0.1.9" />
<plugin name="cordova-plugin-fcm" spec="git+https://github.com/yatharthranjan/cordova-plugin-fcm.git" />
<plugin name="cordova-plugin-globalization" spec="^1.11.0" />
<engine name="android" spec="6.4.0" />
<widget android-versionCode="515" id="org.phidatalab.radar_armt" version="0.5.10-alpha" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>RADAR Questionnaire</name>
<description>An application that collects active data for research.</description>
<author email="[email protected]" href="http://radar-cns.org/">RADAR-CNS</author>
<content src="index.html" />
<access origin="*" />
<access origin="*" subdomains="true" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<icon src="resources/android/icon/drawable-xhdpi-icon.png" />
<preference name="DisallowOverscroll" value="true" />
<preference name="BackgroundColor" value="0xff6d9aa5" />
<preference name="Orientation" value="portrait" />
<platform name="android">
<allow-intent href="market:*" />
<preference name="android-minSdkVersion" value="21" />
<preference name="AndroidLaunchMode" value="singleTop" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenBackgroundColor" value="0xff6d9aa5" />
<preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value="1000" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="SplashScreenSpinnerColor" value="0xffffffff" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<allow-navigation href="*" />
<allow-navigation href="http://10.40.189.168:8101" />
<allow-navigation href="http://10.40.189.168:8100" />
<allow-navigation href="http://10.40.177.195:8101" />
<allow-navigation href="http://10.40.177.195:8100" />
<allow-navigation href="http://10.40.140.19:8100" />
<allow-navigation href="http://172.20.10.5:8100" />
<allow-navigation href="http://10.41.163.140:8100" />
<allow-navigation href="http://10.40.230.126:8100" />
<allow-navigation href="http://10.40.149.14:8100" />
<allow-navigation href="http://10.40.149.14:8101" />
<allow-navigation href="http://172.20.10.5:8101" />
<allow-navigation href="http://10.236.23.88:8100" />
<allow-navigation href="http://172.20.20.20:8100" />
<allow-navigation href="http://10.0.0.150:8100" />
<allow-navigation href="http://10.35.12.253:8100" />
<allow-navigation href="http://10.35.12.253:8101" />
<allow-navigation href="http://169.254.164.7:8100" />
<allow-navigation href="http://10.131.139.253:8101" />
<allow-navigation href="http://10.131.139.253:8100" />
<allow-navigation href="http://10.40.221.18:8101" />
<plugin name="cordova-android-support-gradle-release" spec="^1.4.2">
<variable name="ANDROID_SUPPORT_VERSION" value="27.+" />
</plugin>
<plugin name="cordova-plugin-android-permissions" spec="^0.11.0" />
<plugin name="cordova-plugin-camera" spec="^3.0.0" />
<plugin name="cordova-plugin-console" spec="^1.1.0" />
<plugin name="cordova-plugin-device" spec="^1.1.7" />
<plugin name="cordova-plugin-dialogs" spec="^1.3.4" />
<plugin name="cordova-plugin-media-capture" spec="^3.0.1" />
<plugin name="cordova-plugin-opensmile" spec="^2.0.3" />
<plugin name="cordova-plugin-splashscreen" spec="^4.1.0" />
<plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
<plugin name="cordova-plugin-vibration" spec="^2.1.6" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-sqlite-storage" spec="^2.3.1" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="phonegap-plugin-barcodescanner" spec="^7.0.2" />
<plugin name="cordova-plugin-local-notification" spec="^0.9.0-beta.3" />
<plugin name="cordova-plugin-app-version" spec="^0.1.9" />
<plugin name="cordova-plugin-fcm" spec="git+https://github.com/yatharthranjan/cordova-plugin-fcm.git" />
<plugin name="cordova-plugin-globalization" spec="^1.11.0" />
<engine name="android" spec="6.4.0" />
</widget>
2 changes: 1 addition & 1 deletion src/app/core/containers/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class AppComponent {
private notificationService: NotificationService
) {
this.platform.ready().then(() => {
this.statusBar.styleDefault()
this.statusBar.hide()
this.splashScreen.hide()
this.configService.fetchConfigState(false)
this.configService.migrateToLatestVersion()
Expand Down
32 changes: 14 additions & 18 deletions src/app/core/services/kafka.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,33 +220,29 @@ export class KafkaService {
if (!this.cacheSending) {
this.cacheSending = !this.cacheSending
this.sendToKafkaFromCache()
.then(() => (this.cacheSending = !this.cacheSending))
.catch(e => console.log('Cache could not be sent.'))
.then(() => (this.cacheSending = !this.cacheSending))
}
}

sendToKafkaFromCache() {
return this.storage.get(StorageKeys.CACHE_ANSWERS).then(cache => {
if (!cache) {
return this.storage.set(StorageKeys.CACHE_ANSWERS, {})
} else {
const promises = []
let noOfTasks = 0
for (const answerKey in cache) {
if (answerKey) {
const cacheObject = cache[answerKey]
promises.push(this.createPayloadAndSend(cacheObject))
noOfTasks += 1
if (noOfTasks === 20) {
break
}
const promises = []
let noOfTasks = 0
for (const answerKey in cache) {
if (answerKey) {
const cacheObject = cache[answerKey]
promises.push(this.createPayloadAndSend(cacheObject))
noOfTasks += 1
if (noOfTasks === 20) {
break
}
}
return Promise.all(promises).then(res => {
console.log(res)
return Promise.resolve(res)
})
}
return Promise.all(promises).then(res => {
console.log(res)
return Promise.resolve(res)
})
})
}

Expand Down
56 changes: 35 additions & 21 deletions src/app/core/services/notification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
DefaultNotificationType,
DefaultNumberOfNotificationsToRescue,
DefaultNumberOfNotificationsToSchedule,
DefaultTask,
DefaultTaskTest,
FCMPluginProjectSenderId
} from '../../../assets/data/defaultConfig'
import { LocKeys } from '../../shared/enums/localisations'
Expand Down Expand Up @@ -157,7 +157,7 @@ export class NotificationService {

testFCMNotifications() {
const TWO_MINUTES = 2 * 60000
const task = DefaultTask
const task = DefaultTaskTest
task.timestamp = new Date().getTime() + TWO_MINUTES
const fcmNotification = this.formatFCMNotification(
task,
Expand All @@ -167,25 +167,41 @@ export class NotificationService {
this.sendFCMNotification(fcmNotification)
}

formatNotificationMessage(task) {
let text = this.translate.transform(
LocKeys.NOTIFICATION_REMINDER_NOW_DESC_1.toString()
)
text += ' ' + task.estimatedCompletionTime + ' '
text += this.translate.transform(
LocKeys.NOTIFICATION_REMINDER_NOW_DESC_2.toString()
)
return text
formatNotifMessageAndTitle(task) {
if (task.name == 'TEST') {
return {
title: this.translate.transform(
LocKeys.NOTIFICATION_TEST_REMINDER_NOW.toString()
),
message: this.translate.transform(
LocKeys.NOTIFICATION_TEST_REMINDER_NOW_DESC.toString()
)
}
} else {
return {
title: this.translate.transform(
LocKeys.NOTIFICATION_REMINDER_NOW.toString()
),
message:
this.translate.transform(
LocKeys.NOTIFICATION_REMINDER_NOW_DESC_1.toString()
) +
' ' +
task.estimatedCompletionTime +
' ' +
this.translate.transform(
LocKeys.NOTIFICATION_REMINDER_NOW_DESC_2.toString()
)
}
}
}

formatLocalNotification(task, isLastScheduledNotification, isLastOfDay) {
const text = this.formatNotificationMessage(task)
const notif = this.formatNotifMessageAndTitle(task)
const notification = {
id: task.index,
title: this.translate.transform(
LocKeys.NOTIFICATION_REMINDER_NOW.toString()
),
text: text,
title: notif.title,
text: notif.message,
trigger: { at: new Date(task.timestamp) },
foreground: true,
vibrate: true,
Expand All @@ -200,15 +216,13 @@ export class NotificationService {
}

formatFCMNotification(task, participantLogin) {
const text = this.formatNotificationMessage(task)
const notif = this.formatNotifMessageAndTitle(task)
const expiry = task.name === 'ESM' ? 15 * 60 : 24 * 60 * 60
const fcmNotification = {
eventId: uuid(),
action: 'SCHEDULE',
notificationTitle: this.translate.transform(
LocKeys.NOTIFICATION_REMINDER_NOW.toString()
),
notificationMessage: text,
notificationTitle: notif.title,
notificationMessage: notif.message,
time: task.timestamp,
subjectId: participantLogin,
ttlSeconds: expiry
Expand Down
11 changes: 10 additions & 1 deletion src/app/core/services/storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ export class StorageService {
StorageKeys.SCHEDULE_VERSION,
DefaultScheduleVersion
)
const utc = this.set(
StorageKeys.UTC_OFFSET,
new Date().getTimezoneOffset()
)
const cache = this.set(StorageKeys.CACHE_ANSWERS, {})

return Promise.all([
pId,
Expand All @@ -84,7 +89,11 @@ export class StorageService {
notif,
report,
langs,
version
version,
utc,
cache,
enrolmentDate,
referenceDate
])
}
})
Expand Down
5 changes: 0 additions & 5 deletions src/app/pages/auth/containers/enrolment-page.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,4 @@ page-enrolment {
width: 320px;
border-bottom: 1px solid white;
}

.scroll-content {
margin-bottom: 0 !important;
padding-bottom: 0 !important;
}
}
Loading

0 comments on commit c30922d

Please sign in to comment.