Commits by Nikka
9 subscribers
164 links
Owned by @NikkaGameS
Download Telegram
πŸ”¨ 2 new commits to ComuCompose:master:

b45847e: Refactor login and background service cleanup

- In AppVisibility, wait for UdpCallService to finish before stopping SocketService.
- In LoginActivity, refactor auto-login logic into relaunchLogin and remove the retry loop in login.
- Check if the user profile picture exists in LoginActivity to skip directly to MainActivity.
- Replace finish() with finishAndRemoveTask() in ChatActivity and LoginActivity.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
de34d02: Implement call duration timer and optimize service lifecycle

- Add call timer logic and display elapsed time in CallActivity
- Update call notification to show chronometer
- Auto-stop UdpCallService when call state becomes ENDED
- Refactor FCM token registration and clean up JSON handling
- Optimize LoginActivity startup flow and navigation logic

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
πŸ”¨ 1 new commit to ComuCompose:master:

841729b: Add ongoing call banner to Chat and Main activities

- Expose UdpCallService.runningFlow to track call service state reactively.
- Display a clickable green banner in ChatActivity and MainActivity when a call is active, showing the elapsed duration.
- Clicking the banner navigates to the active CallActivity.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
πŸ”¨ 2 new commits to ComuServer:main:

fb6764f: Refactor to use PeerId and simplify client handling

Replaced uid/device keys with PeerId (ulong) across RealtimeClient,
RealtimeRegistry, and UdpServer for improved efficiency and clarity.
Updated TCPServer to handle specific user.getinfo case. Removed
UdpServer cleanup logic and refactored related code. General cleanup
and debug message updates to align with PeerId-based implementation. by NikkaGames
3ae8d79: Add call sync method and improve call state handling

Added SendCallSync to TCPServer to synchronize call status
with users, sending call details or inactive status via SslStream.
Integrated SendCallSync in two key points after user registration
in RealtimeRegistry. Updated call state logic to include Ringing
state for further processing, enhancing handling of pending calls. by NikkaGames
πŸ”¨ 4 new commits to ComuCompose:master:

d5bf16e: * Utils: Added id helper function to generate a unique 64-bit hash from UID and device ID.
* UdpCallService: Refactored packet header structure to use a fixed-size 12-byte header (8 bytes for hashed peer ID, 4 bytes for call ID) instead of variable-length string fields, simplifying packet parsing and construction.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
3bda294: Update CallActivity finish logic and handling of incoming calls

- In CallActivity.kt, stop the service immediately when the call ends or is busy, reduce the delay before finishing the task from 2000ms to 1200ms, and clean up imports.
- In Handlers.kt, wrap the incoming call event handling in a coroutine that waits until the previous call state is no longer ENDED before initializing the new incoming call and starting CallActivity.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
d7913a5: Add microphone mute toggle and call reconnection monitoring

- Implement microphone muting in UdpCallService and add a toggle button in CallActivity.
- Add connection monitoring: switch to RECON state ("Reconnecting…") if no packets are received for 1 second.
- Handle EVENT_CALL_REJECTED with a new REJECTED state in CallWrapper.
- Update CallActivity to display UI for new states and cleanup resources on rejection.
- Wrap UDP socket send operations in runCatching to prevent crashes.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
9ed44b2: Update Call UI and implement call state synchronization

- Redesign the call screen layout in CallActivity with a new profile icon placeholder, updated typography, and adjusted spacing.
- Change the active call status text from "Call active" to "Connected".
- Implement handling for the call.sync event in Handlers to correctly update the local call state (active/ended) and call ID based on server data.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
πŸ”¨ 2 new commits to ComuServer:main:

8a202c7: Add validation for Ievent.data in HandleMsgSendAsync

A new validation check ensures that the Ievent.data property
is not null, empty, or improperly formatted (must be exactly
24 characters long). If the validation fails, the method
returns DispatchResult.Break to prevent further processing.

This change improves input validation and prevents potential
issues caused by invalid or malformed data. by NikkaGames
e48cdfa: Update methods for picture links, responses, and dispatch

Modified GetPictureLinkById to support an optional full
parameter for returning full or truncated picture links.
Updated HandleUserIconAsync to use this parameter based
on Ievent.value. Changed HandleUserGetInfoAsync to set
r field to 1L in the response. Adjusted
HandlePresenceGetAsync to return DispatchResult.Continue
instead of DispatchResult.Break when TryGetMe fails. by NikkaGames
πŸ”¨ 4 new commits to ComuCompose:master:

2857331: Revamp Call UI and persist UID

- Update CallActivity with a new layout, including a TopAppBar and Scaffold
- Expand call banner visibility in MainActivity and ChatActivity to include incoming and outgoing states
- Persist Singleton UID using SharedPreferences
- Fix blocking pointer input loop in MainActivity
- Remove explicit cleanup call in SocketService

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
4ada7dd: Implement SharedPreferences persistence for Singleton properties

- Update getters and setters to read and write values (UIDs, names, bio, notification settings) using SharedPreferences.
- Ensure cleanUp() resets persisted values.
- Refactor field declarations to single lines and convert simple getters to expression bodies.
- Reorder methods for logical grouping.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
1a636cb: Load profile icon and average color asynchronously in ProfileActivity

* ProfileActivity.kt:
* Convert avgProfileColor to a mutableState to trigger recompositions on update.
* Implement LaunchedEffect to fetch the full resolution profile icon and calculate its average color asynchronously.
* Update UI to show a shimmer placeholder while the profile icon is loading.
* Use the fetched icon bitmap instead of the cached low-res version.

* Handlers.kt:
* Update getIconLink to support fetching the full-size image link via a boolean flag, parsing the result from a JSON object.
* Improve getIcon by setting connection timeouts and user-agent headers.

* LoginActivity.kt:
* Add a check for Handlers.isReconnected loop during login to ensure socket stability.
* Fix context usage for cache directory access when loading the user's own profile picture.

* .idea/deploymentTargetSelector.xml: Update deployment target configuration.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
9366551: Implement expandable profile header and update service startup

- ProfileActivity: Add expanding animation to the profile image when pulling down. Refactor header offset, avatar scaling, and name positioning logic. Move back and edit buttons in the layout hierarchy to ensure proper layering.
- UdpCallService: Move startForegroundCall to onCreate to ensure immediate foreground promotion.
- LoginActivity: Change debug logging level to Info.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
πŸ”¨ 1 new commit to ComuServer:main:

bbc6611: Refactor presence handling; add status subscriptions

Replaced presence handlers with stat handlers to manage
status updates, subscriptions, and unsubscriptions. Added
ConcurrentDictionary structures for statusSubs and
streamIndex to track subscriptions and streams.

Implemented HandleStatusSetAsync, HandleStatusSubAsync,
and HandleStatusUnsubAsync methods for status management.
Added NotifyStatus helper to notify subscribers of status
changes. Updated disconnection logic to clean up statuses
and subscriptions. Ensured subscribers are notified when a
user's status is cleared. by NikkaGames
πŸ”¨ 1 new commit to ComuCompose:master:

8d3ef6c: Refactor user status to subscription model and enhance Profile UI

- Switch user status handling from polling to a subscription-based event system in Handlers and ChatActivity.
- Remove startStatusPolling and implement subscribeStatus and unsubscribeStatus methods.
- Handle EVENT_STATUS_RECV events to update UI status asynchronously.
- Add top and bottom vertical gradient fades to the profile image in ProfileActivity when expanded.
- Animate navigation icon tint brightness based on the profile expansion progress.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
πŸ”¨ 1 new commit to ComuServer:main:

0d0ee2c: Add secure key exchange mechanism for call setup

Introduced xorKey field in CallRegistry for cryptographic key storage. Updated TCPServer to generate a 32-byte random key during call acceptance, Base64-encode it, and distribute it securely to the caller and callee. Ensured messages are sent only to authenticated SSL streams. Added state checks to activate calls only when in Ringing state. Enhanced security of call setup process. by NikkaGames
πŸ”¨ 2 new commits to ComuServer:main:

9778646: Update TCPServer to notify on non-Ringing call state

Enhanced the TCPServer class to send a notification when
call.state is not CallState.Ringing. Previously, the method
would simply return DispatchResult.Continue in this case.

The new logic sends a message to the stream via SendObj,
including an object with name: "call.taken" and the callId
property. This ensures additional feedback is provided for
non-Ringing call states before returning DispatchResult.Continue. by NikkaGames
02d47ca: Refactor call handling and encapsulate call termination

Centralized call termination logic in CallRegistry.EndCall to
improve maintainability and reduce duplication. Updated methods
in TCPServer to use EndCall instead of direct calls to
UdpServer.CloseRoom. Refined IsUserInCall logic to check
call states. Removed redundant code and ensured consistent
handling of call termination across the codebase. by NikkaGames
πŸ”¨ 1 new commit to ComuCompose:master:

1f3a6b3: Implement XOR encryption for voice calls and handle 'taken' state

- Add XOR-based payload obfuscation in UdpCallService for incoming and outgoing audio packets.
- Implement key exchange logic in Handlers via call.accepted and call.handsh events.
- Introduce State.TAKEN in CallWrapper to handle calls answered on other devices, closing the activity when received.
- Remove redundant incoming boolean from CallWrapper.
- Reset encryption keys and call state properly upon service destruction.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
πŸ”¨ 3 new commits to ComuCompose:master:

4712b7a: Handle call reset event and fix call state transitions

- In CallActivity.kt, remove the redundant CallWrapper.reset() call when state is TAKEN.
- In Handlers.kt:
- Add EVENT_CALL_RESET constant and handle it to reset the CallWrapper and stop the timer.
- Reset CallWrapper on EVENT_CALL_INCOMING if the state is not idle.
- Reset CallWrapper on EVENT_CALL_TAKEN before setting the state to TAKEN.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
52c16a5: Implement incoming call notifications and avatar display

* Add CallActionReceiver for call notification actions (Accept/Reject)
* Show peer avatar and name in CallActivity with dynamic background color
* Pass peer uid and name via intents in ChatActivity, ProfileActivity, and UdpCallService
* Create dedicated notification channel for calls
* Refactor EVENT_CALL_INCOMING handling in Handlers and ComuFirebaseService

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
03ba109: Implement mTLS HTTP client for call rejection and handle call notifications

This commit introduces a new mTLS-secured HTTP client (ComuMtlsHttp) to handle call rejection requests securely via a REST API endpoint. It also refactors the call handling logic, including improved notification management and auto-acceptance capabilities.

Specific changes:
* Added ComuMtlsHttp helper object to build an OkHttp client with custom SSL configuration (CA cert, client PFX) for secure communication.
* Added comuhttp.crt and comuclient.pfx (binary) resources for mTLS.
* Updated CallActivity to support auto-accepting calls via intent extras and handling reconnection logic in onResume.
* Refactored CallActionReceiver to reject calls via the new mTLS HTTP endpoint instead of the socket service.
* Updated Handlers to support extended rejection logic (rejectExt), proper notification channel management, and updated call event handling (SYNC, TAKEN, REJECTED).
* Modified Utils.createCallChannel to recreate the notification channel to ensure settings persist correctly.
* Bumped okhttp dependency to 4.12.0.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
πŸ”¨ 2 new commits to ComuCompose:master:

0d24a8d: Implement image uploading and refactor icon retrieval

- Add uploadImage and uploadProfilePictures functions to Handlers
- Integrate visual media picker and legacy content picker in ChatActivity and ProfileActivity
- Add centerCropSquare bitmap utility function
- Update getIcon signature to fetch directly from media server using uid and quality parameters
- Refactor getIcon calls across MainActivity, LoginActivity, CallActivity, and ChatActivity to include uid
- Add UI controls for initiating image uploads in chat and profile screens

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
cfd53c2: Implement real-time profile picture updates with disk caching and version tracking
- Handle EVENT_USER_PICTURE_UPDATE in ComuFirebaseService and Handlers to trigger icon refreshes
- Refactor avatar loading in ProfileActivity, ChatActivity, and MainActivity to observe iconVersion state
- Revamp ProfileActivity UI: add "Upload a new photo" section, improve header animations, and implement dynamic name sizing
- Add Utils.isOnline helper method checks for service and socket connectivity

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
πŸ”¨ 1 new commit to ComuServer:main:

fbe6a28: Push latest changes
* Implemented file server request and event handlers
* Finalize file server for profile media uploading by NikkaGames
πŸ”¨ 1 new commit to ComuCompose:master:

03fa8a5: Implement profile picture upload progress tracking

- Add UploadStore and UploadAcks in Handlers to manage upload states and server acknowledgments.
- Update ProfileActivity to show a CircularProgressIndicator during uploads using real-time progress data.
- Modify uploadProfilePictures and uploadImage to send Content-Length and X-Upload-Guid headers.
- Implement waiting for upload.begin acknowledgment before starting file transfer.
- Handle upload lifecycle events (upload.ack, upload.progress, upload.done, upload.failed) in Handlers.
- Pre-calculate thumbnail size by compressing to memory stream before upload.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
πŸ”¨ 3 new commits to ComuCompose:master:

d13c826: Refactor profile image handling and optimize color calculation

- Remove Bitmap storage (icon, profileIcon, myimg) and associated accessors from Singleton to reduce memory usage and coupling.
- Update LoginActivity, MainActivity, ChatActivity, ProfileActivity, and CallActivity to manage profile images via Handlers.icons or local state instead of the singleton.
- Optimize Utils.getAverageColor to use pixel downsampling for faster performance.
- Change Handlers.icons map to ConcurrentHashMap for thread safety.
- Add EVENT_UPLOAD_BEGIN constant in Handlers.
- Rename state variables for profile icons in ProfileActivity.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
ddefa27: Refactor chat input to combine send and image buttons with animations
Implement image scaling and compression logic for uploads
Prevent initiating a new call if one is already active
Add clipping and fade animations to call control buttons
Update message insertion key and optimize icon cache handling

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
2999b11: Implement image sending and viewing in chat

- Add Coil Compose dependency and configure ComuImageLoader with custom OkHttp client and caching.
- Implement image picking, compression (JPEG/PNG/WebP), and uploading logic in ChatActivity and Handlers.
- Update Handlers to dispatch upload events (progress, success, failure) to the main thread.
- Render photo: messages in ChatActivity using AsyncImage with support for upload progress indicators and size animations.
- Add "Save to gallery" action to the message options bottom sheet and adjust available actions for media/stickers.
- Update AppVisibility to prevent service termination while uploads are active.
- Clear upload store when SocketService is stopped.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
πŸ”¨ 1 new commit to ComuServer:main:

230ac6c: Push latest changes

* Implement chat media uploads and fetching. by NikkaGames
πŸ”¨ 1 new commit to ComuServer:main:

2cab26f: Notify target client about incoming media message from File Server, directly. by NikkaGames
πŸ”¨ 1 new commit to ComuCompose:master:

65133a0: Implement media saving, fix image rotation, and update permissions

- Add saveToGallery functionality in Handlers to download and save images to MediaStore.
- Integrate "Save to gallery" option in ChatActivity`'s `OptionsBottomSheet.
- Fix image orientation issues by normalizing EXIF data before upload in Utils and Handlers.
- Update AndroidManifest.xml permissions to support Android 13+ (replace legacy storage permissions with READ_MEDIA_*).
- Refactor SocketService to wait for connection readiness (waitUntilReady) before sending messages.
- Correct isOnline logic in Utils and update reconnection state handling in Handlers.
- Optimize upload event handlers by removing unnecessary main thread posting.
- Adjust message options menu to conditionally show Copy, Save, and Delete actions based on message type and ownership.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
πŸ”¨ 1 new commit to ComuCompose:master:

4559e16: Implement CallForegroundService and image download progress tracking

- Create CallForegroundService to handle incoming call notifications using NotificationCompat.CallStyle and full-screen intents.
- Update CallActivity, Handlers, and CallActionReceiver to manage the lifecycle of the new foreground service instead of raw notifications.
- Configure the "calls" notification channel with ringtone, vibration, and DND bypass settings in Utils.
- Implement ProgressInterceptor in ComuImageLoader to track and expose image download progress.
- Bind image loading progress to the UI in ChatActivity.
- Update Singleton to use lateinit for context and introduce googleAuth state.
- Add checks in SocketService to stop the service if unauthenticated and handle reconnection logic.
- Register the new service and update permission attributes in AndroidManifest.xml.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames
πŸ”¨ 1 new commit to ComuCompose:master:

1749d40: Replace CallForegroundService with direct NotificationManager usage

- Delete CallForegroundService.kt and remove its declaration from AndroidManifest.xml.
- Move incoming call notification construction logic to Handlers.kt as buildIncomingCall.
- Update handleCall to display notifications using NotificationManagerCompat instead of starting a foreground service.
- Refactor call state event handlers (EVENT_CALL_REJECTED, EVENT_CALL_ENDED, etc.) in Handlers.kt and CallActionReceiver to cancel notifications by ID directly.
- Update CallActivity to remove service start/stop logic and use notification cancellation.
- Pass context to handleCall in ComuFirebaseService.

Signed-off-by: NikkaGames <[email protected]> by NikkaGames