app-mvp
is a client-side JVM MVP application skeleton for simple notes keeping in Kotlin.
app-infra-rest-retrofit
is an infra layer - client REST controllers that are used by client apps.
app-android
is an Android app.
To create podspec files run in root project directory:
./gradlew podspec
app-ios
is an iOS app.
app-flutter
is an Android/iOS Flutter app.
app-javafx
is a desktop JavaFX app.
Client-side application requires server-side JVM application to be running. Applications interact over HTTP REST. Make sure you run it before running Android application.
All the apps (except Flutter) use MVP design pattern (see app-mvp
module):
Android and JavaFX apps just provide concrete View
implementations and reuse Model
and Presenter
from app-mvp
.
In order to interact with server-side app Model
has a reference to UseCase
implementation (from server-side app-api
).
In order to pass boundary we use according Controller
that implement UseCase
and abstracts transport/protocol.
So both apps use app-infra-rest-retrofit
module with Controllers which can be easily replaced with another one.
Applications use app-api
module from server-side application repository.
First, make sure:
NotesServerApp
artifacts are available on local Maven repository: cloneNotesServerApp
repository to any directory, build and publish it to local Maven repository or- use Gradle composite-build:
clone
NotesServerApp
repository to ../NotesServerApp directory (no separate building/publication is required).
In this repository root directory:
./gradlew app-android:assemble
Find compiled .apk
s in ./app-android/build/outputs/apk/
directories.
In this repository root directory:
./gradlew app-javafx:shadowJar
Find compiled app-javafx-all.jar
"shadow" jar (includes all dependencies) in ./app-javafx/build/libs/
directory.
Compile and install podspec files for server-side and client apps in root directories:
./gradlew podspec
Install app-mvp
pod in app-ios
directory:
pod install
In app-flutter
directory:
flutter pub get
flutter packages pub run build_runner build
flutter build apk --target-platform android-arm
One can find few unit tests that demonstrate some benefits of clean architecture for testing:
./gradlew test
One can find few unit tests in app-ios/app-iosTests
. Run them in XCode.
First, create and run AVD. In this repository root directory:
./gradlew app-android:connectedAndroidTest
Make sure all the tests passed:
...
12:12:53 V/InstrumentationResultParser: Time: 15.482
12:12:53 V/InstrumentationResultParser:
12:12:53 V/InstrumentationResultParser: OK (4 tests)
12:12:53 V/InstrumentationResultParser:
12:12:53 V/InstrumentationResultParser:
12:12:53 V/InstrumentationResultParser: INSTRUMENTATION_CODE: -1
12:12:53 V/InstrumentationResultParser:
12:12:53 I/XmlResultReporter: XML test result file generated at /Users/asmirnov/Documents/dev/src/Notes/NotesClientApp/app-android/build/outputs/androidTest-results/connected/TEST-Nexus_5X_API_25_-_dev(AVD) - 7.1.1-app-android-.xml. Total tests 4, passed 4,
In app-flutter
directory:
flutter test
Stop server-side app (just to test errors handling). Install Android app to your device/emulator:
adb install ./app-android/build/outputs/apk/debug/app-android-debug.apk
and run the app.
Type server-side app host and port:
Make sure you can see connection error:
Run server-side app and click "Reload" button to reload the notes list in Android app:
Click "Add" button and type note title and body:
Make sure you can see added note:
Stop server-side app (just to test errors handling). Run JavaFX app:
java -jar app-javafx/build/libs/app-javafx-all.jar
Type server-side app host and port:
Make sure you can see connection error:
Run server-side app and click "Reload" button to reload the notes list in javafx app:
Click "Add" button and type note title and body:
Make sure you can see added note:
Stop server-side app (just to test errors handling). Run the app in iOS device simulator.
Type server-side app host and port:
Make sure you can see connection error:
Run server-side app and click "Reload" button to reload the notes list in iOS app:
Click "Add" button and type note title and body:
Make sure you can see added note:
- Kotlin programming language
- Kotlin Multiplatform for multiplatform configuration/building
- IntelliJ IDEA IDE for JVM coding
- Swift programming language
- Xcode IDE for iOS coding
- Gradle with Groovy DSL for building
- Retrofit2 for HTTP REST
- Ktor for multiplatform HTTP REST
- JavaFX8 for Java UI
- Gradle Shadow plugin for building of jar file with all dependencies
- Mockito and Mockito-kotlin for unit-testing
- Espresso for Android UI testing
- Xcode tests for iOS testing
- Dart programming language
- Flutter UI toolkit
Please find TODOs in source code as topics for improvements if desired.
Any feedback and discussion is appreciated. Contact me on e-mail for this or fork the repository and pull a request.
Anton Smirnov
dev [at] antonsmirnov [dot] name
2019