Skip to content

Commit

Permalink
Use nicer icons (#2426)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitschlag committed Dec 13, 2024
1 parent d729fb4 commit 2ed9f5d
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions deltachat-ios/Controller/FilesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ extension FilesViewController: UITableViewDelegate, UITableViewDataSource {
children.append(
UIAction.menuAction(
localizationKey: "remove_from_homescreen",
systemImageName: "square.and.arrow.up",
systemImageName: "rectangle.on.rectangle.slash",
indexPath: indexPath,
action: { _ in
self.removeFromHomescreen(messageId: messageId)
Expand All @@ -252,7 +252,7 @@ extension FilesViewController: UITableViewDelegate, UITableViewDataSource {
children.append(
UIAction.menuAction(
localizationKey: "add_to_home_screen",
systemImageName: "square.and.arrow.up",
systemImageName: "plus.rectangle.on.rectangle",
indexPath: indexPath,
action: { _ in
self.addToHomescreen(messageId: messageId)
Expand Down Expand Up @@ -325,26 +325,24 @@ extension FilesViewController {
}
}

@available(iOS 15, *)
func addToHomescreen(messageId: Int) {
let entry = WidgetEntry(accountId: dcContext.id, messageId: messageId)
var entries = dcContext.shownWidgets()
entries.insert(entry, at: entries.startIndex)

dcContext.storeShownWidgets(entries)
if #available(iOS 15.0, *) {
WidgetCenter.shared.reloadTimelines(ofKind: "DcWebxdcWidget")
}
WidgetCenter.shared.reloadTimelines(ofKind: "DcWebxdcWidget")
}

@available(iOS 15, *)
func removeFromHomescreen(messageId: Int) {
let entry = WidgetEntry(accountId: dcContext.id, messageId: messageId)
var entries = dcContext.shownWidgets()
entries.removeAll { $0 == entry }

dcContext.storeShownWidgets(entries)
if #available(iOS 15.0, *) {
WidgetCenter.shared.reloadTimelines(ofKind: "DcWebxdcWidget")
}
WidgetCenter.shared.reloadTimelines(ofKind: "DcWebxdcWidget")
}
}

Expand Down

0 comments on commit 2ed9f5d

Please sign in to comment.