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 | |
} |
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
static func findCachedVideoURL(forVideoId id: String) -> URL? { | |
let nsDocumentDirectory = FileManager.SearchPathDirectory.documentDirectory | |
let nsUserDomainMask = FileManager.SearchPathDomainMask.userDomainMask | |
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true) | |
if let dirPath = paths.first { | |
let fileURL = URL(fileURLWithPath: dirPath).appendingPathComponent(folderPath).appendingPathComponent(id + ".mp4") | |
let filePath = fileURL.path | |
let fileManager = FileManager.default | |
if fileManager.fileExists(atPath: filePath) { | |
NewRelicService.sendCustomEvent(with: NewRelicEventType.statusCodes, |
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 removeVideoIfMaxNumberOfVideosReached() { | |
if popupVideosDict.count >= maxVideosAllowed { | |
// remove the least recently used video | |
let sortedDict = popupVideosDict.keysSortedByValue { (v1, v2) -> Bool in | |
v1.timeStamp < v2.timeStamp | |
} | |
guard let videoId = sortedDict.first else { | |
return | |
} | |
popupVideosDict.removeValue(forKey: videoId) |
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 { |
NewerOlder