mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-25 07:59:48 +01:00
web: treat mac app store build specially
This commit is contained in:
6
.github/workflows/desktop.publish.yml
vendored
6
.github/workflows/desktop.publish.yml
vendored
@@ -109,10 +109,6 @@ jobs:
|
||||
- name: Install packages
|
||||
run: npm i
|
||||
working-directory: ./apps/web/desktop
|
||||
|
||||
- name: Build Electron wrapper
|
||||
run: npm run build
|
||||
working-directory: ./apps/web/desktop
|
||||
|
||||
- name: Install provisioning profile
|
||||
run: echo "${{ secrets.MAC_PROVISIONING_PROFILE }}" | base64 --decode > embedded.provisionprofile
|
||||
@@ -124,6 +120,7 @@ jobs:
|
||||
CSC_LINK: ${{ secrets.mac_certs }}
|
||||
CSC_KEY_PASSWORD: ${{ secrets.mac_certs_password }}
|
||||
run: |
|
||||
npm run build:mas
|
||||
npx electron-builder --mac mas --universal -p never
|
||||
working-directory: ./apps/web/desktop
|
||||
|
||||
@@ -133,6 +130,7 @@ jobs:
|
||||
CSC_LINK: ${{ secrets.mac_certs }}
|
||||
CSC_KEY_PASSWORD: ${{ secrets.mac_certs_password }}
|
||||
run: |
|
||||
npm run build
|
||||
if [ ${{ inputs.publish-github }} == true ]; then
|
||||
npx electron-builder --mac zip dmg -p always
|
||||
else
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
"zx": "^7.0.7"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "esbuild ./electron.js ./preload.js --minify --external:electron --external:fsevents --bundle --outdir=./build --platform=node --tsconfig=tsconfig.json",
|
||||
"build": "esbuild ./electron.js ./preload.js --minify --external:electron --external:fsevents --bundle --outdir=./build --platform=node --tsconfig=tsconfig.json --define:MAC_APP_STORE=false",
|
||||
"build:mas": "esbuild ./electron.js ./preload.js --minify --external:electron --external:fsevents --bundle --outdir=./build --platform=node --tsconfig=tsconfig.json --define:MAC_APP_STORE=true",
|
||||
"pack": "rm -rf ./build && cp -r ../build ./ && npm run build && yarn electron-builder --linux AppImage && ./dist/notesnook_x86_64.AppImage"
|
||||
},
|
||||
"author": {
|
||||
|
||||
@@ -19,9 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
const { contextBridge, ipcRenderer } = require("electron");
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
contextBridge.exposeInMainWorld("os", MAC_APP_STORE ? "mas" : process.platform);
|
||||
|
||||
// Expose protected methods that allow the renderer process to use
|
||||
// the ipcRenderer without exposing the entire object
|
||||
contextBridge.exposeInMainWorld("os", process.platform);
|
||||
contextBridge.exposeInMainWorld("api", {
|
||||
send: (channel, data) => {
|
||||
// whitelist channels
|
||||
|
||||
@@ -40,7 +40,7 @@ import { db } from "../../../common/db";
|
||||
import { useCheckoutStore } from "./store";
|
||||
import { getCurrencySymbol } from "./helpers";
|
||||
import { Theme } from "@notesnook/theme";
|
||||
import { isMacApp } from "../../../utils/platform";
|
||||
import { isMacStoreApp } from "../../../utils/platform";
|
||||
|
||||
type BuyDialogProps = {
|
||||
couponCode?: string;
|
||||
@@ -284,7 +284,7 @@ function TrialOrUpgrade(props: TrialOrUpgradeProps) {
|
||||
{formatPeriod(plan.period)}
|
||||
</Text>
|
||||
)}
|
||||
{isMacApp() ? (
|
||||
{isMacStoreApp() ? (
|
||||
<>
|
||||
<Text variant={"subBody"} mt={2} sx={{ textAlign: "center" }}>
|
||||
You cannot upgrade from the macOS app.
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Text, Flex, Box } from "@theme-ui/components";
|
||||
import { isMacApp } from "../../../utils/platform";
|
||||
import { isMacStoreApp } from "../../../utils/platform";
|
||||
import {
|
||||
Accent,
|
||||
Android,
|
||||
@@ -122,7 +122,7 @@ const sections: Section[] = [
|
||||
title: "100% cross platform",
|
||||
detail: "Notesnook is available on all major platforms — for everyone.",
|
||||
columns: 8,
|
||||
isVisible: () => !isMacApp(),
|
||||
isVisible: () => !isMacStoreApp(),
|
||||
features: [
|
||||
{
|
||||
id: "ios",
|
||||
|
||||
@@ -126,8 +126,8 @@ export function isDesktop() {
|
||||
return "api" in window;
|
||||
}
|
||||
|
||||
export function isMacApp() {
|
||||
return true; // window.os === "darwin";
|
||||
export function isMacStoreApp() {
|
||||
return window.os === "mas";
|
||||
}
|
||||
|
||||
export function isTesting() {
|
||||
|
||||
@@ -54,7 +54,7 @@ import { appVersion } from "../utils/version";
|
||||
import { CHECK_IDS } from "@notesnook/core/common";
|
||||
import Tip from "../components/tip";
|
||||
import Toggle from "../components/toggle";
|
||||
import { isDesktop, isMacApp } from "../utils/platform";
|
||||
import { isDesktop, isMacStoreApp } from "../utils/platform";
|
||||
import Vault from "../common/vault";
|
||||
import { isUserPremium } from "../hooks/use-is-user-premium";
|
||||
import { Slider } from "@theme-ui/components";
|
||||
@@ -103,11 +103,11 @@ const otherItems = [
|
||||
link: "https://discord.com/invite/zQBK97EE22"
|
||||
},
|
||||
{
|
||||
title: isMacApp() ? "Download for iOS" : "Download for iOS & Android",
|
||||
description: isMacApp()
|
||||
title: isMacStoreApp() ? "Download for iOS" : "Download for iOS & Android",
|
||||
description: isMacStoreApp()
|
||||
? "Notesnook is also available on iOS"
|
||||
: "Notesnook is available on Android & iOS",
|
||||
link: isMacApp()
|
||||
link: isMacStoreApp()
|
||||
? "https://apps.apple.com/us/app/notesnook-take-private-notes/id1544027013"
|
||||
: "https://notesnook.com/"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user