Skip to content

Commit

Permalink
fix: provider dd
Browse files Browse the repository at this point in the history
  • Loading branch information
wiiznokes committed Jul 3, 2024
1 parent 4f549c4 commit 81b801a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
14 changes: 7 additions & 7 deletions app/src/main/java/io/github/wiiznokes/gitnote/ui/model/Init.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ interface ProviderLink {
val mainPage: String?
val createRepo: String?
val createToken: String?
val checkOutRepo: String?
val listRepo: String?
}

enum class Provider : ProviderLink {
GitHub {
override val mainPage: String = "https://github.com/"
override val createRepo: String = "https://github.com/new"
override val createToken: String = "https://github.com/settings/tokens"
override val checkOutRepo: String? = null
override val listRepo: String? = null
},
Other {
override val mainPage: String? = null
override val createRepo: String? = null
override val createToken: String? = null
override val checkOutRepo: String? = null
GitLab {
override val mainPage: String = "https://gitlab.com/"
override val createRepo: String = "https://gitlab.com/projects/new#blank_project"
override val createToken: String = "https://gitlab.com/-/user_settings/personal_access_tokens"
override val listRepo: String = "https://gitlab.com/dashboard/projects"
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ private fun OpenLinks(
Text(text = it.name)
},
onClick = {
providerExpanded = false
provider.value = it
vm.viewModelScope.launch {
vm.prefs.provider.update(it)
Expand All @@ -164,39 +165,32 @@ private fun OpenLinks(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(5.dp)
) {

provider.value.mainPage?.let {
provider.value.listRepo?.let {
OpenLinkButton(
text = stringResource(R.string.quick_links_home_page),
text = stringResource(R.string.quick_links_see_repos),
url = it
)
}

provider.value.createRepo?.let {
provider.value.createToken?.let {
OpenLinkButton(
text = stringResource(R.string.quick_links_create_repo),
text = stringResource(R.string.quick_links_create_token),
url = it
)
}

provider.value.createToken?.let {
provider.value.createRepo?.let {
OpenLinkButton(
text = stringResource(R.string.quick_links_create_token),
text = stringResource(R.string.quick_links_create_repo),
url = it
)
}

provider.value.checkOutRepo?.let {
provider.value.mainPage?.let {
OpenLinkButton(
text = stringResource(R.string.quick_links_see_repos),
text = stringResource(R.string.quick_links_home_page),
url = it
)
}
}

}


}
}
}
Expand All @@ -217,8 +211,7 @@ private fun ElevatedCard(
modifier = Modifier
.fillMaxWidth()
.padding(
vertical = 20.dp,
horizontal = 15.dp
vertical = 20.dp, horizontal = 15.dp
),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(10.dp)
Expand Down

0 comments on commit 81b801a

Please sign in to comment.