Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
RayDeeUx authored Aug 14, 2024
2 parents da0fcee + 53198dc commit a9c270e
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,11 @@ struct MenuLayerHook : Modify<MenuLayerHook, MenuLayer> {
if (!MenuLayer::init())
return false;

// return early if notif card setting is disabled, reducing indentation
if (!Mod::get()->getSettingValue<bool>("enableNotification"))
return true;
if (Mod::get()->getSettingValue<bool>("enableNotification"))
MenuLayerHook::generateNotifcation();

MenuLayerHook::generateNotifcation();

// add a shuffle button
if (!Mod::get()->getSettingValue<bool>("enableShuffleButton"))
return true;

MenuLayerHook::addShuffleButton();
if (Mod::get()->getSettingValue<bool>("enableShuffleButton"))
MenuLayerHook::addShuffleButton();

return true;
}
Expand Down Expand Up @@ -152,11 +146,10 @@ struct MenuLayerHook : Modify<MenuLayerHook, MenuLayer> {
auto songInfo = downloadManager->getSongInfoObject(Utils::stoi(songFileName.string()));

// sometimes songInfo is nullptr, so improvise
if (songInfo) {
if (songInfo)
notifString = notifString.append(fmt::format("{} by {} ({})", songInfo->m_songName, songInfo->m_artistName, songInfo->m_songID));
} else {
else
notifString = notifString.append(songFileName.string());
}
}
}
}
Expand Down Expand Up @@ -256,10 +249,12 @@ void populateVector(bool customSongs) {

for (auto file : std::filesystem::directory_iterator(configPath)) {
auto filePathString = file.path().string();
if (isSupportedExtension(filePathString)) {
log::debug("Adding custom song: {}", file.path().filename().string());
songManager.addSong(filePathString);
}

if (!isSupportedExtension(filePathString))
continue;

log::debug("Adding custom song: {}", file.path().filename().string());
songManager.addSong(filePathString);
}
} else {
auto downloadManager = MusicDownloadManager::sharedState();
Expand Down

0 comments on commit a9c270e

Please sign in to comment.