Skip to content

Conversation

yet300
Copy link
Contributor

@yet300 yet300 commented Aug 22, 2025

This pr merged with my last pr(#236)

Description

This pull request modernizes the application's user interface and navigation by implementing two key Android features: Edge-to-Edge display and Predictive Back gestures.

As part of this effort, the ChatScreen has been significantly refactored to use the Material 3 Scaffold component. This simplifies the layout structure, improves maintainability, and aligns the codebase with modern Jetpack Compose best practices.

Key Changes:

  1. Edge-to-Edge UI Implementation
    The app now draws behind the system status and navigation bars, creating a more immersive, seamless, and modern look.
    enableEdgeToEdge() is called in MainActivity to activate the feature.
    WindowInsets are now correctly handled throughout the ChatScreen using modifiers like .navigationBarsPadding and .statusBarsPadding to prevent critical UI elements from being obscured by system bars. The keyboard is also handled gracefully with .imePadding.
  2. Predictive Back Gesture Support (Android 13+)
    Added support for the predictive back gesture to provide users with a fluid and intuitive navigation experience. Users can now "peek" at the previous screen before fully committing to the back action.
    Enabled the feature globally by setting android:windowEnableOnBackInvokedCallback to true in the app's theme.
    The OnBackPressedCallback in MainActivity was updated to handle the new handleOnBackStarted, handleOnBackProgressed, and handleOnBackCancelled events.
    These gesture events are propagated to the ChatViewModel, which now manages the back gesture state.
    The ChatScreen observes this state and animates its scale and position based on the gesture's progress, providing clear visual feedback to the user.
  3. Refactoring ChatScreen to use Scaffold
    The main layout of the ChatScreen has been refactored from a custom Box and Column structure to a standard Material 3 Scaffold.
    Benefits:
    Simplifies layout logic by using standard slots like topBar and bottomBar for the header and input sections.
    Improves the handling of WindowInsets and keyboard visibility, as Scaffold manages content padding automatically.
    Reduces boilerplate code and makes the component hierarchy easier to understand and maintain.

##Supported Languages
AI - translate with AI
Native - verified by a native speaker

  • en: English -- Native
  • ru: Русский (Russian) -- AI
  • uk: Українська (Ukrainian) -- AI
  • be: Беларуская (Belarusian) -- AI
  • tr: Türkçe (Turkish) -- AI
  • kk: Қазақша (Kazakh) -- AI
  • ka: ქართული (Georgian) -- AI
  • ar: العربية (Arabic) -- AI
  • cs: Čeština (Czech) -- AI
  • it: Italiano (Italian) -- AI
  • az: Azərbaycan dili (Azerbaijani) -- AI
  • bqi: بختیاری (Bakhtiari) -- AI
  • iw: עברית (Hebrew) -- AI

yet300 and others added 25 commits August 4, 2025 17:21
This commit introduces string resources to internationalize the following screens:
- Onboarding:
    - BatteryOptimizationScreen
    - BluetoothCheckScreen
    - InitializingScreen
    - LocationCheckScreen
    - PermissionExplanationScreen
- UI:
    - ChatHeader
    - DialogComponents
    - InputComponents
* Add Belarusian, Georgian, Kazakh, Russian, Turkish, and Ukrainian translations

Warning: this translation was created using AI, so there may be inaccuracies in the translation.
This commit introduces string resources to internationalize the following screens:
- Onboarding:
    - BatteryOptimizationScreen
    - BluetoothCheckScreen
    - InitializingScreen
    - LocationCheckScreen
    - PermissionExplanationScreen
- UI:
    - ChatHeader
    - DialogComponents
    - InputComponents
* Add Belarusian, Georgian, Kazakh, Russian, Turkish, and Ukrainian translations

Warning: this translation was created using AI, so there may be inaccuracies in the translation.
This commit adds new string resources for the app info screen in English, Belarusian, Georgian, Kazakh, Russian, Turkish, and Ukrainian.

The new strings include:
- App tagline
- Features section with titles and descriptions for offline communication, end-to-end encryption, extended range, favorites, mutual favorites, and mentions.
- Privacy section with titles and descriptions for no tracking, ephemeral identity, and panic mode.
- "How to use" section with instructions.
- Warning message about private message security.
- "Done" button text.

The Ukrainian strings file was also moved from `app/src/main/res/uk/strings.xml` to `app/src/main/res/values-uk/strings.xml` to follow standard Android resource directory naming.
- Replaced AppInfoDialog with AppInfoBottomSheet(IOS like).
- Created `BottomSheetComponents.kt` to house the new `AppInfoBottomSheet` and its related composables.
- Updated `ChatScreen.kt` to use `AppInfoBottomSheet` and invoke it from a new composable `ChatSheets`.
- Removed `AppInfoDialog` from `DialogComponents.kt`.
- `AppInfoBottomSheet` now displays app features, privacy information, usage instructions, and a warning message in a scrollable list.
- Added a top bar to the bottom sheet that becomes opaque on scroll and includes a "Done" button.
…vements

# Conflicts:
#	app/src/main/java/com/bitchat/android/onboarding/BluetoothCheckScreen.kt
#	app/src/main/java/com/bitchat/android/ui/DialogComponents.kt
#	app/src/main/java/com/bitchat/android/ui/InputComponents.kt
#	app/src/main/res/values-be/strings.xml
#	app/src/main/res/values-ka/strings.xml
#	app/src/main/res/values-kk/strings.xml
#	app/src/main/res/values-ru/strings.xml
#	app/src/main/res/values-tr/strings.xml
#	app/src/main/res/values/strings.xml
- Add "mention" string to default and localized strings.xml files
- Remove `app/src/main/res/uk/strings.xml` as it is a duplicate of `app/src/main/res/values-uk/strings.xml`
* Use stringResource for message hint
* Minor code cleanup in InputComponents.kt
* Add stringResource import in DialogComponents.kt
Created AppInfo BottomSheet as on iOS
This commit introduces per-app language preferences by:
- Adding a `locales_config.xml` file defining supported locales: en, ru, uk, be, tr, kk, ka, ar, cs, it, az, bqi, iw.
- Updating `AndroidManifest.xml` to reference the `locales_config.xml` via the `android:localeConfig` attribute in the `<application>` tag.
- Incrementing `tools:targetApi` from 31 to 33 in `AndroidManifest.xml`.
- Replaced `Box` with `Scaffold` for consistent layout.
- Added `Column` with centered content and spacing.
- Added `@Preview` functions for all onboarding screens.
This commit refactors the `ChatScreen` composable to utilize the
`Scaffold` layout from Material 3. This change simplifies the layout
structure and improves how window insets (like the keyboard and status bar)
are handled.

Key changes:
- Replaced the manual `Box` and `Column` layout with `Scaffold`.
- `ChatFloatingHeader` is now placed in the `topBar` slot of the `Scaffold`.
- `MessagesList` is placed in the `content` slot.
- `ChatInputSection` is now placed in the `bottomBar` slot.
- Removed manual spacer for the header and `windowInsetsPadding` from individual components as `Scaffold` manages this.
- Removed the `headerHeight` parameter and related calculations as it's no longer needed.
- Adjusted `zIndex` and background modifiers as `Scaffold` provides better layering.
- The `ChatInputSection` now uses `navigationBarsPadding()` to adjust for the navigation bar.
This commit enables the predictive back gesture for the app by setting
`android:enableOnBackInvokedCallback="true"` in the AndroidManifest.xml.
feat: Implement Edge-to-Edge UI and Predictive Back Gestures
@yet300 yet300 changed the title Add Translations, App Info Bottom Sheet, Edge-to-Edge UI and Predictive Back Gestures Add Translations, App Info Bottom Sheet, Edge-to-Edge and Predictive Back Gestures Aug 22, 2025
yet300 added 3 commits August 22, 2025 22:28
…e-to-edge

# Conflicts:
#	app/src/main/java/com/bitchat/android/onboarding/LocationCheckScreen.kt
#	app/src/main/java/com/bitchat/android/onboarding/PermissionExplanationScreen.kt
#	app/src/main/java/com/bitchat/android/ui/ChatScreen.kt
…e-to-edge

# Conflicts:
#	app/src/main/java/com/bitchat/android/ui/ChatScreen.kt
- Remove unused `headerHeight` parameter from `ChatFloatingHeader`.
- Remove unused `viewModel` parameter from `PasswordPromptDialog`.
yet300 and others added 4 commits August 24, 2025 22:09
* Implement NIP-44 v2 (XChaCha20) for DMs
* Add RelayDirectory for geohash-based relay selection
* Update NostrProtocol to use randomized timestamps for NIP-17
* Send events and subscribe to geohash-specific relays
* UI: Improve ChatScreen layout, message display, and header
* UI: Add scroll-to-bottom button
* UI: Update geohash channel level names (Region -> Province)
* Fix: Ensure private message recipient nickname is not required
* Fix: Send delivery ACKs for geohash DMs
* Chore: Add nostr_relays.csv to assets
- Deleted `BottomSheetComponents.kt` as its functionality will be integrated elsewhere.
- Disabled edge-to-edge display in `MainActivity.kt`.
…ain-module-ca8a

Refactor android project domain module
@callebtc
Copy link
Collaborator

looks like an awesome change. could you resolve conflicts and test again?

@callebtc
Copy link
Collaborator

I'd like to keep translations out until the app is more stable. the remaining features are neat though. can we have them?

@yet300
Copy link
Contributor Author

yet300 commented Aug 29, 2025

@callebtc yes, I also think that translation is not needed yet, but I think that we still need to store the locale in strings.xml. Can we delete all other locales for now but leave only English?

yet300 added 7 commits August 30, 2025 21:39
Removes machine-translated locale files that are not yet complete. This is to avoid shipping a poor user experience with partial or inaccurate translations. The English locale will be used as a fallback.
This commit introduces several major networking and feature enhancements:

*   **Tor Integration**: All internet-based traffic (geohash, Nostr DMs) can now be routed over the Tor network for enhanced privacy. This is implemented using Arti (Tor in Rust) for improved security and reliability. A new network section in the "About" sheet allows users to enable/disable Tor.

*   **Offline & Favorite Improvements**:
    *   Conversations are now unified. Messages from a peer received via Nostr while offline will be merged into their main chat when they connect directly over the mesh.
    *   The sidebar now shows offline favorites and incoming Nostr chats, ensuring all conversations are accessible.
    *   Favorite/unfavorite actions are now sent as notifications to the other peer over mesh or Nostr.

*   **Notification Enhancements**:
    *   Notifications are now sent for newly discovered nearby peers to improve engagement.
    *   Geohash notifications now include the location name (e.g., "City (#geohash)").
    *   Added extensive tests for notification logic.

*   **UI/UX Refinements**:
    *   Added an "Appearance" section in the "About" sheet to select between system, light, and dark themes.
    *   URLs and geohashes in messages are now clickable inline.
    *   Improved nickname rendering to avoid ambiguity when multiple users have the same base name.
    *   Updated privacy policy and README to reflect new hybrid online/offline functionality.

*   **Under-the-hood Refactoring**:
    *   Introduced a central `MessageRouter` to intelligently send messages via mesh or Nostr.
    *   Added a `SeenMessageStore` to prevent re-notifying for previously delivered or read messages across app restarts.
    *   Packets are now signed with an Ed25519 key to prepare for future identity verification features.
    *   Added a GitHub Action to automatically fetch and update the list of Nostr relays weekly.
This commit introduces several major features and improvements to align with the iOS version, focusing on enhanced privacy, interoperability, and user experience.

*   **NIP-44 v2 Encryption:**
    *   Upgrades Nostr direct message encryption from a custom AES-GCM implementation to NIP-44 v2 using XChaCha20-Poly1305. This ensures full compatibility with the latest Nostr standards and other clients.
    *   Introduces randomized timestamps for sealed events to improve metadata privacy.
    *   Refactors `NostrProtocol` to create unsigned NIP-17 rumors (kind 14) and properly sealed/gift-wrapped events.

*   **Tor Integration:**
    *   Adds built-in support for routing all internet traffic over the Tor network using the `arti-mobile` library (Tor in Rust).
    *   Introduces a "Network" section in the About/Settings sheet to enable/disable Tor and view its connection status.
    *   `OkHttpProvider` is added to ensure all WebSocket and HTTP connections respect the current Tor proxy setting.

*   **UI and State Management:**
    *   Adds an app-level theme selector (System, Light, Dark) in the About sheet.
    *   Implements conversation aliasing and merging. Chats from offline/Nostr identities are now unified with the live mesh peer's conversation window when they connect.
    *   Refactors the main `ChatScreen` to use a `Box` layout, improving how the floating header and keyboard insets are handled.
    *   Adds a "scroll to bottom" button that appears when the user scrolls up in the chat view.
    *   Enhances the location channels sheet with a user-controlled enable/disable toggle for location services.

*   **Mesh & Protocol Enhancements:**
    *   Adds cryptographic signatures (Ed25519) to all outgoing mesh packets for improved integrity and sender verification.
    *   Implements a `MessageRouter` to intelligently send private messages via the mesh network if the peer is connected and has an established session, falling back to Nostr otherwise.
    *   Handles favorite/unfavorite notifications received over both mesh and Nostr, providing mutual status updates in system messages.

*   **Geohash & Nostr Services:**
    *   Introduces a `RelayDirectory` to fetch and use geographically closest relays for geohash channels, improving performance and relevance.
    *   Adds a panic/reset function to completely wipe and reinitialize all Nostr and geohash-related data and connections.
    *   Geohash participant display names (`@user#hash`) now dynamically hide the `#hash` suffix when the name is unique in the channel, reducing clutter.
This commit replaces hardcoded strings in the `LocationChannelsSheet` with string resources for better internationalization support.

Changes include:
*   Externalizing permission status, service status, and button labels.
*   Moving the teleport icon's content description to `strings.xml`.
*   Using a formatted string resource for the coverage area display.
This commit completely redesigns the "About" bottom sheet.

The new design features:
*   A cleaner, more structured layout with distinct sections for features, appearance, and network settings.
*   Improved typography and styling that aligns with the rest of the app's UI.
*   A sticky top bar with a "Done" button that appears on scroll.
*   The use of string resources for all text content, improving localization.
*   Extract sheet content into a private `ChatUserSheetContent` composable.
*   Remove the drag handle from the modal bottom sheet.
*   Adjust padding and layout for better visual presentation.
@yet300
Copy link
Contributor Author

yet300 commented Aug 30, 2025

@callebtc Im delete localization just en strings

yet300 added 3 commits August 31, 2025 10:48
Replaces "cancel" and "done" with a consistent "close" button on the location channels and about sheets.
This commit introduces Proof of Work (PoW) for geohash messages as a spam-deterrence mechanism, following NIP-13.

Key changes include:
*   **PoW Implementation**: Adds `NostrProofOfWork.kt` for mining events to a target difficulty and validating incoming events.
*   **Preference Management**: Introduces `PoWPreferenceManager.kt` to manage user settings for enabling/disabling PoW and setting the difficulty.
*   **UI Integration**:
    *   Adds a "Proof of Work" section in the About/Settings sheet to configure PoW.
    *   Integrates a PoW status indicator in the chat header.
    *   Adds a "matrix-style" animation for messages being mined, providing immediate user feedback.
*   **Core Logic**: Updates `NostrGeohashService` to mine outgoing messages and validate incoming ones based on user settings. The local echo of a message now appears instantly while mining happens in the background.
This commit updates the list of default Nostr relays and their coordinates.
@yet300
Copy link
Contributor Author

yet300 commented Sep 1, 2025

Screenshot_20250901_112200 Screenshot_20250901_112221 Screenshot_20250901_112244

@callebtc
Copy link
Collaborator

callebtc commented Sep 9, 2025

hey, these are too many changes at once, I would appreciate if you open smaller PRs so I can review them.

@callebtc
Copy link
Collaborator

callebtc commented Sep 9, 2025

there are also may conflicts and edge-to-edge has been already fixed I think. would appreciate your feedback.

@callebtc callebtc added question Further information is requested UI/UX Improving interactions labels Sep 9, 2025
@riccio8
Copy link

riccio8 commented Sep 10, 2025

@yet300 I'm a native speaker, u marked the traduction as AI

@yet300
Copy link
Contributor Author

yet300 commented Sep 10, 2025

Yes, some languages are made with AI, and need to be checked

yet300 and others added 3 commits September 11, 2025 11:21
# Conflicts:
#	app/src/main/java/com/bitchat/android/onboarding/BatteryOptimizationScreen.kt
#	app/src/main/java/com/bitchat/android/onboarding/BluetoothCheckScreen.kt
#	app/src/main/java/com/bitchat/android/onboarding/InitializingScreen.kt
#	app/src/main/java/com/bitchat/android/onboarding/LocationCheckScreen.kt
#	app/src/main/java/com/bitchat/android/ui/AboutSheet.kt
#	app/src/main/java/com/bitchat/android/ui/LocationChannelsSheet.kt
This commit introduces a new string resource for "debug settings".
@yet300 yet300 mentioned this pull request Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

question Further information is requested UI/UX Improving interactions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants