-
-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1067 from TortugaPower/fix-sharing-mac
Fix sharing debug information from a Mac
- Loading branch information
Showing
5 changed files
with
67 additions
and
9 deletions.
There are no files selected for viewing
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
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
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
47 changes: 47 additions & 0 deletions
47
BookPlayer/Services/DebugInformationActivityItemSource.swift
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// DebugInformationActivityItemSource.swift | ||
// BookPlayer | ||
// | ||
// Created by Gianni Carlo on 5/1/24. | ||
// Copyright © 2024 Tortuga Power. All rights reserved. | ||
// | ||
|
||
import LinkPresentation | ||
|
||
/// Share the debug information as a single String | ||
class DebugInformationActivityItemSource: NSObject, UIActivityItemSource { | ||
let title = "Debug information" | ||
let info: String | ||
|
||
init(info: String) { | ||
self.info = info | ||
super.init() | ||
} | ||
|
||
func activityViewControllerPlaceholderItem(_ activityViewController: UIActivityViewController) -> Any { | ||
return info | ||
} | ||
|
||
func activityViewController( | ||
_ activityViewController: UIActivityViewController, | ||
itemForActivityType activityType: UIActivity.ActivityType? | ||
) -> Any? { | ||
return info | ||
} | ||
|
||
func activityViewController( | ||
_ activityViewController: UIActivityViewController, | ||
subjectForActivityType activityType: UIActivity.ActivityType? | ||
) -> String { | ||
return title | ||
} | ||
|
||
func activityViewControllerLinkMetadata( | ||
_ activityViewController: UIActivityViewController | ||
) -> LPLinkMetadata? { | ||
let metadata = LPLinkMetadata() | ||
metadata.title = title | ||
metadata.iconProvider = NSItemProvider(object: UIImage(systemName: "line.3.horizontal")!) | ||
return metadata | ||
} | ||
} |
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