mirror of
https://github.com/ente-io/ente.git
synced 2025-08-08 07:28:26 +00:00
[mob][photos] upload files in web_view for public albums
This commit is contained in:
parent
c7d56c66a2
commit
799cb24c63
@ -71,6 +71,7 @@ class CollectionsService {
|
||||
final _cachedPublicAlbumToken = <int, String>{};
|
||||
final _cachedPublicAlbumJWTToken = <int, String>{};
|
||||
final _cachedPublicCollectionID = <int>[];
|
||||
final _cachedPublicAlbumKey = <String, String>{};
|
||||
|
||||
CollectionsService._privateConstructor() {
|
||||
_db = CollectionsDB.instance;
|
||||
@ -183,6 +184,7 @@ class CollectionsService {
|
||||
_cachedPublicAlbumJWTToken.clear();
|
||||
_cachedPublicCollectionID.clear();
|
||||
_cachedKeys.clear();
|
||||
_cachedPublicAlbumKey.clear();
|
||||
}
|
||||
|
||||
Future<Map<int, int>> getCollectionIDsToBeSynced() async {
|
||||
@ -1059,6 +1061,7 @@ class CollectionsService {
|
||||
_cachedKeys[collection.id] = collectionKey;
|
||||
_cachedPublicAlbumToken[collection.id] = authToken!;
|
||||
_cachedPublicCollectionID.add(collection.id);
|
||||
_cachedPublicAlbumKey[authToken] = albumKey;
|
||||
collection.setName(_getDecryptedCollectionName(collection));
|
||||
return collection;
|
||||
} catch (e, s) {
|
||||
@ -1114,6 +1117,13 @@ class CollectionsService {
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> getPublicAlbumKey(String authToken) async {
|
||||
if (_cachedPublicAlbumKey.containsKey(authToken)) {
|
||||
return _cachedPublicAlbumKey[authToken]!;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
Future<String?> getPublicAlbumToken(int collectionID) async {
|
||||
if (_cachedPublicAlbumToken.containsKey(collectionID)) {
|
||||
return _cachedPublicAlbumToken[collectionID];
|
||||
|
@ -33,6 +33,7 @@ import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
|
||||
import "package:photos/ui/cast/auto.dart";
|
||||
import "package:photos/ui/cast/choose.dart";
|
||||
import "package:photos/ui/common/popup_item.dart";
|
||||
import "package:photos/ui/common/web_page.dart";
|
||||
import 'package:photos/ui/components/action_sheet_widget.dart';
|
||||
import 'package:photos/ui/components/buttons/button_widget.dart';
|
||||
import 'package:photos/ui/components/models/button_type.dart';
|
||||
@ -844,7 +845,24 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
|
||||
Future<void> _showAddPhotoDialog(BuildContext bContext) async {
|
||||
final collection = widget.collection;
|
||||
try {
|
||||
await showAddPhotosSheet(bContext, collection!);
|
||||
if (galleryType == GalleryType.sharedPublicCollection &&
|
||||
collection!.isEnableCollect()) {
|
||||
final authToken = await CollectionsService.instance
|
||||
.getPublicAlbumToken(collection.id);
|
||||
final albumKey =
|
||||
await CollectionsService.instance.getPublicAlbumKey(authToken!);
|
||||
|
||||
await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => WebPage(
|
||||
widget.title ?? "",
|
||||
"https://albums.ente.sh/?t=$authToken#$albumKey",
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
await showAddPhotosSheet(bContext, collection!);
|
||||
}
|
||||
} catch (e, s) {
|
||||
_logger.severe(e, s);
|
||||
await showGenericErrorDialog(context: bContext, error: e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user