Skip to content

Commit

Permalink
Merge branch 'main' into neilenns/kSetStationStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
neilenns committed Jun 1, 2024
2 parents 02a0574 + 6639805 commit 005eac8
Show file tree
Hide file tree
Showing 19 changed files with 235 additions and 159 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
jobs:
build:
runs-on: ${{ matrix.os }}
environment: Release

strategy:
matrix:
Expand Down Expand Up @@ -49,7 +50,7 @@ jobs:
- name: Installing codesign certificates
if: matrix.os == 'macos-latest'
uses: apple-actions/import-codesign-certs@v2
uses: apple-actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.APPLE_CERT_DATA }}
p12-password: ${{ secrets.APPLE_CERT_PASSWORD }}
Expand Down Expand Up @@ -124,6 +125,7 @@ jobs:
npm install
- name: Package app
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_ID: ${{ secrets.APPLE_ID }}
Expand All @@ -138,13 +140,6 @@ jobs:
dmg_file=$(find . -name "*.dmg" -type f)
new_dmg_file=$(echo $dmg_file | sed 's/arm64/apple-silicon/')
mv $dmg_file $new_dmg_file
- name: Codesign dmg
if: matrix.os == 'macos-latest'
run: |
cd out/make
dmg_file=$(find . -name "*.dmg" -type f)
codesign --timestamp --verbose --sign "Developer ID Application" $dmg_file
- id: relinfo
uses: pozetroninc/github-action-get-latest-release@master
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,5 @@ build/

# Sentry Config File
.sentryclirc

.sign-env.sh
1 change: 1 addition & 0 deletions backend/include/RemoteData.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
#include <Poco/Timer.h>
#include <absl/strings/match.h>
#include <absl/strings/str_split.h>
Expand Down
2 changes: 1 addition & 1 deletion backend/include/Shared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#define API_SERVER_PORT 49080

constexpr semver::version VERSION = semver::version { 1, 0, 2, semver::prerelease::beta, 6 };
constexpr semver::version VERSION = semver::version { 1, 0, 2, semver::prerelease::beta, 7 };
// NOLINTNEXTLINE
const std::string CLIENT_NAME = std::string("TrackAudio-") + VERSION.to_string();

Expand Down
6 changes: 2 additions & 4 deletions backend/include/sdkWebsocketMessage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,8 @@ class Station {

// Example of kTxBegin message:
// @type the type of the message
// @value the frequencies which are being transmitted on
// JSON: {"type": "kTxBegin", "value": {"pFrequenciesHz": [123000000, 118000000]}}
// JSON: {"type": "kTxBegin", "value": {}}

// Example of kTxEnd message:
// @type the type of the message
// @value the frequencies which were being transmitted on
// JSON: {"type": "kTxEnd", "value": {"pFrequenciesHz": [123000000, 118000000]}}
// JSON: {"type": "kTxEnd", "value": {}}
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"types": "types/index.d.ts",
"scripts": {
"build": "cmake-js compile -B Release && node custom_build.mjs && npm pack",
"build": "cmake-js compile -B Release -p 8 && node custom_build.mjs && npm pack",
"format": "clang-format -i include/**.hpp && clang-format -i include/**.h && clang-format -i src/**.cpp"
},
"cmake-js": {
Expand Down
1 change: 1 addition & 0 deletions backend/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ void SetPtt(const Napi::CallbackInfo& info)
}

bool state = info[0].As<Napi::Boolean>().Value();

mClient->SetPtt(state);
}

Expand Down
34 changes: 18 additions & 16 deletions backend/src/sdk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,31 +94,33 @@ void SDK::handleAFVEventForWebsocket(sdk::types::Event event,
}

if (event == sdk::types::Event::kTxBegin) {
auto allRadios = mClient->getRadioState();
std::vector<unsigned int> allTxRadioFreqs;
for (const auto& [freq, state] : allRadios) {
if (state.tx) {
allTxRadioFreqs.push_back(freq);
}
}
// auto allRadios = mClient->getRadioState();
// std::vector<unsigned int> allTxRadioFreqs;
// for (const auto& [freq, state] : allRadios) {
// if (state.tx) {
// allTxRadioFreqs.push_back(freq);
// }
// }

nlohmann::json jsonMessage = WebsocketMessage::buildMessage(WebsocketMessageType::kTxBegin);
jsonMessage["value"]["pFrequenciesHz"] = allTxRadioFreqs;
// jsonMessage["value"]["pFrequenciesHz"] = allTxRadioFreqs;
this->broadcastOnWebsocket(jsonMessage.dump());
return;
}

if (event == sdk::types::Event::kTxEnd) {
auto allRadios = mClient->getRadioState();
std::vector<unsigned int> allTxRadioFreqs;
for (const auto& [freq, state] : allRadios) {
if (state.tx) {
allTxRadioFreqs.push_back(freq);
}
}
// auto allRadios = mClient->getRadioState();
// std::vector<unsigned int> allTxRadioFreqs;
// for (const auto& [freq, state] : allRadios) {
// if (state.tx) {
// allTxRadioFreqs.push_back(freq);
// }
// }

nlohmann::json jsonMessage = WebsocketMessage::buildMessage(WebsocketMessageType::kTxEnd);
jsonMessage["value"]["pFrequenciesHz"] = allTxRadioFreqs;
// jsonMessage["value"]["pFrequenciesHz"] = allTxRadioFreqs;
this->broadcastOnWebsocket(jsonMessage.dump());
return;
}

if (event == sdk::types::Event::kFrequencyStateUpdate) {
Expand Down
18 changes: 16 additions & 2 deletions forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,25 @@ const canNotarize =
process.env.APPLE_NOTARIZATION_PASSWORD &&
process.env.APPLE_TEAM_ID;

console.log("isMaking", isMaking);
console.log("canNotarize", canNotarize);

const config: ForgeConfig = {
packagerConfig: {
name: "TrackAudio",
asar: true,
osxSign: isMaking ? {} : undefined,
osxSign: isMaking
? {
optionsForFile: (filePath) => {
// Here, we keep it simple and return a single entitlements.plist file.
// You can use this callback to map different sets of entitlements
// to specific files in your packaged app.
return {
entitlements: "scripts/entitlements.plist",
};
},
}
: undefined,
osxNotarize: canNotarize
? {
appleId: process.env.APPLE_ID || "",
Expand Down Expand Up @@ -57,7 +71,7 @@ const config: ForgeConfig = {
{
name: "@electron-forge/maker-dmg",
config: {
icon: "resources/AppIcon/AppIcon.icns"
icon: "resources/AppIcon/AppIcon.icns",
},
},
{
Expand Down
7 changes: 3 additions & 4 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
@@ -1,7 +1,7 @@
{
"name": "trackaudio",
"productName": "TrackAudio",
"version": "1.0.2-beta.6",
"version": "1.0.2-beta.7",
"description": "A next generation Audio-For-VATSIM ATC Client for macOS, Linux and Windows",
"main": ".webpack/main",
"scripts": {
Expand Down
12 changes: 12 additions & 0 deletions scripts/entitlements.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.device.audio-input</key>
<true/>
<key>com.apple.security.device.bluetooth</key>
<true/>
</dict>
</plist>
38 changes: 38 additions & 0 deletions src/app/components/MiniModeToggleButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React, { useCallback } from "react";
import { Fullscreen, FullscreenExit } from "react-bootstrap-icons";

interface MiniModeToggleButtonProps {
showRestoreButton: boolean;
}

const MiniModeToggleButton: React.FC<MiniModeToggleButtonProps> = ({
showRestoreButton,
}) => {
const toggleMiniMode = useCallback(() => {
window.api.toggleMiniMode().catch((error: unknown) => {
console.error(error);
});
}, []);

return (
<button
className="btn btn-primary m-2"
style={{ lineHeight: 0, fontSize: "14px" }}
onClick={toggleMiniMode}
>
{showRestoreButton ? (
<Fullscreen
title={"Switch to large mode"}
style={{ strokeWidth: "0.5px", stroke: "white" }}
/>
) : (
<FullscreenExit
title={"Switch to mini mode"}
style={{ strokeWidth: "0.5px", stroke: "white" }}
/>
)}
</button>
);
};

export default MiniModeToggleButton;
23 changes: 20 additions & 3 deletions src/app/components/mini.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import React from "react";
import React, { useState } from "react";
import useRadioState from "../store/radioStore";
import MiniModeToggleButton from "./MiniModeToggleButton";

const Mini: React.FC = () => {
const [radios] = useRadioState((state) => [state.radios]);
const [isHovered, setIsHovered] = useState(false);

return (
<div className="box-container mini">
<div
className="box-container mini"
onMouseEnter={() => {
setIsHovered(true);
}}
onMouseLeave={() => {
setIsHovered(false);
}}
>
<div className="container">
{radios
.filter((r) => r.rx)
Expand All @@ -15,7 +25,9 @@ const Mini: React.FC = () => {
<span
style={{ color: radio.currentlyTx ? "orange" : "inherit" }}
>
{radio.callsign !== "MANUAL" ? radio.callsign : radio.humanFrequency}
{radio.callsign !== "MANUAL"
? radio.callsign
: radio.humanFrequency}
</span>
:{" "}
<span
Expand All @@ -27,6 +39,11 @@ const Mini: React.FC = () => {
);
})}
</div>
<div
className={`exit-mini-mode-container ${isHovered ? "visible" : "hidden"}`}
>
<MiniModeToggleButton showRestoreButton={true} />
</div>
</div>
);
};
Expand Down
13 changes: 2 additions & 11 deletions src/app/components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "../helpers/CallsignHelper";
import useUtilStore from "../store/utilStore";
import { Configuration } from "../../config";
import { FullscreenExit } from "react-bootstrap-icons";
import MiniModeToggleButton from "./MiniModeToggleButton";

const Navbar: React.FC = () => {
const [showModal, setShowModal] = useState(false);
Expand Down Expand Up @@ -205,16 +205,7 @@ const Navbar: React.FC = () => {
onWheel={handleRadioGainMouseWheel}
value={radioGain}
></input>
<button
className="btn btn-primary m-2 hide-gain-value"
style={{ lineHeight: 0, fontSize: "14px" }}
onClick={() => void window.api.toggleMiniMode()}
>
<FullscreenExit
title={"Mini mode"}
style={{ strokeWidth: "0.5px", stroke: "white" }}
/>
</button>
<MiniModeToggleButton showRestoreButton={false} />
{platform === "linux" && (
<button
className="btn btn-danger m-2 hide-gain-value"
Expand Down
Loading

0 comments on commit 005eac8

Please sign in to comment.