@@ -34,7 +34,7 @@ import androidx.core.net.toUri
3434 * Loaded into the React PackageList via MainApplication's instantiation of the StartPackage.
3535 */
3636class StartModule (reactContext : ReactApplicationContext ) : ReactContextBaseJavaModule(reactContext), ActivityEventListener {
37- private val tag = " [${MainActivity .loggerTag} ]StartModule"
37+ private val TAG = " [${MainActivity .loggerTag} ]StartModule"
3838
3939 companion object {
4040 private var reactContext: ReactApplicationContext ? = null
@@ -47,7 +47,7 @@ class StartModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
4747 init {
4848 StartModule .reactContext = reactContext
4949 StartModule .reactContext?.addActivityEventListener(this )
50- Log .d(tag , " StartModule is now initialized." )
50+ Log .d(TAG , " StartModule is now initialized." )
5151 }
5252
5353 override fun getName (): String {
@@ -65,7 +65,7 @@ class StartModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
6565 MediaProjectionService .getStartIntent(reactContext!! , resultCode, data!! )
6666 )
6767 sendEvent(" MediaProjectionService" , " Running" )
68- Log .d(tag , " MediaProjectionService is now running." )
68+ Log .d(TAG , " MediaProjectionService is now running." )
6969 }
7070 }
7171
@@ -92,7 +92,7 @@ class StartModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
9292 // unregister in stopProjection().
9393 EventBus .getDefault().unregister(this )
9494 EventBus .getDefault().register(this )
95- Log .d(tag , " Event Bus registered for StartModule" )
95+ Log .d(TAG , " Event Bus registered for StartModule" )
9696 val mediaProjectionManager = reactContext?.getSystemService(Context .MEDIA_PROJECTION_SERVICE ) as MediaProjectionManager
9797 reactContext?.startActivityForResult(mediaProjectionManager.createScreenCaptureIntent(), 100 , null )
9898 }
@@ -102,7 +102,7 @@ class StartModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
102102 */
103103 private fun stopProjection () {
104104 EventBus .getDefault().unregister(this )
105- Log .d(tag , " Event Bus unregistered for StartModule" )
105+ Log .d(TAG , " Event Bus unregistered for StartModule" )
106106 reactContext?.startService(MediaProjectionService .getStopIntent(reactContext!! ))
107107 sendEvent(" MediaProjectionService" , " Not Running" )
108108 }
@@ -135,7 +135,7 @@ class StartModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
135135 */
136136 private fun checkForOverlayPermission (): Boolean {
137137 if (! Settings .canDrawOverlays(this .reactApplicationContext.currentActivity)) {
138- Log .d(tag , " Application is missing overlay permission." )
138+ Log .d(TAG , " Application is missing overlay permission." )
139139
140140 val builder = AlertDialog .Builder (this .reactApplicationContext.currentActivity)
141141 builder.setTitle(R .string.overlay_disabled)
@@ -154,7 +154,7 @@ class StartModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
154154 return false
155155 }
156156
157- Log .d(tag , " Application has permission to draw overlay." )
157+ Log .d(TAG , " Application has permission to draw overlay." )
158158 return true
159159 }
160160
@@ -171,7 +171,7 @@ class StartModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
171171 val enabled = prefString.contains(reactContext?.packageName.toString() + " /" + MyAccessibilityService ::class .java.name)
172172
173173 if (enabled) {
174- Log .d(tag , " This application's Accessibility Service is currently turned on." )
174+ Log .d(TAG , " This application's Accessibility Service is currently turned on." )
175175 return true
176176 }
177177 }
@@ -219,48 +219,48 @@ class StartModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
219219 fun onStartEvent (event : StartEvent ) {
220220 if (event.message == " Entry Point ON" ) {
221221 // Initialize SQLite settings with detailed debugging.
222- Log .d(tag , " Starting SQLite settings initialization..." )
222+ Log .d(TAG , " Starting SQLite settings initialization..." )
223223
224224 // Check if the database file exists before attempting to initialize.
225225 val dbFile = java.io.File (context.filesDir, " SQLite/settings.db" )
226- Log .d(tag , " Database file path: ${dbFile.absolutePath} " )
227- Log .d(tag , " Database file exists: ${dbFile.exists()} " )
228- Log .d(tag , " Database file can read: ${dbFile.canRead()} " )
229- Log .d(tag , " Database file size: ${if (dbFile.exists()) dbFile.length() else " N/A" } bytes" )
226+ Log .d(TAG , " Database file path: ${dbFile.absolutePath} " )
227+ Log .d(TAG , " Database file exists: ${dbFile.exists()} " )
228+ Log .d(TAG , " Database file can read: ${dbFile.canRead()} " )
229+ Log .d(TAG , " Database file size: ${if (dbFile.exists()) dbFile.length() else " N/A" } bytes" )
230230
231231 // List the contents of the files directory to see what's actually there.
232232 val filesDir = context.filesDir
233- Log .d(tag , " Files directory: ${filesDir.absolutePath} " )
233+ Log .d(TAG , " Files directory: ${filesDir.absolutePath} " )
234234 val files = filesDir.listFiles()
235235 if (files != null ) {
236- Log .d(tag , " Files in files directory:" )
236+ Log .d(TAG , " Files in files directory:" )
237237 for (file in files) {
238- Log .d(tag , " - ${file.name} (${if (file.isDirectory) " dir" else " file" } )" )
238+ Log .d(TAG , " - ${file.name} (${if (file.isDirectory) " dir" else " file" } )" )
239239 }
240240 }
241241
242242 // Check if SQLite subdirectory exists.
243243 val sqliteDir = java.io.File (context.filesDir, " SQLite" )
244- Log .d(tag , " SQLite directory exists: ${sqliteDir.exists()} " )
244+ Log .d(TAG , " SQLite directory exists: ${sqliteDir.exists()} " )
245245 if (sqliteDir.exists()) {
246246 val sqliteFiles = sqliteDir.listFiles()
247247 if (sqliteFiles != null ) {
248- Log .d(tag , " Files in SQLite directory:" )
248+ Log .d(TAG , " Files in SQLite directory:" )
249249 for (file in sqliteFiles) {
250- Log .d(tag , " - ${file.name} (${file.length()} bytes)" )
250+ Log .d(TAG , " - ${file.name} (${file.length()} bytes)" )
251251 }
252252 }
253253 }
254254
255255 // Check if database is available before attempting to initialize.
256256 val settingsManager = SQLiteSettingsManager (context)
257- Log .d(tag , " Database is available: ${settingsManager.isDatabaseAvailable()} " )
257+ Log .d(TAG , " Database is available: ${settingsManager.isDatabaseAvailable()} " )
258258
259259 SettingsHelper .initialize(context)
260260 if (SettingsHelper .isAvailable()) {
261- Log .d(tag , " SQLite settings initialized successfully." )
261+ Log .d(TAG , " SQLite settings initialized successfully." )
262262 } else {
263- Log .w(tag , " Failed to initialize SQLite settings, continuing with defaults." )
263+ Log .w(TAG , " Failed to initialize SQLite settings, continuing with defaults." )
264264 }
265265
266266 val entryPoint = Game (context)
@@ -285,7 +285,7 @@ class StartModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
285285 params.putInt(" id" , messageId++ )
286286 if (emitter == null ) {
287287 // Register the event emitter to send messages to JS.
288- Log .d(tag , " Event emitter not found to be able to send messages to the frontend. Registering now." )
288+ Log .d(TAG , " Event emitter not found to be able to send messages to the frontend. Registering now." )
289289 emitter = reactContext?.getJSModule(DeviceEventManagerModule .RCTDeviceEventEmitter ::class .java)
290290 }
291291
@@ -309,11 +309,11 @@ class StartModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaM
309309 */
310310 @Subscribe
311311 fun onSubscriberExceptionEvent (event : SubscriberExceptionEvent ) {
312- Log .e(tag , " Received exception event to send: ${event.throwable} " )
313- MessageLog .printToLog( event.throwable.toString(), MainActivity .loggerTag, isWarning = false , isError = true , skipPrintTime = false )
312+ Log .e(TAG , " Received exception event to send: ${event.throwable} " )
313+ MessageLog .e( MainActivity .loggerTag, event.throwable.toString())
314314 for (line in event.throwable.stackTrace) {
315- MessageLog .printToLog( " \t ${line} " , MainActivity .loggerTag, isWarning = false , isError = true , skipPrintTime = true )
315+ MessageLog .e( MainActivity .loggerTag, " \t ${line} " , skipPrintTime = true )
316316 }
317- MessageLog .printToLog( " " , MainActivity .loggerTag, isWarning = false , isError = false , skipPrintTime = true )
317+ MessageLog .d( MainActivity .loggerTag, " " , skipPrintTime = true )
318318 }
319319}
0 commit comments