Skip to content

Commit

Permalink
Merge pull request #1878 from KhalisFoundation/dev
Browse files Browse the repository at this point in the history
9.2.0 Una Beta release
  • Loading branch information
inderpreetsingh authored Dec 20, 2023
2 parents 81e73e8 + d9e659e commit d9dff34
Show file tree
Hide file tree
Showing 31 changed files with 227 additions and 212 deletions.
32 changes: 26 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
## New Updates

### 9.2.0 - ਊਨਾ Release _December 24, 2023_

#### New Features

- Ability to login and save your favorite shabads
- Added new video themes for the viewer
![](./assets/img/help_images/video-themes.gif)
- Added a newly designed app loader
- Ability to fiter history results

#### Misc. bug fix and other improvements
- Completely redesigned announcement and dhan guru pane.
![](./assets/img/help_images/announcement-overhaul.png)
- Smoother user experience with subtle animations.
- Other minor improvements

**We would love to hear from you if there a feature that you have been waiting for. Send us your feedback at [sttm.co/feedback](https://www.sttm.co/feedback).**

</br>

### 9.1.3 - _September 30, 2023_

#### Enhancements

- Adds a gurmukhi on-screen keyboard to write annoucements.
- Adds a gurmukhi on-screen keyboard to write announcements.
- Sundar gutka now has an option to switch to english menu.

#### Misc. bug fix and other improvements

- Bani Overlay connectivity with annoucement is improved.
- Bani Overlay connectivity with announcement is improved.
- Fixed issues with the Akhand path view and the Dhan Guru slides.
- Save the shabad navigated through next and previous icons in shabad history.
- Other minor improvements
Expand Down Expand Up @@ -381,7 +401,7 @@ We are excited to launch the latest version of SikhiToTheMax 9.0, which features

- Bani Overlay has been revamped! We have enhanced the UI to make things a little cleaner and less cluttered
- The SikhiToTheMax logo has been added to Bani Overlay as default and can be turned off with the new "Logo" toggle
- The "Show Annoucements in Overlay" toggle has been moved to the Bani Overlay toolbar
- The "Show announcements in Overlay" toggle has been moved to the Bani Overlay toolbar
- The Dhan Guru Nanak Gurpurab theme has been removed. Stay tuned for more special themes in the future!
![](./assets/img/help_images/desktop-new-overlay.png)

Expand All @@ -408,8 +428,8 @@ We are excited to launch the latest version of SikhiToTheMax 9.0, which features

### Improved:

- Added the ability to choose if annoucements should appear in Bani Overlay
- Fixed a bug that would cause annoucements to be hard to read when using dark themes
- Added the ability to choose if announcements should appear in Bani Overlay
- Fixed a bug that would cause announcements to be hard to read when using dark themes
- Fixed a bug that would cause the last line of Anand Sahib (Bhog) not to display properly
- Fixed a bug that would cause a white screen to flash upon app launch
- Fixed a bug that caused the spacebar not to function properly
Expand All @@ -430,7 +450,7 @@ We are excited to launch the latest version of SikhiToTheMax 9.0, which features

### Added:

- New shortcut for inserting an annoucement or displaying a "Dhan Guru" slide. Just press CTRL (or CMD for Mac) + G
- New shortcut for inserting an announcement or displaying a "Dhan Guru" slide. Just press CTRL (or CMD for Mac) + G
![](./assets/img/help_images/desktop-dhan-modal.jpg)

### Improved:
Expand Down
55 changes: 8 additions & 47 deletions analytics.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
const ua = require('universal-analytics'); // https://www.npmjs.com/package/universal-analytics
const { trackEvent } = require('@aptabase/electron/main');
const ua = require('universal-analytics');
const isOnline = require('is-online');
require('dotenv').config();
const fetch = require('node-fetch');

const pjson = require('./package.json');

const appVersion = pjson.version;
// ToDo: Revert back to .env after setting up on AWS build server
const trackingId = 'UA-45513519-12';
const trackingId = process.env.GOOGLE_ANALYTICS_ID;

class Analytics {
constructor(userId, store) {
Expand All @@ -17,19 +16,6 @@ class Analytics {
}
}

/**
* https://developers.google.com/analytics/devguides/collection/analyticsjs/events
* Name | type | required | example
* ------------------------------------------
* eventCategory | text | yes | Typically the object that was interacted with (e.g. 'Video')
* eventAction | text | yes | The type of interaction (e.g. 'play')
* eventLabel | text | no | Useful for categorizing events (e.g. 'Fall Campaign')
* eventValue | int | no | A numeric value associated with the event (e.g. 42)
* @param category
* @param action
* @param label
* @param value
*/
trackEvent({ category, action, label, value }) {
const useragent = this.store.get('user-agent');
const params = {
Expand All @@ -40,42 +26,18 @@ class Analytics {
cd1: appVersion,
useragent,
};
const url = `https://www.google-analytics.com/mp/collect?measurement_id=${process.env.GA_MEASUREMENT_ID}&api_secret=${process.env.GA_API_SECRET}`;
const requestData = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
client_id: this.usr.cid,
events: [
{
name: category,
params,
},
],
}),
};

if (process.env.NODE_ENV !== 'development') {
// TODO: need to add variable that stops statistics collection
isOnline().then((online) => {
// TODO: for offline users, come up with a way of storing and send when online.
if (online && this.usr) {
this.usr.event(params).send();

// Code specific to GA4
fetch(url, requestData)
.then((response) => {
if (response.ok) {
console.log('Event sent successfully using GA4');
} else {
console.error('Error sending event using GA4:');
}
})
.catch((error) => {
console.error('Error occurred while sending event using GA4:', error);
});
trackEvent(action, {
category,
label,
value,
});
}
});
} else {
Expand All @@ -91,7 +53,6 @@ class Analytics {
* @param title
* @param hostname
*/
// when we will remove UA, we can safely remove the below function since it will be outdated
trackPageView(path, title, hostname = 'SikhiToTheMax Desktop') {
if (process.env.NODE_ENV !== 'development') {
if (this.store.get('userPrefs.app.analytics.collectStatistics')) {
Expand Down
55 changes: 49 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ const i18nBackend = require('i18next-node-fs-backend');
const os = require('os');
const fetch = require('node-fetch');
const remote = require('@electron/remote/main');
const keytar = require('keytar');
// eslint-disable-next-line import/no-unresolved
const aptabase = require('@aptabase/electron/main');

require('dotenv').config();

remote.initialize();

Expand Down Expand Up @@ -60,7 +63,7 @@ i18n.init({

expressApp.use(express.static(path.join(__dirname, 'www', 'obs')));

const { app, webContents, BrowserWindow, dialog, ipcMain } = electron;
const { app, webContents, BrowserWindow, dialog, ipcMain, safeStorage } = electron;

const store = new Store({
configName: 'user-preferences',
Expand All @@ -83,6 +86,7 @@ let startChangelogOpenTimer;
let endChangelogOpenTimer;

app.setAsDefaultProtocolClient('sttm-desktop');
aptabase.initialize(process.env.APTABASE_KEY);

if (process.argv.length >= 2) {
app.setAsDefaultProtocolClient('sttm-desktop', process.execPath, [path.resolve(process.argv[1])]);
Expand Down Expand Up @@ -246,6 +250,40 @@ function checkForUpdates(manual = false) {
}
}

function saveToken(token) {
if (!safeStorage.isEncryptionAvailable()) {
throw new Error('Encryption is not available on this system');
}
const userDataPath = app.getPath('userData');
const encryptedToken = safeStorage.encryptString(token);
const tokenPath = path.join(userDataPath, 'userToken.enc');
fs.writeFileSync(tokenPath, encryptedToken);
}

function retrieveToken() {
const userDataPath = app.getPath('userData');
const tokenPath = path.join(userDataPath, 'userToken.enc');

if (fs.existsSync(tokenPath)) {
const encryptedToken = fs.readFileSync(tokenPath);
if (!safeStorage.isEncryptionAvailable()) {
throw new Error('Decryption is not available on this system');
}
return safeStorage.decryptString(encryptedToken);
}

return null;
}

function deleteToken() {
const userDataPath = app.getPath('userData');
const tokenPath = path.join(userDataPath, 'userToken.enc');
fs.unlink(tokenPath, () => {
// eslint-disable-next-line no-console
console.log('token deleted');
});
}

function checkForExternalDisplay() {
const electronScreen = electron.screen;
const displays = electronScreen.getAllDisplays();
Expand Down Expand Up @@ -463,7 +501,7 @@ const handleDeeplink = async (url) => {
const token = loginData.get('token');
if (token) {
try {
await keytar.setPassword('sttm-desktop', 'userToken', token);
saveToken(token);
mainWindow.webContents.send('userToken', token);
} catch {
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -540,9 +578,6 @@ app.on('ready', () => {
splash.loadURL(`file://${__dirname}/www/splash.html`);
splash.center();
remote.enable(mainWindow.webContents);
keytar.getPassword('sttm-desktop', 'userToken').then((data) => {
mainWindow.webContents.send('userToken', data);
});
mainWindow.webContents.on('dom-ready', () => {
if (checkForExternalDisplay()) {
mainWindow.webContents.send(
Expand All @@ -555,6 +590,10 @@ app.on('ready', () => {
}
splash.close();
mainWindow.show();
const token = retrieveToken();
if (token) {
mainWindow.webContents.send('userToken', token);
}
// Platform-specific app stores have their own update mechanism
// so only check if we're not in one
if (!appstore && !isUnsupportedWindow) {
Expand Down Expand Up @@ -644,6 +683,10 @@ ipcMain.on('save-overlay-settings', (event, overlayPrefs) => {
updateOverlayVars(JSON.parse(overlayPrefs));
});

ipcMain.on('deleteToken', () => {
deleteToken();
});

io.on('connection', (socket) => {
updateOverlayVars();
if (lastLine) {
Expand Down
47 changes: 15 additions & 32 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"stylelint-order": "^5.0.0"
},
"dependencies": {
"@aptabase/electron": "^0.3.1",
"@babel/polyfill": "^7.8.7",
"@electron/remote": "^2.0.11",
"anvaad-js": "^1.4.3",
Expand All @@ -96,7 +97,6 @@
"ip": "^1.1.8",
"is-electron": "^2.2.2",
"is-online": "^9.0.1",
"keytar": "^7.9.0",
"lodash.camelcase": "^4.3.0",
"lodash.capitalize": "^4.2.1",
"lodash.debounce": "^4.0.8",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/assets/img/help_images/video-themes.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified www/assets/img/icons/liveicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 1 addition & 14 deletions www/assets/img/icons/liveicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified www/assets/img/icons/logout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d9dff34

Please sign in to comment.