implement base of image picker

This commit is contained in:
Hailey
2024-10-27 00:29:38 -07:00
parent 2b53ef2541
commit 3ef867d894
4 changed files with 263 additions and 21 deletions
@@ -10,7 +10,9 @@ Pod::Spec.new do |s|
s.static_framework = true
s.dependency 'ExpoModulesCore'
s.dependency 'SDWebImage', '~> 5.19.1'
s.dependency 'SDWebImageWebPCoder', '~> 0.14.6'
# Swift/Objective-C compatibility
s.pod_target_xcconfig = {
'DEFINES_MODULE' => 'YES',
@@ -42,5 +42,9 @@ public class ExpoPlatformInfoModule: Module {
}
}
}
AsyncFunction("isAnimatedImage") { (url: URL) in
return ImageInfo.isAnimatedImage(url: url)
}
}
}
@@ -0,0 +1,22 @@
//
// IsAnimatedImage.swift
// Pods
//
// Created by Hailey on 10/27/24.
//
import SDWebImage
class ImageInfo {
static func isAnimatedImage(url: URL) -> Bool {
var path: String
if #available(iOS 16.0, *) {
path = url.path()
} else {
path = url.path
}
let image = SDAnimatedImage(contentsOfFile: path)
return image?.sd_isAnimated ?? false
}
}