54 Commits
dev ... old

Author SHA1 Message Date
Horváth Gergely
dd3884de16 Remove onAppOpened and related LiveActivity state
Remove the _lastActivityRecreation field and the onAppOpened(...) method from LiveActivityService, which previously handled ending/creating activities, refreshing push tokens, fetching the week's timetable and scheduling background fetch. Update home_screen to call LiveActivityService.checkAndUpdateTimetable(...) instead of onAppOpened, and tweak related log messages to clarify the behavior. This simplifies LiveActivity lifecycle on app resume and stops forced activity recreation/token refresh performed by the removed method.
2026-02-27 22:50:32 +01:00
Horváth Gergely
c646ea2d51 Improve Watch sync, token, and live activity handling
Multiple fixes and improvements for watch <> phone sync, token recovery, and live activity behavior:

- WatchSessionManager: add mergeApplicationContext to avoid clobbering app context, add thread-safe pending auth queue and flush, add sendMessageToWatch API, ensure message handling runs on main thread, add reply-timeout logic for language requests, support fire-and-forget messages, and improve enqueue/flush logic.
- WatchConnectivityManager & SettingsView: publish shared session state on force-logout/logout and improve account-switch/token handling; clear DataStore error and reset recovery state after token updates.
- DataStore & WatchL10n: add recovery-in-progress guard to avoid duplicate recovery runs, reset language version tracking on account switch, make WatchL10n.setLanguage main-thread safe.
- TokenManager & SharedKeychainManager: remove old keychain observer plumbing and instead publish shared session state when active token changes or is deleted.
- UI tweaks: reduce icon/text sizes and spacing in pairing view; only show sync button when paired; Settings logout now also publishes shared state.
- Watch sync wiring in Flutter: replace direct watch_connectivity usage with a MethodChannel-backed WatchSyncHelper.sendMessageToWatch and onWatchMessage callback; main and pairing UI updated accordingly.
- Kreta client: replace simple boolean mutex with a Completer-based mutex and timeout handling to avoid busy-waiting.
- LiveActivityService: throttle/avoid frequent activity recreation (cache last recreation time), skip placeholder creation when called from background, and minor cache-clearing adjustments.
- HomeScreen: add WidgetsBindingObserver to manage lifecycle, prevent prefetch while backgrounded, debounce prefetch, ensure LiveActivity registration runs once and refresh on resume after first prefetch.

These changes increase robustness of token sync and account switching, reduce race conditions and duplicate work, and avoid conflicts between WCSession and Flutter plugin delegates.
2026-02-27 22:44:53 +01:00
Horváth Gergely
a22459794a Refactor timetable day selection and parsing
Add robust date parsing and simplify lesson selection logic. Introduces ISO8601 formatters (with and without fractional seconds) and updates parseNextSchoolDayDate to try both variants, plus existing yyyy-MM-dd fallback. Adds LessonCandidate, startOfDay and nextSchoolDay helpers and builds a sorted candidate list (today, tomorrow, next school day) to pick the appropriate lesson set and correctly set isNextDay/isNextSchoolDay flags. Cleans up previous branching-heavy logic and improves handling of edge cases (lessons finished, next-school-day resolution).
2026-02-24 14:38:06 +01:00
Horváth Gergely
91a526703e Improve watch UI and robust language sync
Several watch UI and sync improvements: clamp CountdownRing values and use clamped values for progress/color/display; add optional backgroundColor to FirkaCard and refactor HomeView to use lessonTitleWithStatus, lessonCardBackgroundColor and improved break time calculation and refresh handling (onChange of lastUpdated). TimetableView now shows status icons/colors via helper methods. DataStore now returns a localized "time_now" for recent updates. WatchSessionManager handles Flutter channel/unready states by serving shared language state when available and avoids empty language replies. Dart fixes: await initLang in settings, return null from WatchSyncHelper when uninitialized, and attempt to publish language to watch after initialization in main.
2026-02-20 11:03:47 +01:00
Horváth Gergely
38ff8af578 Use zip to iterate adjacent lessons
Replace index-based loops with zip(entry.lessons, entry.lessons.dropFirst()) in TimetableMediumView and TimetableLargeView to iterate adjacent lesson pairs. This improves readability and safety (avoids manual index arithmetic and potential out-of-bounds issues) while keeping the same break-detection logic.
2026-02-16 20:16:09 +01:00
Horváth Gergely
58c16e9aa8 Add shared session/language state & refresh leases
Introduce shared session and language state plus cross-device refresh leases to improve Watch/iPhone sync. Adds SharedSessionStateManager, SharedLanguageStateManager and RefreshLeaseManager (keychain-backed) and exposes accessGroup via SharedKeychainManager. Wire shared state into WatchSessionManager (publish/load language and session state, immediate token send via message + userInfo + applicationContext, reachability check, lease-related Flutter handlers) and into WatchConnectivityManager (parse versions, apply immediate token updates). Update DataStore and WatchL10n to reconcile shared session/language state, handle stale account switching, and request tokens from phone when needed. Add TokenManager watch-side lease wrapper for refresh coordination, UI tweaks for pairing/no-token messages and icons, small fixes (date parsing in widget provider, background refresh cadence to ~15 min, time-since localization keys and usage), and various helper utilities for parsing int64 and state versioning.
2026-02-16 19:05:17 +01:00
Horváth Gergely
748bff63ea Send language to Watch and handle locale changes
iOS: Update WatchSessionManager to send the current language via WCSession.default.updateApplicationContext with logging and error handling, in addition to existing transferUserInfo. Dart: await initLang during startup and add dispatcher.onLocaleChanged handler that re-initializes language when the app is in auto-language mode, logs locale changes, and triggers a global UI update.
2026-02-15 23:22:32 +01:00
Horváth Gergely
812c1a008e Migrate token storage to shared Keychain
Add SharedKeychainManager and migrate token storage from the old iCloud Key-Value (KV) approach to a synchronized Keychain-backed solution. Replace iCloudTokenManager usages across WatchSessionManager, TokenManager, and WatchConnectivityManager, update saveToken API to syncToSharedKeychain, and add KV-store migration logic that moves existing KV entries into the shared Keychain and clears the old KV store. Update entitlements (add keychain-access-groups) for both Runner and the Watch app, add/remove files in the Xcode project, delete iCloudTokenManager.swift. Also include access-group resolution, logging, and compatibility observer methods in the new manager.
2026-02-13 23:29:19 +01:00
Horváth Gergely
b71aa12751 Improve token recovery and iCloud probing
Track and surface classified token recovery failures and add a timed iCloud probe to accelerate recovery. TokenManager: introduce lastRecoveryFailure, clearLastRecoveryFailure(), and iCloudProbeTimeoutNs; add probeICloudTokenWithTimeout() and attempt an early iCloud-probe apply before refresh flow; record TokenError results from refresh attempts and abort recovery early on network errors; clear failure on successful actions; default lastRecoveryFailure to .noToken when all attempts fail. KretaAPIClient: clear failure on valid token/recovery success and throw a classified APIError when recovery produced a known TokenError. Overall: better diagnostics, faster iCloud-based short-circuiting, and more robust recovery error handling.
2026-02-12 13:50:14 +01:00
Horváth Gergely
c16cbdb186 Add robust Apple Watch token sync & force-logout
Improve Apple Watch sync resilience and token safety across iOS and Flutter. Key changes:

- Watch (watchOS): rate-limit phone token requests, handle "force_logout" via applicationContext/userInfo and perform local token deletion/cleanup. Added cooldown tracking.
- iPhone host (Swift): expose Flutter methods to check watch app installation, clear iCloud token, and send force-logout to the watch; refuse to forward expired tokens and avoid using iCloud fallback when Flutter reports reauth needed.
- Flutter (WatchSyncHelper/KretaClient): cache and check whether a paired Watch app is installed before touching iCloud/watch; reject expired access tokens (both incoming and outgoing) and prevent sending expired tokens to watch; added fresh-install cleanup to clear iCloud/local state once per install; added methods to notify watch of forced logout and to clear iCloud token.
- Initialization: run fresh-install cleanup before attempting iCloud recovery and skip recovery if cleanup ran.
- Login/settings/home UI: only attempt watch sync when a watch is installed; clear iCloud token on account removal (iOS); minor UX/timing and formatting cleanups.

These changes prevent propagation of expired tokens, reduce redundant phone/watch messaging, and provide a controlled force-logout flow for account removal or fresh installs.
2026-02-11 20:42:15 +01:00
Horváth Gergely
8f28fa328c Add force account-switch and iCloud recovery
Introduce forced account-switch handling and improve token selection/recovery logic.

- WatchConnectivityManager & ReauthRequiredView: parse sentAtMs robustly and compute a shouldForceAccountSwitch flag when an incoming token is for a different account; pass forceAccountSwitch to TokenManager.saveToken and include it in logs.
- TokenManager: add localTokenFromKeychainAndFile helper, prefer the active account when selecting a local token, and refine loadToken to prefer active-account tokens but fall back to the freshest available. saveToken now accepts forceAccountSwitch and will persist a token even if it switches accounts when requested. Adjust iCloud handling to skip iCloud token only if a local active-account token exists; improve diagnostic logging.
- WatchToken: enhance isNewer comparison to consider effectiveUpdatedAt and tokenVersion before falling back to expiryDate.
- HomeScreen (phone): import watch_sync_helper and run a secondary iCloud recovery pass on startup (with a short delay) to apply a fresher iCloud token to the app state if needed.

These changes aim to make cross-device token sync more robust, correctly handle account switches triggered from the watch, and recover stale auth state from iCloud on app startup.
2026-02-11 13:09:32 +01:00
Horváth Gergely
8af53422dc Merge branch 'dev' of https://github.com/hgeryy2004/firka into dev 2026-02-11 11:33:43 +01:00
Horváth Gergely
dda4bfd9d3 Improve iCloud / Watch token sync & recovery
Add robust handling for token synchronization and recovery across iOS/watchOS and Flutter.

- iOS (WatchSessionManager.swift): queue token events until Flutter signals watchSyncReady, flush queued auth events and iCloud recovery notifications when ready, forward tokens with de-duplication logic, provide fallback to iCloud when Flutter isn't ready, and avoid sending duplicate events. Adds helper methods for token payloads and comparison.
- Token management (TokenManager.swift): track active studentIdNorm in UserDefaults to prefer a single account, persist active account on saves, prefer freshest token within preferred account, improve proactive refresh with configurable lead time and cooldown, skip unnecessary recoveries when a valid token exists, and add cooldown for phone recovery requests.
- iCloud logic (iCloudTokenManager.swift): avoid overwriting tokens across accounts using updatedAt comparisons and only ignore truly stale saves.
- Dart client (kreta_client.dart): skip recovery if local token still valid, clearer iCloud recovery retry flow, fallbacks, and clear reauth flag when usable token applied.
- Token model (token_model.dart & generated .g.dart): add tokenVersion and updatedAtMs fields, populate them on creation/from response, and update Isar schema + generated query helpers.
- Watch sync helper (watch_sync_helper.dart): include tokenVersion/updatedAt in outgoing payloads, resolve incoming/current versions more robustly, use updatedAt when deciding freshness, and invoke watchSyncReady on init so native side can flush queued events.
- App init (main.dart): run an iCloud recovery check on iOS during startup and only clear reauth flag when the chosen token is still in the future.

These changes improve cross-device token consistency, reduce spurious reauth prompts, and make proactive refresh/recovery less noisy and more efficient.
2026-02-11 11:33:11 +01:00
B3ni
d92e420b34 Update main.dart 2026-02-11 11:27:04 +01:00
Horváth Gergely
b54fa36671 Token recovery and sync refactor; LiveActivity UI
Centralize and harden token recovery and synchronization across watch/phone components and update LiveActivity UI for iOS 18.

Highlights:
- Introduced a centralized recovery flow in TokenManager.recoverToken() with locking, multi-step recovery (local refresh, keychain/file/watch, iCloud retries) and refreshTokenInternal helper. Added proactive refresh and improved refresh logic to include tokenVersion/updatedAtMs metadata.
- Added tokenVersion and updatedAtMs to WatchToken and propagated these fields through iCloud, WatchConnectivity, WatchSessionManager, and ReauthRequiredView payloads. Many save/load paths now avoid unnecessary iCloud sync and ignore stale tokens based on version/timestamps.
- WatchConnectivityManager now filters stale incoming updates using sentAtMs and persists lastAppliedTokenUpdateMs to avoid regressions; payloads include updatedAtMs/tokenVersion when available.
- DataStore and KretaAPIClient use the centralized recovery API instead of ad-hoc retry logic or direct WatchConnectivity requests.
- iCloudTokenManager stores tokenVersion/updatedAtMs, ignores stale saves, and uses consistent timestamps.
- LiveActivityWidget and LiveActivity updated: iOS 18+ uses new adaptive/family-aware views (including a new SmallActivityView) while legacy behavior is preserved for iOS 16.2–17.x.

These changes aim to make token synchronization more reliable across devices and OS versions, reduce duplicate/conflicting writes, and provide a more adaptive live activity UI on newer iOS releases.
2026-02-11 10:37:14 +01:00
Horváth Gergely
60375e93d1 Add active account handling & token recovery
Introduce active account selection and robust token recovery across watch and phone code. Adds a new Dart helper (active_account_helper.dart) to resolve the active account/token and updates KretaClient, token refresh/grant flows, live activity, watch sync, main init and home UI to use pickActiveToken. On the watch side, implement refreshAllWithRecovery in DataStore and replace direct refreshAll calls with refreshAllWithRecovery everywhere (ContentView, BackgroundRefreshManager, WatchConnectivityManager, HomeView). Rewrite the token recovery logic to retry (with delays), prefer fresher iCloud/file/keychain tokens, attempt iPhone retrieval, and better distinguish transient network errors from permanent token invalidation. Also update TokenManager to choose the freshest local token between keychain and file, and add small sync/NULL-safety fixes and delay tweaks in home_screen to improve iCloud recovery behavior. These changes aim to avoid unnecessary reauth prompts, handle intermittent network issues, and support multi-account setups by always using the active token.
2026-02-10 15:04:32 +01:00
Horváth Gergely
eb1e4b4cfd Handle iCloud token recovery and notify Flutter
Add end-to-end handling for tokens recovered from iCloud: TokenManager now detects fresh iCloud tokens and posts a "TokenRecoveredFromiCloud" Notification on iOS; WatchSessionManager observes that notification and invokes the Flutter method "onTokenRecoveredFromiCloud". On the Dart side, WatchSyncHelper handles the new callback and runs checkAndRecoverFromiCloud (clearing the reauth flag when appropriate). HomeScreen now attempts proactive iCloud recovery on iOS during startup when the token is expired/expiring or reauth is required, retrying with incremental delays and updating the client/token cache on success. Also minor log text tweak in main.dart and necessary imports added to home_screen.dart.
2026-02-09 20:29:06 +01:00
Horváth Gergely
f4eb4e7487 Add auto-refresh and duplicate-call guard
Watch app: add Combine import, scenePhase tracking, a periodic timer and a 10-minute freshness threshold to auto-refresh data when the app becomes active or data becomes stale. Move refresh logic into onChange/onReceive handlers and add shouldAutoRefresh to avoid unnecessary refreshes; removed an immediate proactive token refresh in ContentView. DataStore.refreshAll now early-returns if a refresh is already in progress and logs the skip to prevent duplicate concurrent refreshes.
2026-02-09 18:23:55 +01:00
Horváth Gergely
584f340778 Handle percentage grades and token recovery
Add support for percentage-style grades and normalize them to standard grade scale across the watch app and shared models; show raw percentage in grade badge UI while keeping normalized coloring. Update WidgetGrade/KretaGrade to include valueType, add isPercentageGrade, percentageToGrade, normalizedNumericValue, displayTypeWithWeight and displayGradeValue helpers, and use normalized values in DataStore and views. Improve HomeView refresh button to reflect background loading, disable during datastore loading, and auto-transition success/failure states when background sync finishes. Enhance token recovery logic in Dart: KretaClient attempts watch/iCloud recovery twice (with a short delay) before forcing reauth, and token_grant tries to recover a fresher token from iCloud via WatchSyncHelper on 401 responses before throwing token errors.
2026-02-09 15:34:14 +01:00
Horváth Gergely
b9de46f0ed Add iCloud token sync & improve recovery
Add iCloud-based token recovery and saving across iOS/watch components. Introduces WatchSyncHelper.checkAndRecoverFromiCloud and saveTokenToiCloud to fetch/save fresher tokens via a method channel, calls the check on app init and before proactive refresh, and attempts to save refreshed tokens to iCloud. Adds native handlers in WatchSessionManager (checkiCloudToken, saveTokeToniCloud) and updates DataStore token recovery to distinguish network errors vs permanently invalid tokens (avoid unnecessary reauth). Update logging messages accordingly. Also update ubiquity-kvstore identifiers in entitlements to use explicit group.app.firka.firkaa and bump iOS build/version (CURRENT_PROJECT_VERSION and CFBundleVersion) to 1068.
2026-02-08 16:18:28 +01:00
Horváth Gergely
0f3dcf58a5 Add splash assets and watch token recovery
Add Android and iOS launch/splash assets and flutter_native_splash config, and update launch_background.xml/styles for Android 12 support and dark mode.

Implement robust Apple Watch token recovery and refresh behavior: add recovery state and async recovery flow to DataStore (iCloud check, API refresh, request from iPhone), show a recovering UI in ContentView, attempt proactive recoveries on startup, and add WatchToken/iCloudTokenManager model support. WatchConnectivityManager now attempts to refresh expired tokens before replying to iPhone requests. BackgroundRefreshManager scheduling was improved to choose intervals based on timetable and user settings with debug logs. SettingsView defaults to Auto (0) and adds the Auto picker option and localization strings.

Also update entitlements across watch/widget extensions to include com.apple.developer.ubiquity-kvstore-identifier, rename watch app icon entry, and add project.pbxproj references for new source files.
2026-02-06 22:23:18 +01:00
Horváth Gergely
b58e60a1f8 Enhance reauthentication process with token recovery from Apple Watch 2026-02-05 22:12:43 +01:00
Horváth Gergely
42b8eea0ba Improve watch sync error handling and reauthentication logic 2026-02-05 18:24:02 +01:00
Horváth Gergely
ce9781f1c0 Fix typo in import statement
Corrects a misspelled 'mport SwiftUI' to 'import SwiftUI' in LessonCard.swift, restoring the proper SwiftUI import and preventing compilation errors.
2026-02-05 16:04:54 +01:00
Horváth Gergely
e5224cbfff Add Apple Watch app and watch sync support
Add a new Firka Watch app target with UI components, views and services: DataStore, BackgroundRefreshManager, WatchConnectivity/WatchSession integration, localization (WatchL10n), entitlements and assets. Move widget/shared models into ios/Shared and update Xcode project/schemes; add native Kreta API client and TokenManager for watch use. Implement watch-side caching, proactive token refresh, background scheduling, and pairing/pairing UI. Update Flutter side (watch_sync_helper, main, API/token helper changes) and tweak iOS .gitignore and project metadata to enable the watch integration and data sync between phone and watch.
2026-02-05 16:01:58 +01:00
Horváth Gergely
2d14c41070 Add Shortcuts intents, entities & localizations
Introduce App Shortcuts and AppIntents support: add multiple shortcut intents (next/closest lesson, today/tomorrow/closest timetable, recent grades, subject/overall averages), AppShortcuts provider, and ShortcutError. Add AppEntity types (Average, Grade, Lesson, Subject) and corresponding entity queries. Refactor Controls to use AppIntent-based navigation (OpenHome/OpenGrades/OpenTimetable) with localized labels/descriptions and remove duplicate SubjectEntity from AveragesIntent. Update TimetableProvider to use a lock-screen-friendly timeline refresh policy. Add localization resources (AppShortcuts.strings and expanded Localizable.strings) for en/de/hu and register new strings in project files; update Info.plist/project.pbxproj accordingly.
2026-01-31 11:52:01 +01:00
Horváth Gergely
ecb1745d9e Show active break in timetable widget
Add break detection and UI for active breaks in timetable widgets. Introduces a new localization key "break_between" and a BreakIndicatorRow view that displays a break marker and minutes left. TimetableMediumView and TimetableLargeView now detect when the current time falls between consecutive lessons, reduce the number of visible lessons accordingly, and inject a BreakIndicatorRow between lessons when in a break (minutes are calculated using ceil of time interval). Also clean up commented/debug lines in the iOS widget cache helper (widget.dart) for locale/theme and removed a TODO comment.
2026-01-30 20:44:48 +01:00
Horváth Gergely
0abc568a64 Add next-school-day support to iOS widgets
Add support for showing the next school day in widgets. Changes include: new localization keys (next_school_day_timetable, no_lessons_ahead) and a formatShortDate helper; updated Hungarian hours abbreviation. Widget model updated (TimetableData) to include nextSchoolDay and nextSchoolDayDate. TimetableProvider now sets isNextSchoolDay/nextSchoolDayDate and returns an entry when a future school day is found. Views (inline, lock screen, small/medium/large) updated to display the next school day header/date and show no_lessons_ahead where appropriate. Flutter helpers (widget cache/IOS helper) extended to serialize nextSchoolDayLessons/nextSchoolDayDate and to search up to a week ahead for the next school day when tomorrow is empty.
2026-01-30 20:25:02 +01:00
Horváth Gergely
0845290929 Add logging, await token callback and widget refresh
Fixes async token handling and improves observability: await the callback in KretaClient to ensure proper async flow, add informative logs for token expiry/refresh and warn on empty 200/201 API responses. Enhance token refresh flow in token_grant with detailed info/warning/severe logs and exception logging for easier debugging. Update widget DB helper to force fresh fetches for timetables/grades when updating widget cache, avoid writing empty caches and add debug prints for counts and cache status. Wire widget refresh into LiveActivityService background fetch (with import and try/catch logging) so iOS widgets get refreshed during background processing.
2026-01-30 10:41:26 +01:00
Horváth Gergely
3a0eb5fe54 Add iOS Control widgets & timetable UI updates
Introduce iOS 18 Control widgets and improve timetable/widget UI and behavior.

- Add Home, Grades and Timetable Control widgets (AppIntents) that write a "controlNavigation" value into the app group (group.app.firka.firkaa) so the main app can open the requested page.
- Register control widgets in HomeWidgetsBundle for iOS 18+.
- Extend WidgetLocalization with short/abbrev strings (tomorrow_short, hours_abbrev, in_hours) and related localization keys.
- Enhance Lock Screen and Timetable widgets to handle next-day lessons, show hours when >60 minutes, and use localized hour/minute strings.
- Update TimetableProvider timeline generation to avoid producing per-minute entries far before the next lesson; if the next lesson is >60 minutes away, add only a single entry ~60 minutes before it.
- Adjust various widget views (Averages, Grades, Timetable) for more compact layout: spacing, font weights/sizes, compact modes, and added average color logic.
- Update project.pbxproj to add a file-system-synchronized exception for the HomeWidgetsExtension files in the Runner target.
- AppDelegate: read and remove "controlNavigation" from the shared app group and return it via the Flutter method channel as a pending deep link; fall back to existing pendingWidgetDeepLink.
- Flutter: map a received 'home' deep link to HomePage.home in the home screen navigation switch.

These changes add Control Center / Lock Screen launch shortcuts and refine widget presentation and timeline performance.
2026-01-29 23:48:59 +01:00
Horváth Gergely
503a51ca23 Add lock-screen/inline widgets & timeline updates
Introduce Lock Screen and Inline variants for Timetable, Grades and Averages widgets and register them in HomeWidgetsBundle. Add new views and widget configurations (accessoryInline, accessoryCircular, accessoryRectangular) under LockScreen/, plus grade badge and average display UI. Extend Localization with many new keys in Helpers/Localization.swift and add lock-screen descriptions in en/de/hu Localizable.strings. Update TimetableProvider timeline logic to generate more frequent (per-minute) update entries for lock-screen families, deduplicate timeline dates and ensure proper midnight transition. Adjust TimetableViews display logic to prefer next lesson when current is absent and fix displayed label selection. Apply project.pbxproj updates to file-exception/group entries and some build phase metadata.
2026-01-29 13:36:11 +01:00
Horváth Gergely
0781685015 iOS: rename LiveActivity widget & update configs
Rename TimetableWidget to LiveActivityWidget and clean up HomeWidgetsExtension targets/files. Update entitlements (group id and formatting) and remove duplicate HomeWidgetsExtensionExtension entitlements file. Update Runner.xcodeproj: bump objectVersion, rename targets/products/references, add WidgetExtension.xcconfig, switch entitlements/infoplist paths, set live-activity related flags, adjust deployment targets/locales and MARKETING_VERSION/CURRENT_PROJECT_VERSION to use Flutter variables. Change app display name to "Firka Testing" and move CFBundleVersion in Info.plist. Also change default widget style to .liquidGlass for Averages, Grades and Timetable intents and fix null-safety when serializing subject/grade category fields in ios_widget_helper.dart.
2026-01-29 02:33:39 +01:00
Horváth Gergely
2a4836c42f Improve iOS widgets: UI, timeline and JSON fixes
Multiple widget improvements and bug fixes:

- Models: WidgetGrade now exposes subjectNameWithWeight and teacherName for display.
- AveragesProvider: added isFiltered flag, improved subject filtering logic and propagated flag to entries.
- Averages views: show filtered count badge, use configurable max visible items, and respect isFiltered.
- Grades views: display subject name with weight, show teacher in grade rows (renamed flag to showTeacher) and preserve topic display.
- TimetableProvider: build unique transition times for timeline updates, sort entries, and determine current lesson using the provided date instead of Date().
- Timetable views: compute visibleLessons window around the current lesson based on entry.date and use isLessonActive checks against entry.date.
- iOS widget JSON helper: fix subject.category serialization structure, use grade.creationDate for recordDate, and use grade.teacher for teacherName.

These changes fix incorrect JSON exports, improve timeline accuracy, and enhance widget UX when subjects are filtered or when showing teacher/weight info.
2026-01-28 23:37:27 +01:00
Horváth Gergely
4ff6f2fdb0 Add deep link handling for widgets; implement navigation from widget links 2026-01-27 22:22:10 +01:00
Horváth Gergely
f80ce9bc4f Add iOS Home Widgets Extension with timetable, grades, and averages
Introduces a new HomeWidgetsExtension for iOS, including widgets for timetable, recent grades, and subject averages. Adds widget models, providers, intents, localization, and SwiftUI views. Updates project files and main app to support widget data sharing and communication. Also includes new Dart helper for widget data and updates to relevant Flutter screens.
2026-01-27 18:58:25 +01:00
Horváth Gergely
91bf7a359c Add tokenExpired property and update warning display logic in live activity 2025-12-30 04:03:09 +01:00
Horváth Gergely
6d7d3641ea Add user-specific bell delay settings; implement retrieval and storage in SharedPreferences 2025-12-29 22:07:13 +01:00
Horváth Gergely
873e0f209b Add morning notification settings; implement user-specific preferences for time and enabled state 2025-12-24 20:44:40 +01:00
Horváth Gergely
8d768ca6b8 Implement token expiration handling and reauthentication UI; add reauth toast and update seasonal icon logic 2025-12-19 14:51:12 +01:00
Horváth Gergely
229eabfd4f Refactor logging in live activity manager and backend client; streamline lesson data handling and improve break event detection logic 2025-12-18 00:33:13 +01:00
Horváth Gergely
80599c13d8 Refactor lesson filtering and add logic to handle break events in live activity manager 2025-12-15 23:06:28 +01:00
Horváth Gergely
c92e83aadd Enhance time formatting by adding language detection for compact time and seasonal break methods 2025-12-13 03:54:25 +01:00
Horváth Gergely
47670fb558 Add time formatting helper and update seasonal display logic 2025-12-13 03:31:03 +01:00
Horváth Gergely
b8058cd4cb Add morning notification settings and debounce handling for Live Activities 2025-12-12 23:59:32 +01:00
Horváth Gergely
4fd3e2a09b Refactor date calculations for start of the week in live activity service 2025-12-08 09:41:06 +01:00
Horváth Gergely
0e0fa549cf Reduce bellDelay debounce interval from 5 seconds to 3 seconds;
Enhance lesson fetching logic for improved notification scheduling
2025-12-04 13:54:30 +01:00
39e9c097a0 Update project settings and entitlements for improved configuration
- Bump object version in project.pbxproj
- Refactor TimetableWidget folder exceptions in project.pbxproj
- Add BGTaskSchedulerPermittedIdentifiers to Info.plist
- Update development team and product bundle identifiers in entitlements
- Mark subproject as dirty in l10n
2025-11-26 16:33:37 +01:00
Horváth Gergely
ea8315a993 - Fixed UI/UX bugs in the Live Activities
- Fixed the unhandled language get, when the Live Activity is turned off
- Fixed bellDelay bugs
2025-11-26 05:05:14 +01:00
Horváth Gergely
6d33f6b0d8 - Added bellDelay support for Live Activities; both standard push notifications and Live Activities now use the bellDelay value (default: 0). IMPORTANT: Holidays and school break(spring,summer,autumn,winter) activities do not apply bellDelay.
- Implemented background fetch on iOS: the app now refreshes every 30 minutes in the background and sends timetable changes to the backend if any are detected.
2025-11-25 19:07:30 +01:00
Horváth Gergely
8c4bbd0905 - Fixed user switching so previous user data is now properly cleared.
- Fixed re-login behavior: after every new login, the Live Activities privacy notice is shown as intended.
- Made the Live Activity toggle user-specific to prevent settings from carrying over after switching accounts.
- Fixed user logout so the backend now correctly removes all related data.
- Fixed first-install behavior so the Live Activities privacy notice no longer appears on the public beta screen; it now only appears after reaching the home page.
2025-11-25 14:18:23 +01:00
Horváth Gergely
fe70fc7bd1 - Fixed lesson language data; backend now passes the correct values.
- Updated handling of cancelled lessons: removed timer and now displaying the localized “Cancelled” text.
- Aligned the icon and lesson number in the Dynamic Island so they are now level with the label text.
2025-11-24 21:21:12 +01:00
Horváth Gergely
eb3ed957f1 Add data privacy consent dialog for Live Activity
A new data privacy consent dialog has been added to the Live Activity feature. Users must accept this dialog to use Live Activity. If they decline, all their data will be immediately deleted from the database, and cannot use the Live Activities feature. Additionally, users receive a detailed description explaining what data we store, for how long, and their GDPR rights.
2025-11-24 04:43:14 +01:00
cd525898bb Merge branch 'dev' of https://github.com/hgeryy2004/firka into dev 2025-11-20 09:00:31 +01:00
Horváth Gergely
626d6aefdd Added an example of the .env file. 2025-11-19 13:36:35 +01:00
665 changed files with 47666 additions and 47689 deletions

4
.gitignore vendored
View File

@@ -100,12 +100,8 @@ firka/debug-info/
**/.env*
**/*.dart.js
**/*.info.json
**/*.g.dart
**/.codegen-cache.yaml
# tools.py logs
tool_logs/build/*.log
tool_logs/d8dx_fix/*.log
tool_logs/pub_fix/*.log
secrets/upload_certificate.pem
secrets (2)/upload_certificate.pem

18
.gitmodules vendored
View File

@@ -0,0 +1,18 @@
[submodule "firka/vendor/isar_generator"]
path = firka/vendor/isar_generator
url = https://git.qwit.cloud/firka/isar_generator
[submodule "firka/vendor/isar"]
path = firka/vendor/isar
url = https://git.qwit.cloud/firka/isar
[submodule "firka/vendor/isar_flutter_libs"]
path = firka/vendor/isar_flutter_libs
url = https://git.qwit.cloud/firka/isar_flutter_libs
[submodule "firka/lib/l10n"]
path = firka/lib/l10n
url = https://github.com/QwIT-Development/firka-localization
[submodule "firka_wear/vendor/wear_plus"]
path = firka_wear/vendor/wear_plus
url = https://git.firka.app/firka/wear_plus
[submodule "firka/android/app/src/main/java/org/brotli"]
path = firka/android/app/src/main/java/org/brotli
url = https://git.firka.app/firka/org_brotli

View File

@@ -1,232 +0,0 @@
when:
- event: [push, pull_request]
- event: manual
steps:
- name: submodules
image: git.firka.app/firka/firka-builder:latest
commands:
- git submodule update --init --recursive
- name: secrets
image: git.firka.app/firka/firka-builder:latest
environment:
UPLOAD_KEYSTORE_B64:
from_secret: upload_keystore_b64
KEYSTORE_PROPERTIES_B64:
from_secret: keystore_properties_b64
commands:
- echo "$UPLOAD_KEYSTORE_B64" | base64 -d > secrets/upload-keystore.jks
- echo "$KEYSTORE_PROPERTIES_B64" | base64 -d > secrets/keystore.properties
# Each step runs in a fresh container from the builder image -- only the
# workspace volume is shared between them. Pointing PUB_CACHE at a
# workspace-local dir (instead of the image's default /root/.pub-cache)
# is what lets `flutter pub get`'s downloads survive into later steps.
- name: dependencies
image: git.firka.app/firka/firka-builder:latest
commands:
- export PUB_CACHE="$CI_WORKSPACE/.pub-cache"
- cd firka
- '[ -f .env ] || cp .env.example .env 2>/dev/null || touch .env'
- flutter pub get
- name: codegen
image: git.firka.app/firka/firka-builder:latest
commands:
- export PUB_CACHE="$CI_WORKSPACE/.pub-cache"
- cd firka
- dart run scripts/codegen.dart
- name: clone-mock-kreta-server
image: git.firka.app/firka/firka-builder:latest
environment:
GITEA_USERNAME:
from_secret: gitea_username
GITEA_TOKEN:
from_secret: gitea_token
commands:
- pwd
# The heredoc uses a quoted delimiter so $GITEA_USERNAME/$GITEA_TOKEN
# are written to the script literally, not expanded here -- keeps the
# secret values out of this (traced) command's expanded output.
- |
cat > /tmp/write_netrc.sh <<'NETRC_SCRIPT'
printf 'machine git.firka.app\nlogin %s\npassword %s\n' "$GITEA_USERNAME" "$GITEA_TOKEN" > "$HOME/.netrc"
chmod 600 "$HOME/.netrc"
NETRC_SCRIPT
# Runs as an untraced child shell, so the expansion above never hits the log.
- sh /tmp/write_netrc.sh
- git clone --depth 1 https://git.firka.app/firka/mock_kreta_server.git mock_kreta_server
- rm -f /tmp/write_netrc.sh "$HOME/.netrc"
- name: build-mock-kreta-server
image: golang:1.26
commands:
- cd mock_kreta_server
- go build -o ../mock_kreta_server_bin .
# Runs the mock server in the background and exercises kreta_api's DTOs
# against its real wire format, catching drift between the two repos.
- name: kreta-api-mock-server-tests
image: git.firka.app/firka/firka-builder:latest
commands:
- export PUB_CACHE="$CI_WORKSPACE/.pub-cache"
- ./mock_kreta_server_bin -addr :8090 -data mock_kreta_server/data.json &
- sleep 1
- cd kreta_api
- dart pub get
- MOCK_KRETA_SERVER_URL=http://127.0.0.1:8090 dart test
- name: firka-e2e-tests
image: git.firka.app/firka/firka-builder:latest
commands:
- export PUB_CACHE="$CI_WORKSPACE/.pub-cache"
- ./mock_kreta_server_bin -addr :8090 -data mock_kreta_server/data.json &
- sleep 1
- cd firka
- '[ -f .env ] || cp .env.example .env 2>/dev/null || touch .env'
- cp $(find "$PUB_CACHE" -name libisar.so | grep linux | head -n 1) libisar.so 2>/dev/null || true
- flutter test test/data/widget_test.dart test/e2e/screenshot_widget_test.dart test/e2e/notification_diff_test.dart
- name: firka-integration-tests
image: git.firka.app/firka/firka-builder:latest
privileged: true
volumes:
- /dev/kvm:/dev/kvm
commands:
- export PUB_CACHE="$CI_WORKSPACE/.pub-cache"
- 'grep -q "::1" /etc/hosts || echo "::1 localhost ip6-localhost ip6-loopback" >> /etc/hosts 2>/dev/null || true'
- sysctl -w net.ipv6.conf.all.disable_ipv6=0 2>/dev/null || true
- sed -i 's/TIMEOUT=60/TIMEOUT=300/' /opt/bin/start-emulator.sh
- sed -i 's/-snapshot default_boot/-no-snapshot-load/' /opt/bin/start-emulator.sh
- ./mock_kreta_server_bin -addr :8090 -data mock_kreta_server/data.json &
- sleep 1
- /opt/bin/start-emulator.sh
- adb reverse tcp:8090 tcp:8090
- cd firka
- '[ -f .env ] || cp .env.example .env 2>/dev/null || touch .env'
- flutter test integration_test/widget_e2e_test.dart
- name: build-release
image: git.firka.app/firka/firka-builder:latest
when:
- branch: [main, staging]
commands:
- export PUB_CACHE="$CI_WORKSPACE/.pub-cache"
- cd firka
- '[ -f "$(git rev-parse --git-dir)/shallow" ] && git fetch --unshallow 2>/dev/null || true'
- SHA=$(git rev-parse --short HEAD)
- COMMIT_COUNT=$(git rev-list --count HEAD)
- 'BASE_VERSION=$(grep "^version:" pubspec.yaml | cut -d: -f2 | cut -d+ -f1 | tr -d " ")'
- BUILD_NAME="$BASE_VERSION-$SHA"
- VERSION_CODE=$((2000 + COMMIT_COUNT))
- flutter build appbundle --release --build-name="$BUILD_NAME" --build-number="$VERSION_CODE"
# universal apk for the website's download button, the .aab is for stores
- flutter build apk --release --build-name="$BUILD_NAME" --build-number="$VERSION_CODE"
- name: build-debug
image: git.firka.app/firka/firka-builder:latest
when:
- branch:
exclude: [main, staging]
commands:
- export PUB_CACHE="$CI_WORKSPACE/.pub-cache"
- cd firka
- '[ -f "$(git rev-parse --git-dir)/shallow" ] && git fetch --unshallow 2>/dev/null || true'
- SHA=$(git rev-parse --short HEAD)
- COMMIT_COUNT=$(git rev-list --count HEAD)
- 'BASE_VERSION=$(grep "^version:" pubspec.yaml | cut -d: -f2 | cut -d+ -f1 | tr -d " ")'
- BUILD_NAME="$BASE_VERSION-$SHA"
- VERSION_CODE=$((2000 + COMMIT_COUNT))
- flutter build apk --debug --split-per-abi --build-name="$BUILD_NAME" --build-number="$VERSION_CODE"
- name: publish-release
image: woodpeckercommunity/plugin-gitea-package:latest
pull: true
when:
- branch: [main, staging]
settings:
user:
from_secret: gitea_username
password:
from_secret: gitea_token
owner: firka
package_name: firka
package_version: ${CI_COMMIT_SHA}
file_source: ./firka/build/app/outputs/bundle/release/app-release.aab
file_name: app-release.aab
update: 'true'
- name: publish-release-apk
image: woodpeckercommunity/plugin-gitea-package:latest
pull: true
when:
- branch: [main, staging]
settings:
user:
from_secret: gitea_username
password:
from_secret: gitea_token
owner: firka
package_name: firka
package_version: ${CI_COMMIT_SHA}
file_source: ./firka/build/app/outputs/flutter-apk/app-release.apk
file_name: app-release.apk
update: 'true'
- name: publish-debug-arm64-v8a
image: woodpeckercommunity/plugin-gitea-package:latest
pull: true
when:
- branch:
exclude: [main, staging]
settings:
user:
from_secret: gitea_username
password:
from_secret: gitea_token
owner: firka
package_name: firka
package_version: ${CI_COMMIT_SHA}
file_source: ./firka/build/app/outputs/flutter-apk/app-arm64-v8a-debug.apk
file_name: app-arm64-v8a-debug.apk
update: 'true'
- name: publish-debug-armeabi-v7a
image: woodpeckercommunity/plugin-gitea-package:latest
pull: true
when:
- branch:
exclude: [main, staging]
settings:
user:
from_secret: gitea_username
password:
from_secret: gitea_token
owner: firka
package_name: firka
package_version: ${CI_COMMIT_SHA}
file_source: ./firka/build/app/outputs/flutter-apk/app-armeabi-v7a-debug.apk
file_name: app-armeabi-v7a-debug.apk
update: 'true'
- name: publish-debug-x86_64
image: woodpeckercommunity/plugin-gitea-package:latest
pull: true
when:
- branch:
exclude: [main, staging]
settings:
user:
from_secret: gitea_username
password:
from_secret: gitea_token
owner: firka
package_name: firka
package_version: ${CI_COMMIT_SHA}
file_source: ./firka/build/app/outputs/flutter-apk/app-x86_64-debug.apk
file_name: app-x86_64-debug.apk
update: 'true'

View File

@@ -1,10 +0,0 @@
# Firka
Before you change code, write a comment or make a commit in this repo, get the Firka style guide and follow it. It is in a separate repo so it stays the same across all Firka projects.
```bash
[ -d ../style-guide ] && git -C ../style-guide pull --ff-only \
|| git clone https://git.firka.app/firka/style-guide.git ../style-guide
```
Then read `../style-guide/CLAUDE.md` and do what it says. It lists the skills to install and which style skill belongs to this repo.

View File

@@ -1,19 +1,35 @@
# Flutter telepítése
A firka androidra való lebuildeléséhez kötelező a saját Flutter fork használata, illetve minden más fajta --release buildhez is.
A Flutter telepítéséhez a dokumentáció [itt](https://docs.flutter.dev/get-started/install) található.
A projekt jelenleg a 3.41.2-es Flutter SDK-t használja.
A Flutter zip letöltése helyett a custom engine-t cloneold le ([https://git.firka.app/firka/flutter/](https://git.firka.app/firka/flutter/))
# Brotli
A firka brotlival compresseli a libflutter-t buildelés közben ezért szükséges a projekt
buildeléséhez hogy a brotli a PATH-ben legyen
## Windows
- Töltsd le a `brotli-x64-windows-static.zip`-et a [google/brotli github repoból](https://github.com/google/brotli/releases/latest)
- Csomagold ki valahol (pl. C:\Users\\<username>\dev\brotli)
- Add hozzá a mappát ahova kicsomagoltad (C:\Users\\<username>\dev\brotli) a PATH-hez
- Ne felejtsd el újraindítani az IDE-det illetve parancssorodat utánna hogy frissüljön a PATH
## Linux/MacOS
Telepítsd fel a brotli packaget a distro-d package managerével
# Keystore
[Secrets dokumentáció](secrets/README.md)
# Fileok generálása
# Flutter l10n
Flutter l10n és egyéb fileok generálása
Flutter l10n fileok generálása
```shell
$ cd firka # vagy firka_wear
$ dart run scripts/codegen.dart
Flutter gen-l10n --template-arb-file app_hu.arb
```
# Android debug build
@@ -26,10 +42,20 @@ $ Flutter build apk --debug --target-platform android-arm,android-arm64,android-
# Android release build
A release buildhez közelező egy keystore használata.
A release buildhez közelező egy keystore használata, illetve a saját Flutter engineünk használata.
## Release appbundle buildelése (firka és firka_wear)
## Custom Flutter engine setupolása
```shell
$ ./build.sh
$ git clone https://git.firka.app/firka/flutter
$ cd flutter
$ . dev/tools/envsetup.sh
$ gclient sync -D
$ ./dev/tools/build_release.sh
```
## Release apk buildelése
```shell
$ ./tools/linux/build_apk.sh main
```

View File

@@ -1,35 +0,0 @@
# Flutter installieren
Die Dokumentation zur Installation von Flutter findest du [hier](https://docs.flutter.dev/get-started/install).
Das Projekt verwendet derzeit das Flutter SDK 3.41.2.
# Keystore
[Dokumentation zu Secrets](secrets/README.md)
# Dateien generieren
Flutter-L10N-Dateien und andere Dateien generieren
```shell
$ cd firka # oder firka_wear
$ dart run scripts/codegen.dart
```
# Android-Debug-Build
Für den Dev-Build ist kein Keystore erforderlich
```shell
$ cd firka
$ flutter build apk --debug --target-platform android-arm,android-arm64,android-x64
```
# Android-Release-Build
Der Release-Build erfordert die Verwendung eines Keystores.
## Erstellen des Release-Appbundles (firka und firka_wear)
```shell
$ ./build.sh
```

View File

@@ -1,24 +1,41 @@
# Installing Flutter
# Installing flutter
Flutter installation documentation can be found [here](https://docs.flutter.dev/get-started/install).
The project currently uses Flutter SDK 3.41.2.
To build firka you will have to use our custom Flutter fork,
and to make a release build you will have to use our custom
flutter engine.
The documentation for installing flutter can be found [here](https://docs.flutter.dev/get-started/install).
Instead of downloading the regular flutter zip, clone it from ([https://git.firka.app/firka/flutter/](https://git.firka.app/firka/flutter/)).
# Brotli
Firka uses brotli to compress libflutter during the build process to make the app smaller,
so building Firka requires you to have brotli in your path
## Windows
- Download `brotli-x64-windows-static.zip` from [google/brotli](https://github.com/google/brotli/releases/latest)
- Extract it to somewhere like C:\Users\\<username>\dev\brotli
- Add the directory (ex. C:\Users\\<username>\dev\brotli) to your PATH
- Don't forget to restart your IDE or terminal sessions for the PATH variable to update
## Linux/MacOS
Install it using your distro's package manager
# Keystore
[Secrets documentation](secrets/README.md)
[Secrets docs](secrets/README_en.md)
# Generating files
# Flutter l10n
Generating Flutter l10n and other files
Generating flutter l10n files
```shell
$ cd firka # or firka_wear
$ dart run scripts/codegen.dart
flutter gen-l10n --template-arb-file app_hu.arb
```
# Android debug build
The dev build does not require using a keystore
The dev build doesn't require using a custom keystore
```shell
$ cd firka
$ flutter build apk --debug --target-platform android-arm,android-arm64,android-x64
@@ -26,10 +43,20 @@ $ flutter build apk --debug --target-platform android-arm,android-arm64,android-
# Android release build
The release build requires using a keystore.
The release build requires using a custom keystore and our custom flutter fork
## Building the release appbundle (firka and firka_wear)
## Setting up our flutter engine fork
```shell
$ ./build.sh
$ git clone https://git.firka.app/firka/flutter
$ cd flutter
$ . dev/tools/envsetup.sh
$ gclient sync -D
$ ./dev/tools/build_release.sh
```
## Building the release apk
```shell
$ ./tools/linux/build_apk.sh main
```

167
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,167 @@
pipeline {
agent {
label 'ubuntu'
}
environment {
PATH = "/home/jenkins/development/flutter/bin:${env.PATH}"
}
stages {
stage('Pre-build Cleanup') {
steps {
script {
sh '''#!/bin/sh
set -x
fusermount -u secrets || true
'''
}
}
}
stage('Decrypt main keys') {
when {
branch 'main'
}
steps {
script {
def userInput = input(
id: 'signaturePassword',
message: 'Please enter the signing key password:',
parameters: [
password(
defaultValue: '',
description: 'Enter the signing key password',
name: 'password'
)
]
)
env.PASSWORD = userInput.toString()
}
sh '''#!/bin/sh
echo \$PASSWORD | gocryptfs $HOME/android_secrets secrets/ -nonempty
'''
}
}
stage('Clone submodules') {
steps {
script {
sh 'git submodule update --init --recursive'
}
}
}
stage('Build firka') {
steps {
sh 'bash -c "./tools/linux/build_apk.sh ' + env.BRANCH_NAME + '"'
}
}
stage('Rename Release APKs') {
when {
branch 'main'
}
steps {
script {
sh '''#!/bin/sh
set -e
APK_DIR="firka/build/app/outputs/flutter-apk"
# Find all release APKs and rename them
for apk_file in $APK_DIR/app-*-release.apk; do
if [ -f "$apk_file" ]; then
# Extract ABI from filename (e.g., app-arm64-v8a-release.apk -> arm64-v8a)
basename_file=$(basename "$apk_file")
abi=$(echo "$basename_file" | sed 's/app-//; s/-release.apk//')
# Create new filename
new_name="app.firka.naplo_${abi}.apk"
new_path="$APK_DIR/$new_name"
echo "Renaming $apk_file to $new_path"
mv "$apk_file" "$new_path"
fi
done
ls -la $APK_DIR/app.firka.naplo_*.apk || echo "APK files not found"
'''
}
}
}
stage('Calculate Version Code') {
steps {
script {
sh '''#!/bin/sh
set -e
cd firka
# Calculate version code based on git commits (same logic as build script)
COMMIT_COUNT=$(git rev-list --count HEAD)
BASE_BUILD_NUMBER=$((1300 + COMMIT_COUNT))
if [ "$BRANCH_NAME" = "main" ]; then
# For main branch, highest version code is BASE + 3000 (x64 build)
VERSION_CODE=$((BASE_BUILD_NUMBER + 3000))
else
# For debug builds, version code is BASE + 0
VERSION_CODE=$BASE_BUILD_NUMBER
fi
echo "Calculated version code: $VERSION_CODE"
echo "$VERSION_CODE" > ../version_code.txt
'''
env.VERSION_CODE = readFile('version_code.txt').trim()
echo "Setting VERSION_CODE environment variable to: ${env.VERSION_CODE}"
}
}
}
stage('Publish debug artifacts') {
when {
not {
branch 'main'
}
}
steps {
archiveArtifacts artifacts: 'firka/build/app/outputs/flutter-apk/app-debug.apk', fingerprint: true
}
}
stage('Publish release AABs artifacts') {
when {
branch 'main'
}
steps {
archiveArtifacts artifacts: 'firka/build/app/outputs/bundle/release/*.aab', fingerprint: true
sh 'rm firka/build/app/outputs/bundle/release/*.aab'
}
}
stage('Publish release APKs artifacts') {
when {
branch 'main'
}
steps {
archiveArtifacts artifacts: 'firka/build/app/outputs/flutter-apk/app.firka.naplo_*.apk', fingerprint: true
sh 'rm firka/build/app/outputs/flutter-apk/app.firka.naplo_*.apk'
}
}
stage('Post Cleanup') {
steps {
script {
sh '''
rm firka/build/app/outputs/bundle/release/*.aab || true
rm firka/build/app/outputs/flutter-apk/app.firka.naplo_*.apk || true
rm firka/build/app/outputs/flutter-apk/app-debug.apk || true
rm version_code.txt || true
git checkout -- firka/pubspec.yaml || true
git checkout -- firka/lib/helpers/firka_bundle.dart || true
'''
}
}
}
}
}

View File

@@ -1,49 +1,13 @@
# <img src="https://git.firka.app/firka/readme-files/raw/branch/main/dave.png" height="40" /> Firka
# Firka Napló
| <sub>HU</sub> [Magyar](README.md) | <sub>EN</sub> [English](README_en.md) | <sub>DE</sub> [Deutsch](README_de.md) |
|-----------------------------------|---------------------------------------|---------------------------------------|
| <sub>HU</sub> [Magyar](README.md) | <sub>EN</sub> [English](README_en.md) |
|-----------------------------------|---------------------------------------|
<a href="https://translate.firka.app/engage/firka-naplo/"><img src="https://translate.firka.app/widget/firka-naplo/firka-app/en/svg-badge.svg" alt="Fordítás állapota"></a>
<a href="https://status.firka.app/"><img src="https://status.firka.app/api/badge/1/uptime/24?label=Üzemidő&suffix=%" alt="Üzemidő"></a>
<a href="https://builds.firka.app/job/Firka%20Beta/"><img src="https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fbuilds.firka.app%2Fjob%2FFirka%2520Beta%2F&label=Build" alt="Build állapota"></a>
[![Crowdin](https://badges.crowdin.net/firka/localized.svg)](https://crowdin.com/project/firka)
### Azért kezdtünk neki ennek a projektnek, mert úgy véltük, hogy a hivatalos alkalmazás nem volt elég jó. A Firka egy teljesen nyílt forráskódú, közösség által karbantartott alternatíva, és ez még csak a kezdet. Minden verzióval gyorsabb, testreszabhatóbb és felhasználóbarátabb lesz.
## A projektről
<img src="https://git.firka.app/firka/readme-files/raw/branch/main/firka_features.png" width="100%" />
Firka egy alternatív [megnevezetlen naplóra] egy kliens alkalmazás. Az alkalmazás célja
egy modern, felhasználóbarát felület biztosítása a(z) [megnevezetlen napló] rendszerhez.
<br />
## Mik egyáltalán az alkalmazás funkciói?
### Lásd előre, mi vár rád
A főképernyő megmutatja a közelgő óráidat, hogy soha ne érjen meglepetés. Szűrj tantárgy, dolgozatok, vagy bármi más alapján, ami számodra fontos. Az alsó sáv teljesen testreszabható – tedd oda, amit használsz, és rejtsd el, amit nem.
### Jegyek, a te feltételeid szerint
Nem vagy felkészülve a jegyeidre? Ez a beállítás elrejti őket, amíg egyesével meg nem nyitod őket, így kényelmes tempóban dolgozhatod fel minden kudarcodat.
### Pontosan mennyire vagy rossz matekból?
A jegyek oldalon grafikon mutatja az összesített átlagodat, így végig követheted, ahogyan lassan süllyed a félév során. Minden tantárgyhoz külön grafikon is tartozik, ha pontosan tudni akarod melyik a tettes.
### Szabj testre mindent
A beállítások képernyőn olyan lehetőségek is vannak, amelyekről nem is tudtad, hogy szükséged van rájuk. Állítsd be a csengő eltolását, hogy másodpercre pontosan tudd, mikor ér véget az óra.
Balkezes mód is van, mert úgy tűnik, van, aki nem volt szerencsés az életben.
## Mit támogattok?
Jelenleg **Androidot** támogatunk (Wear OS-es okosóra-kísérőalkalmazással).
<br />
Tervezzük a böngészős támogatást is!
## Contribution
Az első lépéseket a [közreműködési útmutatóban](CONTRIBUTING_en.md) találod.
## Közösség
[Discord](https://discord.gg/xTspd3zzRZ)
A [fejlesztői környezet beállítsa](CONTRIBUTING.md)

View File

@@ -1,51 +0,0 @@
# <img src="https://git.firka.app/firka/readme-files/raw/branch/main/dave.png" height="40" /> Firka
| <sub>HU</sub> [Magyar](README.md) | <sub>EN</sub> [English](README_en.md) | <sub>DE</sub> [Deutsch](README_de.md) |
|-----------------------------------|---------------------------------------|---------------------------------------|
<a href="https://translate.firka.app/engage/firka-naplo/"><img src="https://translate.firka.app/widget/firka-naplo/firka-app/en/svg-badge.svg" alt="Translation status"></a>
<a href="https://status.firka.app/"><img src="https://status.firka.app/api/badge/1/uptime/24?label=Uptime&suffix=%" alt="Uptime"></a>
<a href="https://builds.firka.app/job/Firka%20Beta/"><img src="https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fbuilds.firka.app%2Fjob%2FFirka%2520Beta%2F&label=Build" alt="Build status"></a>
### Wir haben diese App entwickelt, weil die offizielle App viel zu wünschen übrig ließ. Firka ist eine vollständig open-source, von der Community gepflegte Alternative, und wir stehen erst am Anfang. Mit jedem Release wird sie schneller, anpassbarer und benutzerfreundlicher.
<img src="https://git.firka.app/firka/readme-files/raw/branch/main/firka_features.png" width="100%" />
<br />
## Was sind überhaupt die Funktionen der App?
### Sieh, was ansteht
Der Startbildschirm zeigt deine anstehenden Lektionen an, damit du nie unvorbereitet bist. Filtere nach Fach, Prüfungen oder was auch immer dir gerade wichtig ist. Die untere Leiste ist vollständig anpassbar: Zeige an was du nutzt und verstecke was du nicht brauchst.
### Noten, ganz nach deinen Vorstellungen
Emotional nicht bereit für deine eigenen Noten? Diese Einstellung hält sie verborgen, bis du jede einzelne antippst, damit du deine Misserfolge in einem angenehmen Tempo verarbeiten kannst.
### Wie schlecht bist du eigentlich in Mathe?
Die Noten-Seite enthält ein Diagramm deines Gesamtdurchschnitts, sodass du beobachten kannst, wie er im Laufe des Semesters langsam sinkt. Jedes Fach hat zudem ein eigenes Diagramm, falls du genau wissen möchtest, welches dafür verantwortlich ist.
### Alles anpassen
Der Einstellungsbildschirm bietet Optionen, von denen du nicht wusstest, dass du sie brauchst. Passe die Glockenverzögerung an, damit du auf die Sekunde genau weißt, wann der Unterricht endet. Es gibt auch einen Linkshänder-Modus, denn anscheinend benutzen manche Leute ihr Handy falsch.
## Was wird unterstützt?
Derzeit unterstützen wir **Android** (mit einer Wear OS Smartwatch-Begleit-App).
<br />
Wir planen, auch deinen Browser zu unterstützen!
## Mitwirken
Wir würden uns sehr über deine Hilfe freuen.
Du kannst im [Leitfaden zum unterstützen](CONTRIBUTING_de.md) loslegen.
## Community
[Discord](https://discord.gg/xTspd3zzRZ)

View File

@@ -1,51 +1,13 @@
# <img src="https://git.firka.app/firka/readme-files/raw/branch/main/dave.png" height="40" /> Firka
# Firka
| <sub>HU</sub> [Magyar](README.md) | <sub>EN</sub> [English](README_en.md) | <sub>DE</sub> [Deutsch](README_de.md) |
|-----------------------------------|---------------------------------------|---------------------------------------|
| <sub>HU</sub> [Magyar](README.md) | <sub>EN</sub> [English](README_en.md) |
|-----------------------------------|---------------------------------------|
<a href="https://translate.firka.app/engage/firka-naplo/"><img src="https://translate.firka.app/widget/firka-naplo/firka-app/en/svg-badge.svg" alt="Translation status"></a>
<a href="https://status.firka.app/"><img src="https://status.firka.app/api/badge/1/uptime/24?label=Uptime&suffix=%" alt="Uptime"></a>
<a href="https://builds.firka.app/job/Firka%20Beta/"><img src="https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fbuilds.firka.app%2Fjob%2FFirka%2520Beta%2F&label=Build" alt="Build status"></a>
[![Crowdin](https://badges.crowdin.net/firka/localized.svg)](https://crowdin.com/project/firka)
### We built this because the official app left a lot to be desired. Firka is a fully open source, community maintained alternative and we're just getting started. Faster, more customizable, and more user friendly with every release.
## The project
Firka is an alternative client for [an application to be named]. The app's goal is to be a modern
user friendly app for the [to be named] system.
<img src="https://git.firka.app/firka/readme-files/raw/branch/main/firka_features.png" width="100%" />
<br />
## What even are the app's features?
### See what's coming
The home screen shows your upcoming lessons so you're never caught off guard. Filter by subject, exams, or whatever you actually care about. The bottom bar is fully customizable, put what you use, hide what you don't.
### Grades, on your terms
Emotionally unprepared for your own grades? This setting keeps them hidden until you tap each one open, so you can process your failures at a comfortable pace.
### How bad are you at maths, exactly?
The grades page has a graph of your overall average, so you can watch it slowly decline over the semester. Each subject also gets its own graph, in case you wanted to know exactly which one is responsible.
### Customize everything
The settings screen has options you didn't know you needed. Adjust the bell offset so you know exactly when class ends down to the second. Left-handed mode exists too, because apparently some people use their phones wrong.
## What do you support?
Currently, we support **Android** (with a Wear OS smartwatch companion app).
<br />
We're planning on supporting your browser also!
## Contribution
We would really appriciate your help.
You can get started at the [contribution guide](CONTRIBUTING_en.md).
## Community
[Discord](https://discord.gg/xTspd3zzRZ)
[Contribution guide](CONTRIBUTING_en.md)

View File

@@ -1,52 +0,0 @@
$ErrorActionPreference = 'Stop'
$ROOT = $PSScriptRoot
$SHA = (git -C $ROOT rev-parse --short HEAD)
$COMMIT_COUNT = [int](git -C $ROOT rev-list --count HEAD)
function Build-App {
param([string]$App)
$pubspec = Join-Path $ROOT $App "pubspec.yaml"
if (-not (Test-Path $pubspec)) {
Write-Error "Not found: $pubspec"
}
$versionLine = Get-Content $pubspec | Select-String -Pattern '^\s*version:\s*' | Select-Object -First 1
if (-not $versionLine) {
Write-Error "No version line in $pubspec"
}
$line = $versionLine.Line
if ($line -match '^\s*version:\s*([^+\s]+)') {
$baseVersion = $Matches[1].Trim()
} else {
Write-Error "Could not parse version from: $line"
}
$buildName = "${baseVersion}-${SHA}"
$versionCode = 2000 + $COMMIT_COUNT
if ($App -eq "firka_wear") {
$versionCode += 1
}
Write-Host "Building $App : version $buildName (version code: $versionCode)"
Push-Location (Join-Path $ROOT $App)
try {
flutter pub get
dart run scripts/codegen.dart
flutter build appbundle --build-name="$buildName" --build-number="$versionCode" --verbose
} finally {
Pop-Location
}
}
$target = if ($args.Count -gt 0) { $args[0] } else { "all" }
switch ($target) {
"firka" { Build-App firka }
"firka_wear" { Build-App firka_wear }
"all" { Build-App firka; Build-App firka_wear }
default {
Write-Error "Usage: $MyInvocation.MyCommand.Name [firka|firka_wear|all]"
}
}

View File

@@ -1,41 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
SHA=$(git -C "$ROOT" rev-parse --short HEAD)
COMMIT_COUNT=$(git -C "$ROOT" rev-list --count HEAD)
build_app() {
local APP="$1"
local PUBSPEC="$ROOT/$APP/pubspec.yaml"
if [[ ! -f "$PUBSPEC" ]]; then
echo "Not found: $PUBSPEC" >&2
return 1
fi
local VERSION_LINE BASE_VERSION BUILD_NAME VERSION_CODE
VERSION_LINE=$(grep -E '^\s*version:\s*' "$PUBSPEC" | head -1)
BASE_VERSION=$(echo "$VERSION_LINE" | sed -E 's/^[[:space:]]*version:[[:space:]]*([^+]+).*/\1/' | tr -d ' ')
BUILD_NAME="${BASE_VERSION}-${SHA}"
VERSION_CODE=$((2000 + COMMIT_COUNT))
[[ "$APP" == "firka_wear" ]] && VERSION_CODE=$((VERSION_CODE + 1))
echo "Building $APP: version $BUILD_NAME (version code: $VERSION_CODE)"
cd "$ROOT/$APP"
flutter pub get
dart run scripts/codegen.dart
flutter build appbundle --build-name="$BUILD_NAME" --build-number="$VERSION_CODE" --verbose
}
case "${1:-all}" in
firka) build_app firka ;;
firka_wear) build_app firka_wear ;;
all) build_app firka && build_app firka_wear ;;
*)
echo "Usage: $0 [firka|firka_wear|all]" >&2
exit 1
;;
esac

View File

@@ -1,48 +0,0 @@
# Cache
Entry:
név|típus|
-|-|
latestElement|idő|
createdAt|idő|
response|Json|
Legutóbbi = Legutóbbi sikeres adatlekérdezés listájának legfrissebb elemének ideje.
## Timetable
TimetableDay entry.
Frissíteni|Korábbi|Múlt hét|Jelenlegi hét|Jövő hét|Későbbi|
-|-|-|-|-|-|
belépéskor?|✖️|✖️|✔️|✔️|✖️|
kijelzéskor?|✖️|✖️|✖️|✖️|✔️|
Új mulasztáskor a mulasztás napját MINDIG frissíti.
## Értékelések/Tesztek/Faliújság/Feljegyzések/Házi feladatok
Frissíteni|Korábbi|Legutóbbi létrehozástól|
-|-|-|
belépéskor?|✖️|✔️|
kijelzéskor?|✖️|✖️|
## Mulasztások
Összes
## Egyéb
Belépéskor
--------
# IMPL
### GenericCache
Entry:
név|típus|
-|-|
userId|id|
createdAt|idő|
response|Json|

6
firka/.gitignore vendored
View File

@@ -49,8 +49,4 @@ app.*.map.json
/android/app/profile
/android/app/release
coverage
# Generated files
*.g.dart
libisar.so
coverage

View File

@@ -7,10 +7,6 @@
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
analyzer:
exclude:
- build/**
- android/**
include: package:flutter_lints/flutter.yaml
linter:

View File

@@ -1,54 +1,77 @@
import org.apache.commons.io.FileUtils
import java.io.FileInputStream
import java.security.MessageDigest
import java.util.Properties
import java.util.concurrent.Executors
import java.util.concurrent.Future
import java.util.concurrent.locks.ReentrantReadWriteLock
import java.util.zip.ZipEntry
import java.util.zip.ZipFile
import java.util.zip.ZipOutputStream
import java.util.zip.ZipOutputStream.DEFLATED
import java.util.zip.ZipOutputStream.STORED
plugins {
id("com.android.application")
// START: FlutterFire Configuration
id("com.google.gms.google-services")
// END: FlutterFire Configuration
id("org.jetbrains.kotlin.plugin.compose")
id("org.jetbrains.kotlin.android")
id("kotlin-android")
id("org.jetbrains.kotlin.plugin.compose") version "2.2.0"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}
fun loadProperties(file: File): Properties {
val properties = Properties()
FileInputStream(file).use { inputStream ->
properties.load(inputStream)
}
return properties
}
android {
namespace = "app.firka.naplo"
compileSdk = 37
ndkVersion = flutter.ndkVersion
compileSdk = flutter.compileSdkVersion
ndkVersion = "27.0.12077973"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}
buildFeatures {
compose = true
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
defaultConfig {
applicationId = "app.firka.naplo"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
minSdk = 29
targetSdk = 36
versionCode = flutter.versionCode
versionName = flutter.versionName
}
val secretsDir = File(projectDir.absolutePath, "../../../secrets/")
val propsFile = File(secretsDir, "keystore.properties")
if (propsFile.exists()) {
val props = Properties().apply { FileInputStream(propsFile).use { load(it) } }
val props = loadProperties(propsFile)
val store = File(secretsDir, props["storeFile"].toString())
signingConfigs {
create("release") {
storeFile = store
storePassword = props["storePassword"] as String
keyPassword = props["keyPassword"] as String
keyAlias = props["keyAlias"] as String
// Use APK Signature Scheme v3 (and v4 for streaming verification). See:
// https://source.android.com/docs/security/features/apksigning/v3
enableV3Signing = true
enableV4Signing = true
}
}
}
buildTypes {
getByName("debug") {
applicationIdSuffix = ".debug"
@@ -56,64 +79,818 @@ android {
}
release {
val config = signingConfigs.findByName("release")
if (config != null) {
signingConfig = config
}
proguardFiles("proguard-rules.pro")
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
}
}
configurations.all {
resolutionStrategy {
force("androidx.test.espresso:espresso-core:3.6.1")
force("androidx.test.espresso:espresso-idling-resource:3.6.1")
}
}
dependencies {
implementation("androidx.wear:wear-ongoing:1.0.0")
implementation("androidx.glance:glance-appwidget:1.1.1")
implementation("com.google.android.gms:play-services-wearable:18.1.0")
implementation("com.google.android.gms:play-services-base:18.5.0")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
}
// Ensure .env exists before Flutter bundles assets (copy from .env.example if missing)
val envFile = file("${project.projectDir}/../../.env")
val envExampleFile = file("${project.projectDir}/../../.env.example")
tasks.register("ensureEnv") {
doLast {
if (!envFile.exists() && envExampleFile.exists()) {
envExampleFile.copyTo(envFile, overwrite = false)
println("Created .env from .env.example for asset bundling.")
}
}
}
tasks.matching { it.name.startsWith("compileFlutterBuild") }.configureEach {
dependsOn("ensureEnv")
}
// Ensure default ProGuard files exist at the projectDir location expected by AGP/R8 when build directory is relocated
val defaultProguardDir = file("${project.projectDir}/build/intermediates/default_proguard_files/global")
defaultProguardDir.mkdirs()
val defaultProguardOptimize = File(defaultProguardDir, "proguard-android-optimize.txt-9.2.0")
if (!defaultProguardOptimize.exists()) {
defaultProguardOptimize.writeText("-allowaccessmodification\n")
}
tasks.register("ensureProguardFiles") {
doLast {
defaultProguardDir.mkdirs()
if (!defaultProguardOptimize.exists()) {
defaultProguardOptimize.writeText("-allowaccessmodification\n")
}
}
}
tasks.matching { it.name.startsWith("compile") || it.name.contains("minify", ignoreCase = true) || it.name.contains("r8", ignoreCase = true) }.configureEach {
dependsOn("ensureProguardFiles")
}
flutter {
source = "../.."
}
}
tasks.register("transformAndResignDebugApk") {
group = "build"
description = "Transform and resign APK with debug key"
dependsOn("assembleDebug")
doLast {
if (System.getenv("TRANSFORM_APK") != null
&& System.getenv("TRANSFORM_APK") == "true") {
transformApks(true)
}
}
}
tasks.register("transformAndResignReleaseApk") {
group = "build"
description = "Transform and resign APK with release key"
dependsOn("assembleRelease")
doLast {
checkReleaseKey()
if (System.getenv("TRANSFORM_APK") != null
&& System.getenv("TRANSFORM_APK") == "true") {
transformApks(false)
}
}
}
tasks.register("transformAndResignReleaseBundle") {
group = "build"
description = "Transform and resign bundle with release key"
dependsOn("bundleRelease")
doLast {
if (System.getenv("TRANSFORM_AAB") != null
&& System.getenv("TRANSFORM_AAB") == "true") {
transformAppBundle()
}
}
}
afterEvaluate {
tasks.findByName("assembleDebug")?.finalizedBy("transformAndResignDebugApk")
tasks.findByName("assembleRelease")?.finalizedBy("transformAndResignReleaseApk")
tasks.findByName("bundleRelease")?.finalizedBy("transformAndResignReleaseBundle")
}
fun checkReleaseKey() {
val secretsDir = File(projectDir.absolutePath, "../../../secrets/")
val propsFile = File(secretsDir, "keystore.properties")
if (propsFile.exists()) {
val props = loadProperties(propsFile)
val store = File(secretsDir, props["storeFile"].toString())
println(
"Signing with:\n" +
"\t- store: ${store.name}\n" +
"\t- key: ${props["keyAlias"]}"
)
} else {
throw Exception("Release keystore not found!")
}
}
fun transformApks(debug: Boolean, i : Int = 0) {
try {
_transformApks(debug)
} catch (e: Exception) {
if (i < 5) {
e.printStackTrace()
println("Retrying: ${i + 1}")
transformApks(debug, i + 1)
} else {
throw e
}
}
}
fun _transformApks(debug: Boolean) {
println("Starting APK transformation process...")
val buildDir = project.buildDir
val apkDir = File(buildDir, "outputs/flutter-apk")
val apks = getApks(debug)
var c = 0
apks
.forEach { c++; transformAndSignApk(apkDir, it.nameWithoutExtension, debug) }
println("Transformed: $c apks")
}
fun transformAndSignApk(apkDir: File, name: String, debug: Boolean) {
val originalApk = File(apkDir, "$name.apk")
val transformedApk = File(apkDir, "$name-transformed.apk")
val finalApk = File(apkDir, "$name-resigned.apk")
val finalIdsig = File(apkDir, "$name-resigned.apk.idsig")
if (!originalApk.exists()) {
throw GradleException("Original APK not found at: ${originalApk.absolutePath}")
}
if (transformedApk.exists()) transformedApk.delete()
if (finalApk.exists()) finalApk.delete()
println("Original APK: ${originalApk.absolutePath}")
try {
println("Transforming APK...")
transformApk(originalApk, transformedApk, if (debug) { "6" } else {"Z"})
if (debug) {
println("Signing with debug key...")
signWithDebugKey(transformedApk, finalApk)
} else {
println("Signing with release key...")
signWithReleaseKey(transformedApk, finalApk)
}
if (finalApk.exists()) {
originalApk.delete()
finalIdsig.delete()
finalApk.renameTo(originalApk)
println("APK successfully transformed")
println("Final APK: ${originalApk.absolutePath}")
}
transformedApk.delete()
} catch (e: Exception) {
throw GradleException("Failed to transform and resign APK: ${e.message}", e)
}
}
fun transformApk(input: File, output: File, compressionLevel: String = "Z") {
val tempDir = File(project.buildDir, "tmp/apk-transform")
val cacheDir = File(project.buildDir, "cache")
val optipngCacheDir = File(cacheDir, "optipng")
val assetCompressionDir = File(cacheDir, "assets")
tempDir.deleteRecursively()
tempDir.mkdirs()
if (!optipngCacheDir.exists()) optipngCacheDir.mkdirs()
if (!assetCompressionDir.exists()) assetCompressionDir.mkdirs()
val brotli = findToolInPath("brotli")
?: throw Exception("Brotli not found in path")
val optipng = findToolInPath("optipng")
if (optipng == null || optipng.isEmpty()) {
println("Optipng was not found in PATH, optimizing images will be skipped.")
}
copy {
from(zipTree(input))
into(tempDir)
}
val metaInf = File(tempDir, "META-INF")
val metaInfFiles = metaInf.listFiles()
for (file in metaInfFiles!!) {
if (file.name.endsWith("MF") || file.name.endsWith("SF")
|| file.name.endsWith("RSA")) {
file.delete()
}
}
val arches = File(tempDir, "lib").listFiles()
val compressedLibs = mutableMapOf<String, String>()
for (arch in arches!!) {
val libFlutter = File(arch, "libflutter.so")
if (!libFlutter.exists()) continue
val compressedFlutter = File(arch, "libflutter-br.so")
compressedLibs["libflutter.so"] = libFlutter.sha256()
println("Compressing ${arch.name}/libflutter.so with brotli")
exec {
commandLine(
brotli,
"-$compressionLevel",
libFlutter.absolutePath,
"-o", compressedFlutter.absolutePath
)
}
libFlutter.delete()
val json = groovy.json.JsonBuilder(compressedLibs)
File(arch, "index.so").writeText(json.toString())
}
val topDirL = tempDir.absolutePath.length + 1
val zos = ZipOutputStream(output.outputStream())
val coreCount = Runtime.getRuntime().availableProcessors()
val flutterResources = tempDir.walkTopDown().filter{f -> f.absolutePath.contains("flutter_assets")}
val pngFiles = tempDir.walkTopDown().filter{f -> f.name.endsWith(".png")}
val assetIndex = mutableMapOf<String, String>()
val indexReadWriteLock = ReentrantReadWriteLock()
if (compressionLevel == "Z") {
if (optipng != null) {
val executor = Executors.newFixedThreadPool(coreCount)
val futures = mutableListOf<Future<*>>()
pngFiles.forEach { pngFile ->
val cacheFile = File(optipngCacheDir, pngFile.sha256())
if (cacheFile.exists()) {
cacheFile.copyTo(pngFile, true)
} else {
val future = executor.submit {
exec {
commandLine(
optipng,
"-zm", "9",
"-zw", "32k",
"-o9",
pngFile.absolutePath
)
}
pngFile.copyTo(cacheFile, true)
}
futures.add(future)
}
}
futures.forEach { it.get() }
executor.shutdown()
}
val executor = Executors.newFixedThreadPool(coreCount)
val futures = mutableListOf<Future<*>>()
val blacklist = listOf(
// "AssetManifest.bin",
"AssetManifest.json",
"FontManifest.json",
"isolate_snapshot_data",
"kernel_blob.bin",
"NativeAssetsManifest.json",
"NOTICES.Z",
"vm_snapshot_data",
"fonts",
"shaders"
)
flutterResources.forEach { f ->
val relName = f.absolutePath.substring(topDirL).replace("\\", "/")
if (f.isDirectory) return@forEach
val cacheFileRaw = File(assetCompressionDir, f.sha256()+".r")
val cacheFileGz = File(assetCompressionDir, f.sha256()+".gz")
val cacheFileBr = File(assetCompressionDir, f.sha256()+".br")
if (cacheFileRaw.exists() || cacheFileGz.exists() || cacheFileBr.exists()) {
if (cacheFileRaw.exists()) {
cacheFileRaw.copyTo(f, true)
indexReadWriteLock.writeLock().lock()
assetIndex[relName] = "r"
indexReadWriteLock.writeLock().unlock()
} else if (cacheFileGz.exists()) {
cacheFileGz.copyTo(f, true)
indexReadWriteLock.writeLock().lock()
assetIndex[relName] = "g"
indexReadWriteLock.writeLock().unlock()
} else {
cacheFileBr.copyTo(f, true)
indexReadWriteLock.writeLock().lock()
assetIndex[relName] = "b"
indexReadWriteLock.writeLock().unlock()
}
} else {
val future = executor.submit {
val brTmp = File(f.absolutePath + ".br.tmp")
val gzTmp = File(f.absolutePath + ".gz.tmp")
var blacklisted = false
for (f in blacklist) {
if (relName.contains(f)) {
blacklisted = true
break
}
}
if (!blacklisted) {
println("$relName: Testing with brotli")
exec {
commandLine(
brotli,
"-$compressionLevel",
f.absolutePath,
"-o", brTmp.absolutePath
)
}
println("$relName: Testing with gzip")
ant.invokeMethod(
"gzip", mapOf(
"src" to f.absolutePath,
"destfile" to gzTmp.absolutePath,
)
)
println("$brTmp: ${brTmp.length()}")
println("$gzTmp: ${gzTmp.length()}")
if (f.length() < gzTmp.length() && f.length() < brTmp.length()) {
println("$relName: Raw file wins")
f.copyTo(cacheFileRaw, true)
indexReadWriteLock.writeLock().lock()
assetIndex[relName] = "r"
indexReadWriteLock.writeLock().unlock()
} else {
if (brTmp.length() < gzTmp.length()) {
println("$relName: Brotli wins")
f.delete()
brTmp.copyTo(f, true)
brTmp.copyTo(cacheFileBr, true)
indexReadWriteLock.writeLock().lock()
assetIndex[relName] = "b"
indexReadWriteLock.writeLock().unlock()
} else {
println("$relName: Gzip wins")
f.delete()
gzTmp.copyTo(f, true)
gzTmp.copyTo(cacheFileGz, true)
indexReadWriteLock.writeLock().lock()
assetIndex[relName] = "g"
indexReadWriteLock.writeLock().unlock()
}
}
brTmp.delete()
gzTmp.delete()
}
}
futures.add(future)
}
}
futures.forEach { it.get() }
executor.shutdown()
}
tempDir.walkTopDown().forEach { f ->
if (f.absolutePath == tempDir.absolutePath) return@forEach
var relName = f.absolutePath.substring(topDirL).replace("\\", "/")
if (f.isDirectory && !relName.endsWith("/")) relName += "/"
if (compressionLevel == "Z") {
if (relName == "assets/flutter_assets/assets/firka.i") return@forEach
}
println(relName)
val compress = !relName.endsWith(".so") && !relName.endsWith(".arsc")
zos.setMethod(if (compress) { DEFLATED } else { STORED })
val entry = ZipEntry(relName)
if (!compress) {
entry.size = f.length()
entry.crc = FileUtils.checksumCRC32(f)
}
zos.putNextEntry(entry)
if (f.isFile) {
zos.write(f.readBytes())
}
zos.closeEntry()
}
if (compressionLevel == "Z") {
zos.setMethod(DEFLATED)
zos.putNextEntry(ZipEntry("assets/flutter_assets/assets/firka.i"))
val indexUncompressed = File(tempDir, "index.json")
indexReadWriteLock.readLock().lock()
val json = groovy.json.JsonBuilder(assetIndex)
indexReadWriteLock.readLock().unlock()
indexUncompressed.writeText(json.toString())
val indexCompressed = File(tempDir, "index.json.br")
exec {
commandLine(
brotli,
"-$compressionLevel",
indexUncompressed.absolutePath,
"-o", indexCompressed.absolutePath
)
}
zos.write(indexCompressed.readBytes())
indexUncompressed.delete()
indexCompressed.delete()
zos.closeEntry()
}
zos.close()
tempDir.deleteRecursively()
println("APK transformed successfully")
}
fun transformAppBundle() {
val buildDir = project.buildDir
val bundle = File(buildDir, "outputs/bundle/release/app-release.aab")
val bundleTmp = File(buildDir, "outputs/bundle/release/tmp.zip")
val apks = getApks(false)
val apkCount = apks.count { it.name.startsWith("app-") && it.name.endsWith("-release.apk") }
if (!bundle.exists()) {
throw Exception("Bundle not found at: $bundle")
}
if (apkCount < 3) {
throw Exception("Excepected 3 apks per abi but only found $apkCount")
}
val aabTempDir = File(project.buildDir, "tmp/aab-transform")
aabTempDir.deleteRecursively()
aabTempDir.mkdirs()
val apksUnzipped = File(project.buildDir, "tmp/apks-unzipped")
apksUnzipped.deleteRecursively()
val arm32TempDir = File(apksUnzipped, "armeabi-v7a")
arm32TempDir.mkdirs()
val arm64TempDir = File(apksUnzipped, "arm64-v8a")
arm64TempDir.mkdirs()
val x86TempDir = File(apksUnzipped, "x86_64")
x86TempDir.mkdirs()
copy {
from(zipTree(bundle))
into(aabTempDir)
}
copy {
from(zipTree(apks.first { it.name.contains("armeabi-v7a") }))
into(arm32TempDir)
}
copy {
from(zipTree(apks.first { it.name.contains("arm64-v8a") }))
into(arm64TempDir)
}
copy {
from(zipTree(apks.first { it.name.contains("x86_64") }))
into(x86TempDir)
}
val libs = File(aabTempDir, "base/lib").listFiles()!!
for (dstLibs in libs) {
println("Copying lib: ${dstLibs.name}")
val srcDir = File(apksUnzipped, dstLibs.name)
if (!srcDir.exists()) {
continue
}
val srcLibs = File(srcDir, "lib/${dstLibs.name}/")
dstLibs.listFiles()!!.forEach { it.delete() }
srcLibs.listFiles()!!.forEach { it.copyTo(File(dstLibs, it.name)) }
}
val zos = ZipOutputStream(bundleTmp.outputStream())
val bundleZip = ZipFile(bundle)
val bundleEntries = bundleZip.entries()
val brotli = findToolInPath("brotli")
?: throw Exception("Brotli not found in path")
val optipng = findToolInPath("optipng")
?: throw Exception("Optipng not found in path")
val indexReadWriteLock = ReentrantReadWriteLock()
val assetIndex = mutableMapOf<String, String>()
while (bundleEntries.hasMoreElements()) {
val entry = bundleEntries.nextElement()
/*
if (entry.name == "base/assets/flutter_assets/assets/firka.i") {
println("Patching: ${entry.name}")
zos.putNextEntry(ZipEntry("assets/flutter_assets/assets/firka.i"))
val indexUncompressed = File(aabTempDir, "index.json")
indexReadWriteLock.readLock().lock()
val json = groovy.json.JsonBuilder(assetIndex)
indexReadWriteLock.readLock().unlock()
indexUncompressed.writeText(json.toString())
val indexCompressed = File(aabTempDir, "index.json.br")
exec {
commandLine(
brotli,
"-Z",
indexUncompressed.absolutePath,
"-o", indexCompressed.absolutePath
)
}
zos.write(indexCompressed.readBytes())
indexUncompressed.delete()
indexCompressed.delete()
zos.closeEntry()
continue
}
if (entry.name.startsWith("base/lib")) {
println("Patching: ${entry.name}")
zos.putNextEntry(ZipEntry(entry.name))
zos.closeEntry()
continue
}
*/
println("Adding: ${entry.name}")
zos.putNextEntry(ZipEntry(entry.name))
if (!entry.isDirectory) {
val data = bundleZip.getInputStream(entry).readAllBytes()
zos.write(data)
}
zos.closeEntry()
}
bundleZip.close()
zos.close()
bundle.delete()
signBundle(bundleTmp, bundle)
bundleTmp.delete()
aabTempDir.deleteRecursively()
println("AAB transformed successfully")
}
fun File.sha256(): String {
val md = MessageDigest.getInstance("SHA-256")
val digest = md.digest(this.readBytes())
return digest.fold("") { str, it -> str + "%02x".format(it) }
}
fun getApks(debug: Boolean): List<File> {
val buildDir = project.buildDir
val apkDir = File(buildDir, "outputs/flutter-apk")
val apks = apkDir.listFiles()!!
val flavor = if (debug) { "debug" } else { "release" }
return apks
.filter { apk -> apk.name.startsWith("app-") && apk.name.endsWith("-$flavor.apk") }
.toList()
}
fun getDebugKeystorePath(): String {
val userHome = System.getProperty("user.home")
val debugKeystore = File(userHome, ".android/debug.keystore")
if (!debugKeystore.exists()) {
throw GradleException("Debug keystore not found at: ${debugKeystore.absolutePath}")
}
return debugKeystore.absolutePath
}
fun getDefaultAndroidSdkPath(): String? {
val os = System.getProperty("os.name").lowercase()
val userHome = System.getProperty("user.home")
val zipAlign = File("/usr/bin/zipalign")
if (zipAlign.exists()) {
return "/usr/bin"
}
return when {
os.contains("win") ->
"$userHome\\AppData\\Local\\Android\\Sdk"
os.contains("mac") ->
"$userHome/Library/Android/sdk"
os.contains("linux") ->
"$userHome/Android/Sdk"
else -> null
}
}
fun findToolInPath(toolName: String): String? {
val pathEnvironment = System.getenv("PATH")
val pathDirs = pathEnvironment.split(File.pathSeparator)
val executableNames = when {
System.getProperty("os.name").lowercase().contains("win") ->
listOf("$toolName.exe", toolName)
else ->
listOf(toolName)
}
for (pathDir in pathDirs) {
for (execName in executableNames) {
val possibleTool = File(pathDir, execName)
if (possibleTool.exists() && possibleTool.canExecute()) {
return possibleTool.absolutePath
}
}
}
return null
}
fun findToolInSdkPath(toolName: String): String? {
var androidHome : String? = System.getenv("ANDROID_HOME")
?: System.getenv("ANDROID_SDK_ROOT")
if (androidHome == null) androidHome = getDefaultAndroidSdkPath()
if (androidHome != null) {
val buildTools = File(androidHome, "build-tools")
if (buildTools.exists()) {
val latestVersion = buildTools.listFiles()
?.filter { it.isDirectory }
?.filter { it.name != "debian" }
?.maxByOrNull { it.name }
if (latestVersion != null) {
val toolExec = File(latestVersion, toolName)
if (toolExec.exists()) {
return toolExec.absolutePath
}
}
} else {
val toolExec = File(androidHome, toolName)
if (toolExec.exists()) {
return toolExec.absolutePath
}
}
}
if (!toolName.contains(".exe")) {
val exeTool = findToolInSdkPath("$toolName.exe")
if (exeTool != null) return exeTool
}
if (!toolName.contains(".sh")) {
val shTool = findToolInSdkPath("$toolName.sh")
if (shTool != null) return shTool
}
if (!toolName.contains(".bat")) {
val batTool = findToolInSdkPath("$toolName.bat")
if (batTool != null) return batTool
}
return null
}
fun signWithDebugKey(input: File, output: File) {
val debugKeystore = getDebugKeystorePath()
val debugKeystorePassword = "android"
val debugKeyAlias = "androiddebugkey"
val debugKeyPassword = "android"
val zipAlign: String = findToolInSdkPath("zipalign")
?: throw Exception("Could not find zipalign in ANDROID_SDK")
val apksigner: String = findToolInSdkPath("apksigner")
?: throw Exception("Could not find zipalign in ANDROID_SDK")
exec {
commandLine(
zipAlign,
"-v", "4",
input.absolutePath,
output.absolutePath
)
}
exec {
commandLine(
apksigner, "sign",
"--ks", debugKeystore,
"--ks-pass", "pass:$debugKeystorePassword",
"--ks-key-alias", debugKeyAlias,
"--key-pass", "pass:$debugKeyPassword",
output.absolutePath
)
}
println("APK signed and aligned successfully")
}
fun signWithReleaseKey(input: File, output: File) {
val secretsDir = File(projectDir.absolutePath, "../../../secrets/")
val propsFile = File(secretsDir, "keystore.properties")
if (!propsFile.exists()) {
throw Exception("Release keystore not found!")
}
val props = loadProperties(propsFile)
val releaseKeystore = File(secretsDir, props["storeFile"].toString())
val releaseKeystorePassword = props["storePassword"] as String
val releaseKeyAlias = props["keyAlias"] as String
val releaseKeyPassword = props["keyPassword"] as String
val zipAlign: String = findToolInSdkPath("zipalign")
?: throw Exception("Could not find zipalign either in ANDROID_SDK")
val apksigner: String = findToolInSdkPath("apksigner")
?: throw Exception("Could not find zipalign either in ANDROID_SDK")
exec {
commandLine(
zipAlign,
"-v", "4",
input.absolutePath,
output.absolutePath
)
}
exec {
commandLine(
apksigner, "sign",
"--ks", releaseKeystore,
"--ks-pass", "pass:$releaseKeystorePassword",
"--ks-key-alias", releaseKeyAlias,
"--key-pass", "pass:$releaseKeyPassword",
output.absolutePath
)
}
println("APK signed and aligned successfully")
}
fun signBundle(input: File, output: File) {
val secretsDir = File(projectDir.absolutePath, "../../../secrets/")
val propsFile = File(secretsDir, "keystore.properties")
if (!propsFile.exists()) {
throw Exception("Release keystore not found!")
}
val props = loadProperties(propsFile)
val releaseKeystore = File(secretsDir, props["storeFile"].toString())
val releaseKeystorePassword = props["storePassword"] as String
val releaseKeyAlias = props["keyAlias"] as String
val releaseKeyPassword = props["keyPassword"] as String
// val zipAlign: String = findToolInSdkPath("zipalign")
// ?: throw Exception("Could not find zipalign in ANDROID_SDK")
val jarsigner: String = findToolInPath("jarsigner")
?: throw Exception("Could not find jarsigner in PATH")
/*
exec {
commandLine(
zipAlign,
"-v", "4",
input.absolutePath,
output.absolutePath
)
}
*/
input.copyTo(output, true)
exec {
// -keystore $KEYSTORE -storetype $STORETYPE -storepass $STOREPASS -digestalg SHA1 -sigalg SHA256withRSA application.zip $KEYALIAS
commandLine(
jarsigner,
"-verbose",
"-sigalg", "SHA256withRSA",
"-digestalg", "SHA-256",
"-keystore", releaseKeystore,
"-storepass", releaseKeystorePassword,
output.absolutePath,
releaseKeyAlias
)
}
println("AAB signed and aligned successfully")
}

View File

@@ -1,29 +0,0 @@
{
"project_info": {
"project_number": "219357380322",
"project_id": "firka-4633b",
"storage_bucket": "firka-4633b.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:219357380322:android:5b776732799faa5c08a8bb",
"android_client_info": {
"package_name": "app.firka.naplo"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyD-3VE9--eKRDGm1UW_P9JLaM2Hyd2Wfx4"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

View File

@@ -1,75 +1,2 @@
# Firka custom keep rules
-keep class app.firka.naplo.glance.** { *; }
# Android optimize rules (-allowaccessmodification)
-allowaccessmodification
# Android common keep rules
-keepattributes AnnotationDefault,
EnclosingMethod,
InnerClasses,
RuntimeVisibleAnnotations,
RuntimeVisibleParameterAnnotations,
RuntimeVisibleTypeAnnotations,
Signature
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
-keep public class com.google.android.vending.licensing.ILicensingService
-dontnote com.android.vending.licensing.ILicensingService
-dontnote com.google.vending.licensing.ILicensingService
-dontnote com.google.android.vending.licensing.ILicensingService
# Native methods
-keepclasseswithmembernames,includedescriptorclasses class * {
native <methods>;
}
# Keep setters in Views so that animations can still work.
-keepclassmembers public class * extends android.view.View {
void set*(***);
*** get*();
}
# We want to keep methods in Activity that could be used in the XML attribute onClick.
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
# For enumeration classes
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keepclassmembers class * implements android.os.Parcelable {
public static final ** CREATOR;
}
# Preserve annotated Javascript interface methods.
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}
# The support libraries contains references to newer platform versions.
-dontnote android.support.**
-dontnote androidx.**
-dontwarn android.support.**
-dontwarn androidx.**
# Understand the @Keep support annotation.
-keep class android.support.annotation.Keep
-keep @android.support.annotation.Keep class * {*;}
-keepclasseswithmembers class * {
@android.support.annotation.Keep <methods>;
}
-keepclasseswithmembers class * {
@android.support.annotation.Keep <fields>;
}
-keepclasseswithmembers class * {
@android.support.annotation.Keep <init>(...);
}
-dontnote org.apache.http.**
-dontnote android.net.http.**
-dontnote java.lang.invoke.**
-keep class org.brotli.** { *; }
-keep class app.firka.naplo.glance.** { *; }

View File

@@ -4,7 +4,6 @@
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<application android:name="app.firka.naplo.AppMain"
android:label="Firka Debug"
<application android:label="Firka Debug"
android:usesCleartextTraffic="true" />
</manifest>
</manifest>

View File

@@ -1,29 +0,0 @@
{
"project_info": {
"project_number": "219357380322",
"project_id": "firka-4633b",
"storage_bucket": "firka-4633b.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:219357380322:android:5b776732799faa5c08a8bb",
"android_client_info": {
"package_name": "app.firka.naplo.debug"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyD-3VE9--eKRDGm1UW_P9JLaM2Hyd2Wfx4"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

View File

@@ -3,43 +3,13 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.POST_PROMOTED_NOTIFICATIONS" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
<uses-permission android:name="android.permission.CAMERA" />
<application
android:name=".AppMain"
android:icon="@mipmap/launcher_icon">
<service
android:name=".WearSyncForegroundService"
android:exported="false"
android:foregroundServiceType="dataSync" />
<service
android:name=".ProgressNotificationForegroundService"
android:exported="false"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Displays ongoing school day lesson and break progress updates." />
</service>
<receiver
android:name=".ProgressAlarmReceiver"
android:exported="false">
<intent-filter>
<action android:name="app.firka.naplo.ACTION_PROGRESS_6AM_ALARM" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<activity
android:name=".MainActivity"
@@ -65,7 +35,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_ace"
android:roundIcon="@mipmap/ic_ace_round" >
<intent-filter>
@@ -79,7 +49,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_ace_f"
android:roundIcon="@mipmap/ic_ace_f_round" >
<intent-filter>
@@ -93,7 +63,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_bi"
android:roundIcon="@mipmap/ic_bi_round" >
<intent-filter>
@@ -107,7 +77,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_bi_f"
android:roundIcon="@mipmap/ic_bi_f_round" >
<intent-filter>
@@ -121,7 +91,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_cactus"
android:roundIcon="@mipmap/ic_cactus_round" >
<intent-filter>
@@ -135,7 +105,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_cc"
android:roundIcon="@mipmap/ic_cc_round" >
<intent-filter>
@@ -149,7 +119,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_enby"
android:roundIcon="@mipmap/ic_enby_round" >
<intent-filter>
@@ -163,7 +133,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_enby_f"
android:roundIcon="@mipmap/ic_enby_f_round" >
<intent-filter>
@@ -177,7 +147,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_fidesz"
android:roundIcon="@mipmap/ic_fidesz_round" >
<intent-filter>
@@ -191,7 +161,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_filc"
android:roundIcon="@mipmap/ic_filc_round" >
<intent-filter>
@@ -205,7 +175,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_filco"
android:roundIcon="@mipmap/ic_filco_round" >
<intent-filter>
@@ -219,7 +189,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_galaxy"
android:roundIcon="@mipmap/ic_galaxy_round" >
<intent-filter>
@@ -233,7 +203,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_gay"
android:roundIcon="@mipmap/ic_gay_round" >
<intent-filter>
@@ -247,7 +217,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_gay_f"
android:roundIcon="@mipmap/ic_gay_f_round" >
<intent-filter>
@@ -261,7 +231,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_half_firka_2"
android:roundIcon="@mipmap/ic_half_firka_2_round" >
<intent-filter>
@@ -275,7 +245,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_kreta"
android:roundIcon="@mipmap/ic_kreta_round" >
<intent-filter>
@@ -289,7 +259,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_lesb"
android:roundIcon="@mipmap/ic_lesb_round" >
<intent-filter>
@@ -303,7 +273,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_lesb_f"
android:roundIcon="@mipmap/ic_lesb_f_round" >
<intent-filter>
@@ -317,7 +287,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_lgbtq"
android:roundIcon="@mipmap/ic_lgbtq_round" >
<intent-filter>
@@ -331,7 +301,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_lgbtq_f"
android:roundIcon="@mipmap/ic_lgbtq_f_round" >
<intent-filter>
@@ -345,7 +315,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_lgbtqp"
android:roundIcon="@mipmap/ic_lgbtqp_round" >
<intent-filter>
@@ -359,7 +329,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_lgbtqp_f"
android:roundIcon="@mipmap/ic_lgbtqp_f_round" >
<intent-filter>
@@ -373,7 +343,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_lidl"
android:roundIcon="@mipmap/ic_lidl_round" >
<intent-filter>
@@ -387,7 +357,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_mkkp"
android:roundIcon="@mipmap/ic_mkkp_round" >
<intent-filter>
@@ -401,7 +371,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_nuke"
android:roundIcon="@mipmap/ic_nuke_round" >
<intent-filter>
@@ -415,7 +385,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_modern"
android:roundIcon="@mipmap/ic_modern_round" >
<intent-filter>
@@ -429,7 +399,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_o1g"
android:roundIcon="@mipmap/ic_o1g_round" >
<intent-filter>
@@ -443,7 +413,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_old"
android:roundIcon="@mipmap/ic_old_round" >
<intent-filter>
@@ -457,7 +427,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_paper"
android:roundIcon="@mipmap/ic_paper_round" >
<intent-filter>
@@ -471,7 +441,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_pear"
android:roundIcon="@mipmap/ic_pear_round" >
<intent-filter>
@@ -485,7 +455,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_pixel"
android:roundIcon="@mipmap/ic_pixel_round" >
<intent-filter>
@@ -499,7 +469,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_pixelized"
android:roundIcon="@mipmap/ic_pixelized_round" >
<intent-filter>
@@ -513,7 +483,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_pride"
android:roundIcon="@mipmap/ic_pride_round" >
<intent-filter>
@@ -527,7 +497,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_proto"
android:roundIcon="@mipmap/ic_proto_round" >
<intent-filter>
@@ -541,7 +511,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_refilc"
android:roundIcon="@mipmap/ic_refilc_round" >
<intent-filter>
@@ -555,7 +525,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_refulc"
android:roundIcon="@mipmap/ic_refulc_round" >
<intent-filter>
@@ -569,7 +539,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_repont"
android:roundIcon="@mipmap/ic_repont_round" >
<intent-filter>
@@ -583,7 +553,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_szivacs"
android:roundIcon="@mipmap/ic_szivacs_round" >
<intent-filter>
@@ -597,7 +567,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_tisza"
android:roundIcon="@mipmap/ic_tisza_round" >
<intent-filter>
@@ -611,7 +581,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_trans"
android:roundIcon="@mipmap/ic_trans_round" >
<intent-filter>
@@ -625,7 +595,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_trans_f"
android:roundIcon="@mipmap/ic_trans_f_round" >
<intent-filter>
@@ -639,7 +609,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_void_icon"
android:roundIcon="@mipmap/ic_void_icon_round" >
<intent-filter>
@@ -653,7 +623,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_xmas1"
android:roundIcon="@mipmap/ic_xmas1_round" >
<intent-filter>
@@ -667,7 +637,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_xmas2"
android:roundIcon="@mipmap/ic_xmas2_round" >
<intent-filter>
@@ -681,7 +651,7 @@
android:targetActivity=".MainActivity"
android:exported="true"
android:enabled="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_xmas3"
android:roundIcon="@mipmap/ic_xmas3_round" >
<intent-filter>
@@ -694,7 +664,6 @@
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="app.firka.naplo.ACTION_REFRESH_WIDGET" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
@@ -710,13 +679,6 @@
<meta-data
android:name="com.google.android.wearable.standalone"
android:value="true" />
<!-- Small status-bar icon for FCM notification-payload messages that
Android displays automatically (data-only wakeups instead go
through LocalNotificationService, which sets its own icon). -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notification" />
</application>
<!-- Required to query activities that can process text, see:

View File

@@ -1,5 +1,99 @@
package app.firka.naplo
import android.annotation.SuppressLint
import android.app.Application
import android.os.Build
import android.util.Log
import org.brotli.dec.BrotliInputStream
import org.json.JSONObject
import java.io.File
import java.io.FileOutputStream
import java.security.MessageDigest
import java.util.zip.ZipFile
class AppMain : Application() {}
class AppMain : Application() {
private fun File.sha256(): String {
if (!exists()) return "0000000000000000000000000000000000000000000000000000000000000000"
val md = MessageDigest.getInstance("SHA-256")
val digest = md.digest(this.readBytes())
return digest.fold("") { str, it -> str + "%02x".format(it) }
}
@SuppressLint("UnsafeDynamicallyLoadedCode")
override fun onCreate() {
super.onCreate()
var useUncompressedLibs = false
val abi = Build.SUPPORTED_ABIS[0]
val apks = File(applicationInfo.nativeLibraryDir, "../..").absoluteFile
.listFiles()!!
.filter { file -> file.name.endsWith(".apk") }
.toList()
var nativesApkN: ZipFile? = null
for (apk in apks) {
if (nativesApkN != null) break
val zip = ZipFile(apk)
val entries = zip.entries()
while (entries.hasMoreElements()) {
val entry = entries.nextElement()
if (entry.name.endsWith("$abi/index.so")) {
zip.close()
nativesApkN = ZipFile(apk)
break
}
if (entry.name.endsWith("$abi/libflutter.so")) {
useUncompressedLibs = true
break
}
}
zip.close()
}
if (useUncompressedLibs) {
return;
}
if (nativesApkN == null) {
throw Exception("Can't find native libraries")
}
val nativesApk: ZipFile = nativesApkN
val compressedLibsIndex = nativesApk.getInputStream(
nativesApk.getEntry("lib/$abi/index.so")
)
val compressedLibs = JSONObject(compressedLibsIndex.readBytes().toString(Charsets.UTF_8))
for (so in compressedLibs.keys()) {
val soFile = File(cacheDir, so)
if (soFile.sha256() == compressedLibs.getString(so)) {
System.load(soFile.absolutePath)
return
}
Log.d("AppMain", "Decompressing: $so")
val brInput = nativesApk.getInputStream(
nativesApk.getEntry("lib/$abi/${so.replace(".so", "-br.so")}")
)
val soOutput = FileOutputStream(soFile)
val brIn = BrotliInputStream(brInput)
brIn.copyTo(soOutput)
brInput.close()
soOutput.close()
System.load(soFile.absolutePath)
}
}
}

View File

@@ -7,9 +7,8 @@ import org.json.JSONObject
fun JSONObject.getStringOrNull(key: String): String? {
return try {
if (has(key) && !isNull(key)) {
val v = getString(key)
if (v == "null" || v.isBlank()) null else v
if (has(key)) {
getString(key)
} else {
null
}

View File

@@ -1,32 +1,19 @@
package app.firka.naplo
import android.app.NotificationManager
import android.appwidget.AppWidgetManager
import android.content.ComponentName
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.util.Log
import androidx.glance.appwidget.updateAll
import app.firka.naplo.glance.TimetableWidget
import app.firka.naplo.glance.TimetableWidgetReceiver
import com.google.android.gms.common.ConnectionResult
import com.google.android.gms.common.GoogleApiAvailability
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
import kotlin.system.exitProcess
class MainActivity : FlutterActivity() {
private val channel = "firka.app/main"
private val wearSyncChannel = "app.firka/wear_sync"
private val progressNotificationChannel = "app.firka/progress_notification"
private fun forceIconUpdate() {
try {
@@ -43,118 +30,6 @@ class MainActivity : FlutterActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, wearSyncChannel).setMethodCallHandler { call, result ->
when (call.method) {
"startWearSyncService" -> {
val args = call.arguments as? Map<*, *>
val cachePath = args?.get("cachePath") as? String
val appDirPath = args?.get("appDirPath") as? String
if (cachePath != null && appDirPath != null) {
val messenger = flutterEngine.dartExecutor.binaryMessenger
val ch = MethodChannel(messenger, wearSyncChannel)
ch.invokeMethod("getLocalizedString", "wearSyncNotificationTitle", object : MethodChannel.Result {
override fun success(titleResult: Any?) {
val title = titleResult as? String ?: "Syncing with watch"
ch.invokeMethod("getLocalizedString", "wearSyncNotificationText", object : MethodChannel.Result {
override fun success(textResult: Any?) {
val text = textResult as? String ?: ""
val intent = Intent(this@MainActivity, WearSyncForegroundService::class.java).apply {
action = WearSyncForegroundService.ACTION_START
putExtra(WearSyncForegroundService.EXTRA_CACHE_PATH, cachePath)
putExtra(WearSyncForegroundService.EXTRA_APP_DIR_PATH, appDirPath)
putExtra(WearSyncForegroundService.EXTRA_NOTIFICATION_TITLE, title)
putExtra(WearSyncForegroundService.EXTRA_NOTIFICATION_TEXT, text)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(intent)
} else {
startService(intent)
}
result.success(null)
}
override fun error(code: String, msg: String?, details: Any?) { result.success(null) }
override fun notImplemented() { result.success(null) }
})
}
override fun error(code: String, msg: String?, details: Any?) { result.error(code, msg, details) }
override fun notImplemented() { result.notImplemented() }
})
} else {
result.error("INVALID_ARGS", "cachePath and appDirPath required", null)
}
}
"stopWearSyncService" -> {
val intent = Intent(this, WearSyncForegroundService::class.java).apply {
action = WearSyncForegroundService.ACTION_STOP
}
startService(intent)
result.success(null)
}
else -> result.notImplemented()
}
}
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, progressNotificationChannel).setMethodCallHandler { call, result ->
when (call.method) {
"startProgressService" -> {
val intent = Intent(this, ProgressNotificationForegroundService::class.java).apply {
action = ProgressNotificationForegroundService.ACTION_START
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(intent)
} else {
startService(intent)
}
result.success(true)
}
"stopProgressService" -> {
val intent = Intent(this, ProgressNotificationForegroundService::class.java).apply {
action = ProgressNotificationForegroundService.ACTION_STOP
}
startService(intent)
result.success(true)
}
"isProgressServiceRunning" -> {
val nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
val isNotifActive = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
try {
nm.activeNotifications?.any { it.id == 4002 } ?: false
} catch (e: Exception) {
ProgressNotificationForegroundService.isRunning
}
} else {
ProgressNotificationForegroundService.isRunning
}
result.success(ProgressNotificationForegroundService.isRunning && isNotifActive)
}
"updateProgressStrings" -> {
@Suppress("UNCHECKED_CAST")
val strings = call.arguments as? Map<String, String>
if (strings != null) {
ProgressNotificationForegroundService.saveStrings(this, strings)
if (ProgressNotificationForegroundService.isRunning) {
val intent = Intent(this, ProgressNotificationForegroundService::class.java).apply {
action = ProgressNotificationForegroundService.ACTION_UPDATE
}
startService(intent)
}
result.success(true)
} else {
result.error("INVALID_ARGS", "strings map required", null)
}
}
"schedule6AmAlarm" -> {
ProgressAlarmReceiver.scheduleNext6AmAlarm(this)
result.success(true)
}
"cancel6AmAlarm" -> {
ProgressAlarmReceiver.cancel6AmAlarm(this)
result.success(true)
}
else -> result.notImplemented()
}
}
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, channel).setMethodCallHandler {
call, result ->
when (call.method) {
@@ -222,31 +97,7 @@ class MainActivity : FlutterActivity() {
} catch (e: Exception) {
e.printStackTrace()
}
result.success(true)
}
"refreshTimetableWidget" -> {
CoroutineScope(SupervisorJob() + Dispatchers.Default).launch {
try {
val appContext = context.applicationContext
val intent = Intent(appContext, TimetableWidgetReceiver::class.java).apply {
action = TimetableWidgetReceiver.ACTION_REFRESH_WIDGET
}
appContext.sendBroadcast(intent)
TimetableWidget().updateAll(appContext)
result.success(true)
} catch (e: Exception) {
result.error("refresh_failed", e.message, null)
}
}
}
"isGmsAvailable" -> {
try {
val availability = GoogleApiAvailability.getInstance()
val resultCode = availability.isGooglePlayServicesAvailable(context)
result.success(resultCode == ConnectionResult.SUCCESS)
} catch (e: Exception) {
result.success(false)
}
result.success(true)
}
else -> {
result.notImplemented()
@@ -257,29 +108,6 @@ class MainActivity : FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.clearFlags(android.view.WindowManager.LayoutParams.FLAG_SECURE)
handleIntent(intent)
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
setIntent(intent)
handleIntent(intent)
}
private fun handleIntent(intent: Intent?) {
val action = intent?.getStringExtra("action")
if (action == "pin_widget") {
val appWidgetManager = AppWidgetManager.getInstance(this)
val myProvider = ComponentName(this, TimetableWidgetReceiver::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && appWidgetManager.isRequestPinAppWidgetSupported) {
appWidgetManager.requestPinAppWidget(myProvider, null, null)
}
} else if (action == "refresh_widget") {
val appContext = applicationContext
val refreshIntent = Intent(appContext, TimetableWidgetReceiver::class.java).apply {
this.action = TimetableWidgetReceiver.ACTION_REFRESH_WIDGET
}
appContext.sendBroadcast(refreshIntent)
}
}
}

View File

@@ -1,97 +0,0 @@
package app.firka.naplo
import android.app.AlarmManager
import android.app.PendingIntent
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Build
import android.util.Log
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.ZoneId
class ProgressAlarmReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent?) {
Log.d(TAG, "onReceive action: ${intent?.action}")
scheduleNext6AmAlarm(context)
val data = ProgressNotificationForegroundService.loadTodayTimetable(context)
if (data == null || data.lessons.isEmpty()) {
Log.d(TAG, "No timetable for today at 6 AM wakeup; skipping service start")
return
}
val sorted = data.lessons.sortedBy { it.start }
val lastLesson = sorted.last()
val now = LocalDateTime.now()
if (now.isBefore(lastLesson.end)) {
Log.d(TAG, "Starting ProgressNotificationForegroundService from 6 AM alarm")
val serviceIntent = Intent(context, ProgressNotificationForegroundService::class.java).apply {
action = ProgressNotificationForegroundService.ACTION_START
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(serviceIntent)
} else {
context.startService(serviceIntent)
}
}
}
companion object {
private const val TAG = "ProgressAlarmReceiver"
const val ACTION_PROGRESS_6AM_ALARM = "app.firka.naplo.ACTION_PROGRESS_6AM_ALARM"
const val ALARM_REQUEST_CODE = 400201
fun scheduleNext6AmAlarm(context: Context) {
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as? AlarmManager ?: return
val intent = Intent(context, ProgressAlarmReceiver::class.java).apply {
action = ACTION_PROGRESS_6AM_ALARM
}
val pendingIntent = PendingIntent.getBroadcast(
context,
ALARM_REQUEST_CODE,
intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val now = LocalDateTime.now()
var target = now.toLocalDate().atTime(6, 0)
if (!target.isAfter(now)) {
target = target.plusDays(1)
}
val epochMillis = target.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()
Log.d(TAG, "Scheduling next 6 AM alarm for $target ($epochMillis)")
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, epochMillis, pendingIntent)
} else {
alarmManager.setExact(AlarmManager.RTC_WAKEUP, epochMillis, pendingIntent)
}
} catch (e: SecurityException) {
Log.w(TAG, "SecurityException while scheduling exact 6 AM alarm, falling back to setWindow", e)
alarmManager.set(AlarmManager.RTC_WAKEUP, epochMillis, pendingIntent)
}
}
fun cancel6AmAlarm(context: Context) {
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as? AlarmManager ?: return
val intent = Intent(context, ProgressAlarmReceiver::class.java).apply {
action = ACTION_PROGRESS_6AM_ALARM
}
val pendingIntent = PendingIntent.getBroadcast(
context,
ALARM_REQUEST_CODE,
intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
alarmManager.cancel(pendingIntent)
Log.d(TAG, "Cancelled 6 AM progress alarm")
}
}
}

View File

@@ -1,649 +0,0 @@
package app.firka.naplo
import android.app.AlarmManager
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.app.Service
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.pm.ServiceInfo
import android.graphics.drawable.Icon
import android.os.Build
import android.os.IBinder
import android.util.Log
import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
import app.firka.naplo.glance.WidgetLesson
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.json.JSONObject
import java.io.File
import java.time.Duration
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.ZoneId
import java.time.format.DateTimeFormatter
class ProgressNotificationForegroundService : Service() {
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
private var tickerJob: Job? = null
private var isForegroundStarted = false
private var transitionPendingIntent: PendingIntent? = null
private val timeReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
when (intent?.action) {
Intent.ACTION_TIME_TICK,
Intent.ACTION_SCREEN_ON,
Intent.ACTION_USER_PRESENT -> {
refreshAndPostNotification()
}
}
}
}
private val channelId = "firka_progress_notification_v3"
private val notificationId = 4002
private val hhmm = DateTimeFormatter.ofPattern("HH:mm")
private fun formatTemplate(template: String, vararg replacements: Pair<String, String>): String {
var res = template
for ((key, value) in replacements) {
res = res.replace("{$key}", value)
}
return res
}
override fun onCreate() {
super.onCreate()
isRunning = true
createNotificationChannel()
val filter = IntentFilter().apply {
addAction(Intent.ACTION_TIME_TICK)
addAction(Intent.ACTION_SCREEN_ON)
addAction(Intent.ACTION_USER_PRESENT)
}
ContextCompat.registerReceiver(
this,
timeReceiver,
filter,
ContextCompat.RECEIVER_NOT_EXPORTED
)
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
createNotificationChannel()
when (intent?.action) {
ACTION_START, ACTION_UPDATE -> {
isRunning = true
refreshAndPostNotification()
startTicker()
}
ACTION_STOP -> {
isRunning = false
stopForegroundService()
return START_NOT_STICKY
}
else -> {
isRunning = true
refreshAndPostNotification()
startTicker()
}
}
return START_STICKY
}
override fun onBind(intent: Intent?): IBinder? = null
override fun onDestroy() {
isRunning = false
cancelTransitionAlarm()
try {
unregisterReceiver(timeReceiver)
} catch (_: Exception) {}
tickerJob?.cancel()
scope.cancel()
super.onDestroy()
}
private fun startTicker() {
tickerJob?.cancel()
tickerJob = scope.launch {
while (isActive) {
val currentMillis = System.currentTimeMillis()
val millisIntoMinute = currentMillis % 60_000
// Target next :00 or :30 second boundary
val delayMillis = if (millisIntoMinute < 30_000) {
30_000 - millisIntoMinute
} else {
60_000 - millisIntoMinute
}.coerceIn(1_000, 30_000)
delay(delayMillis)
refreshAndPostNotification()
}
}
}
private fun refreshAndPostNotification() {
val widgetData = loadTodayTimetable(applicationContext)
if (widgetData == null || widgetData.lessons.isEmpty()) {
Log.d(TAG, "No lessons for today; stopping progress service")
stopForegroundService()
return
}
val lessons = widgetData.lessons.sortedBy { it.start }
val now = LocalDateTime.now()
val lastLesson = lessons.last()
// If today's last lesson has ended, stop notification & foreground service
if (now.isAfter(lastLesson.end) || now.isEqual(lastLesson.end)) {
Log.d(TAG, "Last lesson of the day ended (${lastLesson.end}); stopping progress service")
stopForegroundService()
return
}
val notification = buildProgressNotification(widgetData, now)
if (notification == null) {
stopForegroundService()
return
}
if (!isForegroundStarted) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(
notificationId,
notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE
)
} else {
@Suppress("DEPRECATION")
startForeground(notificationId, notification)
}
isForegroundStarted = true
}
val nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
nm.notify(notificationId, notification)
// Schedule exact alarm for next transition (lesson start/end or break end)
val firstLesson = lessons.first()
val targetTransitionTime: LocalDateTime? = when {
now.isBefore(firstLesson.start) -> firstLesson.start
else -> {
val currentLesson = lessons.find { !now.isBefore(it.start) && now.isBefore(it.end) }
if (currentLesson != null) {
currentLesson.end
} else {
val nextLesson = lessons.firstOrNull { it.start.isAfter(now) }
nextLesson?.start
}
}
}
if (targetTransitionTime != null) {
scheduleNextTransitionAlarm(targetTransitionTime)
}
}
private fun buildProgressNotification(data: TimetableProgressData, now: LocalDateTime): Notification? {
val strings = getStrings(this)
val lessons = data.lessons.sortedBy { it.start }
val firstLesson = lessons.first()
val lastLesson = lessons.last()
val pendingIntent = PendingIntent.getActivity(
this,
0,
packageManager.getLaunchIntentForPackage(packageName),
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val accentColor = data.accentColor
val breakColor = data.breakColor
val remainingLessonsCount = lessons.count { !now.isAfter(it.end) }
val remainingSuffix = if (remainingLessonsCount == 1) {
strings["progress_notif_remaining_lessons_one"] ?: ""
} else {
val template = strings["progress_notif_remaining_lessons_other"] ?: ""
formatTemplate(template, "count" to remainingLessonsCount.toString())
}
if (now.isBefore(firstLesson.start)) {
val minutesLeft = minutesRemaining(now, firstLesson.start)
val firstLessonIconRes = resolveSubjectIcon(firstLesson)
val title = if (firstLesson.lessonNumber != null) {
val template = strings["progress_notif_lesson_title"] ?: ""
if (template.isNotEmpty()) {
formatTemplate(template, "number" to firstLesson.lessonNumber.toString(), "name" to firstLesson.name)
} else {
firstLesson.name
}
} else {
firstLesson.name
}
val room = firstLesson.roomName?.trim()
val roomSuffix = if (!room.isNullOrBlank() && room != "null") "\n$room" else ""
val subSuffix = if (!firstLesson.substituteTeacher.isNullOrBlank() && firstLesson.substituteTeacher != "null" && firstLesson.substituteTeacher != "-") {
strings["progress_notif_substitution"] ?: ""
} else ""
val timeRange = "${firstLesson.start.format(hhmm)}-${firstLesson.end.format(hhmm)}"
val templateCase1 = strings["progress_notif_case1_text"] ?: ""
val text = formatTemplate(
templateCase1,
"minutes" to minutesLeft.toString(),
"timeRange" to timeRange,
"room" to roomSuffix,
"substitution" to subSuffix,
"remaining" to remainingSuffix
)
val criticalTemplate = strings["progress_notif_critical_text"] ?: ""
val criticalText = formatTemplate(criticalTemplate, "minutes" to minutesLeft.toString())
val morningStart = firstLesson.start.toLocalDate().atTime(6, 0)
val baseStart = if (now.isBefore(morningStart)) now else morningStart
val totalMinutes = Duration.between(baseStart, firstLesson.start).toMinutes().coerceAtLeast(15)
val elapsed = Duration.between(baseStart, now).toMinutes().coerceIn(0, totalMinutes)
if (Build.VERSION.SDK_INT >= 36) {
val progressStyle = Notification.ProgressStyle()
.setProgress(elapsed.toInt())
.setProgressSegments(listOf(
Notification.ProgressStyle.Segment(totalMinutes.toInt()).setColor(accentColor)
))
.setProgressEndIcon(Icon.createWithResource(this, firstLessonIconRes))
.setProgressTrackerIcon(Icon.createWithResource(this, R.drawable.ic_subject_break))
val builder = Notification.Builder(this, channelId)
.setStyle(progressStyle)
.setContentTitle(title)
.setContentText(text)
.setSmallIcon(R.drawable.ic_notification)
.setLargeIcon(Icon.createWithResource(this, firstLessonIconRes))
.setContentIntent(pendingIntent)
.setOngoing(true)
.setOnlyAlertOnce(true)
.setRequestPromotedOngoing(true)
.setShortCriticalText(criticalText.take(7))
return builder.build()
} else {
return NotificationCompat.Builder(this, channelId)
.setContentTitle(title)
.setContentText(text)
.setSmallIcon(R.drawable.ic_notification)
.setContentIntent(pendingIntent)
.setProgress(totalMinutes.toInt(), elapsed.toInt(), false)
.setOngoing(true)
.setOnlyAlertOnce(true)
.build()
}
}
val currentLesson = lessons.find { !now.isBefore(it.start) && now.isBefore(it.end) }
val title: String
val text: String
val criticalText: String
val trackerIconRes: Int
val largeIconRes: Int
val endIconRes: Int
val itemDuration: Int
val itemElapsed: Int
val itemColor: Int
if (currentLesson != null) {
val lessonDuration = Duration.between(currentLesson.start, currentLesson.end).toMinutes().coerceAtLeast(1).toInt()
val elapsed = Duration.between(currentLesson.start, now).toMinutes().coerceIn(0, lessonDuration.toLong()).toInt()
val timeLeft = minutesRemaining(now, currentLesson.end)
itemDuration = lessonDuration
itemElapsed = elapsed
itemColor = accentColor
trackerIconRes = resolveSubjectIcon(currentLesson)
largeIconRes = trackerIconRes
endIconRes = R.drawable.ic_subject_break
val prefix = if (currentLesson.lessonNumber != null) {
val template = strings["progress_notif_lesson_title"] ?: ""
if (template.isNotEmpty()) {
formatTemplate(template, "number" to currentLesson.lessonNumber.toString(), "name" to currentLesson.name)
} else {
currentLesson.name
}
} else {
currentLesson.name
}
title = prefix
val room = currentLesson.roomName?.trim()
val roomSuffix = if (!room.isNullOrBlank() && room != "null") "\n$room" else ""
val subSuffix = if (!currentLesson.substituteTeacher.isNullOrBlank() && currentLesson.substituteTeacher != "null" && currentLesson.substituteTeacher != "-") {
strings["progress_notif_substitution"] ?: ""
} else ""
val timeRange = "${currentLesson.start.format(hhmm)}-${currentLesson.end.format(hhmm)}"
val templateLesson = strings["progress_notif_case2_lesson_text"] ?: ""
text = formatTemplate(
templateLesson,
"minutes" to timeLeft.toString(),
"timeRange" to timeRange,
"room" to roomSuffix,
"substitution" to subSuffix,
"remaining" to remainingSuffix
)
val criticalTemplate = strings["progress_notif_critical_text"] ?: ""
criticalText = formatTemplate(criticalTemplate, "minutes" to timeLeft.toString())
} else {
val previousLesson = lessons.lastOrNull { !now.isBefore(it.end) }
val nextLesson = lessons.firstOrNull { it.start.isAfter(now) }
val breakStart = previousLesson?.end ?: now
val breakEnd = nextLesson?.start ?: lastLesson.end
val breakDuration = Duration.between(breakStart, breakEnd).toMinutes().coerceAtLeast(1).toInt()
val elapsed = Duration.between(breakStart, now).toMinutes().coerceIn(0, breakDuration.toLong()).toInt()
val timeLeft = minutesRemaining(now, breakEnd)
itemDuration = breakDuration
itemElapsed = elapsed
itemColor = breakColor
trackerIconRes = R.drawable.ic_subject_break
largeIconRes = if (nextLesson != null) resolveSubjectIcon(nextLesson) else trackerIconRes
endIconRes = if (nextLesson != null) resolveSubjectIcon(nextLesson) else trackerIconRes
title = strings["progress_notif_case2_break_title"] ?: ""
val templateBreak = strings["progress_notif_case2_break_text"] ?: ""
text = formatTemplate(
templateBreak,
"minutes" to timeLeft.toString(),
"remaining" to remainingSuffix
)
val criticalTemplate = strings["progress_notif_critical_text"] ?: ""
criticalText = formatTemplate(criticalTemplate, "minutes" to timeLeft.toString())
}
if (Build.VERSION.SDK_INT >= 36) {
val progressStyle = Notification.ProgressStyle()
.setProgress(itemElapsed)
.setProgressSegments(listOf(
Notification.ProgressStyle.Segment(itemDuration).setColor(itemColor)
))
.setProgressTrackerIcon(Icon.createWithResource(this, trackerIconRes))
.setProgressEndIcon(Icon.createWithResource(this, endIconRes))
val builder = Notification.Builder(this, channelId)
.setStyle(progressStyle)
.setContentTitle(title)
.setContentText(text)
.setSmallIcon(R.drawable.ic_notification)
.setLargeIcon(Icon.createWithResource(this, largeIconRes))
.setContentIntent(pendingIntent)
.setOngoing(true)
.setOnlyAlertOnce(true)
.setRequestPromotedOngoing(true)
.setShortCriticalText(criticalText.take(7))
return builder.build()
} else {
return NotificationCompat.Builder(this, channelId)
.setContentTitle(title)
.setContentText(text)
.setSmallIcon(R.drawable.ic_notification)
.setContentIntent(pendingIntent)
.setProgress(itemDuration, itemElapsed, false)
.setOngoing(true)
.setOnlyAlertOnce(true)
.build()
}
}
private fun resolveSubjectIcon(lesson: WidgetLesson): Int {
if (!lesson.icon.isNullOrEmpty()) {
val res = getSubjectIconRes(lesson.icon)
if (res != R.drawable.ic_notification) return res
}
val name = lesson.name.lowercase()
return when {
Regex("mate(k|matika)").containsMatchIn(name) -> R.drawable.ic_subject_mathematics
Regex("magyar nyelv|nyelvtan").containsMatchIn(name) -> R.drawable.ic_subject_grammar
Regex("irodalom").containsMatchIn(name) -> R.drawable.ic_subject_literature
Regex("tor(i|tenelem)").containsMatchIn(name) -> R.drawable.ic_subject_history
Regex("foldrajz").containsMatchIn(name) -> R.drawable.ic_subject_geography
Regex("rajz|muvtori|muveszet|vizualis").containsMatchIn(name) -> R.drawable.ic_subject_art
Regex("fizika").containsMatchIn(name) -> R.drawable.ic_subject_physics
Regex("^enek|zene|szolfezs|zongora|korus").containsMatchIn(name) -> R.drawable.ic_subject_music
Regex("^tes(i|tneveles)|sport|edzeselmelet").containsMatchIn(name) -> R.drawable.ic_subject_pe
Regex("kemia").containsMatchIn(name) -> R.drawable.ic_subject_chemistry
Regex("biologia").containsMatchIn(name) -> R.drawable.ic_subject_biology
Regex("angol|nemet|francia|olasz|orosz|spanyol|latin|kinai|idegen|nyelv").containsMatchIn(name) -> R.drawable.ic_subject_language
Regex("informatika|szoftver|digitalis").containsMatchIn(name) -> R.drawable.ic_subject_it
Regex("prog|alkalmazas").containsMatchIn(name) -> R.drawable.ic_subject_code
Regex("halozat").containsMatchIn(name) -> R.drawable.ic_subject_networking
Regex("filozofia").containsMatchIn(name) -> R.drawable.ic_subject_philosophy
Regex("osztaly(fonoki|kozosseg)").containsMatchIn(name) -> R.drawable.ic_subject_ofo
Regex("penzugy|gazdasag").containsMatchIn(name) -> R.drawable.ic_subject_economics
Regex("kornyezet|termeszet").containsMatchIn(name) -> R.drawable.ic_subject_env
Regex("(hit|erkolcs)tan|vallas|etika").containsMatchIn(name) -> R.drawable.ic_subject_religion
Regex("adatbazis").containsMatchIn(name) -> R.drawable.ic_subject_database
else -> R.drawable.ic_subject_unknown
}
}
private fun getSubjectIconRes(iconName: String?): Int {
if (iconName == null) return R.drawable.ic_subject_unknown
return when (iconName.lowercase()) {
"mathematics" -> R.drawable.ic_subject_mathematics
"grammar" -> R.drawable.ic_subject_grammar
"literature" -> R.drawable.ic_subject_literature
"history" -> R.drawable.ic_subject_history
"geography" -> R.drawable.ic_subject_geography
"art" -> R.drawable.ic_subject_art
"physics" -> R.drawable.ic_subject_physics
"music" -> R.drawable.ic_subject_music
"pe" -> R.drawable.ic_subject_pe
"chemistry" -> R.drawable.ic_subject_chemistry
"biology" -> R.drawable.ic_subject_biology
"env" -> R.drawable.ic_subject_env
"religion" -> R.drawable.ic_subject_religion
"economics" -> R.drawable.ic_subject_economics
"it" -> R.drawable.ic_subject_it
"code" -> R.drawable.ic_subject_code
"networking" -> R.drawable.ic_subject_networking
"theatre" -> R.drawable.ic_subject_theatre
"film" -> R.drawable.ic_subject_film
"electricalengineering" -> R.drawable.ic_subject_electricalengineering
"mechanicalengineering" -> R.drawable.ic_subject_mechanicalengineering
"technika" -> R.drawable.ic_subject_technika
"dance" -> R.drawable.ic_subject_dance
"philosophy" -> R.drawable.ic_subject_philosophy
"erettsegi" -> R.drawable.ic_subject_erettsegi
"ofo" -> R.drawable.ic_subject_ofo
"diligence" -> R.drawable.ic_subject_diligence
"attitude" -> R.drawable.ic_subject_attitude
"language" -> R.drawable.ic_subject_language
"linux" -> R.drawable.ic_subject_linux
"database" -> R.drawable.ic_subject_database
"applications" -> R.drawable.ic_subject_applications
"project" -> R.drawable.ic_subject_project
"break" -> R.drawable.ic_subject_break
else -> R.drawable.ic_subject_unknown
}
}
private fun createNotificationChannel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
try {
nm.deleteNotificationChannel("firka_progress_notification")
nm.deleteNotificationChannel("firka_progress_notification_v2")
} catch (_: Exception) {}
val strings = getStrings(this)
val channelName = strings["progress_notif_channel_name"]?.takeIf { it.isNotBlank() } ?: "Firka"
val channelDesc = strings["progress_notif_channel_desc"] ?: ""
val channel = NotificationChannel(
channelId,
channelName,
NotificationManager.IMPORTANCE_DEFAULT
).apply {
setShowBadge(false)
setSound(null, null)
enableVibration(false)
description = channelDesc
}
nm.createNotificationChannel(channel)
}
}
private fun scheduleNextTransitionAlarm(targetTime: LocalDateTime) {
val alarmManager = getSystemService(ALARM_SERVICE) as? AlarmManager ?: return
cancelTransitionAlarm()
val intent = Intent(this, ProgressNotificationForegroundService::class.java).apply {
action = ACTION_UPDATE
}
val pendingIntent = PendingIntent.getService(
this,
1001,
intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
transitionPendingIntent = pendingIntent
val epochMillis = targetTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()
if (epochMillis > System.currentTimeMillis()) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, epochMillis, pendingIntent)
} else {
alarmManager.setExact(AlarmManager.RTC_WAKEUP, epochMillis, pendingIntent)
}
} catch (e: SecurityException) {
Log.w(TAG, "Cannot schedule transition alarm", e)
}
}
}
private fun cancelTransitionAlarm() {
val alarmManager = getSystemService(ALARM_SERVICE) as? AlarmManager ?: return
transitionPendingIntent?.let {
alarmManager.cancel(it)
transitionPendingIntent = null
}
}
private fun stopForegroundService() {
isRunning = false
cancelTransitionAlarm()
tickerJob?.cancel()
isForegroundStarted = false
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
stopForeground(STOP_FOREGROUND_REMOVE)
} else {
@Suppress("DEPRECATION")
stopForeground(true)
}
stopSelf()
}
private fun minutesRemaining(from: LocalDateTime, to: LocalDateTime): Int {
val seconds = Duration.between(from, to).seconds
return if (seconds <= 0) 1 else ((seconds + 59) / 60).toInt().coerceAtLeast(1)
}
companion object {
private const val TAG = "ProgressNotifService"
const val ACTION_START = "app.firka.naplo.ProgressNotificationForegroundService.START"
const val ACTION_UPDATE = "app.firka.naplo.ProgressNotificationForegroundService.UPDATE"
const val ACTION_STOP = "app.firka.naplo.ProgressNotificationForegroundService.STOP"
private const val PREFS_STRINGS = "firka_progress_strings"
@Volatile
var isRunning: Boolean = false
fun saveStrings(context: Context, strings: Map<String, String>) {
val prefs = context.applicationContext.getSharedPreferences(PREFS_STRINGS, Context.MODE_PRIVATE)
val editor = prefs.edit()
for ((k, v) in strings) {
editor.putString(k, v)
}
editor.apply()
}
fun getStrings(context: Context): Map<String, String> {
val prefs = context.applicationContext.getSharedPreferences(PREFS_STRINGS, Context.MODE_PRIVATE)
val all = prefs.all
val result = mutableMapOf<String, String>()
for ((k, v) in all) {
if (v is String) {
result[k] = v
}
}
return result
}
fun loadTodayTimetable(context: Context): TimetableProgressData? {
return try {
val appFlutter = File(context.applicationContext.dataDir, "app_flutter")
val widgetStateFile = File(appFlutter, "widget_state.json")
if (!widgetStateFile.exists()) return null
val text = widgetStateFile.readText(Charsets.UTF_8)
val json = JSONObject(text)
val tt = json.getJSONArray("timetable")
val allLessons = mutableListOf<WidgetLesson>()
for (i in 0 until tt.length()) {
allLessons.add(WidgetLesson(tt.getJSONObject(i)))
}
val today = LocalDate.now()
var todayLessons = allLessons.filter { it.start.toLocalDate() == today }
if (todayLessons.isEmpty()) {
val displayDateStr = json.optString("displayDate", "")
if (displayDateStr.isNotEmpty()) {
try {
val displayDate = LocalDate.parse(displayDateStr)
todayLessons = allLessons.filter { it.start.toLocalDate() == displayDate }
} catch (_: Exception) {}
}
}
val colorsObj = json.optJSONObject("colors")
val accent = colorsObj?.optInt("accent", 0xFF4C662B.toInt()) ?: 0xFF4C662B.toInt()
val secondary = colorsObj?.optInt("secondary", 0xFF586249.toInt()) ?: 0xFF586249.toInt()
val language = json.optString("language", null)
TimetableProgressData(todayLessons, accent, secondary, language)
} catch (e: Exception) {
Log.e(TAG, "Error reading timetable data", e)
null
}
}
}
}
data class TimetableProgressData(
val lessons: List<WidgetLesson>,
val accentColor: Int,
val breakColor: Int,
val language: String? = null,
)

View File

@@ -1,221 +0,0 @@
package app.firka.naplo
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.app.Service
import android.content.Intent
import android.os.Build
import android.os.IBinder
import android.util.Log
import androidx.core.app.NotificationCompat
import java.io.ByteArrayInputStream
import java.io.ObjectInputStream
import com.google.android.gms.wearable.MessageClient
import com.google.android.gms.wearable.MessageEvent
import com.google.android.gms.wearable.Wearable
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.embedding.engine.dart.DartExecutor
import io.flutter.embedding.engine.loader.FlutterLoader
import io.flutter.plugin.common.MethodChannel
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlinx.coroutines.withTimeout
import kotlinx.coroutines.delay
/**
* Foreground service that keeps the app able to respond to Wear OS sync requests.
* When the watch sends request_sync, starts a Dart background isolate to fetch data,
* then reads the cache file and sends sync_data to the watch.
*/
class WearSyncForegroundService : Service(), MessageClient.OnMessageReceivedListener {
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
private var cachePath: String? = null
private var appDirPath: String? = null
private val channelId = "firka_wear_sync"
private val notificationId = 4001
private var notificationTitle: String = "Syncing with watch"
private var notificationText: String = ""
override fun onCreate() {
super.onCreate()
createNotificationChannel()
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
when (intent?.action) {
ACTION_START -> {
cachePath = intent.getStringExtra(EXTRA_CACHE_PATH)
appDirPath = intent.getStringExtra(EXTRA_APP_DIR_PATH)
notificationTitle = intent.getStringExtra(EXTRA_NOTIFICATION_TITLE) ?: "Syncing with watch"
notificationText = intent.getStringExtra(EXTRA_NOTIFICATION_TEXT) ?: ""
startForegroundWithNotification()
Wearable.getMessageClient(this@WearSyncForegroundService)
.addListener(this@WearSyncForegroundService)
}
ACTION_STOP -> {
stopForegroundService()
return START_NOT_STICKY
}
}
return START_STICKY
}
override fun onBind(intent: Intent?): IBinder? = null
override fun onDestroy() {
try {
Wearable.getMessageClient(this@WearSyncForegroundService)
.removeListener(this@WearSyncForegroundService)
.addOnCompleteListener { }
} catch (_: Exception) { }
scope.cancel()
super.onDestroy()
}
override fun onMessageReceived(messageEvent: MessageEvent) {
if (messageEvent.path != PATH_WATCH_CONNECTIVITY ||
!isRequestSyncPayload(messageEvent.data)
) return
val cPath = cachePath
val aPath = appDirPath
if (cPath == null || aPath == null) return
scope.launch {
runSyncInBackground(cPath, aPath)
}
}
/**
* watch_connectivity plugin sends with path "watch_connectivity" and serializes the message
* map with Java ObjectOutputStream. Parse payload and check for id == "request_sync".
*/
private fun isRequestSyncPayload(data: ByteArray?): Boolean {
if (data == null || data.isEmpty()) return false
return try {
ObjectInputStream(ByteArrayInputStream(data)).use { ois ->
val map = ois.readObject()
if (map is Map<*, *>) map["id"] == "request_sync" else false
}
} catch (_: Exception) {
false
}
}
private fun startForegroundWithNotification() {
val notification = buildNotification()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(notificationId, notification, android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)
} else {
@Suppress("DEPRECATION")
startForeground(notificationId, notification)
}
}
private fun buildNotification(): Notification {
val pendingIntent = PendingIntent.getActivity(
this,
0,
packageManager.getLaunchIntentForPackage(packageName),
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
return NotificationCompat.Builder(this, channelId)
.setContentTitle(notificationTitle)
.setContentText(notificationText)
.setSmallIcon(R.drawable.ic_notification)
.setContentIntent(pendingIntent)
.setOngoing(true)
.build()
}
private fun createNotificationChannel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel(
channelId,
"Wear sync",
NotificationManager.IMPORTANCE_LOW
).apply { setShowBadge(false) }
(getSystemService(NOTIFICATION_SERVICE) as NotificationManager)
.createNotificationChannel(channel)
}
}
private fun stopForegroundService() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
stopForeground(STOP_FOREGROUND_REMOVE)
} else {
@Suppress("DEPRECATION")
stopForeground(true)
}
stopSelf()
}
private suspend fun runSyncInBackground(cPath: String, aPath: String) = withContext(Dispatchers.Default) {
val flutterLoader = FlutterLoader()
if (!flutterLoader.initialized()) {
withContext(Dispatchers.Main) {
flutterLoader.startInitialization(applicationContext)
flutterLoader.ensureInitializationComplete(applicationContext, null)
}
}
val (engine, bgChannel) = withContext(Dispatchers.Main) {
val eng = FlutterEngine(applicationContext)
val entrypoint = DartExecutor.DartEntrypoint(
flutterLoader.findAppBundlePath(),
"package:firka/services/wear_sync_background.dart",
"wearSyncBackgroundEntrypoint"
)
eng.dartExecutor.executeDartEntrypoint(entrypoint)
val ch = MethodChannel(eng.dartExecutor.binaryMessenger, "app.firka/wear_sync_background")
Pair(eng, ch)
}
val completer = CompletableDeferred<Unit>()
delay(500)
withContext(Dispatchers.Main) {
bgChannel.invokeMethod("request_sync", mapOf(
"cachePath" to cPath,
"appDirPath" to aPath
), object : MethodChannel.Result {
override fun success(result: Any?) {
completer.complete(Unit)
}
override fun error(errorCode: String, errorMessage: String?, errorDetails: Any?) {
Log.e(TAG, "request_sync error: $errorCode $errorMessage")
completer.complete(Unit)
}
override fun notImplemented() {
completer.complete(Unit)
}
})
}
try {
withTimeout(30_000) {
completer.await()
}
} catch (_: kotlinx.coroutines.TimeoutCancellationException) {
Log.w(TAG, "Wear sync isolate timed out")
}
withContext(Dispatchers.Main) {
engine.destroy()
}
}
companion object {
private const val TAG = "WearSyncService"
const val ACTION_START = "app.firka.naplo.WearSyncForegroundService.START"
const val ACTION_STOP = "app.firka.naplo.WearSyncForegroundService.STOP"
const val EXTRA_CACHE_PATH = "cachePath"
const val EXTRA_APP_DIR_PATH = "appDirPath"
const val EXTRA_NOTIFICATION_TITLE = "notificationTitle"
const val EXTRA_NOTIFICATION_TEXT = "notificationText"
private const val PATH_WATCH_CONNECTIVITY = "watch_connectivity"
}
}

View File

@@ -16,10 +16,9 @@ import androidx.glance.layout.padding
import androidx.glance.layout.width
import androidx.glance.text.FontWeight
import androidx.glance.text.Text
import androidx.glance.text.TextAlign
import androidx.glance.text.TextStyle
import app.firka.naplo.model.Colors
import app.firka.naplo.glance.WidgetLesson
import app.firka.naplo.model.Lesson
import java.time.format.DateTimeFormatterBuilder
val hhmm = DateTimeFormatterBuilder()
@@ -27,13 +26,8 @@ val hhmm = DateTimeFormatterBuilder()
.toFormatter()
@Composable
fun LessonCard(
lesson: WidgetLesson,
colors: Colors,
modifier: GlanceModifier = GlanceModifier,
roomBadgeWidthDp: Float = 48f,
subjectColumnWidthDp: Float = 226f,
) {
fun LessonCard(lesson: Lesson, colors: Colors,
modifier: GlanceModifier = GlanceModifier) {
Box(modifier =
modifier
.fillMaxWidth()
@@ -44,33 +38,17 @@ fun LessonCard(
var bgColor = colors.a15p
var fgColor = colors.textSecondary
if (lesson.substituteTeacher != null) {
if (lesson.substituteTeacher == null) {
bgColor = colors.warning15p
fgColor = colors.warningText
}
Box(modifier = GlanceModifier.padding(12.dp)) {
Row(modifier = GlanceModifier.fillMaxWidth()) {
val badgeStyle = TextStyle(
color = ColorProvider(colors.textSecondary, colors.textSecondary),
fontSize = 14.sp,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center
)
val badgePadding = GlanceModifier.padding(8.dp, 4.dp)
val lessonNumberBadgeModifier = GlanceModifier.cornerRadius(16.dp).width(24.dp)
val roomBadgeModifier = GlanceModifier.cornerRadius(16.dp).width(roomBadgeWidthDp.dp)
Row(
modifier = GlanceModifier.width(subjectColumnWidthDp.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Row {
Row(modifier = GlanceModifier.width(226.dp), verticalAlignment = Alignment.CenterVertically) {
if (lesson.lessonNumber != null) {
Box(
modifier = lessonNumberBadgeModifier.background(bgColor),
contentAlignment = Alignment.Center,
) {
Box(modifier = GlanceModifier.cornerRadius(16.dp).background(bgColor)) {
Text(
lesson.lessonNumber.toString(),
style = TextStyle(
@@ -78,24 +56,24 @@ fun LessonCard(
fontSize = 14.sp,
fontWeight = FontWeight.Bold
),
modifier = GlanceModifier.padding(4.dp, 4.dp),
modifier = GlanceModifier.padding(8.dp, 4.dp),
)
}
Spacer(modifier = GlanceModifier.width(4.dp))
}
// TODO: Add subject icons
Text(
text = lesson.name,
lesson.name,
style = TextStyle(
color = ColorProvider(colors.textPrimary, colors.textPrimary),
fontSize = 14.sp,
fontWeight = FontWeight.Bold
),
maxLines = 1,
modifier = GlanceModifier.fillMaxWidth(),
)
}
// Spacer(modifier = GlanceModifier.width(10.dp))
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
lesson.start.format(hhmm),
@@ -106,18 +84,24 @@ fun LessonCard(
),
)
Spacer(modifier = GlanceModifier.width(8.dp))
val roomName = lesson.roomName ?: "N/A"
Box(
modifier = roomBadgeModifier.background(colors.a15p),
contentAlignment = Alignment.Center,
) {
Box(modifier = GlanceModifier.cornerRadius(16.dp).background(colors.a15p)) {
var roomName = "N/A";
if (lesson.roomName != null) {
roomName = lesson.roomName!!;
}
if (roomName.length < 2) {
roomName = " $roomName"
}
Text(
text = roomName,
style = badgeStyle,
maxLines = 1,
modifier = GlanceModifier
.fillMaxWidth()
.padding(4.dp, 4.dp),
roomName,
style = TextStyle(
color = ColorProvider(colors.textSecondary, colors.textSecondary),
fontSize = 14.sp,
fontWeight = FontWeight.Bold
),
modifier = GlanceModifier.padding(8.dp, 4.dp),
)
}
}

View File

@@ -9,10 +9,8 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.glance.GlanceId
import androidx.glance.GlanceModifier
import androidx.glance.LocalSize
import androidx.glance.appwidget.GlanceAppWidget
import androidx.glance.appwidget.provideContent
import androidx.glance.appwidget.SizeMode
import androidx.glance.background
import androidx.glance.color.ColorProvider
import androidx.glance.currentState
@@ -28,9 +26,7 @@ import androidx.glance.text.FontWeight
import androidx.glance.text.Text
import androidx.glance.text.TextStyle
import app.firka.naplo.model.Colors
import app.firka.naplo.glance.WidgetLesson
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import app.firka.naplo.model.Lesson
import org.json.JSONObject
import java.io.File
import java.time.LocalDate
@@ -41,55 +37,20 @@ class TimetableWidget : GlanceAppWidget() {
override val stateDefinition: GlanceStateDefinition<*>?
get() = HomeWidgetGlanceStateDefinition()
override val sizeMode: SizeMode
get() = SizeMode.Exact
override suspend fun provideGlance(context: Context, id: GlanceId) {
val data = withContext(Dispatchers.IO) {
loadWidgetData(context)
}
provideContent {
GlanceContent(context, currentState(), data)
}
}
private fun loadWidgetData(context: Context): WidgetData? {
try {
val appFlutter = File(context.applicationContext.dataDir, "app_flutter")
val widgetStateFile = File(appFlutter, "widget_state.json")
if (!widgetStateFile.exists()) return null
val text = widgetStateFile.readText(Charsets.UTF_8)
val widgetState = JSONObject(text)
val colors = Colors(widgetState)
val tt = widgetState.getJSONArray("timetable")
val lessons = mutableListOf<WidgetLesson>()
for (i in 0..<tt.length()) {
lessons.add(WidgetLesson(tt.getJSONObject(i)))
}
val displayDateStr = widgetState.optString("displayDate", "")
val targetDate = if (displayDateStr.isNotEmpty()) {
try {
LocalDate.parse(displayDateStr)
} catch (_: Exception) {
LocalDate.now()
}
} else {
LocalDate.now()
}
val filtered = lessons.filter { it.start.toLocalDate() == targetDate }
val headerText = if (displayDateStr.isNotEmpty()) displayDateStr else "Mai órarend"
return WidgetData(colors, headerText, filtered)
} catch (e: Throwable) {
android.util.Log.e("TimetableWidget", "Error in loadWidgetData", e)
return null
GlanceContent(context, currentState())
}
}
@Composable
private fun GlanceContent(context: Context, currentState: HomeWidgetGlanceState, data: WidgetData?) {
if (data == null) {
Box(
modifier = GlanceModifier
private fun GlanceContent(context: Context, currentState: HomeWidgetGlanceState) {
val appFlutter = File(context.applicationContext.dataDir, "app_flutter")
val widgetStateFile = File(appFlutter, "widget_state.json")
if (!widgetStateFile.exists()) {
Box(modifier =
GlanceModifier
.background(Color(0xFFFAFFF0))
.padding(16.dp)
.fillMaxSize(),
@@ -104,74 +65,47 @@ class TimetableWidget : GlanceAppWidget() {
)
)
}
return
}
val size = LocalSize.current
val lessonRowHeightDp = 52f
val scale = lessonRowHeightDp / 52f
val headerHeightDp = 20f * scale
val verticalPaddingDp = 32f * scale
val spacerDp = 4f * scale
val paddingDp = 16f * scale
val availableHeightDp = size.height.value - verticalPaddingDp - headerHeightDp - spacerDp
val maxVisibleLessons = (availableHeightDp / lessonRowHeightDp).toInt().coerceAtLeast(0)
val maxLessons = (maxVisibleLessons.coerceAtMost(16) / 2 * 2).coerceAtLeast(1)
val displayLessons = data.lessons.take(maxLessons)
val lessonChunks = displayLessons.chunked(2)
val showDate = maxLessons > 1
val roomBadgeWidthDp = 48f
val minWidthForTimeAndChipDp = 8f + 40f + roomBadgeWidthDp
val subjectColumnWidthDp = (size.width.value - 2 * paddingDp - 32f - minWidthForTimeAndChipDp)
.coerceIn(80f, 226f)
val dateSectionHeight = if (showDate) headerHeightDp + spacerDp else 0f
val lessonListHeight = when (val n = displayLessons.size) {
0 -> 0f
else -> n * lessonRowHeightDp + (n - 1) * spacerDp
}
val remainingHeight = (size.height.value - 2 * paddingDp - dateSectionHeight - lessonListHeight).coerceAtLeast(0f)
val verticalPaddingAroundLessons = remainingHeight / 2f
val widgetState = JSONObject(widgetStateFile.readText(Charsets.UTF_8))
val colors = Colors(widgetState)
Box(
modifier = GlanceModifier
.background(data.colors.background)
.padding(paddingDp.dp)
val tt = widgetState.getJSONArray("timetable")
var lessons = mutableListOf<Lesson>()
for (i in 0..<tt.length()) {
lessons.add(Lesson(tt.getJSONObject(i)))
}
val now = LocalDate.now()
val start = LocalDateTime.of(now.year, now.month, now.dayOfMonth, 0, 0)
val end = start.plusHours(23)
lessons = lessons.filter { lesson -> lesson.start.isAfter(start) && lesson.end.isBefore(end) }.toMutableList()
Box(modifier =
GlanceModifier
.background(colors.background)
.padding(16.dp)
.fillMaxSize()
) {
Column {
if (showDate) {
Text(
data.headerText,
style = TextStyle(
color = ColorProvider(data.colors.textSecondary, data.colors.textSecondary),
fontSize = 12.sp,
fontWeight = FontWeight.Medium
)
Text(
"Mai órarend",
style = TextStyle(
color = ColorProvider(colors.textSecondary, colors.textSecondary),
fontSize = 12.sp,
fontWeight = FontWeight.Medium
)
Spacer(modifier = GlanceModifier.height(spacerDp.dp))
)
Spacer(modifier = GlanceModifier.height(4.dp))
for (lesson in lessons) {
LessonCard(lesson, colors)
Spacer(modifier = GlanceModifier.height(4.dp))
}
Spacer(modifier = GlanceModifier.height(verticalPaddingAroundLessons.dp))
for (chunk in lessonChunks) {
Column {
for (lesson in chunk) {
LessonCard(
lesson,
data.colors,
roomBadgeWidthDp = roomBadgeWidthDp,
subjectColumnWidthDp = subjectColumnWidthDp,
)
Spacer(modifier = GlanceModifier.height(spacerDp.dp))
}
}
}
Spacer(modifier = GlanceModifier.height(verticalPaddingAroundLessons.dp))
}
}
}
}
private data class WidgetData(
val colors: Colors,
val headerText: String,
val lessons: List<WidgetLesson>,
)
}

View File

@@ -1,62 +1,7 @@
package app.firka.naplo.glance
import android.appwidget.AppWidgetManager
import android.content.Context
import android.os.Bundle
import HomeWidgetGlanceWidgetReceiver
import androidx.glance.appwidget.GlanceAppWidgetManager
import kotlinx.coroutines.runBlocking
import android.content.Intent
import android.util.Log
import androidx.glance.appwidget.updateAll
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
class TimetableWidgetReceiver : HomeWidgetGlanceWidgetReceiver<TimetableWidget>() {
override val glanceAppWidget = TimetableWidget()
override fun onReceive(context: Context, intent: Intent) {
super.onReceive(context, intent)
val action = intent.action
if (action == ACTION_REFRESH_WIDGET ||
action == AppWidgetManager.ACTION_APPWIDGET_UPDATE ||
action == Intent.ACTION_BOOT_COMPLETED ||
action == Intent.ACTION_MY_PACKAGE_REPLACED) {
val pendingResult = goAsync()
CoroutineScope(SupervisorJob() + Dispatchers.Default).launch {
try {
glanceAppWidget.updateAll(context)
} catch (e: Exception) {
Log.e("TimetableWidget", "Failed glanceAppWidget.updateAll from onReceive", e)
} finally {
pendingResult?.finish()
}
}
}
}
override fun onAppWidgetOptionsChanged(
context: Context,
appWidgetManager: AppWidgetManager,
appWidgetId: Int,
newOptions: Bundle,
) {
super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions)
val pendingResult = goAsync()
CoroutineScope(SupervisorJob() + Dispatchers.Default).launch {
try {
val glanceId = GlanceAppWidgetManager(context).getGlanceIdBy(appWidgetId)
glanceAppWidget.update(context, glanceId)
} finally {
pendingResult?.finish()
}
}
}
companion object {
const val ACTION_REFRESH_WIDGET = "app.firka.naplo.ACTION_REFRESH_WIDGET"
}
}

View File

@@ -1,49 +0,0 @@
package app.firka.naplo.glance
import app.firka.naplo.getIntOrNull
import app.firka.naplo.getStringOrNull
import org.json.JSONObject
import java.time.LocalDateTime
import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
import java.time.format.DateTimeFormatterBuilder
import java.time.temporal.ChronoField
class WidgetLesson(data: JSONObject) {
companion object {
private val formatter: DateTimeFormatter = DateTimeFormatterBuilder()
.appendPattern("yyyy-MM-dd'T'HH:mm:ss")
.optionalStart()
.appendFraction(ChronoField.NANO_OF_SECOND, 1, 9, true)
.optionalEnd()
.optionalStart()
.appendLiteral('Z')
.optionalEnd()
.optionalStart()
.appendOffset("+HH:MM", "+00:00")
.optionalEnd()
.toFormatter()
fun parseDateTime(raw: String): LocalDateTime {
return try {
LocalDateTime.parse(raw, formatter)
} catch (_: Exception) {
try {
OffsetDateTime.parse(raw).toLocalDateTime()
} catch (_: Exception) {
LocalDateTime.parse(raw)
}
}
}
}
val name: String = data.optString("name", data.optString("Nev", ""))
val start: LocalDateTime = parseDateTime(data.optString("start", data.optString("KezdetIdopont", "")))
val end: LocalDateTime = parseDateTime(data.optString("end", data.optString("VegIdopont", "")))
val lessonNumber: Int? = data.getIntOrNull("dailyNth") ?: data.getIntOrNull("Oraszam")
val roomName: String? = (data.getStringOrNull("roomName") ?: data.getStringOrNull("TeremNeve"))
?.takeIf { it != "null" && it != "-" && it.isNotBlank() }
val substituteTeacher: String? = (data.getStringOrNull("substituteTeacher") ?: data.getStringOrNull("HelyettesTanarNeve"))
?.takeIf { it != "null" && it != "-" && it.isNotBlank() }
val icon: String? = data.getStringOrNull("icon")
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 957 B

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M19 4H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z"
android:fillColor="#FFFFFFFF" />
<path
android:pathData="M12 16h7a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h7zm0 0v4m0 0h4m-4 0H8"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M15.586 3a2 2 0 0 1 2.828 0L21 5.586a2 2 0 0 1 0 2.828L19.414 10 14 4.586 15.586 3zm-3 3-9 9A2 2 0 0 0 3 16.414V19a2 2 0 0 0 2 2h2.586A2 2 0 0 0 9 20.414l9-9L12.586 6z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M 7.0,8.0 a 5.0,5.0 0 1,0 10.0,0 a 5.0,5.0 0 1,0 -10.0,0 Z"
android:fillColor="#FFFFFFFF"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M20 21a8 8 0 1 0-16 0"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M12 13a8 8 0 0 0-8 8h16a8 8 0 0 0-8-8z"
android:fillColor="#FFFFFFFF"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M10 1a1 1 0 0 0 0 2h1v1.062A7.96 7.96 0 0 0 7.094 5.68L5.914 4.5l.793-.793a1 1 0 0 0-1.414-1.414l-3 3a1 1 0 0 0 1.414 1.414l.793-.793 1.18 1.18A7.96 7.96 0 0 0 4.062 11H3v-1a1 1 0 0 0-2 0v4a1 1 0 1 0 2 0v-1h1.062c.182 1.46.759 2.8 1.618 3.906l-1.18 1.18-.793-.793a1 1 0 0 0-1.414 1.414l3 3a1 1 0 0 0 1.414-1.414l-.793-.793 1.18-1.18A7.965 7.965 0 0 0 11 19.938V21h-1a1 1 0 1 0 0 2h4a1 1 0 1 0 0-2h-1v-1.062a7.965 7.965 0 0 0 3.906-1.618l1.18 1.18-.793.793a1 1 0 0 0 1.414 1.414l3-3a1 1 0 0 0-1.414-1.414l-.793.793-1.18-1.18A7.965 7.965 0 0 0 19.938 13H21v1a1 1 0 1 0 2 0v-4a1 1 0 1 0-2 0v1h-1.062a7.965 7.965 0 0 0-1.618-3.906l1.18-1.18.793.793a1 1 0 1 0 1.414-1.414l-3-3a1 1 0 1 0-1.414 1.414l.793.793-1.18 1.18A7.966 7.966 0 0 0 13 4.062V3h1a1 1 0 1 0 0-2h-4zm3 13a1 1 0 0 1 1-1h.001a1 1 0 1 1 0 2H14a1 1 0 0 1-1-1zm-3-3.5a.5.5 0 1 1 1 0 .5.5 0 0 1-1 0zm.5-2.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12zm11-5a1 1 0 1 0-2 0v3.764a3 3 0 0 0 1.658 2.683l2.895 1.447a1 1 0 1 0 .894-1.788l-2.894-1.448a1 1 0 0 1-.553-.894V7z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M6 2a1 1 0 0 0 0 2h1v13a5 5 0 0 0 10 0V4h1a1 1 0 1 0 0-2H6zm3 5V4h6v3H9zm4.708 5.708a1 1 0 0 1-1.414 0h-.001a1 1 0 0 1 1.414-1.415 1 1 0 0 1 0 1.415zm-3.414 4a1 1 0 1 0 1.414-1.414v-.001a1 1 0 0 0-1.415 1.414z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M9.5 5H9a2 2 0 0 0-2 2v2c0 1-.6 3-3 3 1 0 3 .6 3 3v2a2 2 0 0 0 2 2h.5m5-14h.5a2 2 0 0 1 2 2v2c0 1 .6 3 3 3-1 0-3 .6-3 3v2a2 2 0 0 1-2 2h-.5"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M17 7a5.001 5.001 0 0 0-4.607 3.053C11.963 11.07 12.896 12 14 12h6c1.105 0 2.037-.93 1.607-1.947A5.001 5.001 0 0 0 17 7zm0 10a5.001 5.001 0 0 0-3.053-4.607C12.93 11.963 12 12.896 12 14v6c0 1.105.93 2.037 1.947 1.607A5.001 5.001 0 0 0 17 17zM7 17a5.001 5.001 0 0 0 4.607-3.053C12.037 12.93 11.104 12 10 12H4c-1.105 0-2.037.93-1.607 1.947A5.001 5.001 0 0 0 7 17zM7 7a5.001 5.001 0 0 0 3.053 4.607C11.07 12.037 12 11.104 12 10V4c0-1.105-.93-2.037-1.947-1.607A5.001 5.001 0 0 0 7 7z"
android:fillColor="#FFFFFFFF"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M21 7c0 2.21-4.03 4-9 4S3 9.21 3 7s4.03-4 9-4 9 1.79 9 4z"
android:fillColor="#FFFFFFFF" />
<path
android:pathData="M21 7c0 2.21-4.03 4-9 4S3 9.21 3 7m18 0c0-2.21-4.03-4-9-4S3 4.79 3 7m18 0v5M3 7v5m18 0c0 2.21-4.03 4-9 4s-9-1.79-9-4m18 0v5c0 2.21-4.03 4-9 4s-9-1.79-9-4v-5"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M10 2a3.001 3.001 0 0 0-2.83 2H6a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h12a3 3 0 0 0 3-3V7a3 3 0 0 0-3-3h-1.17A3.001 3.001 0 0 0 14 2h-4zM9 5a1 1 0 0 1 1-1h4a1 1 0 1 1 0 2h-4a1 1 0 0 1-1-1zm6.78 6.625a1 1 0 1 0-1.56-1.25l-3.303 4.128-1.21-1.21a1 1 0 0 0-1.414 1.414l2 2a1 1 0 0 0 1.488-.082l4-5z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M21 8c0 1.02-1.186 1.92-3 2.462-1.134.34-2.513.538-4 .538s-2.866-.199-4-.538C8.187 9.92 7 9.02 7 8c0-1.657 3.134-3 7-3s7 1.343 7 3z"
android:fillColor="#FFFFFFFF" />
<path
android:pathData="M21 8c0-1.657-3.134-3-7-3S7 6.343 7 8m14 0v4c0 1.02-1.186 1.92-3 2.462-1.134.34-2.513.538-4 .538s-2.866-.199-4-.538C8.187 13.92 7 13.02 7 12V8m14 0c0 1.02-1.186 1.92-3 2.462-1.134.34-2.513.538-4 .538s-2.866-.199-4-.538C8.187 9.92 7 9.02 7 8"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M3 12v4c0 1.02 1.187 1.92 3 2.462 1.134.34 2.513.538 4 .538s2.866-.199 4-.538c1.813-.542 3-1.442 3-2.462v-1M3 12c0-1.197 1.635-2.23 4-2.711M3 12c0 1.02 1.187 1.92 3 2.462 1.134.34 2.513.538 4 .538.695 0 1.366-.043 2-.124"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M4 14 14 3v7h6L10 21v-7H4z"
android:fillColor="#FFFFFFFF"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M20.156 6.473a2.639 2.639 0 0 0-2.63-2.629C15.049 3.817 9.909 4.193 6.5 7.6c-2.796 2.796-2.915 7.3-.157 10.057 2.758 2.758 7.26 2.639 10.057-.157 3.407-3.408 3.783-8.548 3.756-11.027zm-4.62 1.991a1 1 0 0 1 0 1.415l-.978.977.587.195a1 1 0 0 1-.633 1.898l-1.535-.512-1.247 1.247.586.196a1 1 0 0 1-.632 1.897l-1.173-.39a3.01 3.01 0 0 1-.344-.14l-2.41 2.41-3.121 3.121a1 1 0 0 1-1.414-1.414l3.121-3.121 2.41-2.41a3.009 3.009 0 0 1-.14-.344l-.39-1.173a1 1 0 0 1 1.897-.632l.196.586 1.247-1.247-.512-1.535a1 1 0 0 1 1.898-.633l.195.587.977-.978a1 1 0 0 1 1.414 0z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M 5.0,9.0 a 7.0,7.0 0 1,0 14.0,0 a 7.0,7.0 0 1,0 -14.0,0 Z"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M7 20.234V14c.667.667 2.6 2 5 2s4.333-1.333 5-2v6.234a1 1 0 0 1-1.514.857l-2.972-1.782a1 1 0 0 0-1.028 0L8.514 21.09A1 1 0 0 1 7 20.234z"
android:fillColor="#FFFFFFFF"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M5 5a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3v-1.586l2.293 2.293A1 1 0 0 0 22 16V8a1 1 0 0 0-1.707-.707L18 9.586V8a3 3 0 0 0-3-3H5z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M 3.0,12.0 a 9.0,9.0 0 1,0 18.0,0 a 9.0,9.0 0 1,0 -18.0,0 Z"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M13.5 6h.5a2 2 0 0 0 2-2C8.4 1.2 4.5 6.5 3.5 9.5l4.167 5.093c.215.263.333.593.333.933C8 16.34 8.673 17 9.487 17c.828 0 1.513.672 1.513 1.5V21c2.167-.167 6.8-1.2 8-4h-1a2 2 0 0 1-2-2 2 2 0 0 0-2-2h-2a2 2 0 0 1-2-2v-1a1 1 0 0 1 1-1 1 1 0 0 0 1-1v-.5A1.5 1.5 0 0 1 13.5 6z"
android:fillColor="#FFFFFFFF"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M3 5a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V5zm5 0v7l2.293-2.293a1 1 0 0 1 1.414 0L14 12V5a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12zm14.243-4.243L9.879 9.88l-2.122 6.364 6.364-2.122 2.122-6.364z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v7.764l1.447 2.894-.894.448.894-.448c.998 1.995-.453 4.342-2.683 4.342H4.236c-2.23 0-3.68-2.347-2.683-4.342L3 13.764V6zm3-1a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H6z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12 2H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h.93a2 2 0 0 1 1.664.89l.574.862a1 1 0 0 0 1.664 0l.574-.861A2 2 0 0 1 11.07 12H12a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2z"
android:fillColor="#FFFFFFFF"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M18 10h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-.93a2 2 0 0 0-1.664.89l-.574.862a1 1 0 0 1-1.664 0l-.574-.861A2 2 0 0 0 12.93 20H12a2 2 0 0 1-2-2v-1"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12 3a2 2 0 0 0-1 3.732V8H8c-3.2 0-4 2.667-4 4v7c0 .667.4 2 2 2h1v-4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v4h1c1.6 0 2-1.333 2-2v-7c0-3.2-2.667-4-4-4h-3V6.732A2 2 0 0 0 12 3zm3 18v-3h-2v3h2zm-4 0v-3H9v3h2zm10-3v-5c.667 0 2 .4 2 2v1c0 .667-.4 2-2 2zM3 13v5c-1.6 0-2-1.333-2-2v-1c0-1.6 1.333-2 2-2zm6-1a1 1 0 1 0 0 2h.001a1 1 0 1 0 0-2H9zm5 1a1 1 0 0 1 1-1h.001a1 1 0 1 1 0 2H15a1 1 0 0 1-1-1z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M11 4.85c-2.195-1.022-5.52-1.565-8.633.979A1 1 0 0 0 2 6.603V19a1 1 0 0 0 1.633.774c2.736-2.236 5.734-1.31 7.367-.255V4.849zm2 0v14.669c1.633-1.056 4.63-1.981 7.367.255A1 1 0 0 0 22 19V6.603a1 1 0 0 0-.367-.774C18.52 3.285 15.195 3.828 13 4.849z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M7 2a3 3 0 0 0-3 3v14a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3V5a3 3 0 0 0-3-3H7zm0 4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V6zm1 7a1 1 0 1 0 0 2h.01a1 1 0 1 0 0-2H8zm3 1a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1zm1 2a1 1 0 1 0 0 2h.01a1 1 0 1 0 0-2H12zm-5 1a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H8a1 1 0 0 1-1-1zm10-3a1 1 0 1 0-2 0v3a1 1 0 1 0 2 0v-3z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M9.024 2.783A1 1 0 0 1 10 2h4a1 1 0 0 1 .976.783l.44 1.981c.4.19.781.41 1.14.66l1.938-.61a1 1 0 0 1 1.166.454l2 3.464a1 1 0 0 1-.19 1.237l-1.497 1.373a8.1 8.1 0 0 1 0 1.316l1.497 1.373a1 1 0 0 1 .19 1.237l-2 3.464a1 1 0 0 1-1.166.454l-1.937-.61c-.36.25-.741.47-1.14.66l-.44 1.98A1 1 0 0 1 14 22h-4a1 1 0 0 1-.976-.783l-.44-1.981c-.4-.19-.781-.41-1.14-.66l-1.938.61a1 1 0 0 1-1.166-.454l-2-3.464a1 1 0 0 1 .19-1.237l1.497-1.373a8.097 8.097 0 0 1 0-1.316L2.53 9.97a1 1 0 0 1-.19-1.237l2-3.464a1 1 0 0 1 1.166-.454l1.937.61c.36-.25.741-.47 1.14-.66l.44-1.98zM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M13 4h4v4h-4v9c0 1-.6 3-3 3s-3-2-3-3 .6-3 3-3 3 2 3 3V4z"
android:fillColor="#FFFFFFFF" />
<path
android:pathData="M13 17V8m0 9c0 1-.6 3-3 3s-3-2-3-3 .6-3 3-3 3 2 3 3zm0-9V4h4v4h-4z"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M2 13.5C2 17.9 5.667 19 7.5 19h10c1.5 0 4.5-.9 4.5-4.5S19 10 17.5 10c0-1.5-1.5-5-5-5-2.8 0-4.5 2-5 3C5.667 8 2 9.1 2 13.5z"
android:fillColor="#FFFFFFFF"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M 5.0,9.0 a 4.0,4.0 0 1,0 8.0,0 a 4.0,4.0 0 1,0 -8.0,0 Z"
android:fillColor="#FFFFFFFF"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M9 13c-3.866 0-7 2.686-7 6h14c0-3.314-3.134-6-7-6z"
android:fillColor="#FFFFFFFF"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M15 13a4 4 0 1 0-3-6.646m0 5.411c.897.942 2.193 1.235 3 1.235 3.866 0 7 2.686 7 6h-6"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M3 12h4l3 7 4-14 3 7h4"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12 7a5 5 0 0 0-2 9.584V19h4v-2.416A5.001 5.001 0 0 0 12 7z"
android:fillColor="#FFFFFFFF" />
<path
android:pathData="M21 12h1m-3.5-6.5 1-1M12 3V2M5.5 5.5l-1-1M3 12H2m8 10h4m3-10a5 5 0 1 0-7 4.584V19h4v-2.416A5.001 5.001 0 0 0 17 12z"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M18.893 7.936a8.003 8.003 0 0 1-7.774 12.016m-6.012-3.888a8.003 8.003 0 0 1 7.774-12.016"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M 15.657,6.343 a 2.0,2.0 0 1,0 4.0,0 a 2.0,2.0 0 1,0 -4.0,0 Z"
android:fillColor="#FFFFFFFF"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M 4.343,17.657 a 2.0,2.0 0 1,0 4.0,0 a 2.0,2.0 0 1,0 -4.0,0 Z"
android:fillColor="#FFFFFFFF"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M 10.0,12.0 a 2.0,2.0 0 1,0 4.0,0 a 2.0,2.0 0 1,0 -4.0,0 Z"
android:fillColor="#FFFFFFFF"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M3 2a1 1 0 0 0 0 2v11a1 1 0 0 0 1 1h4.613L7.05 20.684a1 1 0 0 0 1.898.632L10.72 16h2.558l1.772 5.316a1 1 0 0 0 1.898-.632L15.387 16H20a1 1 0 0 0 1-1V4a1 1 0 1 0 0-2H3z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12 3a1 1 0 0 1 1 1v1h1a1 1 0 1 1 0 2h-1v1.5l7.6 5.7A1 1 0 0 1 20 16h-1v3h2a1 1 0 1 1 0 2h-7v-3a2 2 0 1 0-4 0v3H3a1 1 0 1 1 0-2h2v-3H4a1 1 0 0 1-.6-1.8L11 8.5V7h-1a1 1 0 0 1 0-2h1V4a1 1 0 0 1 1-1z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12.879 3.707a3 3 0 0 1 4.242 0l3.172 3.172a3 3 0 0 1 0 4.242l-9.172 9.172a3 3 0 0 1-4.242 0L3.707 17.12a3 3 0 0 1 0-4.242L4.586 12l1.707 1.707a1 1 0 0 0 1.414-1.414L6 10.586 7.586 9l2.707 2.707a1 1 0 0 0 1.414-1.414L9 7.586 10.586 6l1.707 1.707a1 1 0 1 0 1.414-1.414L12 4.586l.879-.879z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M2 3a1 1 0 0 1 1-1h18a1 1 0 1 1 0 2v11a1 1 0 0 1-1 1h-4.613l1.562 4.684a1 1 0 0 1-1.898.632L13.28 16h-2.558L8.95 21.316a1 1 0 1 1-1.898-.632L8.613 16H4a1 1 0 0 1-1-1V4a1 1 0 0 1-1-1zm9.555 3.168A1 1 0 0 0 10 7v4a1 1 0 0 0 1.555.832l3-2a1 1 0 0 0 0-1.664l-3-2zM12.197 9 12 9.131V8.87l.197.131z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm0 5a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0V8a1 1 0 0 1 1-1zm1 9a1 1 0 1 0-2 0 1 1 0 1 0 2 0z"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd" />
</vector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@@ -8,7 +8,6 @@
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:windowSplashScreenBackground">#7ca120</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item>
<item name="android:windowSplashScreenIconBackgroundColor">#7ca120</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your

View File

@@ -8,7 +8,6 @@
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:windowSplashScreenBackground">#7ca120</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item>
<item name="android:windowSplashScreenIconBackgroundColor">#7ca120</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your

View File

@@ -1,9 +1,7 @@
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:initialLayout="@layout/glance_default_loading_layout"
android:minWidth="250dp"
android:minHeight="93dp"
android:minResizeWidth="180dp"
android:minResizeHeight="93dp"
android:minWidth="300dp"
android:minHeight="100dp"
android:resizeMode="horizontal|vertical"
android:updatePeriodMillis="1800000">
android:updatePeriodMillis="10000">
</appwidget-provider>

View File

@@ -1,5 +1,5 @@
import com.android.build.api.dsl.ApplicationExtension
import com.android.build.api.dsl.LibraryExtension
import com.android.build.gradle.BaseExtension
import org.jetbrains.kotlin.gradle.plugin.extraProperties
allprojects {
repositories {
@@ -13,29 +13,37 @@ rootProject.layout.buildDirectory.value(newBuildDir)
subprojects {
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
project.layout.buildDirectory.value(newSubprojectBuildDir)
if (project.name != "app") {
project.evaluationDependsOn(":app")
// fix for verifyReleaseResources
// android_alarm_manager_plus 5.1.1's own build.gradle.kts only applies
// org.jetbrains.kotlin.android when AGP < 9, then unconditionally
// configures KotlinAndroidProjectExtension - which doesn't exist here
// on AGP 9+ unless we apply the plugin ourselves first.
if (project.name == "android_alarm_manager_plus") {
pluginManager.apply("org.jetbrains.kotlin.android")
// note(4831c0): taken from https://github.com/isar/isar/issues/1662
// note(4831c0): and adapted to kotlin
afterEvaluate {
if (plugins.hasPlugin("com.android.application") || plugins.hasPlugin("com.android.library")) {
val androidExtension = extensions.getByName("android") as BaseExtension
androidExtension.apply {
compileSdkVersion(35)
buildToolsVersion = "35.0.0"
}
}
afterEvaluate {
if (plugins.hasPlugin("com.android.library")) {
extensions.configure<LibraryExtension> {
compileSdk = 37
if (hasProperty("android")) {
val androidExtension = extensions.getByName("android") as BaseExtension
androidExtension.apply {
// Set namespace if it's not already set
if (!extraProperties.has("namespace")) {
extraProperties["namespace"] = project.group.toString()
}
}
}
}
// ===============================
project.layout.buildDirectory.value(newSubprojectBuildDir)
}
subprojects {
project.evaluationDependsOn(":app")
}
tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}
}

View File

@@ -1,20 +1,3 @@
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
# Disabled for faster config and incremental builds; re-enable if any dependency needs support-library
android.enableJetifier=false
# Build performance (cold and warm)
org.gradle.caching=true
org.gradle.parallel=true
# Configuration cache disabled: Flutter/AGP/Kotlin plugin not fully compatible (KotlinBaseApiPlugin / ProjectServices)
# org.gradle.configuration-cache=true
org.gradle.daemon=true
# Better Kotlin incremental compilation (warm builds)
kotlin.incremental.useClasspathSnapshot=true
# This builtInKotlin flag was added automatically by Flutter migrator
android.builtInKotlin=false
android.newDsl=false
# Prevent AGP 9.0+ build failures due to relocated build directory ProGuard path mismatches
android.proguard.failOnMissingFiles=false
android.enableJetifier=true

Some files were not shown because too many files have changed in this diff Show More