Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds screen to list usable channels #29

Merged
merged 3 commits into from Nov 11, 2022
Merged

Adds screen to list usable channels #29

merged 3 commits into from Nov 11, 2022

Conversation

ConorOkus
Copy link
Owner

This adds a screen to list all the usable channels and the available balance.

The logic for the balance/progress bar is not quite right (will update)

Screenshot 2022-11-09 at 23 37 44

Copy link
Collaborator

@thunderbiscuit thunderbiscuit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, I just had some small comments/nits. Also think it might need a rebase to pick up the latest 9be0033 commit.

@@ -180,7 +170,7 @@ object LDKBroadcaster : BroadcasterInterface.BroadcasterInterfaceInterface {
val service = Service.create()

tx?.let {
GlobalScope.launch {
CoroutineScope(Dispatchers.IO).launch {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that's the better way to do it for sure.

@@ -29,14 +29,7 @@ interface Access {

companion object {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might be able to do without the create() method in the interface, and simply create an AccessImpl object directly at the call-site.

For example if you remove the companion object entirely, the one call to the AccessImpl is in WalletScreen and would become

onClick = {
    CoroutineScope(Dispatchers.IO).launch {
        // Access.create().sync()
        AccessImpl().sync()
    }
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or you could create the object above and simply reuse it every time you sync instead of creating a new one every time.

@Composable
fun WalletScreen() {
    val accessImpl = AccessImpl()
// ...
onClick = {
    CoroutineScope(Dispatchers.IO).launch {
        accessImpl.sync()
    }
}

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in c446025

@@ -7,5 +7,6 @@ sealed class Screen(val route: String) {
object ListPeersScreen : Screen("list_peers")
object ConnectPeerScreen : Screen("connect_peer")
object OpenChannelScreen : Screen("open_channel")
object ListChannelsScreen: Screen("list_channels")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit, but by convention when an object is extending an interface or another class the colon is separated by a space (ListChannelsScreen : Screen) as opposed to when it's used to declare a variable type or function return type (val age: Int)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 3ad40d6

@ConorOkus ConorOkus merged commit 05e361b into master Nov 11, 2022
@ConorOkus ConorOkus deleted the 07_list_channels branch November 11, 2022 15:40
@ConorOkus ConorOkus restored the 07_list_channels branch November 11, 2022 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants