upload url image or file to ipfs
This commit is contained in:
1 parent
9609a8231d
commit
a4a7e00732
33 files changed
+2594
-81
No files matched your search
@@ -317,6 +317,24 @@ class AppSettingsService extends ChangeNotifier {
|
||||
await updateSettings(_settings.copyWith(imageMessagesEnabled: value));
|
||||
}
|
||||
|
||||
Future<void> setIpfsImageSettings({
|
||||
required String publicGateway,
|
||||
required String uploadGateway,
|
||||
required String uploadEndpoint,
|
||||
required String uploadApiKey,
|
||||
}) async {
|
||||
final normalizedPublicGateway = normalizeIpfsGateway(publicGateway);
|
||||
final normalizedUploadGateway = normalizeIpfsGateway(uploadGateway);
|
||||
await updateSettings(
|
||||
_settings.copyWith(
|
||||
publicIpfsGateway: normalizedPublicGateway,
|
||||
uploadIpfsGateway: normalizedUploadGateway,
|
||||
uploadIpfsEndpoint: uploadEndpoint.trim(),
|
||||
uploadIpfsApiKey: uploadApiKey.trim(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// See [AppSettings.imageProcessAutomatically]. `main.dart` mirrors this into
|
||||
/// `ReceivedImageStore.processAutomatically` on every settings change; the
|
||||
/// store applies it to future arrivals only, so flipping it does not
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import '../helpers/message_url_image_helper.dart';
|
||||
import '../helpers/reaction_helper.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../models/app_settings.dart';
|
||||
import '../storage/prefs_manager.dart';
|
||||
import '../utils/platform_info.dart';
|
||||
import 'notification_reply.dart';
|
||||
@@ -26,6 +27,11 @@ class NotificationService {
|
||||
|
||||
// Locale for localized notification strings
|
||||
Locale _locale = const Locale('en');
|
||||
String _publicIpfsGateway = AppSettings.defaultPublicIpfsGateway;
|
||||
|
||||
void setPublicIpfsGateway(String gateway) {
|
||||
_publicIpfsGateway = gateway.trim();
|
||||
}
|
||||
|
||||
/// Set the locale for notification strings (call when app locale changes)
|
||||
void setLocale(Locale locale) {
|
||||
@@ -297,7 +303,10 @@ class NotificationService {
|
||||
}) async {
|
||||
if (!urlImagesEnabled) return null;
|
||||
|
||||
final imageUrl = await MessageUrlImageHelper.parseVerified(text);
|
||||
final imageUrl = await MessageUrlImageHelper.parseVerified(
|
||||
text,
|
||||
publicGateway: _publicIpfsGateway,
|
||||
);
|
||||
if (imageUrl == null) return null;
|
||||
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user