项目作者: 4ntoine

项目描述 :
Notes client-side app(s)
高级语言: Kotlin
项目地址: git://github.com/4ntoine/NotesClientApp.git
创建时间: 2019-06-21T07:41:45Z
项目社区:https://github.com/4ntoine/NotesClientApp

开源协议:

下载


Build Status

The project

Client-side

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.

Mobile - Android

app-android is an Android app.

Mobile - iOS

To create podspec files run in root project directory:

  1. ./gradlew podspec

app-ios is an iOS app.

Mobile - Flutter (Android/iOS)

app-flutter is an Android/iOS Flutter app.

Desktop - JavaFX

app-javafx is a desktop JavaFX app.

Server-side

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.

MVP

All the apps (except Flutter) use MVP design pattern (see app-mvp module):

MVP

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.

MVP

Building

Applications use app-api module from server-side application repository.

First, make sure:

  • NotesServerApp artifacts are available on local Maven repository:
    clone NotesServerApp 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).

Android app

In this repository root directory:

  1. ./gradlew app-android:assemble

Find compiled .apks in ./app-android/build/outputs/apk/ directories.

JavaFX app

In this repository root directory:

  1. ./gradlew app-javafx:shadowJar

Find compiled app-javafx-all.jar “shadow” jar (includes all dependencies) in ./app-javafx/build/libs/ directory.

iOS app

Compile and install podspec files for server-side and client apps in root directories:

  1. ./gradlew podspec

Install app-mvp pod in app-ios directory:

  1. pod install

Flutter app

Android app

In app-flutter directory:

  1. flutter pub get
  2. flutter packages pub run build_runner build
  3. flutter build apk --target-platform android-arm

Testing

Unit testing

JavaFX/Android app

One can find few unit tests that demonstrate some benefits of clean architecture for testing:

  1. ./gradlew test

iOS app

One can find few unit tests in app-ios/app-iosTests. Run them in XCode.

Automated UI Testing

Android app

First, create and run AVD. In this repository root directory:

  1. ./gradlew app-android:connectedAndroidTest

Make sure all the tests passed:

  1. ...
  2. 12:12:53 V/InstrumentationResultParser: Time: 15.482
  3. 12:12:53 V/InstrumentationResultParser:
  4. 12:12:53 V/InstrumentationResultParser: OK (4 tests)
  5. 12:12:53 V/InstrumentationResultParser:
  6. 12:12:53 V/InstrumentationResultParser:
  7. 12:12:53 V/InstrumentationResultParser: INSTRUMENTATION_CODE: -1
  8. 12:12:53 V/InstrumentationResultParser:
  9. 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,

Flutter app

In app-flutter directory:

  1. flutter test

Manual testing

Android app

Stop server-side app (just to test errors handling).
Install Android app to your device/emulator:

  1. adb install ./app-android/build/outputs/apk/debug/app-android-debug.apk

and run the app.

Type server-side app host and port:

Server host and port

Make sure you can see connection error:

Connection error

Run server-side app and click “Reload” button to reload the notes list in Android app:

List notes loading progress
Empty notes list

Click “Add” button and type note title and body:

Add note
Add note progress

Make sure you can see added note:

Notes list

JavaFX app

Stop server-side app (just to test errors handling).
Run JavaFX app:

  1. java -jar app-javafx/build/libs/app-javafx-all.jar

Type server-side app host and port:

Server host and port

Make sure you can see connection error:

Connection error

Run server-side app and click “Reload” button to reload the notes list in javafx app:

List notes loading progress
Empty notes list

Click “Add” button and type note title and body:

Add note
Add note progress

Make sure you can see added note:

Notes list

iOS app

Stop server-side app (just to test errors handling).
Run the app in iOS device simulator.

Type server-side app host and port:

Server host and port

Make sure you can see connection error:

Connection error

Run server-side app and click “Reload” button to reload the notes list in iOS app:

Empty notes list

Click “Add” button and type note title and body:

Add note

Make sure you can see added note:

Notes list

Flutter app

Android

Server host and port
Add note
Notes list

iOS

Server host and port
Add note
Notes list

Frameworks and tools

Feedback

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.

Author

Anton Smirnov

dev [at] antonsmirnov [dot] name

2019