mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-04-16 06:32:54 +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
|
||||
|
||||
## 0.1.0
|
||||
## 0.1.1
|
||||
|
||||
- New: Groups can now collect flames as well
|
||||
- New: Background execution to pre-load messages
|
||||
|
|
|
|||
|
|
@ -26,8 +26,9 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
|||
|
||||
final rowId = await into(mediaFiles).insert(insertMediaFile);
|
||||
|
||||
return await (select(mediaFiles)..where((t) => t.rowId.equals(rowId)))
|
||||
.getSingle();
|
||||
return await (select(
|
||||
mediaFiles,
|
||||
)..where((t) => t.rowId.equals(rowId))).getSingle();
|
||||
} catch (e) {
|
||||
Log.error('Could not insert media file: $e');
|
||||
return null;
|
||||
|
|
@ -35,10 +36,9 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
|||
}
|
||||
|
||||
Future<void> deleteMediaFile(String mediaId) async {
|
||||
await (delete(mediaFiles)
|
||||
..where(
|
||||
(t) => t.mediaId.equals(mediaId),
|
||||
))
|
||||
await (delete(mediaFiles)..where(
|
||||
(t) => t.mediaId.equals(mediaId),
|
||||
))
|
||||
.go();
|
||||
}
|
||||
|
||||
|
|
@ -46,8 +46,9 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
|||
String mediaId,
|
||||
MediaFilesCompanion updates,
|
||||
) async {
|
||||
await (update(mediaFiles)..where((c) => c.mediaId.equals(mediaId)))
|
||||
.write(updates);
|
||||
await (update(
|
||||
mediaFiles,
|
||||
)..where((c) => c.mediaId.equals(mediaId))).write(updates);
|
||||
}
|
||||
|
||||
Future<void> updateAllMediaFiles(
|
||||
|
|
@ -57,14 +58,15 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
|||
}
|
||||
|
||||
Future<MediaFile?> getMediaFileById(String mediaId) async {
|
||||
return (select(mediaFiles)..where((t) => t.mediaId.equals(mediaId)))
|
||||
.getSingleOrNull();
|
||||
return (select(
|
||||
mediaFiles,
|
||||
)..where((t) => t.mediaId.equals(mediaId))).getSingleOrNull();
|
||||
}
|
||||
|
||||
Future<MediaFile?> getDraftMediaFile() async {
|
||||
final medias = await (select(mediaFiles)
|
||||
..where((t) => t.isDraftMedia.equals(true)))
|
||||
.get();
|
||||
final medias = await (select(
|
||||
mediaFiles,
|
||||
)..where((t) => t.isDraftMedia.equals(true))).get();
|
||||
if (medias.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -72,65 +74,62 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
|||
}
|
||||
|
||||
Stream<MediaFile?> watchMedia(String mediaId) {
|
||||
return (select(mediaFiles)..where((t) => t.mediaId.equals(mediaId)))
|
||||
.watchSingleOrNull();
|
||||
return (select(
|
||||
mediaFiles,
|
||||
)..where((t) => t.mediaId.equals(mediaId))).watchSingleOrNull();
|
||||
}
|
||||
|
||||
Future<void> resetPendingDownloadState() async {
|
||||
await (update(mediaFiles)
|
||||
..where(
|
||||
(c) => c.downloadState.equals(
|
||||
DownloadState.downloading.name,
|
||||
),
|
||||
))
|
||||
await (update(mediaFiles)..where(
|
||||
(c) => c.downloadState.equals(
|
||||
DownloadState.downloading.name,
|
||||
),
|
||||
))
|
||||
.write(
|
||||
const MediaFilesCompanion(
|
||||
downloadState: Value(DownloadState.pending),
|
||||
),
|
||||
);
|
||||
const MediaFilesCompanion(
|
||||
downloadState: Value(DownloadState.pending),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<List<MediaFile>> getAllMediaFilesPendingDownload() async {
|
||||
return (select(mediaFiles)
|
||||
..where(
|
||||
(t) =>
|
||||
t.downloadState.equals(DownloadState.pending.name) |
|
||||
t.downloadState.equals(DownloadState.downloading.name),
|
||||
))
|
||||
return (select(mediaFiles)..where(
|
||||
(t) =>
|
||||
t.downloadState.equals(DownloadState.pending.name) |
|
||||
t.downloadState.equals(DownloadState.downloading.name),
|
||||
))
|
||||
.get();
|
||||
}
|
||||
|
||||
Future<List<MediaFile>> getAllMediaFilesReuploadRequested() async {
|
||||
return (select(mediaFiles)
|
||||
..where(
|
||||
(t) => t.downloadState.equals(DownloadState.reuploadRequested.name),
|
||||
))
|
||||
return (select(mediaFiles)..where(
|
||||
(t) => t.downloadState.equals(DownloadState.reuploadRequested.name),
|
||||
))
|
||||
.get();
|
||||
}
|
||||
|
||||
Future<List<MediaFile>> getAllNonHashedStoredMediaFiles() async {
|
||||
return (select(mediaFiles)
|
||||
..where(
|
||||
(t) => t.stored.equals(true) & t.storedFileHash.isNull(),
|
||||
))
|
||||
return (select(mediaFiles)..where(
|
||||
(t) => t.stored.equals(true) & t.storedFileHash.isNull(),
|
||||
))
|
||||
.get();
|
||||
}
|
||||
|
||||
Future<List<MediaFile>> getAllMediaFilesPendingUpload() async {
|
||||
return (select(mediaFiles)
|
||||
..where(
|
||||
(t) => (t.uploadState.equals(UploadState.initialized.name) |
|
||||
t.uploadState.equals(UploadState.uploadLimitReached.name) |
|
||||
t.uploadState.equals(UploadState.uploading.name) |
|
||||
t.uploadState.equals(UploadState.preprocessing.name)),
|
||||
))
|
||||
return (select(mediaFiles)..where(
|
||||
(t) =>
|
||||
(t.uploadState.equals(UploadState.initialized.name) |
|
||||
t.uploadState.equals(UploadState.uploadLimitReached.name) |
|
||||
t.uploadState.equals(UploadState.uploading.name) |
|
||||
t.uploadState.equals(UploadState.preprocessing.name)),
|
||||
))
|
||||
.get();
|
||||
}
|
||||
|
||||
Stream<List<MediaFile>> watchAllStoredMediaFiles() {
|
||||
final query = (select(mediaFiles)..where((t) => t.stored.equals(true)))
|
||||
.join([])
|
||||
..groupBy([mediaFiles.storedFileHash]);
|
||||
final query =
|
||||
(select(mediaFiles)..where((t) => t.stored.equals(true))).join([])
|
||||
..groupBy([mediaFiles.storedFileHash]);
|
||||
return query.map((row) => row.readTable(mediaFiles)).watch();
|
||||
}
|
||||
|
||||
|
|
@ -142,16 +141,15 @@ class MediaFilesDao extends DatabaseAccessor<TwonlyDB>
|
|||
}
|
||||
|
||||
Future<void> updateAllRetransmissionUploadingState() async {
|
||||
await (update(mediaFiles)
|
||||
..where(
|
||||
(t) =>
|
||||
t.uploadState.equals(UploadState.uploading.name) &
|
||||
t.reuploadRequestedBy.isNotNull(),
|
||||
))
|
||||
await (update(mediaFiles)..where(
|
||||
(t) =>
|
||||
t.uploadState.equals(UploadState.uploading.name) &
|
||||
t.reuploadRequestedBy.isNotNull(),
|
||||
))
|
||||
.write(
|
||||
const MediaFilesCompanion(
|
||||
uploadState: Value(UploadState.preprocessing),
|
||||
),
|
||||
);
|
||||
const MediaFilesCompanion(
|
||||
uploadState: Value(UploadState.preprocessing),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,10 +30,9 @@ Future<void> finishStartedPreprocessing() async {
|
|||
final mediaFiles = await twonlyDB.mediaFilesDao
|
||||
.getAllMediaFilesPendingUpload();
|
||||
|
||||
Log.info('There are ${mediaFiles.length} media files pending');
|
||||
|
||||
for (final mediaFile in mediaFiles) {
|
||||
if (mediaFile.isDraftMedia) {
|
||||
Log.info('Ignoring media files as it is a draft');
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
|
|
@ -51,6 +50,9 @@ Future<void> finishStartedPreprocessing() async {
|
|||
await twonlyDB.mediaFilesDao.deleteMediaFile(mediaFile.mediaId);
|
||||
continue;
|
||||
}
|
||||
Log.info(
|
||||
'Finishing started preprocessing of ${mediaFile.mediaId} in state ${mediaFile.uploadState}.',
|
||||
);
|
||||
await startBackgroundMediaUpload(service);
|
||||
} catch (e) {
|
||||
Log.warn(e);
|
||||
|
|
|
|||
|
|
@ -51,16 +51,16 @@ void callbackDispatcher() {
|
|||
|
||||
Future<bool> initBackgroundExecution() async {
|
||||
SentryWidgetsFlutterBinding.ensureInitialized();
|
||||
globalApplicationCacheDirectory = (await getApplicationCacheDirectory()).path;
|
||||
globalApplicationSupportDirectory =
|
||||
(await getApplicationSupportDirectory()).path;
|
||||
|
||||
initLogger();
|
||||
|
||||
final user = await getUser();
|
||||
if (user == null) return false;
|
||||
gUser = user;
|
||||
|
||||
globalApplicationCacheDirectory = (await getApplicationCacheDirectory()).path;
|
||||
globalApplicationSupportDirectory =
|
||||
(await getApplicationSupportDirectory()).path;
|
||||
|
||||
twonlyDB = TwonlyDB();
|
||||
apiService = ApiService();
|
||||
globalIsInBackgroundTask = true;
|
||||
|
|
@ -92,7 +92,7 @@ Future<void> handlePeriodicTask() async {
|
|||
await KeyValueStore.put(KeyValueKeys.lastPeriodicTaskExecution, {
|
||||
'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'
|
||||
|
||||
version: 0.1.0+100
|
||||
version: 0.1.1+101
|
||||
|
||||
environment:
|
||||
sdk: ^3.11.0
|
||||
|
|
|
|||
Loading…
Reference in a new issue