Skip to content

Commit

Permalink
Update packages and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
antoineguilbert committed Apr 19, 2023
1 parent 3d68819 commit 30f30c3
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 10
node-version: 20

- name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1
uses: samuelmeuli/action-electron-builder@v1.6.0
with:
# GitHub token, automatically provided to the action
# (No need to define this secret in the repo settings)
Expand Down
22 changes: 21 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const electron = require('electron');
const path = require('path');
const url = require('url');
const windowStateKeeper = require('electron-window-state');
const { app, BrowserWindow, Menu, MenuItem, dialog } = electron;
const { app, BrowserWindow, Menu, MenuItem, dialog, nativeTheme } = electron;
const { autoUpdater } = require('electron-updater');

let mainWindow
Expand Down Expand Up @@ -39,6 +39,20 @@ function createWindow () {
mainWindow = new BrowserWindow(windowOptions)
//mainWindow.webContents.openDevTools();

// set user agent to potentially make google fi work
const userAgent =
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0";

mainWindow.webContents.session.webRequest.onBeforeSendHeaders(
{
urls: ["https://accounts.google.com/*"],
},
({ requestHeaders }, callback) =>
callback({
requestHeaders: { ...requestHeaders, "User-Agent": userAgent },
})
);

mainWindow.loadURL(url.format({
pathname: path.join('messages.google.com/web'),
protocol: 'https:',
Expand All @@ -50,6 +64,12 @@ function createWindow () {
electron.shell.openExternal(url);
})

nativeTheme.on('updated', () => {
mainWindow.webContents.send(EVENT_UPDATE_USER_SETTING, {
useDarkMode: nativeTheme.shouldUseDarkColors
});
});

//When a SMS arrived in the app, change the badge
if (process.platform === 'darwin') {
mainWindow.on('page-title-updated', function (e, title) {
Expand Down
23 changes: 16 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "android-messages",
"productName": "Android Messages",
"appId": "com.antoineguilbert.android-messages",
"version": "1.1.7",
"version": "2.0.0",
"description": "Just a simple project made with electron JS to show Android Messages from Google in a app with notifications.",
"main": "main.js",
"scripts": {
Expand All @@ -20,7 +20,15 @@
"build": {
"appId": "com.antoineguilbert.android-messages",
"mac": {
"category": "public.app-category.social-networking"
"category": "public.app-category.social-networking",
"target": [
{
"target": "mas",
"arch": [
"universal"
]
}
]
},
"win": {
"target": "nsis"
Expand All @@ -41,13 +49,14 @@
]
},
"devDependencies": {
"electron": "^11.1.1",
"electron-builder": "^22.9.1"
"electron": "^24.1.2",
"electron-builder": "^24.2.1"
},
"dependencies": {
"electron-context-menu": "^2.4.0",
"electron-updater": "^4.0.6",
"electron-context-menu": "^3.1.1",
"electron-updater": "^5.3.0",
"electron-window-state": "^5.0.3",
"i18n": "^0.13.2"
"i18n": "^0.15.1",
"latest-version": "^7.0.0"
}
}

0 comments on commit 30f30c3

Please sign in to comment.