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

First deliverable #45

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.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
local.properties
3 changes: 3 additions & 0 deletions .idea/.gitignore

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

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

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

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

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

10 changes: 10 additions & 0 deletions .idea/misc.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.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
102 changes: 102 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-parcelize'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'androidx.navigation.safeargs.kotlin'
}

android {
namespace 'com.carteagal.baz_android'
compileSdk 33

defaultConfig {
applicationId "com.carteagal.baz_android"
minSdk 26
targetSdk 33
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
viewBinding {
enabled = true
}

dataBinding {
enabled = true
}
}

ext{
lifecycle_version = "2.5.1"
retrofit_version = "2.9.0"
gson_version = "2.10.1"
rx_version = "3.0.0"
materialDesigne_version = "1.2.0-alpha02"
hilt_version = "2.44"
nav_version = "2.5.3"
splash_version = "1.0.0"
glide_version = "4.14.2"
okhttp_version = "4.9.3"
}

dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation "com.google.android.material:material:$materialDesigne_version"

//SPLASH SCREEN
implementation "androidx.core:core-splashscreen:$splash_version"

//RETROFIT
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation "com.squareup.retrofit2:adapter-rxjava3:$retrofit_version"
implementation "com.google.code.gson:gson:$gson_version"

//RXJAVA
implementation "io.reactivex.rxjava3:rxandroid:$rx_version"
implementation "io.reactivex.rxjava3:rxjava:$rx_version"

//OKHTTP
implementation "com.squareup.okhttp3:okhttp:$okhttp_version"

//VIEWMODEL
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"

//HILT
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-compiler:$hilt_version"

//NAVIGATION
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

//Glide
implementation "com.github.bumptech.glide:glide:$glide_version"
annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"
}
21 changes: 21 additions & 0 deletions app/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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.carteagal.baz_android

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.carteaga.baz_android_capstone", appContext.packageName)
}
}
28 changes: 28 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:name=".di.MainApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.BazAndroidCapstone"
tools:targetApi="31">
<activity
android:name=".presentation.ui.MainActivity"
android:exported="true"
android:theme="@style/Theme.App.Starting"
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.carteagal.baz_android.data.dataSources

import android.util.Log
import com.carteagal.baz_android.data.model.availableBook.AvailableBookResponse
import com.carteagal.baz_android.data.model.orderBook.OrderBookResponse
import com.carteagal.baz_android.data.model.tickerResponse.TickerResponse
import com.carteagal.baz_android.data.service.CryptoApiClient
import javax.inject.Inject

class CryptoRemoteDataSourceImp @Inject constructor(
private val apiClient: CryptoApiClient
) : CryptoRemoteDataSources {

override suspend fun getAvailableBooks(): List<AvailableBookResponse> =
apiClient.getAvailableBooks().result ?: listOf()

override suspend fun getOrderBooks(book: String): List<OrderBookResponse> =
apiClient.getOrderBooks(book).result ?: listOf()

override suspend fun getTicker(book: String) =
apiClient.getTicker(book).result ?: TickerResponse()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.carteagal.baz_android.data.dataSources

import com.carteagal.baz_android.data.model.availableBook.AvailableBookResponse
import com.carteagal.baz_android.data.model.base.BaseServiceResponse
import com.carteagal.baz_android.data.model.orderBook.OrderBookResponse
import com.carteagal.baz_android.data.model.tickerResponse.TickerResponse
import com.carteagal.baz_android.data.network.Resources

interface CryptoRemoteDataSources {
suspend fun getAvailableBooks(): List<AvailableBookResponse>
suspend fun getOrderBooks(book: String): List<OrderBookResponse>
suspend fun getTicker(book: String): TickerResponse
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.carteagal.baz_android.data.model.availableBook

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

data class AvailableBookResponse(
@Expose
@SerializedName("book") val book: String,
@Expose
@SerializedName("minimum_price") val minimumPrice: String,
@Expose
@SerializedName("maximum_price") val maximumPrice: String,
@Expose
@SerializedName("minimum_amount") val minimumAmount: String,
@Expose
@SerializedName("maximum_amount") val maximumAmount: String,
@Expose
@SerializedName("minimum_value") val minimumValue: String,
@Expose
@SerializedName("maximum_value") val maximumValue: String,
@Expose
@SerializedName("tick_size") val tickSize: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.carteagal.baz_android.data.model.availableBook

data class AvailableBookUI(
val name: String,
val imageUrl: String,
val maxPrice: Double,
val minPrice: Double,
val amount: Double
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.carteagal.baz_android.data.model.base

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

data class BaseServiceResponse<T>(
@Expose
@SerializedName("success") val success: Boolean,

@Expose
@SerializedName("payload") val result: T? = null,

@Expose
@SerializedName("error") val error: ErrorBase? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.carteagal.baz_android.data.model.base

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

data class ErrorBase(
@Expose
@SerializedName("code") val code: String,

@Expose
@SerializedName("mesage") val message: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.carteagal.baz_android.data.model.orderBook

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

data class OrderBookResponse(
@Expose
@SerializedName("updated_at") val updatedAt: String?,
@Expose
@SerializedName("sequence") val sequence: String?,
@Expose
@SerializedName("binds") val binds: List<BindsResponse>?
)

data class BindsResponse(
@Expose
@SerializedName("book") val book: String?,
@Expose
@SerializedName("price") val price: String?,
@Expose
@SerializedName("amount") val amount: String?
)
Loading