Repository navigation
v1.3.4
v1.3.4
v1.3.4 主要修正 release build 在 R8 full mode 下,Gson TypeToken 泛型簽章被剝除,導致 DataCache.loadCourses() 把快取的 List<Course> 反序列化成 LinkedTreeMap,並在 viewModelScope 中拋 ClassCastException——重新開啟 App 後課表會變空白,且只能透過登出/登入恢復;同時修正部分 Gson DTO(公告、taxonomy、訂閱、快取的成績單、課程查詢)因欄位未加 @SerializedName,在 R8 改名後被靜默反序列化為 null 的問題。本次也加入 Firebase Analytics 基礎建設(僅 Play flavor,F-Droid 為 no-op stub,完全不 link Firebase)。
v1.3.4 mainly fixes a release-build issue where R8 full mode stripped the generic signature from Gson TypeToken anonymous subclasses — DataCache.loadCourses() deserialized cached List<Course> entries as LinkedTreeMap and threw ClassCastException inside viewModelScope, leaving the timetable empty after reopen and only recoverable via logout/login. It also fixes several Gson DTOs (bulletins, taxonomy, subscriptions, cached score reports, course lookup) whose fields were renamed under R8 because they lacked @SerializedName, causing silent deserialization to null. This release also lays down Firebase Analytics infrastructure (Play flavor only; the F-Droid flavor is a no-op stub and links zero Firebase).
注意 / Notes:
- 不同安裝渠道 (APK, F-Droid, Play Store) 由於 Sign Key 不同,將無法互相更新。
Different distribution channels (APK / F-Droid / Play Store) use different signing keys and cannot upgrade across each other. - 由於 F-Droid 應用程式商店規定不能使用 FireBase 相關服務,F-Droid 版本將無法獲得即時公告推送通知。
Due to FireBase related services not being usable in apps published on F-Droid, the F-Droid flavor will not receive push notifications for Announcements.
🐞 Bug 修正 / Bug Fixes
📦 Release Build / R8
- Gson
TypeToken泛型簽章在 R8 full mode 下被剝除 —DataCache.loadCourses()內的object : TypeToken<List<Course>>() {}在 R8 full mode 下會失去泛型簽章,Gson 因此把每筆都反序列化成LinkedTreeMap,下游cached.associateBy { it.courseNo }在viewModelScope中拋出ClassCastException,重新開啟 App 後課表變空白,且只能透過登出/登入恢復。Direct debug build 不會走 minification path,所以這個問題只在 CI APK 與 Play Store AAB 出現。修正:在 ProGuard rules 加入Signature、*Annotation*、TypeToken以及TypeAdapter/TypeAdapterFactory/JsonSerializer/JsonDeserializer的 keep 規則,並對TypeToken加allowoptimization以符合 Android 文件記載的 R8 full-mode Gson 標準寫法
GsonTypeTokengeneric signature stripped under R8 full mode —DataCache.loadCourses()'sobject : TypeToken<List<Course>>() {}lost its generic signature under R8 full mode, so Gson deserialized each entry asLinkedTreeMap, and the downstreamcached.associateBy { it.courseNo }threwClassCastExceptioninsideviewModelScope, leaving the timetable empty after reopen — only recoverable via logout/login. Direct debug builds skip minification, which is why this only showed up in CI APKs and the Play Store AAB. Fix: added ProGuard keep rules forSignature,*Annotation*,TypeToken, andTypeAdapter/TypeAdapterFactory/JsonSerializer/JsonDeserializer, plusallowoptimizationonTypeTokento match Android's documented canonical form for R8 full-mode Gson compatibility. - 未標
@SerializedName的 Gson DTO 在 R8 下欄位被改名後靜默反序列化為 null —BulletinSummary/BulletinDetail、announcements/下的 taxonomy 與 subscription types,以及DataCache.ScoreReportSnapshot、DataCache.CourseLookupEntryinner classes,內含沒加@SerializedName的欄位。R8 full mode 把它們的 JVM field name 改名後 Gson 就靜默反序列化成 null——公告快取、taxonomy endpoint、訂閱規則、快取的成績單、課程查詢快取全部受影響。修正:對這些型別加上明確的 keep 規則,並把這類 DTO 移出model.**package
Gson DTOs without@SerializedNamesilently deserialized to null after R8 renaming —BulletinSummary/BulletinDetail, the taxonomy and subscription types underannouncements/, and theDataCache.ScoreReportSnapshot/DataCache.CourseLookupEntryinner classes contain fields without@SerializedName. Under R8 full mode their JVM field names get renamed and Gson silently deserialized them as null — breaking bulletin caching, the taxonomy endpoint, subscription rules, cached score reports, and the course-lookup cache. Fix: added explicit keep rules for these types and kept Gson DTOs outsidemodel.**packages.
🆕 新功能 / New Features
📊 Analytics
- Firebase Analytics 基礎建設(flavor-aware logger) — 新增
AnalyticsLogger抽象,Play flavor 走真實 Firebase Analytics 實作(src/play/),F-Droid flavor 為 no-op stub(src/fdroid/);讓main/的 caller 不需 conditional code 就能 log event,同時 F-Droid build 完全不 link Firebase。Play manifest 預設firebase_analytics_collection_enabled=false,所以session_start/first_open/screen_view在使用者 opt-in 前都不會送出;setEnabled(true)才開啟自動收集(Firebase 會持久化此選擇),setEnabled(false)呼叫resetAnalyticsData()切斷 App Instance ID 以符合 GDPR
Firebase Analytics infrastructure with flavor-aware logger — Added anAnalyticsLoggerabstraction with a real Firebase implementation undersrc/play/and a no-op stub undersrc/fdroid/, so callers inmain/log events without conditional code and the F-Droid build links zero Firebase. The Play manifest defaultsfirebase_analytics_collection_enabled=falsesosession_start/first_open/screen_viewdon't ship before opt-in;setEnabled(true)flips collection on (Firebase persists the choice), andsetEnabled(false)callsresetAnalyticsData()to sever the App Instance ID for GDPR compliance. - Event 與 user property 的驗證強化 —
validateName涵蓋長度、identifier 語法、保留字首 (firebase_/google_/ga_)、空字串等所有會被 Firebase 靜默丟棄的情況;identifier 改用 ASCII regex[a-zA-Z][a-zA-Z0-9_]*,因為 Kotlin 的isLetter()/isLetterOrDigit()是 Unicode-aware,會放行αtest這種被 SDK 默默丟掉的 name。safeTruncate在 cap value 長度時不會切斷 UTF-16 surrogate pair,避免 emoji 等 non-BMP 字元壞掉。log()也對 Firebase 文件的硬限做檢查(event name ≤40、param key ≤40、string value ≤100、≤25 params):debug build 拋例外、release build warn-log 並 truncate,與 Firebase 自身會做的一致
Hardened event and user-property validation —validateNamecovers length, identifier syntax, reservedfirebase_/google_/ga_prefixes, and empty strings — every class of silent Firebase rejection. The identifier regex now uses ASCII[a-zA-Z][a-zA-Z0-9_]*because Kotlin'sisLetter()/isLetterOrDigit()are Unicode-aware and were letting names likeαtestthrough to be silently dropped by the SDK.safeTruncateavoids splitting UTF-16 surrogate pairs when capping value length, so emoji and other non-BMP characters don't get corrupted.log()also enforces Firebase's documented hard limits (event name ≤40, param key ≤40, string value ≤100, ≤25 params) — debug throws, release warn-logs and truncates to match what Firebase itself silently does.
🧹 維護 / Maintenance
- F-Droid featureGraphic 更新 — 替換
featureGraphic.png(en-US 與 zh-TW)為新版本
F-Droid feature graphic update — ReplacedfeatureGraphic.png(en-US and zh-TW) with the new version. - F-Droid 中繼資料 commit pin — 將 F-Droid 中繼資料 commit pin 至
59789eb(v1.3.3)
F-Droid metadata commit pin — Pinned F-Droid metadata commit to59789ebfor v1.3.3.