Skip to content

Commit

Permalink
Merge branch 'develop' into ANDROAPP-5013-Align-app-buttons-to-new-ma…
Browse files Browse the repository at this point in the history
…terial-design
  • Loading branch information
DavidAparicioAlbaAsenjo authored Mar 19, 2024
2 parents 0f1b3e7 + 3215cc5 commit 7d2c0ff
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 17 deletions.
45 changes: 36 additions & 9 deletions .github/workflows/release-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ jobs:
git config user.name "GitHub Actions Bot"
git config user.email "<[email protected]>"
- name: Run Python script to update base branch version
run: python scripts/updateVersionName.py ${{ inputs.development_version_name }}

- name: Commit and Push Changes
run: |
git add .
git commit -m "Update version to ${{ inputs.development_version_name }}"
git push
# override vName with new version
- name: Create release branch
run: git checkout -b release/${{ inputs.release_version_name }}
Expand All @@ -60,3 +51,39 @@ jobs:
git add .
git commit -m "Update version to ${{ inputs.release_version_name }}"
git push origin release/${{ inputs.release_version_name }}
update_version:
# The type of runner that the job will run on
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12.1

- name: setup git config
run: |
# setup the username and email.
git config user.name "GitHub Actions Bot"
git config user.email "<[email protected]>"
- name: Create release branch
run: git checkout -b update_version_to${{ inputs.development_version_name }}

- name: Run Python script to update base branch version
run: python scripts/updateVersionName.py ${{ inputs.development_version_name }}

- name: Commit and Push Changes
run: |
git add .
git commit -m "Update version to ${{ inputs.development_version_name }}"
git push origin update_version_to${{ inputs.development_version_name }}
- name: create pull request
run: gh pr create -B develop -H update_version_to${{ inputs.development_version_name }} --title 'Merge update_version_to${{ inputs.development_version_name }} into develop' --body 'Created by Github action'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions app/src/androidTest/java/org/dhis2/usescases/BaseTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import org.dhis2.commons.idlingresource.SearchIdlingResourceSingleton
import org.dhis2.commons.prefs.Preference
import org.dhis2.form.ui.idling.FormCountingIdlingResource
import org.dhis2.usescases.eventsWithoutRegistration.EventIdlingResourceSingleton
import org.dhis2.usescases.eventsWithoutRegistration.eventDetails.ui.EventDetailIdlingResourceSingleton
import org.dhis2.usescases.programEventDetail.eventList.EventListIdlingResourceSingleton
import org.dhis2.usescases.teiDashboard.dashboardfragments.teidata.TeiDataIdlingResourceSingleton
import org.junit.After
Expand Down Expand Up @@ -86,6 +87,7 @@ open class BaseTest {
SearchIdlingResourceSingleton.countingIdlingResource,
TeiDataIdlingResourceSingleton.countingIdlingResource,
EventIdlingResourceSingleton.countingIdlingResource,
EventDetailIdlingResourceSingleton.countingIdlingResource,
)
}

Expand All @@ -98,6 +100,7 @@ open class BaseTest {
SearchIdlingResourceSingleton.countingIdlingResource,
TeiDataIdlingResourceSingleton.countingIdlingResource,
EventIdlingResourceSingleton.countingIdlingResource,
EventDetailIdlingResourceSingleton.countingIdlingResource,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import org.dhis2.commons.prefs.PreferenceProvider
import org.dhis2.commons.schedulers.SchedulerProvider
import org.dhis2.commons.schedulers.defaultSubscribe
import org.dhis2.ui.dialogs.bottomsheet.FieldWithIssue
import org.dhis2.usescases.eventsWithoutRegistration.EventIdlingResourceSingleton
import org.dhis2.usescases.eventsWithoutRegistration.eventCapture.EventCaptureContract.EventCaptureRepository
import org.dhis2.usescases.eventsWithoutRegistration.eventCapture.domain.ConfigureEventCompletionDialog
import org.dhis2.usescases.eventsWithoutRegistration.eventCapture.model.EventCaptureInitialInfo
Expand Down Expand Up @@ -181,17 +182,25 @@ class EventCapturePresenterImpl(

override fun deleteEvent() {
val programStage = programStage()
EventIdlingResourceSingleton.increment()
compositeDisposable.add(
eventCaptureRepository.deleteEvent()
.defaultSubscribe(
schedulerProvider,
{ result ->
onNext = { result ->
EventIdlingResourceSingleton.decrement()
if (result) {
view.showSnackBar(R.string.event_label_was_deleted, programStage)
}
},
Timber::e,
view::finishDataEntry,
onError = {
EventIdlingResourceSingleton.decrement()
Timber.e(it)
},
onComplete = {
EventIdlingResourceSingleton.decrement()
view.finishDataEntry()
},
),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ class EventDetailsViewModel(
return if (eventDate.allowFutureDates) {
SelectableDates(DEFAULT_MIN_DATE, DEFAULT_MAX_DATE)
} else {
val currentDate = SimpleDateFormat("ddMMyyyy", Locale.US).format(Date(System.currentTimeMillis()))
val currentDate =
SimpleDateFormat("ddMMyyyy", Locale.US).format(Date(System.currentTimeMillis()))
SelectableDates(DEFAULT_MIN_DATE, currentDate)
}
}
Expand Down Expand Up @@ -289,7 +290,7 @@ class EventDetailsViewModel(

fun onOrgUnitClick() {
if (!eventOrgUnit.value.fixed) {
if (eventOrgUnit.value.orgUnits.isNullOrEmpty()) {
if (eventOrgUnit.value.orgUnits.isEmpty()) {
showNoOrgUnits?.invoke()
} else {
showOrgUnits?.invoke()
Expand Down Expand Up @@ -387,16 +388,16 @@ inline fun <R, reified T> Result<T>.mockSafeFold(
if ((value as Result<*>).isSuccess) {
valueNotNull::class.java.getDeclaredField("value").let {
it.isAccessible = true
it.get(value) as T
it[value] as T
}.let(onSuccess)
} else {
valueNotNull::class.java.getDeclaredField("value").let {
it.isAccessible = true
it.get(value)
it[value]
}.let { failure ->
failure!!::class.java.getDeclaredField("exception").let {
it.isAccessible = true
it.get(failure) as Exception
it[failure] as Exception
}
}.let(onFailure)
}
Expand Down

0 comments on commit 7d2c0ff

Please sign in to comment.