Skip to content
Merged
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
3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions src/account_facebook/controller/stats/getProgressInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,25 @@ export async function getProgressInfo(
totalWallPostsDeleted = parseInt(totalWallPostsDeletedConfig);
}

const totalWallPostsUntaggedConfig: string | null =
await controller.getConfig("totalWallPostsUntagged");
let totalWallPostsUntagged: number = 0;
if (totalWallPostsUntaggedConfig) {
totalWallPostsUntagged = parseInt(totalWallPostsUntaggedConfig);
}

const totalWallPostsHiddenConfig: string | null = await controller.getConfig(
"totalWallPostsHidden",
);
let totalWallPostsHidden: number = 0;
if (totalWallPostsHiddenConfig) {
totalWallPostsHidden = parseInt(totalWallPostsHiddenConfig);
}

const progressInfo = emptyFacebookProgressInfo();
progressInfo.accountUUID = controller.accountUUID;
progressInfo.totalWallPostsDeleted = totalWallPostsDeleted;
progressInfo.totalWallPostsUntagged = totalWallPostsUntagged;
progressInfo.totalWallPostsHidden = totalWallPostsHidden;
return progressInfo;
}
14 changes: 14 additions & 0 deletions src/account_facebook/facebook_account_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,18 @@ export class FacebookAccountController extends BaseAccountController<FacebookPro
const newValue = (currentValue ? parseInt(currentValue) : 0) + count;
await this.setConfig("totalWallPostsDeleted", newValue.toString());
}

// Increment the total wall posts untagged counter
async incrementTotalWallPostsUntagged(count: number): Promise<void> {
const currentValue = await this.getConfig("totalWallPostsUntagged");
const newValue = (currentValue ? parseInt(currentValue) : 0) + count;
await this.setConfig("totalWallPostsUntagged", newValue.toString());
}

// Increment the total wall posts hidden counter
async incrementTotalWallPostsHidden(count: number): Promise<void> {
const currentValue = await this.getConfig("totalWallPostsHidden");
const newValue = (currentValue ? parseInt(currentValue) : 0) + count;
await this.setConfig("totalWallPostsHidden", newValue.toString());
}
}
24 changes: 24 additions & 0 deletions src/account_facebook/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,30 @@ export const defineIPCFacebook = () => {
},
);

ipcMain.handle(
"Facebook:incrementTotalWallPostsUntagged",
async (_, accountID: number, count: number): Promise<void> => {
try {
const controller = getFacebookAccountController(accountID);
return await controller.incrementTotalWallPostsUntagged(count);
} catch (error) {
throw new Error(packageExceptionForReport(error as Error));
}
},
);

ipcMain.handle(
"Facebook:incrementTotalWallPostsHidden",
async (_, accountID: number, count: number): Promise<void> => {
try {
const controller = getFacebookAccountController(accountID);
return await controller.incrementTotalWallPostsHidden(count);
} catch (error) {
throw new Error(packageExceptionForReport(error as Error));
}
},
);

ipcMain.handle("Facebook:isRateLimited", async (_, accountID: number) => {
try {
const controller = getFacebookAccountController(accountID);
Expand Down
2 changes: 2 additions & 0 deletions src/cyd-api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export type PostXProgressAPIRequest = {
export type PostFacebookProgressAPIRequest = {
account_uuid: string;
total_wall_posts_deleted: number;
total_wall_posts_untagged: number;
total_wall_posts_hidden: number;
};

// API models for GET /user/premium
Expand Down
20 changes: 20 additions & 0 deletions src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,26 @@ const electronAPI = {
count,
);
},
incrementTotalWallPostsUntagged: (
accountID: number,
count: number,
): Promise<void> => {
return ipcRenderer.invoke(
"Facebook:incrementTotalWallPostsUntagged",
accountID,
count,
);
},
incrementTotalWallPostsHidden: (
accountID: number,
count: number,
): Promise<void> => {
return ipcRenderer.invoke(
"Facebook:incrementTotalWallPostsHidden",
accountID,
count,
);
},
isRateLimited: (accountID: number): Promise<FacebookRateLimitInfo> => {
return ipcRenderer.invoke("Facebook:isRateLimited", accountID);
},
Expand Down
25 changes: 18 additions & 7 deletions src/renderer/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"tombstoneLockAccount": "Locking account",
"savePosts": "Saving posts",
"savePostsHTML": "Saving posts HTML",
"deleteWallPosts": "Deleting wall posts",
"deleteWallPosts": "Removing wall posts",
"restoreUserLang": "Restoring language"
},
"progress": {
Expand Down Expand Up @@ -407,12 +407,12 @@
"getArchiveTitle": "Get Archive from Meta",
"getArchiveDescription": "If you want, export your Facebook archive BEFORE you delete all your posts.",
"deleteWallTitle": "Delete My Wall",
"deleteWallDescription": "Delete all posts from your Facebook wall."
"deleteWallDescription": "Remove all posts from your Facebook wall."
},
"deleteOptions": {
"title": "Delete My Wall",
"description": "Select the data you want to delete from your Facebook wall.",
"deleteWallPosts": "Delete all posts from my wall"
"description": "Select the data you want to remove from your Facebook wall.",
"deleteWallPosts": "Remove all posts from my wall"
},
"review": {
"deleteWallPosts": "All posts from your Facebook wall",
Expand All @@ -421,7 +421,9 @@
},
"finished": {
"title": "Jobs Completed",
"wallPosts": "wall posts removed (deleted, untagged, or hidden)"
"wallPostsDeleted": "wall posts deleted",
"wallPostsUntagged": "wall posts untagged",
"wallPostsHidden": "wall posts hidden"
},
"premium": {
"readyToDelete": "You're all set! Let's continue to configure what you want to delete.",
Expand Down Expand Up @@ -620,10 +622,19 @@
"savingLanguage": "I'm checking your language settings.",
"settingLanguageToEnglish": "I'm temporarily changing your language to English (US) for automation.",
"restoringLanguage": "I'm restoring your original language setting.",
"deletingWallPosts": "# I'm removing all posts from your Facebook wall."
"removingWallPosts": "# I'm removing all posts from your Facebook wall.",
"managePostsLoading": "# I'm checking what posts are left to remove.",
"checkBatchActionWallPosts": "# I'm looking for a batch of posts to **{action}**...",
"removeActionWallPosts": "# I'm **{action} {count} posts**....",
"actionDelete": "delete",
"actionDeletePresent": "deleting",
"actionUntag": "untag",
"actionUntagPresent": "untagging",
"actionHide": "hide",
"actionHidePresent": "hiding"
},
"progress": {
"wallPostsDeleted": "Removed {count} wall posts."
"wallPostsProgress": "Deleted **{deleteCount}**, untagged **{untagCount}**, and hid **{hideCount}** wall posts."
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/src/test_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,16 @@ export function mockElectronAPI() {
getProgressInfo: vi.fn().mockResolvedValue({
accountUUID: "test-uuid-123",
totalWallPostsDeleted: 0,
totalWallPostsUntagged: 0,
totalWallPostsHidden: 0,
}),
getConfig: vi.fn().mockResolvedValue(null),
setConfig: vi.fn().mockResolvedValue(undefined),
deleteConfig: vi.fn().mockResolvedValue(undefined),
deleteConfigLike: vi.fn().mockResolvedValue(undefined),
incrementTotalWallPostsDeleted: vi.fn().mockResolvedValue(undefined),
incrementTotalWallPostsUntagged: vi.fn().mockResolvedValue(undefined),
incrementTotalWallPostsHidden: vi.fn().mockResolvedValue(undefined),
isRateLimited: vi
.fn()
.mockResolvedValue({ isRateLimited: false, rateLimitReset: 0 }),
Expand Down
14 changes: 14 additions & 0 deletions src/renderer/src/util_facebook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ describe("util_facebook", () => {
const mockProgressInfo = {
accountUUID: "test-uuid-123",
totalWallPostsDeleted: 42,
totalWallPostsUntagged: 0,
totalWallPostsHidden: 0,
};
mockFacebookGetProgressInfo.mockResolvedValue(mockProgressInfo);

Expand All @@ -79,6 +81,8 @@ describe("util_facebook", () => {
{
account_uuid: "test-uuid-123",
total_wall_posts_deleted: 42,
total_wall_posts_untagged: 0,
total_wall_posts_hidden: 0,
},
true,
);
Expand All @@ -93,6 +97,8 @@ describe("util_facebook", () => {
const mockProgressInfo = {
accountUUID: "test-uuid-456",
totalWallPostsDeleted: 100,
totalWallPostsUntagged: 0,
totalWallPostsHidden: 0,
};
mockFacebookGetProgressInfo.mockResolvedValue(mockProgressInfo);

Expand All @@ -111,6 +117,8 @@ describe("util_facebook", () => {
{
account_uuid: "test-uuid-456",
total_wall_posts_deleted: 100,
total_wall_posts_untagged: 0,
total_wall_posts_hidden: 0,
},
false,
);
Expand All @@ -125,6 +133,8 @@ describe("util_facebook", () => {
const mockProgressInfo = {
accountUUID: "test-uuid-789",
totalWallPostsDeleted: 0,
totalWallPostsUntagged: 0,
totalWallPostsHidden: 0,
};
mockFacebookGetProgressInfo.mockResolvedValue(mockProgressInfo);

Expand All @@ -134,6 +144,8 @@ describe("util_facebook", () => {
{
account_uuid: "test-uuid-789",
total_wall_posts_deleted: 0,
total_wall_posts_untagged: 0,
total_wall_posts_hidden: 0,
},
false,
);
Expand All @@ -154,6 +166,8 @@ describe("util_facebook", () => {
const mockProgressInfo = {
accountUUID: "test-uuid",
totalWallPostsDeleted: 10,
totalWallPostsUntagged: 0,
totalWallPostsHidden: 0,
};
mockFacebookGetProgressInfo.mockResolvedValue(mockProgressInfo);

Expand Down
2 changes: 2 additions & 0 deletions src/renderer/src/util_facebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export async function facebookPostProgress(
{
account_uuid: progressInfo.accountUUID,
total_wall_posts_deleted: progressInfo.totalWallPostsDeleted,
total_wall_posts_untagged: progressInfo.totalWallPostsUntagged,
total_wall_posts_hidden: progressInfo.totalWallPostsHidden,
},
deviceInfo?.valid ? true : false,
);
Expand Down
Loading
Loading