Skip to content

Commit

Permalink
Lyrics implementation prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
akrv7591 committed Jun 26, 2024
1 parent a97611c commit 268d266
Show file tree
Hide file tree
Showing 20 changed files with 528 additions and 45 deletions.
39 changes: 18 additions & 21 deletions ios/Fintunes.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
00E356EB1AD99517003FC87E /* Frameworks */,
00E356EC1AD99517003FC87E /* Resources */,
BDE784ECF29EF861DBFF49D7 /* [CP] Copy Pods Resources */,
A02366876E56A727F566EC3A /* [CP] Embed Pods Frameworks */,
6009D35759F7C212F3F37A8D /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand All @@ -213,7 +213,7 @@
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
B9FB8FC65CEFF9AFAC71127E /* [CP] Copy Pods Resources */,
2917566AA57EE087FC9FCCE9 /* [CP] Embed Pods Frameworks */,
4B46D15F45829B11BB4BC93F /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -258,13 +258,13 @@
TestTargetID = 13B07F861A680F5B00A75B9A;
};
13B07F861A680F5B00A75B9A = {
DevelopmentTeam = HD2D35G9Y4;
DevelopmentTeam = WVZHVLY6Y7;
LastSwiftMigration = 1210;
ProvisioningStyle = Automatic;
};
AB4A8DFA2857C8DA005A1ED0 = {
CreatedOnToolsVersion = 13.4.1;
DevelopmentTeam = HD2D35G9Y4;
DevelopmentTeam = WVZHVLY6Y7;
ProvisioningStyle = Automatic;
TestTargetID = 13B07F861A680F5B00A75B9A;
};
Expand Down Expand Up @@ -334,7 +334,7 @@
shellPath = /bin/sh;
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
};
2917566AA57EE087FC9FCCE9 /* [CP] Embed Pods Frameworks */ = {
4B46D15F45829B11BB4BC93F /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -352,7 +352,7 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Fintunes/Pods-Fintunes-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
A02366876E56A727F566EC3A /* [CP] Embed Pods Frameworks */ = {
6009D35759F7C212F3F37A8D /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down Expand Up @@ -577,9 +577,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 91;
DEVELOPMENT_TEAM = HD2D35G9Y4;
DEVELOPMENT_TEAM = WVZHVLY6Y7;
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
Expand All @@ -597,7 +597,7 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = nl.moeilijkedingen.jellyfinaudioplayer;
PRODUCT_BUNDLE_IDENTIFIER = nl.akrv.jellyfinaudioplayer;
PRODUCT_NAME = Fintunes;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Fintunes-Bridging-Header.h";
Expand All @@ -614,11 +614,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 91;
DEVELOPMENT_TEAM = HD2D35G9Y4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = HD2D35G9Y4;
DEVELOPMENT_TEAM = WVZHVLY6Y7;
INFOPLIST_FILE = Fintunes/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
Expand All @@ -631,11 +629,10 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = nl.moeilijkedingen.jellyfinaudioplayer;
PRODUCT_BUNDLE_IDENTIFIER = akrv.jellyfinaudioplayer;
PRODUCT_NAME = Fintunes;
PROVISIONING_PROFILE = "915c5213-22f6-4f9d-8065-2a06300f9bfb";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "nl.moeilijkedingen.jellyfinaudioplayer AppStore";
SWIFT_OBJC_BRIDGING_HEADER = "Fintunes-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -787,17 +784,17 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 91;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = HD2D35G9Y4;
DEVELOPMENT_TEAM = WVZHVLY6Y7;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.5;
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = nl.moeilijkedingen.FintunesUITests;
PRODUCT_BUNDLE_IDENTIFIER = akrv.development.finetune;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "915c5213-22f6-4f9d-8065-2a06300f9bfb";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -821,17 +818,17 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 91;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = HD2D35G9Y4;
DEVELOPMENT_TEAM = WVZHVLY6Y7;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.5;
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = nl.moeilijkedingen.FintunesUITests;
PRODUCT_BUNDLE_IDENTIFIER = akrv.development.finetune;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "915c5213-22f6-4f9d-8065-2a06300f9bfb";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
Expand Down
3 changes: 3 additions & 0 deletions src/assets/icons/lyrics.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/components/Progresstrack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export function calculateProgressTranslation(
return output;
}

// Progress track did not show up on Lyrics screen if min height is not set
export const ProgressTrackContainer = styled.View`
overflow: hidden;
height: 5px;
Expand All @@ -37,6 +38,7 @@ export const ProgressTrackContainer = styled.View`
align-items: center;
position: relative;
border-radius: 6px;
min-height: 5px;
`;

export interface ProgressTrackProps {
Expand Down
3 changes: 2 additions & 1 deletion src/localisation/lang/en/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@
"privacy-policy": "Privacy Policy",
"sleep-timer": "Sleep timer",
"delete": "Delete",
"cancel": "Cancel"
"cancel": "Cancel",
"lyrics": "Lyrics"
}
5 changes: 4 additions & 1 deletion src/localisation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,7 @@ export type LocaleKeys = 'play-next'
| 'privacy-policy'
| 'sleep-timer'
| 'delete'
| 'cancel'
| 'cancel'
| 'lyrics'

// TODO add localizations to for all languages
6 changes: 4 additions & 2 deletions src/screens/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Player from './modals/Player';
import { StyleSheet } from 'react-native';
import useDefaultStyles, { ColoredBlurView } from '@/components/Colors';
import { StackParams } from './types';
import Lyrics from './modals/Lyrics';

const Stack = createNativeStackNavigator<StackParams>();
const Tab = createBottomTabNavigator();
Expand All @@ -36,7 +37,7 @@ type Screens = {
function Screens() {
const styles = useDefaultStyles();
const isOnboardingComplete = useTypedSelector(state => state.settings.isOnboardingComplete);

// GUARD: If onboarding has not been completed, we instead render the
// onboarding component, so that the user can get setup in the app.
if (!isOnboardingComplete) {
Expand Down Expand Up @@ -97,11 +98,12 @@ export default function Routes() {
<Stack.Screen name="TrackPopupMenu" component={TrackPopupMenu} options={{ presentation: 'formSheet' }} />
<Stack.Screen name="ErrorReporting" component={ErrorReportingPopup} />
<Stack.Screen name="Player" component={Player} />
<Stack.Screen name="Lyrics" component={Lyrics} />
</Stack.Navigator>
);
}

export type NavigationProp = CompositeNavigationProp<
StackNavigationProp<Routes>,
BottomTabNavigationProp<Screens>
>;
>;
83 changes: 83 additions & 0 deletions src/screens/modals/Lyrics/components/LyricsLine.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import React, { memo } from 'react';
import useDefaultStyles from '@/components/Colors';
import {StyleProp, TextStyle, ViewProps} from 'react-native';
import { Lyrics } from '@/utility/JellyfinApi/lyrics.ts';
import styled from 'styled-components/native';
import { lyricsMillisecondsFormat } from '@/utility/LyricsMillisecondsFormat';
import Animated, { useSharedValue, withTiming } from 'react-native-reanimated';

const Container = styled(Animated.View)`
flex-direction: row;
flex-wrap: wrap;
padding-horizontal: 20px;
margin-top: 10px;
flex-direction: row;
gap: 5px;
`;

const LyricsTimestamp = styled.Text`
font-size: 12px;
min-width: 30px;
line-height: 25px;
`;

const LyricsText = styled.Text`
flex: 1;
font-size: 20px;
`;

interface Props extends ViewProps {
lyrics: Lyrics['Lyrics'][number]
active: boolean
isStart: boolean
isEnd: boolean

// Con
containerHeight: number
}

const LyricsLine = ({lyrics, active, isStart, isEnd, containerHeight, ...viewProps}: Props) => {
const defaultStyles = useDefaultStyles();
const marginForFirstOrLastLine = useSharedValue<number | undefined>(undefined);
let style: any | undefined = undefined;

if (isStart || isEnd) {
marginForFirstOrLastLine.value = withTiming( Math.floor(containerHeight / 2));
}

if (isStart) {
style = {
marginTop: marginForFirstOrLastLine
};
}

if (isEnd) {
style = {
marginBottom: marginForFirstOrLastLine
};
}


const lyricsTextStyle: StyleProp<TextStyle> = {
color: active ? defaultStyles.themeColor.color : defaultStyles.text.color,
fontWeight: active? '600': 'normal',
opacity: active ? 1 : 0.7,
};

const timestampStyle: StyleProp<TextStyle> = {
color: active? defaultStyles.themeColor.color : defaultStyles.textHalfOpacity.color,
};

return (
<Container style={style} {...viewProps} >
<LyricsTimestamp style={timestampStyle}>
{lyricsMillisecondsFormat(lyrics.Start)}
</LyricsTimestamp>
<LyricsText style={lyricsTextStyle}>
{lyrics.Text}
</LyricsText>
</Container>
);
};

export default memo(LyricsLine);
Loading

0 comments on commit 268d266

Please sign in to comment.