Skip to content

Commit

Permalink
Important Change (#224)
Browse files Browse the repository at this point in the history
* # Pre-release-v6.0.0.3 done

* # Scroll view issue solve in ViewSubjectScreen

* # Time Bound added !!

* # Connectivity check added

* # Some change in YML file
  • Loading branch information
aiyu-ayaan authored Jan 7, 2024
1 parent 99a734e commit 572c932
Show file tree
Hide file tree
Showing 20 changed files with 457 additions and 81 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/Build and Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.ACCOUNT_TOKEN }}
- run: |
cd generated
v=$(echo ${{ github.ref }} | cut -c 11-)
pre=$(echo ${{ steps.pre_release.outputs.tag_name }} | cut -c 13-)
sed -i -E "/stable.+/stable: $v /" mkdocs.yml
sed -i -E "s/pre_release.+/pre_release: $pre /" mkdocs.yml
sed -i -E "s/stable.+/stable: $(echo ${{ github.ref }} | cut -c 11-) /" mkdocs.yml
sed -i -E "s/pre_release.+/pre_release: $(echo ${{ steps.pre_release.outputs.tag_name }} | cut -c 13-) /" mkdocs.yml
pip install mkdocs-material
pip install mkdocs-glightbox
pip install mkdocs-markdownextradata-plugin
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/GenerateDoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.ACCOUNT_TOKEN }}
- run: |
cd generated
pre=$(echo ${{ steps.pre_release.outputs.tag_name }} | cut -c 13-)
sed -i -E 's/stable.+/stable: ${{ steps.latest_release.outputs.tag_name }}/' mkdocs.yml
sed -i -E "s/pre_release.+/pre_release: $v /" mkdocs.yml
sed -i -E "s/pre_release.+/pre_release: $(echo ${{ steps.pre_release.outputs.tag_name }} | cut -c 13-) /" mkdocs.yml
echo "stable: ${{ github.event.inputs.stable }}"
echo "pre_release: ${{ github.event.inputs.pre_release }}"
pip install mkdocs-material
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/Pre-Release Build and Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.ACCOUNT_TOKEN }}
- run: |
cd generated
v=$(echo ${{ github.ref }} | cut -c 23-)
sed -i -E 's/stable.+/stable: ${{ steps.latest_release.outputs.tag_name }}/' mkdocs.yml
sed -i -E "s/pre_release.+/pre_release: $v /" mkdocs.yml
sed -i -E "s/pre_release.+/pre_release: $(echo ${{ github.ref }} | cut -c 23-) /" mkdocs.yml
pip install mkdocs-material
pip install mkdocs-glightbox
pip install mkdocs-markdownextradata-plugin
Expand Down
2 changes: 2 additions & 0 deletions bitapp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,6 @@ dependencies {

implementation(libs.graph)

implementation("com.github.instacart:truetime-android:3.5")

}
1 change: 0 additions & 1 deletion bitapp/src/main/java/com/atech/bit/BITApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.SharedPreferences
import android.os.Build
import android.util.Log
import androidx.annotation.RequiresApi
import coil.ImageLoader
import coil.ImageLoaderFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ package com.atech.bit.ui.activity.main
import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.viewModels
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.toArgb
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
Expand Down Expand Up @@ -63,6 +61,7 @@ class MainActivity : ComponentActivity(), LifecycleEventObserver,

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
viewModel.checkTime()
setContent {
val themeState by viewModel.themeState
val navHostController = rememberNavController()
Expand All @@ -77,6 +76,14 @@ class MainActivity : ComponentActivity(), LifecycleEventObserver,
Surface(
modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.surface
) {
LaunchedEffect(key1 = viewModel.isTimeCorrect.value) {
if (!viewModel.isTimeCorrect.value && viewModel.hasSetUpDone) {
navHostController.popBackStack()
navHostController.navigate(
ParentScreenRoutes.TimeForceScreen.route
)
}
}
viewModel.action = {
navHostController.navigate(
TopLevelRoute.LOGIN.route
Expand Down Expand Up @@ -164,6 +171,11 @@ class MainActivity : ComponentActivity(), LifecycleEventObserver,
}
}

override fun onResume() {
super.onResume()
viewModel.checkTime()
}


override fun onDestroy() {
super.onDestroy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ import com.atech.core.utils.TAGS
import com.atech.core.utils.fromJSON
import com.atech.core.utils.hasSameDay
import com.atech.core.utils.toJSON
import com.instacart.library.truetime.TrueTimeRx
import dagger.hilt.android.lifecycle.HiltViewModel
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import java.util.Date
import javax.inject.Inject

@HiltViewModel
Expand Down Expand Up @@ -364,4 +367,18 @@ class MainViewModel @Inject constructor(
}
}
}

// _______________________________________ Time _____________________________________________________
private val _isTimeCorrect = mutableStateOf(true)
val isTimeCorrect: State<Boolean> get() = _isTimeCorrect
fun checkTime() = viewModelScope.launch {
TrueTimeRx.build().initializeRx("time.apple.com")
.subscribeOn(Schedulers.io())
.subscribe({ date ->
Log.d(TAGS.BIT_TIME.name, "checkTime: ${date.time hasSameDay Date().time}")
_isTimeCorrect.value = date.time hasSameDay Date().time
}, { throwable ->
Log.e(TAGS.BIT_TIME.name, "checkTime: $throwable")
})
}
}
67 changes: 67 additions & 0 deletions bitapp/src/main/java/com/atech/bit/ui/comman/emptyScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.atech.bit.ui.comman

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.airbnb.lottie.compose.LottieAnimation
import com.airbnb.lottie.compose.LottieCompositionSpec
import com.airbnb.lottie.compose.LottieConstants
import com.airbnb.lottie.compose.animateLottieCompositionAsState
import com.airbnb.lottie.compose.rememberLottieComposition
import com.atech.bit.R
import com.atech.bit.ui.theme.BITAppTheme
import com.atech.bit.ui.theme.grid_1

@Composable
fun GlobalEmptyScreen(
modifier: Modifier = Modifier,
isEmpty: Boolean = true,
emptyText: String = "Empty",
content: @Composable () -> Unit = {}
) {
if (isEmpty)
Column(
modifier = modifier
.padding(grid_1)
.fillMaxWidth()
.background(
color = MaterialTheme.colorScheme.surface
),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.empty_screen))
val progress by animateLottieCompositionAsState(
composition,
iterations = LottieConstants.IterateForever
)
LottieAnimation(
modifier = modifier
.fillMaxWidth()
.fillMaxHeight(0.5f),
composition = composition,
progress = { progress },
)
Text(text = emptyText)
}
else
content()
}

@Preview(showBackground = true)
@Composable
private fun GlobalEmptyScreenPreview() {
BITAppTheme {
GlobalEmptyScreen()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.atech.bit.ui.screens.MainScreen
import com.atech.bit.ui.screens.administration.AdministrationScreen
import com.atech.bit.ui.screens.cgpa.compose.CgpaScreen
import com.atech.bit.ui.screens.force.ForceScreen
import com.atech.bit.ui.screens.force.TimeForceScreen
import com.atech.bit.ui.screens.holiday.compose.HolidayScreen
import com.atech.bit.ui.screens.view_image.ViewImageScreen
import com.atech.bit.utils.animatedComposable
Expand All @@ -31,6 +32,8 @@ sealed class ParentScreenRoutes(val route: String) {
data object MainScreen : ParentScreenRoutes(TopLevelRoute.MAIN_SCREEN.route)

data object ForceScreen : ParentScreenRoutes("force_screen")

data object TimeForceScreen : ParentScreenRoutes("time_force_screen")
}

@Composable
Expand Down Expand Up @@ -60,6 +63,15 @@ fun TopLevelNavigationGraph(
.forceScreenModel.value
)
}
animatedComposable(
route = ParentScreenRoutes.TimeForceScreen.route
) {
TimeForceScreen(
state = communicatorViewModel
.isTimeCorrect.value,
navController = navHostController
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fun ViewSubjectScreen(
}) {
Column(
modifier = modifier
.verticalScroll(scrollState)
/*.verticalScroll(scrollState)*/
.padding(it)
.background(
MaterialTheme.colorScheme.surface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.atech.bit.ui.screens.event.component.event

import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.ExperimentalMaterial3Api
Expand All @@ -17,6 +18,7 @@ import androidx.navigation.compose.rememberNavController
import com.atech.bit.R
import com.atech.bit.ui.comman.BackToolbar
import com.atech.bit.ui.comman.EventItem
import com.atech.bit.ui.comman.GlobalEmptyScreen
import com.atech.bit.ui.navigation.DeepLinkRoutes
import com.atech.bit.ui.navigation.EventRoute
import com.atech.bit.ui.navigation.navigateWithDeepLink
Expand Down Expand Up @@ -49,30 +51,38 @@ fun EventScreen(
)
}
) {
LazyColumn(
GlobalEmptyScreen(
modifier = Modifier
.consumeWindowInsets(it),
contentPadding = it
) {
items(
items = events,
key = { event -> event.title + event.created }
) { model ->
EventItem(
model = model,
onEventClick = { clickItems ->
viewModel.onEvent(EventScreenEvent.OnEventClick(clickItems))
navController.navigate(EventRoute.DetailScreen.route)
},
getAttach = viewModel.getAttach,
onClick = {
navController.navigateWithDeepLink(
DeepLinkRoutes.ViewImageRoute(it)
.padding(it),
isEmpty = events.isEmpty(),
emptyText = "No events found",
content = {
LazyColumn(
modifier = Modifier
.consumeWindowInsets(it),
contentPadding = it
) {
items(
items = events,
key = { event -> event.title + event.created }
) { model ->
EventItem(
model = model,
onEventClick = { clickItems ->
viewModel.onEvent(EventScreenEvent.OnEventClick(clickItems))
navController.navigate(EventRoute.DetailScreen.route)
},
getAttach = viewModel.getAttach,
onClick = {
navController.navigateWithDeepLink(
DeepLinkRoutes.ViewImageRoute(it)
)
}
)
}
)
}
}
}
)
}
}

Expand Down
Loading

0 comments on commit 572c932

Please sign in to comment.