Add object detection, tracking, mobile notifications, and search to any security camera.
add android project
roryclearbd1b5349c827
diff --git a/android/.DS_Store b/android/.DS_Storenew file mode 100644index 0000000..767d26eBinary files /dev/null and b/android/.DS_Store differdiff --git a/android/clearcam/.gitignore b/android/clearcam/.gitignorenew file mode 100644index 0000000..aa724b7--- /dev/null+++ b/android/clearcam/.gitignore@@ -0,0 +1,15 @@+*.iml+.gradle+/local.properties+/.idea/caches+/.idea/libraries+/.idea/modules.xml+/.idea/workspace.xml+/.idea/navEditor.xml+/.idea/assetWizardSettings.xml+.DS_Store+/build+/captures+.externalNativeBuild+.cxx+local.propertiesdiff --git a/android/clearcam/.idea/AndroidProjectSystem.xml b/android/clearcam/.idea/AndroidProjectSystem.xmlnew file mode 100644index 0000000..4a53bee--- /dev/null+++ b/android/clearcam/.idea/AndroidProjectSystem.xml@@ -0,0 +1,6 @@+<?xml version="1.0" encoding="UTF-8"?>+<project version="4">+ <component name="AndroidProjectSystem">+ <option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />+ </component>+</project>\ No newline at end of filediff --git a/android/clearcam/.idea/compiler.xml b/android/clearcam/.idea/compiler.xmlnew file mode 100644index 0000000..b86273d--- /dev/null+++ b/android/clearcam/.idea/compiler.xml@@ -0,0 +1,6 @@+<?xml version="1.0" encoding="UTF-8"?>+<project version="4">+ <component name="CompilerConfiguration">+ <bytecodeTargetLevel target="21" />+ </component>+</project>\ No newline at end of filediff --git a/android/clearcam/.idea/deploymentTargetSelector.xml b/android/clearcam/.idea/deploymentTargetSelector.xmlnew file mode 100644index 0000000..b268ef3--- /dev/null+++ b/android/clearcam/.idea/deploymentTargetSelector.xml@@ -0,0 +1,10 @@+<?xml version="1.0" encoding="UTF-8"?>+<project version="4">+ <component name="deploymentTargetSelector">+ <selectionStates>+ <SelectionState runConfigName="app">+ <option name="selectionMode" value="DROPDOWN" />+ </SelectionState>+ </selectionStates>+ </component>+</project>\ No newline at end of filediff --git a/android/clearcam/.idea/gradle.xml b/android/clearcam/.idea/gradle.xmlnew file mode 100644index 0000000..97f0a8e--- /dev/null+++ b/android/clearcam/.idea/gradle.xml@@ -0,0 +1,18 @@+<?xml version="1.0" encoding="UTF-8"?>+<project version="4">+ <component name="GradleSettings">+ <option name="linkedExternalProjectsSettings">+ <GradleProjectSettings>+ <option name="testRunner" value="CHOOSE_PER_TEST" />+ <option name="externalProjectPath" value="$PROJECT_DIR$" />+ <option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />+ <option name="modules">+ <set>+ <option value="$PROJECT_DIR$" />+ <option value="$PROJECT_DIR$/app" />+ </set>+ </option>+ </GradleProjectSettings>+ </option>+ </component>+</project>\ No newline at end of filediff --git a/android/clearcam/.idea/inspectionProfiles/Project_Default.xml b/android/clearcam/.idea/inspectionProfiles/Project_Default.xmlnew file mode 100644index 0000000..7061a0d--- /dev/null+++ b/android/clearcam/.idea/inspectionProfiles/Project_Default.xml@@ -0,0 +1,61 @@+<component name="InspectionProjectProfileManager">+ <profile version="1.0">+ <option name="myName" value="Project Default" />+ <inspection_tool class="ComposePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">+ <option name="composableFile" value="true" />+ <option name="previewFile" value="true" />+ </inspection_tool>+ <inspection_tool class="ComposePreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">+ <option name="composableFile" value="true" />+ <option name="previewFile" value="true" />+ </inspection_tool>+ <inspection_tool class="ComposePreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">+ <option name="composableFile" value="true" />+ <option name="previewFile" value="true" />+ </inspection_tool>+ <inspection_tool class="ComposePreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">+ <option name="composableFile" value="true" />+ <option name="previewFile" value="true" />+ </inspection_tool>+ <inspection_tool class="GlancePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">+ <option name="composableFile" value="true" />+ </inspection_tool>+ <inspection_tool class="GlancePreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">+ <option name="composableFile" value="true" />+ </inspection_tool>+ <inspection_tool class="GlancePreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">+ <option name="composableFile" value="true" />+ </inspection_tool>+ <inspection_tool class="GlancePreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">+ <option name="composableFile" value="true" />+ </inspection_tool>+ <inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">+ <option name="composableFile" value="true" />+ <option name="previewFile" value="true" />+ </inspection_tool>+ <inspection_tool class="PreviewApiLevelMustBeValid" enabled="true" level="ERROR" enabled_by_default="true">+ <option name="composableFile" value="true" />+ <option name="previewFile" value="true" />+ </inspection_tool>+ <inspection_tool class="PreviewDeviceShouldUseNewSpec" enabled="true" level="WEAK WARNING" enabled_by_default="true">+ <option name="composableFile" value="true" />+ <option name="previewFile" value="true" />+ </inspection_tool>+ <inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true">+ <option name="composableFile" value="true" />+ <option name="previewFile" value="true" />+ </inspection_tool>+ <inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true">+ <option name="composableFile" value="true" />+ <option name="previewFile" value="true" />+ </inspection_tool>+ <inspection_tool class="PreviewParameterProviderOnFirstParameter" enabled="true" level="ERROR" enabled_by_default="true">+ <option name="composableFile" value="true" />+ <option name="previewFile" value="true" />+ </inspection_tool>+ <inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">+ <option name="composableFile" value="true" />+ <option name="previewFile" value="true" />+ </inspection_tool>+ </profile>+</component>\ No newline at end of filediff --git a/android/clearcam/.idea/kotlinc.xml b/android/clearcam/.idea/kotlinc.xmlnew file mode 100644index 0000000..c224ad5--- /dev/null+++ b/android/clearcam/.idea/kotlinc.xml@@ -0,0 +1,6 @@+<?xml version="1.0" encoding="UTF-8"?>+<project version="4">+ <component name="KotlinJpsPluginSettings">+ <option name="version" value="2.0.21" />+ </component>+</project>\ No newline at end of filediff --git a/android/clearcam/.idea/migrations.xml b/android/clearcam/.idea/migrations.xmlnew file mode 100644index 0000000..f8051a6--- /dev/null+++ b/android/clearcam/.idea/migrations.xml@@ -0,0 +1,10 @@+<?xml version="1.0" encoding="UTF-8"?>+<project version="4">+ <component name="ProjectMigrations">+ <option name="MigrateToGradleLocalJavaHome">+ <set>+ <option value="$PROJECT_DIR$" />+ </set>+ </option>+ </component>+</project>\ No newline at end of filediff --git a/android/clearcam/.idea/misc.xml b/android/clearcam/.idea/misc.xmlnew file mode 100644index 0000000..74dd639--- /dev/null+++ b/android/clearcam/.idea/misc.xml@@ -0,0 +1,10 @@+<?xml version="1.0" encoding="UTF-8"?>+<project version="4">+ <component name="ExternalStorageConfigurationManager" enabled="true" />+ <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">+ <output url="file://$PROJECT_DIR$/build/classes" />+ </component>+ <component name="ProjectType">+ <option name="id" value="Android" />+ </component>+</project>\ No newline at end of filediff --git a/android/clearcam/.idea/runConfigurations.xml b/android/clearcam/.idea/runConfigurations.xmlnew file mode 100644index 0000000..16660f1--- /dev/null+++ b/android/clearcam/.idea/runConfigurations.xml@@ -0,0 +1,17 @@+<?xml version="1.0" encoding="UTF-8"?>+<project version="4">+ <component name="RunConfigurationProducerService">+ <option name="ignoredProducers">+ <set>+ <option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />+ <option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />+ <option value="com.intellij.execution.junit.PatternConfigurationProducer" />+ <option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />+ <option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />+ <option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />+ <option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />+ <option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />+ </set>+ </option>+ </component>+</project>\ No newline at end of filediff --git a/android/clearcam/.idea/vcs.xml b/android/clearcam/.idea/vcs.xmlnew file mode 100644index 0000000..6c0b863--- /dev/null+++ b/android/clearcam/.idea/vcs.xml@@ -0,0 +1,6 @@+<?xml version="1.0" encoding="UTF-8"?>+<project version="4">+ <component name="VcsDirectoryMappings">+ <mapping directory="$PROJECT_DIR$/.." vcs="Git" />+ </component>+</project>\ No newline at end of filediff --git a/android/clearcam/app/.gitignore b/android/clearcam/app/.gitignorenew file mode 100644index 0000000..42afabf--- /dev/null+++ b/android/clearcam/app/.gitignore@@ -0,0 +1 @@+/build\ No newline at end of filediff --git a/android/clearcam/app/build.gradle b/android/clearcam/app/build.gradlenew file mode 100644index 0000000..6c16566--- /dev/null+++ b/android/clearcam/app/build.gradle@@ -0,0 +1,66 @@+plugins {+ id 'com.google.gms.google-services'+ alias(libs.plugins.android.application)+ alias(libs.plugins.kotlin.android)+ alias(libs.plugins.kotlin.compose)+}++android {+ namespace 'com.rors.clearcam'+ compileSdk 35++ defaultConfig {+ applicationId "com.rors.clearcam"+ minSdk 24+ targetSdk 35+ versionCode 1+ versionName "1.0"++ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"+ }++ buildTypes {+ release {+ minifyEnabled false+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'+ }+ }+ compileOptions {+ sourceCompatibility JavaVersion.VERSION_11+ targetCompatibility JavaVersion.VERSION_11+ }+ kotlinOptions {+ jvmTarget = '11'+ }+ buildFeatures {+ compose true+ }+}++dependencies {+ implementation "androidx.datastore:datastore-preferences:1.0.0"+ implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.2"+ implementation "androidx.compose.ui:ui:1.6.0"+ implementation "androidx.compose.material3:material3:1.2.0"+ implementation "androidx.navigation:navigation-compose:2.7.5"+ implementation "androidx.compose.foundation:foundation:1.5.0"+ implementation "androidx.compose.material:material-icons-extended:1.6.0"+ implementation "com.google.firebase:firebase-messaging"+ implementation libs.androidx.core.ktx+ implementation libs.androidx.lifecycle.runtime.ktx+ implementation libs.androidx.activity.compose+ implementation platform(libs.androidx.compose.bom)+ implementation libs.androidx.ui+ implementation libs.androidx.ui.graphics+ implementation libs.androidx.ui.tooling.preview+ implementation libs.androidx.material3+ testImplementation libs.junit+ androidTestImplementation libs.androidx.junit+ androidTestImplementation libs.androidx.espresso.core+ androidTestImplementation platform(libs.androidx.compose.bom)+ androidTestImplementation libs.androidx.ui.test.junit4+ debugImplementation libs.androidx.ui.tooling+ debugImplementation libs.androidx.ui.test.manifest+ implementation platform('com.google.firebase:firebase-bom:34.0.0')+ implementation 'com.google.firebase:firebase-analytics'+}\ No newline at end of filediff --git a/android/clearcam/app/google-services.json b/android/clearcam/app/google-services.jsonnew file mode 100644index 0000000..9c1b5a6--- /dev/null+++ b/android/clearcam/app/google-services.json@@ -0,0 +1,29 @@+{+ "project_info": {+ "project_number": "765515979480",+ "project_id": "clearcam-6e490",+ "storage_bucket": "clearcam-6e490.firebasestorage.app"+ },+ "client": [+ {+ "client_info": {+ "mobilesdk_app_id": "1:765515979480:android:6e7ebcaaab760e365755ad",+ "android_client_info": {+ "package_name": "com.rors.clearcam"+ }+ },+ "oauth_client": [],+ "api_key": [+ {+ "current_key": "AIzaSyB5bMBTRykCPiB26K8e562rVUxfu9gY3mk"+ }+ ],+ "services": {+ "appinvite_service": {+ "other_platform_oauth_client": []+ }+ }+ }+ ],+ "configuration_version": "1"+}\ No newline at end of filediff --git a/android/clearcam/app/proguard-rules.pro b/android/clearcam/app/proguard-rules.pronew file mode 100644index 0000000..481bb43--- /dev/null+++ b/android/clearcam/app/proguard-rules.pro@@ -0,0 +1,21 @@+# Add project specific ProGuard rules here.+# You can control the set of applied configuration files using the+# proguardFiles setting in build.gradle.+#+# For more details, see+# http://developer.android.com/guide/developing/tools/proguard.html++# If your project uses WebView with JS, uncomment the following+# and specify the fully qualified class name to the JavaScript interface+# class:+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {+# public *;+#}++# Uncomment this to preserve the line number information for+# debugging stack traces.+#-keepattributes SourceFile,LineNumberTable++# If you keep the line number information, uncomment this to+# hide the original source file name.+#-renamesourcefileattribute SourceFile\ No newline at end of filediff --git a/android/clearcam/app/src/androidTest/java/com/rors/clearcam/ExampleInstrumentedTest.kt b/android/clearcam/app/src/androidTest/java/com/rors/clearcam/ExampleInstrumentedTest.ktnew file mode 100644index 0000000..af9a122--- /dev/null+++ b/android/clearcam/app/src/androidTest/java/com/rors/clearcam/ExampleInstrumentedTest.kt@@ -0,0 +1,24 @@+package com.rors.clearcam++import androidx.test.platform.app.InstrumentationRegistry+import androidx.test.ext.junit.runners.AndroidJUnit4++import org.junit.Test+import org.junit.runner.RunWith++import org.junit.Assert.*++/**+ * Instrumented test, which will execute on an Android device.+ *+ * See [testing documentation](http://d.android.com/tools/testing).+ */+@RunWith(AndroidJUnit4::class)+class ExampleInstrumentedTest {+ @Test+ fun useAppContext() {+ // Context of the app under test.+ val appContext = InstrumentationRegistry.getInstrumentation().targetContext+ assertEquals("com.rors.clearcam", appContext.packageName)+ }+}\ No newline at end of filediff --git a/android/clearcam/app/src/main/AndroidManifest.xml b/android/clearcam/app/src/main/AndroidManifest.xmlnew file mode 100644index 0000000..5dd2acd--- /dev/null+++ b/android/clearcam/app/src/main/AndroidManifest.xml@@ -0,0 +1,47 @@+<?xml version="1.0" encoding="utf-8"?>+<manifest xmlns:android="http://schemas.android.com/apk/res/android"+ xmlns:tools="http://schemas.android.com/tools">+ <uses-permission android:name="android.permission.INTERNET" />+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"+ android:maxSdkVersion="28" />++ <!-- Add this permission for file sharing -->+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"+ android:maxSdkVersion="28" />++ <application+ android:allowBackup="true"+ android:dataExtractionRules="@xml/data_extraction_rules"+ android:fullBackupContent="@xml/backup_rules"+ android:icon="@mipmap/ic_launcher"+ android:label="@string/app_name"+ android:roundIcon="@mipmap/ic_launcher_round"+ android:supportsRtl="true"+ android:theme="@style/Theme.Clearcam"+ tools:targetApi="31">++ <!-- Add this provider inside the application tag -->+ <provider+ android:name="androidx.core.content.FileProvider"+ android:authorities="${applicationId}.provider"+ android:exported="false"+ android:grantUriPermissions="true">+ <meta-data+ android:name="android.support.FILE_PROVIDER_PATHS"+ android:resource="@xml/file_paths" />+ </provider>++ <activity+ android:name=".MainActivity"+ android:exported="true"+ android:configChanges="screenSize|screenLayout|orientation"+ android:windowSoftInputMode="adjustResize"+ android:label="@string/app_name"+ android:theme="@style/Theme.Clearcam">+ <intent-filter>+ <action android:name="android.intent.action.MAIN" />+ <category android:name="android.intent.category.LAUNCHER" />+ </intent-filter>+ </activity>+ </application>+</manifest>\ No newline at end of filediff --git a/android/clearcam/app/src/main/ic_launcher-playstore.png b/android/clearcam/app/src/main/ic_launcher-playstore.pngnew file mode 100644index 0000000..379505fBinary files /dev/null and b/android/clearcam/app/src/main/ic_launcher-playstore.png differdiff --git a/android/clearcam/app/src/main/java/com/rors/clearcam/HomeScreen.kt b/android/clearcam/app/src/main/java/com/rors/clearcam/HomeScreen.ktnew file mode 100644index 0000000..20463b7--- /dev/null+++ b/android/clearcam/app/src/main/java/com/rors/clearcam/HomeScreen.kt@@ -0,0 +1,1346 @@+package com.rors.clearcam++import android.app.Activity+import android.content.Context+import android.content.Intent+import android.content.pm.PackageManager+import android.graphics.Bitmap+import android.os.Build+import android.util.Log+import android.widget.VideoView+import androidx.compose.foundation.Image+import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.horizontalScroll+import androidx.compose.foundation.layout.*+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.foundation.verticalScroll+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.filled.Close+import androidx.compose.material.icons.filled.PlayArrow+import androidx.compose.material3.*+import androidx.compose.runtime.*+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Brush+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.asImageBitmap+import androidx.compose.ui.layout.ContentScale+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.text.style.TextAlign+import androidx.compose.ui.unit.dp+import androidx.compose.ui.viewinterop.AndroidView+import androidx.core.content.FileProvider+import kotlinx.coroutines.*+import java.io.File+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.foundation.gestures.detectVerticalDragGestures+import androidx.compose.ui.input.pointer.pointerInput+import androidx.compose.material.icons.filled.PlayArrow+import androidx.compose.material.icons.filled.Close+import androidx.compose.material.icons.filled.Pause+import androidx.compose.material.icons.filled.Stop+import androidx.compose.material.icons.filled.Pause+import androidx.activity.compose.BackHandler+import androidx.compose.material.icons.filled.Delete+import androidx.compose.material.icons.filled.MoreVert+import androidx.compose.material.icons.filled.Settings+import androidx.compose.material.icons.filled.Share+import androidx.core.app.ActivityCompat+import androidx.core.content.ContextCompat+import android.Manifest+import android.graphics.BitmapFactory+import android.widget.Toast+import androidx.compose.foundation.text.KeyboardOptions+import androidx.compose.material.icons.filled.Lock+import androidx.compose.material.icons.filled.Refresh+import androidx.compose.ui.text.input.KeyboardType+import androidx.compose.ui.text.input.PasswordVisualTransformation+import com.google.firebase.messaging.FirebaseMessaging+import com.rors.clearcam.SettingsScreen+import java.io.OutputStreamWriter+import java.net.HttpURLConnection+import java.net.URL+import java.io.FileOutputStream+import java.net.URLDecoder+import java.net.URLEncoder+import java.nio.charset.StandardCharsets+++private const val APP_VIDEO_DIR = "videos"+private const val SEGMENT_DOWNLOAD_INTERVAL_MS = 1000L+private const val LINK_REFRESH_INTERVAL_MS = 50000L++@Composable+private fun DecryptionKeyDialog(+ onDismiss: () -> Unit,+ onConfirm: (String) -> Unit+) {+ var decryptionKey by remember { mutableStateOf("") }++ AlertDialog(+ onDismissRequest = onDismiss,+ title = { Text("Enter Decryption Key") },+ text = {+ Column {+ Text("This video is encrypted. Please enter the decryption key:")+ Spacer(modifier = Modifier.height(8.dp))+ OutlinedTextField(+ value = decryptionKey,+ onValueChange = { decryptionKey = it },+ label = { Text("Decryption Key") },+ visualTransformation = PasswordVisualTransformation(),+ keyboardOptions = KeyboardOptions(+ keyboardType = KeyboardType.Password,+ autoCorrect = false+ ),+ singleLine = true,+ modifier = Modifier.fillMaxWidth()+ )+ }+ },+ confirmButton = {+ Button(+ onClick = { onConfirm(decryptionKey) },+ enabled = decryptionKey.isNotBlank()+ ) {+ Text("Decrypt")+ }+ },+ dismissButton = {+ TextButton(onClick = onDismiss) {+ Text("Cancel")+ }+ }+ )+}++object ThumbnailCache {+ private const val CACHE_DIR = "thumbnails"++ fun getCachedThumbnail(context: Context, videoId: String): Bitmap? {+ val cacheFile = getCacheFile(context, videoId)+ return if (cacheFile.exists()) {+ BitmapFactory.decodeFile(cacheFile.absolutePath)+ } else {+ null+ }+ }++ fun cacheThumbnail(context: Context, videoId: String, bitmap: Bitmap) {+ val cacheFile = getCacheFile(context, videoId)+ try {+ FileOutputStream(cacheFile).use { out ->+ bitmap.compress(Bitmap.CompressFormat.JPEG, 85, out)+ }+ } catch (e: Exception) {+ e.printStackTrace()+ }+ }++ fun deleteCachedThumbnail(context: Context, videoId: String) {+ val cacheFile = getCacheFile(context, videoId)+ if (cacheFile.exists()) {+ cacheFile.delete()+ }+ }++ private fun getCacheFile(context: Context, videoId: String): File {+ val cacheDir = File(context.cacheDir, CACHE_DIR)+ if (!cacheDir.exists()) cacheDir.mkdirs()+ return File(cacheDir, "thumbnail_${videoId.hashCode()}.jpg")+ }+}+++suspend fun deleteVideoFromBackend(userId: String, filename: String) {+ withContext(Dispatchers.IO) {+ try {+ val backendFilename = filename+ val encodedName = URLEncoder.encode(backendFilename, "UTF-8")+ val url = URL("https://rors.ai/video?session_token=$userId&name=$encodedName")++ val connection = url.openConnection() as HttpURLConnection+ connection.apply {+ requestMethod = "DELETE"+ connectTimeout = 15000+ readTimeout = 15000+ }++ connection.connect()+ connection.responseCode+ } catch (e: Exception) {+ Log.e("DeleteVideo", "Failed to delete video from backend", e)+ }+ }+}++fun getDecryptionKeys(context: Context): MutableList<String> {+ val prefs = context.getSharedPreferences("clearcam_prefs", Context.MODE_PRIVATE)+ val keysString = prefs.getString("decryption_keys", null)+ return keysString?.split("||")?.toMutableList() ?: mutableListOf()+}++fun saveDecryptionKeys(context: Context, keys: List<String>) {+ val prefs = context.getSharedPreferences("clearcam_prefs", Context.MODE_PRIVATE)+ prefs.edit().putString("decryption_keys", keys.joinToString("||")).apply()+}++fun addDecryptionKey(context: Context, key: String) {+ val keys = getDecryptionKeys(context)+ if (key !in keys) {+ keys.add(key)+ saveDecryptionKeys(context, keys)+ }+}++@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun HomeScreen(userId: String) {+ var cameraNames by remember { mutableStateOf<List<String>>(emptyList()) }+ var eventVideos by remember { mutableStateOf<List<EventVideo>>(emptyList()) }+ var isLoading by remember { mutableStateOf(true) }+ var errorMessage by remember { mutableStateOf<String?>(null) }+ var showVideoPlayer by remember { mutableStateOf(false) }+ var currentVideoPath by remember { mutableStateOf("") }+ var showLiveStream by remember { mutableStateOf(false) }+ var currentCameraName by remember { mutableStateOf("") }+ var showSettings by remember { mutableStateOf(false) }++ if (showSettings) {+ SettingsScreen(onBackPressed = { showSettings = false })+ return+ }++ val context = LocalContext.current++ val coroutineScope = rememberCoroutineScope()+ val videosDir = remember { File(context.filesDir, APP_VIDEO_DIR) }++ val scrollState = rememberScrollState()+ var isRefreshing by remember { mutableStateOf(false) }+ var refreshTrigger by remember { mutableStateOf(0f) }++ fun loadVideosFromStorage() {+ eventVideos = loadAllVideos(videosDir)+ }++ fun refreshData() {+ coroutineScope.launch {+ try {+ if (!videosDir.exists()) videosDir.mkdirs()++ val camerasDeferred = async { fetchCameraNames(userId) }+ val newestTime = getNewestCreationTimeFromFiles(videosDir)+ val newVideos = fetchEventVideos(userId, newestTime / 1000)++ cameraNames = camerasDeferred.await()+ val decryptionKeys = getDecryptionKeys(context).toMutableList()++ // First try to decrypt any existing encrypted files with all available keys+ videosDir.listFiles()?.forEach { file ->+ if (file.name.endsWith(".aes")) {+ val outputFilename = file.name.removeSuffix(".aes")+ val videoFile = File(videosDir, outputFilename)++ if (!videoFile.exists()) {+ for (key in decryptionKeys) {+ try {+ val aesData = file.readBytes()+ if (decryptAesFileToMp4(aesData, videoFile, key)) {+ // Success - delete the encrypted file+ file.delete()+ break+ }+ } catch (e: Exception) {+ Log.e("Decrypt", "Failed to decrypt ${file.name} with key $key", e)+ }+ }+ }+ }+ }++ // Then process new videos+ newVideos.forEach { video ->+ try {+ val outputFilename = video.fileName.removeSuffix(".aes")+ val videoFile = File(videosDir, outputFilename)+ val encryptedFile = File(videosDir, video.fileName)++ if (!videoFile.exists()) {+ val aesData = downloadUrl(video.url)+ encryptedFile.writeBytes(aesData)++ var success = false+ for (key in decryptionKeys) {+ if (decryptAesFileToMp4(aesData, videoFile, key)) {+ success = true+ encryptedFile.delete()+ break+ }+ }++ if (!success) {+ // Keep the encrypted file if decryption fails+ videoFile.delete()+ }+ }+ } catch (e: Exception) {+ Log.e("Decrypt", "Failed for ${video.fileName}", e)+ }+ }++ loadVideosFromStorage()+ errorMessage = null+ } catch (e: Exception) {+ errorMessage = "Error: ${e.message}"+ } finally {+ isLoading = false+ }+ }+ }++ LaunchedEffect(userId) {+ refreshData()+ }++ LaunchedEffect(userId) {+ while (true) {+ delay(10000L)+ refreshData()+ }+ }++ if (showVideoPlayer) {+ SimpleVideoPlayer(+ videoPath = currentVideoPath,+ onDismiss = { showVideoPlayer = false }+ )+ return+ }++ if (showLiveStream) {+ LiveStreamPlayer(+ userId = userId,+ cameraName = currentCameraName,+ onDismiss = { showLiveStream = false }+ )+ return+ }++ Box(+ modifier = Modifier+ .fillMaxSize()+ .pointerInput(Unit) {+ detectVerticalDragGestures { _, dragAmount ->+ if (scrollState.value == 0 && dragAmount > 0) {+ refreshTrigger = dragAmount.coerceAtMost(150f)+ if (refreshTrigger >= 150f && !isRefreshing) {+ isRefreshing = true+ refreshData()+ isRefreshing = false+ refreshTrigger = 0f+ }+ }+ }+ }+ ) {+ Column(+ modifier = Modifier+ .fillMaxSize()+ .padding(16.dp)+ .verticalScroll(scrollState)+ ) {+ // 🔝 Compact scrollable top bar+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .height(48.dp),+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.SpaceBetween+ ) {+ Spacer(modifier = Modifier.width(48.dp)) // Left placeholder (optional)++ IconButton(onClick = { showSettings = true }) {+ Icon(+ imageVector = Icons.Default.Settings,+ contentDescription = "Settings"+ )+ }+ }++ Spacer(modifier = Modifier.height(16.dp))++ if (refreshTrigger > 0) {+ Box(+ modifier = Modifier+ .fillMaxWidth()+ .height(64.dp),+ contentAlignment = Alignment.Center+ ) {+ CircularProgressIndicator(+ modifier = Modifier.size(36.dp),+ strokeWidth = 3.dp+ )+ }+ }++ Spacer(modifier = Modifier.height(16.dp))++ when {+ isLoading -> Box(+ modifier = Modifier.fillMaxSize(),+ contentAlignment = Alignment.Center+ ) {+ CircularProgressIndicator()+ }++ errorMessage != null -> Box(+ modifier = Modifier.fillMaxSize(),+ contentAlignment = Alignment.Center+ ) {+ Text(+ text = errorMessage!!,+ color = MaterialTheme.colorScheme.error,+ textAlign = TextAlign.Center+ )+ }++ else -> {+ CameraHorizontalList(+ cameraNames = cameraNames,+ userId = userId,+ onCameraClick = { cameraName ->+ currentCameraName = cameraName+ showLiveStream = true+ },+ onRefresh = { refreshData() } // Pass the existing refresh function+ )++ Spacer(modifier = Modifier.height(24.dp))++ EventVideoSection(+ eventVideos = eventVideos,+ context = context,+ onVideoClick = { videoPath ->+ currentVideoPath = videoPath+ showVideoPlayer = true+ },+ onVideoDeleted = { deletedVideo ->+ val file = File(videosDir, deletedVideo.fileName)+ if (file.exists()) {+ file.delete()+ }+ // Clear the thumbnail cache+ ThumbnailCache.deleteCachedThumbnail(context, deletedVideo.fileName)++ coroutineScope.launch {+ deleteVideoFromBackend(userId, deletedVideo.fileName)+ refreshData()+ }+ eventVideos = eventVideos.filter { it != deletedVideo }+ },+ onVideoShared = { video ->+ val videoFile = File(videosDir, video.fileName)+ val uri = FileProvider.getUriForFile(+ context,+ "${context.packageName}.provider",+ videoFile+ )+ val shareIntent = Intent(Intent.ACTION_SEND).apply {+ type = "video/mp4"+ putExtra(Intent.EXTRA_STREAM, uri)+ addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)+ }+ context.startActivity(Intent.createChooser(shareIntent, "Share Video"))+ },+ userId = userId+ )+ }+ }+ }+ }+}++@Composable+fun SimpleVideoPlayer(videoPath: String, onDismiss: () -> Unit) {+ val context = LocalContext.current+ var showError by remember { mutableStateOf(false) }+ var isPlaying by remember { mutableStateOf(true) }+ var currentPosition by remember { mutableStateOf(0) }+ var duration by remember { mutableStateOf(0) }+ var showControls by remember { mutableStateOf(false) }+ var isScrubbing by remember { mutableStateOf(false) }+ val videoViewRef = remember { mutableStateOf<VideoView?>(null) }+ val coroutineScope = rememberCoroutineScope()++ // Track playback states+ var isPrepared by remember { mutableStateOf(false) }+ var isInitialPlay by remember { mutableStateOf(true) }++ // Handle video playback+ LaunchedEffect(videoPath) {+ videoViewRef.value?.apply {+ // Reset states+ showError = false+ isPrepared = false++ // Reset the video view+ stopPlayback()+ setVideoPath("")++ // Set the new path+ setVideoPath(videoPath)+ }+ }++ fun stopAndDismiss() {+ videoViewRef.value?.stopPlayback()+ onDismiss()+ }++ BackHandler(enabled = true) {+ stopAndDismiss()+ }++ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(Color.Black)+ .clickable { showControls = !showControls }+ ) {+ AndroidView(+ factory = { ctx ->+ VideoView(ctx).apply {+ videoViewRef.value = this+ setVideoPath(videoPath)++ setOnPreparedListener { mp ->+ duration = mp.duration+ isPrepared = true+ showError = false++ if (isInitialPlay) {+ mp.start()+ isInitialPlay = false+ }+ isPlaying = true++ // Update position periodically+ coroutineScope.launch {+ while (isActive) {+ if (!isScrubbing) {+ currentPosition = [email protected]+ }+ delay(200)+ }+ }+ }++ setOnCompletionListener {+ isPlaying = false+ currentPosition = duration+ // Auto-replay+ seekTo(0)+ start()+ }++ setOnErrorListener { _, what, extra ->+ // Only show error if we were actually trying to play+ if (isPrepared) {+ showError = true+ }+ true+ }+ }+ },+ modifier = Modifier.fillMaxSize()+ )++ if (showError) {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(Color.Black.copy(alpha = 0.7f))+ .clickable { showError = false },+ contentAlignment = Alignment.Center+ ) {+ Column(+ horizontalAlignment = Alignment.CenterHorizontally,+ verticalArrangement = Arrangement.spacedBy(16.dp)+ ) {+ Text(+ text = "Error playing video",+ color = Color.White,+ style = MaterialTheme.typography.titleMedium+ )+ Button(+ onClick = {+ showError = false+ videoViewRef.value?.start()+ }+ ) {+ Text("Retry")+ }+ }+ }+ }++ if (showControls && !showError) {+ Box(modifier = Modifier.fillMaxSize()) {+ // Top controls+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(16.dp)+ .align(Alignment.TopStart),+ horizontalArrangement = Arrangement.Start+ ) {+ IconButton(+ onClick = { stopAndDismiss() },+ modifier = Modifier+ .size(36.dp)+ .background(Color.Black.copy(alpha = 0.6f), CircleShape)+ ) {+ Icon(+ imageVector = Icons.Default.Close,+ contentDescription = "Close",+ tint = Color.White+ )+ }+ }++ // Center play/pause button+ IconButton(+ onClick = {+ isPlaying = !isPlaying+ videoViewRef.value?.apply {+ if (isPlaying) start() else pause()+ }+ },+ modifier = Modifier+ .size(64.dp)+ .align(Alignment.Center)+ .background(Color.Black.copy(alpha = 0.6f), CircleShape)+ ) {+ Icon(+ imageVector = if (isPlaying) Icons.Filled.Pause else Icons.Filled.PlayArrow,+ contentDescription = if (isPlaying) "Pause" else "Play",+ tint = Color.White,+ modifier = Modifier.size(36.dp)+ )+ }++ // Bottom controls+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .align(Alignment.BottomCenter)+ .padding(16.dp)+ ) {+ Slider(+ value = currentPosition.toFloat(),+ onValueChange = { newValue ->+ isScrubbing = true+ currentPosition = newValue.toInt()+ },+ onValueChangeFinished = {+ isScrubbing = false+ videoViewRef.value?.seekTo(currentPosition)+ },+ valueRange = 0f..duration.toFloat(),+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 8.dp),+ colors = SliderDefaults.colors(+ thumbColor = Color.White,+ activeTrackColor = Color.Red,+ inactiveTrackColor = Color.White.copy(alpha = 0.3f)+ )+ )++ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween+ ) {+ Text(+ text = formatMillisToTime(currentPosition),+ color = Color.White,+ style = MaterialTheme.typography.labelSmall+ )+ Text(+ text = formatMillisToTime(duration),+ color = Color.White,+ style = MaterialTheme.typography.labelSmall+ )+ }+ }+ }+ }+ }+}++private fun formatMillisToTime(millis: Int): String {+ val seconds = (millis / 1000) % 60+ val minutes = (millis / (1000 * 60)) % 60+ return String.format("%02d:%02d", minutes, seconds)+}++@Composable+fun LiveStreamPlayer(+ userId: String,+ cameraName: String,+ onDismiss: () -> Unit+) {+ val context = LocalContext.current+ val videoViewRef = remember { mutableStateOf<VideoView?>(null) }+ val coroutineScope = rememberCoroutineScope()+ var currentSegmentPath by remember { mutableStateOf<String?>(null) }+ var isLoading by remember { mutableStateOf(true) }+ var showError by remember { mutableStateOf(false) }++ val decryptionKeys = remember { mutableStateListOf<String>() }+ var showDecryptionDialog by remember { mutableStateOf(false) }+ var pendingSegmentData by remember { mutableStateOf<ByteArray?>(null) }++ fun captureThumbnail() {+ currentSegmentPath?.let { path ->+ coroutineScope.launch(Dispatchers.IO) {+ saveVideoThumbnail(path, cameraName, context)+ }+ }+ }++ // Proper back button handling+ BackHandler(enabled = true) {+ videoViewRef.value?.stopPlayback()+ onDismiss()+ }++ // Load saved decryption keys+ LaunchedEffect(Unit) {+ decryptionKeys.clear()+ decryptionKeys.addAll(getDecryptionKeys(context))+ }++ // Stream fetching logic+ DisposableEffect(userId, cameraName) {+ val coroutineScope = CoroutineScope(Dispatchers.IO)+ var downloadLink: String? = null+ var isPlaying = false++ val linkRefreshJob = coroutineScope.launch {+ while (true) {+ try {+ downloadLink = fetchLiveStreamUrl(userId, cameraName)+ } catch (e: Exception) {+ Log.e("LiveStream", "Error fetching link", e)+ }+ delay(LINK_REFRESH_INTERVAL_MS)+ }+ }++ val segmentDownloadJob = coroutineScope.launch {+ while (true) {+ try {+ val link = downloadLink+ if (link != null) {+ val segmentData = try {+ downloadUrl(link)+ } catch (e: Exception) {+ null+ }++ segmentData?.let { data ->+ val tempFile = File.createTempFile(+ "segment_${System.currentTimeMillis()}",+ ".mp4",+ context.cacheDir+ ).apply { deleteOnExit() }++ var success = false++ for (storedKey in decryptionKeys) {+ if (decryptAesFileToMp4(data, tempFile, storedKey)) {+ success = true+ break+ }+ }++ if (success) {+ currentSegmentPath = tempFile.absolutePath+ isLoading = false++ withContext(Dispatchers.Main) {+ videoViewRef.value?.apply {+ if (!isPlaying) {+ setVideoPath(tempFile.absolutePath)+ setOnPreparedListener { mp ->+ mp.start()+ isPlaying = true+ captureThumbnail()+ isLoading = false+ }+ } else {+ setOnCompletionListener {+ setVideoPath(tempFile.absolutePath)+ setOnPreparedListener { mp ->+ mp.start()+ }+ }+ }+ }+ }+ } else {+ pendingSegmentData = data+ showDecryptionDialog = true+ }+ }+ }+ } catch (e: Exception) {+ Log.e("LiveStream", "Failed to process segment", e)+ isLoading = false+ showError = true+ }++ delay(SEGMENT_DOWNLOAD_INTERVAL_MS)+ }+ }++ onDispose {+ linkRefreshJob.cancel()+ segmentDownloadJob.cancel()+ videoViewRef.value?.stopPlayback()+ }+ }++ if (showDecryptionDialog) {+ DecryptionKeyDialog(+ onDismiss = {+ showDecryptionDialog = false+ pendingSegmentData = null+ },+ onConfirm = { userKey ->+ showDecryptionDialog = false+ pendingSegmentData?.let { data ->+ val tempFile = File.createTempFile(+ "segment_user_${System.currentTimeMillis()}",+ ".mp4",+ context.cacheDir+ ).apply { deleteOnExit() }++ coroutineScope.launch {+ if (decryptAesFileToMp4(data, tempFile, userKey)) {+ addDecryptionKey(context, userKey)+ decryptionKeys.add(userKey)+ currentSegmentPath = tempFile.absolutePath+ isLoading = false++ withContext(Dispatchers.Main) {+ videoViewRef.value?.apply {+ setVideoPath(tempFile.absolutePath)+ setOnPreparedListener { mp ->+ mp.start()+ captureThumbnail()+ }+ }+ }+ } else {+ withContext(Dispatchers.Main) {+ showError = true+ Toast.makeText(context, "Invalid decryption key", Toast.LENGTH_SHORT).show()+ }+ }+ pendingSegmentData = null+ }+ }+ }+ )+ }++ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(Color.Black)+ ) {+ AndroidView(+ factory = { ctx ->+ VideoView(ctx).also { videoView ->+ videoViewRef.value = videoView+ videoView.setOnErrorListener { _, _, _ ->+ showError = true+ true+ }+ }+ },+ modifier = Modifier.fillMaxSize()+ )++ if (isLoading) {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(Color.Black.copy(alpha = 0.7f)),+ contentAlignment = Alignment.Center+ ) {+ CircularProgressIndicator(+ modifier = Modifier.size(48.dp),+ color = Color.White,+ strokeWidth = 4.dp+ )+ }+ }++ if (showError) {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(Color.Black.copy(alpha = 0.7f))+ .clickable { showError = false },+ contentAlignment = Alignment.Center+ ) {+ Column(+ horizontalAlignment = Alignment.CenterHorizontally,+ verticalArrangement = Arrangement.spacedBy(16.dp)+ ) {+ Text(+ text = "Error loading stream",+ color = Color.White,+ style = MaterialTheme.typography.titleMedium+ )+ Button(+ onClick = {+ showError = false+ isLoading = true+ videoViewRef.value?.start()+ }+ ) {+ Text("Retry")+ }+ }+ }+ }++ IconButton(+ onClick = {+ videoViewRef.value?.stopPlayback()+ onDismiss()+ },+ modifier = Modifier+ .align(Alignment.TopStart)+ .padding(16.dp)+ ) {+ Icon(+ imageVector = Icons.Default.Close,+ contentDescription = "Close",+ tint = Color.White+ )+ }+ }+}++@Composable+fun CameraHorizontalList(+ cameraNames: List<String>,+ userId: String,+ onCameraClick: (String) -> Unit,+ onRefresh: () -> Unit+) {+ Column {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(+ text = "Your Cameras",+ style = MaterialTheme.typography.headlineSmall,+ modifier = Modifier.padding(bottom = 16.dp)+ )++ IconButton(+ onClick = onRefresh,+ modifier = Modifier.size(24.dp)+ ) {+ Icon(+ imageVector = Icons.Default.Refresh, // Using Material Icons+ contentDescription = "Refresh cameras"+ )+ }+ }++ if (cameraNames.isEmpty()) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .padding(vertical = 32.dp),+ horizontalAlignment = Alignment.CenterHorizontally+ ) {+ Text(+ text = "No live cameras found",+ style = MaterialTheme.typography.bodyMedium,+ modifier = Modifier.padding(bottom = 16.dp)+ )+ Button(+ onClick = onRefresh,+ colors = ButtonDefaults.buttonColors(+ containerColor = MaterialTheme.colorScheme.primary+ )+ ) {+ Icon(+ imageVector = Icons.Default.Refresh,+ contentDescription = "Refresh",+ modifier = Modifier.size(18.dp)+ )+ Spacer(modifier = Modifier.width(8.dp))+ Text("Refresh")+ }+ }+ } else {+ Row(+ modifier = Modifier+ .horizontalScroll(rememberScrollState())+ .padding(bottom = 16.dp),+ horizontalArrangement = Arrangement.spacedBy(16.dp)+ ) {+ cameraNames.forEach { name ->+ CameraCard(name = name, onClick = { onCameraClick(name) })+ }+ }+ }+ }+}++@Composable+fun CameraCard(+ name: String,+ onClick: () -> Unit+) {+ val context = LocalContext.current+ var thumbnailBitmap by remember { mutableStateOf<Bitmap?>(null) }++ LaunchedEffect(name) {+ thumbnailBitmap = withContext(Dispatchers.IO) {+ getLiveStreamThumbnail(name, context)+ }+ }++ Box(+ modifier = Modifier+ .width(280.dp)+ .aspectRatio(16f / 9f)+ .clip(RoundedCornerShape(12.dp))+ .clickable(onClick = onClick)+ ) {+ thumbnailBitmap?.let { bitmap ->+ Image(+ bitmap = bitmap.asImageBitmap(),+ contentDescription = "Live stream thumbnail",+ contentScale = ContentScale.Crop,+ modifier = Modifier.fillMaxSize()+ )+ } ?: run {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(+ brush = Brush.verticalGradient(+ colors = listOf(Color(0xFF3A3A3A), Color(0xFF1A1A1A))+ )+ )+ )+ }++ Icon(+ imageVector = Icons.Default.PlayArrow,+ contentDescription = "Play",+ tint = Color.White,+ modifier = Modifier+ .size(48.dp)+ .align(Alignment.Center)+ )++ Text(+ text = URLDecoder.decode(name, StandardCharsets.UTF_8.name()),+ color = Color.White,+ style = MaterialTheme.typography.titleMedium,+ modifier = Modifier+ .align(Alignment.BottomStart)+ .padding(12.dp)+ )+ }+}++@Composable+fun EventVideoSection(+ eventVideos: List<EventVideo>,+ context: Context,+ onVideoClick: (String) -> Unit,+ onVideoDeleted: (EventVideo) -> Unit,+ onVideoShared: (EventVideo) -> Unit,+ userId: String+) {+ if (eventVideos.isEmpty()) {+ Text(+ text = "No events found",+ style = MaterialTheme.typography.bodyMedium,+ modifier = Modifier.padding(16.dp)+ )+ return+ }++ val videosDir = File(context.filesDir, APP_VIDEO_DIR)+ val groupedByDate = eventVideos.groupBy { it.date }+ .toList()+ .sortedByDescending { (date, _) -> date }++ val coroutineScope = rememberCoroutineScope()++ fun handleDecryption(video: EventVideo, key: String) {+ coroutineScope.launch {+ try {+ val encryptedFile = File(videosDir, video.fileName)+ val outputFile = File(videosDir, video.fileName.removeSuffix(".aes") + ".mp4")++ if (decryptAesFileToMp4(encryptedFile.readBytes(), outputFile, key)) {+ // Success - add key to saved keys+ addDecryptionKey(context, key)++ // Delete the encrypted file+ encryptedFile.delete()++ // Clear thumbnail cache for encrypted version+ ThumbnailCache.deleteCachedThumbnail(context, video.fileName)++ // Trigger refresh to update UI+ onVideoClick(outputFile.absolutePath)+ } else {+ // Failed - delete the output file if it was created+ if (outputFile.exists()) outputFile.delete()+ // Show error+ Toast.makeText(context, "Invalid decryption key", Toast.LENGTH_SHORT).show()+ }+ } catch (e: Exception) {+ Log.e("Decryption", "Failed to decrypt video", e)+ Toast.makeText(context, "Decryption failed", Toast.LENGTH_SHORT).show()+ }+ }+ }++ Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {+ Text(+ text = "Events",+ style = MaterialTheme.typography.headlineSmall,+ modifier = Modifier.padding(bottom = 8.dp)+ )++ groupedByDate.forEach { (date, videosOnDate) ->+ Column {+ Text(+ text = date,+ style = MaterialTheme.typography.titleLarge,+ modifier = Modifier.padding(vertical = 8.dp)+ )++ Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {+ videosOnDate.forEach { video ->+ key(video.fileName) {+ EventVideoListItem(+ video = video,+ videoPath = File(videosDir, video.fileName).absolutePath,+ onClick = {+ onVideoClick(File(videosDir, video.fileName).absolutePath)+ },+ onDelete = { onVideoDeleted(video) },+ onShare = { onVideoShared(video) },+ onDecrypt = { key -> handleDecryption(video, key) }+ )+ }+ }+ }+ }+ }+ }+}+++@Composable+fun EventVideoListItem(+ video: EventVideo,+ videoPath: String,+ onClick: () -> Unit,+ onDelete: () -> Unit,+ onShare: () -> Unit,+ onDecrypt: (String) -> Unit+) {+ val context = LocalContext.current+ var thumbnailBitmap by remember { mutableStateOf<Bitmap?>(null) }+ val cacheKey = remember { video.fileName }+ var showMenu by remember { mutableStateOf(false) }+ var showDecryptionDialog by remember { mutableStateOf(false) }+ var isActive by remember { mutableStateOf(true) }++ // Load thumbnail in a coroutine+ LaunchedEffect(video.fileName) {+ isActive = true++ if (video.isDecrypted) {+ val bitmap = ThumbnailCache.getCachedThumbnail(context, cacheKey)+ ?: withContext(Dispatchers.IO) {+ if (isActive) {+ getVideoThumbnail(videoPath)?.also {+ ThumbnailCache.cacheThumbnail(context, cacheKey, it)+ }+ } else null+ }++ if (isActive) {+ thumbnailBitmap = bitmap+ }+ } else {+ // Ensure there's no misleading thumbnail from old cache+ ThumbnailCache.deleteCachedThumbnail(context, cacheKey)+ }+ }++ // Cleanup when the composable is disposed+ DisposableEffect(video.fileName) {+ onDispose {+ isActive = false+ thumbnailBitmap = null+ }+ }++ if (showDecryptionDialog) {+ DecryptionKeyDialog(+ onDismiss = { showDecryptionDialog = false },+ onConfirm = { key ->+ showDecryptionDialog = false+ onDecrypt(key)+ }+ )+ }++ Row(+ modifier = Modifier+ .fillMaxWidth()+ .clickable {+ if (video.isDecrypted) {+ onClick()+ } else {+ showDecryptionDialog = true+ }+ }+ .padding(vertical = 4.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ // Thumbnail (160x90)+ Box(+ modifier = Modifier+ .width(160.dp)+ .aspectRatio(16f / 9f)+ .clip(RoundedCornerShape(8.dp))+ ) {+ if (thumbnailBitmap != null) {+ Image(+ bitmap = thumbnailBitmap!!.asImageBitmap(),+ contentDescription = "Video thumbnail",+ contentScale = ContentScale.Crop,+ modifier = Modifier.fillMaxSize()+ )+ } else {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(+ brush = Brush.verticalGradient(+ colors = listOf(Color(0xFF3A3A3A), Color(0xFF1A1A1A))+ )+ ))+ }++ Icon(+ imageVector = if (video.isDecrypted) Icons.Default.PlayArrow else Icons.Default.Lock,+ contentDescription = if (video.isDecrypted) "Play" else "Encrypted",+ tint = if (video.isDecrypted) Color.White.copy(alpha = 0.8f) else Color.Red.copy(alpha = 0.8f),+ modifier = Modifier+ .size(24.dp)+ .align(Alignment.Center)+ )+ }++ // Video info and menu+ Row(+ modifier = Modifier+ .weight(1f)+ .padding(start = 12.dp),+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.SpaceBetween+ ) {+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = video.time, // This shows the formatted time (HH:MM:SS)+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface+ )+ Text(+ text = video.date, // This shows the date (YYYY-MM-DD)+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.7f)+ )+ }++ // Context menu+ Box {+ IconButton(+ onClick = { showMenu = true },+ modifier = Modifier.size(36.dp)+ ) {+ Icon(+ imageVector = Icons.Default.MoreVert,+ contentDescription = "More options",+ tint = MaterialTheme.colorScheme.onSurface+ )+ }++ DropdownMenu(+ expanded = showMenu,+ onDismissRequest = { showMenu = false }+ ) {+ DropdownMenuItem(+ text = { Text("Share") },+ onClick = {+ showMenu = false+ onShare()+ },+ leadingIcon = {+ Icon(+ imageVector = Icons.Default.Share,+ contentDescription = "Share"+ )+ }+ )+ DropdownMenuItem(+ text = { Text("Delete", color = MaterialTheme.colorScheme.error) },+ onClick = {+ showMenu = false+ onDelete()+ },+ leadingIcon = {+ Icon(+ imageVector = Icons.Default.Delete,+ contentDescription = "Delete",+ tint = MaterialTheme.colorScheme.error+ )+ }+ )+ }+ }+ }+ }+}\ No newline at end of filediff --git a/android/clearcam/app/src/main/java/com/rors/clearcam/MainActivity.kt b/android/clearcam/app/src/main/java/com/rors/clearcam/MainActivity.ktnew file mode 100644index 0000000..919692e--- /dev/null+++ b/android/clearcam/app/src/main/java/com/rors/clearcam/MainActivity.kt@@ -0,0 +1,224 @@+package com.rors.clearcam++import android.content.Context+import android.os.Bundle+import androidx.activity.ComponentActivity+import androidx.activity.compose.setContent+import androidx.activity.enableEdgeToEdge+import androidx.compose.foundation.Image+import androidx.compose.foundation.layout.*+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.foundation.text.KeyboardActions+import androidx.compose.foundation.text.KeyboardOptions+import androidx.compose.material3.*+import androidx.compose.runtime.*+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.text.input.ImeAction+import androidx.compose.ui.text.input.KeyboardType+import androidx.compose.ui.text.input.PasswordVisualTransformation+import androidx.compose.ui.unit.dp+import androidx.navigation.compose.NavHost+import androidx.navigation.compose.composable+import androidx.navigation.compose.rememberNavController+import com.rors.clearcam.ui.theme.ClearcamTheme+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext+import java.net.HttpURLConnection+import java.net.URL++class MainActivity : ComponentActivity() {+ override fun onCreate(savedInstanceState: Bundle?) {+ super.onCreate(savedInstanceState)+ enableEdgeToEdge()++ // Check for saved user ID+ val savedUserId = PrefsHelper.getUserId(this)++ setContent {+ ClearcamTheme {+ Surface(+ modifier = Modifier.fillMaxSize(),+ color = MaterialTheme.colorScheme.background+ ) {+ val navController = rememberNavController()++ // Auto-navigate if user is already logged in+ LaunchedEffect(savedUserId) {+ if (savedUserId != null) {+ navController.navigate("home/$savedUserId") {+ popUpTo("login") { inclusive = true }+ }+ }+ }++ NavHost(+ navController = navController,+ startDestination = "login"+ ) {+ composable("login") {+ LoginScreen(+ onLoginSuccess = { userId ->+ PrefsHelper.saveUserData(this@MainActivity, userId)+ navController.navigate("home/$userId") {+ popUpTo("login") { inclusive = true }+ }+ }+ )+ }+ composable("home/{userId}") { backStackEntry ->+ val userId = backStackEntry.arguments?.getString("userId") ?: return@composable+ HomeScreen(userId = userId)+ }+ }+ }+ }+ }+ }+}++@Composable+fun LoginScreen(onLoginSuccess: (String) -> Unit) {+ var userId by remember { mutableStateOf("") }+ var loginStatus by remember { mutableStateOf("") }+ var isLoading by remember { mutableStateOf(false) }+ val coroutineScope = rememberCoroutineScope()++ fun attemptLogin() {+ coroutineScope.launch {+ isLoading = true+ loginStatus = ""+ val success = validateUser(userId)+ isLoading = false+ if (success) {+ onLoginSuccess(userId)+ } else {+ loginStatus = "Invalid user ID"+ }+ }+ }++ Column(+ modifier = Modifier+ .fillMaxSize()+ .padding(32.dp),+ verticalArrangement = Arrangement.Center,+ horizontalAlignment = Alignment.CenterHorizontally+ ) {+ // App icon+ Image(+ painter = painterResource(id = R.drawable.app_icon),+ contentDescription = "App Icon",+ modifier = Modifier+ .padding(bottom = 24.dp)+ .size(100.dp)+ .clip(CircleShape)+ )++ Text(+ text = "Enter your Clearcam User ID:",+ style = MaterialTheme.typography.headlineSmall,+ color = MaterialTheme.colorScheme.onBackground+ )++ Spacer(modifier = Modifier.height(16.dp))++ OutlinedTextField(+ value = userId,+ onValueChange = { userId = it },+ label = { Text("User ID") },+ singleLine = true,+ keyboardOptions = KeyboardOptions(+ keyboardType = KeyboardType.Password,+ autoCorrect = false,+ imeAction = ImeAction.Done+ ),+ keyboardActions = KeyboardActions(+ onDone = { attemptLogin() }+ ),+ visualTransformation = PasswordVisualTransformation(),+ modifier = Modifier.fillMaxWidth(),+ colors = OutlinedTextFieldDefaults.colors(+ focusedBorderColor = MaterialTheme.colorScheme.primary,+ unfocusedBorderColor = MaterialTheme.colorScheme.outline,+ focusedLabelColor = MaterialTheme.colorScheme.primary,+ unfocusedLabelColor = MaterialTheme.colorScheme.outline,+ cursorColor = MaterialTheme.colorScheme.primary,+ focusedTextColor = MaterialTheme.colorScheme.onBackground,+ unfocusedTextColor = MaterialTheme.colorScheme.onBackground+ )+ )++ Spacer(modifier = Modifier.height(8.dp))++ if (loginStatus.isNotBlank()) {+ Text(+ text = loginStatus,+ color = if (loginStatus == "Logged in") MaterialTheme.colorScheme.primary+ else MaterialTheme.colorScheme.error,+ style = MaterialTheme.typography.bodyLarge+ )+ Spacer(modifier = Modifier.height(8.dp))+ }++ Button(+ onClick = { attemptLogin() },+ enabled = !isLoading && userId.isNotBlank(),+ modifier = Modifier.fillMaxWidth()+ ) {+ if (isLoading) {+ CircularProgressIndicator(+ color = MaterialTheme.colorScheme.onPrimary,+ modifier = Modifier.size(20.dp),+ strokeWidth = 2.dp+ )+ } else {+ Text("Login")+ }+ }+ }+}+++object PrefsHelper {+ private const val PREFS_NAME = "ClearCamPrefs"+ private const val KEY_USER_ID = "user_id"++ fun saveUserData(context: Context, userId: String) {+ context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE).edit()+ .putString(KEY_USER_ID, userId)+ .apply()+ }++ fun getUserId(context: Context): String? {+ return context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)+ .getString(KEY_USER_ID, null)+ }++ fun clearUserData(context: Context) {+ context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE).edit()+ .remove(KEY_USER_ID)+ .apply()+ }+}++suspend fun validateUser(userId: String): Boolean {+ return withContext(Dispatchers.IO) {+ try {+ val url = URL("https://rors.ai/validate_user?session_token=$userId")+ val connection = url.openConnection() as HttpURLConnection+ connection.requestMethod = "GET"+ val responseCode = connection.responseCode+ connection.disconnect()+ responseCode == 200+ } catch (e: Exception) {+ e.printStackTrace()+ false+ }+ }+}diff --git a/android/clearcam/app/src/main/java/com/rors/clearcam/SettingsScreen.kt b/android/clearcam/app/src/main/java/com/rors/clearcam/SettingsScreen.ktnew file mode 100644index 0000000..7040099--- /dev/null+++ b/android/clearcam/app/src/main/java/com/rors/clearcam/SettingsScreen.kt@@ -0,0 +1,250 @@+package com.rors.clearcam++import android.Manifest+import android.app.Activity+import android.app.NotificationManager+import android.content.Context+import android.content.Intent+import android.content.pm.PackageManager+import android.os.Build+import android.util.Log+import androidx.activity.compose.BackHandler+import androidx.compose.foundation.layout.*+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.filled.ArrowBack+import androidx.compose.material3.*+import androidx.compose.runtime.*+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.unit.dp+import androidx.core.app.ActivityCompat+import androidx.core.content.ContextCompat+import androidx.datastore.preferences.core.edit+import androidx.datastore.preferences.core.booleanPreferencesKey+import androidx.datastore.preferences.preferencesDataStore+import com.google.firebase.messaging.FirebaseMessaging+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.flow.map+import kotlinx.coroutines.launch+import java.io.OutputStreamWriter+import java.net.HttpURLConnection+import java.net.URL++val Context.dataStore by preferencesDataStore(name = "settings")++@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun SettingsScreen(onBackPressed: () -> Unit) {+ val context = LocalContext.current+ val coroutineScope = rememberCoroutineScope()+ val userId = PrefsHelper.getUserId(context) ?: ""+ val notificationsEnabled = remember { mutableStateOf(false) }+ val showLogoutDialog = remember { mutableStateOf(false) }++ // Load saved preference when screen appears+ LaunchedEffect(Unit) {+ context.dataStore.data.map { preferences ->+ preferences[booleanPreferencesKey("notifications_enabled")] ?: false+ }.collect { enabled ->+ notificationsEnabled.value = enabled+ }+ }++ // Logout confirmation dialog+ if (showLogoutDialog.value) {+ AlertDialog(+ onDismissRequest = { showLogoutDialog.value = false },+ title = { Text("Logout") },+ text = { Text("Are you sure you want to logout?") },+ confirmButton = {+ TextButton(+ onClick = {+ showLogoutDialog.value = false+ // Clear user data+ PrefsHelper.clearUserData(context)+ // Disable notifications+ disableNotifications(context)+ // Restart the app+ (context as Activity).finish()+ val intent = context.packageManager+ .getLaunchIntentForPackage(context.packageName)+ intent?.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)+ context.startActivity(intent)+ }+ ) {+ Text("Logout")+ }+ },+ dismissButton = {+ TextButton(+ onClick = { showLogoutDialog.value = false }+ ) {+ Text("Cancel")+ }+ }+ )+ }++ BackHandler { onBackPressed() }++ Scaffold(+ topBar = {+ TopAppBar(+ title = { Text("Settings") },+ navigationIcon = {+ IconButton(onClick = onBackPressed) {+ Icon(Icons.Default.ArrowBack, contentDescription = "Back")+ }+ }+ )+ }+ ) { innerPadding ->+ Column(+ modifier = Modifier+ .fillMaxSize()+ .padding(innerPadding)+ ) {+ // Your existing notification toggle - completely unchanged+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(16.dp),+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.SpaceBetween+ ) {+ Text(+ text = "Receive event notifications",+ style = MaterialTheme.typography.bodyLarge+ )++ Switch(+ checked = notificationsEnabled.value,+ onCheckedChange = { enabled ->+ notificationsEnabled.value = enabled+ coroutineScope.launch {+ context.dataStore.edit { preferences ->+ preferences[booleanPreferencesKey("notifications_enabled")] = enabled+ }+ }+ if (enabled) {+ requestNotificationPermissionAndRegister(context, userId)+ } else {+ disableNotifications(context)+ }+ }+ )+ }++ // Added logout button at the bottom+ Spacer(modifier = Modifier.weight(1f))+ Button(+ onClick = { showLogoutDialog.value = true },+ modifier = Modifier+ .fillMaxWidth()+ .padding(16.dp),+ colors = ButtonDefaults.buttonColors(+ containerColor = MaterialTheme.colorScheme.errorContainer,+ contentColor = MaterialTheme.colorScheme.error+ )+ ) {+ Text("Logout")+ }+ }+ }+}++private fun disableNotifications(context: Context) {+ FirebaseMessaging.getInstance().deleteToken()+ .addOnCompleteListener { task ->+ if (task.isSuccessful) {+ Log.d("FCM", "FCM token deleted, notifications disabled locally")+ } else {+ Log.e("FCM", "Failed to delete FCM token", task.exception)+ }+ }++ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {+ val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager+ notificationManager?.getNotificationChannel("YOUR_CHANNEL_ID")?.let { channel ->+ channel.importance = NotificationManager.IMPORTANCE_NONE+ Log.d("FCM", "Notification channel disabled")+ } ?: Log.e("FCM", "Failed to disable channel (not found or null)")+ }+}++private fun requestNotificationPermissionAndRegister(context: Context, userId: String) {+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {+ val hasPermission = ContextCompat.checkSelfPermission(+ context,+ Manifest.permission.POST_NOTIFICATIONS+ ) == PackageManager.PERMISSION_GRANTED++ if (!hasPermission) {+ val shouldShowRationale = ActivityCompat.shouldShowRequestPermissionRationale(+ context as Activity,+ Manifest.permission.POST_NOTIFICATIONS+ )++ if (shouldShowRationale) {+ // Could show a dialog here if you want+ Log.d("Settings", "Notification permission rationale should be shown")+ return+ } else {+ ActivityCompat.requestPermissions(+ context,+ arrayOf(Manifest.permission.POST_NOTIFICATIONS),+ 1001+ )+ }+ }+ }++ // Get FCM token and send to server+ FirebaseMessaging.getInstance().token+ .addOnCompleteListener { task ->+ if (!task.isSuccessful) {+ Log.w("FCM", "Fetching FCM token failed", task.exception)+ return@addOnCompleteListener+ }++ val token = task.result+ Log.d("FCM Token", token)++ CoroutineScope(Dispatchers.IO).launch {+ try {+ val url = URL("https://rors.ai/add_device")+ val connection = url.openConnection() as HttpURLConnection+ connection.apply {+ requestMethod = "POST"+ setRequestProperty("Content-Type", "application/json")+ doOutput = true+ connectTimeout = 10000+ readTimeout = 10000+ }++ val requestBody = """+ {+ "device_token": "$token",+ "session_token": "$userId",+ "platform": 1+ }+ """.trimIndent()++ OutputStreamWriter(connection.outputStream).use { writer ->+ writer.write(requestBody)+ }++ val responseCode = connection.responseCode+ if (responseCode == HttpURLConnection.HTTP_OK) {+ Log.d("FCM", "Token successfully sent to server")+ } else {+ Log.e("FCM", "Server returned $responseCode")+ }+ } catch (e: Exception) {+ Log.e("FCM", "Failed to send token to server", e)+ }+ }+ }+}diff --git a/android/clearcam/app/src/main/java/com/rors/clearcam/VideoHelper.kt b/android/clearcam/app/src/main/java/com/rors/clearcam/VideoHelper.ktnew file mode 100644index 0000000..f242645--- /dev/null+++ b/android/clearcam/app/src/main/java/com/rors/clearcam/VideoHelper.kt@@ -0,0 +1,350 @@+package com.rors.clearcam++import android.content.Context+import android.graphics.Bitmap+import android.graphics.BitmapFactory+import android.media.MediaMetadataRetriever+import android.media.ThumbnailUtils+import android.util.Log+import org.json.JSONObject+import java.io.File+import java.net.HttpURLConnection+import java.net.URL+import java.net.URLEncoder+import java.text.SimpleDateFormat+import java.util.Locale+import javax.crypto.Cipher+import javax.crypto.spec.IvParameterSpec+import javax.crypto.spec.SecretKeySpec+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.withContext++// Constants+private const val LIVE_STREAM_TIMEOUT_MS = 15000+private const val AES_KEY_SIZE = 32 // 256-bit key+private const val AES_BLOCK_SIZE = 16+private const val HEADER_SIZE = 8+private val MAGIC_NUMBER = 0x4D41474943UL // "MAGIC"+data class EventVideo(+ val url: String,+ val timestamp: String,+ val date: String,+ val time: String,+ val fileName: String,+ val isDecrypted: Boolean = false+)++fun saveVideoThumbnail(videoPath: String, cameraName: String, context: Context): String? {+ return try {+ val bitmap = getVideoThumbnail(videoPath) ?: return null+ val thumbnailsDir = File(context.filesDir, "thumbnails")+ if (!thumbnailsDir.exists()) {+ thumbnailsDir.mkdirs()+ }++ // Include camera name in the filename+ val thumbnailFile = File(thumbnailsDir, "thumbnail_${cameraName}.jpg")+ thumbnailFile.outputStream().use { out ->+ bitmap.compress(Bitmap.CompressFormat.JPEG, 85, out)+ }+ thumbnailFile.absolutePath+ } catch (e: Exception) {+ null+ }+}++fun getVideoThumbnail(videoPath: String): Bitmap? {+ return try {+ val retriever = MediaMetadataRetriever()+ retriever.setDataSource(videoPath)++ val duration = retriever.extractMetadata(+ MediaMetadataRetriever.METADATA_KEY_DURATION+ )?.toLong() ?: 0L+ val midpoint = duration / 2++ val bitmap = retriever.getFrameAtTime(+ midpoint * 1000,+ MediaMetadataRetriever.OPTION_CLOSEST+ )++ retriever.release()++ bitmap?.let {+ ThumbnailUtils.extractThumbnail(+ it,+ 320,+ 180,+ ThumbnailUtils.OPTIONS_RECYCLE_INPUT+ )+ }+ } catch (e: Exception) {+ null+ }+}++fun getLiveStreamThumbnail(cameraName: String, context: Context): Bitmap? {+ return try {+ val thumbnailsDir = File(context.filesDir, "thumbnails")+ if (!thumbnailsDir.exists()) return null++ val thumbnailFile = File(thumbnailsDir, "thumbnail_${cameraName}.jpg")+ if (thumbnailFile.exists()) {+ thumbnailFile.inputStream().use { stream ->+ BitmapFactory.decodeStream(stream)+ }+ } else {+ null+ }+ } catch (e: Exception) {+ null+ }+}++fun parseEventVideos(urls: List<String>): List<EventVideo> {+ return urls.mapNotNull { fullUrl ->+ try {+ val baseUrl = fullUrl.substringBefore("?")+ val filenameWithExt = baseUrl.substringAfterLast("/")+ val filename = filenameWithExt++ // Match all datetime patterns in the filename+ val regex = Regex("""\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}""")+ val allMatches = regex.findAll(filename).toList()++ val lastMatch = allMatches.lastOrNull()?.value ?: return@mapNotNull null++ val (date, time) = lastMatch.split("_")+ val timestamp = "$date $time"+ val displayTime = time.replace("-", ":")++ EventVideo(fullUrl, timestamp, date, displayTime, filename)+ } catch (e: Exception) {+ e.printStackTrace()+ null+ }+ }.sortedByDescending { it.timestamp }+}++fun loadAllVideos(videosDir: File): List<EventVideo> {+ return videosDir.listFiles()+ ?.mapNotNull { file: File -> parseFilenameToEventVideo(file.name)+ }+ ?.sortedByDescending { it.timestamp }+ ?: emptyList()+}++fun parseFilenameToEventVideo(filename: String): EventVideo? {+ return try {+ val baseName = if (filename.endsWith(".mp4")) {+ filename.removeSuffix(".mp4")+ } else if (filename.endsWith(".aes")) {+ filename.removeSuffix(".aes")+ } else {+ filename+ }++ // Match all datetime patterns in the filename+ val regex = Regex("""\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}""")+ val allMatches = regex.findAll(baseName).toList()++ // Use the last match (most recent timestamp) if there are multiple+ val lastMatch = allMatches.lastOrNull()?.value ?: return null++ val (date, time) = lastMatch.split("_")+ val timestamp = "$date $time"+ val displayTime = time.replace("-", ":")++ EventVideo(+ url = "",+ timestamp = timestamp,+ date = date,+ time = displayTime,+ fileName = filename,+ isDecrypted = filename.endsWith(".mp4")+ )+ } catch (e: Exception) {+ Log.e("Parse", "Failed to parse filename: $filename", e)+ null+ }+}++suspend fun fetchLiveStreamUrl(userId: String, cameraName: String): String? {+ return withContext(Dispatchers.IO) {+ try {+ val encodedName = URLEncoder.encode(cameraName, "UTF-8")+ val url = URL("https://rors.ai/get_stream_download_link?session_token=$userId&name=$encodedName")++ val connection = url.openConnection() as HttpURLConnection+ connection.apply {+ requestMethod = "GET"+ connectTimeout = LIVE_STREAM_TIMEOUT_MS+ readTimeout = LIVE_STREAM_TIMEOUT_MS+ useCaches = false+ }++ if (connection.responseCode == HttpURLConnection.HTTP_OK) {+ connection.inputStream.bufferedReader().use { reader ->+ val response = reader.readText()+ JSONObject(response).getString("download_link")+ }+ } else {+ null+ }+ } catch (e: Exception) {+ Log.e("LiveStream", "Failed to fetch stream URL", e)+ null+ }+ }+}++suspend fun deleteStreamLink(userId: String, cameraName: String) {+ withContext(Dispatchers.IO) {+ try {+ val encodedName = URLEncoder.encode(cameraName, "UTF-8")+ val url = URL("https://rors.ai/delete_stream_download_link?session_token=$userId&name=$encodedName")++ val connection = url.openConnection() as HttpURLConnection+ connection.apply {+ requestMethod = "GET"+ connectTimeout = LIVE_STREAM_TIMEOUT_MS+ readTimeout = LIVE_STREAM_TIMEOUT_MS+ }+ connection.connect()+ } catch (e: Exception) {+ Log.e("LiveStream", "Failed to delete stream link", e)+ }+ }+}++suspend fun fetchCameraNames(userId: String): List<String> = withContext(Dispatchers.IO) {+ try {+ val url = URL("https://rors.ai/get_live_devices?session_token=$userId")+ val connection = url.openConnection() as HttpURLConnection+ connection.requestMethod = "GET"++ if (connection.responseCode == 200) {+ val response = connection.inputStream.bufferedReader().use { it.readText() }+ val jsonObject = JSONObject(response)+ val namesArray = jsonObject.getJSONArray("device_names")++ (0 until namesArray.length()).map { i ->+ namesArray.getString(i)+ }+ } else {+ emptyList()+ }+ } catch (e: Exception) {+ e.printStackTrace()+ emptyList()+ }+}++suspend fun fetchEventVideos(+ userId: String,+ newestCreationTime: Long = 0+): List<EventVideo> = withContext(Dispatchers.IO) {+ try {+ val url = URL("https://rors.ai/events?session_token=$userId&newest_creation_time=$newestCreationTime")+ val connection = url.openConnection() as HttpURLConnection+ connection.apply {+ requestMethod = "GET"+ connectTimeout = 15000+ readTimeout = 15000+ }++ if (connection.responseCode == HttpURLConnection.HTTP_OK) {+ val response = connection.inputStream.bufferedReader().use { it.readText() }+ val jsonObject = JSONObject(response)+ val filesArray = jsonObject.getJSONArray("files")++ (0 until filesArray.length()).map { i ->+ filesArray.getString(i)+ }.let { urls ->+ parseEventVideos(urls)+ }+ } else {+ emptyList()+ }+ } catch (e: Exception) {+ Log.e("FetchVideos", "Failed to fetch videos", e)+ emptyList()+ }+}++suspend fun downloadUrl(urlStr: String): ByteArray = withContext(Dispatchers.IO) {+ val url = URL(urlStr)+ val connection = url.openConnection() as HttpURLConnection+ connection.requestMethod = "GET"+ connection.connectTimeout = 15000+ connection.readTimeout = 15000++ connection.inputStream.use { inputStream ->+ inputStream.readBytes()+ }+}++fun getNewestCreationTimeFromFiles(videosDir: File): Long {+ return videosDir.listFiles()+ ?.mapNotNull { file: File ->+ try {+ // Parse filename like "2025-08-01_13-41-50.mp4"+ val baseName = file.name.removeSuffix(".mp4")+ val format = SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.getDefault())+ format.parse(baseName)?.time ?: 0L+ } catch (e: Exception) {+ null+ }+ }+ ?.maxOrNull() ?: 0L+}++fun decryptAesFileToMp4(+ encryptedInput: ByteArray,+ outputFile: File,+ keyString: String+): Boolean {+ try {+ if (encryptedInput.size <= AES_BLOCK_SIZE) return false++ val iv = encryptedInput.copyOfRange(0, AES_BLOCK_SIZE)+ val encryptedData = encryptedInput.copyOfRange(AES_BLOCK_SIZE, encryptedInput.size)++ val keyBytes = ByteArray(AES_KEY_SIZE).apply {+ val keySrc = keyString.toByteArray(Charsets.UTF_8)+ System.arraycopy(keySrc, 0, this, 0, keySrc.size.coerceAtMost(AES_KEY_SIZE))+ }++ val cipher = Cipher.getInstance("AES/CBC/PKCS5Padding")+ val secretKey = SecretKeySpec(keyBytes, "AES")+ val ivSpec = IvParameterSpec(iv)++ cipher.init(Cipher.DECRYPT_MODE, secretKey, ivSpec)+ val decryptedBytes = cipher.doFinal(encryptedData)++ if (decryptedBytes.size < HEADER_SIZE) return false++ val headerValue = (decryptedBytes[0].toULong() and 0xFFu) or+ ((decryptedBytes[1].toULong() and 0xFFu) shl 8) or+ ((decryptedBytes[2].toULong() and 0xFFu) shl 16) or+ ((decryptedBytes[3].toULong() and 0xFFu) shl 24) or+ ((decryptedBytes[4].toULong() and 0xFFu) shl 32) or+ ((decryptedBytes[5].toULong() and 0xFFu) shl 40) or+ ((decryptedBytes[6].toULong() and 0xFFu) shl 48) or+ ((decryptedBytes[7].toULong() and 0xFFu) shl 56)++ if (headerValue != MAGIC_NUMBER) {+ Log.e("Decryption", "Invalid magic number. Expected $MAGIC_NUMBER, got $headerValue")+ return false+ }++ val mp4Data = decryptedBytes.copyOfRange(HEADER_SIZE, decryptedBytes.size)+ outputFile.parentFile?.mkdirs()+ outputFile.writeBytes(mp4Data)++ return true+ } catch (e: Exception) {+ Log.e("Decryption", "Decryption failed", e)+ return false+ }+}\ No newline at end of filediff --git a/android/clearcam/app/src/main/java/com/rors/clearcam/ui/theme/Color.kt b/android/clearcam/app/src/main/java/com/rors/clearcam/ui/theme/Color.ktnew file mode 100644index 0000000..d598b97--- /dev/null+++ b/android/clearcam/app/src/main/java/com/rors/clearcam/ui/theme/Color.kt@@ -0,0 +1,11 @@+package com.rors.clearcam.ui.theme++import androidx.compose.ui.graphics.Color++val Purple80 = Color(0xFFD0BCFF)+val PurpleGrey80 = Color(0xFFCCC2DC)+val Pink80 = Color(0xFFEFB8C8)++val Purple40 = Color(0xFF6650a4)+val PurpleGrey40 = Color(0xFF625b71)+val Pink40 = Color(0xFF7D5260)\ No newline at end of filediff --git a/android/clearcam/app/src/main/java/com/rors/clearcam/ui/theme/Theme.kt b/android/clearcam/app/src/main/java/com/rors/clearcam/ui/theme/Theme.ktnew file mode 100644index 0000000..b5f183d--- /dev/null+++ b/android/clearcam/app/src/main/java/com/rors/clearcam/ui/theme/Theme.kt@@ -0,0 +1,57 @@+package com.rors.clearcam.ui.theme++import android.os.Build+import androidx.compose.foundation.isSystemInDarkTheme+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.darkColorScheme+import androidx.compose.material3.dynamicDarkColorScheme+import androidx.compose.material3.dynamicLightColorScheme+import androidx.compose.material3.lightColorScheme+import androidx.compose.runtime.Composable+import androidx.compose.ui.platform.LocalContext++private val DarkColorScheme = darkColorScheme(+ primary = Purple80,+ secondary = PurpleGrey80,+ tertiary = Pink80+)++private val LightColorScheme = lightColorScheme(+ primary = Purple40,+ secondary = PurpleGrey40,+ tertiary = Pink40++ /* Other default colors to override+ background = Color(0xFFFFFBFE),+ surface = Color(0xFFFFFBFE),+ onPrimary = Color.White,+ onSecondary = Color.White,+ onTertiary = Color.White,+ onBackground = Color(0xFF1C1B1F),+ onSurface = Color(0xFF1C1B1F),+ */+)++@Composable+fun ClearcamTheme(+ darkTheme: Boolean = isSystemInDarkTheme(),+ // Dynamic color is available on Android 12++ dynamicColor: Boolean = true,+ content: @Composable () -> Unit+) {+ val colorScheme = when {+ dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {+ val context = LocalContext.current+ if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)+ }++ darkTheme -> DarkColorScheme+ else -> LightColorScheme+ }++ MaterialTheme(+ colorScheme = colorScheme,+ typography = Typography,+ content = content+ )+}\ No newline at end of filediff --git a/android/clearcam/app/src/main/java/com/rors/clearcam/ui/theme/Type.kt b/android/clearcam/app/src/main/java/com/rors/clearcam/ui/theme/Type.ktnew file mode 100644index 0000000..77e8d7f--- /dev/null+++ b/android/clearcam/app/src/main/java/com/rors/clearcam/ui/theme/Type.kt@@ -0,0 +1,34 @@+package com.rors.clearcam.ui.theme++import androidx.compose.material3.Typography+import androidx.compose.ui.text.TextStyle+import androidx.compose.ui.text.font.FontFamily+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.unit.sp++// Set of Material typography styles to start with+val Typography = Typography(+ bodyLarge = TextStyle(+ fontFamily = FontFamily.Default,+ fontWeight = FontWeight.Normal,+ fontSize = 16.sp,+ lineHeight = 24.sp,+ letterSpacing = 0.5.sp+ )+ /* Other default text styles to override+ titleLarge = TextStyle(+ fontFamily = FontFamily.Default,+ fontWeight = FontWeight.Normal,+ fontSize = 22.sp,+ lineHeight = 28.sp,+ letterSpacing = 0.sp+ ),+ labelSmall = TextStyle(+ fontFamily = FontFamily.Default,+ fontWeight = FontWeight.Medium,+ fontSize = 11.sp,+ lineHeight = 16.sp,+ letterSpacing = 0.5.sp+ )+ */+)\ No newline at end of filediff --git a/android/clearcam/app/src/main/res/drawable/app_icon.png b/android/clearcam/app/src/main/res/drawable/app_icon.pngnew file mode 100644index 0000000..927cf35Binary files /dev/null and b/android/clearcam/app/src/main/res/drawable/app_icon.png differdiff --git a/android/clearcam/app/src/main/res/drawable/ic_launcher_background.xml b/android/clearcam/app/src/main/res/drawable/ic_launcher_background.xmlnew file mode 100644index 0000000..07d5da9--- /dev/null+++ b/android/clearcam/app/src/main/res/drawable/ic_launcher_background.xml@@ -0,0 +1,170 @@+<?xml version="1.0" encoding="utf-8"?>+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="108dp"+ android:height="108dp"+ android:viewportWidth="108"+ android:viewportHeight="108">+ <path+ android:fillColor="#3DDC84"+ android:pathData="M0,0h108v108h-108z" />+ <path+ android:fillColor="#00000000"+ android:pathData="M9,0L9,108"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M19,0L19,108"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M29,0L29,108"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M39,0L39,108"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M49,0L49,108"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M59,0L59,108"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M69,0L69,108"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M79,0L79,108"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M89,0L89,108"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M99,0L99,108"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M0,9L108,9"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M0,19L108,19"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M0,29L108,29"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M0,39L108,39"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M0,49L108,49"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M0,59L108,59"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M0,69L108,69"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M0,79L108,79"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M0,89L108,89"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M0,99L108,99"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M19,29L89,29"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M19,39L89,39"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M19,49L89,49"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M19,59L89,59"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M19,69L89,69"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M19,79L89,79"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M29,19L29,89"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M39,19L39,89"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M49,19L49,89"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M59,19L59,89"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M69,19L69,89"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+ <path+ android:fillColor="#00000000"+ android:pathData="M79,19L79,89"+ android:strokeWidth="0.8"+ android:strokeColor="#33FFFFFF" />+</vector>diff --git a/android/clearcam/app/src/main/res/drawable/ic_launcher_foreground.xml b/android/clearcam/app/src/main/res/drawable/ic_launcher_foreground.xmlnew file mode 100644index 0000000..2b068d1--- /dev/null+++ b/android/clearcam/app/src/main/res/drawable/ic_launcher_foreground.xml@@ -0,0 +1,30 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ xmlns:aapt="http://schemas.android.com/aapt"+ android:width="108dp"+ android:height="108dp"+ android:viewportWidth="108"+ android:viewportHeight="108">+ <path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">+ <aapt:attr name="android:fillColor">+ <gradient+ android:endX="85.84757"+ android:endY="92.4963"+ android:startX="42.9492"+ android:startY="49.59793"+ android:type="linear">+ <item+ android:color="#44000000"+ android:offset="0.0" />+ <item+ android:color="#00000000"+ android:offset="1.0" />+ </gradient>+ </aapt:attr>+ </path>+ <path+ android:fillColor="#FFFFFF"+ android:fillType="nonZero"+ android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"+ android:strokeWidth="1"+ android:strokeColor="#00000000" />+</vector>\ No newline at end of filediff --git a/android/clearcam/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/clearcam/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xmlnew file mode 100644index 0000000..036d09b--- /dev/null+++ b/android/clearcam/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml@@ -0,0 +1,5 @@+<?xml version="1.0" encoding="utf-8"?>+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">+ <background android:drawable="@color/ic_launcher_background"/>+ <foreground android:drawable="@mipmap/ic_launcher_foreground"/>+</adaptive-icon>\ No newline at end of filediff --git a/android/clearcam/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/clearcam/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xmlnew file mode 100644index 0000000..036d09b--- /dev/null+++ b/android/clearcam/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml@@ -0,0 +1,5 @@+<?xml version="1.0" encoding="utf-8"?>+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">+ <background android:drawable="@color/ic_launcher_background"/>+ <foreground android:drawable="@mipmap/ic_launcher_foreground"/>+</adaptive-icon>\ No newline at end of filediff --git a/android/clearcam/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/android/clearcam/app/src/main/res/mipmap-hdpi/ic_launcher.webpnew file mode 100644index 0000000..9ec8298Binary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-hdpi/ic_launcher.webp differdiff --git a/android/clearcam/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp b/android/clearcam/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webpnew file mode 100644index 0000000..bc6747cBinary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp differdiff --git a/android/clearcam/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/android/clearcam/app/src/main/res/mipmap-hdpi/ic_launcher_round.webpnew file mode 100644index 0000000..1f9a8f9Binary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differdiff --git a/android/clearcam/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/android/clearcam/app/src/main/res/mipmap-mdpi/ic_launcher.webpnew file mode 100644index 0000000..8c7f48eBinary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-mdpi/ic_launcher.webp differdiff --git a/android/clearcam/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp b/android/clearcam/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webpnew file mode 100644index 0000000..e4bb67eBinary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp differdiff --git a/android/clearcam/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/android/clearcam/app/src/main/res/mipmap-mdpi/ic_launcher_round.webpnew file mode 100644index 0000000..c932e17Binary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differdiff --git a/android/clearcam/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/android/clearcam/app/src/main/res/mipmap-xhdpi/ic_launcher.webpnew file mode 100644index 0000000..cdd1fecBinary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differdiff --git a/android/clearcam/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp b/android/clearcam/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webpnew file mode 100644index 0000000..1967f7dBinary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp differdiff --git a/android/clearcam/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/android/clearcam/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webpnew file mode 100644index 0000000..13a0cdaBinary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differdiff --git a/android/clearcam/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/android/clearcam/app/src/main/res/mipmap-xxhdpi/ic_launcher.webpnew file mode 100644index 0000000..f786a7fBinary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differdiff --git a/android/clearcam/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp b/android/clearcam/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webpnew file mode 100644index 0000000..fce0710Binary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp differdiff --git a/android/clearcam/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/android/clearcam/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webpnew file mode 100644index 0000000..2929e28Binary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differdiff --git a/android/clearcam/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/android/clearcam/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webpnew file mode 100644index 0000000..183e37aBinary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differdiff --git a/android/clearcam/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp b/android/clearcam/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webpnew file mode 100644index 0000000..6154386Binary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp differdiff --git a/android/clearcam/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/android/clearcam/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webpnew file mode 100644index 0000000..37518e7Binary files /dev/null and b/android/clearcam/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differdiff --git a/android/clearcam/app/src/main/res/values/colors.xml b/android/clearcam/app/src/main/res/values/colors.xmlnew file mode 100644index 0000000..f8c6127--- /dev/null+++ b/android/clearcam/app/src/main/res/values/colors.xml@@ -0,0 +1,10 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <color name="purple_200">#FFBB86FC</color>+ <color name="purple_500">#FF6200EE</color>+ <color name="purple_700">#FF3700B3</color>+ <color name="teal_200">#FF03DAC5</color>+ <color name="teal_700">#FF018786</color>+ <color name="black">#FF000000</color>+ <color name="white">#FFFFFFFF</color>+</resources>\ No newline at end of filediff --git a/android/clearcam/app/src/main/res/values/ic_launcher_background.xml b/android/clearcam/app/src/main/res/values/ic_launcher_background.xmlnew file mode 100644index 0000000..e63992f--- /dev/null+++ b/android/clearcam/app/src/main/res/values/ic_launcher_background.xml@@ -0,0 +1,4 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <color name="ic_launcher_background">#2973AD</color>+</resources>\ No newline at end of filediff --git a/android/clearcam/app/src/main/res/values/strings.xml b/android/clearcam/app/src/main/res/values/strings.xmlnew file mode 100644index 0000000..351c0a7--- /dev/null+++ b/android/clearcam/app/src/main/res/values/strings.xml@@ -0,0 +1,3 @@+<resources>+ <string name="app_name">clearcam</string>+</resources>\ No newline at end of filediff --git a/android/clearcam/app/src/main/res/values/themes.xml b/android/clearcam/app/src/main/res/values/themes.xmlnew file mode 100644index 0000000..f2b4669--- /dev/null+++ b/android/clearcam/app/src/main/res/values/themes.xml@@ -0,0 +1,5 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>++ <style name="Theme.Clearcam" parent="android:Theme.Material.Light.NoActionBar" />+</resources>\ No newline at end of filediff --git a/android/clearcam/app/src/main/res/xml/backup_rules.xml b/android/clearcam/app/src/main/res/xml/backup_rules.xmlnew file mode 100644index 0000000..4df9255--- /dev/null+++ b/android/clearcam/app/src/main/res/xml/backup_rules.xml@@ -0,0 +1,13 @@+<?xml version="1.0" encoding="utf-8"?><!--+ Sample backup rules file; uncomment and customize as necessary.+ See https://developer.android.com/guide/topics/data/autobackup+ for details.+ Note: This file is ignored for devices older than API 31+ See https://developer.android.com/about/versions/12/backup-restore+-->+<full-backup-content>+ <!--+ <include domain="sharedpref" path="."/>+ <exclude domain="sharedpref" path="device.xml"/>+-->+</full-backup-content>\ No newline at end of filediff --git a/android/clearcam/app/src/main/res/xml/data_extraction_rules.xml b/android/clearcam/app/src/main/res/xml/data_extraction_rules.xmlnew file mode 100644index 0000000..9ee9997--- /dev/null+++ b/android/clearcam/app/src/main/res/xml/data_extraction_rules.xml@@ -0,0 +1,19 @@+<?xml version="1.0" encoding="utf-8"?><!--+ Sample data extraction rules file; uncomment and customize as necessary.+ See https://developer.android.com/about/versions/12/backup-restore#xml-changes+ for details.+-->+<data-extraction-rules>+ <cloud-backup>+ <!-- TODO: Use <include> and <exclude> to control what is backed up.+ <include .../>+ <exclude .../>+ -->+ </cloud-backup>+ <!--+ <device-transfer>+ <include .../>+ <exclude .../>+ </device-transfer>+ -->+</data-extraction-rules>\ No newline at end of filediff --git a/android/clearcam/app/src/main/res/xml/file_paths.xml b/android/clearcam/app/src/main/res/xml/file_paths.xmlnew file mode 100644index 0000000..7a07df3--- /dev/null+++ b/android/clearcam/app/src/main/res/xml/file_paths.xml@@ -0,0 +1,5 @@+<?xml version="1.0" encoding="utf-8"?>+<paths>+ <files-path name="videos" path="videos/" />+ <cache-path name="cache" path="/" />+</paths>\ No newline at end of filediff --git a/android/clearcam/app/src/test/java/com/rors/clearcam/ExampleUnitTest.kt b/android/clearcam/app/src/test/java/com/rors/clearcam/ExampleUnitTest.ktnew file mode 100644index 0000000..dbf66c7--- /dev/null+++ b/android/clearcam/app/src/test/java/com/rors/clearcam/ExampleUnitTest.kt@@ -0,0 +1,17 @@+package com.rors.clearcam++import org.junit.Test++import org.junit.Assert.*++/**+ * Example local unit test, which will execute on the development machine (host).+ *+ * See [testing documentation](http://d.android.com/tools/testing).+ */+class ExampleUnitTest {+ @Test+ fun addition_isCorrect() {+ assertEquals(4, 2 + 2)+ }+}\ No newline at end of filediff --git a/android/clearcam/build.gradle b/android/clearcam/build.gradlenew file mode 100644index 0000000..cd0ef47--- /dev/null+++ b/android/clearcam/build.gradle@@ -0,0 +1,7 @@+// Top-level build file where you can add configuration options common to all sub-projects/modules.+plugins {+alias(libs.plugins.android.application) apply false+ alias(libs.plugins.kotlin.android) apply false+ alias(libs.plugins.kotlin.compose) apply false+ id 'com.google.gms.google-services' version '4.4.3' apply false+}\ No newline at end of filediff --git a/android/clearcam/gradle.properties b/android/clearcam/gradle.propertiesnew file mode 100644index 0000000..20e2a01--- /dev/null+++ b/android/clearcam/gradle.properties@@ -0,0 +1,23 @@+# Project-wide Gradle settings.+# IDE (e.g. Android Studio) users:+# Gradle settings configured through the IDE *will override*+# any settings specified in this file.+# For more details on how to configure your build environment visit+# http://www.gradle.org/docs/current/userguide/build_environment.html+# Specifies the JVM arguments used for the daemon process.+# The setting is particularly useful for tweaking memory settings.+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8+# When configured, Gradle will run in incubating parallel mode.+# This option should only be used with decoupled projects. For more details, visit+# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects+# org.gradle.parallel=true+# AndroidX package structure to make it clearer which packages are bundled with the+# Android operating system, and which are packaged with your app's APK+# https://developer.android.com/topic/libraries/support-library/androidx-rn+android.useAndroidX=true+# Kotlin code style for this project: "official" or "obsolete":+kotlin.code.style=official+# Enables namespacing of each library's R class so that its R class includes only the+# resources declared in the library itself and none from the library's dependencies,+# thereby reducing the size of the R class for that library+android.nonTransitiveRClass=true\ No newline at end of filediff --git a/android/clearcam/gradle/libs.versions.toml b/android/clearcam/gradle/libs.versions.tomlnew file mode 100644index 0000000..8f32fcf--- /dev/null+++ b/android/clearcam/gradle/libs.versions.toml@@ -0,0 +1,32 @@+[versions]+agp = "8.9.2"+kotlin = "2.0.21"+coreKtx = "1.16.0"+junit = "4.13.2"+junitVersion = "1.3.0"+espressoCore = "3.7.0"+lifecycleRuntimeKtx = "2.9.2"+activityCompose = "1.10.1"+composeBom = "2024.09.00"++[libraries]+androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }+junit = { group = "junit", name = "junit", version.ref = "junit" }+androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }+androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }+androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }+androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }+androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }+androidx-ui = { group = "androidx.compose.ui", name = "ui" }+androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }+androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }+androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }+androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }+androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }+androidx-material3 = { group = "androidx.compose.material3", name = "material3" }++[plugins]+android-application = { id = "com.android.application", version.ref = "agp" }+kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }+kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }+diff --git a/android/clearcam/gradle/wrapper/gradle-wrapper.jar b/android/clearcam/gradle/wrapper/gradle-wrapper.jarnew file mode 100644index 0000000..e708b1cBinary files /dev/null and b/android/clearcam/gradle/wrapper/gradle-wrapper.jar differdiff --git a/android/clearcam/gradle/wrapper/gradle-wrapper.properties b/android/clearcam/gradle/wrapper/gradle-wrapper.propertiesnew file mode 100644index 0000000..aa31875--- /dev/null+++ b/android/clearcam/gradle/wrapper/gradle-wrapper.properties@@ -0,0 +1,6 @@+#Thu Jul 31 11:26:44 IST 2025+distributionBase=GRADLE_USER_HOME+distributionPath=wrapper/dists+distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip+zipStoreBase=GRADLE_USER_HOME+zipStorePath=wrapper/distsdiff --git a/android/clearcam/gradlew b/android/clearcam/gradlewnew file mode 100755index 0000000..4f906e0--- /dev/null+++ b/android/clearcam/gradlew@@ -0,0 +1,185 @@+#!/usr/bin/env sh++#+# Copyright 2015 the original author or authors.+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# https://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+#++##############################################################################+##+## Gradle start up script for UN*X+##+##############################################################################++# Attempt to set APP_HOME+# Resolve links: $0 may be a link+PRG="$0"+# Need this for relative symlinks.+while [ -h "$PRG" ] ; do+ ls=`ls -ld "$PRG"`+ link=`expr "$ls" : '.*-> \(.*\)$'`+ if expr "$link" : '/.*' > /dev/null; then+ PRG="$link"+ else+ PRG=`dirname "$PRG"`"/$link"+ fi+done+SAVED="`pwd`"+cd "`dirname \"$PRG\"`/" >/dev/null+APP_HOME="`pwd -P`"+cd "$SAVED" >/dev/null++APP_NAME="Gradle"+APP_BASE_NAME=`basename "$0"`++# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'++# Use the maximum available, or set MAX_FD != -1 to use that value.+MAX_FD="maximum"++warn () {+ echo "$*"+}++die () {+ echo+ echo "$*"+ echo+ exit 1+}++# OS specific support (must be 'true' or 'false').+cygwin=false+msys=false+darwin=false+nonstop=false+case "`uname`" in+ CYGWIN* )+ cygwin=true+ ;;+ Darwin* )+ darwin=true+ ;;+ MINGW* )+ msys=true+ ;;+ NONSTOP* )+ nonstop=true+ ;;+esac++CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar+++# Determine the Java command to use to start the JVM.+if [ -n "$JAVA_HOME" ] ; then+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then+ # IBM's JDK on AIX uses strange locations for the executables+ JAVACMD="$JAVA_HOME/jre/sh/java"+ else+ JAVACMD="$JAVA_HOME/bin/java"+ fi+ if [ ! -x "$JAVACMD" ] ; then+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME++Please set the JAVA_HOME variable in your environment to match the+location of your Java installation."+ fi+else+ JAVACMD="java"+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.++Please set the JAVA_HOME variable in your environment to match the+location of your Java installation."+fi++# Increase the maximum file descriptors if we can.+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then+ MAX_FD_LIMIT=`ulimit -H -n`+ if [ $? -eq 0 ] ; then+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then+ MAX_FD="$MAX_FD_LIMIT"+ fi+ ulimit -n $MAX_FD+ if [ $? -ne 0 ] ; then+ warn "Could not set maximum file descriptor limit: $MAX_FD"+ fi+ else+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"+ fi+fi++# For Darwin, add options to specify how the application appears in the dock+if $darwin; then+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""+fi++# For Cygwin or MSYS, switch paths to Windows format before running java+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`++ JAVACMD=`cygpath --unix "$JAVACMD"`++ # We build the pattern for arguments to be converted via cygpath+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`+ SEP=""+ for dir in $ROOTDIRSRAW ; do+ ROOTDIRS="$ROOTDIRS$SEP$dir"+ SEP="|"+ done+ OURCYGPATTERN="(^($ROOTDIRS))"+ # Add a user-defined pattern to the cygpath arguments+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"+ fi+ # Now convert the arguments - kludge to limit ourselves to /bin/sh+ i=0+ for arg in "$@" ; do+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option++ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`+ else+ eval `echo args$i`="\"$arg\""+ fi+ i=`expr $i + 1`+ done+ case $i in+ 0) set -- ;;+ 1) set -- "$args0" ;;+ 2) set -- "$args0" "$args1" ;;+ 3) set -- "$args0" "$args1" "$args2" ;;+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;+ esac+fi++# Escape application args+save () {+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done+ echo " "+}+APP_ARGS=`save "$@"`++# Collect all arguments for the java command, following the shell quoting and substitution rules+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"++exec "$JAVACMD" "$@"diff --git a/android/clearcam/gradlew.bat b/android/clearcam/gradlew.batnew file mode 100644index 0000000..ac1b06f--- /dev/null+++ b/android/clearcam/gradlew.bat@@ -0,0 +1,89 @@+@rem+@rem Copyright 2015 the original author or authors.+@rem+@rem Licensed under the Apache License, Version 2.0 (the "License");+@rem you may not use this file except in compliance with the License.+@rem You may obtain a copy of the License at+@rem+@rem https://www.apache.org/licenses/LICENSE-2.0+@rem+@rem Unless required by applicable law or agreed to in writing, software+@rem distributed under the License is distributed on an "AS IS" BASIS,+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+@rem See the License for the specific language governing permissions and+@rem limitations under the License.+@rem++@if "%DEBUG%" == "" @echo off+@rem ##########################################################################+@rem+@rem Gradle startup script for Windows+@rem+@rem ##########################################################################++@rem Set local scope for the variables with windows NT shell+if "%OS%"=="Windows_NT" setlocal++set DIRNAME=%~dp0+if "%DIRNAME%" == "" set DIRNAME=.+set APP_BASE_NAME=%~n0+set APP_HOME=%DIRNAME%++@rem Resolve any "." and ".." in APP_HOME to make it shorter.+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi++@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"++@rem Find java.exe+if defined JAVA_HOME goto findJavaFromJavaHome++set JAVA_EXE=java.exe+%JAVA_EXE% -version >NUL 2>&1+if "%ERRORLEVEL%" == "0" goto execute++echo.+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.+echo.+echo Please set the JAVA_HOME variable in your environment to match the+echo location of your Java installation.++goto fail++:findJavaFromJavaHome+set JAVA_HOME=%JAVA_HOME:"=%+set JAVA_EXE=%JAVA_HOME%/bin/java.exe++if exist "%JAVA_EXE%" goto execute++echo.+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%+echo.+echo Please set the JAVA_HOME variable in your environment to match the+echo location of your Java installation.++goto fail++:execute+@rem Setup the command line++set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar+++@rem Execute Gradle+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*++:end+@rem End local scope for the variables with windows NT shell+if "%ERRORLEVEL%"=="0" goto mainEnd++:fail+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of+rem the _cmd.exe /c_ return code!+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1+exit /b 1++:mainEnd+if "%OS%"=="Windows_NT" endlocal++:omegadiff --git a/android/clearcam/settings.gradle b/android/clearcam/settings.gradlenew file mode 100644index 0000000..950c03a--- /dev/null+++ b/android/clearcam/settings.gradle@@ -0,0 +1,23 @@+pluginManagement {+ repositories {+ google {+ content {+ includeGroupByRegex("com\\.android.*")+ includeGroupByRegex("com\\.google.*")+ includeGroupByRegex("androidx.*")+ }+ }+ mavenCentral()+ gradlePluginPortal()+ }+}+dependencyResolutionManagement {+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)+ repositories {+ google()+ mavenCentral()+ }+}++rootProject.name = "clearcam"+include ':app'