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

Envio do teste #18

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c475be2
[Structure] Added base project structure
0xfbravo Oct 26, 2019
71a4ce9
[DataLayer] Added RxKotlin and Retrofit support
0xfbravo Oct 26, 2019
60c9178
[DomainLayer] Added Kotlin support
0xfbravo Oct 26, 2019
326ce09
[DomainLayer] Added use-case model and interactor
0xfbravo Oct 26, 2019
89f2cf8
[DataLayer] Fixes on gradle
0xfbravo Oct 26, 2019
5f4b8f7
[DataLayer] Added base request config
0xfbravo Oct 26, 2019
70ba202
[DataLayer] Added API communication
0xfbravo Oct 26, 2019
e001bd2
[DomainLayer] Added interactor unit tests
0xfbravo Oct 26, 2019
be91775
[DataLayer] Added api calls unit tests
0xfbravo Oct 26, 2019
9339f7e
Merge branch 'feature/api_communication' into develop
0xfbravo Oct 26, 2019
335ed46
[PresentationLayer] Added Koin Injection and base classes
0xfbravo Oct 26, 2019
2a56824
[DataLayer] Refactoring on Api services
0xfbravo Oct 27, 2019
947bac6
[DataLayer] Fixes on modules visibility
0xfbravo Oct 27, 2019
ef6b974
[PresentationLayer] Added base mvp
0xfbravo Oct 27, 2019
6ef6bc3
[PresentationLayer] Fixes on injection
0xfbravo Oct 27, 2019
397db32
[PresentationLayer] Fixes on presenter call
0xfbravo Oct 27, 2019
f2d297a
[PresentationLayer] Added presenter call on products list activity
0xfbravo Oct 27, 2019
6353349
[PresentationLayer] Activities renaming
0xfbravo Oct 27, 2019
f58dc23
[PresentationLayer] Added cart products quantity title
0xfbravo Oct 27, 2019
8bb26ae
[PresentationLayer] Added cart values information
0xfbravo Oct 27, 2019
b89fa1c
[PresentationLayer] Added cart recycler view
0xfbravo Oct 27, 2019
5ed6f43
[PresentationLayer] Fixes on recyclerview margin
0xfbravo Oct 27, 2019
a14e36d
[PresentationLayer] Added Facebook Shimmer
0xfbravo Oct 27, 2019
05c0eb3
[PresentationLayer] Fixes on margin
0xfbravo Oct 27, 2019
c360e9b
Merge branch 'feature/presentation_layer' into develop
0xfbravo Oct 27, 2019
ee3400d
[PresentationLayer] Added product details activity layout
0xfbravo Oct 27, 2019
8a30287
[PresentationLayer] Added custom alert to notify errors
0xfbravo Oct 27, 2019
8c5eb47
[PresentationLayer] Fixes on custom alert style
0xfbravo Oct 27, 2019
15b302e
[PresentationLayer] Fixes on parcelable
0xfbravo Oct 27, 2019
555d6be
[PresentationLayer] Added product details navigation
0xfbravo Oct 27, 2019
9e05f80
[PresentationLayer] Added product infos on ProductDetailsActivity
0xfbravo Oct 27, 2019
3714e04
[PresentationLayer] Added custom toolbar
0xfbravo Oct 27, 2019
754ff89
[PresentationLayer] Added animated transition
0xfbravo Oct 28, 2019
05be25c
[PresentationLayer] Fixes on transition
0xfbravo Oct 28, 2019
de64753
Merge branch 'feature/product_details' into develop
0xfbravo Oct 28, 2019
41ae162
Merge branch 'release/0.0.0'
0xfbravo Oct 28, 2019
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
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx

.idea/misc.xml
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

125 changes: 125 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed assets/clock.png
Binary file not shown.
Binary file removed assets/pencil.png
Binary file not shown.
Binary file removed assets/rubberbands.png
Binary file not shown.
Binary file removed assets/rulers.png
Binary file not shown.
28 changes: 28 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()

}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
1 change: 1 addition & 0 deletions data_layer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
67 changes: 67 additions & 0 deletions data_layer/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29


defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
}

dependencies {
// Libs Version control
def rxKotlinVersion = "2.4.0"
def rxAndroidVersion = "2.1.0"
def retrofitVersion = "2.6.0"
def okHttpVersion = "3.12.0"
def gsonVersion = "2.8.5"

// Link to DomainLayer
implementation project(':domain_layer')

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.core:core-ktx:1.1.0'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.23.0'
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0"
testImplementation "com.squareup.okhttp3:mockwebserver:3.14.2"
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

// RxKotlin - [https://github.com/ReactiveX/RxKotlin]
implementation("io.reactivex.rxjava2:rxkotlin:${rxKotlinVersion}")

// RxAndroid - [https://github.com/ReactiveX/RxAndroid]
implementation "io.reactivex.rxjava2:rxandroid:${rxAndroidVersion}"

// Retrofit - [https://github.com/square/retrofit]
implementation "com.squareup.retrofit2:retrofit:${retrofitVersion}"
implementation "com.squareup.retrofit2:converter-gson:${retrofitVersion}"
implementation "com.squareup.retrofit2:adapter-rxjava2:${retrofitVersion}"

// OkHttp - [https://github.com/square/okhttp/]
implementation "com.squareup.okhttp3:okhttp:${okHttpVersion}"
implementation "com.squareup.okhttp3:logging-interceptor:${okHttpVersion}"

// GSON - [https://github.com/google/gson]
implementation "com.google.code.gson:gson:${gsonVersion}"
}
Empty file added data_layer/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions data_layer/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions data_layer/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nexaas.challenge.data" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.nexaas.challenge.data.core

import com.nexaas.challenge.domain.core.DomainMappable
import com.nexaas.challenge.domain.core.DomainModel

internal abstract class Entity<T: DomainModel>: DomainMappable<T>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.nexaas.challenge.data.core

import com.google.gson.GsonBuilder
import io.reactivex.plugins.RxJavaPlugins
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import retrofit2.converter.gson.GsonConverterFactory
import java.lang.IllegalArgumentException
import java.util.concurrent.TimeUnit

internal object RetrofitFactory {
private val gson = GsonBuilder().setPrettyPrinting().serializeNulls().create()
private val connectTimeout = 60L
private val readTimeout = 60L
private val writeTimeout = 60L

private fun provideRxDefaultErrorHandler() {
RxJavaPlugins.setErrorHandler { it.printStackTrace() }
}

private fun provideHttpClient(): OkHttpClient {
val httpLoggingInterceptor = HttpLoggingInterceptor(HttpLoggingInterceptor.Logger.DEFAULT)
val clientBuilder = OkHttpClient.Builder()

/* Debug logger */
httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.BODY
clientBuilder.addInterceptor(httpLoggingInterceptor)

/* Client timeout */
clientBuilder.connectTimeout(connectTimeout, TimeUnit.SECONDS)
clientBuilder.writeTimeout(writeTimeout, TimeUnit.SECONDS)
clientBuilder.readTimeout(readTimeout, TimeUnit.SECONDS)

return clientBuilder.build()
}

@Throws(IllegalArgumentException::class)
fun provideRetrofit(baseURL: String): Retrofit {
provideRxDefaultErrorHandler()
return Retrofit.Builder()
.baseUrl(baseURL)
.client(provideHttpClient())
.addConverterFactory(GsonConverterFactory.create(gson))
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.nexaas.challenge.data.core.exceptions

import java.lang.Exception

internal class InvalidApiBaseUrl(msg: String): Exception(msg)
Loading