Commit 14e92c0c authored by Eugene Shapovalov's avatar Eugene Shapovalov 💬

Merge remote-tracking branch 'remotes/origin/develop' into feature/project_file_details

# Conflicts:
#	.idea/codeStyles/Project.xml
#	app/build.gradle.kts
#	app/src/main/java/ru/terrakok/gitlabclient/Screens.kt
#	app/src/main/java/ru/terrakok/gitlabclient/toothpick/DI.kt
#	build.gradle.kts
parents 506c4f19 271c381b
......@@ -8,8 +8,7 @@ local.properties
# Idea
.idea/
!.idea/codeStyles
**/*.iml
# Mac OS
.DS_Store
\ No newline at end of file
.DS_Store
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<AndroidXmlCodeStyleSettings>
<option name="USE_CUSTOM_SETTINGS" value="true" />
</AndroidXmlCodeStyleSettings>
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<XML>
<option name="XML_KEEP_LINE_BREAKS" value="false" />
<option name="XML_ALIGN_ATTRIBUTES" value="false" />
<option name="XML_SPACE_INSIDE_EMPTY_TAG" value="true" />
</XML>
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
\ No newline at end of file
......@@ -16,8 +16,8 @@ android {
minSdkVersion(19)
targetSdkVersion(28)
versionName = "1.3.2"
versionCode = 11
versionName = "1.4.2"
versionCode = 14
buildToolsVersion = "28.0.3"
......@@ -71,13 +71,13 @@ android {
buildTypes {
create("debugPG") {
isDebuggable = true
initWith(getByName("debug"))
isMinifyEnabled = true
versionNameSuffix = " debugPG"
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
file("config/proguard/proguard-rules.txt")
file("proguard-rules.pro")
)
}
getByName("release") {
......@@ -86,7 +86,7 @@ android {
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
file("config/proguard/proguard-rules.txt")
file("proguard-rules.pro")
)
}
}
......@@ -98,7 +98,7 @@ dependencies {
val moxyVersion = "1.4.6"
val toothpickVersion = "1.0.6"
val retrofitVersion = "2.2.0"
val markwonVersion = "1.1.1"
val markwonVersion = "2.0.0"
val glideVersion = "4.8.0"
//Support
......@@ -134,9 +134,7 @@ dependencies {
//Image load and cache
implementation("com.github.bumptech.glide:glide:$glideVersion")
kapt("com.github.bumptech.glide:compiler:$glideVersion")
implementation("com.github.bumptech.glide:okhttp3-integration:4.6.1") {
exclude(group = "glide-parent")
}
implementation("com.github.bumptech.glide:okhttp3-integration:$glideVersion")
//Markdown to HTML converter
implementation("ru.noties:markwon:$markwonVersion")
implementation("ru.noties:markwon-image-loader:$markwonVersion")
......@@ -149,9 +147,10 @@ dependencies {
//FlexBox Layout
implementation("com.google.android:flexbox:1.0.0")
//Firebase
implementation("com.google.firebase:firebase-core:16.0.5")
implementation("com.google.firebase:firebase-core:16.0.6")
//Crashlytics
implementation("com.crashlytics.sdk.android:crashlytics:2.9.6")
implementation("com.crashlytics.sdk.android:crashlytics:2.9.8")
//JUnit
testImplementation("junit:junit:4.12")
//Mockito
......
{
"project_info": {
"project_number": "0",
"firebase_url": "debug",
"project_id": "gitfox-gitlab-client",
"storage_bucket": "debug"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:0:android:0",
"android_client_info": {
"package_name": "com.gitlab.terrakok.gitfox"
}
},
"oauth_client": [
{
"client_id": "debug",
"client_type": 3
}
],
"api_key": [
{
"current_key": "debug"
},
{
"current_key": "debug"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
......@@ -16,6 +16,7 @@
<activity
android:name=".ui.AppActivity"
android:launchMode="singleInstance"
android:theme="@style/AppTheme.Splash"
android:windowSoftInputMode="adjustResize">
<intent-filter>
......
......@@ -7,10 +7,8 @@ import com.jakewharton.threetenabp.AndroidThreeTen
import io.fabric.sdk.android.Fabric
import ru.noties.markwon.SpannableConfiguration
import ru.noties.markwon.spans.SpannableTheme
import ru.terrakok.gitlabclient.model.data.auth.AuthHolder
import ru.terrakok.gitlabclient.toothpick.DI
import ru.terrakok.gitlabclient.toothpick.module.AppModule
import ru.terrakok.gitlabclient.toothpick.module.ServerModule
import timber.log.Timber
import toothpick.Toothpick
import toothpick.configuration.Configuration
......@@ -62,13 +60,8 @@ class App : Application() {
}
private fun initAppScope() {
val appScope = Toothpick.openScope(DI.APP_SCOPE)
appScope.installModules(AppModule(this))
//By default we need init ServerScope for launch app
val authHolder = appScope.getInstance(AuthHolder::class.java)
val serverScope = Toothpick.openScopes(DI.APP_SCOPE, DI.SERVER_SCOPE)
serverScope.installModules(ServerModule(authHolder.serverPath))
Toothpick.openScope(DI.APP_SCOPE)
.installModules(AppModule(this))
}
private fun initMarkwon() {
......
......@@ -6,10 +6,12 @@ import android.net.Uri
import ru.terrakok.cicerone.android.support.SupportAppScreen
import ru.terrakok.gitlabclient.entity.issue.IssueState
import ru.terrakok.gitlabclient.entity.mergerequest.MergeRequestState
import ru.terrakok.gitlabclient.entity.milestone.MilestoneState
import ru.terrakok.gitlabclient.ui.about.AboutFragment
import ru.terrakok.gitlabclient.ui.auth.AuthFlowFragment
import ru.terrakok.gitlabclient.ui.auth.AuthFragment
import ru.terrakok.gitlabclient.ui.drawer.DrawerFlowFragment
import ru.terrakok.gitlabclient.ui.global.StubFragment
import ru.terrakok.gitlabclient.ui.file.ProjectFileFlowFragment
import ru.terrakok.gitlabclient.ui.file.ProjectFileFragment
import ru.terrakok.gitlabclient.ui.issue.IssueFlowFragment
......@@ -29,13 +31,17 @@ import ru.terrakok.gitlabclient.ui.my.todos.MyTodosFragment
import ru.terrakok.gitlabclient.ui.privacypolicy.PrivacyPolicyFragment
import ru.terrakok.gitlabclient.ui.project.ProjectFlowFragment
import ru.terrakok.gitlabclient.ui.project.ProjectFragment
import ru.terrakok.gitlabclient.ui.project.files.ProjectFilesFragment
import ru.terrakok.gitlabclient.ui.project.info.ProjectEventsFragment
import ru.terrakok.gitlabclient.ui.project.info.ProjectInfoContainerFragment
import ru.terrakok.gitlabclient.ui.project.info.ProjectInfoFragment
import ru.terrakok.gitlabclient.ui.project.issues.ProjectIssuesContainerFragment
import ru.terrakok.gitlabclient.ui.project.issues.ProjectIssuesFragment
import ru.terrakok.gitlabclient.ui.project.labels.ProjectLabelsFragment
import ru.terrakok.gitlabclient.ui.project.mergerequest.ProjectMergeRequestsContainerFragment
import ru.terrakok.gitlabclient.ui.project.mergerequest.ProjectMergeRequestsFragment
import ru.terrakok.gitlabclient.ui.project.milestones.ProjectMilestonesContainerFragment
import ru.terrakok.gitlabclient.ui.project.milestones.ProjectMilestonesFragment
import ru.terrakok.gitlabclient.ui.projects.ProjectsContainerFragment
import ru.terrakok.gitlabclient.ui.projects.ProjectsListFragment
import ru.terrakok.gitlabclient.ui.user.UserFlowFragment
......@@ -121,54 +127,58 @@ object Screens {
override fun getFragment() = ProjectFlowFragment.create(projectId)
}
data class ProjectMainFlow(
val scope: String
) : SupportAppScreen() {
override fun getFragment() = ProjectFragment.create(scope)
object ProjectMainFlow : SupportAppScreen() {
override fun getFragment() = ProjectFragment()
}
data class ProjectInfoContainer(
val scope: String
) : SupportAppScreen() {
override fun getFragment() = ProjectInfoContainerFragment.create(scope)
object ProjectInfoContainer : SupportAppScreen() {
override fun getFragment() = ProjectInfoContainerFragment()
}
data class ProjectInfo(
val scope: String
) : SupportAppScreen() {
override fun getFragment() = ProjectInfoFragment.create(scope)
object ProjectInfo : SupportAppScreen() {
override fun getFragment() = ProjectInfoFragment()
}
data class ProjectEvents(
val scope: String
) : SupportAppScreen() {
override fun getFragment() = ProjectEventsFragment.create(scope)
object ProjectEvents : SupportAppScreen() {
override fun getFragment() = ProjectEventsFragment()
}
data class ProjectIssuesContainer(
val scope: String
) : SupportAppScreen() {
override fun getFragment() = ProjectIssuesContainerFragment.create(scope)
object ProjectIssuesContainer : SupportAppScreen() {
override fun getFragment() = ProjectIssuesContainerFragment()
}
data class ProjectIssues(
val issueState: IssueState,
val scope: String
val issueState: IssueState
) : SupportAppScreen() {
override fun getFragment() = ProjectIssuesFragment.create(issueState, scope)
override fun getFragment() = ProjectIssuesFragment.create(issueState)
}
data class ProjectMergeRequestsContainer(
val scope: String
) : SupportAppScreen() {
override fun getFragment() = ProjectMergeRequestsContainerFragment.create(scope)
object ProjectMergeRequestsContainer : SupportAppScreen() {
override fun getFragment() = ProjectMergeRequestsContainerFragment()
}
data class ProjectMergeRequests(
val mrState: MergeRequestState,
val scope: String
val mrState: MergeRequestState
) : SupportAppScreen() {
override fun getFragment() = ProjectMergeRequestsFragment.create(mrState)
}
object ProjectLabels : SupportAppScreen() {
override fun getFragment() = ProjectLabelsFragment()
}
object ProjectMilestonesContainer : SupportAppScreen() {
override fun getFragment() = ProjectMilestonesContainerFragment()
}
data class ProjectMilestones(
val milestoneState: MilestoneState
) : SupportAppScreen() {
override fun getFragment() = ProjectMergeRequestsFragment.create(mrState, scope)
override fun getFragment() = ProjectMilestonesFragment.create(milestoneState)
}
object ProjectFiles : SupportAppScreen() {
override fun getFragment() = ProjectFilesFragment()
}
data class UserFlow(
......@@ -263,4 +273,11 @@ object Screens {
text
)
}
data class MilestoneFlow(
val milestoneId: Long
) : SupportAppScreen() {
//todo: implement milestone flow.
override fun getFragment() = StubFragment()
}
}
\ No newline at end of file
package ru.terrakok.gitlabclient.entity
import com.google.gson.annotations.SerializedName
data class Branch(
@SerializedName("name") val name: String,
@SerializedName("merged") val merged: Boolean,
@SerializedName("protected") val protected: Boolean,
@SerializedName("default") val default: Boolean,
@SerializedName("developers_can_push") val developersCanPush: Boolean,
@SerializedName("developers_can_merge") val developersCanMerge: Boolean,
@SerializedName("can_push") val canPush: Boolean
)
\ No newline at end of file
package ru.terrakok.gitlabclient.entity
/**
* Created by Eugene Shapovalov (@CraggyHaggy) on 04.01.19.
*/
data class Color(
val name: String,
val value: Int
)
\ No newline at end of file
package ru.terrakok.gitlabclient.entity
import com.google.gson.annotations.SerializedName
/**
* @author Maxim Myalkin (MaxMyalkin) on 29.10.2018.
*/
data class Label(
@SerializedName("id") val id: Long,
@SerializedName("name") val name: String,
@SerializedName("color") val color: Color,
@SerializedName("description") val description: String?,
@SerializedName("open_issues_count") val openIssuesCount: Int,
@SerializedName("closed_issues_count") val closedIssuesCount: Int,
@SerializedName("open_merge_requests_count") val openMergeRequestsCount: Int,
@SerializedName("subscribed") val subscribed: Boolean,
@SerializedName("priority") val priority: Int?
)
\ No newline at end of file
......@@ -6,7 +6,7 @@ import org.threeten.bp.LocalDateTime
data class Project(
@SerializedName("id") val id: Long,
@SerializedName("description") val description: String?,
@SerializedName("default_branch") val defaultBranch: String,
@SerializedName("default_branch") val defaultBranch: String?,
@SerializedName("visibility") val visibility: Visibility,
@SerializedName("ssh_url_to_repo") val sshUrlToRepo: String?,
@SerializedName("http_url_to_repo") val httpUrlToRepo: String?,
......
package ru.terrakok.gitlabclient.entity.app
import ru.terrakok.gitlabclient.entity.RepositoryTreeNodeType
/**
* Created by Eugene Shapovalov (@CraggyHaggy) on 02.11.18.
*/
data class ProjectFile(
val id: String,
val name: String,
val nodeType: RepositoryTreeNodeType
)
\ No newline at end of file
package ru.terrakok.gitlabclient.entity.app.session
data class AuthHolder(
val token: String?,
val isOAuth: Boolean
)
\ No newline at end of file
package ru.terrakok.gitlabclient.model.interactor.auth
package ru.terrakok.gitlabclient.entity.app.session
/**
* @author Konstantin Tskhovrebov (aka terrakok) on 25.09.17.
......
package ru.terrakok.gitlabclient.entity.app.session
data class UserAccount(
val userId: Long,
val token: String,
val serverPath: String,
val avatarUrl: String,
val userName: String,
val isOAuth: Boolean
) {
val id: String = "$userId : $serverPath"
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ package ru.terrakok.gitlabclient.entity.app.target
*/
enum class TargetHeaderIcon {
CREATED,
IMPORTED,
JOINED,
COMMENTED,
MERGED,
......
package ru.terrakok.gitlabclient.entity.app.user
import ru.terrakok.gitlabclient.entity.User
/**
* @author Konstantin Tskhovrebov (aka terrakok) on 11.05.17.
*/
data class MyUserInfo(val user: User, val serverName: String)
\ No newline at end of file
......@@ -12,6 +12,8 @@ enum class EventAction(private val jsonName: String) {
COMMENTED_ON("commented on"),
@SerializedName("created")
CREATED("created"),
@SerializedName("imported")
IMPORTED("imported"),
@SerializedName("pushed to")
PUSHED_TO("pushed to"),
@SerializedName("pushed new")
......
......@@ -4,7 +4,7 @@ import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.Assignee
import ru.terrakok.gitlabclient.entity.Author
import ru.terrakok.gitlabclient.entity.Milestone
import ru.terrakok.gitlabclient.entity.milestone.Milestone
data class Issue(
@SerializedName("id") val id: Long,
......
......@@ -3,7 +3,7 @@ package ru.terrakok.gitlabclient.entity.mergerequest
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.Author
import ru.terrakok.gitlabclient.entity.Milestone
import ru.terrakok.gitlabclient.entity.milestone.Milestone
import ru.terrakok.gitlabclient.entity.User
data class MergeRequest(
......
package ru.terrakok.gitlabclient.entity
package ru.terrakok.gitlabclient.entity.milestone
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
......@@ -8,7 +8,7 @@ data class Milestone(
@SerializedName("iid") val iid: Long,
@SerializedName("project_id") val projectId: Long,
@SerializedName("description") val description: String?,
@SerializedName("state") val state: String?,
@SerializedName("state") val state: MilestoneState,
@SerializedName("due_date") val dueDate: String?,
@SerializedName("start_date") val startDate: String?,
@SerializedName("created_at") val createdAt: LocalDateTime?,
......
package ru.terrakok.gitlabclient.entity.milestone
import com.google.gson.annotations.SerializedName
/**
* @author Valentin Logvinovitch (@glvvl) on 22.11.18.
*/
enum class MilestoneState(private val jsonName: String) {
@SerializedName("active")
ACTIVE("active"),
@SerializedName("closed")
CLOSED("closed");
override fun toString() = jsonName
}
......@@ -4,7 +4,7 @@ import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.Assignee
import ru.terrakok.gitlabclient.entity.Author
import ru.terrakok.gitlabclient.entity.Milestone
import ru.terrakok.gitlabclient.entity.milestone.Milestone
/**
* @author Eugene Shapovalov (CraggyHaggy). Date: 13.09.17
......
......@@ -7,6 +7,7 @@ import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.net.Uri
import android.support.annotation.ColorInt
import android.support.annotation.LayoutRes
import android.support.design.widget.Snackbar
import android.support.v4.app.Fragment
......@@ -191,4 +192,9 @@ fun Activity.hideKeyboard() {
}
}
fun Any.objectScopeName() = "${javaClass.simpleName}_${hashCode()}"
\ No newline at end of file
fun Any.objectScopeName() = "${javaClass.simpleName}_${hashCode()}"
fun View.setBackgroundTintByColor(@ColorInt color: Int) {
val wrappedDrawable = DrawableCompat.wrap(background)
DrawableCompat.setTint(wrappedDrawable.mutate(), color)
}
\ No newline at end of file
......@@ -71,11 +71,13 @@ fun EventAction.getHumanName(resources: Resources) = when (this) {
EventAction.COMMENTED_ON -> resources.getString(R.string.event_action_commented_on)
EventAction.JOINED -> resources.getString(R.string.event_action_joined)