Skip to content

Instantly share code, notes, and snippets.

View hsmnzaydn's full-sized avatar
🎈
Working from home

Hüseyin Serkan Özaydin hsmnzaydn

🎈
Working from home
View GitHub Profile
@Composable
fun SplashScreen(viewModel:SplashVM?,navHostController: NavHostController) {
val data = viewModel?.isDownloadData?.value
LaunchedEffect(key1 = data) {
when (data) {
is Resource.Success -> {
Log.d("SPLASH_SCREEN","MAIN SCREEN AÇILDI")
navHostController.navigate("main_screen")
}
}
@Composable
fun SplashScreen(viewModel:SplashVM?,navHostController: NavHostController){
val data = viewModel?.isDownloadData?.value
when(data){
is Resource.Success ->{
Log.d("SPLASH_SCREEN","MAIN SCREEN AÇILDI")
navHostController.navigate("main_screen")
}
}
}
@HiltViewModel
class SplashVM @Inject constructor(private val getQuestionUseCase: QuestionUseCase) : ViewModel() {
var isDownloadData : MutableState<Resource<List<Question>>> = mutableStateOf(Resource.Loading(true))
private set
init {
getQuestions()
}
name: Java CI
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
lifecycleScope.launchWhenResumed {
val response = try {
apolloClient(requireContext()).mutate(LoginMutation(email = Input.fromNullable("serkan.zaydn@gmail.com"))).toDeferred().await()
} catch (e: Exception) {
null
}
val login = response?.data?.login
}
// AUTO-GENERATED FILE. DO NOT MODIFY.
//
// This class was automatically generated by Apollo GraphQL plugin from the GraphQL queries it found.
// It should not be modified by hand.
//
package com.example.rocketreserver
import com.apollographql.apollo.api.Input
import com.apollographql.apollo.api.Mutation
import com.apollographql.apollo.api.Operation
mutation Login($email: String) {
login(email: $email)
}
./gradlew downloadApolloSchema \
--endpoint="https://your.domain/graphql/endpoint" \ #GraphQL endpoint
--schema="src/main/graphql/com/example/schema.json" #schema.json dosyasının ineceği path
@hsmnzaydn
hsmnzaydn / services.kt
Last active January 19, 2021 05:14
Provide Apollo
fun apolloClient(context: Context): ApolloClient {
check(Looper.myLooper() == Looper.getMainLooper()) {
"Only the main thread can get the apolloClient instance"
}
if (instance != null) {
return instance!!
}
val okHttpClient = OkHttpClient.Builder()
@hsmnzaydn
hsmnzaydn / build.gradle
Last active January 19, 2021 05:15
Apollo
implementation "com.apollographql.apollo:apollo-runtime:2.5.2" //Apollo
implementation "com.apollographql.apollo:apollo-coroutines-support:2.4.6" //Apollo Coroutine