mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-04-18 14:22:53 +00:00
bump version and fix issue
Some checks failed
Flutter analyze & test / flutter_analyze_and_test (push) Has been cancelled
Some checks failed
Flutter analyze & test / flutter_analyze_and_test (push) Has been cancelled
This commit is contained in:
parent
5204984f9c
commit
18cce3ba39
5 changed files with 68 additions and 68 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 0.1.0
|
## 0.1.1
|
||||||
|
|
||||||
- New: Groups can now collect flames as well
|
- New: Groups can now collect flames as well
|
||||||
- New: Background execution to pre-load messages
|
- New: Background execution to pre-load messages
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,9 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
||||||
|
|
||||||
final rowId = await into(mediaFiles).insert(insertMediaFile);
|
final rowId = await into(mediaFiles).insert(insertMediaFile);
|
||||||
|
|
||||||
return await (select(mediaFiles)..where((t) => t.rowId.equals(rowId)))
|
return await (select(
|
||||||
.getSingle();
|
mediaFiles,
|
||||||
|
)..where((t) => t.rowId.equals(rowId))).getSingle();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Log.error('Could not insert media file: $e');
|
Log.error('Could not insert media file: $e');
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -35,8 +36,7 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteMediaFile(String mediaId) async {
|
Future<void> deleteMediaFile(String mediaId) async {
|
||||||
await (delete(mediaFiles)
|
await (delete(mediaFiles)..where(
|
||||||
..where(
|
|
||||||
(t) => t.mediaId.equals(mediaId),
|
(t) => t.mediaId.equals(mediaId),
|
||||||
))
|
))
|
||||||
.go();
|
.go();
|
||||||
|
|
@ -46,8 +46,9 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
||||||
String mediaId,
|
String mediaId,
|
||||||
MediaFilesCompanion updates,
|
MediaFilesCompanion updates,
|
||||||
) async {
|
) async {
|
||||||
await (update(mediaFiles)..where((c) => c.mediaId.equals(mediaId)))
|
await (update(
|
||||||
.write(updates);
|
mediaFiles,
|
||||||
|
)..where((c) => c.mediaId.equals(mediaId))).write(updates);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updateAllMediaFiles(
|
Future<void> updateAllMediaFiles(
|
||||||
|
|
@ -57,14 +58,15 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<MediaFile?> getMediaFileById(String mediaId) async {
|
Future<MediaFile?> getMediaFileById(String mediaId) async {
|
||||||
return (select(mediaFiles)..where((t) => t.mediaId.equals(mediaId)))
|
return (select(
|
||||||
.getSingleOrNull();
|
mediaFiles,
|
||||||
|
)..where((t) => t.mediaId.equals(mediaId))).getSingleOrNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<MediaFile?> getDraftMediaFile() async {
|
Future<MediaFile?> getDraftMediaFile() async {
|
||||||
final medias = await (select(mediaFiles)
|
final medias = await (select(
|
||||||
..where((t) => t.isDraftMedia.equals(true)))
|
mediaFiles,
|
||||||
.get();
|
)..where((t) => t.isDraftMedia.equals(true))).get();
|
||||||
if (medias.isEmpty) {
|
if (medias.isEmpty) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -72,13 +74,13 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<MediaFile?> watchMedia(String mediaId) {
|
Stream<MediaFile?> watchMedia(String mediaId) {
|
||||||
return (select(mediaFiles)..where((t) => t.mediaId.equals(mediaId)))
|
return (select(
|
||||||
.watchSingleOrNull();
|
mediaFiles,
|
||||||
|
)..where((t) => t.mediaId.equals(mediaId))).watchSingleOrNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> resetPendingDownloadState() async {
|
Future<void> resetPendingDownloadState() async {
|
||||||
await (update(mediaFiles)
|
await (update(mediaFiles)..where(
|
||||||
..where(
|
|
||||||
(c) => c.downloadState.equals(
|
(c) => c.downloadState.equals(
|
||||||
DownloadState.downloading.name,
|
DownloadState.downloading.name,
|
||||||
),
|
),
|
||||||
|
|
@ -91,8 +93,7 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<MediaFile>> getAllMediaFilesPendingDownload() async {
|
Future<List<MediaFile>> getAllMediaFilesPendingDownload() async {
|
||||||
return (select(mediaFiles)
|
return (select(mediaFiles)..where(
|
||||||
..where(
|
|
||||||
(t) =>
|
(t) =>
|
||||||
t.downloadState.equals(DownloadState.pending.name) |
|
t.downloadState.equals(DownloadState.pending.name) |
|
||||||
t.downloadState.equals(DownloadState.downloading.name),
|
t.downloadState.equals(DownloadState.downloading.name),
|
||||||
|
|
@ -101,25 +102,23 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<MediaFile>> getAllMediaFilesReuploadRequested() async {
|
Future<List<MediaFile>> getAllMediaFilesReuploadRequested() async {
|
||||||
return (select(mediaFiles)
|
return (select(mediaFiles)..where(
|
||||||
..where(
|
|
||||||
(t) => t.downloadState.equals(DownloadState.reuploadRequested.name),
|
(t) => t.downloadState.equals(DownloadState.reuploadRequested.name),
|
||||||
))
|
))
|
||||||
.get();
|
.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<MediaFile>> getAllNonHashedStoredMediaFiles() async {
|
Future<List<MediaFile>> getAllNonHashedStoredMediaFiles() async {
|
||||||
return (select(mediaFiles)
|
return (select(mediaFiles)..where(
|
||||||
..where(
|
|
||||||
(t) => t.stored.equals(true) & t.storedFileHash.isNull(),
|
(t) => t.stored.equals(true) & t.storedFileHash.isNull(),
|
||||||
))
|
))
|
||||||
.get();
|
.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<MediaFile>> getAllMediaFilesPendingUpload() async {
|
Future<List<MediaFile>> getAllMediaFilesPendingUpload() async {
|
||||||
return (select(mediaFiles)
|
return (select(mediaFiles)..where(
|
||||||
..where(
|
(t) =>
|
||||||
(t) => (t.uploadState.equals(UploadState.initialized.name) |
|
(t.uploadState.equals(UploadState.initialized.name) |
|
||||||
t.uploadState.equals(UploadState.uploadLimitReached.name) |
|
t.uploadState.equals(UploadState.uploadLimitReached.name) |
|
||||||
t.uploadState.equals(UploadState.uploading.name) |
|
t.uploadState.equals(UploadState.uploading.name) |
|
||||||
t.uploadState.equals(UploadState.preprocessing.name)),
|
t.uploadState.equals(UploadState.preprocessing.name)),
|
||||||
|
|
@ -128,8 +127,8 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<List<MediaFile>> watchAllStoredMediaFiles() {
|
Stream<List<MediaFile>> watchAllStoredMediaFiles() {
|
||||||
final query = (select(mediaFiles)..where((t) => t.stored.equals(true)))
|
final query =
|
||||||
.join([])
|
(select(mediaFiles)..where((t) => t.stored.equals(true))).join([])
|
||||||
..groupBy([mediaFiles.storedFileHash]);
|
..groupBy([mediaFiles.storedFileHash]);
|
||||||
return query.map((row) => row.readTable(mediaFiles)).watch();
|
return query.map((row) => row.readTable(mediaFiles)).watch();
|
||||||
}
|
}
|
||||||
|
|
@ -142,8 +141,7 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updateAllRetransmissionUploadingState() async {
|
Future<void> updateAllRetransmissionUploadingState() async {
|
||||||
await (update(mediaFiles)
|
await (update(mediaFiles)..where(
|
||||||
..where(
|
|
||||||
(t) =>
|
(t) =>
|
||||||
t.uploadState.equals(UploadState.uploading.name) &
|
t.uploadState.equals(UploadState.uploading.name) &
|
||||||
t.reuploadRequestedBy.isNotNull(),
|
t.reuploadRequestedBy.isNotNull(),
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,9 @@ Future<void> finishStartedPreprocessing() async {
|
||||||
final mediaFiles = await twonlyDB.mediaFilesDao
|
final mediaFiles = await twonlyDB.mediaFilesDao
|
||||||
.getAllMediaFilesPendingUpload();
|
.getAllMediaFilesPendingUpload();
|
||||||
|
|
||||||
Log.info('There are ${mediaFiles.length} media files pending');
|
|
||||||
|
|
||||||
for (final mediaFile in mediaFiles) {
|
for (final mediaFile in mediaFiles) {
|
||||||
if (mediaFile.isDraftMedia) {
|
if (mediaFile.isDraftMedia) {
|
||||||
|
Log.info('Ignoring media files as it is a draft');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
@ -51,6 +50,9 @@ Future<void> finishStartedPreprocessing() async {
|
||||||
await twonlyDB.mediaFilesDao.deleteMediaFile(mediaFile.mediaId);
|
await twonlyDB.mediaFilesDao.deleteMediaFile(mediaFile.mediaId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Log.info(
|
||||||
|
'Finishing started preprocessing of ${mediaFile.mediaId} in state ${mediaFile.uploadState}.',
|
||||||
|
);
|
||||||
await startBackgroundMediaUpload(service);
|
await startBackgroundMediaUpload(service);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Log.warn(e);
|
Log.warn(e);
|
||||||
|
|
|
||||||
|
|
@ -51,16 +51,16 @@ void callbackDispatcher() {
|
||||||
|
|
||||||
Future<bool> initBackgroundExecution() async {
|
Future<bool> initBackgroundExecution() async {
|
||||||
SentryWidgetsFlutterBinding.ensureInitialized();
|
SentryWidgetsFlutterBinding.ensureInitialized();
|
||||||
|
globalApplicationCacheDirectory = (await getApplicationCacheDirectory()).path;
|
||||||
|
globalApplicationSupportDirectory =
|
||||||
|
(await getApplicationSupportDirectory()).path;
|
||||||
|
|
||||||
initLogger();
|
initLogger();
|
||||||
|
|
||||||
final user = await getUser();
|
final user = await getUser();
|
||||||
if (user == null) return false;
|
if (user == null) return false;
|
||||||
gUser = user;
|
gUser = user;
|
||||||
|
|
||||||
globalApplicationCacheDirectory = (await getApplicationCacheDirectory()).path;
|
|
||||||
globalApplicationSupportDirectory =
|
|
||||||
(await getApplicationSupportDirectory()).path;
|
|
||||||
|
|
||||||
twonlyDB = TwonlyDB();
|
twonlyDB = TwonlyDB();
|
||||||
apiService = ApiService();
|
apiService = ApiService();
|
||||||
globalIsInBackgroundTask = true;
|
globalIsInBackgroundTask = true;
|
||||||
|
|
@ -92,7 +92,7 @@ Future<void> handlePeriodicTask() async {
|
||||||
await KeyValueStore.put(KeyValueKeys.lastPeriodicTaskExecution, {
|
await KeyValueStore.put(KeyValueKeys.lastPeriodicTaskExecution, {
|
||||||
'timestamp': DateTime.now().millisecondsSinceEpoch,
|
'timestamp': DateTime.now().millisecondsSinceEpoch,
|
||||||
});
|
});
|
||||||
return false;
|
return true;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ description: "twonly, a privacy-friendly way to connect with friends through sec
|
||||||
|
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 0.1.0+100
|
version: 0.1.1+101
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.11.0
|
sdk: ^3.11.0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue