mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-06-13 14:10:46 +02:00
Compare commits
4 Commits
v4.13-rc.5
...
v4.13
Author | SHA1 | Date | |
---|---|---|---|
18cc60a80b | |||
fedde9f739 | |||
9fde97bef0 | |||
742bd03e9e |
@ -1,4 +1,4 @@
|
||||
<h3>Wersja 4.13-rc.5, 2022-10-25</h3>
|
||||
<h3>Wersja 4.13, 2022-10-26</h3>
|
||||
<ul>
|
||||
<li>Poprawione powiadomienia na Androidzie 13. @santoni0</li>
|
||||
<li>Opcja kolorowania bloków w planie lekcji.</li>
|
||||
@ -13,4 +13,4 @@
|
||||
<br>
|
||||
<br>
|
||||
Dzięki za korzystanie ze Szkolnego!<br>
|
||||
<i>© [Kuba Szczodrzyński](@kuba2k2), [Kacper Ziubryniewicz](@kapi2289) 2022</i>
|
||||
<i>© [Kuba Szczodrzyński](@kuba2k2) 2022</i>
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
/*secret password - removed for source code publication*/
|
||||
static toys AES_IV[16] = {
|
||||
0x2f, 0xc0, 0xca, 0x16, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
0xce, 0x63, 0xdd, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
|
||||
unsigned char *agony(unsigned int laugh, unsigned char *box, unsigned char *heat);
|
||||
|
||||
|
@ -14,6 +14,7 @@ import pl.szczodrzynski.edziennik.ext.takePositive
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
abstract class BaseConfig(
|
||||
@Transient
|
||||
val db: AppDb,
|
||||
val profileId: Int? = null,
|
||||
protected var entries: List<ConfigEntry>? = null,
|
||||
|
@ -324,11 +324,14 @@ class SzkolnyApi(val app: App) : CoroutineScope {
|
||||
}
|
||||
|
||||
@Throws(Exception::class)
|
||||
fun shareNote(note: Note) {
|
||||
fun shareNote(note: Note, teamId: Long? = null) {
|
||||
val profile = app.db.profileDao().getByIdNow(note.profileId)
|
||||
?: throw NullPointerException("Profile is not found")
|
||||
val team = app.db.teamDao().getClassNow(note.profileId)
|
||||
?: throw NullPointerException("TeamClass is not found")
|
||||
val team = if (teamId == null)
|
||||
app.db.teamDao().getClassNow(note.profileId)
|
||||
else
|
||||
app.db.teamDao().getByIdNow(note.profileId, teamId)
|
||||
team ?: throw NullPointerException("TeamClass is not found")
|
||||
|
||||
val response = api.shareNote(NoteShareRequest(
|
||||
deviceId = app.deviceId,
|
||||
|
@ -46,6 +46,6 @@ object Signing {
|
||||
|
||||
/*fun provideKey(param1: String, param2: Long): ByteArray {*/
|
||||
fun pleaseStopRightNow(param1: String, param2: Long): ByteArray {
|
||||
return "$param1.MTIzNDU2Nzg5MDF1TqH/cn===.$param2".sha256()
|
||||
return "$param1.MTIzNDU2Nzg5MDHSZrnOj0===.$param2".sha256()
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ interface Noteable {
|
||||
fun getNoteType(): Note.OwnerType
|
||||
fun getNoteOwnerProfileId(): Int
|
||||
fun getNoteOwnerId(): Long
|
||||
fun getNoteShareTeamId(): Long? = null
|
||||
|
||||
var notes: MutableList<Note>
|
||||
|
||||
|
@ -91,6 +91,7 @@ open class Profile(
|
||||
get() = registration == REGISTRATION_ENABLED && !archived
|
||||
|
||||
@delegate:Ignore
|
||||
@delegate:Transient
|
||||
val config by lazy { App.config[this.id] }
|
||||
|
||||
override fun getImageDrawable(context: Context) = this.getDrawable(context)
|
||||
|
@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.data.db.entity.Event
|
||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||
import pl.szczodrzynski.edziennik.data.db.entity.Note
|
||||
import pl.szczodrzynski.edziennik.data.db.entity.Noteable
|
||||
import pl.szczodrzynski.edziennik.ext.takePositive
|
||||
import pl.szczodrzynski.edziennik.ui.search.Searchable
|
||||
import pl.szczodrzynski.edziennik.utils.html.BetterHtml
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||
@ -118,4 +119,5 @@ class EventFull(
|
||||
override fun getNoteType() = Note.OwnerType.EVENT
|
||||
override fun getNoteOwnerProfileId() = profileId
|
||||
override fun getNoteOwnerId() = id
|
||||
override fun getNoteShareTeamId() = teamId.takePositive()
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import pl.szczodrzynski.edziennik.R
|
||||
import pl.szczodrzynski.edziennik.data.db.entity.Lesson
|
||||
import pl.szczodrzynski.edziennik.data.db.entity.Note
|
||||
import pl.szczodrzynski.edziennik.data.db.entity.Noteable
|
||||
import pl.szczodrzynski.edziennik.ext.takePositive
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time
|
||||
|
||||
class LessonFull(
|
||||
@ -142,4 +143,5 @@ class LessonFull(
|
||||
override fun getNoteType() = Note.OwnerType.LESSON
|
||||
override fun getNoteOwnerProfileId() = profileId
|
||||
override fun getNoteOwnerId() = ownerId
|
||||
override fun getNoteShareTeamId() = teamId.takePositive()
|
||||
}
|
||||
|
@ -76,6 +76,9 @@ fun pendingIntentFlag(): Int {
|
||||
fun Int?.takeValue() = if (this == -1) null else this
|
||||
fun Int?.takePositive() = if (this == -1 || this == 0) null else this
|
||||
|
||||
fun Long?.takeValue() = if (this == -1L) null else this
|
||||
fun Long?.takePositive() = if (this == -1L || this == 0L) null else this
|
||||
|
||||
fun String?.takeValue() = if (this.isNullOrBlank()) null else this
|
||||
|
||||
fun Any?.ignore() = Unit
|
||||
|
@ -75,6 +75,7 @@ class HomeTimetableCard(
|
||||
private var counterJob: Job? = null
|
||||
private var counterStart: Time? = null
|
||||
private var counterEnd: Time? = null
|
||||
private var showAllLessons: Boolean = false
|
||||
private var subjectSpannable: CharSequence? = null
|
||||
|
||||
private val ignoreCancelled = false
|
||||
@ -276,6 +277,8 @@ class HomeTimetableCard(
|
||||
counterJob = startCoroutineTimer(repeatMillis = 500) {
|
||||
count()
|
||||
}
|
||||
|
||||
showAllLessons = !isOngoing
|
||||
}
|
||||
else {
|
||||
val isTomorrow = today.clone().stepForward(0, 0, 1) == timetableDate
|
||||
@ -312,12 +315,22 @@ class HomeTimetableCard(
|
||||
} ?: run {
|
||||
b.classroom.visibility = View.GONE
|
||||
}
|
||||
|
||||
showAllLessons = true
|
||||
}
|
||||
|
||||
val text = mutableListOf<CharSequence>(
|
||||
if (showAllLessons)
|
||||
activity.getString(R.string.home_timetable_all_lessons)
|
||||
else
|
||||
activity.getString(R.string.home_timetable_later)
|
||||
)
|
||||
val nextLessons = lessons.drop(skipFirst + 1)
|
||||
|
||||
val nextLessons = if (showAllLessons)
|
||||
lessons.drop(skipFirst)
|
||||
else
|
||||
lessons.drop(skipFirst + 1)
|
||||
|
||||
for (lesson in nextLessons) {
|
||||
text += listOf(
|
||||
lesson.displayStartTime?.stringHM,
|
||||
@ -348,6 +361,14 @@ class HomeTimetableCard(
|
||||
}
|
||||
|
||||
val now = syncedNow
|
||||
if (now >= counterStart && showAllLessons) {
|
||||
// update "next lessons" view to remove current lesson
|
||||
this.counterJob?.cancel()
|
||||
this.counterStart = null
|
||||
this.counterEnd = null
|
||||
update()
|
||||
return
|
||||
}
|
||||
if (now > counterEnd) {
|
||||
// the lesson is already over
|
||||
b.progress.visibility = View.GONE
|
||||
|
@ -87,7 +87,12 @@ class NoteEditorDialog(
|
||||
.show()
|
||||
}
|
||||
|
||||
val success = manager.saveNote(activity, note, wasShared = editingNote?.isShared ?: false)
|
||||
val success = manager.saveNote(
|
||||
activity = activity,
|
||||
note = note,
|
||||
teamId = owner?.getNoteShareTeamId(),
|
||||
wasShared = editingNote?.isShared ?: false,
|
||||
)
|
||||
progressDialog?.dismiss()
|
||||
return success
|
||||
}
|
||||
|
@ -93,10 +93,15 @@ class NoteManager(private val app: App) {
|
||||
return getOwner(note) != null
|
||||
}
|
||||
|
||||
suspend fun saveNote(activity: AppCompatActivity, note: Note, wasShared: Boolean): Boolean {
|
||||
suspend fun saveNote(
|
||||
activity: AppCompatActivity,
|
||||
note: Note,
|
||||
teamId: Long?,
|
||||
wasShared: Boolean,
|
||||
): Boolean {
|
||||
val success = when {
|
||||
!note.isShared && wasShared -> unshareNote(activity, note)
|
||||
note.isShared -> shareNote(activity, note)
|
||||
note.isShared -> shareNote(activity, note, teamId)
|
||||
else -> true
|
||||
}
|
||||
|
||||
@ -124,9 +129,9 @@ class NoteManager(private val app: App) {
|
||||
return true
|
||||
}
|
||||
|
||||
private suspend fun shareNote(activity: AppCompatActivity, note: Note): Boolean {
|
||||
private suspend fun shareNote(activity: AppCompatActivity, note: Note, teamId: Long?): Boolean {
|
||||
return app.api.runCatching(activity) {
|
||||
shareNote(note)
|
||||
shareNote(note, teamId)
|
||||
} != null
|
||||
}
|
||||
|
||||
|
@ -426,4 +426,10 @@ public class Date implements Comparable<Date>, Noteable {
|
||||
public boolean hasReplacingNotes() {
|
||||
return Noteable.DefaultImpls.hasReplacingNotes(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Long getNoteShareTeamId() {
|
||||
return Noteable.DefaultImpls.getNoteShareTeamId(this);
|
||||
}
|
||||
}
|
||||
|
@ -847,7 +847,7 @@
|
||||
<string name="settings_about_licenses_text">Open-Source-Lizenzen</string>
|
||||
<string name="settings_about_privacy_policy_text">Datenschutzrichtlinie</string>
|
||||
<string name="settings_card_register_title">E-Klassenbuch</string>
|
||||
<string name="settings_about_title_subtext">© Kuba Szczodrzyński && Kacper Ziubryniewicz\nSeptember 2018 - 2022</string>
|
||||
<string name="settings_about_title_subtext">© Kuba Szczodrzyński, September 2018 - 2022</string>
|
||||
<string name="settings_about_update_subtext">Klicken Sie hier, um nach Aktualisierungen zu suchen</string>
|
||||
<string name="settings_about_update_text">Aktualisierung</string>
|
||||
<string name="settings_about_version_text">Version</string>
|
||||
|
@ -849,7 +849,7 @@
|
||||
<string name="settings_about_licenses_text">Open-source licenses</string>
|
||||
<string name="settings_about_privacy_policy_text">Privacy policy</string>
|
||||
<string name="settings_card_register_title">E-register</string>
|
||||
<string name="settings_about_title_subtext">© Kuba Szczodrzyński && Kacper Ziubryniewicz\nSeptember 2018 – 2022</string>
|
||||
<string name="settings_about_title_subtext">© Kuba Szczodrzyński, September 2018 – 2022</string>
|
||||
<string name="settings_about_update_subtext">Click to check for updates</string>
|
||||
<string name="settings_about_update_text">Update</string>
|
||||
<string name="settings_about_version_text">Version</string>
|
||||
|
@ -916,7 +916,7 @@
|
||||
<string name="settings_about_licenses_text">Licencje open-source</string>
|
||||
<string name="settings_about_privacy_policy_text">Polityka prywatności</string>
|
||||
<string name="settings_card_register_title">E-dziennik</string>
|
||||
<string name="settings_about_title_subtext">© Kuba Szczodrzyński && Kacper Ziubryniewicz\nwrzesień 2018 - 2022</string>
|
||||
<string name="settings_about_title_subtext">© Kuba Szczodrzyński, wrzesień 2018 - 2022</string>
|
||||
<string name="settings_about_update_subtext">Kliknij, aby sprawdzić aktualizacje</string>
|
||||
<string name="settings_about_update_text">Aktualizacja</string>
|
||||
<string name="settings_about_version_text">Wersja</string>
|
||||
@ -1550,4 +1550,5 @@
|
||||
<string name="settings_register_share_by_default_text">Domyślnie udostępniaj wydarzenia</string>
|
||||
<string name="settings_register_share_by_default_subtext">Ustaw tworzone wydarzenia domyślnie jako udostępnione</string>
|
||||
<string name="settings_registration_section">Rejestracja</string>
|
||||
<string name="home_timetable_all_lessons">Wszystkie lekcje:</string>
|
||||
</resources>
|
||||
|
@ -5,8 +5,8 @@ buildscript {
|
||||
kotlin_version = '1.6.10'
|
||||
|
||||
release = [
|
||||
versionName: "4.13-rc.5",
|
||||
versionCode: 4130050
|
||||
versionName: "4.13",
|
||||
versionCode: 4130099
|
||||
]
|
||||
|
||||
setup = [
|
||||
|
Reference in New Issue
Block a user