From 5c998c3b1ae3480daf2d97d21ef43c2b279ed6f7 Mon Sep 17 00:00:00 2001 From: lukestahl Date: Tue, 2 Jan 2024 22:56:25 +0100 Subject: [PATCH] add shortcuts generator --- package.json | 2 +- packages/shortcuts-generator/.gitignore | 1 + packages/shortcuts-generator/package.json | 19 +++ packages/shortcuts-generator/src/index.ts | 4 + packages/shortcuts-generator/tsconfig.json | 20 +++ packages/target-plugin/.gitignore | 2 +- pnpm-lock.yaml | 15 ++ public/apps.json | 122 ++++++++++++++++ public/shortcut.template.plist | 154 +++++++++++++++++++++ 9 files changed, 337 insertions(+), 2 deletions(-) create mode 100644 packages/shortcuts-generator/.gitignore create mode 100644 packages/shortcuts-generator/package.json create mode 100644 packages/shortcuts-generator/src/index.ts create mode 100644 packages/shortcuts-generator/tsconfig.json create mode 100644 public/apps.json create mode 100644 public/shortcut.template.plist diff --git a/package.json b/package.json index dba04b9..9d0fc62 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "fix": "manypkg fix", "lint": "pnpm run --filter \"{apps/*}\" --stream --parallel lint", "format": "pnpm run --filter \"{apps/*}\" --stream --parallel format", - "build": "pnpm run --filter \"{apps/*}\" --stream --parallel build", + "build": "pnpm run --filter \"{packages/*}\" --stream --parallel build", "start:prod": "node dist/main", "upgrade:tamagui": "pnpm up '*tamagui*'@latest '@tamagui/*'@latest react-native-web-lite@latest", "check-deps": "check-dependency-version-consistency ." diff --git a/packages/shortcuts-generator/.gitignore b/packages/shortcuts-generator/.gitignore new file mode 100644 index 0000000..c795b05 --- /dev/null +++ b/packages/shortcuts-generator/.gitignore @@ -0,0 +1 @@ +build \ No newline at end of file diff --git a/packages/shortcuts-generator/package.json b/packages/shortcuts-generator/package.json new file mode 100644 index 0000000..7d40133 --- /dev/null +++ b/packages/shortcuts-generator/package.json @@ -0,0 +1,19 @@ +{ + "name": "@acme/shortcuts-generator", + "version": "1.0.0", + "description": "Generates shortcuts", + "main": "build/src/index.js", + "types": "build/src/index.d.ts", + "scripts": { + "build": "rm -rf build && tsc", + "clean": "rm -rf .turbo node_modules", + "format": "prettier --check \"**/*.{mjs,ts,md,json}\"", + "typecheck": "tsc --noEmit" + }, + "devDependencies": { + "@acme/prettier-config": "^0.1.0", + "@acme/tsconfig": "^0.1.0", + "typescript": "^5.3.3" + }, + "prettier": "@acme/prettier-config" +} diff --git a/packages/shortcuts-generator/src/index.ts b/packages/shortcuts-generator/src/index.ts new file mode 100644 index 0000000..b123d13 --- /dev/null +++ b/packages/shortcuts-generator/src/index.ts @@ -0,0 +1,4 @@ +import apps from "../../../public/apps.json"; + +export { apps }; +// generate the shortcuts for the apps diff --git a/packages/shortcuts-generator/tsconfig.json b/packages/shortcuts-generator/tsconfig.json new file mode 100644 index 0000000..b5fdc60 --- /dev/null +++ b/packages/shortcuts-generator/tsconfig.json @@ -0,0 +1,20 @@ +{ + "exclude": ["lib/**/*.spec.tsx", "lib/**/*.stories.tsx", "lib/**/*.styles.tsx", "build/**/*"], + "compilerOptions": { + "skipLibCheck": true, + "target": "es6", + "module": "es6", + "lib": ["es6", "dom"], + "jsx": "react", + "resolveJsonModule": true, + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "outDir": "build", + "rootDirs": ["src"], + "strict": true, + "moduleResolution": "node", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/packages/target-plugin/.gitignore b/packages/target-plugin/.gitignore index 9581f1d..c795b05 100644 --- a/packages/target-plugin/.gitignore +++ b/packages/target-plugin/.gitignore @@ -1 +1 @@ -./build \ No newline at end of file +build \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index be65536..0d42954 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,6 +39,9 @@ importers: '@acme/expo-exit-app': specifier: ^0.1.0 version: link:../../packages/expo-exit-app + '@acme/shortcuts': + specifier: ^1.0.0 + version: link:../../packages/shortcuts '@acme/target-plugin': specifier: ^0.1.0 version: link:../../packages/target-plugin @@ -332,6 +335,18 @@ importers: specifier: ^5.3.3 version: 5.3.3 + packages/shortcuts: + devDependencies: + '@acme/prettier-config': + specifier: ^0.1.0 + version: link:../prettier-config + '@acme/tsconfig': + specifier: ^0.1.0 + version: link:../tsconfig + typescript: + specifier: ^5.3.3 + version: 5.3.3 + packages/target-plugin: dependencies: expo: diff --git a/public/apps.json b/public/apps.json new file mode 100644 index 0000000..97074eb --- /dev/null +++ b/public/apps.json @@ -0,0 +1,122 @@ +[ + { + "key": "instagram", + "name": "Instagram", + "scheme": "instagram://" + }, + { + "key": "facebook", + "name": "Facebook", + "scheme": "fb://" + }, + { + "key": "twitter", + "name": "Twitter", + "scheme": "twitter://" + }, + { + "key": "snapchat", + "name": "Snapchat", + "scheme": "snapchat://" + }, + { + "key": "linkedin", + "name": "LinkedIn", + "scheme": "linkedin://" + }, + { + "key": "pinterest", + "name": "Pinterest", + "scheme": "pinterest://" + }, + { + "key": "youtube", + "name": "YouTube", + "scheme": "youtube://" + }, + { + "key": "whatsapp", + "name": "WhatsApp", + "scheme": "whatsapp://" + }, + { + "key": "tiktok", + "name": "TikTok", + "scheme": "tiktok://" + }, + { + "key": "spotify", + "name": "Spotify", + "scheme": "spotify://" + }, + { + "key": "twitch", + "name": "Twitch", + "scheme": "twitch://" + }, + { + "key": "reddit", + "name": "Reddit", + "scheme": "reddit://" + }, + { + "key": "telegram", + "name": "Telegram", + "scheme": "telegram://" + }, + { + "key": "discord", + "name": "Discord", + "scheme": "discord://" + }, + { + "key": "safari", + "name": "Safari", + "scheme": "https://google.com" + }, + { + "key": "breal", + "name": "Breal", + "scheme": "breal://" + }, + { + "key": "clashroyale", + "name": "Clash Royale", + "scheme": "clashroyale://" + }, + { + "key": "clashofclans", + "name": "Clash of Clans", + "scheme": "clashofclans://" + }, + { + "key": "netflix", + "name": "Netflix", + "scheme": "netflix://" + }, + { + "key": "tinder", + "name": "Tinder", + "scheme": "tinder://" + }, + { + "key": "candycrushsaga", + "name": "Candy Crush Saga", + "scheme": "candycrushsaga://" + }, + { + "key": "disney+", + "name": "Disney+", + "scheme": "disney+://" + }, + { + "key": "outlook", + "name": "Outlook", + "scheme": "ms-outlook://" + }, + { + "key": "mastodon", + "name": "Mastodon", + "scheme": "mastodon://" + } +] diff --git a/public/shortcut.template.plist b/public/shortcut.template.plist new file mode 100644 index 0000000..88a4e03 --- /dev/null +++ b/public/shortcut.template.plist @@ -0,0 +1,154 @@ + + + + + WFQuickActionSurfaces + + WFWorkflowActions + + + WFWorkflowActionIdentifier + com.lukesthl.digitalbreak.DigitalBreak + WFWorkflowActionParameters + + AppIntentDescriptor + + AppIntentIdentifier + DigitalBreak + BundleIdentifier + com.lukesthl.digitalbreak + Name + digitalbreak + TeamIdentifier + 3X5J8LXMDM + + OpenWhenRun + + UUID + 63E357CB-003D-4D34-B5A8-2C4EC6D73D81 + appPrompt + Instagram + + + + WFWorkflowActionIdentifier + is.workflow.actions.conditional + WFWorkflowActionParameters + + GroupingIdentifier + 4F582243-164B-4BBE-8DF0-AA8CF6C7B5B5 + WFCondition + 4 + WFControlFlowMode + 0 + WFInput + + Type + Variable + Variable + + Value + + OutputName + Activate Digital Break when an app opens + OutputUUID + 63E357CB-003D-4D34-B5A8-2C4EC6D73D81 + Type + ActionOutput + + WFSerializationType + WFTextTokenAttachment + + + + + + WFWorkflowActionIdentifier + com.lukesthl.digitalbreak.OpenAppIntent + WFWorkflowActionParameters + + AppIntentDescriptor + + AppIntentIdentifier + OpenAppIntent + BundleIdentifier + com.lukesthl.digitalbreak + Name + digitalbreak + TeamIdentifier + 3X5J8LXMDM + + UUID + C2634DF8-0CFC-400F-B39E-47AFB2A7EB59 + + + + WFWorkflowActionIdentifier + is.workflow.actions.conditional + WFWorkflowActionParameters + + GroupingIdentifier + 4F582243-164B-4BBE-8DF0-AA8CF6C7B5B5 + WFControlFlowMode + 1 + + + + WFWorkflowActionIdentifier + is.workflow.actions.conditional + WFWorkflowActionParameters + + GroupingIdentifier + 4F582243-164B-4BBE-8DF0-AA8CF6C7B5B5 + WFControlFlowMode + 2 + + + + WFWorkflowClientVersion + 2106.0.3 + WFWorkflowHasOutputFallback + + WFWorkflowHasShortcutInputVariables + + WFWorkflowIcon + + WFWorkflowIconGlyphNumber + 61456 + WFWorkflowIconStartColor + 946986751 + + WFWorkflowImportQuestions + + WFWorkflowInputContentItemClasses + + WFAppContentItem + WFAppStoreAppContentItem + WFArticleContentItem + WFContactContentItem + WFDateContentItem + WFEmailAddressContentItem + WFFolderContentItem + WFGenericFileContentItem + WFImageContentItem + WFiTunesProductContentItem + WFLocationContentItem + WFDCMapsLinkContentItem + WFAVAssetContentItem + WFPDFContentItem + WFPhoneNumberContentItem + WFRichTextContentItem + WFSafariWebPageContentItem + WFStringContentItem + WFURLContentItem + + WFWorkflowMinimumClientVersion + 900 + WFWorkflowMinimumClientVersionString + 900 + WFWorkflowOutputContentItemClasses + + WFWorkflowTypes + + +