Răsfoiți Sursa

app: continued development of password reset

Bobarik41p 6 zile în urmă
părinte
comite
54db925326

+ 1 - 1
App/.idea/kotlinc.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="KotlinJpsPluginSettings">
-    <option name="version" value="1.9.0" />
+    <option name="version" value="2.0.0" />
   </component>
 </project>

+ 329 - 0
App/.idea/other.xml

@@ -0,0 +1,329 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="direct_access_persist.xml">
+    <option name="deviceSelectionList">
+      <list>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="27" />
+          <option name="brand" value="DOCOMO" />
+          <option name="codename" value="F01L" />
+          <option name="id" value="F01L" />
+          <option name="manufacturer" value="FUJITSU" />
+          <option name="name" value="F-01L" />
+          <option name="screenDensity" value="360" />
+          <option name="screenX" value="720" />
+          <option name="screenY" value="1280" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="28" />
+          <option name="brand" value="DOCOMO" />
+          <option name="codename" value="SH-01L" />
+          <option name="id" value="SH-01L" />
+          <option name="manufacturer" value="SHARP" />
+          <option name="name" value="AQUOS sense2 SH-01L" />
+          <option name="screenDensity" value="480" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2160" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="Lenovo" />
+          <option name="codename" value="TB370FU" />
+          <option name="id" value="TB370FU" />
+          <option name="manufacturer" value="Lenovo" />
+          <option name="name" value="Tab P12" />
+          <option name="screenDensity" value="340" />
+          <option name="screenX" value="1840" />
+          <option name="screenY" value="2944" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="31" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="a51" />
+          <option name="id" value="a51" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy A51" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2400" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="akita" />
+          <option name="id" value="akita" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 8a" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2400" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="33" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="b0q" />
+          <option name="id" value="b0q" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy S22 Ultra" />
+          <option name="screenDensity" value="600" />
+          <option name="screenX" value="1440" />
+          <option name="screenY" value="3088" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="32" />
+          <option name="brand" value="google" />
+          <option name="codename" value="bluejay" />
+          <option name="id" value="bluejay" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 6a" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2400" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="caiman" />
+          <option name="id" value="caiman" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 9 Pro" />
+          <option name="screenDensity" value="360" />
+          <option name="screenX" value="960" />
+          <option name="screenY" value="2142" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="comet" />
+          <option name="id" value="comet" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 9 Pro Fold" />
+          <option name="screenDensity" value="390" />
+          <option name="screenX" value="2076" />
+          <option name="screenY" value="2152" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="29" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="crownqlteue" />
+          <option name="id" value="crownqlteue" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy Note9" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="2220" />
+          <option name="screenY" value="1080" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="dm3q" />
+          <option name="id" value="dm3q" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy S23 Ultra" />
+          <option name="screenDensity" value="600" />
+          <option name="screenX" value="1440" />
+          <option name="screenY" value="3088" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="e1q" />
+          <option name="id" value="e1q" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy S24" />
+          <option name="screenDensity" value="480" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2340" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="33" />
+          <option name="brand" value="google" />
+          <option name="codename" value="felix" />
+          <option name="id" value="felix" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel Fold" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="2208" />
+          <option name="screenY" value="1840" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="felix" />
+          <option name="id" value="felix" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel Fold" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="2208" />
+          <option name="screenY" value="1840" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="33" />
+          <option name="brand" value="google" />
+          <option name="codename" value="felix_camera" />
+          <option name="id" value="felix_camera" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel Fold (Camera-enabled)" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="2208" />
+          <option name="screenY" value="1840" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="33" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="gts8uwifi" />
+          <option name="id" value="gts8uwifi" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy Tab S8 Ultra" />
+          <option name="screenDensity" value="320" />
+          <option name="screenX" value="1848" />
+          <option name="screenY" value="2960" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="husky" />
+          <option name="id" value="husky" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 8 Pro" />
+          <option name="screenDensity" value="390" />
+          <option name="screenX" value="1008" />
+          <option name="screenY" value="2244" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="30" />
+          <option name="brand" value="motorola" />
+          <option name="codename" value="java" />
+          <option name="id" value="java" />
+          <option name="manufacturer" value="Motorola" />
+          <option name="name" value="G20" />
+          <option name="screenDensity" value="280" />
+          <option name="screenX" value="720" />
+          <option name="screenY" value="1600" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="komodo" />
+          <option name="id" value="komodo" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 9 Pro XL" />
+          <option name="screenDensity" value="360" />
+          <option name="screenX" value="1008" />
+          <option name="screenY" value="2244" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="33" />
+          <option name="brand" value="google" />
+          <option name="codename" value="lynx" />
+          <option name="id" value="lynx" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 7a" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2400" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="31" />
+          <option name="brand" value="google" />
+          <option name="codename" value="oriole" />
+          <option name="id" value="oriole" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 6" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2400" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="33" />
+          <option name="brand" value="google" />
+          <option name="codename" value="panther" />
+          <option name="id" value="panther" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 7" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2400" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="q5q" />
+          <option name="id" value="q5q" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy Z Fold5" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1812" />
+          <option name="screenY" value="2176" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="q6q" />
+          <option name="id" value="q6q" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy Z Fold6" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1856" />
+          <option name="screenY" value="2160" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="30" />
+          <option name="brand" value="google" />
+          <option name="codename" value="r11" />
+          <option name="id" value="r11" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel Watch" />
+          <option name="screenDensity" value="320" />
+          <option name="screenX" value="384" />
+          <option name="screenY" value="384" />
+          <option name="type" value="WEAR_OS" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="30" />
+          <option name="brand" value="google" />
+          <option name="codename" value="redfin" />
+          <option name="id" value="redfin" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 5" />
+          <option name="screenDensity" value="440" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2340" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="shiba" />
+          <option name="id" value="shiba" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 8" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2400" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="33" />
+          <option name="brand" value="google" />
+          <option name="codename" value="tangorpro" />
+          <option name="id" value="tangorpro" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel Tablet" />
+          <option name="screenDensity" value="320" />
+          <option name="screenX" value="1600" />
+          <option name="screenY" value="2560" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="tokay" />
+          <option name="id" value="tokay" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 9" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2424" />
+        </PersistentDeviceSelectionData>
+      </list>
+    </option>
+  </component>
+</project>

+ 4 - 1
App/app/build.gradle.kts

@@ -1,7 +1,8 @@
 plugins {
     alias(libs.plugins.android.application)
     alias(libs.plugins.jetbrains.kotlin.android)
-    kotlin("plugin.serialization") version "1.9.0"
+    alias(libs.plugins.compose.compiler)
+
 }
 
 android {
@@ -83,6 +84,8 @@ dependencies {
     implementation (libs.androidx.lifecycle.viewmodel.compose)
     implementation("com.squareup.okhttp3:okhttp:4.10.0")
     implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
+    implementation ("com.google.code.gson:gson:2.8.5")
+    implementation ("com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1")
 
 
 }

+ 26 - 19
App/app/src/main/java/com/example/mystictale/MainActivity.kt

@@ -5,19 +5,19 @@ import android.os.Bundle
 import androidx.activity.ComponentActivity
 import androidx.activity.compose.setContent
 import androidx.activity.enableEdgeToEdge
-import androidx.activity.viewModels
 import androidx.annotation.RequiresApi
-import com.example.mystictale.ViewModels.AuthViewModel
+import com.example.example.ExampleJson2KtKotlin
 import com.example.mystictale.navigation.Navigation
-import com.example.mystictale.resources.components.dateComponents.isDateValid
 import com.example.mystictale.ui.theme.MysticTaleTheme
+import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+import com.fasterxml.jackson.module.kotlin.readValue
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.launch
 import kotlinx.coroutines.withContext
 import okhttp3.OkHttpClient
 import okhttp3.Request
-import org.json.JSONArray
+
 
 class MainActivity : ComponentActivity() {
     @RequiresApi(Build.VERSION_CODES.O)
@@ -28,14 +28,15 @@ class MainActivity : ComponentActivity() {
         setContent {
             MysticTaleTheme {
 
-                //Navigation()
-                getUserIdByEmail("kbobarik@mail.ru") { userId ->
-                    if (userId != null) {
-                        println("UID пользователя: $userId")
-                    } else {
-                        println("Пользователь с таким email не найден.")
-                    }
-                }
+
+                Navigation()
+//                getUserIdByEmail("kbobarik@mail.ru") { userId ->
+//                    if (userId != null) {
+//                        println("UID пользователя: $userId")
+//                    } else {
+//                        println("Пользователь с таким email не найден.")
+//                    }
+//                }
 
 
             }
@@ -49,8 +50,14 @@ fun getUserIdByEmail(email: String, onResult: (String?) -> Unit) {
         val url = "https://eykhnnlgofgxdzlixydt.supabase.co/auth/v1/admin/users?filter=email.eq.$email"
         val request = Request.Builder()
             .url(url)
-            .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImV5a2hubmxnb2ZneGR6bGl4eWR0Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTcyOTIzNDg3OCwiZXhwIjoyMDQ0ODEwODc4fQ.Y_4IElNlvVo59iYJ4Wa9AJyP0wT7z3ysB50vxzL9bQU") // Добавьте ваш service_role ключ
-            .addHeader("apikey", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImV5a2hubmxnb2ZneGR6bGl4eWR0Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTcyOTIzNDg3OCwiZXhwIjoyMDQ0ODEwODc4fQ.Y_4IElNlvVo59iYJ4Wa9AJyP0wT7z3ysB50vxzL9bQU") // То же самое
+            .addHeader(
+                "Authorization",
+                "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImV5a2hubmxnb2ZneGR6bGl4eWR0Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTcyOTIzNDg3OCwiZXhwIjoyMDQ0ODEwODc4fQ.Y_4IElNlvVo59iYJ4Wa9AJyP0wT7z3ysB50vxzL9bQU"
+            ) // Добавьте ваш service_role ключ
+            .addHeader(
+                "apikey",
+                "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImV5a2hubmxnb2ZneGR6bGl4eWR0Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTcyOTIzNDg3OCwiZXhwIjoyMDQ0ODEwODc4fQ.Y_4IElNlvVo59iYJ4Wa9AJyP0wT7z3ysB50vxzL9bQU"
+            ) // То же самое
             .build()
 
         try {
@@ -67,15 +74,15 @@ fun getUserIdByEmail(email: String, onResult: (String?) -> Unit) {
             }
 
             val userId = if (!responseBody.isNullOrEmpty()) {
-                val jsonArray = JSONArray(responseBody)
-                if (jsonArray.length() > 0) {
-                    val userObject = jsonArray.getJSONObject(0)
-                    userObject.getString("id")
+                val mapper = jacksonObjectMapper()
+                val userFromJson = mapper.readValue<List<ExampleJson2KtKotlin>>(responseBody)
+                if (userFromJson.isNotEmpty()) {
+                    val userObject = userFromJson;
                 } else null
             } else null
 
             withContext(Dispatchers.Main) {
-                onResult(userId)
+                onResult("1")
             }
         } catch (e: Exception) {
             e.printStackTrace()

+ 7 - 32
App/app/src/main/java/com/example/mystictale/ViewModels/AuthViewModel.kt

@@ -13,6 +13,8 @@ import com.example.mystictale.models.UserState
 import com.example.mystictale.resources.SharedPreferenceHelper
 import io.github.jan.supabase.auth.auth
 import io.github.jan.supabase.auth.providers.builtin.Email
+import io.github.jan.supabase.postgrest.postgrest
+import io.github.jan.supabase.postgrest.rpc
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.launch
@@ -108,42 +110,15 @@ class AuthViewModel : ViewModel() {
     }
 
     fun getUserIdByEmail(email: String) {
-        CoroutineScope(Dispatchers.IO).launch {
-            val client = OkHttpClient()
-            val request = Request.Builder()
-                .url("https://eykhnnlgofgxdzlixydt.supabase.co/auth/v1/admin/users?filter=email.eq.$email")
-                .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImV5a2hubmxnb2ZneGR6bGl4eWR0Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTcyOTIzNDg3OCwiZXhwIjoyMDQ0ODEwODc4fQ.Y_4IElNlvVo59iYJ4Wa9AJyP0wT7z3ysB50vxzL9bQU")
-                .addHeader("apikey", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImV5a2hubmxnb2ZneGR6bGl4eWR0Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTcyOTIzNDg3OCwiZXhwIjoyMDQ0ODEwODc4fQ.Y_4IElNlvVo59iYJ4Wa9AJyP0wT7z3ysB50vxzL9bQU")
-                .build()
-
+        viewModelScope.launch {
             try {
                 _userState.value = UserState.Loading
-                val response = client.newCall(request).execute()
-                val responseBody = response.body?.string()
-
-                val userId = if (responseBody != null) {
-                    val json = JSONObject(responseBody)
-                    if (json.has("users")) {
-                        val users = json.getJSONArray("users")
-                        if (users.length() > 0) {
-                            users.getJSONObject(0).getString("id")
-                        } else null
-                    } else null
-                } else null
-                if(userId==null)
-                {
-                    _userState.value = UserState.Error("Unknow user")
-                    Log.d("my_tag", "Unknow user")
-                }
-                else{
-                    uid = userId
-                    Log.d("my_tag", uid!!)
-                    _userState.value = UserState.Success("Success reset password")
-                    Log.d("my_tag", "Success reset password")
-                }
+                uid = SupabaseConnect.supabase.postgrest.rpc("get_user_id_by_email", email).toString()
+                Log.d("my_tag", uid!!)
+                _userState.value = UserState.Success("Success reset password")
+                Log.d("my_tag", "Success reset password")
 
             } catch (e: Exception) {
-                e.printStackTrace()
                 _userState.value = UserState.Error("Error: ${e.message}")
                 Log.d("my_tag", e.message!!)
             }

+ 12 - 0
App/app/src/main/java/com/example/mystictale/models/AppMetadata.kt

@@ -0,0 +1,12 @@
+package com.example.example
+
+import com.google.gson.annotations.SerializedName
+
+
+data class AppMetadata (
+  @SerializedName("provider")
+  var provider  : String? = null,
+  @SerializedName("providers" )
+  var providers : ArrayList<String> = arrayListOf()
+
+)

+ 11 - 0
App/app/src/main/java/com/example/mystictale/models/ExampleJson2KtKotlin.kt

@@ -0,0 +1,11 @@
+package com.example.example
+
+import com.google.gson.annotations.SerializedName
+
+
+data class ExampleJson2KtKotlin (
+
+  @SerializedName("users" ) var users : ArrayList<Users> = arrayListOf(),
+  @SerializedName("aud"   ) var aud   : String?          = null
+
+)

+ 13 - 0
App/app/src/main/java/com/example/mystictale/models/UserMetadata.kt

@@ -0,0 +1,13 @@
+package com.example.example
+
+import com.google.gson.annotations.SerializedName
+
+
+data class UserMetadata (
+
+  @SerializedName("email"          ) var email         : String?  = null,
+  @SerializedName("email_verified" ) var emailVerified : Boolean? = null,
+  @SerializedName("phone_verified" ) var phoneVerified : Boolean? = null,
+  @SerializedName("sub"            ) var sub           : String?  = null
+
+)

+ 23 - 0
App/app/src/main/java/com/example/mystictale/models/Users.kt

@@ -0,0 +1,23 @@
+package com.example.example
+
+import com.google.gson.annotations.SerializedName
+
+
+data class Users (
+
+  @SerializedName("id"                 ) var id               : String?       = null,
+  @SerializedName("aud"                ) var aud              : String?       = null,
+  @SerializedName("role"               ) var role             : String?       = null,
+  @SerializedName("email"              ) var email            : String?       = null,
+  @SerializedName("email_confirmed_at" ) var emailConfirmedAt : String?       = null,
+  @SerializedName("phone"              ) var phone            : String?       = null,
+  @SerializedName("confirmed_at"       ) var confirmedAt      : String?       = null,
+  @SerializedName("last_sign_in_at"    ) var lastSignInAt     : String?       = null,
+  @SerializedName("app_metadata"       ) var appMetadata      : AppMetadata?  = AppMetadata(),
+  @SerializedName("user_metadata"      ) var userMetadata     : UserMetadata? = UserMetadata(),
+  @SerializedName("identities"         ) var identities       : String?       = null,
+  @SerializedName("created_at"         ) var createdAt        : String?       = null,
+  @SerializedName("updated_at"         ) var updatedAt        : String?       = null,
+  @SerializedName("is_anonymous"       ) var isAnonymous      : Boolean?      = null
+
+)

+ 1 - 0
App/build.gradle.kts

@@ -2,4 +2,5 @@
 plugins {
     alias(libs.plugins.android.application) apply false
     alias(libs.plugins.jetbrains.kotlin.android) apply false
+    kotlin("plugin.serialization") version "1.9.22"
 }

+ 2 - 1
App/gradle/libs.versions.toml

@@ -2,7 +2,7 @@
 agp = "8.5.1"
 bom = "3.0.2"
 fragmentKtx = "1.8.5"
-kotlin = "1.9.0"
+kotlin = "2.0.0"
 datetime = "0.8.1-rc"
 coreKtx = "1.13.1"
 junit = "4.13.2"
@@ -51,4 +51,5 @@ realtime-kt = { module = "io.github.jan-tennert.supabase:realtime-kt" }
 [plugins]
 android-application = { id = "com.android.application", version.ref = "agp" }
 jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
+compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }