Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
48fa2c3
refactor: Reorganize messaging functionality into dedicated module
ccoppo Feb 2, 2025
c339d96
refactor: fixing oops some files did not get committed/pushed in my f…
ccoppo Feb 5, 2025
67a52e2
Added Craig's chat screen
cybarney Feb 5, 2025
ce1a236
Fix for app crashing when IP field empty
cybarney Feb 5, 2025
ad9943b
feat(chat): Replace manual IP entry with ChatNodeListScreen for node-…
aryan-r-0 Feb 6, 2025
071c595
Added Messaging Bubbles
cybarney Feb 12, 2025
8658411
Added the file encoder class
CLiang46 Feb 13, 2025
57d2c7d
Merge branch 'messaging-updates-wil-mesh-asu-cidse2024' of https://gi…
CLiang46 Feb 13, 2025
c08dc2e
refactor(WifiListItem): move WifiListItem to shared utility file for …
aryan-r-0 Feb 13, 2025
f8a5250
Fixed functionality for sending text messages
cybarney Feb 13, 2025
826c5f3
Fixing issue in gradle.xml
cybarney Feb 13, 2025
674b206
Added colors for message bubles
cybarney Feb 14, 2025
e05e321
Add test device functionality
ccoppo Feb 15, 2025
9942d78
Added the file encoder class
CLiang46 Feb 19, 2025
b73fe91
Added the file encoder class
CLiang46 Feb 19, 2025
aa1ecab
commented out some of the changes to the Message class that were caus…
CLiang46 Feb 19, 2025
754de44
feat: unify and persist local device name in DB, integrate /myinfo en…
aryan-r-0 Feb 20, 2025
b7cc38d
feat: unify and persist local device name in DB, integrate /myinfo en…
aryan-r-0 Feb 20, 2025
56cd348
Merge remote-tracking branch 'origin/messaging-updates-wil-mesh-asu-c…
aryan-r-0 Feb 20, 2025
bbf18a3
feat: fixed merge issues
aryan-r-0 Feb 20, 2025
8ee6a10
feat: fixed merge issues with the test device
aryan-r-0 Feb 27, 2025
982e88d
feat(settings): propagate device name updates and broadcast user info
aryan-r-0 Feb 27, 2025
9be7ec1
Cleaned up ChatScreen.kt
cybarney Feb 27, 2025
95b0564
Fixed onboarding and user info bugs; include DI-provided local IP
aryan-r-0 Mar 5, 2025
d420773
Added time stamps to messages
cybarney Mar 11, 2025
170a9da
added conversation homescreen and persisting chat history
ccoppo Mar 17, 2025
54d3d6d
Resolved merge conflicts in ChatScreen
ccoppo Mar 17, 2025
85a3b18
merge conflicts were not, infact resolved. my b collin, all better now
ccoppo Mar 17, 2025
715c25d
fixed issue with messages not getting shown on chat screen after quit…
ccoppo Mar 18, 2025
6042089
Changed chat/file sending so it is being sent as a JSON payload via H…
CollinBarney Mar 19, 2025
d636e17
Fixed some issues that were caused by my previous push.
CollinBarney Mar 20, 2025
e90423f
Added JSON schema so that the JSON payloads could be validated.
CollinBarney Mar 20, 2025
24253c3
Cleaned up chat screen UI
CollinBarney Mar 20, 2025
49bd026
Merge branch 'main' of https://github.com/grey-box/Project-Mesh into …
aryan-r-0 Mar 27, 2025
1dcf713
Merge feature and main branches: integrate Conversations screen, navi…
aryan-r-0 Mar 27, 2025
89572d0
Not perfect yet but chats finally appearing yay
ccoppo Apr 16, 2025
663aec7
Fixed some bugs in device status centralization
ccoppo Apr 17, 2025
977238d
Fixed some bugs in device status centralization
ccoppo Apr 18, 2025
0ed62d5
Fixed more device status bugs, fixed dual conversation creation issue
ccoppo Apr 18, 2025
797c0e3
STATUSES ARE NOW OFFICIALLY WORKING FOR SURE FOR SURE GOD BLESS
ccoppo Apr 18, 2025
ecab1ae
ITS WORKING ITS WORKING ITS WORKING
ccoppo Apr 19, 2025
dab6c0b
Fixed JSON/HTTP POST stuff for messages
CollinBarney Apr 22, 2025
ee44efa
Fixed indent issue
CollinBarney Apr 22, 2025
dd934b8
Added file picker button to chat screen
CollinBarney Apr 22, 2025
50c4666
Added README documentation and images for testusers, user profiles, a…
ccoppo Apr 30, 2025
aeee172
Update README.md
cassie-coppo Apr 30, 2025
9ea025c
Update README.md
cassie-coppo Apr 30, 2025
2a6c32a
Update README.md
cassie-coppo Apr 30, 2025
5025361
Added file picker functionality
CollinBarney Apr 30, 2025
c625444
Merge branch 'messaging-updates-wil-mesh-asu-cidse2024' of https://gi…
CollinBarney Apr 30, 2025
51f778e
Fixed Image issues and spacing hopefully
ccoppo May 1, 2025
21664f7
Added border for readability
ccoppo May 1, 2025
28931f9
Added Ping screen back to network tab
CollinBarney May 1, 2025
91ffe47
Offline messaging works now yall goodnight and God Bless
ccoppo May 2, 2025
2b7dc98
Merge remote-tracking branch 'origin/messaging-updates-wil-mesh-asu-c…
ccoppo May 2, 2025
350e16d
Created the French strings.xml, and added the option in SettingsScree…
ForbiddenKiwis Jun 2, 2025
89a670d
Fix the TextField Bug in which it goes to the top of the Screen. By a…
ForbiddenKiwis Jun 2, 2025
5e09a8c
Integrate Prior Bug Fixes and Feature Implementations
kelvinlin9614 Jun 3, 2025
b346569
Fixed Username crash bug when username is null made it so that the us…
ForbiddenKiwis Jun 5, 2025
4c42701
Nav-Bar Modification
FireLordBruno Jun 9, 2025
8ebb54b
increased font size
FireLordBruno Jun 9, 2025
8dd50d3
Created a default value for the Username in the OnboardingScreen.kt. …
ForbiddenKiwis Jun 10, 2025
cdeb6d6
Change username to unisex name from John Doe -> Guest
ForbiddenKiwis Jun 12, 2025
6b78b7f
Created a blankUsernameGenerator() in order to resolve the Username P…
ForbiddenKiwis Jun 13, 2025
255505e
Created Debug Build Variant
ForbiddenKiwis Jun 16, 2025
1b758df
The App now does not show the Log Tab when in Release Mode but when i…
ForbiddenKiwis Jun 17, 2025
74d2db5
Applying Logging Good practices by using Timber to handle logs by giv…
ForbiddenKiwis Jun 23, 2025
dc16eb4
Refactor MainActivity.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
3ef9619
Refactor ChatScreen.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
fb5745b
Refactor CrashHandler.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
627d243
Refactor JSONSchema.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
4df206b
Refactor MessageNetworkHandler.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
5cf4d21
Refactor MessageService.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
755eaa4
Refactor ConversationRepository.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
6ed57ac
Refactor ChatScreenViewModel.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
0925e41
Refactor ConversationsHomeScreenViewModel.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
a4fc819
Refactor Logger.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
b2c62db
Refactor MessageMigrationUtils.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
dcc7ae3
Refactor AppServer.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
eae3a19
Refactor TestDeviceEntry.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
ee7baab
Refactor TestDeviceService.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
ee197b5
Refactor HomeScreenViewModel.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
d39e050
Refactor NetworkScreenViewModel.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
892a471
Refactor OnboardingViewModel.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
56508d3
Refactor SelectDestNodeScreenViewModel.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
5a387f6
Refactor ReceiveScreen.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
b0710e2
Refactor MNetLoggerAndroid.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
bcedca5
Adding Aider files to .gitignore.
ccameron-gb Oct 1, 2025
7f7a117
refactor: Reorganize messaging functionality into dedicated module
ccoppo Feb 2, 2025
3fe3933
Added Craig's chat screen
cybarney Feb 5, 2025
aea7465
Fixing issue in gradle.xml
cybarney Feb 13, 2025
5987c83
Added the file encoder class
CLiang46 Feb 19, 2025
24ed541
Integrate Prior Bug Fixes and Feature Implementations
kelvinlin9614 Jun 3, 2025
800c03e
Created Debug Build Variant
ForbiddenKiwis Jun 16, 2025
8e84c7b
The App now does not show the Log Tab when in Release Mode but when i…
ForbiddenKiwis Jun 17, 2025
0986486
Applying Logging Good practices by using Timber to handle logs by giv…
ForbiddenKiwis Jun 23, 2025
8a04272
Refactor MainActivity.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
61c8430
Refactor ChatScreen.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
3b6d5d8
Refactor CrashHandler.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
9bdedfe
Refactor JSONSchema.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
db477d1
Refactor MessageNetworkHandler.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
e3ce8c2
Refactor MessageService.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
a077988
Refactor ConversationRepository.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
80fc264
Refactor ChatScreenViewModel.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
d236ca6
Refactor ConversationsHomeScreenViewModel.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
8c3c91f
Refactor Logger.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
f8b5ca0
Refactor MessageMigrationUtils.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
b597c43
Refactor AppServer.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
dad102d
Refactor TestDeviceEntry.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
3046a5a
Refactor TestDeviceService.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
bdd250c
Refactor HomeScreenViewModel.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
1ed29aa
Refactor NetworkScreenViewModel.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
079c0ee
Refactor OnboardingViewModel.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
2c31b67
Refactor SelectDestNodeScreenViewModel.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
90675aa
Refactor ReceiveScreen.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
eb268f0
Refactor MNetLoggerAndroid.kt Log into Timber
ForbiddenKiwis Jun 24, 2025
148b743
Merge remote-tracking branch 'origin/Debug-Build-Type' into Debug-Bui…
flow733 Mar 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ kotlin-ide/
.kotlin/
.teamcity
.idea/
.aider*
.env
10 changes: 10 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ android {
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("debug")
Copy link
Collaborator

Choose a reason for hiding this comment

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

The release build is using the debug signing key here. That will break real release installs/updates and can’t be used for store distribution. Please remove this or point it at the real release signing config.

}

debug {
isDebuggable = true
applicationIdSuffix = ".debug"
versionNameSuffix = "-debug"
}
}
compileOptions {
Expand Down Expand Up @@ -145,4 +152,7 @@ dependencies {

// For JSON serialisation
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")

// For Debug Build
implementation("com.jakewharton.timber:timber:5.0.1")
}
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.greybox.projectmesh.fileprovider"
android:authorities="${applicationId}.fileprovider"
Copy link
Collaborator

Choose a reason for hiding this comment

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

The provider authority now changes with the application ID, but the file-opening code still uses the old hardcoded authority. In debug builds this will mismatch and opening received files will fail. Please make the FileProvider authority consistent everywhere.

android:grantUriPermissions="true"
android:exported="false">

Expand Down
13 changes: 7 additions & 6 deletions app/src/main/java/com/greybox/projectmesh/MNetLoggerAndroid.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import timber.log.Timber
import java.io.File
import java.text.DateFormat
import java.util.Date
Expand Down Expand Up @@ -52,12 +53,12 @@ class MNetLoggerAndroid(

private fun doLog(priority: Int, message: String, exception: Exception?) {
when (priority) {
Log.VERBOSE -> Log.v(MeshrabiyaConstants.LOG_TAG, message, exception)
Log.DEBUG -> Log.d(MeshrabiyaConstants.LOG_TAG, message, exception)
Log.INFO -> Log.i(MeshrabiyaConstants.LOG_TAG, message, exception)
Log.WARN -> Log.w(MeshrabiyaConstants.LOG_TAG, message, exception)
Log.ERROR -> Log.e(MeshrabiyaConstants.LOG_TAG, message, exception)
Log.ASSERT -> Log.wtf(MeshrabiyaConstants.LOG_TAG, message, exception)
Log.VERBOSE -> Timber.tag(MeshrabiyaConstants.LOG_TAG).v(exception, message)
Log.DEBUG -> Timber.tag(MeshrabiyaConstants.LOG_TAG).d(exception, message)
Log.INFO -> Timber.tag(MeshrabiyaConstants.LOG_TAG).i(exception, message)
Log.WARN -> Timber.tag(MeshrabiyaConstants.LOG_TAG).w(exception, message)
Log.ERROR -> Timber.tag(MeshrabiyaConstants.LOG_TAG).e(exception, message)
Log.ASSERT -> Timber.tag(MeshrabiyaConstants.LOG_TAG).wtf(exception, message)
}

val logDisplay = buildString {
Expand Down
97 changes: 61 additions & 36 deletions app/src/main/java/com/greybox/projectmesh/MainActivity.kt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import com.ustadmobile.meshrabiya.vnet.wifi.WifiConnectException
import java.util.regex.Pattern
import android.util.Log


// This File is to pre-check the wifi connection, reusing from Meshrabiya test app
/*
WorkFlow:
Expand Down
10 changes: 3 additions & 7 deletions app/src/main/java/com/greybox/projectmesh/debug/CrashHandler.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package com.greybox.projectmesh.debug

import android.R.layout
import android.content.Context
import android.content.Intent
import android.util.Log
import android.widget.FrameLayout
import android.widget.PopupWindow
import com.google.gson.Gson
import org.xml.sax.helpers.DefaultHandler
import timber.log.Timber
import java.lang.Exception
import java.lang.Thread.UncaughtExceptionHandler
import kotlin.system.exitProcess
Expand All @@ -29,7 +25,7 @@ class CrashHandler(private val context: Context, private val defaultHandler: Unc
{
val crashIntent = Intent(applicationContext, activity).also {
it.putExtra("CrashData", Gson().toJson(exception))
Log.e("Project Mesh Error","Error: ",exception);
Timber.tag("Project Mesh Error").e(exception, "Error: ");
}

crashIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
Expand All @@ -50,7 +46,7 @@ class CrashHandler(private val context: Context, private val defaultHandler: Unc
Gson().fromJson(intent.getStringExtra("CrashData"), Throwable::class.java)
}
catch (e: Exception) {
Log.e("CrashHandler","getThrowableFromIntent: ",e);
Timber.tag("CrashHandler",).e(e,"getThrowableFromIntent: ");
null
}

Expand Down
20 changes: 20 additions & 0 deletions app/src/main/java/com/greybox/projectmesh/logging/ReleaseTree.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.greybox.projectmesh.logging

import android.util.Log
import timber.log.Timber

class ReleaseTree : Timber.Tree() {
@Suppress("LogNotTimber")
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
// Log WARN and ERROR only to avoid leaking debug info in release
if (priority == Log.ERROR || priority == Log.WARN) {
val safeTag = tag ?: "ReleaseTree"
Log.println(priority, safeTag, message)

// Log Exceptions if present
t?.let {
Log.e(safeTag, "Exception: $message", it)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,12 @@ import android.net.Uri
import java.io.File
import java.io.FileOutputStream
import java.io.InputStream
import java.io.OutputStream
import kotlin.io.encoding.Base64
import kotlin.io.encoding.ExperimentalEncodingApi
import android.content.SharedPreferences
import android.os.Build
import android.util.Log
import com.greybox.projectmesh.GlobalApp
import com.greybox.projectmesh.db.MeshDatabase
import com.greybox.projectmesh.messaging.data.entities.Message
import com.greybox.projectmesh.messaging.network.MessageNetworkHandler
import com.greybox.projectmesh.extension.updateItem
import com.greybox.projectmesh.testing.TestDeviceService
import com.ustadmobile.meshrabiya.ext.copyToWithProgressCallback
import com.ustadmobile.meshrabiya.util.FileSerializer
import com.ustadmobile.meshrabiya.util.InetAddressSerializer
import fi.iki.elonen.NanoHTTPD
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.cancel
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.flow.updateAndGet
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.internal.headersContentLength
import java.io.Closeable
import java.net.InetAddress
import java.net.URLEncoder
import java.util.concurrent.atomic.AtomicInteger
import com.greybox.projectmesh.extension.getUriNameAndSize
import org.kodein.di.DI
import org.kodein.di.DIAware
import org.kodein.di.instance
import okhttp3.HttpUrl
import okhttp3.MediaType.Companion.toMediaType
import java.net.HttpURLConnection
import java.net.URL
import java.net.URLConnection
import java.net.URLDecoder

//Use this to encode files not just images
//Needs to be tested sometime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.greybox.projectmesh.messaging.data.entities

import android.util.Log
import org.json.JSONObject
import org.json.JSONException
import timber.log.Timber

class JSONSchema {

Expand All @@ -22,16 +22,16 @@ class JSONSchema {
"""
//Takes JSON string and validates it against JSON Schema
fun schemaValidation(json: String): Boolean {
//Log.d("JSONSchema", "Validating JSON: $json")
//Log.d("JSONSchema", "Against schema: $schemaString")
//Timber.tag("JSONSchema").d("Validating JSON: $json")
//Timber.tag("JSONSchema").d("Against schema: $schemaString")
try {
val schemaJson = JSONObject(schemaString)
val jsonObject = JSONObject(json)

validate(jsonObject, schemaJson)
return true
}catch (e: JSONException) {
Log.e("JSONSchema", "JSON schema validation failed: ${e.message}")
Timber.tag("JSONSchema",).e("JSON schema validation failed: ${e.message}")
return false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.util.Log
import androidx.core.app.NotificationCompat
import com.google.gson.Gson
import com.greybox.projectmesh.GlobalApp
import com.greybox.projectmesh.MainActivity
import com.greybox.projectmesh.R
Expand All @@ -17,7 +15,6 @@ import com.greybox.projectmesh.messaging.utils.ConversationUtils
import com.greybox.projectmesh.messaging.repository.ConversationRepository
import com.greybox.projectmesh.server.AppServer
import com.greybox.projectmesh.testing.TestDeviceService
import com.greybox.projectmesh.util.NotificationHelper
import java.net.InetAddress
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand All @@ -29,11 +26,8 @@ import okhttp3.Request
import org.kodein.di.DI
import org.kodein.di.DIAware
import org.kodein.di.instance
import com.greybox.projectmesh.user.UserRepository
import kotlinx.coroutines.runBlocking
import android.content.SharedPreferences
import android.os.Parcel
import android.os.Parcelable
import timber.log.Timber
import java.net.URI

class MessageNetworkHandler(
Expand Down Expand Up @@ -69,7 +63,7 @@ class MessageNetworkHandler(
.get()
.build()

Log.d("MessageNetworkHandler", "Request URL: ${request.url}")
Timber.tag("MessageNetworkHandler").d("Request URL: ${request.url}")
//Turn this into JSON
/*
val gs = Gson()
Expand All @@ -89,20 +83,25 @@ class MessageNetworkHandler(
try {
httpClient.newCall(request).execute().use { response ->
if (response.isSuccessful) {
Log.d("MessageNetworkHandler", "Message sent successfully")
Timber.tag("MessageNetworkHandler").d("Message sent successfully")
} else {
Log.e("MessageNetworkHandler", "Failed to send message: ${response.code}")
Timber.tag("MessageNetworkHandler").e("Failed to send message: " +
"${response
.code}")
}
}
} catch (e: Exception) {
Log.e("MessageNetworkHandler", "Failed to send message, connection error: ${e.message}", e)
Timber.tag("MessageNetworkHandler").e(e,"Failed to send message, connection " +
"error: ${e.message}")
}

} catch (e: Exception) {
Log.e("MessageNetworkHandler", "Failed to send message to ${address.hostAddress}")
Timber.tag("MessageNetworkHandler").e("Failed to send message to ${address
.hostAddress}")
}
}
}

companion object {
//process incoming messages and route them to the correct conversation
fun handleIncomingMessage(
Expand All @@ -111,8 +110,8 @@ class MessageNetworkHandler(
senderIp: InetAddress,
incomingfile: URI?
): Message {
Log.d(
"MessageNetworkHandler",
Timber.tag(
"MessageNetworkHandler").d(
"Handling incoming message: $chatMessage, from: ${senderIp.hostAddress}, has file: ${incomingfile != null}"
)

Expand All @@ -134,8 +133,8 @@ class MessageNetworkHandler(
val localUuid = GlobalApp.GlobalUserRepo.prefs.getString("UUID", null) ?: "local-user"
val chatName = ConversationUtils.createConversationId(localUuid, userUuid)

Log.d(
"MessageNetworkHandler",
Timber.tag(
"MessageNetworkHandler").d(
"Creating message with chat name: $chatName, sender: $sender"
)

Expand Down Expand Up @@ -168,9 +167,9 @@ class MessageNetworkHandler(
)
}

Log.d("MessageNetworkHandler", "Updated conversation with new message")
Timber.tag("MessageNetworkHandler").d("Updated conversation with new message")
} catch (e: Exception) {
Log.e("MessageNetworkHandler", "Failed to update conversation", e)
Timber.tag("MessageNetworkHandler").e(e,"Failed to update conversation")
}
}
return message
Expand All @@ -190,7 +189,7 @@ class MessageNetworkHandler(
?.getDeclaredField("INSTANCE")?.get(null) as? Context
?: throw Exception("Cannot get application context")
} catch (e: Exception) {
Log.e("MessageNetworkHandler", "Failed to get application context", e)
Timber.tag("MessageNetworkHandler").e(e,"Failed to get application context")
return
}

Expand Down Expand Up @@ -228,9 +227,9 @@ class MessageNetworkHandler(
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.notify(message.hashCode(), notification)

Log.d("MessageNetworkHandler", "Showed notification for message with file")
Timber.tag("MessageNetworkHandler").d("Showed notification for message with file")
} catch (e: Exception) {
Log.e("MessageNetworkHandler", "Failed to show notification", e)
Timber.tag("MessageNetworkHandler").e(e, "Failed to show notification")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@
package com.greybox.projectmesh.messaging.network

import android.content.SharedPreferences
import android.util.Log
import com.greybox.projectmesh.GlobalApp
import com.greybox.projectmesh.messaging.repository.MessageRepository
import com.greybox.projectmesh.messaging.data.entities.Message
import com.greybox.projectmesh.messaging.repository.ConversationRepository
import com.greybox.projectmesh.messaging.data.entities.Conversation
import com.greybox.projectmesh.messaging.utils.MessageUtils
import com.greybox.projectmesh.user.UserRepository
import java.net.InetAddress
import org.kodein.di.DI
import org.kodein.di.DIAware
import org.kodein.di.instance
import timber.log.Timber

class MessageService(
override val di: DI
Expand Down Expand Up @@ -61,7 +58,7 @@ class MessageService(

}
}catch (e: Exception){
Log.e("MessageService", "Error updating conversation with message", e)
Timber.tag("MessageService").e(e,"Error updating conversation with message")
}
}
}
Loading