-
Notifications
You must be signed in to change notification settings - Fork 2
feat: connection issues view #878
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
Open
jvsena42
wants to merge
25
commits into
master
Choose a base branch
from
feat/connection-issues-view
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
9604817
feat: ConnectionIssuesView
jvsena42 b93d729
feat: display connection issues view
jvsena42 1671051
fix: circle alignment
jvsena42 61e0371
fix: circle color and fading
jvsena42 e60c9fb
chore: lint
jvsena42 aaa3d8d
fix: gradient color
jvsena42 9f3c1f9
feat: display connection issues screen in transfer flows
jvsena42 46f955f
refactor: remove unnecessary parameter
jvsena42 e81a4ff
Merge branch 'feat/send-v60' into feat/connection-issues-view
jvsena42 a5fde6d
fix: re-trigger updateLimits when switch to online
jvsena42 4f9c6df
Merge branch 'feat/send-v60' into feat/connection-issues-view
jvsena42 70f1112
fix: not populated LN balance on canSend fallback
jvsena42 db7d466
fix: add spacer
jvsena42 8b11ea7
fix: fallback to cached balance for validation when channels are loading
jvsena42 5f3da5c
fix: isFirstEmission check
jvsena42 eec1e8e
fix: await for peer connection before try to close
jvsena42 49167e1
Merge branch 'feat/send-v60' into feat/connection-issues-view
jvsena42 20154dc
doc: changelog entry
jvsena42 4e7e2a2
chore: lint
jvsena42 0136e97
merge: feat/send-v60 into feat/connection-issues-view
jvsena42 5caf2b3
doc: consolidate changelog entries
jvsena42 ef540ab
Merge branch 'feat/send-v60' into feat/connection-issues-view
jvsena42 e3d6b4f
Update app/src/main/java/to/bitkit/ui/components/ConnectionIssuesView.kt
jvsena42 2c417d5
Merge branch 'feat/send-v60' into feat/connection-issues-view
jvsena42 ecdb66b
Merge branch 'master' into feat/connection-issues-view
jvsena42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
app/src/main/java/to/bitkit/ui/components/ConnectionIssuesView.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| package to.bitkit.ui.components | ||
|
|
||
| import androidx.compose.foundation.Canvas | ||
| import androidx.compose.foundation.Image | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.navigationBarsPadding | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.geometry.Offset | ||
| import androidx.compose.ui.graphics.Brush | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.graphics.PathEffect | ||
| import androidx.compose.ui.graphics.drawscope.DrawScope | ||
| import androidx.compose.ui.graphics.drawscope.Stroke | ||
| import androidx.compose.ui.layout.ContentScale | ||
| import androidx.compose.ui.platform.testTag | ||
| import androidx.compose.ui.res.painterResource | ||
| import androidx.compose.ui.res.stringResource | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import to.bitkit.R | ||
| import to.bitkit.ui.scaffold.SheetTopBar | ||
| import to.bitkit.ui.shared.util.gradientBackground | ||
| import to.bitkit.ui.theme.AppThemeSurface | ||
| import to.bitkit.ui.theme.Colors | ||
| import to.bitkit.ui.utils.withAccent | ||
|
|
||
| @Composable | ||
| fun ConnectionIssuesView( | ||
| titleText: String, | ||
| modifier: Modifier = Modifier, | ||
| ) { | ||
| Column( | ||
| modifier = modifier | ||
| .fillMaxSize() | ||
| .gradientBackground() | ||
| .navigationBarsPadding() | ||
| .padding(horizontal = 16.dp) | ||
| .testTag("ConnectionIssueView"), | ||
| ) { | ||
| SheetTopBar(titleText = titleText) | ||
| VerticalSpacer(24.dp) | ||
|
|
||
| Box( | ||
| contentAlignment = Alignment.Center, | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .weight(1f), | ||
| ) { | ||
| DashedRingsLayer(outerOnly = true) | ||
|
|
||
| Image( | ||
| painter = painterResource(R.drawable.phone), | ||
| contentDescription = null, | ||
| contentScale = ContentScale.Fit, | ||
| modifier = Modifier | ||
| .size(311.dp) | ||
| .align(Alignment.Center), | ||
| ) | ||
|
|
||
| DashedRingsLayer(outerOnly = false) | ||
| } | ||
|
|
||
| Display( | ||
| text = stringResource(R.string.other__connection_issues_title) | ||
| .withAccent(accentColor = Colors.Yellow), | ||
| modifier = Modifier.fillMaxWidth() | ||
| ) | ||
|
|
||
| VerticalSpacer(8.dp) | ||
|
|
||
| BodyM( | ||
| text = stringResource(R.string.other__connection_issues_explain), | ||
| color = Colors.White64, | ||
| modifier = Modifier.fillMaxWidth(), | ||
| ) | ||
|
|
||
| VerticalSpacer(24.dp) | ||
|
|
||
| Box( | ||
| contentAlignment = Alignment.Center, | ||
| modifier = Modifier.fillMaxWidth(), | ||
| ) { | ||
| GradientCircularProgressIndicator( | ||
| strokeWidth = 1.dp, | ||
| modifier = Modifier.size(32.dp), | ||
| ) | ||
| } | ||
|
|
||
| VerticalSpacer(16.dp) | ||
| } | ||
| } | ||
|
|
||
| private val outerRingRadii = listOf(200f) | ||
| private val innerRingRadii = listOf(150f, 100f, 50f) | ||
|
|
||
| @Composable | ||
| private fun DashedRingsLayer(outerOnly: Boolean, modifier: Modifier = Modifier) { | ||
| val radii = if (outerOnly) outerRingRadii else innerRingRadii | ||
| Canvas(modifier = modifier.fillMaxSize()) { | ||
| val center = Offset(size.width * 0.25f, size.height * 0.40f) | ||
| radii.forEach { radiusDp -> drawDashedGradientRing(radiusDp, center) } | ||
| } | ||
| } | ||
|
|
||
| private fun DrawScope.drawDashedGradientRing(radiusDp: Float, center: Offset) { | ||
| val radius = radiusDp.dp.toPx() | ||
| val brush = Brush.linearGradient( | ||
| colors = listOf(Color.Black, Colors.Yellow), | ||
| start = Offset(center.x - radius, center.y - radius), | ||
| end = Offset(center.x + radius, center.y + radius), | ||
| ) | ||
| drawCircle( | ||
| brush = brush, | ||
| radius = radius, | ||
| center = center, | ||
| style = Stroke( | ||
| width = 1.dp.toPx(), | ||
| pathEffect = PathEffect.dashPathEffect( | ||
| floatArrayOf(8.dp.toPx(), 6.dp.toPx()), | ||
| ), | ||
| ), | ||
| ) | ||
| } | ||
|
|
||
| @Preview(showSystemUi = true) | ||
| @Composable | ||
| private fun Preview() { | ||
| AppThemeSurface { | ||
| BottomSheetPreview { | ||
| ConnectionIssuesView(titleText = "Send Bitcoin") | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.