Add custom ringtone sounds.

This commit is contained in:
Matthew Chen 2018-02-21 20:59:03 -05:00
parent cd32895657
commit a44a117612
35 changed files with 664 additions and 374 deletions

View File

@ -9,20 +9,47 @@
/* Begin PBXBuildFile section */
2AE2882E4C2B96BFFF9EE27C /* Pods_SignalShareExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F94C85CB0B235DA37F68ED0 /* Pods_SignalShareExtension.framework */; };
34074F5B203D093B004596AE /* NotificationSoundsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34074F59203D093A004596AE /* NotificationSoundsViewController.m */; };
34074F61203D0CBE004596AE /* NotificationSounds.m in Sources */ = {isa = PBXBuildFile; fileRef = 34074F5F203D0CBD004596AE /* NotificationSounds.m */; };
34074F62203D0CBE004596AE /* NotificationSounds.h in Headers */ = {isa = PBXBuildFile; fileRef = 34074F60203D0CBE004596AE /* NotificationSounds.h */; settings = {ATTRIBUTES = (Public, ); }; };
34074FAE203D14D8004596AE /* aurora.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FAD203D14D8004596AE /* aurora.m4r */; };
34074FBA203D14F6004596AE /* bamboo.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FAF203D14F3004596AE /* bamboo.m4r */; };
34074FBB203D14F6004596AE /* circles.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FB0203D14F4004596AE /* circles.m4r */; };
34074FBC203D14F6004596AE /* chord.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FB1203D14F4004596AE /* chord.m4r */; };
34074FBD203D14F6004596AE /* complete.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FB2203D14F4004596AE /* complete.m4r */; };
34074FBE203D14F6004596AE /* hello.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FB3203D14F4004596AE /* hello.m4r */; };
34074FBF203D14F6004596AE /* input.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FB4203D14F4004596AE /* input.m4r */; };
34074FC0203D14F6004596AE /* note.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FB5203D14F4004596AE /* note.m4r */; };
34074FC1203D14F6004596AE /* popcorn.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FB6203D14F5004596AE /* popcorn.m4r */; };
34074FC2203D14F6004596AE /* pulse.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FB7203D14F5004596AE /* pulse.m4r */; };
34074FC3203D14F6004596AE /* synth.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FB8203D14F5004596AE /* synth.m4r */; };
34074FC4203D14F6004596AE /* keys.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FB9203D14F6004596AE /* keys.m4r */; };
34074F61203D0CBE004596AE /* OWSSounds.m in Sources */ = {isa = PBXBuildFile; fileRef = 34074F5F203D0CBD004596AE /* OWSSounds.m */; };
34074F62203D0CBE004596AE /* OWSSounds.h in Headers */ = {isa = PBXBuildFile; fileRef = 34074F60203D0CBE004596AE /* OWSSounds.h */; settings = {ATTRIBUTES = (Public, ); }; };
34074FEE203E5436004596AE /* aurora.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FC6203E5435004596AE /* aurora.m4r */; };
34074FEF203E5436004596AE /* bamboo.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FC7203E5435004596AE /* bamboo.m4r */; };
34074FF0203E5436004596AE /* chord.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FC8203E5435004596AE /* chord.m4r */; };
34074FF1203E5436004596AE /* circles.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FC9203E5435004596AE /* circles.m4r */; };
34074FF2203E5436004596AE /* complete.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FCA203E5435004596AE /* complete.m4r */; };
34074FF3203E5436004596AE /* hello.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FCB203E5435004596AE /* hello.m4r */; };
34074FF4203E5436004596AE /* input.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FCC203E5435004596AE /* input.m4r */; };
34074FF5203E5436004596AE /* keys.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FCD203E5435004596AE /* keys.m4r */; };
34074FF6203E5436004596AE /* note.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FCE203E5435004596AE /* note.m4r */; };
34074FF7203E5436004596AE /* popcorn.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FCF203E5435004596AE /* popcorn.m4r */; };
34074FF8203E5436004596AE /* pulse.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FD0203E5435004596AE /* pulse.m4r */; };
34074FF9203E5436004596AE /* synth.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FD1203E5435004596AE /* synth.m4r */; };
34074FFA203E5436004596AE /* Apex.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FD3203E5436004596AE /* Apex.m4r */; };
34074FFB203E5436004596AE /* Beacon.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FD4203E5436004596AE /* Beacon.m4r */; };
34074FFC203E5436004596AE /* Bulletin.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FD5203E5436004596AE /* Bulletin.m4r */; };
34074FFD203E5436004596AE /* By The Seaside.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FD6203E5436004596AE /* By The Seaside.m4r */; };
34074FFE203E5436004596AE /* Chimes.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FD7203E5436004596AE /* Chimes.m4r */; };
34074FFF203E5436004596AE /* Circuit.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FD8203E5436004596AE /* Circuit.m4r */; };
34075000203E5436004596AE /* Constellation.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FD9203E5436004596AE /* Constellation.m4r */; };
34075001203E5436004596AE /* Cosmic.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FDA203E5436004596AE /* Cosmic.m4r */; };
34075002203E5436004596AE /* Crystals.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FDB203E5436004596AE /* Crystals.m4r */; };
34075003203E5436004596AE /* Hillside.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FDC203E5436004596AE /* Hillside.m4r */; };
34075004203E5436004596AE /* Illuminate.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FDD203E5436004596AE /* Illuminate.m4r */; };
34075005203E5436004596AE /* Night Owl.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FDE203E5436004596AE /* Night Owl.m4r */; };
34075006203E5436004596AE /* Opening.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FDF203E5436004596AE /* Opening.m4r */; };
34075007203E5436004596AE /* Playtime.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FE0203E5436004596AE /* Playtime.m4r */; };
34075008203E5436004596AE /* Presto.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FE1203E5436004596AE /* Presto.m4r */; };
34075009203E5436004596AE /* Radar.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FE2203E5436004596AE /* Radar.m4r */; };
3407500A203E5436004596AE /* Radiate.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FE3203E5436004596AE /* Radiate.m4r */; };
3407500B203E5436004596AE /* Ripples.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FE4203E5436004596AE /* Ripples.m4r */; };
3407500C203E5436004596AE /* Sencha.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FE5203E5436004596AE /* Sencha.m4r */; };
3407500D203E5436004596AE /* Signal.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FE6203E5436004596AE /* Signal.m4r */; };
3407500E203E5436004596AE /* Silk.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FE7203E5436004596AE /* Silk.m4r */; };
3407500F203E5436004596AE /* Slow Rise.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FE8203E5436004596AE /* Slow Rise.m4r */; };
34075010203E5436004596AE /* Stargaze.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FE9203E5436004596AE /* Stargaze.m4r */; };
34075011203E5436004596AE /* Summit.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FEA203E5436004596AE /* Summit.m4r */; };
34075012203E5436004596AE /* Twinkle.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FEB203E5436004596AE /* Twinkle.m4r */; };
34075013203E5436004596AE /* Uplift.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FEC203E5436004596AE /* Uplift.m4r */; };
34075014203E5436004596AE /* Waves.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FED203E5436004596AE /* Waves.m4r */; };
340B02BA1FA0D6C700F9CFEC /* ConversationViewItemTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 340B02B91FA0D6C700F9CFEC /* ConversationViewItemTest.m */; };
340CB2271EAC25820001CAA1 /* UpdateGroupViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 340CB2261EAC25820001CAA1 /* UpdateGroupViewController.m */; };
341F2C0F1F2B8AE700D07D6B /* DebugUIMisc.m in Sources */ = {isa = PBXBuildFile; fileRef = 341F2C0E1F2B8AE700D07D6B /* DebugUIMisc.m */; };
@ -494,20 +521,47 @@
3400C7981EAFB772008A8584 /* ThreadViewHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ThreadViewHelper.m; sourceTree = "<group>"; };
34074F59203D093A004596AE /* NotificationSoundsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NotificationSoundsViewController.m; sourceTree = "<group>"; };
34074F5A203D093B004596AE /* NotificationSoundsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationSoundsViewController.h; sourceTree = "<group>"; };
34074F5F203D0CBD004596AE /* NotificationSounds.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NotificationSounds.m; sourceTree = "<group>"; };
34074F60203D0CBE004596AE /* NotificationSounds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationSounds.h; sourceTree = "<group>"; };
34074FAD203D14D8004596AE /* aurora.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; name = aurora.m4r; path = Signal/AudioFiles/messageReceivedSounds/aurora.m4r; sourceTree = SOURCE_ROOT; };
34074FAF203D14F3004596AE /* bamboo.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; name = bamboo.m4r; path = Signal/AudioFiles/messageReceivedSounds/bamboo.m4r; sourceTree = SOURCE_ROOT; };
34074FB0203D14F4004596AE /* circles.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; name = circles.m4r; path = Signal/AudioFiles/messageReceivedSounds/circles.m4r; sourceTree = SOURCE_ROOT; };
34074FB1203D14F4004596AE /* chord.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; name = chord.m4r; path = Signal/AudioFiles/messageReceivedSounds/chord.m4r; sourceTree = SOURCE_ROOT; };
34074FB2203D14F4004596AE /* complete.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; name = complete.m4r; path = Signal/AudioFiles/messageReceivedSounds/complete.m4r; sourceTree = SOURCE_ROOT; };
34074FB3203D14F4004596AE /* hello.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; name = hello.m4r; path = Signal/AudioFiles/messageReceivedSounds/hello.m4r; sourceTree = SOURCE_ROOT; };
34074FB4203D14F4004596AE /* input.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; name = input.m4r; path = Signal/AudioFiles/messageReceivedSounds/input.m4r; sourceTree = SOURCE_ROOT; };
34074FB5203D14F4004596AE /* note.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; name = note.m4r; path = Signal/AudioFiles/messageReceivedSounds/note.m4r; sourceTree = SOURCE_ROOT; };
34074FB6203D14F5004596AE /* popcorn.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; name = popcorn.m4r; path = Signal/AudioFiles/messageReceivedSounds/popcorn.m4r; sourceTree = SOURCE_ROOT; };
34074FB7203D14F5004596AE /* pulse.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; name = pulse.m4r; path = Signal/AudioFiles/messageReceivedSounds/pulse.m4r; sourceTree = SOURCE_ROOT; };
34074FB8203D14F5004596AE /* synth.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; name = synth.m4r; path = Signal/AudioFiles/messageReceivedSounds/synth.m4r; sourceTree = SOURCE_ROOT; };
34074FB9203D14F6004596AE /* keys.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; name = keys.m4r; path = Signal/AudioFiles/messageReceivedSounds/keys.m4r; sourceTree = SOURCE_ROOT; };
34074F5F203D0CBD004596AE /* OWSSounds.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSSounds.m; sourceTree = "<group>"; };
34074F60203D0CBE004596AE /* OWSSounds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSSounds.h; sourceTree = "<group>"; };
34074FC6203E5435004596AE /* aurora.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = aurora.m4r; sourceTree = "<group>"; };
34074FC7203E5435004596AE /* bamboo.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = bamboo.m4r; sourceTree = "<group>"; };
34074FC8203E5435004596AE /* chord.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = chord.m4r; sourceTree = "<group>"; };
34074FC9203E5435004596AE /* circles.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = circles.m4r; sourceTree = "<group>"; };
34074FCA203E5435004596AE /* complete.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = complete.m4r; sourceTree = "<group>"; };
34074FCB203E5435004596AE /* hello.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = hello.m4r; sourceTree = "<group>"; };
34074FCC203E5435004596AE /* input.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = input.m4r; sourceTree = "<group>"; };
34074FCD203E5435004596AE /* keys.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = keys.m4r; sourceTree = "<group>"; };
34074FCE203E5435004596AE /* note.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = note.m4r; sourceTree = "<group>"; };
34074FCF203E5435004596AE /* popcorn.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = popcorn.m4r; sourceTree = "<group>"; };
34074FD0203E5435004596AE /* pulse.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = pulse.m4r; sourceTree = "<group>"; };
34074FD1203E5435004596AE /* synth.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = synth.m4r; sourceTree = "<group>"; };
34074FD3203E5436004596AE /* Apex.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Apex.m4r; sourceTree = "<group>"; };
34074FD4203E5436004596AE /* Beacon.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Beacon.m4r; sourceTree = "<group>"; };
34074FD5203E5436004596AE /* Bulletin.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Bulletin.m4r; sourceTree = "<group>"; };
34074FD6203E5436004596AE /* By The Seaside.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = "By The Seaside.m4r"; sourceTree = "<group>"; };
34074FD7203E5436004596AE /* Chimes.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Chimes.m4r; sourceTree = "<group>"; };
34074FD8203E5436004596AE /* Circuit.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Circuit.m4r; sourceTree = "<group>"; };
34074FD9203E5436004596AE /* Constellation.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Constellation.m4r; sourceTree = "<group>"; };
34074FDA203E5436004596AE /* Cosmic.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Cosmic.m4r; sourceTree = "<group>"; };
34074FDB203E5436004596AE /* Crystals.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Crystals.m4r; sourceTree = "<group>"; };
34074FDC203E5436004596AE /* Hillside.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Hillside.m4r; sourceTree = "<group>"; };
34074FDD203E5436004596AE /* Illuminate.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Illuminate.m4r; sourceTree = "<group>"; };
34074FDE203E5436004596AE /* Night Owl.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Night Owl.m4r"; sourceTree = "<group>"; };
34074FDF203E5436004596AE /* Opening.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Opening.m4r; sourceTree = "<group>"; };
34074FE0203E5436004596AE /* Playtime.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Playtime.m4r; sourceTree = "<group>"; };
34074FE1203E5436004596AE /* Presto.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Presto.m4r; sourceTree = "<group>"; };
34074FE2203E5436004596AE /* Radar.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Radar.m4r; sourceTree = "<group>"; };
34074FE3203E5436004596AE /* Radiate.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Radiate.m4r; sourceTree = "<group>"; };
34074FE4203E5436004596AE /* Ripples.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Ripples.m4r; sourceTree = "<group>"; };
34074FE5203E5436004596AE /* Sencha.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Sencha.m4r; sourceTree = "<group>"; };
34074FE6203E5436004596AE /* Signal.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Signal.m4r; sourceTree = "<group>"; };
34074FE7203E5436004596AE /* Silk.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Silk.m4r; sourceTree = "<group>"; };
34074FE8203E5436004596AE /* Slow Rise.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Slow Rise.m4r"; sourceTree = "<group>"; };
34074FE9203E5436004596AE /* Stargaze.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Stargaze.m4r; sourceTree = "<group>"; };
34074FEA203E5436004596AE /* Summit.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Summit.m4r; sourceTree = "<group>"; };
34074FEB203E5436004596AE /* Twinkle.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Twinkle.m4r; sourceTree = "<group>"; };
34074FEC203E5436004596AE /* Uplift.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Uplift.m4r; sourceTree = "<group>"; };
34074FED203E5436004596AE /* Waves.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = Waves.m4r; sourceTree = "<group>"; };
340B02B61F9FD31800F9CFEC /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = translations/he.lproj/Localizable.strings; sourceTree = "<group>"; };
340B02B91FA0D6C700F9CFEC /* ConversationViewItemTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ConversationViewItemTest.m; sourceTree = "<group>"; };
340CB2221EAC155C0001CAA1 /* ContactsViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactsViewHelper.h; sourceTree = "<group>"; };
@ -1118,37 +1172,66 @@
34074F54203D0722004596AE /* Sounds */ = {
isa = PBXGroup;
children = (
34074F63203D1258004596AE /* messageReceivedSounds */,
34074F7C203D126D004596AE /* ringtoneSounds */,
34074FC5203E5435004596AE /* messageReceivedSounds */,
34074FD2203E5436004596AE /* ringtoneSounds */,
);
path = Sounds;
sourceTree = "<group>";
};
34074F63203D1258004596AE /* messageReceivedSounds */ = {
34074FC5203E5435004596AE /* messageReceivedSounds */ = {
isa = PBXGroup;
children = (
34074FAD203D14D8004596AE /* aurora.m4r */,
34074FAF203D14F3004596AE /* bamboo.m4r */,
34074FB1203D14F4004596AE /* chord.m4r */,
34074FB0203D14F4004596AE /* circles.m4r */,
34074FB2203D14F4004596AE /* complete.m4r */,
34074FB3203D14F4004596AE /* hello.m4r */,
34074FB4203D14F4004596AE /* input.m4r */,
34074FB9203D14F6004596AE /* keys.m4r */,
34074FB5203D14F4004596AE /* note.m4r */,
34074FB6203D14F5004596AE /* popcorn.m4r */,
34074FB7203D14F5004596AE /* pulse.m4r */,
34074FB8203D14F5004596AE /* synth.m4r */,
34074FC6203E5435004596AE /* aurora.m4r */,
34074FC7203E5435004596AE /* bamboo.m4r */,
34074FC8203E5435004596AE /* chord.m4r */,
34074FC9203E5435004596AE /* circles.m4r */,
34074FCA203E5435004596AE /* complete.m4r */,
34074FCB203E5435004596AE /* hello.m4r */,
34074FCC203E5435004596AE /* input.m4r */,
34074FCD203E5435004596AE /* keys.m4r */,
34074FCE203E5435004596AE /* note.m4r */,
34074FCF203E5435004596AE /* popcorn.m4r */,
34074FD0203E5435004596AE /* pulse.m4r */,
34074FD1203E5435004596AE /* synth.m4r */,
);
path = messageReceivedSounds;
sourceTree = "<group>";
name = messageReceivedSounds;
path = Signal/AudioFiles/messageReceivedSounds;
sourceTree = SOURCE_ROOT;
};
34074F7C203D126D004596AE /* ringtoneSounds */ = {
34074FD2203E5436004596AE /* ringtoneSounds */ = {
isa = PBXGroup;
children = (
34074FD3203E5436004596AE /* Apex.m4r */,
34074FD4203E5436004596AE /* Beacon.m4r */,
34074FD5203E5436004596AE /* Bulletin.m4r */,
34074FD6203E5436004596AE /* By The Seaside.m4r */,
34074FD7203E5436004596AE /* Chimes.m4r */,
34074FD8203E5436004596AE /* Circuit.m4r */,
34074FD9203E5436004596AE /* Constellation.m4r */,
34074FDA203E5436004596AE /* Cosmic.m4r */,
34074FDB203E5436004596AE /* Crystals.m4r */,
34074FDC203E5436004596AE /* Hillside.m4r */,
34074FDD203E5436004596AE /* Illuminate.m4r */,
34074FDE203E5436004596AE /* Night Owl.m4r */,
34074FDF203E5436004596AE /* Opening.m4r */,
34074FE0203E5436004596AE /* Playtime.m4r */,
34074FE1203E5436004596AE /* Presto.m4r */,
34074FE2203E5436004596AE /* Radar.m4r */,
34074FE3203E5436004596AE /* Radiate.m4r */,
34074FE4203E5436004596AE /* Ripples.m4r */,
34074FE5203E5436004596AE /* Sencha.m4r */,
34074FE6203E5436004596AE /* Signal.m4r */,
34074FE7203E5436004596AE /* Silk.m4r */,
34074FE8203E5436004596AE /* Slow Rise.m4r */,
34074FE9203E5436004596AE /* Stargaze.m4r */,
34074FEA203E5436004596AE /* Summit.m4r */,
34074FEB203E5436004596AE /* Twinkle.m4r */,
34074FEC203E5436004596AE /* Uplift.m4r */,
34074FED203E5436004596AE /* Waves.m4r */,
);
path = ringtoneSounds;
sourceTree = "<group>";
name = ringtoneSounds;
path = Signal/AudioFiles/ringtoneSounds;
sourceTree = SOURCE_ROOT;
};
34330A581E7875FB00DF2FB9 /* Fonts */ = {
isa = PBXGroup;
@ -1266,9 +1349,9 @@
346129921FD1E30000532771 /* migrations */,
347850671FD9B78A007B8332 /* NoopCallMessageHandler.swift */,
347850681FD9B78A007B8332 /* NoopNotificationsManager.swift */,
34074F60203D0CBE004596AE /* NotificationSounds.h */,
34074F5F203D0CBD004596AE /* NotificationSounds.m */,
45F170AB1E2F0351003FC1F2 /* OWSAudioSession.swift */,
34074F60203D0CBE004596AE /* OWSSounds.h */,
34074F5F203D0CBD004596AE /* OWSSounds.m */,
346129561FD1D74B00532771 /* Release.h */,
346129571FD1D74B00532771 /* Release.m */,
346129581FD1D74B00532771 /* SignalKeyingStorage.h */,
@ -2171,7 +2254,7 @@
45194F901FD7200000333B2C /* ThreadUtil.h in Headers */,
346129CC1FD2072E00532771 /* NSAttributedString+OWS.h in Headers */,
346129FD1FD5F31400532771 /* OWS102MoveLoggingPreferenceToUserDefaults.h in Headers */,
34074F62203D0CBE004596AE /* NotificationSounds.h in Headers */,
34074F62203D0CBE004596AE /* OWSSounds.h in Headers */,
344F2499200FD03300CFB4F4 /* SharingThreadPickerViewController.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -2438,53 +2521,80 @@
buildActionMask = 2147483647;
files = (
AD83FF3F1A73426500B5C81A /* audio_pause_button_blue.png in Resources */,
3407500C203E5436004596AE /* Sencha.m4r in Resources */,
34330A5A1E7875FB00DF2FB9 /* fontawesome-webfont.ttf in Resources */,
A5509ECA1A69AB8B00ABA4BC /* Main.storyboard in Resources */,
AD83FF421A73426500B5C81A /* audio_play_button.png in Resources */,
34074FEF203E5436004596AE /* bamboo.m4r in Resources */,
34330A5C1E787A9800DF2FB9 /* dripicons-v2.ttf in Resources */,
B633C5C41A1D190B0059AC12 /* mute_on@2x.png in Resources */,
B633C5CE1A1D190B0059AC12 /* quit@2x.png in Resources */,
34075008203E5436004596AE /* Presto.m4r in Resources */,
34074FF1203E5436004596AE /* circles.m4r in Resources */,
AD83FF441A73426500B5C81A /* audio_pause_button.png in Resources */,
34074FBF203D14F6004596AE /* input.m4r in Resources */,
34074FBB203D14F6004596AE /* circles.m4r in Resources */,
34075005203E5436004596AE /* Night Owl.m4r in Resources */,
B6F509971AA53F760068F56A /* Localizable.strings in Resources */,
B633C59D1A1D190B0059AC12 /* endcall@2x.png in Resources */,
FC5CDF391A3393DD00B47253 /* error_white@2x.png in Resources */,
34075003203E5436004596AE /* Hillside.m4r in Resources */,
34074FFA203E5436004596AE /* Apex.m4r in Resources */,
3407500E203E5436004596AE /* Silk.m4r in Resources */,
34075004203E5436004596AE /* Illuminate.m4r in Resources */,
B633C5D21A1D190B0059AC12 /* savephoto@2x.png in Resources */,
B10C9B611A7049EC00ECA2BF /* play_icon.png in Resources */,
34074FF3203E5436004596AE /* hello.m4r in Resources */,
34074FF9203E5436004596AE /* synth.m4r in Resources */,
AD83FF401A73426500B5C81A /* audio_pause_button_blue@2x.png in Resources */,
34074FC3203D14F6004596AE /* synth.m4r in Resources */,
34074FC4203D14F6004596AE /* keys.m4r in Resources */,
B66DBF4A19D5BBC8006EA940 /* Images.xcassets in Resources */,
34074FF7203E5436004596AE /* popcorn.m4r in Resources */,
34074FFF203E5436004596AE /* Circuit.m4r in Resources */,
34074FF8203E5436004596AE /* pulse.m4r in Resources */,
4517642A1DE939FD00EDB8B9 /* ContactCell.xib in Resources */,
34074FC1203D14F6004596AE /* popcorn.m4r in Resources */,
34074FC2203D14F6004596AE /* pulse.m4r in Resources */,
AD83FF431A73426500B5C81A /* audio_play_button@2x.png in Resources */,
34074FBE203D14F6004596AE /* hello.m4r in Resources */,
34075007203E5436004596AE /* Playtime.m4r in Resources */,
45CB2FA81CB7146C00E1B343 /* Launch Screen.storyboard in Resources */,
34B3F8781E8DF1700035BE1A /* ContactsPicker.xib in Resources */,
34074FBA203D14F6004596AE /* bamboo.m4r in Resources */,
B633C5C31A1D190B0059AC12 /* mute_off@2x.png in Resources */,
3407500F203E5436004596AE /* Slow Rise.m4r in Resources */,
34074FF2203E5436004596AE /* complete.m4r in Resources */,
34074FFB203E5436004596AE /* Beacon.m4r in Resources */,
AD83FF411A73426500B5C81A /* audio_play_button_blue@2x.png in Resources */,
FC5CDF3A1A3393DD00B47253 /* warning_white@2x.png in Resources */,
34074FBC203D14F6004596AE /* chord.m4r in Resources */,
34074FC0203D14F6004596AE /* note.m4r in Resources */,
34074FAE203D14D8004596AE /* aurora.m4r in Resources */,
34075014203E5436004596AE /* Waves.m4r in Resources */,
34075011203E5436004596AE /* Summit.m4r in Resources */,
E1370BE018A0686600826894 /* busy.mp3 in Resources */,
34075006203E5436004596AE /* Opening.m4r in Resources */,
34074FF6203E5436004596AE /* note.m4r in Resources */,
E1370BE218A0686C00826894 /* failure.mp3 in Resources */,
34075009203E5436004596AE /* Radar.m4r in Resources */,
34075012203E5436004596AE /* Twinkle.m4r in Resources */,
B633C58D1A1D190B0059AC12 /* contact_default_feed.png in Resources */,
B10C9B621A7049EC00ECA2BF /* play_icon@2x.png in Resources */,
34074FFE203E5436004596AE /* Chimes.m4r in Resources */,
B633C5861A1D190B0059AC12 /* call@2x.png in Resources */,
B67EBF5D19194AC60084CCFD /* Settings.bundle in Resources */,
34074FF5203E5436004596AE /* keys.m4r in Resources */,
3407500D203E5436004596AE /* Signal.m4r in Resources */,
34075000203E5436004596AE /* Constellation.m4r in Resources */,
E1370BE418A0686C00826894 /* outring.mp3 in Resources */,
B10C9B601A7049EC00ECA2BF /* pause_icon@2x.png in Resources */,
34075002203E5436004596AE /* Crystals.m4r in Resources */,
E1370BE518A0686C00826894 /* r.caf in Resources */,
FC9120411A39EFB70074545C /* qr@2x.png in Resources */,
34075001203E5436004596AE /* Cosmic.m4r in Resources */,
34074FFD203E5436004596AE /* By The Seaside.m4r in Resources */,
34075013203E5436004596AE /* Uplift.m4r in Resources */,
E1370BE618A0686C00826894 /* sonarping.mp3 in Resources */,
3407500B203E5436004596AE /* Ripples.m4r in Resources */,
34075010203E5436004596AE /* Stargaze.m4r in Resources */,
34074FF0203E5436004596AE /* chord.m4r in Resources */,
34074FF4203E5436004596AE /* input.m4r in Resources */,
B10C9B5F1A7049EC00ECA2BF /* pause_icon.png in Resources */,
3407500A203E5436004596AE /* Radiate.m4r in Resources */,
AD83FF471A73428300B5C81A /* audio_play_button_blue.png in Resources */,
34074FFC203E5436004596AE /* Bulletin.m4r in Resources */,
34074FEE203E5436004596AE /* aurora.m4r in Resources */,
34330A5E1E787BD800DF2FB9 /* ElegantIcons.ttf in Resources */,
34074FBD203D14F6004596AE /* complete.m4r in Resources */,
AD83FF451A73426500B5C81A /* audio_pause_button@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -2862,7 +2972,7 @@
347850711FDAEB17007B8332 /* OWSUserProfile.m in Sources */,
346129761FD1E0B500532771 /* WeakTimer.swift in Sources */,
346129F81FD5F31400532771 /* OWS100RemoveTSRecipientsMigration.m in Sources */,
34074F61203D0CBE004596AE /* NotificationSounds.m in Sources */,
34074F61203D0CBE004596AE /* OWSSounds.m in Sources */,
346129B51FD1F7E800532771 /* OWSProfileManager.m in Sources */,
346129701FD1D74C00532771 /* Release.m in Sources */,
3478506C1FD9B78A007B8332 /* NoopNotificationsManager.swift in Sources */,

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,13 +3,13 @@
//
#import "NotificationSoundsViewController.h"
#import <SignalMessaging/NotificationSounds.h>
#import <SignalMessaging/OWSSounds.h>
@interface NotificationSoundsViewController ()
@property (nonatomic) BOOL isDirty;
@property (nonatomic) NotificationSound currentNotificationSound;
@property (nonatomic) OWSSound currentSound;
@end
@ -24,8 +24,8 @@
[self setTitle:NSLocalizedString(@"NOTIFICATIONS_ITEM_SOUND",
@"Label for settings view that allows user to change the notification sound.")];
self.currentNotificationSound = (self.thread ? [NotificationSounds notificationSoundForThread:self.thread]
: [NotificationSounds globalNotificationSound]);
self.currentSound
= (self.thread ? [OWSSounds notificationSoundForThread:self.thread] : [OWSSounds globalNotificationSound]);
[self updateTableContents];
[self updateNavigationItems];
@ -64,21 +64,19 @@
OWSTableSection *soundsSection = [OWSTableSection new];
soundsSection.headerTitle = NSLocalizedString(
@"NOTIFICATIONS_SECTION_SOUNDS", @"Label for settings UI that allows user to change the notification sound.");
for (NSNumber *nsNotificationSound in [NotificationSounds allNotificationSounds]) {
NotificationSound notificationSound = (NotificationSound)nsNotificationSound.intValue;
for (NSNumber *nsValue in [OWSSounds allNotificationSounds]) {
OWSSound sound = (OWSSound)nsValue.intValue;
OWSTableItem *item;
if (notificationSound == self.currentNotificationSound) {
item = [OWSTableItem
checkmarkItemWithText:[NotificationSounds displayNameForNotificationSound:notificationSound]
actionBlock:^{
[weakSelf notificationSoundWasSelected:notificationSound];
}];
if (sound == self.currentSound) {
item = [OWSTableItem checkmarkItemWithText:[OWSSounds displayNameForSound:sound]
actionBlock:^{
[weakSelf soundWasSelected:sound];
}];
} else {
item =
[OWSTableItem actionItemWithText:[NotificationSounds displayNameForNotificationSound:notificationSound]
actionBlock:^{
[weakSelf notificationSoundWasSelected:notificationSound];
}];
item = [OWSTableItem actionItemWithText:[OWSSounds displayNameForSound:sound]
actionBlock:^{
[weakSelf soundWasSelected:sound];
}];
}
[soundsSection addItem:item];
}
@ -90,15 +88,15 @@
#pragma mark - Events
- (void)notificationSoundWasSelected:(NotificationSound)notificationSound
- (void)soundWasSelected:(OWSSound)sound
{
[NotificationSounds playNotificationSound:notificationSound];
[OWSSounds playSound:sound];
if (self.currentNotificationSound == notificationSound) {
if (self.currentSound == sound) {
return;
}
self.currentNotificationSound = notificationSound;
self.currentSound = sound;
self.isDirty = YES;
[self updateTableContents];
[self updateNavigationItems];
@ -113,9 +111,9 @@
- (void)saveWasPressed:(id)sender
{
if (self.thread) {
[NotificationSounds setNotificationSound:self.currentNotificationSound forThread:self.thread];
[OWSSounds setNotificationSound:self.currentSound forThread:self.thread];
} else {
[NotificationSounds setGlobalNotificationSound:self.currentNotificationSound];
[OWSSounds setGlobalNotificationSound:self.currentSound];
}
[self.navigationController popViewControllerAnimated:YES];

View File

@ -8,9 +8,9 @@
#import <AudioToolbox/AudioServices.h>
#import <SignalMessaging/Environment.h>
#import <SignalMessaging/NSString+OWS.h>
#import <SignalMessaging/NotificationSounds.h>
#import <SignalMessaging/OWSContactsManager.h>
#import <SignalMessaging/OWSPreferences.h>
#import <SignalMessaging/OWSSounds.h>
#import <SignalServiceKit/NSString+SSK.h>
#import <SignalServiceKit/TSCall.h>
#import <SignalServiceKit/TSContactThread.h>
@ -100,8 +100,8 @@
};
if ([self shouldPlaySoundForNotification]) {
NotificationSound notificationSound = [NotificationSounds notificationSoundForThread:thread];
notification.soundName = [NotificationSounds filenameForNotificationSound:notificationSound];
OWSSound sound = [OWSSounds notificationSoundForThread:thread];
notification.soundName = [OWSSounds filenameForSound:sound];
}
NSString *alertMessage;
@ -140,8 +140,8 @@
Signal_Thread_UserInfo_Key : thread.uniqueId
};
if ([self shouldPlaySoundForNotification]) {
NotificationSound notificationSound = [NotificationSounds notificationSoundForThread:thread];
notification.soundName = [NotificationSounds filenameForNotificationSound:notificationSound];
OWSSound sound = [OWSSounds notificationSoundForThread:thread];
notification.soundName = [OWSSounds filenameForSound:sound];
}
NSString *alertMessage;
@ -181,8 +181,8 @@
Signal_Thread_UserInfo_Key : thread.uniqueId
};
if ([self shouldPlaySoundForNotification]) {
NotificationSound notificationSound = [NotificationSounds notificationSoundForThread:thread];
notification.soundName = [NotificationSounds filenameForNotificationSound:notificationSound];
OWSSound sound = [OWSSounds notificationSoundForThread:thread];
notification.soundName = [OWSSounds filenameForSound:sound];
}
NSString *alertMessage;
@ -226,8 +226,8 @@
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.userInfo = @{ Signal_Thread_UserInfo_Key : thread.uniqueId };
if (shouldPlaySound) {
NotificationSound notificationSound = [NotificationSounds notificationSoundForThread:thread];
notification.soundName = [NotificationSounds filenameForNotificationSound:notificationSound];
OWSSound sound = [OWSSounds notificationSoundForThread:thread];
notification.soundName = [OWSSounds filenameForSound:sound];
}
NSString *alertBodyString = @"";
@ -247,8 +247,8 @@
[[PushManager sharedManager] presentNotification:notification checkForCancel:NO];
} else {
if (shouldPlaySound && [Environment.preferences soundInForeground]) {
NotificationSound notificationSound = [NotificationSounds notificationSoundForThread:thread];
[NotificationSounds playNotificationSound:notificationSound];
OWSSound sound = [OWSSounds notificationSoundForThread:thread];
[OWSSounds playSound:sound];
}
}
});
@ -289,8 +289,8 @@
if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive && messageText) {
UILocalNotification *notification = [[UILocalNotification alloc] init];
if (shouldPlaySound) {
NotificationSound notificationSound = [NotificationSounds notificationSoundForThread:thread];
notification.soundName = [NotificationSounds filenameForNotificationSound:notificationSound];
OWSSound sound = [OWSSounds notificationSoundForThread:thread];
notification.soundName = [OWSSounds filenameForSound:sound];
}
switch (self.notificationPreviewType) {
@ -352,8 +352,8 @@
[[PushManager sharedManager] presentNotification:notification checkForCancel:YES];
} else {
if (shouldPlaySound && [Environment.preferences soundInForeground]) {
NotificationSound notificationSound = [NotificationSounds notificationSoundForThread:thread];
[NotificationSounds playNotificationSound:notificationSound];
OWSSound sound = [OWSSounds notificationSoundForThread:thread];
[OWSSounds playSound:sound];
}
}
});

View File

@ -19,7 +19,6 @@ FOUNDATION_EXPORT const unsigned char SignalMessagingVersionString[];
#import <SignalMessaging/DebugLogger.h>
#import <SignalMessaging/Environment.h>
#import <SignalMessaging/NSString+OWS.h>
#import <SignalMessaging/NotificationSounds.h>
#import <SignalMessaging/OWSAudioAttachmentPlayer.h>
#import <SignalMessaging/OWSContactAvatarBuilder.h>
#import <SignalMessaging/OWSContactOffersInteraction.h>
@ -30,6 +29,7 @@ FOUNDATION_EXPORT const unsigned char SignalMessagingVersionString[];
#import <SignalMessaging/OWSLogger.h>
#import <SignalMessaging/OWSMath.h>
#import <SignalMessaging/OWSProfileManager.h>
#import <SignalMessaging/OWSSounds.h>
#import <SignalMessaging/OWSTableViewController.h>
#import <SignalMessaging/OWSUserProfile.h>
#import <SignalMessaging/Release.h>

View File

@ -1,45 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
typedef NS_ENUM(NSUInteger, NotificationSound) {
NotificationSound_Default = 0,
NotificationSound_Aurora,
NotificationSound_Bamboo,
NotificationSound_Chord,
NotificationSound_Circles,
NotificationSound_Complete,
NotificationSound_Hello,
NotificationSound_Input,
NotificationSound_Keys,
NotificationSound_Note,
NotificationSound_Popcorn,
NotificationSound_Pulse,
NotificationSound_Synth,
};
NS_ASSUME_NONNULL_BEGIN
@class TSThread;
@interface NotificationSounds : NSObject
- (instancetype)init NS_UNAVAILABLE;
+ (NSArray<NSNumber *> *)allNotificationSounds;
+ (NSString *)displayNameForNotificationSound:(NotificationSound)notificationSound;
+ (NSString *)filenameForNotificationSound:(NotificationSound)notificationSound;
+ (void)playNotificationSound:(NotificationSound)notificationSound;
+ (NotificationSound)globalNotificationSound;
+ (void)setGlobalNotificationSound:(NotificationSound)notificationSound;
+ (NotificationSound)notificationSoundForThread:(TSThread *)thread;
+ (void)setNotificationSound:(NotificationSound)notificationSound forThread:(TSThread *)thread;
@end
NS_ASSUME_NONNULL_END

View File

@ -1,226 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "NotificationSounds.h"
#import <AudioToolbox/AudioServices.h>
#import <SignalServiceKit/TSStorageManager.h>
#import <SignalServiceKit/TSThread.h>
#import <SignalServiceKit/YapDatabaseConnection+OWS.h>
NSString *const kNotificationSoundsStorageNotificationCollection = @"kNotificationSoundsStorageNotificationCollection";
NSString *const kNotificationSoundsStorageGlobalNotificationKey = @"kNotificationSoundsStorageGlobalNotificationKey";
@interface NotificationSounds ()
@property (nonatomic, readonly) YapDatabaseConnection *dbConnection;
@property (nonatomic) NSMutableDictionary<NSNumber *, NSNumber *> *systemSoundIDMap;
@end
#pragma mark -
@implementation NotificationSounds
+ (instancetype)sharedManager
{
static NotificationSounds *instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[self alloc] initDefault];
});
return instance;
}
- (instancetype)initDefault
{
TSStorageManager *storageManager = [TSStorageManager sharedManager];
return [self initWithStorageManager:storageManager];
}
- (instancetype)initWithStorageManager:(TSStorageManager *)storageManager
{
self = [super init];
if (!self) {
return self;
}
OWSAssert(storageManager);
_dbConnection = storageManager.newDatabaseConnection;
OWSSingletonAssert();
return self;
}
+ (NSArray<NSNumber *> *)allNotificationSounds
{
return @[
@(NotificationSound_Aurora),
@(NotificationSound_Bamboo),
@(NotificationSound_Chord),
@(NotificationSound_Circles),
@(NotificationSound_Complete),
@(NotificationSound_Hello),
@(NotificationSound_Input),
@(NotificationSound_Keys),
@(NotificationSound_Note),
@(NotificationSound_Popcorn),
@(NotificationSound_Pulse),
@(NotificationSound_Synth),
];
}
+ (NSString *)displayNameForNotificationSound:(NotificationSound)notificationSound
{
// TODO: Should we localize these sound names?
switch (notificationSound) {
case NotificationSound_Aurora:
return @"Aurora";
case NotificationSound_Bamboo:
return @"Bamboo";
case NotificationSound_Chord:
return @"Chord";
case NotificationSound_Circles:
return @"Circles";
case NotificationSound_Complete:
return @"Complete";
case NotificationSound_Hello:
return @"Hello";
case NotificationSound_Input:
return @"Input";
case NotificationSound_Keys:
return @"Keys";
case NotificationSound_Default:
case NotificationSound_Note:
return @"Note";
case NotificationSound_Popcorn:
return @"Popcorn";
case NotificationSound_Pulse:
return @"Pulse";
case NotificationSound_Synth:
return @"Synth";
}
}
+ (NSString *)filenameForNotificationSound:(NotificationSound)notificationSound
{
// TODO: Should we localize these sound names?
switch (notificationSound) {
case NotificationSound_Aurora:
return @"aurora.m4r";
case NotificationSound_Bamboo:
return @"bamboo.m4r";
case NotificationSound_Chord:
return @"chord.m4r";
case NotificationSound_Circles:
return @"circles.m4r";
case NotificationSound_Complete:
return @"complete.m4r";
case NotificationSound_Hello:
return @"hello.m4r";
case NotificationSound_Input:
return @"input.m4r";
case NotificationSound_Keys:
return @"keys.m4r";
case NotificationSound_Default:
case NotificationSound_Note:
return @"note.m4r";
case NotificationSound_Popcorn:
return @"popcorn.m4r";
case NotificationSound_Pulse:
return @"pulse.m4r";
case NotificationSound_Synth:
return @"synth.m4r";
}
}
+ (NSURL *)soundURLForNotificationSound:(NotificationSound)notificationSound
{
NSString *filename = [self filenameForNotificationSound:notificationSound];
NSURL *_Nullable url = [[NSBundle mainBundle] URLForResource:filename.stringByDeletingPathExtension
withExtension:filename.pathExtension];
OWSAssert(url);
return url;
}
+ (void)playNotificationSound:(NotificationSound)notificationSound
{
[self.sharedManager playNotificationSound:notificationSound];
}
- (SystemSoundID)systemSoundIDForNotificationSound:(NotificationSound)notificationSound
{
@synchronized(self)
{
if (!self.systemSoundIDMap) {
self.systemSoundIDMap = [NSMutableDictionary new];
}
NSNumber *_Nullable systemSoundID = self.systemSoundIDMap[@(notificationSound)];
if (!systemSoundID) {
NSURL *soundURL = [NotificationSounds soundURLForNotificationSound:notificationSound];
SystemSoundID newSystemSoundID;
OSStatus error = AudioServicesCreateSystemSoundID((__bridge CFURLRef)soundURL, &newSystemSoundID);
if (error) {
OWSFail(@"%@ could not load sound.", self.logTag);
}
systemSoundID = @(newSystemSoundID);
self.systemSoundIDMap[@(notificationSound)] = systemSoundID;
}
return (SystemSoundID)systemSoundID.unsignedIntegerValue;
}
}
- (void)playNotificationSound:(NotificationSound)notificationSound
{
SystemSoundID systemSoundID = [self systemSoundIDForNotificationSound:notificationSound];
AudioServicesPlayAlertSound(systemSoundID);
}
+ (NotificationSound)defaultNotificationSound
{
return NotificationSound_Note;
}
+ (NotificationSound)globalNotificationSound
{
NotificationSounds *notificationSounds = NotificationSounds.sharedManager;
NSNumber *_Nullable value =
[notificationSounds.dbConnection objectForKey:kNotificationSoundsStorageGlobalNotificationKey
inCollection:kNotificationSoundsStorageNotificationCollection];
// Default to the global default.
return (value ? (NotificationSound)value.intValue : [self defaultNotificationSound]);
}
+ (void)setGlobalNotificationSound:(NotificationSound)notificationSound
{
NotificationSounds *notificationSounds = NotificationSounds.sharedManager;
[notificationSounds.dbConnection setObject:@(notificationSound)
forKey:kNotificationSoundsStorageGlobalNotificationKey
inCollection:kNotificationSoundsStorageNotificationCollection];
}
+ (NotificationSound)notificationSoundForThread:(TSThread *)thread
{
NotificationSounds *notificationSounds = NotificationSounds.sharedManager;
NSNumber *_Nullable value =
[notificationSounds.dbConnection objectForKey:thread.uniqueId
inCollection:kNotificationSoundsStorageNotificationCollection];
// Default to the "global" notification sound, which in turn will default to the global default.
return (value ? (NotificationSound)value.intValue : [self globalNotificationSound]);
}
+ (void)setNotificationSound:(NotificationSound)notificationSound forThread:(TSThread *)thread
{
NotificationSounds *notificationSounds = NotificationSounds.sharedManager;
[notificationSounds.dbConnection setObject:@(notificationSound)
forKey:thread.uniqueId
inCollection:kNotificationSoundsStorageNotificationCollection];
}
@end

View File

@ -0,0 +1,76 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
typedef NS_ENUM(NSUInteger, OWSSound) {
OWSSound_Default = 0,
// Notification Sounds
OWSSound_Aurora,
OWSSound_Bamboo,
OWSSound_Chord,
OWSSound_Circles,
OWSSound_Complete,
OWSSound_Hello,
OWSSound_Input,
OWSSound_Keys,
OWSSound_Note,
OWSSound_Popcorn,
OWSSound_Pulse,
OWSSound_Synth,
// Ringtone Sounds
OWSSound_Apex,
OWSSound_Beacon,
OWSSound_Bulletin,
OWSSound_By_The_Seaside,
OWSSound_Chimes,
OWSSound_Circuit,
OWSSound_Constellation,
OWSSound_Cosmic,
OWSSound_Crystals,
OWSSound_Hillside,
OWSSound_Illuminate,
OWSSound_Night_Owl,
OWSSound_Opening,
OWSSound_Playtime,
OWSSound_Presto,
OWSSound_Radar,
OWSSound_Radiate,
OWSSound_Ripples,
OWSSound_Sencha,
OWSSound_Signal,
OWSSound_Silk,
OWSSound_Slow_Rise,
OWSSound_Stargaze,
OWSSound_Summit,
OWSSound_Twinkle,
OWSSound_Uplift,
OWSSound_Waves,
};
NS_ASSUME_NONNULL_BEGIN
@class TSThread;
@interface OWSSounds : NSObject
- (instancetype)init NS_UNAVAILABLE;
+ (NSString *)displayNameForSound:(OWSSound)sound;
+ (NSString *)filenameForSound:(OWSSound)sound;
+ (void)playSound:(OWSSound)sound;
#pragma mark - Notifications
+ (NSArray<NSNumber *> *)allNotificationSounds;
+ (OWSSound)globalNotificationSound;
+ (void)setGlobalNotificationSound:(OWSSound)sound;
+ (OWSSound)notificationSoundForThread:(TSThread *)thread;
+ (void)setNotificationSound:(OWSSound)sound forThread:(TSThread *)thread;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,377 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "OWSSounds.h"
#import <AudioToolbox/AudioServices.h>
#import <SignalServiceKit/TSStorageManager.h>
#import <SignalServiceKit/TSThread.h>
#import <SignalServiceKit/YapDatabaseConnection+OWS.h>
NSString *const kOWSSoundsStorageNotificationCollection = @"kOWSSoundsStorageNotificationCollection";
NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlobalNotificationKey";
@interface OWSSounds ()
@property (nonatomic, readonly) YapDatabaseConnection *dbConnection;
@property (nonatomic) NSMutableDictionary<NSNumber *, NSNumber *> *systemSoundIDMap;
@end
#pragma mark -
@implementation OWSSounds
+ (instancetype)sharedManager
{
static OWSSounds *instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[self alloc] initDefault];
});
return instance;
}
- (instancetype)initDefault
{
TSStorageManager *storageManager = [TSStorageManager sharedManager];
return [self initWithStorageManager:storageManager];
}
- (instancetype)initWithStorageManager:(TSStorageManager *)storageManager
{
self = [super init];
if (!self) {
return self;
}
OWSAssert(storageManager);
_dbConnection = storageManager.newDatabaseConnection;
// TODO: Is it safe to load all of these sounds into memory?
// Probably better to do LRU cache.
self.systemSoundIDMap = [NSMutableDictionary new];
OWSSingletonAssert();
return self;
}
+ (NSArray<NSNumber *> *)allNotificationSounds
{
return @[
@(OWSSound_Aurora),
@(OWSSound_Bamboo),
@(OWSSound_Chord),
@(OWSSound_Circles),
@(OWSSound_Complete),
@(OWSSound_Hello),
@(OWSSound_Input),
@(OWSSound_Keys),
@(OWSSound_Note),
@(OWSSound_Popcorn),
@(OWSSound_Pulse),
@(OWSSound_Synth),
];
}
+ (NSArray<NSNumber *> *)allRingtoneSounds
{
return @[
@(OWSSound_Apex),
@(OWSSound_Beacon),
@(OWSSound_Bulletin),
@(OWSSound_By_The_Seaside),
@(OWSSound_Chimes),
@(OWSSound_Circuit),
@(OWSSound_Constellation),
@(OWSSound_Cosmic),
@(OWSSound_Crystals),
@(OWSSound_Hillside),
@(OWSSound_Illuminate),
@(OWSSound_Night_Owl),
@(OWSSound_Opening),
@(OWSSound_Playtime),
@(OWSSound_Presto),
@(OWSSound_Radar),
@(OWSSound_Radiate),
@(OWSSound_Ripples),
@(OWSSound_Sencha),
@(OWSSound_Signal),
@(OWSSound_Silk),
@(OWSSound_Slow_Rise),
@(OWSSound_Stargaze),
@(OWSSound_Summit),
@(OWSSound_Twinkle),
@(OWSSound_Uplift),
@(OWSSound_Waves),
];
}
+ (NSString *)displayNameForSound:(OWSSound)sound
{
// TODO: Should we localize these sound names?
switch (sound) {
case OWSSound_Default:
OWSFail(@"%@ invalid argument.", self.logTag);
return @"";
// Notification Sounds
case OWSSound_Aurora:
return @"Aurora";
case OWSSound_Bamboo:
return @"Bamboo";
case OWSSound_Chord:
return @"Chord";
case OWSSound_Circles:
return @"Circles";
case OWSSound_Complete:
return @"Complete";
case OWSSound_Hello:
return @"Hello";
case OWSSound_Input:
return @"Input";
case OWSSound_Keys:
return @"Keys";
case OWSSound_Note:
return @"Note";
case OWSSound_Popcorn:
return @"Popcorn";
case OWSSound_Pulse:
return @"Pulse";
case OWSSound_Synth:
return @"Synth";
// Ringtone Sounds
case OWSSound_Apex:
return @"Apex";
case OWSSound_Beacon:
return @"Beacon";
case OWSSound_Bulletin:
return @"Bulletin";
case OWSSound_By_The_Seaside:
return @"By The Seaside";
case OWSSound_Chimes:
return @"Chimes";
case OWSSound_Circuit:
return @"Circuit";
case OWSSound_Constellation:
return @"Constellation";
case OWSSound_Cosmic:
return @"Cosmic";
case OWSSound_Crystals:
return @"Crystals";
case OWSSound_Hillside:
return @"Hillside";
case OWSSound_Illuminate:
return @"Illuminate";
case OWSSound_Night_Owl:
return @"Night Owl";
case OWSSound_Opening:
return @"Opening";
case OWSSound_Playtime:
return @"Playtime";
case OWSSound_Presto:
return @"Presto";
case OWSSound_Radar:
return @"Radar";
case OWSSound_Radiate:
return @"Radiate";
case OWSSound_Ripples:
return @"Ripples";
case OWSSound_Sencha:
return @"Sencha";
case OWSSound_Signal:
return @"Signal";
case OWSSound_Silk:
return @"Silk";
case OWSSound_Slow_Rise:
return @"Slow Rise";
case OWSSound_Stargaze:
return @"Stargaze";
case OWSSound_Summit:
return @"Summit";
case OWSSound_Twinkle:
return @"Twinkle";
case OWSSound_Uplift:
return @"Uplift";
case OWSSound_Waves:
return @"Waves";
}
}
+ (NSString *)filenameForSound:(OWSSound)sound
{
switch (sound) {
case OWSSound_Default:
OWSFail(@"%@ invalid argument.", self.logTag);
return @"";
// Notification Sounds
case OWSSound_Aurora:
return @"aurora.m4r";
case OWSSound_Bamboo:
return @"bamboo.m4r";
case OWSSound_Chord:
return @"chord.m4r";
case OWSSound_Circles:
return @"circles.m4r";
case OWSSound_Complete:
return @"complete.m4r";
case OWSSound_Hello:
return @"hello.m4r";
case OWSSound_Input:
return @"input.m4r";
case OWSSound_Keys:
return @"keys.m4r";
case OWSSound_Note:
return @"note.m4r";
case OWSSound_Popcorn:
return @"popcorn.m4r";
case OWSSound_Pulse:
return @"pulse.m4r";
case OWSSound_Synth:
return @"synth.m4r";
// Ringtone Sounds
case OWSSound_Apex:
return @"Apex.m4r";
case OWSSound_Beacon:
return @"Beacon.m4r";
case OWSSound_Bulletin:
return @"Bulletin.m4r";
case OWSSound_By_The_Seaside:
return @"By The Seaside.m4r";
case OWSSound_Chimes:
return @"Chimes.m4r";
case OWSSound_Circuit:
return @"Circuit.m4r";
case OWSSound_Constellation:
return @"Constellation.m4r";
case OWSSound_Cosmic:
return @"Cosmic.m4r";
case OWSSound_Crystals:
return @"Crystals.m4r";
case OWSSound_Hillside:
return @"Hillside.m4r";
case OWSSound_Illuminate:
return @"Illuminate.m4r";
case OWSSound_Night_Owl:
return @"Night Owl.m4r";
case OWSSound_Opening:
return @"Opening.m4r";
case OWSSound_Playtime:
return @"Playtime.m4r";
case OWSSound_Presto:
return @"Presto.m4r";
case OWSSound_Radar:
return @"Radar.m4r";
case OWSSound_Radiate:
return @"Radiate.m4r";
case OWSSound_Ripples:
return @"Ripples.m4r";
case OWSSound_Sencha:
return @"Sencha.m4r";
case OWSSound_Signal:
return @"Signal.m4r";
case OWSSound_Silk:
return @"Silk.m4r";
case OWSSound_Slow_Rise:
return @"Slow Rise.m4r";
case OWSSound_Stargaze:
return @"Stargaze.m4r";
case OWSSound_Summit:
return @"Summit.m4r";
case OWSSound_Twinkle:
return @"Twinkle.m4r";
case OWSSound_Uplift:
return @"Uplift.m4r";
case OWSSound_Waves:
return @"Waves.m4r";
}
}
+ (NSURL *)soundURLForSound:(OWSSound)sound
{
NSString *filename = [self filenameForSound:sound];
NSURL *_Nullable url = [[NSBundle mainBundle] URLForResource:filename.stringByDeletingPathExtension
withExtension:filename.pathExtension];
OWSAssert(url);
return url;
}
+ (void)playSound:(OWSSound)sound
{
[self.sharedManager playSound:sound];
}
- (SystemSoundID)systemSoundIDForSound:(OWSSound)sound
{
@synchronized(self)
{
NSNumber *_Nullable systemSoundID = self.systemSoundIDMap[@(sound)];
if (!systemSoundID) {
NSURL *soundURL = [OWSSounds soundURLForSound:sound];
SystemSoundID newSystemSoundID;
OSStatus error = AudioServicesCreateSystemSoundID((__bridge CFURLRef)soundURL, &newSystemSoundID);
if (error) {
OWSFail(@"%@ could not load sound.", self.logTag);
}
systemSoundID = @(newSystemSoundID);
self.systemSoundIDMap[@(sound)] = systemSoundID;
}
return (SystemSoundID)systemSoundID.unsignedIntegerValue;
}
}
- (void)playSound:(OWSSound)sound
{
SystemSoundID systemSoundID = [self systemSoundIDForSound:sound];
AudioServicesPlayAlertSound(systemSoundID);
}
#pragma mark - Notifications
+ (OWSSound)defaultNotificationSound
{
return OWSSound_Note;
}
+ (OWSSound)globalNotificationSound
{
OWSSounds *instance = OWSSounds.sharedManager;
NSNumber *_Nullable value = [instance.dbConnection objectForKey:kOWSSoundsStorageGlobalNotificationKey
inCollection:kOWSSoundsStorageNotificationCollection];
// Default to the global default.
return (value ? (OWSSound)value.intValue : [self defaultNotificationSound]);
}
+ (void)setGlobalNotificationSound:(OWSSound)sound
{
OWSSounds *instance = OWSSounds.sharedManager;
[instance.dbConnection setObject:@(sound)
forKey:kOWSSoundsStorageGlobalNotificationKey
inCollection:kOWSSoundsStorageNotificationCollection];
}
+ (OWSSound)notificationSoundForThread:(TSThread *)thread
{
OWSSounds *instance = OWSSounds.sharedManager;
NSNumber *_Nullable value =
[instance.dbConnection objectForKey:thread.uniqueId inCollection:kOWSSoundsStorageNotificationCollection];
// Default to the "global" notification sound, which in turn will default to the global default.
return (value ? (OWSSound)value.intValue : [self globalNotificationSound]);
}
+ (void)setNotificationSound:(OWSSound)sound forThread:(TSThread *)thread
{
OWSSounds *instance = OWSSounds.sharedManager;
[instance.dbConnection setObject:@(sound)
forKey:thread.uniqueId
inCollection:kOWSSoundsStorageNotificationCollection];
}
@end