Skip to content

Commit dc6e96c

Browse files
authored
Merge pull request #35 from umbum/develop
release 1.0.1
2 parents 6d82993 + 509f65a commit dc6e96c

File tree

11 files changed

+45
-63
lines changed

11 files changed

+45
-63
lines changed

app/build.gradle

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ android {
2424
applicationId "com.tistory.umbum.github_issue_widget_app"
2525
minSdkVersion 21
2626
targetSdkVersion 28
27-
versionCode 1
28-
versionName "1.0"
27+
versionName '1.0.1' // X.Y.Z; X = Major, Y = minor, Z = Patch level
28+
versionCode 2
2929
buildConfigString "CLIENT_SECRET", (buildProperties.secrets['github_client_secret'] | buildProperties.notThere['github_client_secret']).string
3030
buildConfigString "CLIENT_ID", (buildProperties.secrets['github_client_id'] | buildProperties.notThere['github_client_id']).string
3131
buildConfigString "REDIRECT_URI", (buildProperties.secrets['redirect_uri'] | buildProperties.notThere['redirect_uri']).string
@@ -53,7 +53,7 @@ android {
5353
}
5454

5555
dependencies {
56-
implementation fileTree(dir: 'libs', include: ['*.jar'])
56+
implementation fileTree(include: ['*.jar'], dir: 'libs')
5757
implementation 'com.android.support:appcompat-v7:28.0.0'
5858
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
5959
implementation 'com.android.support:support-v4:28.0.0'
@@ -66,10 +66,9 @@ dependencies {
6666
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
6767
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
6868
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version"
69-
implementation "com.android.support:customtabs:28.0.0"
70-
implementation "com.android.support:recyclerview-v7:28.0.0"
71-
kapt "com.android.databinding:compiler:$android_plugin_version"
72-
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
73-
implementation "io.reactivex.rxjava2:rxjava:2.2.10"
69+
implementation 'com.android.support:customtabs:28.0.0'
70+
implementation 'com.android.support:recyclerview-v7:28.0.0'
71+
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
72+
implementation 'io.reactivex.rxjava2:rxjava:2.2.10'
7473
implementation "android.arch.lifecycle:extensions:$lifecycle_version"
7574
}

app/src/main/java/com/tistory/umbum/github_issue_widget_app/data/local/preferences/AccessTokenRepository.kt

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,11 @@ import retrofit2.Response
1313

1414
class AccessTokenRepository(private val context: Context) {
1515
var accessToken: String?
16-
get() = context.applicationContext
17-
.getSharedPreferences("SETTINGS", Context.MODE_PRIVATE)
18-
.getString("accessToken", null)
19-
set(accessToken) {
20-
accessToken ?: throw NullPointerException()
16+
get() = sharedPref.getString("accessToken", null)
17+
set(accessToken) = sharedPref.edit().putString("accessToken", accessToken).apply()
2118

22-
context.applicationContext
23-
.getSharedPreferences("SETTINGS", Context.MODE_PRIVATE)
24-
.edit()
25-
.putString("accessToken", accessToken)
26-
.apply()
27-
}
19+
private val sharedPref = context.applicationContext
20+
.getSharedPreferences("SETTINGS", Context.MODE_PRIVATE)
2821

2922
fun updateAccessToken(code: String): LiveData<String?> {
3023
val accessTokenLiveData = MutableLiveData<String?>()

app/src/main/java/com/tistory/umbum/github_issue_widget_app/data/local/preferences/UserSelectedRepository.kt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,23 @@ import android.util.Log
55
import com.tistory.umbum.github_issue_widget_app.ALL_ISSUES_TEXT
66

77
class UserSelectedRepository(private val context: Context) {
8-
val TAG = this::class.java.simpleName
9-
val keyPrefix = "selected_repo_for_id"
8+
private val TAG = this::class.java.simpleName
9+
private val keyPrefix = "selected_repo_for_id"
10+
private val sharedPref = context.applicationContext
11+
.getSharedPreferences("SETTINGS", Context.MODE_PRIVATE)
1012

11-
fun getSelectedRepoPath(id: Int) : String = context.applicationContext
12-
.getSharedPreferences("SETTINGS", Context.MODE_PRIVATE)
13+
fun getSelectedRepoPath(id: Int) : String = sharedPref
1314
.getString("${keyPrefix}${id}", ALL_ISSUES_TEXT)!!
1415

1516
fun setSelectedRepoPath(id: Int, repoPath: String) {
16-
context.applicationContext
17-
.getSharedPreferences("SETTINGS", Context.MODE_PRIVATE)
18-
.edit()
17+
sharedPref.edit()
1918
.putString("${keyPrefix}${id}", repoPath)
2019
.apply()
2120
Log.d(TAG, "[save] ${keyPrefix}${id} : ${repoPath}")
2221
}
2322

2423
fun removeSelectedRepoPath(id: Int) {
25-
context.applicationContext
26-
.getSharedPreferences("SETTINGS", Context.MODE_PRIVATE)
27-
.edit()
24+
sharedPref.edit()
2825
.remove("${keyPrefix}${id}")
2926
.apply()
3027
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.tistory.umbum.github_issue_widget_app.data.model
22

3-
data class AccessTokenResponse(val accessToken: String,
4-
val tokenType: String,
5-
val scope: String)
3+
import com.google.gson.annotations.SerializedName
4+
5+
data class AccessTokenResponse(@SerializedName("access_token") val accessToken: String,
6+
@SerializedName("token_type") val tokenType: String,
7+
@SerializedName("scope") val scope: String)
Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
package com.tistory.umbum.github_issue_widget_app.data.model
22

3-
data class IssueItem(val id: Int,
4-
val title: String,
5-
val htmlUrl: String,
6-
val labels: List<LabelItem>,
7-
val repository: RepoItem
8-
)
3+
import com.google.gson.annotations.SerializedName
94

10-
data class LabelItem(val name: String,
11-
val color: String)
5+
data class IssueItem(@SerializedName("id") val id: Int,
6+
@SerializedName("title") val title: String,
7+
@SerializedName("html_url") val htmlUrl: String,
8+
@SerializedName("labels") val labels: List<LabelItem>,
9+
@SerializedName("repository") val repository: RepoItem)
1210

13-
data class RepoItem(val id: Int,
14-
val name: String,
15-
val fullName: String,
16-
val private: Boolean,
17-
val openIssuesCount: Int)
11+
data class LabelItem(@SerializedName("name") val name: String,
12+
@SerializedName("color") val color: String)
13+
14+
data class RepoItem(@SerializedName("id") val id: Int,
15+
@SerializedName("name") val name: String,
16+
@SerializedName("full_name") val fullName: String,
17+
@SerializedName("private") val private: Boolean,
18+
@SerializedName("open_issues_count") val openIssuesCount: Int)

app/src/main/java/com/tistory/umbum/github_issue_widget_app/data/remote/api/GithubApiClient.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.tistory.umbum.github_issue_widget_app.data.remote.api
22

3-
import com.google.gson.FieldNamingPolicy
4-
import com.google.gson.GsonBuilder
53
import com.google.gson.JsonArray
64
import com.tistory.umbum.github_issue_widget_app.data.model.IssueItem
75
import com.tistory.umbum.github_issue_widget_app.data.model.RepoItem
@@ -15,12 +13,9 @@ import retrofit2.http.Path
1513
const val GITHUB_API_URL = "https://api.github.com/"
1614

1715
object GithubApiClient {
18-
private val gson = GsonBuilder()
19-
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
20-
.create()
2116
val client = Retrofit.Builder()
2217
.baseUrl(GITHUB_API_URL)
23-
.addConverterFactory(GsonConverterFactory.create(gson))
18+
.addConverterFactory(GsonConverterFactory.create())
2419
.build()
2520
.create(Service::class.java)
2621

app/src/main/java/com/tistory/umbum/github_issue_widget_app/data/remote/api/GithubClient.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.tistory.umbum.github_issue_widget_app.data.remote.api
22

3-
import com.google.gson.FieldNamingPolicy
4-
import com.google.gson.GsonBuilder
53
import com.tistory.umbum.github_issue_widget_app.data.model.AccessTokenResponse
64
import retrofit2.Call
75
import retrofit2.Retrofit
@@ -15,12 +13,9 @@ import retrofit2.http.POST
1513
const val GITHUB_URL = "https://github.com/"
1614

1715
object GithubClient {
18-
private val gson = GsonBuilder()
19-
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
20-
.create()
2116
val client = Retrofit.Builder()
2217
.baseUrl(GITHUB_URL)
23-
.addConverterFactory(GsonConverterFactory.create(gson))
18+
.addConverterFactory(GsonConverterFactory.create())
2419
.build()
2520
.create(Service::class.java)
2621

app/src/main/java/com/tistory/umbum/github_issue_widget_app/ui/reposelect/RepoSelectAdapter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import android.view.View
1010
import android.view.ViewGroup
1111
import com.tistory.umbum.github_issue_widget_app.R
1212
import com.tistory.umbum.github_issue_widget_app.data.local.preferences.UserSelectedRepository
13-
import com.tistory.umbum.github_issue_widget_app.databinding.RepoItemBinding
1413
import com.tistory.umbum.github_issue_widget_app.data.model.RepoItem
14+
import com.tistory.umbum.github_issue_widget_app.databinding.RepoItemBinding
1515
import com.tistory.umbum.github_issue_widget_app.ui.widget.IssueWidget
1616

1717

app/src/main/java/com/tistory/umbum/github_issue_widget_app/ui/widget/IssueListService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import com.tistory.umbum.github_issue_widget_app.ALL_ISSUES_TEXT
1010
import com.tistory.umbum.github_issue_widget_app.R
1111
import com.tistory.umbum.github_issue_widget_app.data.local.preferences.AccessTokenRepository
1212
import com.tistory.umbum.github_issue_widget_app.data.local.preferences.UserSelectedRepository
13-
import com.tistory.umbum.github_issue_widget_app.data.remote.api.GithubApiClient
1413
import com.tistory.umbum.github_issue_widget_app.data.model.IssueItem
14+
import com.tistory.umbum.github_issue_widget_app.data.remote.api.GithubApiClient
1515
import retrofit2.Call
1616

1717

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.3.40'
4+
ext.kotlin_version = '1.3.41'
55
ext.retrofit_version = '2.5.0'
6-
ext.android_plugin_version = '3.1.0'
6+
ext.android_gradle_plugin_version = '3.5.0'
77
ext.lifecycle_version = '1.1.1'
88
repositories {
99
google()
1010
jcenter()
1111
}
1212
dependencies {
13-
classpath "com.android.tools.build:gradle:$android_plugin_version"
13+
classpath "com.android.tools.build:gradle:$android_gradle_plugin_version"
1414
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1515
classpath 'com.novoda:gradle-build-properties-plugin:0.4.1'
1616

0 commit comments

Comments
 (0)