Merge branch 'develop'

This commit is contained in:
Kuba Szczodrzyński 2022-02-21 22:12:46 +01:00
commit 2e97467c57
No known key found for this signature in database
GPG Key ID: 70CB8A85BA1633CB
14 changed files with 132 additions and 28 deletions

View File

@ -41,6 +41,7 @@ android {
buildTypes {
debug {
getIsDefault().set(true)
minifyEnabled = false
manifestPlaceholders = [
buildTimestamp: 0
@ -55,7 +56,8 @@ android {
}
flavorDimensions "platform"
productFlavors {
main {
unofficial {
getIsDefault().set(true)
versionName "${release.versionName}-${gitInfo.versionSuffix}"
}
official {}
@ -63,7 +65,18 @@ android {
}
variantFilter { variant ->
def flavors = variant.flavors*.name
setIgnore(variant.buildType.name == "debug" && !flavors.contains("main"))
setIgnore(variant.buildType.name == "debug" && !flavors.contains("unofficial") || flavors.contains("main"))
}
sourceSets {
unofficial {
java.srcDirs = ["src/main/java", "src/play-not/java"]
}
official {
java.srcDirs = ["src/main/java", "src/play-not/java"]
}
play {
java.srcDirs = ["src/main/java", "src/play/java"]
}
}
defaultConfig {
@ -170,7 +183,8 @@ dependencies {
implementation "eu.szkolny:mhttp:af4b62e6e9"
implementation "eu.szkolny:nachos:0e5dfcaceb"
implementation "eu.szkolny.selective-dao:annotation:27f8f3f194"
implementation "eu.szkolny:ssl-provider:1.0.0"
officialImplementation "eu.szkolny:ssl-provider:1.0.0"
unofficialImplementation "eu.szkolny:ssl-provider:1.0.0"
implementation "pl.szczodrzynski:navlib:0.8.0"
implementation "pl.szczodrzynski:numberslidingpicker:2921225f76"
implementation "pl.szczodrzynski:recyclertablayout:700f980584"

View File

@ -1,6 +1,6 @@
<h3>Wersja 4.11.2, 2022-02-05</h3>
<h3>Wersja 4.11.3, 2022-02-21</h3>
<ul>
<li>Mobidziennik: naprawiono brak nadawców w liście wiadomości.</li>
<li>Naprawiono odświeżanie planu lekcji po pobraniu wybranego tygodnia.</li>
</ul>
<br>
<br>

View File

@ -9,7 +9,7 @@
/*secret password - removed for source code publication*/
static toys AES_IV[16] = {
0x66, 0xae, 0x85, 0x2a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
0x90, 0xe9, 0x2f, 0x20, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
unsigned char *agony(unsigned int laugh, unsigned char *box, unsigned char *heat);

View File

@ -26,8 +26,6 @@ import com.google.firebase.messaging.FirebaseMessaging
import com.google.gson.Gson
import com.hypertrack.hyperlog.HyperLog
import com.mikepenz.iconics.Iconics
import eu.szkolny.sslprovider.SSLProvider
import eu.szkolny.sslprovider.enableSupportedTls
import im.wangchao.mhttp.MHttp
import kotlinx.coroutines.*
import me.leolin.shortcutbadger.ShortcutBadger
@ -42,6 +40,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Profile
import pl.szczodrzynski.edziennik.ext.DAY
import pl.szczodrzynski.edziennik.ext.MS
import pl.szczodrzynski.edziennik.ext.setLanguage
import pl.szczodrzynski.edziennik.network.SSLProviderInstaller
import pl.szczodrzynski.edziennik.network.cookie.DumbCookieJar
import pl.szczodrzynski.edziennik.sync.SyncWorker
import pl.szczodrzynski.edziennik.sync.UpdateWorker
@ -49,7 +48,6 @@ import pl.szczodrzynski.edziennik.ui.base.CrashActivity
import pl.szczodrzynski.edziennik.utils.*
import pl.szczodrzynski.edziennik.utils.Utils.d
import pl.szczodrzynski.edziennik.utils.managers.*
import timber.log.Timber
import java.util.concurrent.TimeUnit
import kotlin.coroutines.CoroutineContext
@ -119,7 +117,8 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
.connectTimeout(15, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.enableSupportedTls(enableCleartext = true)
SSLProviderInstaller.enableSupportedTls(builder, enableCleartext = true)
if (devMode) {
HyperLog.initialize(this)
@ -203,18 +202,7 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
withContext(Dispatchers.Default) {
config.migrate(this@App)
SSLProvider.install(
applicationContext,
downloadIfNeeded = true,
supportTls13 = false,
onFinish = {
buildHttp()
},
onError = {
Timber.e("Failed to install SSLProvider: $it")
it.printStackTrace()
}
)
SSLProviderInstaller.install(applicationContext, this@App::buildHttp)
if (config.devModePassword != null)
checkDevModePassword()

View File

@ -46,6 +46,6 @@ object Signing {
/*fun provideKey(param1: String, param2: Long): ByteArray {*/
fun pleaseStopRightNow(param1: String, param2: Long): ByteArray {
return "$param1.MTIzNDU2Nzg5MDMIlcxGrq===.$param2".sha256()
return "$param1.MTIzNDU2Nzg5MDw/KY+My+===.$param2".sha256()
}
}

View File

@ -62,6 +62,8 @@ class TimetableDayFragment : LazyFragment(), CoroutineScope {
private var firstEventMinute = 24 * 60
private var paddingTop = 0
private var viewsRemoved = false
private val manager
get() = app.timetableManager
private val attendanceManager
@ -127,6 +129,7 @@ class TimetableDayFragment : LazyFragment(), CoroutineScope {
inflater.inflate(R.layout.timetable_no_timetable, b.root) { view, _, _ ->
b.root.removeAllViews()
b.root.addView(view)
viewsRemoved = true
val b = TimetableNoTimetableBinding.bind(view)
val weekStart = date.weekStart.stringY_m_d
@ -151,6 +154,7 @@ class TimetableDayFragment : LazyFragment(), CoroutineScope {
inflater.inflate(R.layout.timetable_no_lessons, b.root) { view, _, _ ->
b.root.removeAllViews()
b.root.addView(view)
viewsRemoved = true
}
return
}
@ -162,6 +166,13 @@ class TimetableDayFragment : LazyFragment(), CoroutineScope {
return
}
// the timetable was not synced (the day layout views are removed) and is now available
if (viewsRemoved) {
viewsRemoved = false
activity.sendBroadcast(Intent(TimetableFragment.ACTION_RELOAD_PAGES))
return
}
b.scrollView.isVisible = true
b.dayFrame.removeView(dayView)
b.dayFrame.addView(dayView, 0)

View File

@ -36,6 +36,7 @@ class TimetableFragment : Fragment(), CoroutineScope {
companion object {
private const val TAG = "TimetableFragment"
const val ACTION_SCROLL_TO_DATE = "pl.szczodrzynski.edziennik.timetable.SCROLL_TO_DATE"
const val ACTION_RELOAD_PAGES = "pl.szczodrzynski.edziennik.timetable.RELOAD_PAGES"
const val DEFAULT_START_HOUR = 6
const val DEFAULT_END_HOUR = 19
var pageSelection: Date? = null
@ -66,14 +67,22 @@ class TimetableFragment : Fragment(), CoroutineScope {
override fun onReceive(context: Context, i: Intent) {
if (!isAdded)
return
val dateStr = i.extras?.getString("timetableDate", null) ?: return
val date = Date.fromY_m_d(dateStr)
b.viewPager.setCurrentItem(items.indexOf(date), true)
when (i.action) {
ACTION_SCROLL_TO_DATE -> {
val dateStr = i.extras?.getString("timetableDate", null) ?: return
val date = Date.fromY_m_d(dateStr)
b.viewPager.setCurrentItem(items.indexOf(date), true)
}
ACTION_RELOAD_PAGES -> {
b.viewPager.adapter?.notifyDataSetChanged()
}
}
}
}
override fun onResume() {
super.onResume()
activity.registerReceiver(broadcastReceiver, IntentFilter(ACTION_SCROLL_TO_DATE))
activity.registerReceiver(broadcastReceiver, IntentFilter(ACTION_RELOAD_PAGES))
}
override fun onPause() {
super.onPause()

View File

@ -47,4 +47,8 @@ class TimetablePagerAdapter(
}
return pageTitle
}
override fun getItemPosition(`object`: Any): Int {
return POSITION_NONE
}
}

View File

@ -72,6 +72,9 @@ class MessageManager(private val app: App) {
if (sentDate > 0L) {
it.addedDate = sentDate
}
withContext(Dispatchers.IO) {
it.recipients = app.db.messageRecipientDao().getAllByMessageId(profileId, it.id)
}
}
} else {
withContext(Dispatchers.IO) {

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) Kuba Szczodrzyński 2022-2-21.
*/
package pl.szczodrzynski.edziennik.network
import android.content.Context
import eu.szkolny.sslprovider.SSLProvider
import eu.szkolny.sslprovider.enableSupportedTls
import okhttp3.OkHttpClient
import timber.log.Timber
object SSLProviderInstaller {
fun install(applicationContext: Context, rebuildCallback: () -> Unit) {
SSLProvider.install(
applicationContext,
downloadIfNeeded = true,
supportTls13 = false,
onFinish = {
rebuildCallback()
},
onError = {
Timber.e("Failed to install SSLProvider: $it")
it.printStackTrace()
}
)
}
fun enableSupportedTls(builder: OkHttpClient.Builder, enableCleartext: Boolean = true) {
builder.enableSupportedTls(enableCleartext)
}
}

View File

@ -0,0 +1,19 @@
/*
* Copyright (c) Kuba Szczodrzyński 2022-2-21.
*/
package pl.szczodrzynski.edziennik.network
import android.content.Context
import okhttp3.OkHttpClient
object SSLProviderInstaller {
fun install(applicationContext: Context, rebuildCallback: () -> Unit) {
}
fun enableSupportedTls(builder: OkHttpClient.Builder, enableCleartext: Boolean = true) {
}
}

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) Kuba Szczodrzyński 2022-2-21.
*/
package pl.szczodrzynski.edziennik.sync
import android.app.IntentService
import android.content.Intent
import android.widget.Toast
import pl.szczodrzynski.edziennik.utils.Utils
class UpdateDownloaderService : IntentService(UpdateDownloaderService::class.java.simpleName) {
override fun onHandleIntent(intent: Intent?) {
try {
Utils.openGooglePlay(this, application.packageName)
}
catch (e: Exception) {
e.printStackTrace()
Toast.makeText(this, "Nie znaleziono Google Play. Pobierz aktualizację ręcznie.", Toast.LENGTH_SHORT).show()
}
}
}

View File

@ -5,8 +5,8 @@ buildscript {
kotlin_version = '1.5.30'
release = [
versionName: "4.11.2",
versionCode: 4110299
versionName: "4.11.3",
versionCode: 4110399
]
setup = [