Add colanode icon

This commit is contained in:
Hakan Shehu
2024-11-23 10:29:47 +01:00
parent b6f35ea430
commit fd9b945dc5
8 changed files with 25 additions and 12 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@@ -11,6 +11,9 @@ import fs from 'fs/promises';
const config: ForgeConfig = {
packagerConfig: {
name: 'Colanode',
executableName: 'Colanode',
icon: 'assets/colanode_logo_black',
appBundleId: 'com.colanode.desktop',
asar: true,
ignore: [
/^\/src/,

View File

@@ -16,9 +16,13 @@ import { commandService } from '@/main/services/command-service';
import { bootstrapper } from '@/main/bootstrapper';
import started from 'electron-squirrel-startup';
import { logService } from '@/main/services/log-service';
import { getAppIconPath } from '@/main/utils';
const logger = logService.createLogger('main');
app.setName('Colanode');
app.setAppUserModelId('com.colanode.desktop');
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (started) {
app.quit();
@@ -30,6 +34,7 @@ const createWindow = () => {
// Create the browser window.
const mainWindow = new BrowserWindow({
fullscreen: true,
icon: getAppIconPath(),
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
},

View File

@@ -4,7 +4,8 @@ import fs from 'fs';
import unzipper from 'unzipper';
import { EmojiData } from '@/shared/types/emojis';
import { IconData } from '@/shared/types/icons';
import { logService } from './log-service';
import { logService } from '@/main/services/log-service';
import { getAssetsSourcePath } from '@/main/utils';
type AssetsVersion = {
date: string;
@@ -34,7 +35,7 @@ class AssetService {
return path.join(this.assetsDir, url);
}
return path.join(this.getAssetsSourcePath(), url);
return path.join(getAssetsSourcePath(), url);
}
public getEmojiData(): EmojiData {
@@ -70,7 +71,7 @@ class AssetService {
private async updateEmojis(): Promise<void> {
this.logger.debug('Updating emojis');
const emojisZipPath = path.join(this.getAssetsSourcePath(), 'emojis.zip');
const emojisZipPath = path.join(getAssetsSourcePath(), 'emojis.zip');
const emojisDir = path.join(this.assetsDir, 'emojis');
if (fs.existsSync(emojisDir)) {
fs.rmSync(emojisDir, { recursive: true });
@@ -86,7 +87,7 @@ class AssetService {
private async updateIcons(): Promise<void> {
this.logger.debug('Updating icons');
const iconsZipPath = path.join(this.getAssetsSourcePath(), 'icons.zip');
const iconsZipPath = path.join(getAssetsSourcePath(), 'icons.zip');
const iconsDir = path.join(this.assetsDir, 'icons');
if (fs.existsSync(iconsDir)) {
fs.rmSync(iconsDir, { recursive: true });
@@ -133,14 +134,6 @@ class AssetService {
})
);
}
private getAssetsSourcePath(): string {
if (app.isPackaged) {
return path.join(process.resourcesPath, 'assets');
}
return path.resolve(__dirname, '../../assets');
}
}
export const assetService = new AssetService();

View File

@@ -40,6 +40,18 @@ export const getAccountAvatarsDirectoryPath = (accountId: string): string => {
return path.join(appPath, 'avatars', accountId);
};
export const getAssetsSourcePath = (): string => {
if (app.isPackaged) {
return path.join(process.resourcesPath, 'assets');
}
return path.resolve(__dirname, '../../assets');
};
export const getAppIconPath = (): string => {
return path.join(getAssetsSourcePath(), 'colanode_logo_black.png');
};
export const hasInsertChanges = (result: InsertResult[]): boolean => {
if (result.length === 0) {
return false;