Skip to content

Conversation

iAmEben
Copy link
Contributor

@iAmEben iAmEben commented Jul 11, 2025

Description

This pull request introduces real-time Bluetooth state monitoring to the OnboardingFlowScreen composable in MainActivity. The feature ensures the UI updates dynamically when the user enables or disables Bluetooth, enhancing the onboarding experience by providing immediate feedback and seamless progression through the onboarding flow.

Key Changes

1. New monitorBluetoothState Function in BluetoothStatusManager:
Registers a BroadcastReceiver for BluetoothAdapter.ACTION_STATE_CHANGED.
Updates bluetoothStatus and calls BluetoothStatusManager.handleBluetoothStatus on state changes.
Returns BroadcastReceiver for unregistration.

2. Updated OnboardingFlowScreen Composable:
Uses monitorBluetoothState in a DisposableEffect to manage the receiver lifecycle.
Adds callbacks (onBluetoothStatusChange, onStateChange, onBluetoothLoadingChange) to update state reactively.
Auto-calls checkBluetoothAndProceed when Bluetooth is enabled in BLUETOOTH_CHECK state.

Before

Screenrecorder-2025-07-11-10-39-06-608.mp4

After

Screenrecorder-2025-07-11-10-43-39-469.mp4

Motivation

Previously, BluetoothCheckScreen required manual retries to detect Bluetooth state changes. Real-time monitoring ensures immediate UI updates and automatic progression when Bluetooth is enabled, enhancing UX.

Please review and provide feedback!

@callebtc
Copy link
Collaborator

love this PR thank you

@iAmEben
Copy link
Contributor Author

iAmEben commented Jul 11, 2025

love this PR thank you

You're welcome, looking to put out more PR

@callebtc callebtc added the enhancement New feature or request label Jul 11, 2025
@iAmEben iAmEben closed this Jul 13, 2025
@iAmEben iAmEben reopened this Jul 13, 2025
@@ -0,0 +1,33 @@
package com.bitchat.android.ui

import androidx.compose.foundation.layout.Row
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where is this file used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to improve the user experience after onboarding. Currently, when users turn off their Bluetooth, they’re redirected back to the BluetoothCheckScreen. Instead, I’d like to display a banner at the top of the chat screen indicating that Bluetooth is turned off. This way, users can still view their messages while being informed of the issue. The banner should automatically disappear once Bluetooth is turned back on. Its for a different PR, obviously cause this PR was closed so it got added, not sure

@callebtc
Copy link
Collaborator

It looks like there is an unused file in the PR.

I have a small change request, if you agree:

when I'm in the app, and I turn of bluetooth, I see the "bitchat wants to turn on bluetooth" toggle [1] instead of the user the "bluetooth required" screen [2]. only pressing the "enable bluetooth" button should show the toggle IMO.

[1]
image
[2]
image

@iAmEben
Copy link
Contributor Author

iAmEben commented Jul 13, 2025

It looks like there is an unused file in the PR.

I have a small change request, if you agree:

when I'm in the app, and I turn of bluetooth, I see the "bitchat wants to turn on bluetooth" toggle [1] instead of the user the "bluetooth required" screen [2]. only pressing the "enable bluetooth" button should show the toggle IMO.

[1] image [2] image

I'm not sure I got that correctly, can you explain that again?

@iAmEben
Copy link
Contributor Author

iAmEben commented Jul 14, 2025

So I took my time to read your message again and again, I think what you're trying to say is that you don't want the dialog that shows up saying 'bitchat wants to to turn on bluetooth" instead it should be the BluetoothCheckScreen composable, which when the user clicks on the enable button should then trigger the alert that "Bitchat wants to turn on Bluetooth"
I will look into that and maybe make a pull request. But what do you think of my suggested feature, do I just keep it to the BluetoothCheckScreen?

@iAmEben
Copy link
Contributor Author

iAmEben commented Jul 14, 2025

Update: Bluetooth no longer auto triggers. It works only on button press.

Before:

Screenrecorder-2025-07-14-15-57-12-966.mp4

After:

Screenrecorder-2025-07-14-15-58-02-664.mp4

Please review and let me know your thoughts.

@callebtc
Copy link
Collaborator

callebtc commented Aug 5, 2025

awesome, appreciate that you've made the requested changes and sorry for the delay!

@callebtc callebtc merged commit a0d1c6f into permissionlesstech:main Aug 5, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants