forked from github/szkolny
Compare commits
5 Commits
v4.13-rc.3
...
v4.13-rc.4
Author | SHA1 | Date | |
---|---|---|---|
eeb3fc4621 | |||
41693a9fc8 | |||
d3599b8c89 | |||
ffd81f8b82 | |||
2c34924052 |
@ -1,9 +1,11 @@
|
||||
<h3>Wersja 4.13-rc.3, 2022-10-23</h3>
|
||||
<h3>Wersja 4.13-rc.4, 2022-10-24</h3>
|
||||
<ul>
|
||||
<li>Poprawione powiadomienia na Androidzie 13. @santoni0</li>
|
||||
<li>Możliwość dostosowania wyświetlania planu lekcji.</li>
|
||||
<li>Opcja kolorowania bloków w planie lekcji.</li>
|
||||
<li><b>USOS</b> - pierwsza wersja obsługi systemu. Osobne rodzaje wydarzeń (oraz wygląd niektórych części aplikacji) lepiej dostosowany do nauki na studiach.</li>
|
||||
<li>Możliwość dostosowania wyświetlania planu lekcji.</li>
|
||||
<li>Opcja ustawienia nowych wydarzeń domyślnie jako udostępnione.</li>
|
||||
<li>Bardziej czytelna legenda rodzaju udostępnionego wydarzenia.</li>
|
||||
<li>Poprawione opcje filtrowania powiadomień i wyboru przycisków menu bocznego.</li>
|
||||
<li>Ulepszony system pobierania aktualizacji aplikacji.</li>
|
||||
</ul>
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
/*secret password - removed for source code publication*/
|
||||
static toys AES_IV[16] = {
|
||||
0x0f, 0x0d, 0x19, 0x4d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
0xfa, 0x74, 0xdd, 0xa5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
|
||||
unsigned char *agony(unsigned int laugh, unsigned char *box, unsigned char *heat);
|
||||
|
||||
|
@ -462,6 +462,8 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
||||
}
|
||||
fun profileSave() = profileSave(profile)
|
||||
fun profileSave(profile: Profile) {
|
||||
if (profile.id == profileId)
|
||||
App.profile = profile
|
||||
launch(Dispatchers.Default) {
|
||||
App.db.profileDao().add(profile)
|
||||
}
|
||||
|
@ -29,6 +29,8 @@ class ProfileConfig(
|
||||
var dataVersion by config<Int>(DATA_VERSION)
|
||||
var hash by config<String>("")
|
||||
|
||||
var shareByDefault by config<Boolean>(false)
|
||||
|
||||
init {
|
||||
if (dataVersion < DATA_VERSION)
|
||||
ProfileConfigMigration(this)
|
||||
|
@ -258,12 +258,10 @@ class SzkolnyApi(val app: App) : CoroutineScope {
|
||||
seen = profile.empty
|
||||
notified = profile.empty
|
||||
|
||||
if (profile.userCode == event.sharedBy) {
|
||||
sharedBy = "self"
|
||||
addedManually = true
|
||||
} else {
|
||||
sharedBy = eventSharedBy
|
||||
}
|
||||
sharedBy = if (profile.userCode == event.sharedBy)
|
||||
"self"
|
||||
else
|
||||
eventSharedBy
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,6 @@ object Signing {
|
||||
|
||||
/*fun provideKey(param1: String, param2: Long): ByteArray {*/
|
||||
fun pleaseStopRightNow(param1: String, param2: Long): ByteArray {
|
||||
return "$param1.MTIzNDU2Nzg5MD7hH6ZvtD===.$param2".sha256()
|
||||
return "$param1.MTIzNDU2Nzg5MDjZ2ooKOe===.$param2".sha256()
|
||||
}
|
||||
}
|
||||
|
@ -73,13 +73,22 @@ open class Event(
|
||||
const val COLOR_INFORMATION = 0xff039be5.toInt()
|
||||
}
|
||||
|
||||
/**
|
||||
* Added manually - added by self, shared by self, or shared by someone else.
|
||||
*/
|
||||
@ColumnInfo(name = "eventAddedManually")
|
||||
var addedManually: Boolean = false
|
||||
get() = field || sharedBy == "self"
|
||||
get() = field || isShared
|
||||
|
||||
/**
|
||||
* Shared by - user code who shared the event. Null if not shared.
|
||||
* "Self" if shared by this app user.
|
||||
*/
|
||||
@ColumnInfo(name = "eventSharedBy")
|
||||
var sharedBy: String? = null
|
||||
@ColumnInfo(name = "eventSharedByName")
|
||||
var sharedByName: String? = null
|
||||
|
||||
@ColumnInfo(name = "eventBlacklisted")
|
||||
var blacklisted: Boolean = false
|
||||
@ColumnInfo(name = "eventIsDone")
|
||||
@ -104,6 +113,27 @@ open class Event(
|
||||
var attachmentIds: MutableList<Long>? = null
|
||||
var attachmentNames: MutableList<String>? = null
|
||||
|
||||
val isHomework
|
||||
get() = type == TYPE_HOMEWORK
|
||||
|
||||
/**
|
||||
* Whether the event is shared by anyone. Note that this implies [addedManually].
|
||||
*/
|
||||
val isShared
|
||||
get() = sharedBy != null
|
||||
|
||||
/**
|
||||
* Whether the event is shared by "self" (this app user).
|
||||
*/
|
||||
val isSharedSent
|
||||
get() = sharedBy == "self"
|
||||
|
||||
/**
|
||||
* Whether the event is shared by someone else from the class group.
|
||||
*/
|
||||
val isSharedReceived
|
||||
get() = sharedBy != null && sharedBy != "self"
|
||||
|
||||
/**
|
||||
* Add an attachment
|
||||
* @param id attachment ID
|
||||
@ -134,9 +164,6 @@ open class Event(
|
||||
it.timeInMillis += 45 * MINUTE * 1000
|
||||
}
|
||||
|
||||
val isHomework
|
||||
get() = type == TYPE_HOMEWORK
|
||||
|
||||
@Ignore
|
||||
fun withMetadata(metadata: Metadata) = EventFull(this, metadata)
|
||||
}
|
||||
|
@ -160,11 +160,11 @@ class SzkolnyAppFirebase(val app: App, val profiles: List<Profile>, val message:
|
||||
if (event.color == -1)
|
||||
event.color = null
|
||||
|
||||
event.addedManually = true
|
||||
event.sharedBy = json.getString("sharedBy")
|
||||
event.sharedByName = json.getString("sharedByName")
|
||||
if (profile.userCode == event.sharedBy) {
|
||||
event.sharedBy = "self"
|
||||
event.addedManually = true
|
||||
}
|
||||
|
||||
val metadata = Metadata(
|
||||
|
@ -80,6 +80,8 @@ class EventManualDialog(
|
||||
SzkolnyApi(app)
|
||||
}
|
||||
|
||||
private val profileConfig by lazy { app.config.forProfile() }
|
||||
|
||||
private var enqueuedWeekDialog: AlertDialog? = null
|
||||
private var enqueuedWeekStart = Date.getToday()
|
||||
|
||||
@ -107,9 +109,6 @@ class EventManualDialog(
|
||||
}
|
||||
|
||||
override suspend fun onShow() {
|
||||
b.shareSwitch.isChecked = editingShared
|
||||
b.shareSwitch.isEnabled = !editingShared || (editingShared && editingOwn)
|
||||
|
||||
b.showMore.onClick { // TODO iconics is broken
|
||||
it.apply {
|
||||
refreshDrawableState()
|
||||
@ -137,6 +136,13 @@ class EventManualDialog(
|
||||
}
|
||||
|
||||
loadLists()
|
||||
|
||||
val shareByDefault = profileConfig.shareByDefault
|
||||
&& profile.enableSharedEvents
|
||||
&& profile.registration == Profile.REGISTRATION_ENABLED
|
||||
|
||||
b.shareSwitch.isChecked = editingShared || editingEvent == null && shareByDefault
|
||||
b.shareSwitch.isEnabled = !editingShared || editingOwn
|
||||
}
|
||||
|
||||
private fun updateShareText(checked: Boolean = b.shareSwitch.isChecked) {
|
||||
@ -411,6 +417,20 @@ class EventManualDialog(
|
||||
return
|
||||
}
|
||||
|
||||
if (share && !profile.enableSharedEvents) {
|
||||
MaterialAlertDialogBuilder(activity)
|
||||
.setTitle(R.string.event_sharing)
|
||||
.setMessage(R.string.settings_register_shared_events_dialog_enabled_text)
|
||||
.setPositiveButton(R.string.ok) { _, _ ->
|
||||
profile.enableSharedEvents = true
|
||||
app.profileSave(profile)
|
||||
saveEvent()
|
||||
}
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.show()
|
||||
return
|
||||
}
|
||||
|
||||
b.dateDropdown.error = null
|
||||
b.teamDropdown.error = null
|
||||
b.typeDropdown.error = null
|
||||
|
@ -13,6 +13,7 @@ import com.mikepenz.iconics.typeface.library.community.material.CommunityMateria
|
||||
import com.mikepenz.iconics.utils.colorInt
|
||||
import com.mikepenz.iconics.utils.sizeDp
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import pl.szczodrzynski.edziennik.R
|
||||
import pl.szczodrzynski.edziennik.data.db.entity.Note
|
||||
@ -59,6 +60,8 @@ class NoteEditorDialog(
|
||||
private val textStylingManager
|
||||
get() = app.textStylingManager
|
||||
|
||||
private val profileConfig by lazy { app.config.forProfile() }
|
||||
|
||||
private var progressDialog: AlertDialog? = null
|
||||
|
||||
override suspend fun onPositiveClick(): Boolean {
|
||||
@ -76,6 +79,23 @@ class NoteEditorDialog(
|
||||
return NO_DISMISS
|
||||
}
|
||||
|
||||
if (note.isShared && !profile.enableSharedEvents) {
|
||||
MaterialAlertDialogBuilder(activity)
|
||||
.setTitle(R.string.event_sharing)
|
||||
.setMessage(R.string.settings_register_shared_events_dialog_enabled_text)
|
||||
.setPositiveButton(R.string.ok) { _, _ ->
|
||||
profile.enableSharedEvents = true
|
||||
app.profileSave(profile)
|
||||
launch {
|
||||
if (onPositiveClick())
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.show()
|
||||
return NO_DISMISS
|
||||
}
|
||||
|
||||
if (note.isShared || editingNote?.isShared == true) {
|
||||
progressDialog = MaterialAlertDialogBuilder(activity)
|
||||
.setTitle(R.string.please_wait)
|
||||
@ -127,8 +147,15 @@ class NoteEditorDialog(
|
||||
topicStylingConfig = StylingConfigBase(editText = b.topic, htmlMode = HtmlMode.SIMPLE)
|
||||
bodyStylingConfig = StylingConfigBase(editText = b.body, htmlMode = HtmlMode.SIMPLE)
|
||||
|
||||
val profile = withContext(Dispatchers.IO) {
|
||||
app.db.profileDao().getByIdNow(profileId)
|
||||
}
|
||||
|
||||
b.ownerType = owner?.getNoteType() ?: Note.OwnerType.NONE
|
||||
b.editingNote = editingNote
|
||||
b.shareByDefault = profileConfig.shareByDefault
|
||||
&& profile?.enableSharedEvents == true
|
||||
&& profile.registration == Profile.REGISTRATION_ENABLED
|
||||
|
||||
b.color.clear().append(Note.Color.values().map { color ->
|
||||
TextInputDropDown.Item(
|
||||
|
@ -39,7 +39,7 @@ class SettingsRegisterCard(util: SettingsUtil) : SettingsCard(util) {
|
||||
subText = R.string.settings_register_shared_events_subtext,
|
||||
icon = CommunityMaterial.Icon3.cmd_share_outline,
|
||||
value = app.profile.enableSharedEvents
|
||||
) { _, value ->
|
||||
) { item, value ->
|
||||
app.profile.enableSharedEvents = value
|
||||
app.profileSave()
|
||||
MaterialAlertDialogBuilder(activity)
|
||||
@ -52,6 +52,23 @@ class SettingsRegisterCard(util: SettingsUtil) : SettingsCard(util) {
|
||||
)
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
if (value) {
|
||||
card.items.after(item, sharedEventsDefaultItem)
|
||||
} else {
|
||||
card.items.remove(sharedEventsDefaultItem)
|
||||
}
|
||||
util.refresh()
|
||||
}
|
||||
}
|
||||
|
||||
private val sharedEventsDefaultItem by lazy {
|
||||
util.createPropertyItem(
|
||||
text = R.string.settings_register_share_by_default_text,
|
||||
subText = R.string.settings_register_share_by_default_subtext,
|
||||
icon = CommunityMaterial.Icon3.cmd_toggle_switch_outline,
|
||||
value = configProfile.shareByDefault
|
||||
) { _, value ->
|
||||
configProfile.shareByDefault = value
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,8 +129,11 @@ class SettingsRegisterCard(util: SettingsUtil) : SettingsCard(util) {
|
||||
item.isChecked = enabled
|
||||
if (value) {
|
||||
card.items.after(item, sharedEventsItem)
|
||||
if (app.profile.enableSharedEvents)
|
||||
card.items.after(item, sharedEventsDefaultItem)
|
||||
} else {
|
||||
card.items.remove(sharedEventsItem)
|
||||
card.items.remove(sharedEventsDefaultItem)
|
||||
}
|
||||
util.refresh()
|
||||
})
|
||||
@ -127,6 +147,11 @@ class SettingsRegisterCard(util: SettingsUtil) : SettingsCard(util) {
|
||||
|
||||
if (app.profile.canShare)
|
||||
sharedEventsItem
|
||||
else
|
||||
null,
|
||||
|
||||
if (app.profile.enableSharedEvents)
|
||||
sharedEventsDefaultItem
|
||||
else
|
||||
null
|
||||
)
|
||||
|
@ -112,7 +112,7 @@ class DateDropdown : TextInputDropDown {
|
||||
date.stepForward(0, 0, -weekDay + 7)
|
||||
weekDay = 0
|
||||
// ALL SCHOOL DAYS OF THE NEXT WEEK
|
||||
while (weekDay < 4) {
|
||||
while (weekDay < 5) {
|
||||
dates += Item(
|
||||
date.value.toLong(),
|
||||
context.getString(R.string.dialog_event_manual_date_next_week, Week.getFullDayName(weekDay), date.formattedString),
|
||||
|
@ -55,7 +55,8 @@ class EventManager(val app: App) : CoroutineScope {
|
||||
val hasReplacingNotes = event.hasReplacingNotes()
|
||||
|
||||
title.text = listOfNotNull(
|
||||
if (event.addedManually) "{cmd-clipboard-edit-outline} " else null,
|
||||
if (event.addedManually && !event.isSharedReceived) "{cmd-calendar-edit} " else null,
|
||||
if (event.isSharedReceived) "{cmd-share-variant} " else null,
|
||||
if (event.hasNotes() && hasReplacingNotes && showNotes) "{cmd-swap-horizontal} " else null,
|
||||
if (event.hasNotes() && !hasReplacingNotes && showNotes) "{cmd-playlist-edit} " else null,
|
||||
if (showType) "${event.typeName ?: "wydarzenie"} - " else null,
|
||||
@ -77,6 +78,8 @@ class EventManager(val app: App) : CoroutineScope {
|
||||
fun setLegendText(legend: IconicsTextView, event: EventFull, showNotes: Boolean = true) {
|
||||
legend.text = listOfNotNull(
|
||||
if (event.addedManually) R.string.legend_event_added_manually else null,
|
||||
if (event.isSharedSent) R.string.legend_event_shared_sent else null,
|
||||
if (event.isSharedReceived) R.string.legend_event_shared_received else null,
|
||||
if (event.isDone) R.string.legend_event_is_done else null,
|
||||
if (showNotes) NoteManager.getLegendText(event) else null,
|
||||
).map { legend.context.getString(it) }.join("\n")
|
||||
|
@ -92,6 +92,8 @@ class UpdateManager(val app: App) : CoroutineScope {
|
||||
}
|
||||
|
||||
fun notify(update: Update) {
|
||||
if (!app.config.sync.notifyAboutUpdates)
|
||||
return
|
||||
val bigText = listOf(
|
||||
app.getString(R.string.notification_updates_text, update.versionName),
|
||||
update.releaseNotes?.let { BetterHtml.fromHtml(context = null, it) },
|
||||
|
@ -18,6 +18,10 @@
|
||||
<variable
|
||||
name="editingNote"
|
||||
type="Note" />
|
||||
|
||||
<variable
|
||||
name="shareByDefault"
|
||||
type="boolean" />
|
||||
</data>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
@ -89,7 +93,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:checked="@{editingNote.sharedBy != null}"
|
||||
android:checked="@{editingNote.sharedBy != null || editingNote == null && shareByDefault}"
|
||||
android:isVisible="@{ownerType.shareable}"
|
||||
android:minHeight="32dp"
|
||||
android:text="@string/dialog_event_manual_share_enabled" />
|
||||
|
@ -83,8 +83,9 @@
|
||||
},
|
||||
"university": {
|
||||
"configOverrides": {
|
||||
"timetableTrimHourRange": true,
|
||||
"timetableColorSubjectName": true
|
||||
"shareByDefault": true,
|
||||
"timetableColorSubjectName": true,
|
||||
"timetableTrimHourRange": true
|
||||
},
|
||||
"uiConfig": {
|
||||
"lessonHeight": 45
|
||||
|
@ -1437,7 +1437,7 @@
|
||||
<string name="agenda_config_elearning_mark">Ustaw wydarzenia jako lekcje on-line</string>
|
||||
<string name="agenda_config_elearning_type">Wybierz rodzaj wydarzeń</string>
|
||||
<string name="agenda_config_elearning_group">Grupuj lekcje on-line na liście</string>
|
||||
<string name="legend_event_added_manually">{cmd-clipboard-edit-outline} wydarzenie dodane ręcznie</string>
|
||||
<string name="legend_event_added_manually">{cmd-calendar-edit} wydarzenie dodane ręcznie</string>
|
||||
<string name="legend_event_is_done">{cmd-check} oznaczono jako wykonane</string>
|
||||
<string name="agenda_config_not_available_yet">Funkcja jeszcze nie jest dostępna.</string>
|
||||
<string name="messages_config_compose">Tworzenie wiadomości</string>
|
||||
@ -1549,4 +1549,8 @@
|
||||
<string name="notification_user_action_required_oauth_usos">USOS - wymagane logowanie z użyciem przeglądarki</string>
|
||||
<string name="oauth_dialog_title">Zaloguj się</string>
|
||||
<string name="app_cannot_load_data">Nie można załadować danych aplikacji</string>
|
||||
<string name="legend_event_shared_received">{cmd-share-variant} udostępnione w klasie</string>
|
||||
<string name="legend_event_shared_sent">{cmd-share-variant} udostępnione przez Ciebie</string>
|
||||
<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>
|
||||
</resources>
|
||||
|
@ -5,8 +5,8 @@ buildscript {
|
||||
kotlin_version = '1.6.10'
|
||||
|
||||
release = [
|
||||
versionName: "4.13-rc.3",
|
||||
versionCode: 4130030
|
||||
versionName: "4.13-rc.4",
|
||||
versionCode: 4130040
|
||||
]
|
||||
|
||||
setup = [
|
||||
|
Reference in New Issue
Block a user