Skip to content
Snippets Groups Projects
Commit a5b16b56 authored by John Carlson's avatar John Carlson
Browse files

Merge branch 'develop'

parents 5827bf17 dd71bf11
No related branches found
No related tags found
No related merge requests found
Pipeline #
Showing
with 85 additions and 48 deletions
Change Log
==========
 
Version 2.4.10
----------------------------
- Crash fixes related to fetching accounts
- Fix issue with deleting issues
- Load all the details of a pipeline without the user having to refresh
- Better potential to find the README of a project by loading all the files instead of the first 20
- Fix for files not loading properly when changing to a new branch or tag
Version 2.4.9
----------------------------
 
Loading
Loading
Loading
Loading
@@ -4,7 +4,7 @@ buildscript {
}
 
dependencies {
classpath 'io.fabric.tools:gradle:1.23.0'
classpath 'io.fabric.tools:gradle:1.24.1'
}
}
 
Loading
Loading
@@ -18,7 +18,7 @@ apply plugin: 'io.fabric'
 
def versionMajor = 2
def versionMinor = 4
def versionPatch = 9
def versionPatch = 10
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
 
android {
Loading
Loading
@@ -93,18 +93,19 @@ android {
 
packagingOptions {
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/app_fdroidDebug.kotlin_module'
}
}
 
ext {
supportLibVersion = '26.0.0'
supportLibVersion = '26.0.1'
retrofitVersion = '2.3.0'
okHttpVersion = '3.8.1'
butterknifeVersion = '8.7.0'
butterknifeVersion = '8.8.1'
parcelerVersion = '1.1.9'
reptarVersion = '2.5.0'
reptarVersion = '2.5.1'
adapterLayout = '1.1.1'
materialDialogsVersion = '0.9.4.5'
materialDialogsVersion = '0.9.4.7'
leakCanaryVersion = '1.5'
addendumVersion = '1.4.0'
alakazamVersion = '1.0.1'
Loading
Loading
@@ -150,7 +151,7 @@ dependencies {
 
implementation 'org.greenrobot:eventbus:3.0.0'
 
implementation 'io.reactivex.rxjava2:rxjava:2.1.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.3'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
 
implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.1.0'
Loading
Loading
@@ -199,7 +200,7 @@ dependencies {
 
implementation 'com.github.alorma:diff-textview:1.3.0'
 
implementation 'com.wdullaer:materialdatetimepicker:3.2.2'
implementation 'com.wdullaer:materialdatetimepicker:3.3.0'
 
implementation 'com.github.novoda:simple-chrome-custom-tabs:0.1.5'
 
Loading
Loading
@@ -208,7 +209,7 @@ dependencies {
 
implementation 'de.hdodenhof:circleimageview:2.1.0'
 
implementation('com.vdurmont:emoji-java:3.2.0') {
implementation('com.vdurmont:emoji-java:3.3.0') {
exclude group: 'org.json', module: 'json'
}
 
Loading
Loading
Loading
Loading
@@ -82,6 +82,7 @@ class ActivityActivity : BaseActivity() {
App.bus().unregister(this)
}
 
@Suppress("UNUSED_PARAMETER")
@Subscribe
fun onEvent(event: CloseDrawerEvent) {
drawerLayout.closeDrawers()
Loading
Loading
Loading
Loading
@@ -63,7 +63,7 @@ class AddNewLabelActivity : BaseActivity(), ColorChooserDialog.ColorCallback {
// Pass AppCompatActivity which implements ColorCallback, along with the textTitle of the dialog
ColorChooserDialog.Builder(this, R.string.add_new_label_choose_color)
.preselect(chosenColor)
.show()
.show(this)
}
 
override fun onCreate(savedInstanceState: Bundle?) {
Loading
Loading
Loading
Loading
@@ -167,11 +167,13 @@ class GroupsActivity : BaseActivity() {
})
}
 
@Suppress("UNUSED_PARAMETER")
@Subscribe
fun onEvent(event: CloseDrawerEvent) {
drawerLayout.closeDrawers()
}
 
@Suppress("UNUSED_PARAMETER")
@Subscribe
fun onEvent(event: ReloadDataEvent) {
load()
Loading
Loading
Loading
Loading
@@ -32,6 +32,7 @@ import com.commit451.gitlab.model.api.Issue
import com.commit451.gitlab.model.api.Note
import com.commit451.gitlab.model.api.Project
import com.commit451.gitlab.navigation.Navigator
import com.commit451.gitlab.rx.CustomCompleteObserver
import com.commit451.gitlab.rx.CustomResponseSingleObserver
import com.commit451.gitlab.rx.CustomSingleObserver
import com.commit451.gitlab.util.IntentUtil
Loading
Loading
@@ -122,7 +123,7 @@ class IssueActivity : BaseActivity() {
R.id.action_delete -> {
App.get().gitLab.deleteIssue(project!!.id, issue!!.iid)
.setup(bindToLifecycle())
.subscribe(object : CustomSingleObserver<String>() {
.subscribe(object : CustomCompleteObserver() {
 
override fun error(t: Throwable) {
Timber.e(t)
Loading
Loading
@@ -130,7 +131,7 @@ class IssueActivity : BaseActivity() {
.show()
}
 
override fun success(s: String) {
override fun complete() {
App.bus().post(IssueReloadEvent())
Toast.makeText(this@IssueActivity, R.string.issue_deleted, Toast.LENGTH_SHORT)
.show()
Loading
Loading
@@ -144,11 +145,11 @@ class IssueActivity : BaseActivity() {
}
 
@OnClick(R.id.fab_edit_issue)
fun onEditIssueClick(fab: View) {
fun onEditIssueClick() {
val project = project
val issue = issue
if (project != null && issue != null) {
Navigator.navigateToEditIssue(this@IssueActivity, fab, project, issue)
Navigator.navigateToEditIssue(this@IssueActivity, project, issue)
}
}
 
Loading
Loading
@@ -260,7 +261,7 @@ class IssueActivity : BaseActivity() {
textTitle.text = issue?.title
toolbarTitle.text = getString(R.string.issue_number, issue?.iid)
if (issue?.isConfidential!!) {
toolbarTitle.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_confidential_24dp, 0)
toolbarTitle.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_visibility_off_white_24dp, 0)
}
adapterIssueDetails.updateIssue(issue!!)
}
Loading
Loading
Loading
Loading
@@ -75,8 +75,7 @@ class LoginActivity : BaseActivity() {
 
@BindView(R.id.root) lateinit var root: View
@BindView(R.id.toolbar) lateinit var toolbar: Toolbar
@BindView(R.id.url_hint) lateinit var textInputLayoutUrl: TextInputLayout
@BindView(R.id.url_input) lateinit var textUrl: TextView
@BindView(R.id.text_input_layout_server) lateinit var textInputLayoutUrl: TextInputLayout
@BindView(R.id.user_input_hint) lateinit var textInputLayoutUser: TextInputLayout
@BindView(R.id.user_input) lateinit var textUser: EditText
@BindView(R.id.password_hint) lateinit var textInputLayoutPassword: TextInputLayout
Loading
Loading
@@ -197,7 +196,7 @@ class LoginActivity : BaseActivity() {
toolbar.setNavigationOnClickListener { onBackPressed() }
}
 
textUrl.setText(R.string.url_gitlab)
textInputLayoutUrl.editText?.setText(R.string.url_gitlab)
}
 
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
Loading
Loading
@@ -292,7 +291,7 @@ class LoginActivity : BaseActivity() {
}
 
fun verifyUrl(): Boolean {
val url = textUrl.text.toString()
val url = textInputLayoutUrl.text()
var uri: Uri? = null
try {
if (HttpUrl.parse(url) != null) {
Loading
Loading
Loading
Loading
@@ -85,7 +85,7 @@ class MilestoneActivity : BaseActivity() {
 
@OnClick(R.id.edit)
fun onEditClicked(fab: View) {
Navigator.navigateToEditMilestone(this@MilestoneActivity, fab, project, milestone)
Navigator.navigateToEditMilestone(this@MilestoneActivity, project, milestone)
}
 
override fun onCreate(savedInstanceState: Bundle?) {
Loading
Loading
Loading
Loading
@@ -74,6 +74,7 @@ class ProjectsActivity : BaseActivity() {
}
}
 
@Suppress("UNUSED_PARAMETER")
@Subscribe
fun onEvent(event: CloseDrawerEvent) {
drawerLayout.closeDrawers()
Loading
Loading
Loading
Loading
@@ -4,6 +4,7 @@ import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.widget.Toast
import com.commit451.gitlab.App
import com.commit451.gitlab.R
import com.commit451.gitlab.data.Prefs
import com.commit451.gitlab.navigation.DeepLinker
Loading
Loading
@@ -60,7 +61,7 @@ class RoutingActivity : BaseActivity() {
override fun onRouteUnknown(uri: Uri?) {
Timber.d("Route unknown. Opening original Uri if it exists")
if (originalUri != null) {
IntentUtil.openPage(this@RoutingActivity, uri!!.toString())
IntentUtil.openPage(this@RoutingActivity, uri!!.toString(), App.get().currentAccount)
} else {
Toast.makeText(this@RoutingActivity, R.string.deeplink_navigate_error, Toast.LENGTH_SHORT)
.show()
Loading
Loading
Loading
Loading
@@ -49,7 +49,7 @@ class SettingsActivity : BaseActivity() {
}
 
bindPrefs()
switchRequireAuth.setOnCheckedChangeListener { compoundButton, b ->
switchRequireAuth.setOnCheckedChangeListener { _, b ->
Prefs.isRequiredDeviceAuth = b
}
}
Loading
Loading
Loading
Loading
@@ -66,6 +66,7 @@ class TodosActivity : BaseActivity() {
return true
}
 
@Suppress("UNUSED_PARAMETER")
@Subscribe
fun onEvent(event: CloseDrawerEvent) {
drawerLayout.closeDrawers()
Loading
Loading
Loading
Loading
@@ -3,6 +3,7 @@ package com.commit451.gitlab.api
import com.commit451.gitlab.api.request.SessionRequest
import com.commit451.gitlab.api.response.FileUploadResponse
import com.commit451.gitlab.model.api.*
import io.reactivex.Completable
import io.reactivex.Single
import okhttp3.MultipartBody
import retrofit2.Response
Loading
Loading
@@ -17,6 +18,7 @@ interface GitLabService {
 
companion object {
const val API_VERSION = "api/v4"
const val MAX_TREE_PER_PAGE = "100"
}
 
/* --- LOGIN --- */
Loading
Loading
@@ -77,7 +79,7 @@ interface GitLabService {
 
@DELETE(API_VERSION + "/groups/{id}/members/{user_id}")
fun removeGroupMember(@Path("id") groupId: Long,
@Path("user_id") userId: Long): Single<String>
@Path("user_id") userId: Long): Completable
 
/* --- PROJECTS --- */
 
Loading
Loading
@@ -124,10 +126,10 @@ interface GitLabService {
 
@DELETE(API_VERSION + "/projects/{id}/members/{user_id}")
fun removeProjectMember(@Path("id") projectId: Long,
@Path("user_id") userId: Long): Single<String>
@Path("user_id") userId: Long): Completable
 
@POST(API_VERSION + "/projects/{id}/fork")
fun forkProject(@Path("id") projectId: Long): Single<String>
fun forkProject(@Path("id") projectId: Long): Completable
 
@POST(API_VERSION + "/projects/{id}/star")
fun starProject(@Path("id") projectId: Long): Single<Response<Project>>
Loading
Loading
@@ -144,7 +146,7 @@ interface GitLabService {
 
@GET(API_VERSION + "/projects/{id}/milestones")
fun getMilestones(@Path("id") projectId: Long,
@Query("state") state: String): Single<Response<List<Milestone>>>
@Query("state") state: String?): Single<Response<List<Milestone>>>
 
@GET
fun getMilestones(@Url url: String): Single<Response<List<Milestone>>>
Loading
Loading
@@ -279,7 +281,7 @@ interface GitLabService {
 
@DELETE(API_VERSION + "/projects/{id}/issues/{issue_iid}")
fun deleteIssue(@Path("id") projectId: Long,
@Path("issue_iid") issueIid: Long): Single<String>
@Path("issue_iid") issueIid: Long): Completable
 
/* --- REPOSITORY --- */
 
Loading
Loading
@@ -289,9 +291,9 @@ interface GitLabService {
@GET(API_VERSION + "/projects/{id}/repository/contributors")
fun getContributors(@Path("id") projectId: String): Single<List<Contributor>>
 
@GET(API_VERSION + "/projects/{id}/repository/tree")
@GET(API_VERSION + "/projects/{id}/repository/tree?per_page=" + MAX_TREE_PER_PAGE)
fun getTree(@Path("id") projectId: Long,
@Query("ref_name") branchName: String?,
@Query("ref") ref: String?,
@Query("path") path: String?): Single<List<RepositoryTreeObject>>
 
@GET(API_VERSION + "/projects/{id}/repository/files/{file_path}")
Loading
Loading
Loading
Loading
@@ -5,9 +5,9 @@ import com.commit451.gitlab.model.api.Build
import com.commit451.gitlab.model.api.Project
 
fun Build.getRawBuildUrl(baseUrl: String, project: Project): String {
return baseUrl + project.pathWithNamespace + "/builds/" + id + "/raw"
return baseUrl + project.pathWithNamespace + "/-/jobs/" + id + "/raw"
}
 
fun Build.getDownloadBuildUrl(baseUrl: String, project: Project): String {
return baseUrl + GitLabService.API_VERSION + "/projects/" + project.id + "/builds/" + id + "/artifacts"
return baseUrl + GitLabService.API_VERSION + "/projects/" + project.id + "/jobs/" + id + "/artifacts"
}
package com.commit451.gitlab.extension
import com.commit451.reptar.kotlin.fromIoToMainThread
import com.trello.rxlifecycle2.LifecycleTransformer
import io.reactivex.Completable
fun Completable.setup(transformer: LifecycleTransformer<Any>): Completable {
return this.compose(transformer).fromIoToMainThread()
}
Loading
Loading
@@ -4,6 +4,7 @@ import android.os.Build
import android.text.Html
import android.text.Spanned
import android.util.Base64
import com.commit451.gitlab.model.Account
import io.reactivex.Single
 
fun String.base64Decode(): Single<ByteArray> {
Loading
Loading
@@ -23,3 +24,10 @@ fun String.formatAsHtml(imageGetter: Html.ImageGetter? = null, tagHandler: Html.
return Html.fromHtml(this, imageGetter, tagHandler)
}
}
fun String.resolveUrl(account: Account): String {
if (startsWith("/")){
return account.serverUrl + this.replaceFirst("/", "")
}
return this
}
Loading
Loading
@@ -38,6 +38,8 @@ open class BaseFragment : RxFragment() {
}
 
inner class EventReceiver {
@Suppress("unused", "UNUSED_PARAMETER")
@Subscribe
fun onReloadData(event: ReloadDataEvent) {
loadData()
Loading
Loading
Loading
Loading
@@ -52,7 +52,7 @@ class FilesFragment : ButterKnifeFragment() {
lateinit var adapterBreadcrumb: BreadcrumbAdapter
 
var project: Project? = null
var branchName: String? = null
lateinit var ref: String
var currentPath = ""
 
val filesAdapterListener = object : FileAdapter.Listener {
Loading
Loading
@@ -62,25 +62,25 @@ class FilesFragment : ButterKnifeFragment() {
 
override fun onFileClicked(treeItem: RepositoryTreeObject) {
val path = currentPath + treeItem.name
Navigator.navigateToFile(activity, project!!.id, path, branchName!!)
Navigator.navigateToFile(activity, project!!.id, path, ref)
}
 
override fun onCopyClicked(treeItem: RepositoryTreeObject) {
val clipboard = activity.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
 
// Creates a new text clip to put on the clipboard
val clip = ClipData.newPlainText(treeItem.name, treeItem.getUrl(project!!, branchName!!, currentPath).toString())
val clip = ClipData.newPlainText(treeItem.name, treeItem.getUrl(project!!, ref, currentPath).toString())
clipboard.primaryClip = clip
Snackbar.make(root, R.string.copied_to_clipboard, Snackbar.LENGTH_SHORT)
.show()
}
 
override fun onShareClicked(treeItem: RepositoryTreeObject) {
IntentUtil.share(view!!, treeItem.getUrl(project!!, branchName!!, currentPath))
IntentUtil.share(view!!, treeItem.getUrl(project!!, ref, currentPath))
}
 
override fun onOpenInBrowserClicked(treeItem: RepositoryTreeObject) {
IntentUtil.openPage(activity as BaseActivity, treeItem.getUrl(project!!, branchName!!, currentPath).toString())
IntentUtil.openPage(activity as BaseActivity, treeItem.getUrl(project!!, ref, currentPath).toString(), App.get().currentAccount)
}
}
 
Loading
Loading
@@ -91,8 +91,6 @@ class FilesFragment : ButterKnifeFragment() {
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
 
App.bus().register(this)
adapterFiles = FileAdapter(filesAdapterListener)
list.layoutManager = LinearLayoutManager(activity)
list.addItemDecoration(DividerItemDecoration(activity))
Loading
Loading
@@ -106,11 +104,13 @@ class FilesFragment : ButterKnifeFragment() {
 
if (activity is ProjectActivity) {
project = (activity as ProjectActivity).project
branchName = (activity as ProjectActivity).getRefRef()
ref = (activity as ProjectActivity).getRefRef()!!
loadData("")
} else {
throw IllegalStateException("Incorrect parent activity")
}
App.bus().register(this)
}
 
override fun onBackPressed(): Boolean {
Loading
Loading
@@ -131,22 +131,20 @@ class FilesFragment : ButterKnifeFragment() {
}
 
override fun loadData() {
loadData(currentPath)
}
 
fun loadData(newPath: String) {
if (view == null) {
return
}
 
if (project == null || branchName.isNullOrEmpty()) {
if (project == null || ref.isNullOrEmpty()) {
swipeRefreshLayout.isRefreshing = false
return
}
 
swipeRefreshLayout.isRefreshing = true
 
App.get().gitLab.getTree(project!!.id, branchName!!, newPath)
App.get().gitLab.getTree(project!!.id, ref, newPath)
.setup(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
.subscribe(object : CustomSingleObserver<List<RepositoryTreeObject>>() {
 
Loading
Loading
@@ -209,10 +207,11 @@ class FilesFragment : ButterKnifeFragment() {
}
 
 
@Suppress("unused")
@Subscribe
fun onProjectReload(event: ProjectReloadEvent) {
project = event.project
branchName = event.branchName
ref = event.branchName
 
loadData("")
}
Loading
Loading
Loading
Loading
@@ -24,8 +24,8 @@ import com.commit451.gitlab.extension.setup
import com.commit451.gitlab.model.api.Group
import com.commit451.gitlab.model.api.User
import com.commit451.gitlab.navigation.Navigator
import com.commit451.gitlab.rx.CustomCompleteObserver
import com.commit451.gitlab.rx.CustomResponseSingleObserver
import com.commit451.gitlab.rx.CustomSingleObserver
import com.commit451.gitlab.util.LinkHeaderParser
import com.commit451.gitlab.viewHolder.ProjectMemberViewHolder
import com.trello.rxlifecycle2.android.FragmentEvent
Loading
Loading
@@ -84,7 +84,7 @@ class GroupMembersFragment : ButterKnifeFragment() {
this@GroupMembersFragment.member = member
App.get().gitLab.removeGroupMember(group.id, member.id)
.setup(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
.subscribe(object : CustomSingleObserver<String>() {
.subscribe(object : CustomCompleteObserver() {
 
override fun error(e: Throwable) {
Timber.e(e)
Loading
Loading
@@ -92,7 +92,7 @@ class GroupMembersFragment : ButterKnifeFragment() {
.show()
}
 
override fun success(value: String) {
override fun complete() {
adapterGroupMembers.removeMember(this@GroupMembersFragment.member!!)
}
})
Loading
Loading
Loading
Loading
@@ -220,6 +220,7 @@ class IssuesFragment : ButterKnifeFragment() {
adapterIssue.updateIssue(event.issue)
}
 
@Suppress("UNUSED_PARAMETER")
@Subscribe
fun onEvent(event: IssueReloadEvent) {
loadData()
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment