diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..dc5a61a --- /dev/null +++ b/changelog.md @@ -0,0 +1,3 @@ +- Haptikus visszajelzés +- Animációk +- Hibajavítások \ No newline at end of file diff --git a/filcnaplo/ios/Podfile.lock b/filcnaplo/ios/Podfile.lock index f3433fb..e36f8f5 100644 --- a/filcnaplo/ios/Podfile.lock +++ b/filcnaplo/ios/Podfile.lock @@ -58,8 +58,6 @@ PODS: - SwiftyGif (5.4.0) - url_launcher (0.0.1): - Flutter - - vibration (1.7.4-nullsafety.0): - - Flutter DEPENDENCIES: - file_picker (from `.symlinks/plugins/file_picker/ios`) @@ -72,7 +70,6 @@ DEPENDENCIES: - share_plus (from `.symlinks/plugins/share_plus/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`) - url_launcher (from `.symlinks/plugins/url_launcher/ios`) - - vibration (from `.symlinks/plugins/vibration/ios`) SPEC REPOS: trunk: @@ -103,8 +100,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/sqflite/ios" url_launcher: :path: ".symlinks/plugins/url_launcher/ios" - vibration: - :path: ".symlinks/plugins/vibration/ios" SPEC CHECKSUMS: DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d @@ -122,7 +117,6 @@ SPEC CHECKSUMS: sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 SwiftyGif: 5d4af95df24caf1c570dbbcb32a3b8a0763bc6d7 url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef - vibration: 1ec279c4a1a7a646627b54039d812334b3f1114a PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c diff --git a/filcnaplo/ios/Runner/Info.plist b/filcnaplo/ios/Runner/Info.plist index b635367..561f546 100644 --- a/filcnaplo/ios/Runner/Info.plist +++ b/filcnaplo/ios/Runner/Info.plist @@ -50,5 +50,7 @@ NSPhotoLibraryUsageDescription The app requires the photo library to set a custom profile picture. + ITSAppUsesNonExemptEncryption + \ No newline at end of file diff --git a/filcnaplo/lib/api/login.dart b/filcnaplo/lib/api/login.dart index 9b8abb1..140b045 100644 --- a/filcnaplo/lib/api/login.dart +++ b/filcnaplo/lib/api/login.dart @@ -1,3 +1,5 @@ +import 'dart:developer'; + import 'package:filcnaplo/utils/jwt.dart'; import 'package:filcnaplo_kreta_api/providers/absence_provider.dart'; import 'package:filcnaplo_kreta_api/providers/event_provider.dart'; diff --git a/filcnaplo/lib/database/init.dart b/filcnaplo/lib/database/init.dart index fdf5533..49dfb0e 100644 --- a/filcnaplo/lib/database/init.dart +++ b/filcnaplo/lib/database/init.dart @@ -9,8 +9,7 @@ Future initDB() async { var settingsDB = await createSettingsTable(db); // Create table Users - await db.execute( - "CREATE TABLE IF NOT EXISTS users (id TEXT NOT NULL, name TEXT, username TEXT, password TEXT, institute_code TEXT, student TEXT, role INTEGER)"); + var usersDB = await createUsersTable(db); await db.execute("CREATE TABLE IF NOT EXISTS user_data (" "id TEXT NOT NULL, grades TEXT, timetable TEXT, exams TEXT, homework TEXT, messages TEXT, notes TEXT, events TEXT, absences TEXT)"); @@ -19,7 +18,9 @@ Future initDB() async { await db.insert("settings", SettingsProvider.defaultSettings().toMap()); } - await migrateDB(db, settingsDB.struct.keys); + // Migrate Databases + await migrateDB(db, "settings", settingsDB.struct.keys, SettingsProvider.defaultSettings().toMap(), createSettingsTable); + await migrateDB(db, "users", usersDB.struct.keys, {"role": 0}, createUsersTable); return db; } @@ -40,35 +41,67 @@ Future createSettingsTable(Database db) async { return settingsDB; } -Future migrateDB(Database db, Iterable keys) async { - var settings = (await db.query("settings"))[0]; +Future createUsersTable(Database db) async { + var usersDB = DatabaseStruct( + {"id": String, "name": String, "username": String, "password": String, "institute_code": String, "student": String, "role": int}); - bool migrationRequired = keys.any((key) => !settings.containsKey(key) || settings[key] == null); + // Create table Users + await db.execute("CREATE TABLE IF NOT EXISTS users ($usersDB)"); - if (migrationRequired) { - var defaultSettings = SettingsProvider.defaultSettings(); - var settingsCopy = Map.from(settings); + return usersDB; +} - // Delete settings - await db.execute("drop table settings"); +Future migrateDB( + Database db, + String table, + Iterable keys, + Map defaultValues, + Future Function(Database) create, +) async { + var originalRows = await db.query(table); - // Fill missing columns - keys.forEach((key) { - if (!keys.contains(key)) { - print("debug: dropping $key"); - settingsCopy.remove(key); - } + if (originalRows.length == 0) { + await db.execute("drop table $table"); + await create(db); + return; + } - if (!settings.containsKey(key) || settings[key] == null) { - print("DEBUG: migrating $key"); - settingsCopy[key] = defaultSettings.toMap()[key]; - } + List> migrated = []; + + await Future.forEach>(originalRows, (original) async { + bool migrationRequired = keys.any((key) => !original.containsKey(key) || original[key] == null); + + if (migrationRequired) { + print("INFO: Migrating $table"); + var copy = Map.from(original); + + // Fill missing columns + keys.forEach((key) { + if (!keys.contains(key)) { + print("DEBUG: dropping $key"); + copy.remove(key); + } + + if (!original.containsKey(key) || original[key] == null) { + print("DEBUG: migrating $key"); + copy[key] = defaultValues[key]; + } + }); + + migrated.add(copy); + } + }); + + if (migrated.length > 0) { + // Delete table + await db.execute("drop table $table"); + + // Recreate table + await create(db); + await Future.forEach(migrated, (Map copy) async { + await db.insert(table, copy); }); - // Recreate settings - await createSettingsTable(db); - await db.insert("settings", settingsCopy); - print("INFO: Database migrated"); } } diff --git a/filcnaplo/lib/database/struct.dart b/filcnaplo/lib/database/struct.dart index 50b3355..cec8e48 100644 --- a/filcnaplo/lib/database/struct.dart +++ b/filcnaplo/lib/database/struct.dart @@ -15,7 +15,7 @@ class DatabaseStruct { break; } - return "${name} ${typeName.toUpperCase()}"; + return "${name} ${typeName.toUpperCase()} ${name == 'id' ? 'NOT NULL' : ''}"; } @override diff --git a/filcnaplo/pubspec.yaml b/filcnaplo/pubspec.yaml index 1d22d46..bf0eac0 100644 --- a/filcnaplo/pubspec.yaml +++ b/filcnaplo/pubspec.yaml @@ -3,7 +3,7 @@ description: "Nem hivatalos e-napló alkalmazás az e-Kréta rendszerhez" homepage: https://filcnaplo.hu publish_to: "none" -version: 3.0.2+130 +version: 3.0.4+133 environment: sdk: ">=2.12.0 <3.0.0" diff --git a/filcnaplo_mobile_ui b/filcnaplo_mobile_ui index d8a680e..33bfa51 160000 --- a/filcnaplo_mobile_ui +++ b/filcnaplo_mobile_ui @@ -1 +1 @@ -Subproject commit d8a680edf29c4b576e8303b7fc0a938df914e6e7 +Subproject commit 33bfa51329b52f900835b06adc8f62b9cb16b8eb