d_yanis 1 year ago
parent 51f7c046ce
commit 3f4148cf89

@ -1,6 +1,7 @@
package com.iqball.app
import android.os.Bundle
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
@ -8,13 +9,17 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import arrow.core.Either
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.iqball.app.api.EitherBodyConverter
import com.iqball.app.api.EitherCallAdapterFactory
import com.iqball.app.api.service.AuthService
import com.iqball.app.api.service.IQBallService
import com.iqball.app.page.HomeMain
import com.iqball.app.page.RegisterPage
import com.iqball.app.ui.theme.IQBallTheme
import kotlinx.coroutines.runBlocking
import okhttp3.OkHttpClient
import okhttp3.ResponseBody
import retrofit2.Converter
@ -26,14 +31,14 @@ import java.lang.reflect.Type
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val gson = Gson()
Log.d("test", "test")
/*val gson = Gson()
val retrofit = Retrofit.Builder()
.addConverterFactory(EitherBodyConverter.create())
.addConverterFactory(GsonConverterFactory.create(gson))
.addCallAdapterFactory(EitherCallAdapterFactory.create(gson))
.baseUrl("https://iqball.maxou.dev/api/dotnet-master/")
.baseUrl("http://maxou.dev/")
.client(
OkHttpClient.Builder()
.addInterceptor { it.proceed(it.request()) }
@ -41,13 +46,14 @@ class MainActivity : ComponentActivity() {
)
.build()
val service = retrofit.create<IQBallService>()
val service = retrofit.create<IQBallService>()*/
setContent {
IQBallTheme {
// A surface container using the 'background' color from the theme
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
App(service)
//App(service)
HomeMain()
}
}
}
@ -56,5 +62,12 @@ class MainActivity : ComponentActivity() {
@Composable
fun App(service: IQBallService) {
RegisterPage(service)
runBlocking {
val result = service.login(AuthService.LoginRequest("yanis@mail.com", "123456"))
//val auth = result.getOrNull()!!
Log.d("test", "test")
//service.getUserData(auth.token)
}
//RegisterPage(service)
}

@ -0,0 +1,46 @@
package com.iqball.app.page
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.runtime.Composable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CutCornerShape
import androidx.compose.material3.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.iqball.app.R
import com.iqball.app.ui.theme.IQBallTheme
@Composable
fun HomeMain() {
Column() {
Row (
modifier = Modifier
.fillMaxWidth()
.height(100.dp)
.border(
border = BorderStroke(2.dp, Color.Blue),
shape = CutCornerShape(8.dp)
)
){
Text(
"IQBALL",
modifier = Modifier.border(
border = BorderStroke(2.dp, Color.Red),
shape = CutCornerShape(8.dp)
)
)
}
}
}

@ -0,0 +1,37 @@
package com.iqball.app.page
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.iqball.app.ui.theme.IQBallTheme
@Composable
fun SettingsMain() {
Column() {
}
}
@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
Text(
text = "Hello $name!",
modifier = modifier
)
}
@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
IQBallTheme {
Greeting("Android")
}
}

@ -1,5 +1,5 @@
[versions]
agp = "8.3.0"
agp = "8.2.2"
arrowCore = "1.2.1"
converterGson = "2.9.0"
kotlin = "1.9.0"

Loading…
Cancel
Save