Skip to content

Commit

Permalink
Merge branch 'master' of github.com:smilecs/ketro
Browse files Browse the repository at this point in the history
  • Loading branch information
smile committed Nov 24, 2024
2 parents ef82595 + 9f27d44 commit 2ac5ab1
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 67 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
.idea/caches/build_file_checksums.ser
.idea/misc.xml
github.properties
/.idea/
5 changes: 4 additions & 1 deletion .idea/gradle.xml

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

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

This file was deleted.

49 changes: 8 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,59 +8,26 @@ so errors can easily be grouped and managed with adequate actions and feedback t

## Include Dependency

Currently Ketro is hosted on Jcenter, just add the below line to your app gradle file
Ketro is hosted using JitPack, just add the below line to your root `build.gradle` file

```groovy
implementation 'past3.smilecs.ketro:ketro:1.2.4'
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
```
## Multi - module projects:
Ketro now supports multi-module projects, the Ketro modules such as Wrapper and ApiErrorHandler have been put into a separate package
to allow you expose these in a domain layer without including the Ketro dependency so as to enable separation of concerns between the
data, presentation and domain layer.

```groovy
implementation 'past3.smilecs.ketro:ketro:1.3.3'
```

```groovy
implementation 'past3.smilecs.kcore:kcore:1.3.6'
```
or

```groovy
api 'past3.smilecs.ketro:ketro:1.3.3'
```

```groovy
api 'past3.smilecs.kcore:kcore:1.3.6'
```

Add the sample below to your top level `build.gradle` file when including the `kcore` dependency

```groovy
allprojects {
repositories {
jcenter()
maven {
url "https://dl.bintray.com/smilecs/ketro"
}
}
dependencies {
implementation 'com.github.smilecs:ketro:1.4'
}
```

#### Note:
`Kcore` Houses the ketro models, it's seperation is just so you don't need to include, the `ketro`
dependency in your `domain` module, if you choose to keep your domain layer as a clean kotlin project
with no android dependency else, you can just use the `ketro 1.3.x` dependency in all your modules.

Please check sample if any confusion on how these layers interact and how the dependency between kcore and ketro work
. As a side, the actual handling logic is in `ketro` and `kcore` is a dependency in `ketro`.

- Note: The Kcore models are still accessible via the Ketro project, this other implementation is just
for those who want a simpler way to separate their modules without having to include Ketro in every part of their
project were only the models are needed.


## Ketro Request methods

Ketro offers a selection of methods that wrap your retrofit calls and return a LiveData object with a wrapper that contains an exception object if the request was unsuccessful or as the user defines.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
classpath "com.android.tools.build:gradle:4.2.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Sun Aug 25 14:28:38 EAT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
3 changes: 2 additions & 1 deletion kcore/src/main/java/com/past3/ketro/kcore/model/Wrapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ class Wrapper<T>(
val statusCode: StatusCode = StatusCode(-1)
)

inline class StatusCode(val code: Int)
@JvmInline
value class StatusCode(val code: Int)
20 changes: 6 additions & 14 deletions ketro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,15 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

def getVersionName = { ->
return "1.3.4" // Replace with version Name
}

def getArtificatId = { ->
return "ketro" // Replace with library name ID
}

android {
compileSdkVersion 32
compileSdkVersion 33


defaultConfig {
minSdkVersion 16
targetSdkVersion 32
versionCode 3
versionName "1.2"
targetSdkVersion 33
versionCode 4
versionName "1.4"

testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'

Expand All @@ -42,9 +35,8 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
Expand Down
7 changes: 7 additions & 0 deletions ketro/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep public class com.past3.ketro.api.Request
-keep public class com.past3.ketro.api.ApiErrorHandler
-keep public class com.past3.ketro.api.ApiCallback
-keep public class com.past3.ketro.api.GenericRequestHandler
-keep public class com.past3.ketro.api.Kobserver
-keep public class com.past3.ketro.api.LiveDataHandler

2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':ketro', ':request', ':kcore'
include ':ketro', ':kcore'

0 comments on commit 2ac5ab1

Please sign in to comment.