mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-26 02:21:39 +00:00

* chore: optimize image upload * feat: show upload image status * chore: upload the ai image to cloud server
21 lines
590 B
Dart
21 lines
590 B
Dart
import 'dart:convert';
|
|
|
|
import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart';
|
|
import 'package:http/http.dart' as http;
|
|
|
|
Future<bool> isImageExistOnCloud({
|
|
required String url,
|
|
required UserProfilePB userProfilePB,
|
|
}) async {
|
|
final header = <String, String>{};
|
|
final token = userProfilePB.token;
|
|
try {
|
|
final decodedToken = jsonDecode(token);
|
|
header['Authorization'] = 'Bearer ${decodedToken['access_token']}';
|
|
final response = await http.get(Uri.http(url), headers: header);
|
|
return response.statusCode == 200;
|
|
} catch (_) {
|
|
return false;
|
|
}
|
|
}
|