Skip to content

Commit 3d2aafb

Browse files
authored
Merge pull request #1962 from session-foundation/feat/ongoing-appeal
Feat: ongoing appeal instead of final appeal
2 parents 7441677 + 7966066 commit 3d2aafb

5 files changed

Lines changed: 27 additions & 12 deletions

File tree

images/cta/donate-appeal.webp

179 KB
Loading

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "session-desktop",
55
"productName": "Session",
66
"description": "Private messaging from your desktop",
7-
"version": "1.18.0",
7+
"version": "1.18.1",
88
"license": "GPL-3.0",
99
"author": {
1010
"name": "Session Foundation",

ts/components/dialog/SessionCTA.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ const StyledDonateAppealTitleContainer = styled(Localizer)`
194194
`;
195195

196196
function DonateAppealTitle() {
197-
return <StyledDonateAppealTitleContainer token="finalAppeal" />;
197+
return <StyledDonateAppealTitleContainer token="ongoingAppeal" />;
198198
}
199199

200200
function getTitle(variant: CTAVariantExcludingProCTAs) {
@@ -226,7 +226,7 @@ function getDescription(variant: CTAVariantExcludingProCTAs) {
226226
return <Localizer token="donateSessionDescription" />;
227227

228228
case CTAVariant.DONATE_APPEAL:
229-
return <Localizer token="finalAppealDescription" />;
229+
return <Localizer token="ongoingAppealDescription" />;
230230

231231
default:
232232
assertUnreachable(variant, 'CtaTitle');

ts/node/migration/sessionMigrations.ts

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ const LOKI_SCHEMA_VERSIONS: Array<(currentVersion: number, db: Database) => void
131131
updateToSessionSchemaVersion53,
132132
updateToSessionSchemaVersion54,
133133
updateToSessionSchemaVersion55,
134+
updateToSessionSchemaVersion56,
134135
];
135136

136137
function updateToSessionSchemaVersion1(currentVersion: number, db: Database) {
@@ -2398,30 +2399,26 @@ async function updateToSessionSchemaVersion54(currentVersion: number, db: Databa
23982399
console.log(`updateToSessionSchemaVersion${targetVersion}: success!`);
23992400
}
24002401

2401-
async function updateToSessionSchemaVersion55(currentVersion: number, db: Database) {
2402-
const targetVersion = 55;
2403-
if (currentVersion >= targetVersion) {
2404-
return;
2405-
}
2402+
async function removeDonateAppealCTAReadFlag(targetVersion: number, db: Database) {
24062403
console.log(`updateToSessionSchemaVersion${targetVersion}: starting...`);
24072404

24082405
db.transaction(() => {
24092406
const ctaInteractions = sqlNode.getItemById(SettingsKey.ctaInteractions, db)?.value ?? [];
24102407
console.log(
2411-
`updateToSessionSchemaVersion55 ${SettingsKey.ctaInteractions} before: ${JSON.stringify(ctaInteractions)}`
2408+
`updateToSessionSchemaVersion${targetVersion} ${SettingsKey.ctaInteractions} before: ${JSON.stringify(ctaInteractions)}`
24122409
);
24132410

24142411
const idx = ctaInteractions.findIndex((i: any) => i?.variant === CTAVariant.DONATE_APPEAL);
24152412
if (idx !== -1) {
24162413
ctaInteractions.splice(idx, 1);
24172414
console.log(
2418-
`updateToSessionSchemaVersion55 removed ${CTAVariant.DONATE_APPEAL} from ${SettingsKey.ctaInteractions}`
2415+
`updateToSessionSchemaVersion${targetVersion} removed ${CTAVariant.DONATE_APPEAL} from ${SettingsKey.ctaInteractions}`
24192416
);
24202417
sqlNode.createOrUpdateItem({ id: SettingsKey.ctaInteractions, value: ctaInteractions }, db);
24212418
}
24222419

24232420
console.log(
2424-
`updateToSessionSchemaVersion55 ${SettingsKey.ctaInteractions} after: ${JSON.stringify(sqlNode.getItemById(SettingsKey.ctaInteractions, db)?.value ?? [])}`
2421+
`updateToSessionSchemaVersion${targetVersion} ${SettingsKey.ctaInteractions} after: ${JSON.stringify(sqlNode.getItemById(SettingsKey.ctaInteractions, db)?.value ?? [])}`
24252422
);
24262423

24272424
writeSessionSchemaVersion(targetVersion, db);
@@ -2430,6 +2427,24 @@ async function updateToSessionSchemaVersion55(currentVersion: number, db: Databa
24302427
console.log(`updateToSessionSchemaVersion${targetVersion}: success!`);
24312428
}
24322429

2430+
async function updateToSessionSchemaVersion55(currentVersion: number, db: Database) {
2431+
const targetVersion = 55;
2432+
if (currentVersion >= targetVersion) {
2433+
return;
2434+
}
2435+
await removeDonateAppealCTAReadFlag(targetVersion, db);
2436+
}
2437+
2438+
// Note: updateToSessionSchemaVersion55 and updateToSessionSchemaVersion56 are the same,
2439+
// but run at different times to make the donate appeal CTA show up again.
2440+
async function updateToSessionSchemaVersion56(currentVersion: number, db: Database) {
2441+
const targetVersion = 56;
2442+
if (currentVersion >= targetVersion) {
2443+
return;
2444+
}
2445+
await removeDonateAppealCTAReadFlag(targetVersion, db);
2446+
}
2447+
24332448
export function printTableColumns(table: string, db: Database) {
24342449
console.info(db.pragma(`table_info('${table}');`));
24352450
}

0 commit comments

Comments
 (0)