This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func asynchronouslyLoadURLAssets(_ newAsset: AVURLAsset) { | |
DispatchQueue.main.async { | |
newAsset.loadValuesAsynchronously(forKeys: self.assetKeysRequiredToPlay) { | |
for key in self.assetKeysRequiredToPlay { | |
var error: NSError? | |
if newAsset.statusOfValue(forKey: key, error: &error) == .failed { | |
self.delegate?.playerDidFailToPlay(message: "Can't use this AVAsset because one of it's keys failed to load") | |
return | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func cleanExpiredVideos() { | |
let currentTimeStamp = Date().timeIntervalSince1970 | |
var expiredKeys: [String] = [] | |
for videoData in videosDict where currentTimeStamp - videoData.value.timeStamp >= expiryTime { | |
// video is expired. delete | |
if let _ = popupVideosDict[videoData.key] { | |
expiredKeys.append(videoData.key) | |
} | |
} | |
for key in expiredKeys { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func isStorageAvailable() -> Bool { | |
let fileURL = URL(fileURLWithPath: NSHomeDirectory() as String) | |
do { | |
let values = try fileURL.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey, .volumeTotalCapacityKey]) | |
guard let totalSpace = values.volumeTotalCapacity, | |
let freeSpace = values.volumeAvailableCapacityForImportantUsage else { | |
return false | |
} | |
if freeSpace > minimumSpaceRequired { | |
return true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun ApplyButton( | |
text: String, | |
modifier: Modifier = Modifier, | |
applicable: Boolean = false, | |
spanStyle: SpanStyle, | |
paragraphStyle: ParagraphStyle, | |
style: TextStyle, | |
onClick: () -> Unit | |
) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if UIAccessibility.isVoiceOverRunning { | |
// add cart button in item cell | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let addItemAction = UIAccessibilityCustomAction(name: "Add one quantity of this item.") { [weak self] _ in | |
// add 1 quantity of the item selected | |
UIAccessibility.post(notification: .announcement, argument: "Item added, total number of items in cart now is \(noOfItems) with a subtotal of \(cartTotal) rupees") | |
} | |
let removeItemAction = UIAccessibilityCustomAction(name: "Remove one quantity of this item.") { [weak self] _ in | |
if itemsInCart { | |
//remove 1 quantity of the item selected | |
if noOfItems == 0 { | |
UIAccessibility.post(notification: .announcement, argument: "Item removed, no items in cart now") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIAccessibility.post(notification: .announcement, | |
argument: "Location has changed to JP Nagar") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imageView.isAccessibilityElement = true | |
imageView.accessibilityLabel = dataSource.accessibility.altText |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cell.isAccessibilityElement = true | |
cell.accessibilityLabel = restaurantName + rating + offer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension URL { | |
var attributes: [FileAttributeKey : Any]? { | |
do { | |
return try FileManager.default.attributesOfItem(atPath: path) | |
} catch let error as NSError { | |
print("FileAttribute error: \(error)") | |
} | |
return nil | |
} |
NewerOlder