diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 5316cb2..5927722 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -15,10 +15,10 @@ jobs:
encodedString: ${{ secrets.KEYSTORE_BASE64 }}
- name: Create key.properties
run: |
- echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > filcnaplo/android/key.properties
- echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> filcnaplo/android/key.properties
- echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> filcnaplo/android/key.properties
- echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> filcnaplo/android/key.properties
+ echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > refilc/android/key.properties
+ echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> refilc/android/key.properties
+ echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> refilc/android/key.properties
+ echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> refilc/android/key.properties
- uses: actions/setup-java@v3
with:
distribution: "zulu"
@@ -32,7 +32,7 @@ jobs:
- name: Install dependencies
run: ./fix-pub.sh
- name: Build
- run: cd filcnaplo && ./build.sh
+ run: cd refilc && ./build.sh
- name: Upload Android Release
uses: actions/upload-artifact@v2
with:
diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml
index 604d8ea..c456926 100644
--- a/.github/workflows/ios.yml
+++ b/.github/workflows/ios.yml
@@ -46,7 +46,7 @@ jobs:
# Build and sign the ipa using a single flutter command
- name: Building IPA
- working-directory: filcnaplo
+ working-directory: refilc
run: bash build-ipa.sh
# Collect the file and upload as artifact
@@ -55,7 +55,7 @@ jobs:
with:
name: release-ipa
# Path to the release files
- path: filcnaplo/build/ios/ipa/*.ipa
+ path: refilc/build/ios/ipa/*.ipa
# Important! Cleanup: remove the certificate and provisioning profile from the runner!
- name: Clean up keychain and provisioning profile
diff --git a/.gitignore b/.gitignore
index eb2131f..b4db4b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,39 +1,56 @@
-filcnaplo/.flutter-plugins
-filcnaplo/.flutter-plugins-dependencies
-filcnaplo/pubspec.lock
-filcnaplo/.dart_tool/
-filcnaplo/android/
-filcnaplo/ios/
-filcnaplo/windows/
-filcnaplo/linux/
-filcnaplo/macos/
-filcnaplo/build/
+refilc/.flutter-plugins
+refilc/.flutter-plugins-dependencies
+refilc/pubspec.lock
+refilc/.dart_tool/
+# refilc/android/
+# refilc/ios/
+# refilc/windows/
+# refilc/linux/
+# refilc/macos/
+refilc/build/
+refilc/android/key.properties
+refilc/android/debug.keystore
-filcnaplo_desktop_ui/.flutter-plugins
-filcnaplo_desktop_ui/.flutter-plugins-dependencies
-filcnaplo_desktop_ui/pubspec.lock
-filcnaplo_desktop_ui/.dart_tool/
+refilc_desktop_ui/.flutter-plugins
+refilc_desktop_ui/.flutter-plugins-dependencies
+refilc_desktop_ui/pubspec.lock
+refilc_desktop_ui/.dart_tool/
-filcnaplo_kreta_api/.flutter-plugins
-filcnaplo_kreta_api/.flutter-plugins-dependencies
-filcnaplo_kreta_api/pubspec.lock
-filcnaplo_kreta_api/.dart_tool/
+refilc_kreta_api/.flutter-plugins
+refilc_kreta_api/.flutter-plugins-dependencies
+refilc_kreta_api/pubspec.lock
+refilc_kreta_api/.dart_tool/
-filcnaplo_mobile_ui/.flutter-plugins
-filcnaplo_mobile_ui/.flutter-plugins-dependencies
-filcnaplo_mobile_ui/pubspec.lock
-filcnaplo_mobile_ui/.dart_tool/
+refilc_mobile_ui/.flutter-plugins
+refilc_mobile_ui/.flutter-plugins-dependencies
+refilc_mobile_ui/pubspec.lock
+refilc_mobile_ui/.dart_tool/
-filcnaplo_premium/.flutter-plugins
-filcnaplo_premium/.flutter-plugins-dependencies
-filcnaplo_premium/pubspec.lock
-filcnaplo_premium/.dart_tool/
+# filcnaplo_premium/.flutter-plugins
+# filcnaplo_premium/.flutter-plugins-dependencies
+# filcnaplo_premium/pubspec.lock
+# filcnaplo_premium/.dart_tool/
.vscode
.github
.idea
.gitmodules
+.gradle
-filcnaplo/.DS_Store
+refilc/.DS_Store
.DS_Store
+refilc/linux/flutter/
+.plugin_symlinks/
+refilc/macos/Flutter/
+refilc/ios/Flutter/
+refilc/ios/Runner/GeneratedPluginRegistrant.h
+refilc/ios/Runner/GeneratedPluginRegistrant.m
+refilc/android/local.properties
+refilc/android/debugkey.properties
+refilc/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
+
+tool_logs/build/*.log
+tool_logs/d8dx_fix/*.log
+tool_logs/pub_fix/*.log
+refilc_mobile_ui/android/local.properties
diff --git a/.gitmodules b/.gitmodules
index 5253922..8cd5c43 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
[submodule "naplo-plus"]
- path = filcnaplo_premium
+ path = refilc_plus
url = git@github.com:refilc/naplo-plus.git
diff --git a/README.md b/README.md
index a297d87..7650e26 100644
--- a/README.md
+++ b/README.md
@@ -11,8 +11,10 @@
### Clone the project
+A teljes source eléréséhez szükséged lesz a naplo-plus repo-ra is, mely biztonsági okokból privát. Írj Discord szerverünkön, hogy kaphass hozzáférést.
+
```sh
-git clone https://github.com/refilc/naplo
+git clone --branch dev https://github.com/refilc/naplo --recursive
cd naplo
```
@@ -23,8 +25,8 @@ Run `fix-pub.sh`
### Run the app
```sh
-cd filcnaplo
-flutter run
+cd refilc
+flutter run (--release)
```
### Contribution
@@ -47,6 +49,4 @@ Az összes (ugyan azon verzióhoz tartozó) contribution meg fog jelenni a relea
**Péter:** video editor
-**annon:** a régi Filc Napló fejlesztője (ez az app, ha bár sokban változott, alapjaiban a Filc-re épül)
-
-Ez a projekt egy fork; az eredeti projektet megtaláljátok itt: [filc/naplo-archive](https://github.com/filc/naplo-archive) (köszi, annon)
+**annon:** a régi Filc Napló fejlesztője (ez az app, ha bár sokban változott, alapjaiban a Filc-re épül)
diff --git a/changelog.md b/changelog.md
deleted file mode 100644
index f01585f..0000000
--- a/changelog.md
+++ /dev/null
@@ -1,13 +0,0 @@
-What's new:
-
-- design tweak
-- new premium ui
-- premium fix
-- rounding fix
-- graph percentage fix
-- fail warning
-- Widget
-- fix sent messages
-- fix ios live activities
-- Hibajavítások 🐛
-- **Megérkezett a Filc Premium!** ✨
diff --git a/filcnaplo/.gitignore b/filcnaplo/.gitignore
deleted file mode 100644
index 24476c5..0000000
--- a/filcnaplo/.gitignore
+++ /dev/null
@@ -1,44 +0,0 @@
-# Miscellaneous
-*.class
-*.log
-*.pyc
-*.swp
-.DS_Store
-.atom/
-.buildlog/
-.history
-.svn/
-migrate_working_dir/
-
-# IntelliJ related
-*.iml
-*.ipr
-*.iws
-.idea/
-
-# The .vscode folder contains launch configuration and tasks you configure in
-# VS Code which you may wish to be included in version control, so this line
-# is commented out by default.
-#.vscode/
-
-# Flutter/Dart/Pub related
-**/doc/api/
-**/ios/Flutter/.last_build_id
-.dart_tool/
-.flutter-plugins
-.flutter-plugins-dependencies
-.packages
-.pub-cache/
-.pub/
-/build/
-
-# Symbolication related
-app.*.symbols
-
-# Obfuscation related
-app.*.map.json
-
-# Android Studio will place build artifacts here
-/android/app/debug
-/android/app/profile
-/android/app/release
diff --git a/filcnaplo/android/app/proguard-rules.pro b/filcnaplo/android/app/proguard-rules.pro
deleted file mode 100644
index 56fe627..0000000
--- a/filcnaplo/android/app/proguard-rules.pro
+++ /dev/null
@@ -1,5 +0,0 @@
--keep class io.flutter.plugin.editing.** { *; }
--keep class androidx.lifecycle.DefaultLifecycleObserver
--keep class com.pauldemarco.flutter_blue.** { *; }
--keep class com.mr.flutter.plugin.filepicker.** { *; }
--keep class com.shockwave.**
\ No newline at end of file
diff --git a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/MainActivity.java b/filcnaplo/android/app/src/main/java/hu/refilc/naplo/MainActivity.java
deleted file mode 100644
index ff22fb7..0000000
--- a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/MainActivity.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package hu.refilc.naplo;
-
-import io.flutter.embedding.android.FlutterActivity;
-
-public class MainActivity extends FlutterActivity {
-
-}
diff --git a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/database/DBManager.java b/filcnaplo/android/app/src/main/java/hu/refilc/naplo/database/DBManager.java
deleted file mode 100644
index b39409d..0000000
--- a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/database/DBManager.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package hu.refilc.naplo.database;
-
-import android.content.ContentValues;
-import android.content.Context;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-
-import java.sql.SQLException;
-
-import hu.refilc.naplo.database.SQLiteHelper;
-
-public class DBManager {
- private Context context;
- private SQLiteDatabase database;
- private SQLiteHelper dbHelper;
-
- public DBManager(Context c) {
- this.context = c;
- }
-
- public DBManager open() throws SQLException {
- this.dbHelper = new SQLiteHelper(this.context);
- this.database = this.dbHelper.getWritableDatabase();
- return this;
- }
-
- public void close() {
- this.dbHelper.close();
- }
-
- public Cursor fetchWidget(int wid) {
- Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_WIDGETS, new String[]{SQLiteHelper._ID, SQLiteHelper.DAY_SEL}, SQLiteHelper._ID + " = " + wid, null, null, null, null);
- if (cursor != null) {
- cursor.moveToFirst();
- }
- return cursor;
- }
-
- public Cursor fetchTimetable() {
- Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_USER_DATA, new String[]{SQLiteHelper.TIMETABLE}, null, null, null, null, null);
- if (cursor != null) {
- cursor.moveToFirst();
- }
- return cursor;
- }
-
- public Cursor fetchLastUser() {
- Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.LAST_ACCOUNT_ID}, null, null, null, null, null);
- if (cursor != null) {
- cursor.moveToFirst();
- }
- return cursor;
- }
-
- public Cursor fetchTheme() {
- Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.THEME, SQLiteHelper.ACCENT_COLOR}, null, null, null, null, null);
- if (cursor != null) {
- cursor.moveToFirst();
- }
- return cursor;
- }
-
- public Cursor fetchPremiumToken() {
- Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.PREMIUM_TOKEN}, null, null, null, null, null);
- if (cursor != null) {
- cursor.moveToFirst();
- }
- return cursor;
- }
-
- public Cursor fetchPremiumScopes() {
- Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.PREMIUM_SCOPES}, null, null, null, null, null);
- if (cursor != null) {
- cursor.moveToFirst();
- }
- return cursor;
- }
-
- public Cursor fetchLocale() {
- Cursor cursor = this.database.query(SQLiteHelper.TABLE_NAME_SETTINGS, new String[]{SQLiteHelper.LOCALE}, null, null, null, null, null);
- if (cursor != null) {
- cursor.moveToFirst();
- }
- return cursor;
- }
-
- public void deleteWidget(int _id) {
- this.database.delete(SQLiteHelper.TABLE_NAME_WIDGETS, "_id=" + _id, null);
- }
-
- /*public void changeSettings(int _id, Map map) {
- ContentValues con = new ContentValues();
- for(Map.Entry e: map.entrySet()){
- con.put(e.getKey(), e.getValue());
- }
- this.database.update(SQLiteHelper.TABLE_NAME_WIDGETS, con, "_id = " + _id, null);
- }
- public void insertSettings(int _id, Map map) {
- ContentValues con = new ContentValues();
- for(Map.Entry e: map.entrySet()){
- con.put(e.getKey(), e.getValue());
- //Log.d("Settings added", e.getKey() + " - " + e.getValue());
- }
- this.database.insert(SQLiteHelper.TABLE_NAME_WIDGETS, null, con);
- }*/
-
- public void insertSelDay(int _id, int day_sel) {
- ContentValues con = new ContentValues();
- con.put(SQLiteHelper._ID, _id);
- con.put(SQLiteHelper.DAY_SEL, day_sel);
- this.database.insert(SQLiteHelper.TABLE_NAME_WIDGETS, null, con);
- }
-
- public int update(int _id, int day_sel) {
- ContentValues con = new ContentValues();
- con.put(SQLiteHelper.DAY_SEL, day_sel);
- return this.database.update(SQLiteHelper.TABLE_NAME_WIDGETS, con, SQLiteHelper._ID + " = " + _id, null);
- }
-}
\ No newline at end of file
diff --git a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/database/SQLiteHelper.java b/filcnaplo/android/app/src/main/java/hu/refilc/naplo/database/SQLiteHelper.java
deleted file mode 100644
index 5944408..0000000
--- a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/database/SQLiteHelper.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package hu.refilc.naplo.database;
-
-import android.content.Context;
-import android.database.sqlite.SQLiteDatabase;
-import android.database.sqlite.SQLiteOpenHelper;
-
-public class SQLiteHelper extends SQLiteOpenHelper {
- private static final String CREATE_TABLE_WIDGET = " create table widgets ( _id INTEGER NOT NULL, day_sel INTEGER NOT NULL);";
- private static final String DB_NAME = "app.db";
- private static final int DB_VERSION = 1;
- public static final String _ID = "_id";
- public static final String DAY_SEL = "day_sel";
- public static final String TIMETABLE = "timetable";
- public static final String LAST_ACCOUNT_ID = "last_account_id";
- public static final String THEME = "theme";
- public static final String PREMIUM_TOKEN = "premium_token";
- public static final String PREMIUM_SCOPES = "premium_scopes";
- public static final String LOCALE = "language";
- public static final String ACCENT_COLOR = "accent_color";
- public static final String TABLE_NAME_WIDGETS = "widgets";
- public static final String TABLE_NAME_USER_DATA = "user_data";
- public static final String TABLE_NAME_SETTINGS = "settings";
-
- public SQLiteHelper(Context context) {
- super(context, DB_NAME, null, 7);
- }
-
- public void onCreate(SQLiteDatabase db) {
- db.execSQL(CREATE_TABLE_WIDGET);
- }
-
- public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
- db.execSQL("DROP TABLE IF EXISTS widgets");
- onCreate(db);
- }
-}
\ No newline at end of file
diff --git a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/utils/Utils.java b/filcnaplo/android/app/src/main/java/hu/refilc/naplo/utils/Utils.java
deleted file mode 100644
index 30f2a62..0000000
--- a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/utils/Utils.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package hu.refilc.naplo.utils;
-
-import android.content.Context;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-
-import java.util.Calendar;
-import java.util.Date;
-
-public class Utils {
- public static boolean hasNetwork(Context context) {
- ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
- NetworkInfo netInfo = cm.getActiveNetworkInfo();
- if (netInfo != null && netInfo.isConnectedOrConnecting()) {
- return true;
- }
- return false;
- }
-
- public static Date getWeekStartDate() {
- Calendar calendar = Calendar.getInstance();
- while (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
- calendar.add(Calendar.DATE, -1);
- }
- return calendar.getTime();
- }
-
- public static Date getWeekEndDate() {
- Calendar calendar = Calendar.getInstance();
- while (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
- calendar.add(Calendar.DATE, 1);
- }
- calendar.add(Calendar.DATE, -1);
- return calendar.getTime();
- }
-}
\ No newline at end of file
diff --git a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/utils/Week.java b/filcnaplo/android/app/src/main/java/hu/refilc/naplo/utils/Week.java
deleted file mode 100644
index 9f62c3e..0000000
--- a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/utils/Week.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package hu.refilc.naplo.utils;
-
-import java.time.DayOfWeek;
-import java.time.Duration;
-import java.time.LocalDate;
-
-public class Week {
- private final LocalDate start;
- private final LocalDate end;
-
- private Week(LocalDate start, LocalDate end) {
- this.start = start;
- this.end = end;
- }
-
- public static Week current() {
- return fromDate(LocalDate.now());
- }
-
- public static Week fromId(int id) {
- LocalDate _now = getYearStart().plusDays(id * 7L);
- return new Week(_now.minusDays(_now.getDayOfWeek().getValue() - 1), _now.plusDays(7 - _now.getDayOfWeek().getValue()));
- }
-
- public static Week fromDate(LocalDate date) {
-
- return new Week(date.minusDays(date.getDayOfWeek().getValue() - 1), date.plusDays(7 - date.getDayOfWeek().getValue()));
- }
-
- public Week next() {
- return Week.fromDate(start.plusDays(8));
- }
-
- public int id() {
- return (int) Math.ceil(Duration.between(getYearStart().atStartOfDay(), start.atStartOfDay()).toDays() / 7f);
- }
-
- private static LocalDate getYearStart() {
- LocalDate now = LocalDate.now();
- LocalDate start = getYearStart(now.getYear());
- return start.isBefore(now) ? start : getYearStart(now.getYear() -1);
- }
-
- private static LocalDate getYearStart(int year) {
- LocalDate time = LocalDate.of(year, 9, 1);
- if (time.getDayOfWeek() == DayOfWeek.SATURDAY)
- return time.plusDays(2);
- else if (time.getDayOfWeek() == DayOfWeek.SUNDAY)
- return time.plusDays(1);
- return time;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Week week = (Week) o;
- return this.id() == week.id();
- }
-
- @Override
- public int hashCode() {
- return id();
- }
-}
\ No newline at end of file
diff --git a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/widget_timetable/WidgetTimetable.java b/filcnaplo/android/app/src/main/java/hu/refilc/naplo/widget_timetable/WidgetTimetable.java
deleted file mode 100644
index b433ec7..0000000
--- a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/widget_timetable/WidgetTimetable.java
+++ /dev/null
@@ -1,392 +0,0 @@
-package hu.refilc.naplo.widget_timetable;
-
-import android.app.PendingIntent;
-import android.appwidget.AppWidgetManager;
-import android.appwidget.AppWidgetProvider;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.Build;
-import android.util.Log;
-import android.view.View;
-import android.widget.RemoteViews;
-import android.widget.Toast;
-
-import org.joda.time.DateTime;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.time.DayOfWeek;
-import java.time.format.TextStyle;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.HashMap;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import hu.refilc.naplo.database.DBManager;
-import hu.refilc.naplo.MainActivity;
-import hu.refilc.naplo.R;
-
-import hu.refilc.naplo.utils.Week;
-
-import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
-
-import es.antonborri.home_widget.HomeWidgetBackgroundIntent;
-import es.antonborri.home_widget.HomeWidgetLaunchIntent;
-import es.antonborri.home_widget.HomeWidgetProvider;
-
-public class WidgetTimetable extends HomeWidgetProvider {
-
- private static final String ACTION_WIDGET_CLICK_NAV_LEFT = "list_widget.ACTION_WIDGET_CLICK_NAV_LEFT";
- private static final String ACTION_WIDGET_CLICK_NAV_RIGHT = "list_widget.ACTION_WIDGET_CLICK_NAV_RIGHT";
- private static final String ACTION_WIDGET_CLICK_NAV_TODAY = "list_widget.ACTION_WIDGET_CLICK_NAV_TODAY";
- private static final String ACTION_WIDGET_CLICK_NAV_REFRESH = "list_widget.ACTION_WIDGET_CLICK_NAV_REFRESH";
- private static final String ACTION_WIDGET_CLICK_BUY_PREMIUM = "list_widget.ACTION_WIDGET_CLICK_BUY_PREMIUM";
-
- @Override
- public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds, SharedPreferences widgetData) {
- for (int i = 0; i < appWidgetIds.length; i++) {
- RemoteViews views = generateView(context, appWidgetIds[i]);
-
- if(premiumEnabled(context) && userLoggedIn(context)) {
- int rday = selectDay(context, appWidgetIds[i], 0, true);
- views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday));
- }
-
- pushUpdate(context, views, appWidgetIds[i]);
- }
- }
-
- public static void pushUpdate(Context context, RemoteViews remoteViews, int appWidgetSingleId) {
- AppWidgetManager manager = AppWidgetManager.getInstance(context);
-
- manager.updateAppWidget(appWidgetSingleId, remoteViews);
- manager.notifyAppWidgetViewDataChanged(appWidgetSingleId, R.id.widget_list);
- }
-
- public static RemoteViews generateView(Context context, int appId) {
- Intent serviceIntent = new Intent(context, WidgetTimetableService.class);
- serviceIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appId);
- serviceIntent.setData(Uri.parse(serviceIntent.toUri(Intent.URI_INTENT_SCHEME)));
-
- RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_timetable);
-
- views.setViewVisibility(R.id.need_premium, View.GONE);
- views.setViewVisibility(R.id.need_login, View.GONE);
- views.setViewVisibility(R.id.tt_grid_cont, View.GONE);
-
- if(!userLoggedIn(context)) {
- views.setViewVisibility(R.id.need_login, View.VISIBLE);
- views.setOnClickPendingIntent(R.id.open_login, makePending(context, ACTION_WIDGET_CLICK_BUY_PREMIUM, appId));
- } else if(premiumEnabled(context)) {
- views.setViewVisibility(R.id.tt_grid_cont, View.VISIBLE);
- views.setOnClickPendingIntent(R.id.nav_to_left, makePending(context, ACTION_WIDGET_CLICK_NAV_LEFT, appId));
- views.setOnClickPendingIntent(R.id.nav_to_right, makePending(context, ACTION_WIDGET_CLICK_NAV_RIGHT, appId));
- views.setOnClickPendingIntent(R.id.nav_current, makePending(context, ACTION_WIDGET_CLICK_NAV_TODAY, appId));
- views.setOnClickPendingIntent(R.id.nav_refresh, makePending(context, ACTION_WIDGET_CLICK_NAV_REFRESH, appId));
- views.setRemoteAdapter(R.id.widget_list, serviceIntent);
- views.setEmptyView(R.id.widget_list, R.id.empty_view);
- } else {
- views.setViewVisibility(R.id.need_premium, View.VISIBLE);
- views.setOnClickPendingIntent(R.id.buy_premium, makePending(context, ACTION_WIDGET_CLICK_BUY_PREMIUM, appId));
- }
-
- return views;
- }
-
- static PendingIntent makePending(Context context, String action, int appWidgetId) {
- Intent activebtnnext = new Intent(context, WidgetTimetable.class);
- activebtnnext.setAction(action);
- activebtnnext.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
- return PendingIntent.getBroadcast(context, appWidgetId, activebtnnext , PendingIntent.FLAG_IMMUTABLE);
- }
-
- @Override
- public void onReceive(Context context, Intent intent) {
- super.onReceive(context, intent);
-
- if(intent.hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID)) {
- int appId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
- RemoteViews views = generateView(context, appId);
-
- try {
- if(premiumEnabled(context) && userLoggedIn(context)) {
- if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_LEFT)) {
- int rday = selectDay(context, appId, -1, false);
- views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday));
-
- pushUpdate(context, views, appId);
- } else if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_RIGHT)) {
- int rday = selectDay(context, appId, 1, false);
- views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday));
-
- pushUpdate(context, views, appId);
- } else if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_TODAY)) {
- int rday = getToday(context);
- setSelectedDay(context, appId, rday);
-
- views.setTextViewText(R.id.nav_current, convertDayOfWeek(context, rday));
-
- pushUpdate(context, views, appId);
- } else if (intent.getAction().equals(ACTION_WIDGET_CLICK_NAV_REFRESH)) {
- PendingIntent pendingIntent = HomeWidgetLaunchIntent.INSTANCE.getActivity(context, MainActivity.class, Uri.parse("timetable://refresh"));
- pendingIntent.send();
- } else if (intent.getAction().equals("android.appwidget.action.APPWIDGET_DELETED")) {
- DBManager dbManager = new DBManager(context.getApplicationContext());
-
- try {
- dbManager.open();
- dbManager.deleteWidget(appId);
- dbManager.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- if(intent.getAction().equals(ACTION_WIDGET_CLICK_BUY_PREMIUM)) {
- PendingIntent pendingIntent = HomeWidgetLaunchIntent.INSTANCE.getActivity(context, MainActivity.class, Uri.parse("settings://premium"));
- pendingIntent.send();
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- public static String convertDayOfWeek(Context context, int rday) {
-
- /*if(rday == -1) return DayOfWeek.of(1).getDisplayName(TextStyle.FULL, new Locale("hu", "HU"));
-
- String dayOfWeek = DayOfWeek.of(rday + 1).getDisplayName(TextStyle.FULL, new Locale("hu", "HU"));*/
-
- String dayOfWeek = "Unknown";
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- Locale loc = getLocale(context);
-
- if (rday == -1)
- return DayOfWeek.of(1).getDisplayName(TextStyle.FULL, loc);
-
- dayOfWeek = DayOfWeek.of(rday + 1).getDisplayName(TextStyle.FULL, loc);
- }
-
- return dayOfWeek.substring(0, 1).toUpperCase() + dayOfWeek.substring(1).toLowerCase();
- }
-
- public static void setSelectedDay(Context context, int wid, int day) {
- DBManager dbManager = new DBManager(context.getApplicationContext());
-
- try {
- dbManager.open();
- dbManager.update(wid, day);
- dbManager.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public static int getToday(Context context) {
- int rday = new DateTime().getDayOfWeek() - 1;
- List s = genJsonDays(context);
-
- try {
- if(checkIsAfter(s, rday)) rday += 1;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return retDay(rday, s.size());
- }
-
- public static int selectDay(Context context, int wid, int add, Boolean afterSubjects) {
- DBManager dbManager = new DBManager(context.getApplicationContext());
-
- try {
- dbManager.open();
- Cursor cursor = dbManager.fetchWidget(wid);
-
- List s = genJsonDays(context);
- int retday = new DateTime().getDayOfWeek() - 1;
-
- if(cursor.getCount() != 0) retday = retDay(cursor.getInt(1) + add, s.size());
-
- if(afterSubjects) if(checkIsAfter(s, retday)) retday += 1;
- retday = retDay(retday, s.size());
-
- if(cursor.getCount() == 0) dbManager.insertSelDay(wid, retday);
- else dbManager.update(wid, retday);
-
- dbManager.close();
-
- return retday;
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return 0;
- }
-
- public static Boolean checkIsAfter(List s, int retday) throws Exception {
- retday = retDay(retday, s.size());
-
- String vegIdopont = s.get(retday).getJSONObject(s.get(retday).length() - 1).getString("VegIdopont");
-
- return new DateTime().isAfter(new DateTime(vegIdopont));
- }
-
- public static int retDay(int retday, int size) {
- if (retday < 0) retday = size - 1;
- else if (retday > size - 1) retday = 0;
-
- return retday;
- }
-
- public static List genJsonDays(Context context) {
- List genDays = new ArrayList<>();
- Map dayMap = new HashMap<>();
-
- DBManager dbManager = new DBManager(context.getApplicationContext());
-
- try {
- dbManager.open();
- Cursor ct = dbManager.fetchTimetable();
-
- if (ct.getCount() == 0) {
- return genDays;
- }
-
- JSONObject fetchedTimetable = new JSONObject(ct.getString(0));
- String currentWeek = String.valueOf(Week.current().id());
- JSONArray week = fetchedTimetable.getJSONArray(currentWeek);
-
- // Organize lessons into dates
- for (int i = 0; i < week.length(); i++) {
- try {
- JSONObject entry = week.getJSONObject(i);
- String date = entry.getString("Datum");
- dayMap.computeIfAbsent(date, k -> new JSONArray()).put(entry);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
-
- genDays.addAll(dayMap.values());
-
- // Sort the 'genDays' list of JSON based on the start time of the first entry
- genDays.sort((day1, day2) -> {
- try {
- // Extract the start time of the first entry in each day's JSON
- String startTime1 = day1.getJSONObject(0).getString("KezdetIdopont");
- String startTime2 = day2.getJSONObject(0).getString("KezdetIdopont");
- // Compare the start times and return the result for sorting
- return startTime1.compareTo(startTime2);
- } catch (JSONException e) {
- e.printStackTrace();
- return 0;
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- dbManager.close();
- }
-
- return genDays;
- }
-
-
-
- public static String zeroPad(int value, int padding){
- StringBuilder b = new StringBuilder();
- b.append(value);
- while(b.length() < padding){
- b.insert(0,"0");
- }
- return b.toString();
- }
-
- public static Locale getLocale(Context context) {
- DBManager dbManager = new DBManager(context.getApplicationContext());
-
- try {
- dbManager.open();
- String loc = dbManager.fetchLocale().getString(0);
- dbManager.close();
-
- if(loc.equals("hu") || loc.equals("de")) {
- return new Locale(loc, loc.toUpperCase());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return new Locale("en", "GB");
- }
-
- public static boolean premiumEnabled(Context context) {
- DBManager dbManager = new DBManager(context.getApplicationContext());
-
- try {
- dbManager.open();
- String premium_token = dbManager.fetchPremiumToken().getString(0);
- String premium_scopes_raw = dbManager.fetchPremiumScopes().getString(0);
- dbManager.close();
-
- JSONArray arr = new JSONArray(premium_scopes_raw);
- List premium_scopes = new ArrayList<>();
- for(int i = 0; i < arr.length(); i++){
- String scope = arr.getString(i);
- premium_scopes.add(scope.substring(scope.lastIndexOf('.') + 1));
- }
-
- if(!premium_token.equals("") && (premium_scopes.contains("*") || premium_scopes.contains("TIMETALBE_WIDGET"))) {
- return true;
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return false;
- }
-
- public static boolean userLoggedIn(Context context) {
- return !lastUserId(context).equals("");
- }
-
- public static String lastUserId(Context context) {
- DBManager dbManager = new DBManager(context.getApplicationContext());
- try {
- dbManager.open();
- Cursor cursor = dbManager.fetchLastUser();
- dbManager.close();
-
- if(cursor != null && !cursor.getString(0).equals("")) {
- String last_user = cursor.getString(0);
- return last_user;
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return "";
- }
-
- @Override
- public void onEnabled(Context context) {
- }
-
- @Override
- public void onDisabled(Context context) {
- }
-}
\ No newline at end of file
diff --git a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/widget_timetable/WidgetTimetableDataProvider.java b/filcnaplo/android/app/src/main/java/hu/refilc/naplo/widget_timetable/WidgetTimetableDataProvider.java
deleted file mode 100644
index 55eaa98..0000000
--- a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/widget_timetable/WidgetTimetableDataProvider.java
+++ /dev/null
@@ -1,356 +0,0 @@
-package hu.refilc.naplo.widget_timetable;
-
-import android.appwidget.AppWidgetManager;
-import android.content.Context;
-import android.content.Intent;
-import android.database.Cursor;
-import android.os.Build;
-import android.util.Log;
-import android.view.View;
-import android.widget.RemoteViews;
-import android.widget.RemoteViewsService;
-
-import org.joda.time.DateTime;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import hu.refilc.naplo.database.DBManager;
-import hu.refilc.naplo.R;
-
-public class WidgetTimetableDataProvider implements RemoteViewsService.RemoteViewsFactory {
-
- private Context context;
- private int appWidgetId;
-
- private int rday = 0;
-
- private int theme;
-
- private Integer[] colorValues;
-
- List day_subjects = new ArrayList<>();
- List lessonIndexes = new ArrayList<>();
-
- Item witem;
-
- /* Default values */
-
- static class Item {
- int Layout;
-
- int NumVisibility;
- int NameVisibility;
- int NameNodescVisibility;
- int DescVisibility;
- int RoomVisibility;
- int TimeVisibility;
-
- int NumColor;
- int NameColor;
- int NameNodescColor;
- int DescColor;
-
- Integer[] NameNodescPadding = {0, 0, 0, 0};
-
- public Item(int Layout, int NumVisibility,int NameVisibility,int NameNodescVisibility,int DescVisibility,int RoomVisibility,int TimeVisibility,int NumColor,int NameColor,int NameNodescColor,int DescColor) {
- this.Layout = Layout;
- this.NumVisibility = NumVisibility;
- this.NameVisibility = NameVisibility;
- this.NameNodescVisibility = NameNodescVisibility;
- this.DescVisibility = DescVisibility;
- this.RoomVisibility = RoomVisibility;
- this.TimeVisibility = TimeVisibility;
-
- this.NumColor = NumColor;
- this.NameColor = NameColor;
- this.NameNodescColor = NameNodescColor;
- this.DescColor = DescColor;
- }
- }
-
- static class Lesson {
- String status;
- String lessonIndex;
- String lessonName;
- String lessonTopic;
- String lessonRoom;
- long lessonStart;
- long lessonEnd;
- String substituteTeacher;
-
- public Lesson(String status, String lessonIndex,String lessonName,String lessonTopic, String lessonRoom,long lessonStart,long lessonEnd,String substituteTeacher) {
- this.status = status;
- this.lessonIndex = lessonIndex;
- this.lessonName = lessonName;
- this.lessonTopic = lessonTopic;
- this.lessonRoom = lessonRoom;
- this.lessonStart = lessonStart;
- this.lessonEnd = lessonEnd;
- this.substituteTeacher = substituteTeacher;
- }
- }
-
- Integer[] itemNameNodescPadding = {0, 0, 0, 0};
-
- public WidgetTimetableDataProvider(Context context, Intent intent) {
- this.context = context;
- this.appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
-
- this.theme = getThemeAccent(context);
-
- this.colorValues = new Integer[]{R.color.filc,
- R.color.blue_shade300,
- R.color.green_shade300,
- R.color.lime_shade300,
- R.color.yellow_shade300,
- R.color.orange_shade300,
- R.color.red_shade300,
- R.color.pink_shade300,
- R.color.purple_shade300};
-
- }
-
- @Override
- public void onCreate() {
- initData();
- }
-
- @Override
- public void onDataSetChanged() {
- initData();
- }
-
- @Override
- public void onDestroy() {
-
- }
-
- @Override
- public int getCount() {
-
- return day_subjects.size();
- }
-
- public void setLayout(final RemoteViews view) {
- /* Visibilities */
- view.setViewVisibility(R.id.tt_item_num, witem.NumVisibility);
- view.setViewVisibility(R.id.tt_item_name, witem.NameVisibility);
- view.setViewVisibility(R.id.tt_item_name_nodesc, witem.NameNodescVisibility);
- view.setViewVisibility(R.id.tt_item_desc, witem.DescVisibility);
- view.setViewVisibility(R.id.tt_item_room, witem.RoomVisibility);
- view.setViewVisibility(R.id.tt_item_time, witem.TimeVisibility);
-
- /* backgroundResources */
- view.setInt(R.id.main_lay, "setBackgroundResource", witem.Layout);
-
- /* Paddings */
- view.setViewPadding(R.id.tt_item_name_nodesc, witem.NameNodescPadding[0], witem.NameNodescPadding[1], witem.NameNodescPadding[2], witem.NameNodescPadding[3]);
-
- /* Text Colors */
- view.setInt(R.id.tt_item_num, "setTextColor", getColor(context, witem.NumColor));
- view.setInt(R.id.tt_item_name, "setTextColor", getColor(context, witem.NameColor));
- view.setInt(R.id.tt_item_name_nodesc, "setTextColor", getColor(context, witem.NameNodescColor));
- view.setInt(R.id.tt_item_desc, "setTextColor", getColor(context, witem.DescColor));
- }
-
- public int getColor(Context context, int color) {
- return context.getResources().getColor(color);
- }
-
- @Override
- public RemoteViews getViewAt(int position) {
- RemoteViews view = new RemoteViews(context.getPackageName(), R.layout.timetable_item);
-
- witem = defaultItem(theme);
-
- Lesson curr_subject = day_subjects.get(position);
-
- if (curr_subject.status.equals("empty")) {
- witem.NumColor = R.color.text_miss_num;
-
- witem.TimeVisibility = View.GONE;
- witem.RoomVisibility = View.GONE;
-
- witem.NameNodescColor = R.color.text_miss;
- }
-
- if (!curr_subject.substituteTeacher.equals("null")) {
- witem.NumColor = R.color.yellow;
- witem.Layout = R.drawable.card_layout_tile_helyetesitett;
- }
-
- if (curr_subject.status.equals("Elmaradt")) {
- witem.NumColor = R.color.red;
- witem.Layout = R.drawable.card_layout_tile_elmarad;
- } else if (curr_subject.status.equals("TanevRendjeEsemeny")) {
- witem.NumVisibility = View.GONE;
- witem.TimeVisibility = View.GONE;
- witem.RoomVisibility = View.GONE;
-
- witem.NameNodescPadding[0] = 50;
- witem.NameNodescPadding[2] = 50;
-
- witem.NameNodescColor = R.color.text_miss;
- }
-
- if (curr_subject.lessonTopic.equals("null")) {
- witem.DescVisibility = View.GONE;
- witem.NameVisibility = View.GONE;
-
- witem.NameNodescVisibility = View.VISIBLE;
- }
-
- setLayout(view);
-
- String lessonIndexTrailing = curr_subject.lessonIndex.equals("+") ? "" : ".";
-
- view.setTextViewText(R.id.tt_item_num, curr_subject.lessonIndex + lessonIndexTrailing);
- view.setTextViewText(R.id.tt_item_name, curr_subject.lessonName);
- view.setTextViewText(R.id.tt_item_name_nodesc, curr_subject.lessonName);
- view.setTextViewText(R.id.tt_item_desc, curr_subject.lessonTopic);
- view.setTextViewText(R.id.tt_item_room, curr_subject.lessonRoom);
- if(curr_subject.lessonStart != 0 && curr_subject.lessonEnd != 0)
- view.setTextViewText(R.id.tt_item_time, WidgetTimetable.zeroPad(new DateTime(curr_subject.lessonStart).getHourOfDay(), 2) + ":" + WidgetTimetable.zeroPad(new DateTime(curr_subject.lessonStart).getMinuteOfHour(), 2) +
- "\n" + WidgetTimetable.zeroPad(new DateTime(curr_subject.lessonEnd).getHourOfDay(), 2) + ":" + WidgetTimetable.zeroPad(new DateTime(curr_subject.lessonEnd).getMinuteOfHour(),2));
-
- return view;
- }
-
- @Override
- public RemoteViews getLoadingView() {
- return null;
- }
-
- @Override
- public int getViewTypeCount() {
- return 1;
- }
-
- @Override
- public long getItemId(int position) {
- return position;
- }
-
- @Override
- public boolean hasStableIds() {
- return true;
- }
-
- private void initData() {
-
- theme = getThemeAccent(context);
-
- rday = WidgetTimetable.selectDay(context, appWidgetId, 0, false);
-
- day_subjects.clear();
- lessonIndexes.clear();
-
- try {
- List arr = WidgetTimetable.genJsonDays(context);
-
- if(arr.isEmpty()) {
- return;
- }
- JSONArray arr_lessons = WidgetTimetable.genJsonDays(context).get(rday);
-
- for (int i = 0; i < arr_lessons.length(); i++) {
- JSONObject obj_lessons = arr_lessons.getJSONObject(i);
-
- day_subjects.add(jsonToLesson(obj_lessons));
- }
- } catch (JSONException e) {
- e.printStackTrace();
- }
-
- if(day_subjects.size() > 0) {
- Collections.sort(day_subjects, new Comparator() {
- public int compare(Lesson o1, Lesson o2) {
- return new DateTime(o1.lessonStart).compareTo(new DateTime(o2.lessonStart));
- }
- });
-
- for (int i = 0; i < day_subjects.size(); i++) {
- if(!day_subjects.get(i).lessonIndex.equals("+")) {
- lessonIndexes.add(Integer.valueOf(day_subjects.get(i).lessonIndex));
- }
- }
-
- if(lessonIndexes.size() > 0) {
-
- int lessonsChecked = Collections.min(lessonIndexes);
- int i = 0;
-
- while(lessonsChecked < Collections.max(lessonIndexes)) {
- if(!lessonIndexes.contains(lessonsChecked)) {
- day_subjects.add(i, emptyLesson(lessonsChecked));
- }
- lessonsChecked++;
- i++;
- }
- }
- }
- }
-
- public static Integer getThemeAccent(Context context) {
- DBManager dbManager = new DBManager(context.getApplicationContext());
-
- try {
- dbManager.open();
- Cursor cursor = dbManager.fetchTheme();
- dbManager.close();
-
- return cursor.getInt(1);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return 0;
- }
-
- public Item defaultItem(int theme) {
- return new Item(
- R.drawable.card_layout_tile,
- View.VISIBLE,
- View.VISIBLE,
- View.INVISIBLE,
- View.VISIBLE,
- View.VISIBLE,
- View.VISIBLE,
- colorValues[theme >= colorValues.length ? 0 : theme],
- R.color.text,
- R.color.text,
- R.color.text_desc
- );
- }
-
- public Lesson emptyLesson(int lessonIndex) {
- return new Lesson("empty", String.valueOf(lessonIndex), "Lyukasóra", "null", "null", 0, 0, "null");
- }
-
- public Lesson jsonToLesson(JSONObject json) {
- try {
- String name = json.getString("Nev");
- name = name.substring(0, 1).toUpperCase() + name.substring(1); // Capitalize name
- return new Lesson(
- json.getJSONObject("Allapot").getString("Nev"),
- !json.getString("Oraszam").equals("null") ? json.getString("Oraszam") : "+",
- name,
- json.getString("Tema"),
- json.getString("TeremNeve"),
- new DateTime(json.getString("KezdetIdopont")).getMillis(),
- new DateTime(json.getString("VegIdopont")).getMillis(),
- json.getString("HelyettesTanarNeve")
- );
- }catch (Exception e) {
- Log.d("Filc", "exception: " + e);
- };
-
- return null;
- }
-}
\ No newline at end of file
diff --git a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/widget_timetable/WidgetTimetableService.java b/filcnaplo/android/app/src/main/java/hu/refilc/naplo/widget_timetable/WidgetTimetableService.java
deleted file mode 100644
index 1864174..0000000
--- a/filcnaplo/android/app/src/main/java/hu/refilc/naplo/widget_timetable/WidgetTimetableService.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package hu.refilc.naplo.widget_timetable;
-
-import android.content.Intent;
-import android.os.Build;
-import android.widget.RemoteViewsService;
-
-public class WidgetTimetableService extends RemoteViewsService {
- @Override
- public RemoteViewsFactory onGetViewFactory(Intent intent) {
- return new WidgetTimetableDataProvider(getApplicationContext(), intent);
- }
-}
\ No newline at end of file
diff --git a/filcnaplo/android/app/src/main/res/drawable-hdpi/android12splash.png b/filcnaplo/android/app/src/main/res/drawable-hdpi/android12splash.png
deleted file mode 100644
index 42f64fb..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-hdpi/android12splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png b/filcnaplo/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png
deleted file mode 100644
index 314c878..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-hdpi/splash.png b/filcnaplo/android/app/src/main/res/drawable-hdpi/splash.png
deleted file mode 100644
index 42f64fb..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-hdpi/splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-mdpi/android12splash.png b/filcnaplo/android/app/src/main/res/drawable-mdpi/android12splash.png
deleted file mode 100644
index 65928ee..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-mdpi/android12splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png b/filcnaplo/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png
deleted file mode 100644
index aa13b85..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-mdpi/splash.png b/filcnaplo/android/app/src/main/res/drawable-mdpi/splash.png
deleted file mode 100644
index 65928ee..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-mdpi/splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-night-hdpi/android12splash.png b/filcnaplo/android/app/src/main/res/drawable-night-hdpi/android12splash.png
deleted file mode 100644
index 42f64fb..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-night-hdpi/android12splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-night-mdpi/android12splash.png b/filcnaplo/android/app/src/main/res/drawable-night-mdpi/android12splash.png
deleted file mode 100644
index 65928ee..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-night-mdpi/android12splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-night-xhdpi/android12splash.png b/filcnaplo/android/app/src/main/res/drawable-night-xhdpi/android12splash.png
deleted file mode 100644
index 8147fe6..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-night-xhdpi/android12splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-night-xxhdpi/android12splash.png b/filcnaplo/android/app/src/main/res/drawable-night-xxhdpi/android12splash.png
deleted file mode 100644
index 80a42fb..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-night-xxhdpi/android12splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-night-xxxhdpi/android12splash.png b/filcnaplo/android/app/src/main/res/drawable-night-xxxhdpi/android12splash.png
deleted file mode 100644
index 2148f7f..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-night-xxxhdpi/android12splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-v21/background.png b/filcnaplo/android/app/src/main/res/drawable-v21/background.png
deleted file mode 100644
index d90316e..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-v21/background.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-xhdpi/android12splash.png b/filcnaplo/android/app/src/main/res/drawable-xhdpi/android12splash.png
deleted file mode 100644
index 8147fe6..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-xhdpi/android12splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png b/filcnaplo/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png
deleted file mode 100644
index a83f396..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-xhdpi/splash.png b/filcnaplo/android/app/src/main/res/drawable-xhdpi/splash.png
deleted file mode 100644
index 8147fe6..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-xhdpi/splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-xxhdpi/android12splash.png b/filcnaplo/android/app/src/main/res/drawable-xxhdpi/android12splash.png
deleted file mode 100644
index 80a42fb..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-xxhdpi/android12splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png b/filcnaplo/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png
deleted file mode 100644
index 1de7a46..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-xxhdpi/splash.png b/filcnaplo/android/app/src/main/res/drawable-xxhdpi/splash.png
deleted file mode 100644
index 80a42fb..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-xxhdpi/splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-xxxhdpi/android12splash.png b/filcnaplo/android/app/src/main/res/drawable-xxxhdpi/android12splash.png
deleted file mode 100644
index 2148f7f..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-xxxhdpi/android12splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png b/filcnaplo/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png
deleted file mode 100644
index beeae31..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable-xxxhdpi/splash.png b/filcnaplo/android/app/src/main/res/drawable-xxxhdpi/splash.png
deleted file mode 100644
index 2148f7f..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable-xxxhdpi/splash.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/drawable/background.png b/filcnaplo/android/app/src/main/res/drawable/background.png
deleted file mode 100644
index d90316e..0000000
Binary files a/filcnaplo/android/app/src/main/res/drawable/background.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/filcnaplo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100644
index 7144abf..0000000
Binary files a/filcnaplo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/filcnaplo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100644
index 0e55b88..0000000
Binary files a/filcnaplo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/filcnaplo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100644
index 83ad190..0000000
Binary files a/filcnaplo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/filcnaplo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted file mode 100644
index 26c3c81..0000000
Binary files a/filcnaplo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/filcnaplo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/filcnaplo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
deleted file mode 100644
index 9ef3354..0000000
Binary files a/filcnaplo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ
diff --git a/filcnaplo/android/settings.gradle b/filcnaplo/android/settings.gradle
deleted file mode 100644
index 33f0745..0000000
--- a/filcnaplo/android/settings.gradle
+++ /dev/null
@@ -1,11 +0,0 @@
-include ':app'
-
-def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
-def properties = new Properties()
-
-assert localPropertiesFile.exists()
-localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
-
-def flutterSdkPath = properties.getProperty("flutter.sdk")
-assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
-apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
diff --git a/filcnaplo/assets/icons/ic_android.png b/filcnaplo/assets/icons/ic_android.png
deleted file mode 100644
index f274933..0000000
Binary files a/filcnaplo/assets/icons/ic_android.png and /dev/null differ
diff --git a/filcnaplo/assets/icons/ic_launcher.png b/filcnaplo/assets/icons/ic_launcher.png
deleted file mode 100644
index 154065b..0000000
Binary files a/filcnaplo/assets/icons/ic_launcher.png and /dev/null differ
diff --git a/filcnaplo/assets/icons/ic_launcher_foreground.png b/filcnaplo/assets/icons/ic_launcher_foreground.png
deleted file mode 100644
index a6d9eab..0000000
Binary files a/filcnaplo/assets/icons/ic_launcher_foreground.png and /dev/null differ
diff --git a/filcnaplo/assets/icons/ic_launcher_monochrome.png b/filcnaplo/assets/icons/ic_launcher_monochrome.png
deleted file mode 100644
index 29efac3..0000000
Binary files a/filcnaplo/assets/icons/ic_launcher_monochrome.png and /dev/null differ
diff --git a/filcnaplo/assets/icons/ic_splash.png b/filcnaplo/assets/icons/ic_splash.png
deleted file mode 100644
index 6fdfa13..0000000
Binary files a/filcnaplo/assets/icons/ic_splash.png and /dev/null differ
diff --git a/filcnaplo/assets/images/card_border.png b/filcnaplo/assets/images/card_border.png
deleted file mode 100644
index 5df72be..0000000
Binary files a/filcnaplo/assets/images/card_border.png and /dev/null differ
diff --git a/filcnaplo/assets/images/heart.png b/filcnaplo/assets/images/heart.png
deleted file mode 100644
index a219089..0000000
Binary files a/filcnaplo/assets/images/heart.png and /dev/null differ
diff --git a/filcnaplo/assets/images/logo.png b/filcnaplo/assets/images/logo.png
deleted file mode 100644
index 20b717e..0000000
Binary files a/filcnaplo/assets/images/logo.png and /dev/null differ
diff --git a/filcnaplo/assets/images/static_confetti.png b/filcnaplo/assets/images/static_confetti.png
deleted file mode 100644
index a9450ed..0000000
Binary files a/filcnaplo/assets/images/static_confetti.png and /dev/null differ
diff --git a/filcnaplo/assets/images/subject_covers/math_light.png b/filcnaplo/assets/images/subject_covers/math_light.png
deleted file mode 100644
index eb3e2f5..0000000
Binary files a/filcnaplo/assets/images/subject_covers/math_light.png and /dev/null differ
diff --git a/filcnaplo/assets/launch_icons/refilc_concept.png b/filcnaplo/assets/launch_icons/refilc_concept.png
deleted file mode 100644
index bc031ab..0000000
Binary files a/filcnaplo/assets/launch_icons/refilc_concept.png and /dev/null differ
diff --git a/filcnaplo/assets/launch_icons/refilc_default.png b/filcnaplo/assets/launch_icons/refilc_default.png
deleted file mode 100644
index ab54f58..0000000
Binary files a/filcnaplo/assets/launch_icons/refilc_default.png and /dev/null differ
diff --git a/filcnaplo/assets/launch_icons/refilc_overcomplicated.png b/filcnaplo/assets/launch_icons/refilc_overcomplicated.png
deleted file mode 100644
index de1f125..0000000
Binary files a/filcnaplo/assets/launch_icons/refilc_overcomplicated.png and /dev/null differ
diff --git a/filcnaplo/assets/launch_icons/refilc_pride.png b/filcnaplo/assets/launch_icons/refilc_pride.png
deleted file mode 100644
index 2b1a305..0000000
Binary files a/filcnaplo/assets/launch_icons/refilc_pride.png and /dev/null differ
diff --git a/filcnaplo/ios/Runner/AppDelegate.swift b/filcnaplo/ios/Runner/AppDelegate.swift
deleted file mode 100644
index 028b1bd..0000000
--- a/filcnaplo/ios/Runner/AppDelegate.swift
+++ /dev/null
@@ -1,25 +0,0 @@
-import UIKit
-import Flutter
-
-@UIApplicationMain
-@objc class AppDelegate: FlutterAppDelegate {
- override func application(
- _ application: UIApplication,
- didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
- ) -> Bool {
- GeneratedPluginRegistrant.register(with: self)
-
- // here, Without this code the task will not work.
- //SwiftFlutterForegroundTaskPlugin.setPluginRegistrantCallback(registerPlugins)
- if #available(iOS 10.0, *) {
- UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
- }
-
- return super.application(application, didFinishLaunchingWithOptions: launchOptions)
- }
-}
-
-// here
-func registerPlugins(registry: FlutterPluginRegistry) {
- GeneratedPluginRegistrant.register(with: registry)
-}
diff --git a/filcnaplo/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png b/filcnaplo/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png
deleted file mode 100644
index d90316e..0000000
Binary files a/filcnaplo/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png and /dev/null differ
diff --git a/filcnaplo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/filcnaplo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
deleted file mode 100644
index 65928ee..0000000
Binary files a/filcnaplo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png and /dev/null differ
diff --git a/filcnaplo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/filcnaplo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
deleted file mode 100644
index 8147fe6..0000000
Binary files a/filcnaplo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png and /dev/null differ
diff --git a/filcnaplo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/filcnaplo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
deleted file mode 100644
index 80a42fb..0000000
Binary files a/filcnaplo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png and /dev/null differ
diff --git a/filcnaplo/ios/livecard/lesson_model.swift b/filcnaplo/ios/livecard/lesson_model.swift
deleted file mode 100644
index 3f9e2d0..0000000
--- a/filcnaplo/ios/livecard/lesson_model.swift
+++ /dev/null
@@ -1,31 +0,0 @@
-import Foundation
-
-class LessonData {
- var color: String
- var icon: String
- var index: String
- var title: String
- var subtitle: String
- var description: String
- var startDate: Date
- var endDate: Date
- var date: ClosedRange
- var nextSubject: String
- var nextRoom: String
-
- init?() {
- let sharedDefault = UserDefaults(suiteName: "group.refilc2.livecard")!
-
- self.color = sharedDefault.string(forKey: "color")!
- self.icon = sharedDefault.string(forKey: "icon")!
- self.index = sharedDefault.string(forKey: "index")!
- self.title = sharedDefault.string(forKey: "title")!
- self.subtitle = sharedDefault.string(forKey: "subtitle")!
- self.description = sharedDefault.string(forKey: "description")!
- self.startDate = Date(timeIntervalSince1970: Double(sharedDefault.string(forKey: "startDate")!)! / 1000)
- self.endDate = Date(timeIntervalSince1970: Double(sharedDefault.string(forKey: "endDate")!)! / 1000)
- date = self.startDate...self.endDate
- self.nextSubject = sharedDefault.string(forKey: "nextSubject")!
- self.nextRoom = sharedDefault.string(forKey: "nextRoom")!
- }
-}
diff --git a/filcnaplo/ios/livecard/livecard.swift b/filcnaplo/ios/livecard/livecard.swift
deleted file mode 100644
index f873311..0000000
--- a/filcnaplo/ios/livecard/livecard.swift
+++ /dev/null
@@ -1,205 +0,0 @@
-import ActivityKit
-import WidgetKit
-import SwiftUI
-
-@main
-struct Widgets: WidgetBundle {
- var body: some Widget {
- if #available(iOS 16.1, *) {
- LiveCardWidget()
- }
- }
-}
-
-// Color Converter
-extension Color {
- init(hex: String, alpha: Double = 1.0) {
- var hexValue = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
-
- if hexValue.hasPrefix("#") {
- hexValue.remove(at: hexValue.startIndex)
- }
-
- var rgbValue: UInt64 = 0
- Scanner(string: hexValue).scanHexInt64(&rgbValue)
-
- let red = Double((rgbValue & 0xFF0000) >> 16) / 255.0
- let green = Double((rgbValue & 0x00FF00) >> 8) / 255.0
- let blue = Double(rgbValue & 0x0000FF) / 255.0
-
- self.init(
- .sRGB,
- red: red,
- green: green,
- blue: blue,
- opacity: alpha
- )
- }
-}
-
-
-// We need to redefined live activities pipe
-struct LiveActivitiesAppAttributes: ActivityAttributes, Identifiable {
- public struct ContentState: Codable, Hashable { }
-
- var id = UUID()
-}
-
-struct LockScreenLiveActivityView: View {
- let context: ActivityViewContext
-
- let lesson = LessonData()
-
- var body: some View {
- HStack(alignment: .center) {
- Image(systemName: lesson!.icon)
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(width: CGFloat(30), height: CGFloat(30))
- .padding(.leading, CGFloat(24))
-
- VStack(alignment: .leading) {
- HStack(alignment: .center) {
- Text(lesson!.index + lesson!.title)
- .font(.title3)
- .bold()
-
- Text(lesson!.subtitle)
- .font(.subheadline)
- .padding(.trailing, 12)
- }
-
- if (lesson!.description != "") {
- Text(lesson!.description)
- .font(.subheadline)
- }
-
- HStack {
- Image(systemName: "arrow.right")
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(width: CGFloat(8), height: CGFloat(8))
- Text(lesson!.nextSubject)
- .font(.caption)
- Text(lesson!.nextRoom)
- .font(.caption2)
- }
- }.padding(15)
-
- Spacer()
-
- Text(timerInterval: lesson!.date, countsDown: true)
- .multilineTextAlignment(.center)
- .frame(width: 85)
- .font(.title2)
- .monospacedDigit()
- .padding(.trailing, CGFloat(24))
- }
- .activityBackgroundTint(
- lesson!.color != "#676767"
- ? Color(hex: lesson!.color)
- // Ha nem megy hat nem megy
- : Color.clear
- )
- }
-}
-
-@available(iOSApplicationExtension 16.1, *)
-struct LiveCardWidget: Widget {
- var body: some WidgetConfiguration {
- /// Live Activity Notification
- ActivityConfiguration(for: LiveActivitiesAppAttributes.self) { context in
- LockScreenLiveActivityView(context: context)
- /// Dynamic Island
- } dynamicIsland: { context in
- let lesson = LessonData()
-
- /// Expanded
- return DynamicIsland {
- DynamicIslandExpandedRegion(.leading) {
- VStack {
- Spacer()
- ProgressView(
- timerInterval: lesson!.date,
- countsDown: true,
- label: {
- Image(systemName: lesson!.icon)
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(width: CGFloat(32), height: CGFloat(32))
- },
- currentValueLabel: {
- Image(systemName: lesson!.icon)
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(width: CGFloat(32), height: CGFloat(32))
- }
- ).progressViewStyle(.circular)
- }
- }
- DynamicIslandExpandedRegion(.center) {
- VStack(alignment: .leading) {
- Text(lesson!.index + lesson!.title)
- .lineLimit(1)
- .font(.title3)
- .bold()
-
- Text(lesson!.description)
- .lineLimit(2)
- .font(.caption)
- }.padding(EdgeInsets(top: 0.0, leading: 5.0, bottom: 0.0, trailing: 0.0))
- }
- DynamicIslandExpandedRegion(.trailing) {
- VStack {
- Spacer()
- Text(lesson!.subtitle)
- .lineLimit(1)
- .font(.subheadline)
- Spacer()
- }
- }
-
- /// Compact
- } compactLeading: {
- Label {
- Text(lesson!.title)
- } icon: {
- Image(systemName: lesson!.icon)
- }
- .font(.caption2)
- }
- compactTrailing: {
- Text(timerInterval: lesson!.date, countsDown: true)
- .multilineTextAlignment(.center)
- .frame(width: 40)
- .font(.caption2)
-
- /// Collapsed
- } minimal: {
- VStack(alignment: .center, content: {
- ProgressView(
- timerInterval: lesson!.date,
- countsDown: true,
- label: {
- Image(systemName: lesson!.icon)
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(width: CGFloat(12), height: CGFloat(12))
- },
- currentValueLabel: {
- Image(systemName: lesson!.icon)
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(width: CGFloat(12), height: CGFloat(12))
- }
- ).progressViewStyle(.circular)
- })
- }
- .keylineTint(
- lesson!.color != "#676767"
- ? Color(hex: lesson!.color)
- : Color.clear
- )
- }
- }
-}
diff --git a/filcnaplo/lib/api/login.dart b/filcnaplo/lib/api/login.dart
deleted file mode 100644
index 0d2f1cc..0000000
--- a/filcnaplo/lib/api/login.dart
+++ /dev/null
@@ -1,191 +0,0 @@
-// ignore_for_file: avoid_print, use_build_context_synchronously
-
-import 'package:filcnaplo/utils/jwt.dart';
-import 'package:filcnaplo_kreta_api/models/school.dart';
-import 'package:filcnaplo_kreta_api/providers/absence_provider.dart';
-import 'package:filcnaplo_kreta_api/providers/event_provider.dart';
-import 'package:filcnaplo_kreta_api/providers/exam_provider.dart';
-import 'package:filcnaplo_kreta_api/providers/grade_provider.dart';
-import 'package:filcnaplo_kreta_api/providers/homework_provider.dart';
-import 'package:filcnaplo_kreta_api/providers/message_provider.dart';
-import 'package:filcnaplo_kreta_api/providers/note_provider.dart';
-import 'package:filcnaplo_kreta_api/providers/timetable_provider.dart';
-import 'package:filcnaplo/api/providers/user_provider.dart';
-import 'package:filcnaplo/api/providers/database_provider.dart';
-import 'package:filcnaplo/models/settings.dart';
-import 'package:filcnaplo/models/user.dart';
-import 'package:filcnaplo_kreta_api/client/api.dart';
-import 'package:filcnaplo_kreta_api/client/client.dart';
-import 'package:filcnaplo_kreta_api/models/student.dart';
-import 'package:filcnaplo_kreta_api/models/week.dart';
-import 'package:flutter/material.dart';
-import 'package:provider/provider.dart';
-import 'package:filcnaplo/api/nonce.dart';
-import 'package:uuid/uuid.dart';
-
-enum LoginState {
- missingFields,
- invalidGrant,
- failed,
- normal,
- inProgress,
- success,
-}
-
-Nonce getNonce(String nonce, String username, String instituteCode) {
- Nonce nonceEncoder = Nonce(
- key: [98, 97, 83, 115, 120, 79, 119, 108, 85, 49, 106, 77], nonce: nonce);
- nonceEncoder
- .encode(instituteCode.toUpperCase() + nonce + username.toUpperCase());
-
- return nonceEncoder;
-}
-
-Future loginAPI({
- required String username,
- required String password,
- required String instituteCode,
- required BuildContext context,
- void Function(User)? onLogin,
- void Function()? onSuccess,
-}) async {
- Future testLogin(School school) async {
- var user = User(
- username: username,
- password: password,
- instituteCode: instituteCode,
- name: 'Teszt Lajos',
- student: Student(
- birth: DateTime.now(),
- id: const Uuid().v4(),
- name: 'Teszt Lajos',
- school: school,
- yearId: '1',
- parents: ['Teszt András', 'Teszt Linda'],
- json: {"a": "b"},
- address: '1117 Budapest, Gábor Dénes utca 4.',
- ),
- role: Role.parent,
- );
-
- if (onLogin != null) onLogin(user);
-
- // store test user in db
- await Provider.of(context, listen: false)
- .store
- .storeUser(user);
- Provider.of(context, listen: false).addUser(user);
- Provider.of(context, listen: false).setUser(user.id);
-
- if (onSuccess != null) onSuccess();
-
- return LoginState.success;
- }
-
- // if institute matches one of test things do test login
- if (instituteCode == 'refilc-test-sweden') {
- School school = School(
- city: "Stockholm",
- instituteCode: "refilc-test-sweden",
- name: "reFilc Test SE - Leo Ekström High School",
- );
-
- await testLogin(school);
- } else if (instituteCode == 'refilc-test-spain') {
- School school = School(
- city: "Madrid",
- instituteCode: "refilc-test-spain",
- name: "reFilc Test ES - Emilio Obrero University",
- );
-
- await testLogin(school);
- } else {
- // normal login from here
- Provider.of(context, listen: false).userAgent =
- Provider.of(context, listen: false).config.userAgent;
-
- Map headers = {
- "content-type": "application/x-www-form-urlencoded",
- };
-
- String nonceStr = await Provider.of(context, listen: false)
- .getAPI(KretaAPI.nonce, json: false);
-
- Nonce nonce = getNonce(nonceStr, username, instituteCode);
- headers.addAll(nonce.header());
-
- Map? res = await Provider.of(context, listen: false)
- .postAPI(KretaAPI.login,
- headers: headers,
- body: User.loginBody(
- username: username,
- password: password,
- instituteCode: instituteCode,
- ));
- if (res != null) {
- if (res.containsKey("error")) {
- if (res["error"] == "invalid_grant") {
- return LoginState.invalidGrant;
- }
- } else {
- if (res.containsKey("access_token")) {
- try {
- Provider.of(context, listen: false).accessToken =
- res["access_token"];
- Map? studentJson =
- await Provider.of(context, listen: false)
- .getAPI(KretaAPI.student(instituteCode));
- Student student = Student.fromJson(studentJson!);
- var user = User(
- username: username,
- password: password,
- instituteCode: instituteCode,
- name: student.name,
- student: student,
- role: JwtUtils.getRoleFromJWT(res["access_token"])!,
- );
-
- if (onLogin != null) onLogin(user);
-
- // Store User in the database
- await Provider.of(context, listen: false)
- .store
- .storeUser(user);
- Provider.of(context, listen: false).addUser(user);
- Provider.of(context, listen: false).setUser(user.id);
-
- // Get user data
- try {
- await Future.wait([
- Provider.of(context, listen: false).fetch(),
- Provider.of(context, listen: false)
- .fetch(week: Week.current()),
- Provider.of(context, listen: false).fetch(),
- Provider.of(context, listen: false).fetch(),
- Provider.of(context, listen: false).fetchAll(),
- Provider.of(context, listen: false)
- .fetchAllRecipients(),
- Provider.of(context, listen: false).fetch(),
- Provider.of(context, listen: false).fetch(),
- Provider.of(context, listen: false).fetch(),
- ]);
- } catch (error) {
- print("WARNING: failed to fetch user data: $error");
- }
-
- if (onSuccess != null) onSuccess();
-
- return LoginState.success;
- } catch (error) {
- print("ERROR: loginAPI: $error");
- // maybe check debug mode
- // ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("ERROR: $error")));
- return LoginState.failed;
- }
- }
- }
- }
- }
-
- return LoginState.failed;
-}
diff --git a/filcnaplo/lib/api/providers/live_card_provider.dart b/filcnaplo/lib/api/providers/live_card_provider.dart
deleted file mode 100644
index ccb278c..0000000
--- a/filcnaplo/lib/api/providers/live_card_provider.dart
+++ /dev/null
@@ -1,294 +0,0 @@
-// ignore_for_file: no_leading_underscores_for_local_identifiers
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:filcnaplo/helpers/subject.dart';
-import 'package:filcnaplo/models/settings.dart';
-import 'package:filcnaplo_kreta_api/models/lesson.dart';
-import 'package:filcnaplo_kreta_api/models/week.dart';
-import 'package:filcnaplo/utils/format.dart';
-import 'package:filcnaplo_kreta_api/providers/timetable_provider.dart';
-import 'package:flutter/foundation.dart';
-import 'package:live_activities/live_activities.dart';
-import 'package:filcnaplo_mobile_ui/pages/home/live_card/live_card.i18n.dart';
-
-enum LiveCardState {
- empty,
- duringLesson,
- duringBreak,
- morning,
- afternoon,
- night,
- summary
-}
-
-class LiveCardProvider extends ChangeNotifier {
- Lesson? currentLesson;
- Lesson? nextLesson;
- Lesson? prevLesson;
- List? nextLessons;
-
- LiveCardState currentState = LiveCardState.empty;
- late Timer _timer;
- late final TimetableProvider _timetable;
- late final SettingsProvider _settings;
-
- late Duration _delay;
-
- final _liveActivitiesPlugin = LiveActivities();
- String? _latestActivityId;
- Map _lastActivity = {};
-
- bool _hasCheckedTimetable = false;
-
- LiveCardProvider({
- required TimetableProvider timetable,
- required SettingsProvider settings,
- }) : _timetable = timetable,
- _settings = settings {
- if (Platform.isIOS) {
- _liveActivitiesPlugin.areActivitiesEnabled().then((value) {
- // Console log
- if (kDebugMode) {
- print("iOS LiveActivity enabled: $value");
- }
-
- if (value) {
- _liveActivitiesPlugin.init(appGroupId: "group.refilc2.livecard");
-
- _liveActivitiesPlugin.getAllActivitiesIds().then((value) {
- _latestActivityId = value.isNotEmpty ? value.first : null;
- });
- }
- });
- }
-
- _timer = Timer.periodic(const Duration(seconds: 1), (timer) => update());
- _delay = settings.bellDelayEnabled
- ? Duration(seconds: settings.bellDelay)
- : Duration.zero;
- update();
- }
-
- @override
- void dispose() {
- _timer.cancel();
- if (Platform.isIOS) {
- _liveActivitiesPlugin.areActivitiesEnabled().then((value) {
- if (value) {
- if (_latestActivityId != null) {
- _liveActivitiesPlugin.endActivity(_latestActivityId!);
- }
- }
- });
- }
- super.dispose();
- }
-
- // Debugging
- static DateTime _now() {
- // return DateTime(2023, 9, 27, 9, 30);
- return DateTime.now();
- }
-
- String getFloorDifference() {
- final prevFloor = prevLesson!.getFloor();
- final nextFloor = nextLesson!.getFloor();
- if (prevFloor == null || nextFloor == null || prevFloor == nextFloor) {
- return "to room";
- }
- if (nextFloor == 0) {
- return "ground floor";
- }
- if (nextFloor > prevFloor) {
- return "up floor";
- } else {
- return "down floor";
- }
- }
-
- Map toMap() {
- switch (currentState) {
- case LiveCardState.duringLesson:
- return {
- "color":
- '#${_settings.liveActivityColor.toString().substring(10, 16)}',
- "icon": currentLesson != null
- ? SubjectIcon.resolveName(subject: currentLesson?.subject)
- : "book",
- "index":
- currentLesson != null ? '${currentLesson!.lessonIndex}. ' : "",
- "title": currentLesson != null
- ? currentLesson?.subject.renamedTo ?? ShortSubject.resolve(subject: currentLesson?.subject).capital()
- : "",
- "subtitle": currentLesson?.room.replaceAll("_", " ") ?? "",
- "description": currentLesson?.description ?? "",
- "startDate": ((currentLesson?.start.millisecondsSinceEpoch ?? 0) -
- _delay.inMilliseconds)
- .toString(),
- "endDate": ((currentLesson?.end.millisecondsSinceEpoch ?? 0) -
- _delay.inMilliseconds)
- .toString(),
- "nextSubject": nextLesson != null
- ? nextLesson?.subject.renamedTo ?? ShortSubject.resolve(subject: nextLesson?.subject).capital()
- : "",
- "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "",
- };
- case LiveCardState.duringBreak:
- final iconFloorMap = {
- "to room": "chevron.right.2",
- "up floor": "arrow.up.right",
- "down floor": "arrow.down.left",
- "ground floor": "arrow.down.left",
- };
-
- final diff = getFloorDifference();
-
- return {
- "color":
- '#${_settings.liveActivityColor.toString().substring(10, 16)}',
- "icon": iconFloorMap[diff] ?? "cup.and.saucer",
- "title": "Szünet",
- "description": "go $diff".i18n.fill([
- diff != "to room" ? (nextLesson!.getFloor() ?? 0) : nextLesson!.room
- ]),
- "startDate": ((prevLesson?.end.millisecondsSinceEpoch ?? 0) -
- _delay.inMilliseconds)
- .toString(),
- "endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) -
- _delay.inMilliseconds)
- .toString(),
- "nextSubject": (nextLesson != null
- ? nextLesson?.subject.renamedTo ?? ShortSubject.resolve(subject: nextLesson?.subject).capital()
- : "")
- .capital(),
- "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "",
- "index": "",
- "subtitle": "",
- };
- default:
- return {};
- }
- }
-
- void update() async {
- if (Platform.isIOS) {
- _liveActivitiesPlugin.areActivitiesEnabled().then((value) {
- if (value) {
- final cmap = toMap();
- if (!mapEquals(cmap, _lastActivity)) {
- _lastActivity = cmap;
- try {
- if (_lastActivity.isNotEmpty) {
- if (_latestActivityId == null) {
- _liveActivitiesPlugin
- .createActivity(_lastActivity)
- .then((value) => _latestActivityId = value);
- } else {
- _liveActivitiesPlugin.updateActivity(
- _latestActivityId!, _lastActivity);
- }
- } else {
- if (_latestActivityId != null) {
- _liveActivitiesPlugin.endActivity(_latestActivityId!);
- }
- }
- } catch (e) {
- if (kDebugMode) {
- print('ERROR: Unable to create or update iOS LiveActivity!');
- }
- }
- }
- }
- });
- }
-
- List today = _today(_timetable);
-
- if (today.isEmpty && !_hasCheckedTimetable) {
- _hasCheckedTimetable = true;
- await _timetable.fetch(week: Week.current());
- today = _today(_timetable);
- }
-
- _delay = _settings.bellDelayEnabled
- ? Duration(seconds: _settings.bellDelay)
- : Duration.zero;
-
- final now = _now().add(_delay);
-
- // Filter cancelled lessons #20
- // Filter label lessons #128
- today = today
- .where((lesson) =>
- lesson.status?.name != "Elmaradt" &&
- lesson.subject.id != '' &&
- !lesson.isEmpty)
- .toList();
-
- if (today.isNotEmpty) {
- // sort
- today.sort((a, b) => a.start.compareTo(b.start));
-
- final _lesson = today.firstWhere(
- (l) => l.start.isBefore(now) && l.end.isAfter(now),
- orElse: () => Lesson.fromJson({}));
-
- if (_lesson.start.year != 0) {
- currentLesson = _lesson;
- } else {
- currentLesson = null;
- }
-
- final _next = today.firstWhere((l) => l.start.isAfter(now),
- orElse: () => Lesson.fromJson({}));
- nextLessons = today.where((l) => l.start.isAfter(now)).toList();
-
- if (_next.start.year != 0) {
- nextLesson = _next;
- } else {
- nextLesson = null;
- }
-
- final _prev = today.lastWhere((l) => l.end.isBefore(now),
- orElse: () => Lesson.fromJson({}));
-
- if (_prev.start.year != 0) {
- prevLesson = _prev;
- } else {
- prevLesson = null;
- }
- }
-
- if (now.isBefore(DateTime(now.year, DateTime.august, 31)) &&
- now.isAfter(DateTime(now.year, DateTime.june, 14))) {
- currentState = LiveCardState.summary;
- } else if (currentLesson != null) {
- currentState = LiveCardState.duringLesson;
- } else if (nextLesson != null && prevLesson != null) {
- currentState = LiveCardState.duringBreak;
- } else if (now.hour >= 12 && now.hour < 20) {
- currentState = LiveCardState.afternoon;
- } else if (now.hour >= 20) {
- currentState = LiveCardState.night;
- } else if (now.hour >= 5 && now.hour <= 10) {
- currentState = LiveCardState.morning;
- } else {
- currentState = LiveCardState.empty;
- }
-
- notifyListeners();
- }
-
- bool get show => currentState != LiveCardState.empty;
-
- Duration get delay => _delay;
-
- bool _sameDate(DateTime a, DateTime b) =>
- (a.year == b.year && a.month == b.month && a.day == b.day);
-
- List _today(TimetableProvider p) => (p.getWeek(Week.current()) ?? [])
- .where((l) => _sameDate(l.date, _now()))
- .toList();
-}
diff --git a/filcnaplo/lib/helpers/notification_helper.dart b/filcnaplo/lib/helpers/notification_helper.dart
deleted file mode 100644
index 6f6f9a4..0000000
--- a/filcnaplo/lib/helpers/notification_helper.dart
+++ /dev/null
@@ -1,601 +0,0 @@
-import 'package:filcnaplo/api/providers/database_provider.dart';
-import 'package:filcnaplo/api/providers/status_provider.dart';
-import 'package:filcnaplo/api/providers/user_provider.dart';
-import 'package:filcnaplo/models/settings.dart';
-import 'package:filcnaplo/helpers/notification_helper.i18n.dart';
-import 'package:filcnaplo_kreta_api/client/api.dart';
-import 'package:filcnaplo_kreta_api/client/client.dart';
-import 'package:filcnaplo_kreta_api/models/absence.dart';
-import 'package:filcnaplo_kreta_api/models/grade.dart';
-import 'package:filcnaplo_kreta_api/models/lesson.dart';
-import 'package:filcnaplo_kreta_api/models/week.dart';
-import 'package:filcnaplo_kreta_api/providers/grade_provider.dart';
-import 'package:filcnaplo_kreta_api/providers/timetable_provider.dart';
-import 'package:flutter_local_notifications/flutter_local_notifications.dart'
- hide Message;
-import 'package:i18n_extension/i18n_widget.dart';
-import 'package:intl/intl.dart';
-import 'package:filcnaplo_kreta_api/models/message.dart';
-
-class NotificationsHelper {
- late DatabaseProvider database;
- late SettingsProvider settingsProvider;
- late UserProvider userProvider;
- late KretaClient kretaClient;
- FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
- FlutterLocalNotificationsPlugin();
-
- List combineLists(
- List list1,
- List list2,
- K Function(T) keyExtractor,
- ) {
- Set uniqueKeys = {};
- List combinedList = [];
-
- for (T item in list1) {
- K key = keyExtractor(item);
- if (!uniqueKeys.contains(key)) {
- uniqueKeys.add(key);
- combinedList.add(item);
- }
- }
-
- for (T item in list2) {
- K key = keyExtractor(item);
- if (!uniqueKeys.contains(key)) {
- uniqueKeys.add(key);
- combinedList.add(item);
- }
- }
-
- return combinedList;
- }
-
- String dayTitle(DateTime date) {
- try {
- return DateFormat("EEEE", I18n.locale.languageCode).format(date);
- } catch (e) {
- return "Unknown";
- }
- }
-
- @pragma('vm:entry-point')
- void backgroundJob() async {
- // initialize providers
- database = DatabaseProvider();
- await database.init();
- settingsProvider = await database.query.getSettings(database);
- userProvider = await database.query.getUsers(settingsProvider);
-
- if (userProvider.id != null && settingsProvider.notificationsEnabled) {
- // refresh kreta login
- final status = StatusProvider();
- kretaClient = KretaClient(
- user: userProvider, settings: settingsProvider, status: status);
- kretaClient.refreshLogin();
- if (settingsProvider.notificationsGradesEnabled) gradeNotification();
- if (settingsProvider.notificationsAbsencesEnabled) absenceNotification();
- if (settingsProvider.notificationsMessagesEnabled) messageNotification();
- if (settingsProvider.notificationsLessonsEnabled) lessonNotification();
- }
- }
-
- void gradeNotification() async {
- // fetch grades
- GradeProvider gradeProvider = GradeProvider(
- settings: settingsProvider,
- user: userProvider,
- database: database,
- kreta: kretaClient);
- gradeProvider.fetch();
- List grades =
- await database.userQuery.getGrades(userId: userProvider.id ?? "");
- DateTime lastSeenGrade =
- await database.userQuery.lastSeenGrade(userId: userProvider.id ?? "");
-
- // loop through grades and see which hasn't been seen yet
- for (Grade grade in grades) {
- // if grade is not a normal grade (1-5), don't show it
- if ([1, 2, 3, 4, 5].contains(grade.value.value)) {
- // if the grade was added over a week ago, don't show it to avoid notification spam
- if (grade.seenDate.isAfter(lastSeenGrade) &&
- grade.date.difference(DateTime.now()).inDays * -1 < 7) {
- // send notificiation about new grade
- AndroidNotificationDetails androidNotificationDetails =
- AndroidNotificationDetails(
- 'GRADES',
- 'Jegyek',
- channelDescription: 'Értesítés jegyek beírásakor',
- importance: Importance.max,
- priority: Priority.max,
- color: settingsProvider.customAccentColor,
- ticker: 'Jegyek',
- );
- NotificationDetails notificationDetails =
- NotificationDetails(android: androidNotificationDetails);
- if (userProvider.getUsers().length == 1) {
- await flutterLocalNotificationsPlugin.show(
- grade.id.hashCode,
- "title_grade".i18n,
- "body_grade".i18n.fill(
- [
- grade.value.value.toString(),
- grade.subject.isRenamed &&
- settingsProvider.renamedSubjectsEnabled
- ? grade.subject.renamedTo!
- : grade.subject.name
- ],
- ),
- notificationDetails,
- );
- } else {
- // multiple users are added, also display student name
- await flutterLocalNotificationsPlugin.show(
- grade.id.hashCode,
- "title_grade".i18n,
- "body_grade_multiuser".i18n.fill(
- [
- userProvider.displayName!,
- grade.value.value.toString(),
- grade.subject.isRenamed &&
- settingsProvider.renamedSubjectsEnabled
- ? grade.subject.renamedTo!
- : grade.subject.name
- ],
- ),
- notificationDetails,
- );
- }
- }
- }
- }
- // set grade seen status
- gradeProvider.seenAll();
- }
-
- void absenceNotification() async {
- // get absences from api
- List? absenceJson = await kretaClient
- .getAPI(KretaAPI.absences(userProvider.instituteCode ?? ""));
- List storedAbsences =
- await database.userQuery.getAbsences(userId: userProvider.id!);
- if (absenceJson == null) {
- return;
- }
- // format api absences to correct format while preserving isSeen value
- List absences = absenceJson.map((e) {
- Absence apiAbsence = Absence.fromJson(e);
- Absence storedAbsence = storedAbsences.firstWhere(
- (stored) => stored.id == apiAbsence.id,
- orElse: () => apiAbsence);
- apiAbsence.isSeen = storedAbsence.isSeen;
- return apiAbsence;
- }).toList();
- List modifiedAbsences = [];
- if (absences != storedAbsences) {
- // remove absences that are not new
- absences.removeWhere((element) => storedAbsences.contains(element));
- for (Absence absence in absences) {
- if (!absence.isSeen) {
- absence.isSeen = true;
- modifiedAbsences.add(absence);
- AndroidNotificationDetails androidNotificationDetails =
- AndroidNotificationDetails(
- 'ABSENCES',
- 'Hiányzások',
- channelDescription: 'Értesítés hiányzások beírásakor',
- importance: Importance.max,
- priority: Priority.max,
- color: settingsProvider.customAccentColor,
- ticker: 'Hiányzások',
- );
- NotificationDetails notificationDetails =
- NotificationDetails(android: androidNotificationDetails);
- if (userProvider.getUsers().length == 1) {
- await flutterLocalNotificationsPlugin.show(
- absence.id.hashCode,
- "title_absence".i18n, // https://discord.com/channels/1111649116020285532/1153273625206591528
- "body_absence".i18n.fill(
- [
- DateFormat("yyyy-MM-dd").format(absence.date),
- absence.subject.isRenamed &&
- settingsProvider.renamedSubjectsEnabled
- ? absence.subject.renamedTo!
- : absence.subject.name
- ],
- ),
- notificationDetails,
- );
- } else {
- await flutterLocalNotificationsPlugin.show(
- absence.id.hashCode,
- "title_absence".i18n, // https://discord.com/channels/1111649116020285532/1153273625206591528
- "body_absence_multiuser".i18n.fill(
- [
- userProvider.displayName!,
- DateFormat("yyyy-MM-dd").format(absence.date),
- absence.subject.isRenamed &&
- settingsProvider.renamedSubjectsEnabled
- ? absence.subject.renamedTo!
- : absence.subject.name
- ],
- ),
- notificationDetails,
- );
- }
- }
- }
- }
- // combine modified absences and storedabsences list and save them to the database
- List combinedAbsences = combineLists(
- modifiedAbsences,
- storedAbsences,
- (Absence absence) => absence.id,
- );
- await database.userStore
- .storeAbsences(combinedAbsences, userId: userProvider.id!);
- }
-
- void messageNotification() async {
- // get messages from api
- List? messageJson =
- await kretaClient.getAPI(KretaAPI.messages("beerkezett"));
- List storedmessages =
- await database.userQuery.getMessages(userId: userProvider.id!);
- if (messageJson == null) {
- return;
- }
- // format api messages to correct format while preserving isSeen value
- // Parse messages
- List messages = [];
- await Future.wait(List.generate(messageJson.length, (index) {
- return () async {
- Map message = messageJson.cast