diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e4cdf79..c137e1a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.95 + +- [DSFileService] Fixed ```getExtensionFromMimeType``` method to get mime type based on RegEx. + ## 0.0.94 - [DSExpandedImage] Centered the circular progress loading. diff --git a/lib/src/services/ds_file.service.dart b/lib/src/services/ds_file.service.dart index 0809f1e0..def8c58f 100644 --- a/lib/src/services/ds_file.service.dart +++ b/lib/src/services/ds_file.service.dart @@ -1,7 +1,6 @@ import 'dart:io'; import 'package:dio/dio.dart'; -import 'package:mime/mime.dart'; import 'package:open_filex/open_filex.dart'; import 'package:path/path.dart' as path_utils; import 'package:path_provider/path_provider.dart'; @@ -79,17 +78,19 @@ abstract class DSFileService { final hasExtension = path_utils.extension(savedFilePath).isNotEmpty; if (!hasExtension) { - final newExtension = getFileExtensionFromMime( - response.headers.map['content-type']?.first, - ); + final mime = response.headers.map['content-type']?.first; + + if (mime?.isNotEmpty ?? false) { + final newExtension = getExtensionFromMimeType(mime!); - if (newExtension.isNotEmpty) { - final filename = savedFilePath.substring(0); + if (newExtension.isNotEmpty) { + final filename = savedFilePath.substring(0); - final newFilePath = '$filename.$newExtension'; + final newFilePath = '$filename.$newExtension'; - File(savedFilePath).renameSync(newFilePath); - savedFilePath = newFilePath; + File(savedFilePath).renameSync(newFilePath); + savedFilePath = newFilePath; + } } } @@ -102,9 +103,12 @@ abstract class DSFileService { return null; } - static String getFileExtensionFromMime(String? mimeType) { + static String getExtensionFromMimeType(final String mimeType) { return mimeType == 'application/vnd.ms-powerpoint' ? 'ppt' - : extensionFromMime(mimeType ?? ''); + : RegExp(r'((?<=\/)[a-zA-Z0-9]+)') + .firstMatch(mimeType)?[0] + ?.toLowerCase() ?? + ''; } } diff --git a/lib/src/widgets/utils/ds_card.widget.dart b/lib/src/widgets/utils/ds_card.widget.dart index eec23aa5..56729ed2 100644 --- a/lib/src/widgets/utils/ds_card.widget.dart +++ b/lib/src/widgets/utils/ds_card.widget.dart @@ -326,7 +326,7 @@ class DSCard extends StatelessWidget { replyContent: replyContent, size: size, filename: media.title ?? - '${media.uri.hashCode}.${DSFileService.getFileExtensionFromMime(media.type)}', + '${media.uri.hashCode}.${DSFileService.getExtensionFromMimeType(media.type)}', borderRadius: borderRadius, style: style, shouldAuthenticate: shouldAuthenticate, diff --git a/pubspec.yaml b/pubspec.yaml index aebb5775..1c25b011 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: blip_ds description: Blip Design System for Flutter. -version: 0.0.94 +version: 0.0.95 homepage: https://github.com/takenet/blip-ds-flutter#readme repository: https://github.com/takenet/blip-ds-flutter diff --git a/sample/ios/Podfile.lock b/sample/ios/Podfile.lock index ef382193..512f2e6d 100644 --- a/sample/ios/Podfile.lock +++ b/sample/ios/Podfile.lock @@ -9,56 +9,83 @@ PODS: - ffmpeg-kit-ios-full-gpl (= 5.1) - Flutter - Flutter (1.0.0) + - flutter_image_compress_common (1.0.0): + - Flutter + - Mantle + - SDWebImage + - SDWebImageWebPCoder - FMDB (2.7.5): - FMDB/standard (= 2.7.5) - FMDB/standard (2.7.5) - just_audio (0.0.1): - Flutter - - libphonenumber_plugin (0.0.1): - - Flutter - - PhoneNumberKit + - libwebp (1.3.2): + - libwebp/demux (= 1.3.2) + - libwebp/mux (= 1.3.2) + - libwebp/sharpyuv (= 1.3.2) + - libwebp/webp (= 1.3.2) + - libwebp/demux (1.3.2): + - libwebp/webp + - libwebp/mux (1.3.2): + - libwebp/demux + - libwebp/sharpyuv (1.3.2) + - libwebp/webp (1.3.2): + - libwebp/sharpyuv + - Mantle (2.2.0): + - Mantle/extobjc (= 2.2.0) + - Mantle/extobjc (2.2.0) - map_launcher (0.0.1): - Flutter - open_filex (0.0.2): - Flutter + - package_info_plus (0.4.5): + - Flutter - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS - - PhoneNumberKit (3.3.4): - - PhoneNumberKit/PhoneNumberKitCore (= 3.3.4) - - PhoneNumberKit/UIKit (= 3.3.4) - - PhoneNumberKit/PhoneNumberKitCore (3.3.4) - - PhoneNumberKit/UIKit (3.3.4): - - PhoneNumberKit/PhoneNumberKitCore - - sqflite (0.0.2): + - SDWebImage (5.18.5): + - SDWebImage/Core (= 5.18.5) + - SDWebImage/Core (5.18.5) + - SDWebImageWebPCoder (0.14.2): + - libwebp (~> 1.0) + - SDWebImage/Core (~> 5.17) + - sqflite (0.0.3): - Flutter - FMDB (>= 2.7.5) - url_launcher_ios (0.0.1): - Flutter + - video_compress (0.3.0): + - Flutter - video_player_avfoundation (0.0.1): - Flutter - - wakelock (0.0.1): + - FlutterMacOS + - wakelock_plus (0.0.1): - Flutter DEPENDENCIES: - audio_session (from `.symlinks/plugins/audio_session/ios`) - ffmpeg_kit_flutter_full_gpl (from `.symlinks/plugins/ffmpeg_kit_flutter_full_gpl/ios`) - Flutter (from `Flutter`) + - flutter_image_compress_common (from `.symlinks/plugins/flutter_image_compress_common/ios`) - just_audio (from `.symlinks/plugins/just_audio/ios`) - - libphonenumber_plugin (from `.symlinks/plugins/libphonenumber_plugin/ios`) - map_launcher (from `.symlinks/plugins/map_launcher/ios`) - open_filex (from `.symlinks/plugins/open_filex/ios`) + - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - sqflite (from `.symlinks/plugins/sqflite/ios`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`) - - wakelock (from `.symlinks/plugins/wakelock/ios`) + - video_compress (from `.symlinks/plugins/video_compress/ios`) + - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`) + - wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`) SPEC REPOS: trunk: - ffmpeg-kit-ios-full-gpl - FMDB - - PhoneNumberKit + - libwebp + - Mantle + - SDWebImage + - SDWebImageWebPCoder EXTERNAL SOURCES: audio_session: @@ -67,42 +94,51 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/ffmpeg_kit_flutter_full_gpl/ios" Flutter: :path: Flutter + flutter_image_compress_common: + :path: ".symlinks/plugins/flutter_image_compress_common/ios" just_audio: :path: ".symlinks/plugins/just_audio/ios" - libphonenumber_plugin: - :path: ".symlinks/plugins/libphonenumber_plugin/ios" map_launcher: :path: ".symlinks/plugins/map_launcher/ios" open_filex: :path: ".symlinks/plugins/open_filex/ios" + package_info_plus: + :path: ".symlinks/plugins/package_info_plus/ios" path_provider_foundation: :path: ".symlinks/plugins/path_provider_foundation/darwin" sqflite: :path: ".symlinks/plugins/sqflite/ios" url_launcher_ios: :path: ".symlinks/plugins/url_launcher_ios/ios" + video_compress: + :path: ".symlinks/plugins/video_compress/ios" video_player_avfoundation: - :path: ".symlinks/plugins/video_player_avfoundation/ios" - wakelock: - :path: ".symlinks/plugins/wakelock/ios" + :path: ".symlinks/plugins/video_player_avfoundation/darwin" + wakelock_plus: + :path: ".symlinks/plugins/wakelock_plus/ios" SPEC CHECKSUMS: audio_session: 4f3e461722055d21515cf3261b64c973c062f345 ffmpeg-kit-ios-full-gpl: 2682965e5b3e7f13a05836d46d302eafe6c5039e ffmpeg_kit_flutter_full_gpl: 7dcfcdc419f4667252cde1871859976bca328169 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + flutter_image_compress_common: ec1d45c362c9d30a3f6a0426c297f47c52007e3e FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa - libphonenumber_plugin: e8a7d64a6624a7c25f2c4ab0b7ead2a8e341e35e + libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009 + Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d map_launcher: e325db1261d029ff33e08e03baccffe09593ffea open_filex: 6e26e659846ec990262224a12ef1c528bb4edbe4 - path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852 - PhoneNumberKit: 441e8b26ec88d598e3591de9061eff18f5dd12e8 - sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 - url_launcher_ios: ae1517e5e344f5544fb090b079e11f399dfbe4d2 - video_player_avfoundation: e489aac24ef5cf7af82702979ed16f2a5ef84cff - wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f + package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85 + path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 + SDWebImage: 7ac2b7ddc5e8484c79aa90fc4e30b149d6a2c88f + SDWebImageWebPCoder: 633b813fca24f1de5e076bcd7f720c038b23892b + sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a + url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b + video_compress: fce97e4fb1dfd88175aa07d2ffc8a2f297f87fbe + video_player_avfoundation: e9e6f9cae7d7a6d9b43519b0aab382bca60fcfd1 + wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47 PODFILE CHECKSUM: da491a8b7d2d8eef05b8be02236cf916620dd0f4 -COCOAPODS: 1.12.1 +COCOAPODS: 1.14.3 diff --git a/sample/ios/Runner.xcodeproj/project.pbxproj b/sample/ios/Runner.xcodeproj/project.pbxproj index 01187341..68c4041d 100644 --- a/sample/ios/Runner.xcodeproj/project.pbxproj +++ b/sample/ios/Runner.xcodeproj/project.pbxproj @@ -358,7 +358,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = CZXK68F2MF; + DEVELOPMENT_TEAM = 2U6X6P3626; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; @@ -368,8 +368,12 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.example.sample; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; @@ -488,7 +492,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = CZXK68F2MF; + DEVELOPMENT_TEAM = 2U6X6P3626; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; @@ -498,9 +502,13 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.example.sample; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -512,7 +520,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = CZXK68F2MF; + DEVELOPMENT_TEAM = 2U6X6P3626; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; @@ -522,8 +530,12 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.example.sample; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; diff --git a/sample/macos/Flutter/GeneratedPluginRegistrant.swift b/sample/macos/Flutter/GeneratedPluginRegistrant.swift index 82711f78..8b0f1c12 100644 --- a/sample/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/sample/macos/Flutter/GeneratedPluginRegistrant.swift @@ -7,6 +7,7 @@ import Foundation import audio_session import ffmpeg_kit_flutter_full_gpl +import flutter_image_compress_macos import just_audio import package_info_plus import path_provider_foundation @@ -19,6 +20,7 @@ import wakelock_plus func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin")) FFmpegKitFlutterPlugin.register(with: registry.registrar(forPlugin: "FFmpegKitFlutterPlugin")) + FlutterImageCompressMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterImageCompressMacosPlugin")) JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) diff --git a/sample/pubspec.lock b/sample/pubspec.lock index dcf683a4..5ddd61b8 100644 --- a/sample/pubspec.lock +++ b/sample/pubspec.lock @@ -31,7 +31,7 @@ packages: path: ".." relative: true source: path - version: "0.0.88" + version: "0.0.95" boolean_selector: dependency: transitive description: @@ -104,6 +104,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.17.2" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "2f9d2cbccb76127ba28528cb3ae2c2326a122446a83de5a056aaa3880d3882c5" + url: "https://pub.dev" + source: hosted + version: "0.3.3+7" crypto: dependency: transitive description: @@ -221,6 +229,46 @@ packages: url: "https://pub.dev" source: hosted version: "3.3.1" + flutter_image_compress: + dependency: transitive + description: + name: flutter_image_compress + sha256: f159d2e8c4ed04b8e36994124fd4a5017a0f01e831ae3358c74095c340e9ae5e + url: "https://pub.dev" + source: hosted + version: "2.1.0" + flutter_image_compress_common: + dependency: transitive + description: + name: flutter_image_compress_common + sha256: "7cad12802628706655920089cfe9ee1d1098300e7f39a079eb160458bbc47652" + url: "https://pub.dev" + source: hosted + version: "1.0.3" + flutter_image_compress_macos: + dependency: transitive + description: + name: flutter_image_compress_macos + sha256: fea1e3d71150d03373916b832c49b5c2f56c3e7e13da82a929274a2c6f88251e + url: "https://pub.dev" + source: hosted + version: "1.0.1" + flutter_image_compress_platform_interface: + dependency: transitive + description: + name: flutter_image_compress_platform_interface + sha256: eb4f055138b29b04498ebcb6d569aaaee34b64d75fb74ea0d40f9790bf47ee9d + url: "https://pub.dev" + source: hosted + version: "1.0.3" + flutter_image_compress_web: + dependency: transitive + description: + name: flutter_image_compress_web + sha256: da41cc3859f19d11c7d10be615f6a9dcf0907e7daffde7442bf4cc2486663660 + url: "https://pub.dev" + source: hosted + version: "0.1.3+2" flutter_lints: dependency: "direct dev" description: