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

Pull Request for Preview #17

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
21fa2ba
Manage dependencies
YUSMLE Jul 25, 2020
414ef67
Add core module
YUSMLE Jul 25, 2020
9eb90e6
Add Model, DataSource, Repository and UseCase for AccessToken
YUSMLE Jul 25, 2020
fe51e70
Add basic Activity and ViewModel
YUSMLE Jul 26, 2020
24fd818
Add some helper classes
YUSMLE Jul 26, 2020
efd3c0d
Add abstraction to folow MVI design
YUSMLE Jul 26, 2020
a719bd5
Add AccessToken view state
YUSMLE Jul 26, 2020
9aab6ed
Add AccessToken view model
YUSMLE Jul 26, 2020
8bb357e
Add AccessToken Activity
YUSMLE Jul 26, 2020
082f616
Add and modify colors, dimens and styles
YUSMLE Jul 26, 2020
2591c3e
Refactor UI layout of AccessToken Activity
YUSMLE Jul 26, 2020
08d30e8
Add secret constant values
YUSMLE Jul 26, 2020
7844d1b
Refactor some classes and files
YUSMLE Jul 26, 2020
cd8f024
Implement API call infrastructure and AccessToken remote service
YUSMLE Jul 26, 2020
e5c9f91
Implement AccessToken local service
YUSMLE Jul 26, 2020
bbfcc45
Add dependency injection infrastructure using Dagger2
YUSMLE Jul 26, 2020
c3b2003
Fix `android.view.InflateException` for MaterialButton
YUSMLE Jul 26, 2020
37cb06c
Fix issues with ViewModel dependency injection
YUSMLE Jul 26, 2020
13b4daa
Fix issues with AccessToken API call URL
YUSMLE Jul 26, 2020
7139d61
Add use cases to persist AccessToken
YUSMLE Jul 27, 2020
f1a915a
Add some UI utils
YUSMLE Jul 27, 2020
72f8c69
Refactor SingleLiveEvent class
YUSMLE Jul 27, 2020
c818318
Render view states and loading status
YUSMLE Jul 27, 2020
7570872
Merge branch 'feature/github_authorization' into develop
YUSMLE Jul 27, 2020
764fe40
Merge branch 'feature/github_repositories' into develop
YUSMLE Jul 28, 2020
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
8 changes: 8 additions & 0 deletions .idea/compiler.xml

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

2 changes: 1 addition & 1 deletion .idea/misc.xml

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

168 changes: 131 additions & 37 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,50 +1,144 @@
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply plugin: Plugins.androidApplication
apply plugin: Plugins.kotlinAndroid
apply plugin: Plugins.kotlinAndroidExtensions
apply plugin: Plugins.kotlinKapt

android {
compileSdkVersion 29
buildToolsVersion "29.0.1"
compileSdkVersion Configs.compileSdkVersion

defaultConfig {
applicationId "com.mydigipay.challenge.github"
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
applicationId Configs.applicationId
minSdkVersion Configs.minSdkVersion
targetSdkVersion Configs.targetSdkVersion
versionCode Configs.versionCode
versionName Configs.versionName

testInstrumentationRunner Configs.testInstrumentationRunner
multiDexEnabled true
}

buildTypes {
debug {
minifyEnabled false
shrinkResources false
//useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "DigiPay Challenge v${defaultConfig.versionName} - (${variant.buildType.name}).apk"
}
}
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
shrinkResources false
//useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "DigiPay Challenge v${defaultConfig.versionName}.apk"
}
}
}
}

/* This is how to use Java 8 Language Lambda feature. */
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

/* Specify JVM target of Kotlin to Java v1.8 */
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}

/* This is how to use data binding feature of Android Studio. */
dataBinding {
enabled = true
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'org.koin:koin-android:2.0.1'
implementation 'org.koin:koin-android-viewmodel:2.0.1'


implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
implementation 'androidx.preference:preference-ktx:1.1.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

/* Modules */
implementation project(path: ':core')

/* JAR Dependencies */
implementation fileTree(include: ['*.jar'], dir: 'libs')

/* Kotlin */
implementation Dependencies.kotlin

/* Testing */
testImplementation Dependencies.jUnit
androidTestImplementation Dependencies.androidXTestRunner
androidTestImplementation Dependencies.androidXTestExt
androidTestImplementation(Dependencies.espessoCore, {
exclude group: Dependencies.excludeGroup, module: Dependencies.excludeModule
})

/* AndroidX Support */
implementation Dependencies.androidXCoreKtx
implementation Dependencies.androidXAppCompat
implementation Dependencies.androidXConstraintLayout
implementation Dependencies.androidXRecyclerView
implementation Dependencies.androidXCardView
implementation Dependencies.androidXSwipeRefreshLayout
implementation Dependencies.googleAndroidMaterial

/* Jetpack Lifecycle Component */
implementation Dependencies.lifeCycleExtensions
kapt Dependencies.lifeCycleCommonJava8

/* Jetpack Room Component */
implementation Dependencies.roomRuntime
kapt Dependencies.roomCompiler
androidTestImplementation Dependencies.roomTesting
implementation Dependencies.roomRxJava

/* Jetpack Preference Component */
implementation Dependencies.preference

/* Jetpack Navigation Component */
implementation Dependencies.navigationFragment
implementation Dependencies.navigationFragmentKtx
implementation Dependencies.navigationUi
implementation Dependencies.navigationUiKtx
implementation Dependencies.navigationDynamicFeaturesFragment
androidTestImplementation Dependencies.navigationTesting

/* RxJava */
implementation Dependencies.rxJva
implementation Dependencies.rxAndroid

/* Kotlin Coroutines */
implementation Dependencies.kotlinXCoroutinesCore
implementation Dependencies.kotlinXCoroutinesAndroid

/* Dependency Injection using Dagger2 */
implementation Dependencies.dagger
implementation Dependencies.daggerAndroidSupport
kapt Dependencies.daggerCompiler
kapt Dependencies.daggerAndroidProcessor

/* Dependency Injection using Koin */
implementation Dependencies.koin
implementation Dependencies.koinViewModel

/* Remote API Call using Retrofit2 */
implementation Dependencies.retrofit
implementation Dependencies.converterGson
implementation Dependencies.adapterRxJava
implementation Dependencies.okHttp
implementation Dependencies.loggingInterceptor
implementation Dependencies.gson
implementation Dependencies.adapterCoroutines

/* Other */

implementation(Dependencies.glide) {
exclude group: Dependencies.excludeGroup
}
kapt Dependencies.glideCompiler
}
31 changes: 19 additions & 12 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mydigipay.challenge.github">
<uses-permission android:name="android.permission.INTERNET"/>
package="com.mydigipay.challenge">

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

<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name="com.mydigipay.challenge.app.App">
android:theme="@style/AppTheme">

<activity
android:name="com.mydigipay.challenge.github.MainActivity"
android:label="@string/app_name"
android:name=".presentation.view.ui.AccessTokenActivity"
android:label="@string/title_activity_access_token"
android:theme="@style/AppTheme.NoActionBar">

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name="com.mydigipay.challenge.github.LoginUriActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="challenge" />
<!-- My custom URI scheme -->
<data
android:scheme="com.mydigipay.challenge"
android:host="oauth2redirect" />
</intent-filter>
</activity>

<activity
android:name=".presentation.view.ui.GithubReposActivity"
android:label="@string/title_activity_github_repos"
android:theme="@style/AppTheme.NoActionBar" />
</application>

</manifest>
</manifest>
33 changes: 33 additions & 0 deletions app/src/main/java/com/mydigipay/challenge/App.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.mydigipay.challenge

import android.app.Activity
import android.app.Application
import com.mydigipay.challenge.framework.di.components.AppComponent
import com.mydigipay.challenge.framework.di.components.DaggerAppComponent
import dagger.android.AndroidInjector
import dagger.android.DispatchingAndroidInjector
import dagger.android.HasActivityInjector
import javax.inject.Inject

class App : Application(), HasActivityInjector {

@Inject
internal lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Activity>

override fun activityInjector(): AndroidInjector<Activity> {
return dispatchingAndroidInjector
}

override fun onCreate() {
super.onCreate()

mInjector = DaggerAppComponent.builder()
.app(this)
.build()
mInjector.inject(this)
}

companion object {
private lateinit var mInjector: AppComponent
}
}
19 changes: 19 additions & 0 deletions app/src/main/java/com/mydigipay/challenge/Const.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.mydigipay.challenge

// The base URL used for request a user's GitHub identity.
const val AUTHORIZE_URL: String = "https://github.com/login/oauth/authorize"

// The base URL used for request AccessToken from GitHub.
const val ACCESS_TOKEN_URL: String = "https://github.com/login/oauth/access_token/"

// The base URL used for request AccessToken from GitHub.
const val REST_API_URL: String = "https://api.github.com/"

// The URL in your application where users are sent after authorization.
const val REDIRECT_URI: String = "com.mydigipay.challenge://oauth2redirect"

// The client ID you received from GitHub for your GitHub App.
const val CLIENT_ID = "407ca6e82fb962149752"

// The client secret you received from GitHub for your GitHub App.
const val CLIENT_SECRET = "54026b111c06b89ea48bf5082ac8fce6da1480c5"
29 changes: 0 additions & 29 deletions app/src/main/java/com/mydigipay/challenge/app/App.kt

This file was deleted.

Loading