WIP: feature/abstractions (#45)

* Abstraction layer backup

* Removed DataEntity, was unnecessary for now

* Separated network, persistence, entities and interaction, closes #29

* Renamed binding

* Removed build files, example tests

Removed build files, example tests

* Fixed build files were not being ignored all around app

* Updated CI ymls

* Small changes

* Fixed legacy repository package names

* Fixed CQ findings

* Updated Fastlane

* Packaging changes and version upgrades

* Removed core from interactors

* Version bumps

* Added new module graph
This commit is contained in:
Melih Aksoy
2019-10-30 17:27:53 +01:00
committed by GitHub
parent 83e39400a9
commit 88022629e1
103 changed files with 1098 additions and 921 deletions

View File

@@ -0,0 +1,17 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply from: "$rootProject.projectDir/scripts/module.gradle"
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':abstractions')
implementation libraries.room
implementation libraries.moshiKotlin
kapt annotationProcessors.roomCompiler
kapt annotationProcessors.moshi
}

View File

21
data/definitions/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,3 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.melih.definitions.entities" />

View File

@@ -0,0 +1,4 @@
package com.melih.definitions
internal const val DEFAULT_NAME = "Default name"
internal const val EMPTY_STRING = ""

View File

@@ -0,0 +1,23 @@
package com.melih.definitions
import com.melih.abstractions.data.ViewEntity
import com.melih.abstractions.deliverable.Result
import com.melih.abstractions.mapper.Mapper
import com.melih.definitions.entities.LaunchEntity
/**
* Contract for sources to seperate business logic from build and return type
*/
interface Source {
//region Abstractions
suspend fun <T : ViewEntity> getNextLaunches(
count: Int,
page: Int,
mapper: Mapper<LaunchEntity, T>
): Result<List<T>>
suspend fun <T : ViewEntity> getLaunchById(id: Long, mapper: Mapper<LaunchEntity, T>): Result<T>
//endregion
}

View File

@@ -0,0 +1,19 @@
package com.melih.definitions.entities
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.melih.definitions.DEFAULT_NAME
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@Entity(tableName = "Launches")
@JsonClass(generateAdapter = true)
data class LaunchEntity(
@PrimaryKey val id: Long = 0L,
val name: String = DEFAULT_NAME,
@field:Json(name = "wsstamp") val launchStartTime: Long = 0L,
@field:Json(name = "westamp") val launchEndTime: Long = 0L,
val location: LocationEntity = LocationEntity(),
val rocket: RocketEntity = RocketEntity(),
val missions: List<MissionEntity> = listOf(MissionEntity())
)

View File

@@ -0,0 +1,12 @@
package com.melih.definitions.entities
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class LaunchesEntity(
val id: Long = 0L,
val launches: List<LaunchEntity> = listOf(),
val total: Int = 0,
val offset: Int = 0,
val count: Int = 0
)

View File

@@ -0,0 +1,20 @@
package com.melih.definitions.entities
import androidx.room.ColumnInfo
import com.melih.definitions.DEFAULT_NAME
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class LocationEntity(
@ColumnInfo(name = "id_location") val id: Long = 0L,
@ColumnInfo(name = "name_location") val name: String = DEFAULT_NAME,
val pads: List<PadEntity> = listOf(PadEntity())
)
@JsonClass(generateAdapter = true)
data class PadEntity(
@ColumnInfo(name = "id_pad") val id: Long = 0L,
@ColumnInfo(name = "name_pad") val name: String = DEFAULT_NAME,
val lat: Long = 0L,
val long: Long = 0L
)

View File

@@ -0,0 +1,14 @@
package com.melih.definitions.entities
import androidx.room.ColumnInfo
import com.melih.definitions.DEFAULT_NAME
import com.melih.definitions.EMPTY_STRING
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class MissionEntity(
@ColumnInfo(name = "id_mission") val id: Long = 0L,
@ColumnInfo(name = "name_mission") val name: String = DEFAULT_NAME,
val description: String = EMPTY_STRING,
val typeName: String = EMPTY_STRING
)

View File

@@ -0,0 +1,16 @@
package com.melih.definitions.entities
import androidx.room.ColumnInfo
import com.melih.definitions.DEFAULT_NAME
import com.melih.definitions.EMPTY_STRING
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class RocketEntity(
@ColumnInfo(name = "id_rocket") val id: Long = 0L,
@ColumnInfo(name = "name_rocket") val name: String = DEFAULT_NAME,
@field:Json(name = "familyname") val familyName: String = DEFAULT_NAME,
val imageSizes: IntArray = intArrayOf(),
val imageURL: String = EMPTY_STRING
)