diff --git a/app/build.gradle b/app/build.gradle index 65258c4..28697c6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,9 +13,10 @@ android { minSdkVersion 21 targetSdkVersion 28 versionCode 11 - versionName "0.3.99" + versionName "0.4.0-rc1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" resValue "string", "build_time", buildTime() + setProperty("archivesBaseName", "projectlaogai-$versionName") } buildTypes { @@ -44,8 +45,8 @@ dependencies { implementation 'com.google.android.material:material:1.0.0' implementation 'com.google.code.gson:gson:2.8.5' implementation 'com.afollestad:aesthetic:1.0.0-beta05' - implementation 'com.afollestad.material-dialogs:core:2.2.0' - implementation 'com.afollestad.material-dialogs:color:2.2.0' + implementation 'com.afollestad.material-dialogs:core:2.6.0' + implementation 'com.afollestad.material-dialogs:color:2.6.0' testImplementation 'junit:junit:4.12' diff --git a/app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt b/app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt index 67349ec..b0e4bf2 100644 --- a/app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt +++ b/app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt @@ -171,12 +171,13 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte val currentDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK) val cal = Calendar.getInstance() + // timetable sunday workaround cal.time = Date(timetableCacheTime * 1000) val timetableCacheDay = cal.get(Calendar.DAY_OF_WEEK) - // if the last update was on monday and now its a sunday, update before displaying the timetable // TODO this sill backfire if someone has to update before the server finished updating the timetable at 0001/0101 - if(currentDay == Calendar.MONDAY && timetableCacheDay == Calendar.SUNDAY) { + // update blocking if a) it`s monday and the last cache was not on a monday or b) the cache is older than 6 days + if((currentDay == Calendar.MONDAY && timetableCacheDay != Calendar.MONDAY) || (System.currentTimeMillis() / 1000) - timetableCacheTime > 518400) { println("updating timetable after sunday!") val jobA = tcor.getTimetable(cCourse.courseName, 0) val jobB = tcor.getTimetable(cCourse.courseName, 1) @@ -185,6 +186,16 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte jobB.get() } + // mensa sunday workaround + cal.time = Date(System.currentTimeMillis()) // reset to current time + + // update blocking if it's sunday after 1500 + // TODO and the last update was before 1500 + if(currentDay == Calendar.SUNDAY && cal.get(Calendar.HOUR_OF_DAY) >= 15) { + val jobA = tcor.getMensa() + jobA.get() + } + // get the cached files val cache = CacheController(this) cache.readStartCache(cCourse.courseName)