Skip to content

Commit

Permalink
Merge pull request #161 from ProteGO-Safe/release/4.8.0
Browse files Browse the repository at this point in the history
Release/4.8.0
  • Loading branch information
qLb authored Nov 24, 2020
2 parents bbb5377 + 7e595c7 commit 9ea3b9e
Show file tree
Hide file tree
Showing 32 changed files with 285 additions and 55 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/dev_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
description: 'React Workflow run_id'
required: true
default: 'warning'
app_distribution_group:
description: 'App distribution group'
required: false
default: ''

jobs:
nightly:
Expand All @@ -18,6 +22,8 @@ jobs:
PROTEGO_KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }}
PROTEGO_KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
REACT_RUN_ID: ${{ github.event.inputs.react_run_id }}
APP_DISTRIBUTION_GROUP: ${{ github.event.inputs.app_distribution_group }}
APP_DISTRIBUTION_KEY_ENCRYPTED: ${{ secrets.APP_DISTRIBUTION_KEY_ENCRYPTED }}
REACT_TOKEN_SCRIPT: ${{ secrets.REACT_TOKEN_SCRIPT }}
PRIVATE_KEY: ${{ secrets.CI_PRIVATE_KEY }}
PUBLIC_KEY: ${{ secrets.CI_PUBLIC_KEY }}
Expand Down Expand Up @@ -63,7 +69,7 @@ jobs:

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 4)

- name: Setup Environment (Keystore)
run: |
Expand All @@ -83,9 +89,22 @@ jobs:
- name: Run Unit Tests
run: ./gradlew testProdReleaseUnitTest -PPROTEGO_KEYSTORE_DEBUG_FILE=$PROTEGO_KEYSTORE_FILE -PPROTEGO_KEYSTORE_DEBUG_PASSWORD=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_ALIAS=$PROTEGO_KEYSTORE_ALIAS

- name: Assemble Stage Debug with Screencast (Signed Stage Keystore)
- name: Assemble Stage Debug (Signed Stage Keystore)
if: github.event.inputs.app_distribution_group == ''
run: ./gradlew assembleStageDebug -Pandroid.injected.signing.store.file=$PROTEGO_KEYSTORE_FILE -Pandroid.injected.signing.store.password=$PROTEGO_KEYSTORE_PASSWORD -Pandroid.injected.signing.key.alias=$PROTEGO_KEYSTORE_ALIAS -Pandroid.injected.signing.key.password=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_FILE=$PROTEGO_KEYSTORE_FILE -PPROTEGO_KEYSTORE_DEBUG_PASSWORD=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_ALIAS=$PROTEGO_KEYSTORE_ALIAS

- name: Assemble Stage Debug and upload to App Distribution for specified group(Signed Stage Keystore)
if: github.event.inputs.app_distribution_group != ''
run: |
mkdir -p appdistribution
echo "${APP_DISTRIBUTION_KEY_ENCRYPTED}" | base64 --decode > appdistribution/app_distribution.json
echo "${APP_DISTRIBUTION_GROUP}" > appdistribution/groups_file.txt
echo "Stage Debug uploaded by CI
Android run_id=$GITHUB_RUN_ID
Android branch=${{ steps.get_version.outputs.VERSION }}
React run_id=${REACT_RUN_ID}" > appdistribution/release_notes.txt
./gradlew assembleStageDebug appDistributionUploadStageDebug -Pandroid.injected.signing.store.file=$PROTEGO_KEYSTORE_FILE -Pandroid.injected.signing.store.password=$PROTEGO_KEYSTORE_PASSWORD -Pandroid.injected.signing.key.alias=$PROTEGO_KEYSTORE_ALIAS -Pandroid.injected.signing.key.password=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_FILE=$PROTEGO_KEYSTORE_FILE -PPROTEGO_KEYSTORE_DEBUG_PASSWORD=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_ALIAS=$PROTEGO_KEYSTORE_ALIAS
- name: Assemble Stage Release (Signed Stage Keystore)
run: ./gradlew assembleStageRelease -Pandroid.injected.signing.store.file=$PROTEGO_KEYSTORE_FILE -Pandroid.injected.signing.store.password=$PROTEGO_KEYSTORE_PASSWORD -Pandroid.injected.signing.key.alias=$PROTEGO_KEYSTORE_ALIAS -Pandroid.injected.signing.key.password=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_FILE=$PROTEGO_KEYSTORE_FILE -PPROTEGO_KEYSTORE_DEBUG_PASSWORD=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_ALIAS=$PROTEGO_KEYSTORE_ALIAS

Expand All @@ -95,5 +114,5 @@ jobs:
- name: Upload APKs
uses: actions/upload-artifact@v2
with:
name: "${{ steps.get_version.outputs.VERSION }}_apks"
name: "${{ github.run_id }}_${{ steps.get_version.outputs.VERSION }}_apks"
path: app/build/outputs/apk/*
24 changes: 20 additions & 4 deletions .github/workflows/rc_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
PROTEGO_KEYSTORE_FILE: protegosafe-stage.jks
PROTEGO_KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }}
PROTEGO_KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
APP_DISTRIBUTION_KEY_ENCRYPTED: ${{ secrets.APP_DISTRIBUTION_KEY_ENCRYPTED }}
APP_DISTRIBUTION_GROUP: RC_TEST

steps:
- name: Clone Repository
Expand Down Expand Up @@ -46,11 +48,25 @@ jobs:
- name: Run Unit Tests
run: ./gradlew testProdReleaseUnitTest -PPROTEGO_KEYSTORE_DEBUG_FILE=$PROTEGO_KEYSTORE_FILE -PPROTEGO_KEYSTORE_DEBUG_PASSWORD=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_ALIAS=$PROTEGO_KEYSTORE_ALIAS

- name: Assemble Stage Debug (Signed Stage Keystore)
run: ./gradlew assembleStageDebug -Pandroid.injected.signing.store.file=$PROTEGO_KEYSTORE_FILE -Pandroid.injected.signing.store.password=$PROTEGO_KEYSTORE_PASSWORD -Pandroid.injected.signing.key.alias=$PROTEGO_KEYSTORE_ALIAS -Pandroid.injected.signing.key.password=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_FILE=$PROTEGO_KEYSTORE_FILE -PPROTEGO_KEYSTORE_DEBUG_PASSWORD=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_ALIAS=$PROTEGO_KEYSTORE_ALIAS
- name: Prepare App Distribution
run: |
mkdir -p appdistribution
echo "${APP_DISTRIBUTION_KEY_ENCRYPTED}" | base64 --decode > appdistribution/app_distribution.json
echo "${APP_DISTRIBUTION_GROUP}" > appdistribution/groups_file.txt
- name: Assemble Stage Debug and upload to App Distribution (Signed Stage Keystore)
run: |
echo "Release Candidate Stage Debug uploaded by CI
RC name=${GITHUB_REF#refs/tags/}
Android run_id=$GITHUB_RUN_ID" > appdistribution/release_notes.txt
./gradlew assembleStageDebug appDistributionUploadStageDebug -Pandroid.injected.signing.store.file=$PROTEGO_KEYSTORE_FILE -Pandroid.injected.signing.store.password=$PROTEGO_KEYSTORE_PASSWORD -Pandroid.injected.signing.key.alias=$PROTEGO_KEYSTORE_ALIAS -Pandroid.injected.signing.key.password=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_FILE=$PROTEGO_KEYSTORE_FILE -PPROTEGO_KEYSTORE_DEBUG_PASSWORD=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_ALIAS=$PROTEGO_KEYSTORE_ALIAS
- name: Assemble Stage Release (Signed Stage Keystore)
run: ./gradlew assembleStageRelease -Pandroid.injected.signing.store.file=$PROTEGO_KEYSTORE_FILE -Pandroid.injected.signing.store.password=$PROTEGO_KEYSTORE_PASSWORD -Pandroid.injected.signing.key.alias=$PROTEGO_KEYSTORE_ALIAS -Pandroid.injected.signing.key.password=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_FILE=$PROTEGO_KEYSTORE_FILE -PPROTEGO_KEYSTORE_DEBUG_PASSWORD=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_ALIAS=$PROTEGO_KEYSTORE_ALIAS
- name: Assemble Stage Release and upload to App Distribution (Signed Stage Keystore)
run: |
echo "Release Candidate Stage Release uploaded by CI
RC name=${GITHUB_REF#refs/tags/}
Android run_id=$GITHUB_RUN_ID" > appdistribution/release_notes.txt
./gradlew assembleStageRelease appDistributionUploadStageRelease -Pandroid.injected.signing.store.file=$PROTEGO_KEYSTORE_FILE -Pandroid.injected.signing.store.password=$PROTEGO_KEYSTORE_PASSWORD -Pandroid.injected.signing.key.alias=$PROTEGO_KEYSTORE_ALIAS -Pandroid.injected.signing.key.password=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_FILE=$PROTEGO_KEYSTORE_FILE -PPROTEGO_KEYSTORE_DEBUG_PASSWORD=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_ALIAS=$PROTEGO_KEYSTORE_ALIAS
- name: Assemble Stage SauceLab (Signed Stage Keystore)
run: ./gradlew assembleStageSauceLab -Pandroid.injected.signing.store.file=$PROTEGO_KEYSTORE_FILE -Pandroid.injected.signing.store.password=$PROTEGO_KEYSTORE_PASSWORD -Pandroid.injected.signing.key.alias=$PROTEGO_KEYSTORE_ALIAS -Pandroid.injected.signing.key.password=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_FILE=$PROTEGO_KEYSTORE_FILE -PPROTEGO_KEYSTORE_DEBUG_PASSWORD=$PROTEGO_KEYSTORE_PASSWORD -PPROTEGO_KEYSTORE_DEBUG_ALIAS=$PROTEGO_KEYSTORE_ALIAS
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ Dev: ./app/src/dev/google-services.json

## ChangeLog

4.8.0

Possibility to share Temporary Exposure Keys with other countries

Updated UI

4.7.1

Fixed back button handling
Expand Down
14 changes: 9 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apply plugin: 'androidx.navigation.safeargs.kotlin'
apply plugin: 'com.google.firebase.crashlytics'
apply from: '../ktlint.gradle'
apply from: '../unzipUI.gradle'
apply plugin: 'com.google.firebase.appdistribution'

android {
signingConfigs {
Expand All @@ -27,14 +28,12 @@ android {
applicationId "pl.gov.mc.protegosafe"
minSdkVersion 21
targetSdkVersion 29
versionCode 76
versionName "4.7.1"
versionCode 77
versionName "4.8.0"

setProperty("archivesBaseName", "protegosafe-${defaultConfig.versionName}-${defaultConfig.versionCode}")

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

buildConfigField "boolean", "ENABLE_WEBVIEW_LOGS", "false"
}

compileOptions {
Expand All @@ -53,7 +52,6 @@ android {
debug {
versionNameSuffix ".debug"
signingConfig signingConfigs.debug
buildConfigField "boolean", "ENABLE_WEBVIEW_LOGS", "false"
}
sauceLab {
initWith buildTypes.release
Expand All @@ -74,6 +72,12 @@ android {
applicationIdSuffix ".stage"
versionNameSuffix '-STAGE'
manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]

firebaseAppDistribution {
serviceCredentialsFile="./appdistribution/app_distribution.json"
releaseNotesFile="./appdistribution/release_notes.txt"
groupsFile="./appdistribution/groups_file.txt"
}
}
prod {
dimension "mode"
Expand Down
16 changes: 0 additions & 16 deletions app/src/main/java/pl/gov/mc/protegosafe/logging/NoLoggingTree.kt

This file was deleted.

23 changes: 23 additions & 0 deletions app/src/main/java/pl/gov/mc/protegosafe/logging/WebViewTimber.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package pl.gov.mc.protegosafe.logging

import org.koin.core.KoinComponent
import org.koin.core.inject
import pl.gov.mc.protegosafe.data.db.WebViewLoggingDataStore
import timber.log.Timber

object WebViewTimber : Timber.Tree(), KoinComponent {
private val webViewLoggingDataStore: WebViewLoggingDataStore by inject()

override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
if (webViewLoggingDataStore.isLoggingEnabled) {
when {
t != null -> {
Timber.e(t, message)
}
else -> {
Timber.d(message)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import pl.gov.mc.protegosafe.domain.model.ActivityResult
import pl.gov.mc.protegosafe.domain.model.AppLifecycleState
import pl.gov.mc.protegosafe.domain.model.ExposureNotificationActionNotResolvedException
import pl.gov.mc.protegosafe.domain.usecase.GetMigrationUrlUseCase
import pl.gov.mc.protegosafe.logging.webViewTimber
import pl.gov.mc.protegosafe.logging.WebViewTimber
import pl.gov.mc.protegosafe.ui.common.BaseFragment
import pl.gov.mc.protegosafe.ui.common.livedata.observe
import timber.log.Timber
Expand Down Expand Up @@ -155,7 +155,7 @@ class HomeFragment : BaseFragment() {
if (BuildConfig.DEBUG) {
webChromeClient = object : WebChromeClient() {
override fun onConsoleMessage(consoleMessage: ConsoleMessage): Boolean {
webViewTimber().d("webView console ${consoleMessage.message()}")
WebViewTimber.d("webView console ${consoleMessage.message()}")
return true
}
}
Expand Down Expand Up @@ -215,14 +215,14 @@ class HomeFragment : BaseFragment() {
}

private fun runJavascript(script: String) {
webViewTimber().d("run javascript: $script")
WebViewTimber.d("run javascript: $script")
binding.webView.evaluateJavascript(script, null)
}

private fun requestExposureNotificationPermission(
exception: ExposureNotificationActionNotResolvedException
) {
webViewTimber()
WebViewTimber
.d("Request exposure notification permission: ${exception.resolutionRequest}")
when (val apiException = exception.apiException) {
is ApiException -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import pl.gov.mc.protegosafe.domain.usecase.StartExposureNotificationUseCase
import pl.gov.mc.protegosafe.domain.usecase.StorePendingActivityResultUseCase
import pl.gov.mc.protegosafe.domain.usecase.UploadTemporaryExposureKeysWithCachedPayloadUseCase
import pl.gov.mc.protegosafe.domain.usecase.covidtest.UpdateTestSubscriptionStatusUseCase
import pl.gov.mc.protegosafe.logging.webViewTimber
import pl.gov.mc.protegosafe.logging.WebViewTimber
import pl.gov.mc.protegosafe.ui.common.BaseViewModel
import pl.gov.mc.protegosafe.ui.common.livedata.SingleLiveEvent
import timber.log.Timber
Expand Down Expand Up @@ -110,7 +110,7 @@ class HomeViewModel(
)
.subscribe(
{
webViewTimber().d("getBridgeData: $dataType output: $it")
WebViewTimber.d("getBridgeData: $dataType output: $it")
bridgeDataResponse(it, dataType, requestId)
},
{
Expand Down Expand Up @@ -332,13 +332,13 @@ class HomeViewModel(

private fun bridgeDataResponse(body: String, dataType: Int, requestId: String) {
val codeToExecute = "bridgeDataResponse('$body', $dataType, '$requestId')"
webViewTimber().d("run Javascript: -$codeToExecute-")
WebViewTimber.d("run Javascript: -$codeToExecute-")
_javascriptCode.postValue(codeToExecute)
}

private fun onBridgeData(dataType: Int, dataJson: String) {
val codeToExecute = "onBridgeData($dataType, '$dataJson')"
webViewTimber().d("run Javascript: -$codeToExecute-")
WebViewTimber.d("run Javascript: -$codeToExecute-")
_javascriptCode.postValue(codeToExecute)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package pl.gov.mc.protegosafe.ui.home

import android.webkit.JavascriptInterface
import pl.gov.mc.protegosafe.logging.webViewTimber
import pl.gov.mc.protegosafe.logging.WebViewTimber

class NativeBridgeInterface(
private val setBridgeDataCallback: ((dataType: Int, data: String) -> Unit),
Expand All @@ -10,19 +10,19 @@ class NativeBridgeInterface(

@JavascriptInterface
fun setBridgeData(dataType: Int, data: String) {
webViewTimber().d("setBridgeData: $dataType - $data")
WebViewTimber.d("setBridgeData: $dataType - $data")
setBridgeDataCallback(dataType, data)
}

@JavascriptInterface
fun setBridgeData(dataType: Int) {
webViewTimber().d("setBridgeData: $dataType")
WebViewTimber.d("setBridgeData: $dataType")
setBridgeDataCallback(dataType, "")
}

@JavascriptInterface
fun getBridgeData(dataType: Int, data: String, requestId: String) {
webViewTimber().d("getBridgeData called: $dataType")
WebViewTimber.d("getBridgeData called: $dataType")
getBridgeDataCallback(dataType, data, requestId)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ package pl.gov.mc.protegosafe.di

import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.dsl.module
import pl.gov.mc.protegosafe.helpers.GetWebViewLoggingStatusUseCase
import pl.gov.mc.protegosafe.helpers.SetRiskHelperUseCase
import pl.gov.mc.protegosafe.helpers.SetWebViewLoggingEnabledUseCase
import pl.gov.mc.protegosafe.helpers.SetWorkersIntervalUseCase
import pl.gov.mc.protegosafe.ui.TestHelpersViewModel

val helpers = module {
factory { SetRiskHelperUseCase(get(), get(), get()) }
viewModel { TestHelpersViewModel(get(), get()) }
viewModel { TestHelpersViewModel(get(), get(), get(), get()) }
factory { SetWorkersIntervalUseCase(get(), get(), get()) }
factory { SetWebViewLoggingEnabledUseCase(get(), get()) }
factory { GetWebViewLoggingStatusUseCase(get(), get()) }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package pl.gov.mc.protegosafe.helpers

import io.reactivex.Single
import io.reactivex.schedulers.Schedulers
import pl.gov.mc.protegosafe.data.db.WebViewLoggingDataStore
import pl.gov.mc.protegosafe.domain.executor.PostExecutionThread

class GetWebViewLoggingStatusUseCase(
private val webViewLoggingDataStore: WebViewLoggingDataStore,
private val postExecutionThread: PostExecutionThread
) {
fun execute(): Single<Boolean> {
return Single.fromCallable {
webViewLoggingDataStore.isLoggingEnabled
}
.subscribeOn(Schedulers.io())
.observeOn(postExecutionThread.scheduler)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package pl.gov.mc.protegosafe.helpers

import io.reactivex.Completable
import io.reactivex.Single
import io.reactivex.schedulers.Schedulers
import pl.gov.mc.protegosafe.data.db.WebViewLoggingDataStore
import pl.gov.mc.protegosafe.domain.executor.PostExecutionThread

class SetWebViewLoggingEnabledUseCase(
private val webViewLoggingDataStore: WebViewLoggingDataStore,
private val postExecutionThread: PostExecutionThread
) {
fun execute(isEnabled: Boolean): Single<String> {
return Completable.fromAction {
webViewLoggingDataStore.isLoggingEnabled = isEnabled
}.toSingle {
if (isEnabled) {
"Web view logging enabled"
} else {
"Web view logging disabled"
}
}
.subscribeOn(Schedulers.io())
.observeOn(postExecutionThread.scheduler)
}
}
Loading

0 comments on commit 9ea3b9e

Please sign in to comment.