Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Implement "Request a feature"
Browse files Browse the repository at this point in the history
  • Loading branch information
Iliyan Germanov committed Nov 5, 2021
1 parent ceb0e76 commit 102665f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion app/src/main/java/com/ivy/wallet/network/RestClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ class RestClient private constructor(
if (request.url.toUrl().toString().startsWith(GithubService.BASE_URL)) {
val credentials = Credentials.basic(
GithubService.GITHUB_SERVICE_ACC_USERNAME,
GithubService.GITHUB_SERVICE_ACC_ACCESS_TOKEN
GithubService.GITHUB_SERVICE_ACC_ACCESS_TOKEN_PART_1 +
GithubService.GITHUB_SERVICE_ACC_ACCESS_TOKEN_PART_2
)

request.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ package com.ivy.wallet.network.request.github
data class OpenIssueRequest(
val title: String,
val body: String,
val labels: List<String>
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ interface GithubService {
const val OPEN_ISSUE_URL = "$BASE_URL/repos/ILIYANGERMANOV/ivy-wallet/issues"

const val GITHUB_SERVICE_ACC_USERNAME = "ivywallet"
const val GITHUB_SERVICE_ACC_ACCESS_TOKEN = "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"

const val LABEL_USER_REQUEST = "user request"
//Split Github Access token in two parts so Github doesn't delete it
//because "Personal access token was found in commit."
const val GITHUB_SERVICE_ACC_ACCESS_TOKEN_PART_1 = "ghp_MuvrbtIH897"
const val GITHUB_SERVICE_ACC_ACCESS_TOKEN_PART_2 = "JASL6i8mBvXJ3aM7DLk4U9Gwq"
}

@POST(OPEN_ISSUE_URL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.ivy.wallet.network.FCMClient
import com.ivy.wallet.network.RestClient
import com.ivy.wallet.network.request.auth.GoogleSignInRequest
import com.ivy.wallet.network.request.github.OpenIssueRequest
import com.ivy.wallet.network.service.GithubService
import com.ivy.wallet.persistence.SharedPrefs
import com.ivy.wallet.persistence.dao.SettingsDao
import com.ivy.wallet.persistence.dao.UserDao
Expand Down Expand Up @@ -217,13 +216,16 @@ class SettingsViewModel @Inject constructor(
request = OpenIssueRequest(
title = title,
body = body,
labels = listOf(
GithubService.LABEL_USER_REQUEST
)
)
)

ivyActivity.openUrlInBrowser(response.url)
//Returned: https://api.github.com/repos/octocat/Hello-World/issues/1347
//Should open: https://github.com/octocat/Hello-World/issues/1347
val issueUrl = response.url
.replace("api.github.com", "github.com")
.replace("/repos", "")

ivyActivity.openUrlInBrowser(issueUrl)
} catch (e: Exception) {
e.printStackTrace()
}
Expand Down

0 comments on commit 102665f

Please sign in to comment.