Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7 migration from bitucket #22

Merged
merged 3 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/test_app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test the App

on:
push:
branches:
- '**'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v2
with:
# Number of commits to fetch. 0 indicates all history for all branches and tags.
fetch-depth: 0

- name: Setup JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'

- name: Setup Android SDK
uses: android-actions/setup-android@v2

- name: Restore gradle.properties
env:
GRADLE_PROPERTIES: ${{ secrets.GRADLE_PROPERTIES }}
shell: bash
run: |
mkdir -p ~/.gradle/
echo "GRADLE_USER_HOME=${HOME}/.gradle" >> $GITHUB_ENV
echo "${GRADLE_PROPERTIES}" > ~/.gradle/gradle.properties

# Cache Gradle dependencies and Gradle Wrapper
- name: Setup Gradle Cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}

- name: Make gradlew executable
run: chmod +x ./gradlew

- name: Run Test
run: ./gradlew check
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ open class StorageHelper(val context: Context) {
fun loadAll(): MutableList<Route> {
val dir = getRoutesDir()
return dir.listFiles()
.filter { it.name.toLowerCase().endsWith(".xml") }
.filter { it.name.lowercase().endsWith(".xml") }
.mapNotNull {
try {
xmlHelper.loadRouteFromFile(it)
Expand Down
21 changes: 0 additions & 21 deletions bitbucket-pipelines.yml

This file was deleted.

42 changes: 0 additions & 42 deletions docs/activities_flow.mmd

This file was deleted.

145 changes: 141 additions & 4 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


# Development environment configuration

To ~/.gradle/gradle.properties add:
Expand All @@ -12,7 +14,50 @@ When using gradle directly the token can be delivered as a parameter: `-PMAPBOX_

# Activities flow

[State machine](activities_flow.mmd)
```mermaid
stateDiagram-v2
[*] --> MainActivity
MainActivity --> TreasuresEditorActivity : create new route\n OR\n edit existing route
TreasuresEditorActivity --> MainActivity
MainActivity --> BluetoothActivity : send route\n OR\n receive route
BluetoothActivity --> MainActivity
MainActivity --> SearchingActivity : select route\n for searching
SearchingActivity --> MainActivity
SearchingActivity --> TreasureSelectorActivity : select treasure\n for searching
TreasureSelectorActivity --> SearchingActivity
SearchingActivity --> PhotoActivity : show photo hint
PhotoActivity --> SearchingActivity
SearchingActivity --> ResultActivity : show treasure
ResultActivity --> SearchingActivity
SearchingActivity --> QrScanIntent : scan found treasure
QrScanIntent --> SearchingActivity
TreasuresEditorActivity --> CapturePhotoIntent : make photo\n with a hint
CapturePhotoIntent --> TreasuresEditorActivity
SearchingActivity --> MapActivity : show map
MapActivity --> SearchingActivity

MainActivity --> FacebookActivity
FacebookActivity --> MainActivity
TreasuresEditorActivity --> FacebookActivity
FacebookActivity --> TreasuresEditorActivity
BluetoothActivity --> FacebookActivity
FacebookActivity --> BluetoothActivity
SearchingActivity --> FacebookActivity
FacebookActivity --> SearchingActivity
TreasureSelectorActivity --> FacebookActivity
FacebookActivity --> TreasureSelectorActivity
PhotoActivity --> FacebookActivity
FacebookActivity --> PhotoActivity
ResultActivity --> FacebookActivity
FacebookActivity --> ResultActivity
TreasuresEditorActivity --> FacebookActivity
FacebookActivity --> TreasuresEditorActivity
MapActivity --> FacebookActivity
FacebookActivity --> MapActivity

note right of QrScanIntent: INTENT
note right of CapturePhotoIntent: INTENT
```

# Persistence management

Expand All @@ -36,15 +81,107 @@ There are three levels of state persistence.

## Structure

[Class diagram](permissions_class_diagram.mmd)
```mermaid
classDiagram
class ActivityRequirements{
<<interface>>
getSpecsArray()
getMessage()
getMessageForPermanentDenial()
}
class PermissionActivity{
<<abstract>>
assurePermissionsAreGranted()
}
class PermissionsSpec{
<<enum>>
requestCode: Int
getPermissionsTextArray()
}
class PermissionListener{
<<interface>>
permissionsGranted()
navigateToSettings()
deny()
retry()
}
class PermissionManager{
areAllPermissionsGranted()$
isPermissionGranted()$
requestAllPermissions()
handleRequestPermissionsResult()
handleResume()
}
PermissionActivity <|-- XyzActivity
PermissionActivity --> PermissionManager
PermissionActivity --> PermissionsSpec
PermissionsSpec <|-- PermissionsForAbcd
PermissionsForAbcd --> "1..*" PermissionWithCode
PermissionManager --> PermissionListener
PermissionActivity *--> PermissionListener : inner class
```

## Requesting permissions

[Sequence diagram](requesting_permissions_sequence_diagram.mmd)
```mermaid
sequenceDiagram
Start ->>+ XyzActivity: onCreate()
XyzActivity ->>+ PermissionActivity: assurePermissionsAreGranted(:PermissionsSpec)
PermissionActivity ->>+ ActivityRequirements: getSpecsArray()
ActivityRequirements -->>- PermissionActivity: x
PermissionActivity ->>+ PermissionManager: areAllPermissionsGranted(:Array<PermissionWithCode>)
PermissionManager -->>- PermissionActivity: x
alt all permissions granted
PermissionActivity ->>+ XyzActivity: onPermissionsGranted()
XyzActivity -->>- PermissionActivity: x
else
PermissionActivity ->>+ PermissionManager: requestAllPermissions(:PermissionsSpec)
PermissionManager ->>+ ActivityRequirements: getSpecsArray()
ActivityRequirements -->>- PermissionManager: x
PermissionManager ->>+ ActivityCompat: requestPermissions(permissions,requestCode)
ActivityCompat -->>- PermissionManager: x
PermissionManager -->>- PermissionActivity: x
end
PermissionActivity -->>- XyzActivity: x
XyzActivity -->>- Start: x
```

## Handling request permission result

[Sequence diagram](handling_request_result.mmd)
```mermaid
sequenceDiagram
Start ->>+ PermissionActivity: onRequestPermissionsResult(requestCode,permissions,grantResults)
PermissionActivity ->>+ PermissionManager: handleRequestPermissionsResult(:PermissionsSpec,permissions,grantResults)
alt are all permissions granted
PermissionManager ->>+ PermissionListener: permissionsGranted(:PermissionsSpec)
PermissionListener ->>+ PermissionActivity: onPermissionsGranted(:PermissionsSpec)
PermissionActivity -->>- PermissionListener: x
PermissionListener -->>- PermissionManager: x
else
PermissionManager ->>+ ActivityCompat: shouldShowRequestPermissionRationale(deniedPermission)
ActivityCompat -->>- PermissionManager: x
alt should show rationale
PermissionManager ->>+ PermissionManager: showPermissionRationaleDialog(:PermissionsSpec)
PermissionManager ->>+ PermissionListener: retry()
PermissionListener -->>- PermissionManager: x
PermissionManager -->>- PermissionManager: x
else
PermissionManager ->>+ PermissionManager: showPermissionPermanentDenialDialog(:PermissionsSpec,deniedPermission)
opt user wants to change permissions in settings
PermissionManager ->>+ PermissionListener: navigateToSettings()
PermissionListener -) Settings: startActivity(intent)
PermissionListener -->>- PermissionManager: x
end
PermissionManager -->>- PermissionManager: x
end

end
PermissionManager -->>- PermissionActivity: x
PermissionActivity -->>- Start: x
Settings -)+ PermissionActivity: onResume()
PermissionActivity ->>+ PermissionManager: handleResume()
PermissionManager -->>- PermissionActivity: x
```

Rejecting required permissions should result in a dialog where user can change his/her mind. Permissions can be rejected "permanently", then the settings need to be visited to
grant permissions.
Expand Down
32 changes: 0 additions & 32 deletions docs/handling_request_result.mmd

This file was deleted.

37 changes: 0 additions & 37 deletions docs/permissions_class_diagram.mmd

This file was deleted.

20 changes: 0 additions & 20 deletions docs/requesting_permissions_sequence_diagram.mmd

This file was deleted.

Loading
Loading