Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export default function Page() {
}

const [year, month, day] = selectedSource.displayDate.split('-');
const url = `https://relisten.net/${artist?.slug}/${year}/${month}/${day}?source=${selectedSource.uuid}`;
const url = `https://relisten.net/${artist?.slug}/${year}/${month}/${day}?source=${selectedSource.sourceId ?? selectedSource.uuid}`;

void Share.share({
message: `Check out ${show.displayDate} (${show.venue?.name ?? ''}) by ${artist?.name} on @relistenapp${Platform.OS === 'ios' ? '' : `: ${url}`}`,
Expand Down Expand Up @@ -505,7 +505,7 @@ export const SourceHeader = ({
textClassName="text-l"
onPress={() => {
const [year, month, day] = show.displayDate.split('-');
const url = `https://relisten.net/${artist?.slug}/${year}/${month}/${day}?source=${source.uuid}`;
const url = `https://relisten.net/${artist?.slug}/${year}/${month}/${day}?source=${source.sourceId ?? source.uuid}`;
Share.share({
message: `Check out ${show.displayDate} (${show.venue?.name ?? ''}) by ${artist?.name} on @relistenapp${Platform.OS === 'ios' ? '' : `: ${url}`}`,
url: url,
Expand Down
2 changes: 1 addition & 1 deletion relisten/player/ui/player_screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function CurrentTrackInfo({ dismissOnNavigate }: CurrentTrackInfoProps) {

const onShare = () => {
const [year, month, day] = show.displayDate.split('-');
const url = `https://relisten.net/${artist.slug}/${year}/${month}/${day}/${track.slug}?source=${source.uuid}`;
const url = `https://relisten.net/${artist.slug}/${year}/${month}/${day}/${track.slug}?source=${source.sourceId ?? source.uuid}`;
Share.share({
message: `Check out ${track.title} (${track.humanizedDuration}) by ${artist.name} (${show.displayDate}) on @relistenapp${Platform.OS === 'ios' ? '' : `: ${url}`}`,
url: url,
Expand Down
2 changes: 1 addition & 1 deletion relisten/player/ui/source_track_actions_menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export function SourceTrackActionsMenu({ playShow, sourceTrack }: SourceTrackAct
break;
case ACTION_IDS.share: {
const [year, month, day] = sourceTrack.show.displayDate.split('-');
const url = `https://relisten.net/${sourceTrack.artist.slug}/${year}/${month}/${day}/${sourceTrack.slug}?source=${sourceTrack.source.uuid}`;
const url = `https://relisten.net/${sourceTrack.artist.slug}/${year}/${month}/${day}/${sourceTrack.slug}?source=${sourceTrack.source.sourceId ?? sourceTrack.source.uuid}`;

await Share.share({
message: `Check out ${sourceTrack.title} (${sourceTrack.humanizedDuration}) from ${sourceTrack.show.displayDate} by ${sourceTrack.artist?.name} on @relistenapp${Platform.OS === 'ios' ? '' : `: ${url}`}`,
Expand Down
4 changes: 4 additions & 0 deletions relisten/realm/models/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { checkIfOfflineSourceTrackExists } from '@/relisten/realm/realm_filters'
import type { LibraryIndex } from '@/relisten/realm/library_index';

export interface SourceRequiredProperties extends RelistenObjectRequiredProperties {
sourceId?: number;
artistUuid: string;
venueUuid?: string;
displayDate: string;
Expand Down Expand Up @@ -44,6 +45,7 @@ export class Source
primaryKey: 'uuid',
properties: {
uuid: 'string',
sourceId: 'int?',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Backfill sourceId for cached sources

For existing users who already have Source rows cached, this optional column is created as null and the next online refresh does not necessarily populate it: Repository.upsertWithinWrite skips propertiesFromApi unless the API updated_at is newer or shouldUpdateFromApi returns true. For unchanged shows, all new share call sites will therefore keep falling back to the UUID until the remote source changes or the database is rebuilt, so the main fix still fails for cached sources; add a migration/backfill or a Source.shouldUpdateFromApi check when sourceId is missing.

Useful? React with 👍 / 👎.

createdAt: 'date',
updatedAt: 'date',
artistUuid: { type: 'string', indexed: true },
Expand Down Expand Up @@ -83,6 +85,7 @@ export class Source
};

uuid!: string;
sourceId?: number;
createdAt!: Date;
updatedAt!: Date;
artistUuid!: string;
Expand Down Expand Up @@ -156,6 +159,7 @@ export class Source
static propertiesFromApi(relistenObj: SourceFull): SourceRequiredProperties {
return {
uuid: relistenObj.uuid,
sourceId: relistenObj.id != null ? Number(relistenObj.id) : undefined,
createdAt: dayjs(relistenObj.created_at).toDate(),
updatedAt: dayjs(relistenObj.updated_at).toDate(),
artistUuid: relistenObj.artist_uuid,
Expand Down
2 changes: 1 addition & 1 deletion relisten/realm/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const realmConfig: Realm.Configuration = {
PopularityWindow,
PopularityWindows,
],
schemaVersion: 12,
schemaVersion: 13,
// As to not conflict with the prior versions default.realm that isn't readable with this version of the SDK
path: './relisten.realm',
};
Expand Down