Skip to content

Commit

Permalink
Merge pull request #2457 from planetarium/release/2.7.0
Browse files Browse the repository at this point in the history
Release/2.7.0 to main
  • Loading branch information
Akamig committed Jul 1, 2024
2 parents 3b0961b + ef97299 commit 87e7a24
Show file tree
Hide file tree
Showing 89 changed files with 499 additions and 3,435 deletions.
17 changes: 0 additions & 17 deletions __tests__/mock/MockNineChroniclesMixpanel.ts

This file was deleted.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "NineChronicles",
"productName": "Nine Chronicles",
"version": "2.6.2",
"version": "2.7.0",
"description": "Game Launcher for Nine Chronicles",
"author": "Planetarium <engineering@planetariumhq.com>",
"license": "GPL-3.0",
Expand Down Expand Up @@ -92,7 +92,6 @@
"graphql-request": "5.1.0",
"lockfile": "^1.0.4",
"material-ui-popup-state": "^1.6.1",
"mixpanel": "^0.13.0",
"mobx": "^6.7.0",
"mobx-react": "^7.6.0",
"mobx-react-router": "^5.0.0",
Expand Down
170 changes: 1 addition & 169 deletions src/api.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ query TransactionResult($txId: TxId!) {
blockHash
blockIndex
txStatus
outputState
}
}
}
Expand Down Expand Up @@ -98,21 +99,6 @@ query ValidateSnapshot($raw: String!) {
}
}

query CollectionSheet {
stateQuery {
monsterCollectionSheet {
orderedList {
level
requiredGold
rewards {
itemId
quantity
}
}
}
}
}

query GetAvatarAddress($address: Address!) {
stateQuery {
agent(address: $address) {
Expand All @@ -125,27 +111,6 @@ query GetAvatarAddress($address: Address!) {
}
}

query CollectionSheetWithState($address: Address!) {
stateQuery {
monsterCollectionSheet {
orderedList {
level
requiredGold
rewards {
itemId
quantity
}
}
}
agent(address: $address) {
gold
}
monsterCollectionState(agentAddress: $address) {
level
}
}
}

query MinerAddress {
minerAddress
}
Expand All @@ -164,35 +129,6 @@ query GetNextTxNonce($address: Address!) {
}
}

query StateQueryMonsterCollection($agentAddress: Address!) {
stateQuery {
agent(address: $agentAddress) {
gold
}

monsterCollectionState(agentAddress: $agentAddress) {
expiredBlockIndex
level
rewardLevel
receivedBlockIndex
startedBlockIndex
claimableBlockIndex
}
}
}

mutation Collect($level: Int!) {
action {
monsterCollect(level: $level)
}
}

mutation ClaimCollectionReward($address: Address!) {
action {
claimMonsterCollectionReward(avatarAddress: $address)
}
}

mutation Transfer(
$recipient: Address!
$amount: String!
Expand Down Expand Up @@ -249,92 +185,6 @@ subscription Tip {
}
}

query UserStaking($address: Address!) {
stateQuery {
stakeState(address: $address) {
deposit
startedBlockIndex
receivedBlockIndex
cancellableBlockIndex
claimableBlockIndex
stakeRewards {
orderedList {
level
requiredGold
rewards {
itemId
decimalRate
type
currencyTicker
}
bonusRewards {
itemId
count
}
}
}
}
}
}

query LatestStakingSheet {
stateQuery {
latestStakeRewards {
orderedList {
level
requiredGold
rewards {
itemId
decimalRate
type
currencyTicker
}
bonusRewards {
itemId
count
}
}
}
}
}

query StakingSheet {
stateQuery {
stakeRewards {
orderedList {
level
requiredGold
rewards {
itemId
decimalRate
type
currencyTicker
}
bonusRewards {
itemId
count
}
}
}
}
}

query V1CollectionState($address: Address!) {
stateQuery {
monsterCollectionSheet {
orderedList {
level
requiredGold
}
}
monsterCollectionState(agentAddress: $address) {
startedBlockIndex
claimableBlockIndex
level
}
}
}

query GenesisHash {
nodeStatus {
genesis {
Expand Down Expand Up @@ -365,24 +215,6 @@ query transferAsset(
}
}

query Stake($publicKey: String!, $amount: BigInt) {
actionTxQuery(publicKey: $publicKey) {
stake(amount: $amount)
}
}

query ClaimStakeReward($publicKey: String!, $avatarAddress: Address) {
actionTxQuery(publicKey: $publicKey) {
claimStakeReward(avatarAddress: $avatarAddress)
}
}

query MigrateMonsterCollection($publicKey: String!, $avatarAddress: Address) {
actionTxQuery(publicKey: $publicKey) {
migrateMonsterCollection(avatarAddress: $avatarAddress)
}
}

query CheckContracted($agentAddress: Address!) {
stateQuery {
pledge(agentAddress: $agentAddress) {
Expand Down
1 change: 0 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ export const CUSTOM_SERVER: boolean =
LocalServerPort().notDefault ||
RpcServerHost().notDefault ||
RpcServerPort().notDefault;
export const MIXPANEL_TOKEN = "80a1e14b57d050536185c7459d45195a";
export const TRANSIFEX_TOKEN = "1/9ac6d0a1efcda679e72e470221e71f4b0497f7ab";
export const DEFAULT_DOWNLOAD_BASE_URL = "https://release.nine-chronicles.com";
export const installerName = "NineChroniclesInstaller.exe";
Expand Down
78 changes: 2 additions & 76 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
configStore,
get as getConfig,
playerPath,
MIXPANEL_TOKEN,
netenv,
baseUrl,
CONFIG_FILE_PATH,
Expand All @@ -30,11 +29,9 @@ import "core-js";
import log from "electron-log";
import * as utils from "src/utils";
import { IGameStartOptions } from "../interfaces/ipc";
import { init as createMixpanel } from "mixpanel";
import { v4 as uuidv4 } from "uuid";
import { Client as NTPClient } from "ntp-time";
import { IConfig } from "src/interfaces/config";
import { NineChroniclesMixpanel } from "./mixpanel";
import {
createWindow as createV2Window,
setQuitting as setV2Quitting,
Expand Down Expand Up @@ -79,12 +76,6 @@ const updateOptions: IUpdateOptions = {
downloadStarted: quitAllProcesses,
};

const mixpanelUUID = loadInstallerMixpanelUUID();
const mixpanel: NineChroniclesMixpanel | undefined =
getConfig("Mixpanel") && process.env.NODE_ENV === "production"
? new NineChroniclesMixpanel(createMixpanel(MIXPANEL_TOKEN), mixpanelUUID)
: undefined;

client
.syncTime()
.then((time) => {
Expand Down Expand Up @@ -115,17 +106,6 @@ if (!app.requestSingleInstanceLock()) {

app.on("open-url", (_, url) => win && send(win, IPC_OPEN_URL, url));

let quitTracked = false;
app.on("before-quit", (event) => {
if (mixpanel != null && !quitTracked) {
event.preventDefault();
mixpanel?.track("Launcher/Quit", undefined, () => {
quitTracked = true;
app.quit();
});
}
});

cleanUp();

if (process.platform === "darwin" && process.arch == "arm64") {
Expand Down Expand Up @@ -270,10 +250,6 @@ async function initializeApp() {

if (app.commandLine.hasSwitch("protocol"))
send(win!, IPC_OPEN_URL, process.argv[process.argv.length - 1]);

mixpanel?.track("Launcher/Start", {
isV2: true,
});
});

app.on("quit", (event) => {
Expand Down Expand Up @@ -350,10 +326,6 @@ function initializeIpc() {
}
});

ipcMain.on("login", async () => {
mixpanel?.login();
});

ipcMain.on("get-aws-sink-cloudwatch-guid", async (event) => {
const localAppData = process.env.localappdata;
if (process.platform === "win32" && localAppData !== undefined) {
Expand All @@ -377,19 +349,6 @@ function initializeIpc() {
event.returnValue = "Not supported platform.";
});

ipcMain.on(
"mixpanel-track-event",
async (_, eventName: string, param: object) => {
mixpanel?.track(eventName, {
...param,
});
},
);

ipcMain.on("mixpanel-alias", async (_, alias: string) => {
mixpanel?.alias(alias);
});

ipcMain.on("online-status-changed", (event, status: "online" | "offline") => {
console.log(`online-status-changed: ${status}`);
if (status === "offline") {
Expand Down Expand Up @@ -449,32 +408,6 @@ function cleanUp() {
cleanUpLockfile();
}

function loadInstallerMixpanelUUID(): string {
const planetariumPath =
process.platform === "win32"
? path.join(process.env.LOCALAPPDATA as string, "planetarium")
: app.getPath("userData");
if (!fs.existsSync(planetariumPath)) {
fs.mkdirSync(planetariumPath, {
recursive: true,
});
}

const guidPath = path.join(planetariumPath, ".installer_mixpanel_uuid");

if (!fs.existsSync(guidPath)) {
const newUUID = uuidv4();
console.log(`The installer mixpanel UUID doesn't exist at '${guidPath}'.`);
fs.writeFileSync(guidPath, newUUID);
console.log(`Created new UUID ${newUUID} and stored.`);
return newUUID;
} else {
return fs.readFileSync(guidPath, {
encoding: "utf-8",
});
}
}

async function quitAllProcesses(reason: string = "default") {
if (gameNode === null) return;
const pid = gameNode.pid!;
Expand Down Expand Up @@ -520,15 +453,8 @@ function createTray(iconPath: string) {
}

function relaunch() {
if (mixpanel !== undefined) {
mixpanel.track("Launcher/Relaunch", undefined, () => {
app.relaunch();
app.exit();
});
} else {
app.relaunch();
app.exit();
}
app.relaunch();
app.exit();
}

function initCheckForUpdateWorker(
Expand Down
Loading

0 comments on commit 87e7a24

Please sign in to comment.