mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-12 11:31:09 +00:00
New sound for incoming transfer
This commit is contained in:
1 parent
46b45cd3f7
commit
d6658498ba
5 files changed
+72
-14
No files matched your search
@@ -10,20 +10,24 @@ import UserNotifications
|
||||
import NearbyShare
|
||||
import SwiftUI
|
||||
import StoreKit
|
||||
import AudioToolbox
|
||||
|
||||
@main
|
||||
class AppDelegate: NSObject, NSApplicationDelegate, MainAppDelegate{
|
||||
private var statusItem:NSStatusItem?
|
||||
private var activeIncomingTransfers:[String:TransferInfo]=[:]
|
||||
private var statusItem: NSStatusItem?
|
||||
private var activeIncomingTransfers: [String : TransferInfo] = [:]
|
||||
|
||||
var welcomeWindow: NSWindow?
|
||||
var plusWindow: NSWindow?
|
||||
private var iapManager: IAPManager?
|
||||
|
||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||
let menu=NSMenu()
|
||||
|
||||
let menu = NSMenu()
|
||||
|
||||
menu.addItem(withTitle: NSLocalizedString("VisibleToEveryone", value: "Visible to everyone", comment: ""), action: nil, keyEquivalent: "")
|
||||
menu.addItem(withTitle: String(format: NSLocalizedString("DeviceName", value: "Device name: %@", comment: ""), arguments: [Host.current().localizedName!]), action: nil, keyEquivalent: "")
|
||||
|
||||
menu.addItem(NSMenuItem.separator())
|
||||
|
||||
// // Add "Recommended Apps" menu item
|
||||
@@ -41,10 +45,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, MainAppDelegate{
|
||||
|
||||
menu.addItem(withTitle: NSLocalizedString("Quit", value: "Quit QuickDrop", comment: ""), action: #selector(NSApplication.terminate(_:)), keyEquivalent: "")
|
||||
|
||||
|
||||
statusItem=NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
|
||||
statusItem?.button?.image=NSImage(named: "MenuBarIcon")
|
||||
statusItem?.menu=menu
|
||||
statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
|
||||
statusItem?.button?.image = NSImage(named: "MenuBarIcon")
|
||||
statusItem?.menu = menu
|
||||
statusItem?.behavior = .removalAllowed
|
||||
|
||||
NearbyConnectionManager.shared.mainAppDelegate=self
|
||||
@@ -184,7 +187,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, MainAppDelegate{
|
||||
func obtainUserConsent(for transfer: TransferMetadata, from device: RemoteDeviceInfo) {
|
||||
self.activeIncomingTransfers[transfer.id] = TransferInfo(device: device, transfer: transfer)
|
||||
|
||||
NSSound(named: NSSound.Name("NSUserNotificationDefaultSoundName"))?.play()
|
||||
AudioManager.playSound()
|
||||
|
||||
let alert = NSAlert()
|
||||
alert.alertStyle = .informational
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// AudioManager.swift
|
||||
// QuickDrop
|
||||
//
|
||||
// Created by Leon Böttger on 01.03.25.
|
||||
//
|
||||
|
||||
import AVFoundation
|
||||
|
||||
class AudioManager {
|
||||
static var audioPlayer: AVAudioPlayer?
|
||||
|
||||
static func playSound() {
|
||||
guard let soundURL = Bundle.main.url(forResource: "timeIsNow", withExtension: "mp3") else {
|
||||
print("Sound file not found")
|
||||
return
|
||||
}
|
||||
|
||||
do {
|
||||
audioPlayer = try AVAudioPlayer(contentsOf: soundURL)
|
||||
audioPlayer?.play()
|
||||
} catch {
|
||||
print("Error playing sound: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import SwiftUI
|
||||
|
||||
struct WelcomeScreen: View {
|
||||
|
||||
@State private var newWindow: NSWindow? // Retain the NSWindow object
|
||||
@State private var newWindow: NSWindow?
|
||||
@AppStorage(UserDefaultsKeys.plusVersion.rawValue) var isPlusVersion = false
|
||||
|
||||
@Environment(\.colorScheme) var colorScheme
|
||||
@@ -86,11 +86,6 @@ struct WelcomeScreen: View {
|
||||
.buttonStyle(.plain)
|
||||
#endif
|
||||
}
|
||||
.onAppear {
|
||||
// #if DEBUG
|
||||
// isPlusVersion = false
|
||||
// #endif
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.frame(maxWidth: 500)
|
||||
@@ -276,6 +271,32 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
All of the sounds listed below are provided under the Creative Commons Attribution 4.0 International License.
|
||||
|
||||
https://creativecommons.org/licenses/by/4.0/legalcode
|
||||
|
||||
Creative Commons Attribution 4.0 International Public License (2020/14/09)
|
||||
|
||||
[...]
|
||||
|
||||
Section 5 – Disclaimer of Warranties and Limitation of Liability.
|
||||
|
||||
Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
|
||||
To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
|
||||
The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
|
||||
|
||||
[...]
|
||||
|
||||
All sounds are copyrighted material of https://notificationsounds.com
|
||||
|
||||
Terms of use: https://notificationsounds.com/terms-of-use
|
||||
|
||||
Sound files:
|
||||
|
||||
https://notificationsounds.com/notification-sounds/time-is-now-585
|
||||
|
||||
Modifications to sound files: Volume and length, no previous modifications.
|
||||
""")
|
||||
.padding()
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
69DCF49C2AB8C58500CBE2CC /* SwiftECC in Frameworks */ = {isa = PBXBuildFile; productRef = 69DCF49B2AB8C58500CBE2CC /* SwiftECC */; };
|
||||
69DCF49D2AB8C9A500CBE2CC /* libNearbyShare.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 69DCF4812AB70D0600CBE2CC /* libNearbyShare.dylib */; };
|
||||
69DCF49E2AB8C9A500CBE2CC /* libNearbyShare.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 69DCF4812AB70D0600CBE2CC /* libNearbyShare.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
EB3643602D73A2A2009CDFF8 /* AudioManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB36435F2D73A29F009CDFF8 /* AudioManager.swift */; };
|
||||
EB3643622D73A2CA009CDFF8 /* timeIsNow.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = EB3643612D73A2CA009CDFF8 /* timeIsNow.mp3 */; };
|
||||
EB7CD1432D6FAEB400CB0CB5 /* UserDefaultsKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB7CD1422D6FAEAF00CB0CB5 /* UserDefaultsKeys.swift */; };
|
||||
EB7CD1452D6FB0C300CB0CB5 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB7CD1442D6FB0C100CB0CB5 /* Logger.swift */; };
|
||||
EB7CD1462D6FB0E800CB0CB5 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB7CD1442D6FB0C100CB0CB5 /* Logger.swift */; };
|
||||
@@ -205,6 +207,8 @@
|
||||
E9C8C6D42CFF66650053474D /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
E9C8C6D52CFF66650053474D /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ro; path = ro.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
||||
E9C8C6D62CFF66650053474D /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
EB36435F2D73A29F009CDFF8 /* AudioManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioManager.swift; sourceTree = "<group>"; };
|
||||
EB3643612D73A2CA009CDFF8 /* timeIsNow.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = timeIsNow.mp3; sourceTree = "<group>"; };
|
||||
EB4ACE3C2D345A0800A0AF4C /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
EB7CD1422D6FAEAF00CB0CB5 /* UserDefaultsKeys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultsKeys.swift; sourceTree = "<group>"; };
|
||||
EB7CD1442D6FB0C100CB0CB5 /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = "<group>"; };
|
||||
@@ -279,6 +283,7 @@
|
||||
698DFAEC29E353220064F247 /* Frameworks */,
|
||||
69DA9A0F29E0BF5100A442DA /* Products */,
|
||||
EB7CD1442D6FB0C100CB0CB5 /* Logger.swift */,
|
||||
EB3643612D73A2CA009CDFF8 /* timeIsNow.mp3 */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -298,6 +303,7 @@
|
||||
EBD2A2182D28619200BCB8E2 /* Info.plist */,
|
||||
69DA9A1129E0BF5100A442DA /* AppDelegate.swift */,
|
||||
EBD2A2162D2860BE00BCB8E2 /* WelcomeScreen.swift */,
|
||||
EB36435F2D73A29F009CDFF8 /* AudioManager.swift */,
|
||||
EB7CD1422D6FAEAF00CB0CB5 /* UserDefaultsKeys.swift */,
|
||||
EB7CD13B2D6F8B6500CB0CB5 /* IAP */,
|
||||
69DA9A1329E0BF5200A442DA /* Assets.xcassets */,
|
||||
@@ -498,6 +504,7 @@
|
||||
69D2C33829E78DF400EC7E30 /* Localizable.stringsdict in Resources */,
|
||||
69D2C32D29E77F2200EC7E30 /* Localizable.strings in Resources */,
|
||||
69D2C32F29E7898C00EC7E30 /* MainMenu.xib in Resources */,
|
||||
EB3643622D73A2CA009CDFF8 /* timeIsNow.mp3 in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -519,6 +526,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
EBD2A2172D2860C100BCB8E2 /* WelcomeScreen.swift in Sources */,
|
||||
EB3643602D73A2A2009CDFF8 /* AudioManager.swift in Sources */,
|
||||
EB7CD1432D6FAEB400CB0CB5 /* UserDefaultsKeys.swift in Sources */,
|
||||
69DA9A1229E0BF5100A442DA /* AppDelegate.swift in Sources */,
|
||||
EB7CD1452D6FB0C300CB0CB5 /* Logger.swift in Sources */,
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user