Skip to content

Commit

Permalink
Fix audio and image loading for activities, update UnitTests
Browse files Browse the repository at this point in the history
bumped build number to 19
  • Loading branch information
RDMurray committed Mar 14, 2024
1 parent 1ad37e8 commit 6432b20
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
9 changes: 6 additions & 3 deletions apps/ios/GuideDogs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6472,7 +6472,7 @@
CODE_SIGN_ENTITLEMENTS = GuideDogs/Assets/PropertyLists/SoundscapeDF.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 18;
CURRENT_PROJECT_VERSION = 19;
DEVELOPMENT_TEAM = "";
EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE = YES;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -6533,6 +6533,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = X4H33NKGKY;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
Expand Down Expand Up @@ -6567,6 +6568,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = X4H33NKGKY;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
Expand Down Expand Up @@ -6598,6 +6600,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = X4H33NKGKY;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
Expand Down Expand Up @@ -6758,7 +6761,7 @@
CODE_SIGN_ENTITLEMENTS = GuideDogs/Assets/PropertyLists/Soundscape.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 18;
CURRENT_PROJECT_VERSION = 19;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = X4H33NKGKY;
EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE = YES;
Expand Down Expand Up @@ -6818,7 +6821,7 @@
CODE_SIGN_ENTITLEMENTS = GuideDogs/Assets/PropertyLists/Soundscape.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 18;
CURRENT_PROJECT_VERSION = 19;
DEVELOPMENT_TEAM = X4H33NKGKY;
EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE = YES;
ENABLE_BITCODE = NO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,12 @@ extension AuthoredActivityContent {
let audioMimeTypes = Set(["audio/mpeg", "audio/x-m4a"])

return waypoints.compactMap { wpt in
let links: [GPXLink] = wpt.extensions?.soundscapeLinkExtensions?.links.filter({
let imageLinks: [GPXLink] = wpt.extensions?.soundscapeLinkExtensions?.links.filter({
guard let mimetype = $0.mimetype else { return false }
return imageMimeTypes.contains(mimetype) || audioMimeTypes.contains(mimetype)
return imageMimeTypes.contains(mimetype)
}) ?? []

let parsedImages: [ActivityWaypointImage] = links.compactMap { link in
let parsedImages: [ActivityWaypointImage] = imageLinks.compactMap { link in
guard let href = link.href,
let url = URL(string: href, relativeTo: baseURL) else {
return nil
Expand All @@ -298,7 +298,12 @@ extension AuthoredActivityContent {
return ActivityWaypointImage(url: url, altText: link.text)
}

let parsedAudioClips: [ActivityWaypointAudioClip] = links.compactMap { link in
let audioLinks: [GPXLink] = wpt.extensions?.soundscapeLinkExtensions?.links.filter({
guard let mimetype = $0.mimetype else { return false }
return audioMimeTypes.contains(mimetype)
}) ?? []

let parsedAudioClips: [ActivityWaypointAudioClip] = audioLinks.compactMap { link in
guard let href = link.href,
let url = URL(string: href, relativeTo: baseURL) else {
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ final class AuthoredActivityContentTest: XCTestCase {

// MARK: Test GPX Parsing

static let baseURL = URL(string: "https://example.com")!
/// Tests parsing from GPX
/// Using `GPXSoundscapeSharedContentExtensions` v1
/// And minimal other details
Expand Down Expand Up @@ -63,7 +64,7 @@ final class AuthoredActivityContentTest: XCTestCase {
XCTFail("Failed to get parsedData")
return
}
guard let activity = AuthoredActivityContent.parse(gpx: root) else {
guard let activity = AuthoredActivityContent.parse(gpx: root, baseURL: AuthoredActivityContentTest.baseURL) else {
XCTFail("Failed to create AuthoredActivityContent from GPXRoot")
return
}
Expand Down Expand Up @@ -150,7 +151,7 @@ final class AuthoredActivityContentTest: XCTestCase {
XCTFail("Failed to get parsedData")
return
}
guard let activity = AuthoredActivityContent.parse(gpx: root) else {
guard let activity = AuthoredActivityContent.parse(gpx: root, baseURL: AuthoredActivityContentTest.baseURL) else {
XCTFail("Failed to create AuthoredActivityContent from GPXRoot")
return
}
Expand Down

0 comments on commit 6432b20

Please sign in to comment.