|
| 1 | +--- |
| 2 | +layout: doc |
| 3 | +--- |
| 4 | + |
| 5 | +<script setup lang="ts"> |
| 6 | +import { ref, computed } from 'vue'; |
| 7 | +import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue'; |
| 8 | +import { |
| 9 | + addString, |
| 10 | + copyToClipboard, |
| 11 | + downloadUrl, |
| 12 | + pasteFromClipboard, |
| 13 | + showDownloadUi, |
| 14 | +} from 'protocol-launcher/yoink-ios'; |
| 15 | +import { SelectInstallationMethod } from '../../.vitepress/components'; |
| 16 | +import { |
| 17 | + addStringParams, |
| 18 | + copyToClipboardParams, |
| 19 | + downloadUrlParams, |
| 20 | + pasteFromClipboardParams, |
| 21 | +} from '../../.vitepress/constants/yoink-ios'; |
| 22 | + |
| 23 | +const currentMethod = ref('On-Demand'); |
| 24 | +const importPath = computed(() => currentMethod.value === 'On-Demand' ? 'protocol-launcher/yoink-ios' : 'protocol-launcher'); |
| 25 | +</script> |
| 26 | + |
| 27 | +# Yoink for iOS |
| 28 | + |
| 29 | +[Yoink for iPad and iPhone](https://eternalstorms.at/yoink/ios/) is a shelf app for collecting files and snippets on iPad and iPhone. **Protocol Launcher** allows you to generate official Yoink for iOS URL scheme actions. |
| 30 | + |
| 31 | +## Usage |
| 32 | + |
| 33 | +There are two ways to use this library: |
| 34 | + |
| 35 | +- On-Demand import from subpaths enables tree-shaking and keeps bundles small. |
| 36 | +- Full Import from the root package is convenient but includes all app modules. |
| 37 | + |
| 38 | +Pick On-Demand for production builds; Full Import is fine for quick scripts or demos. |
| 39 | + |
| 40 | +<SelectInstallationMethod v-model="currentMethod" /> |
| 41 | + |
| 42 | +## Notes |
| 43 | + |
| 44 | +This module only wraps the URL scheme actions documented in Yoink for iPad and iPhone Usage Tips: `pastefromclipboard`, `copytoclipboard`, `showdownloadui`, `downloadurl`, and `addstring`. |
| 45 | + |
| 46 | +The official page documents `x-success` and `x-error` callback parameters for the scheme. `showdownloadui` does not accept callbacks because Yoink states that this action does not call back to the calling app. |
| 47 | + |
| 48 | +The official page shows its generic format as `yoink://[action]...`, while every concrete action example uses `yoinkios://...`; this module follows those concrete action examples. |
| 49 | + |
| 50 | +## URL Methods |
| 51 | + |
| 52 | +### Paste From Clipboard |
| 53 | + |
| 54 | +Paste the current clipboard contents into Yoink. |
| 55 | + |
| 56 | +```ts-vue [{{currentMethod}}] |
| 57 | +import { {{ currentMethod === 'On-Demand' ? 'pasteFromClipboard' : 'yoinkIos' }} } from '{{ importPath }}' |
| 58 | +
|
| 59 | +const url = {{currentMethod === 'On-Demand' ? '' : 'yoinkIos.'}}pasteFromClipboard({ |
| 60 | + title: 'My Title', |
| 61 | + createStack: 0, |
| 62 | +}) |
| 63 | +``` |
| 64 | + |
| 65 | +<div class="flex justify-center"> |
| 66 | + <VPLink :href="pasteFromClipboard(pasteFromClipboardParams)" target="_self"> |
| 67 | + Paste Clipboard Into Yoink |
| 68 | + </VPLink> |
| 69 | +</div> |
| 70 | + |
| 71 | +### Copy To Clipboard |
| 72 | + |
| 73 | +Copy an item from Yoink to the clipboard by index. In Yoink, `0` is the topmost item. |
| 74 | + |
| 75 | +```ts-vue [{{currentMethod}}] |
| 76 | +import { {{ currentMethod === 'On-Demand' ? 'copyToClipboard' : 'yoinkIos' }} } from '{{ importPath }}' |
| 77 | +
|
| 78 | +const url = {{currentMethod === 'On-Demand' ? '' : 'yoinkIos.'}}copyToClipboard({ |
| 79 | + index: 0, |
| 80 | +}) |
| 81 | +``` |
| 82 | + |
| 83 | +<div class="flex justify-center"> |
| 84 | + <VPLink :href="copyToClipboard(copyToClipboardParams)" target="_self"> |
| 85 | + Copy First Yoink Item |
| 86 | + </VPLink> |
| 87 | +</div> |
| 88 | + |
| 89 | +### Show Download UI |
| 90 | + |
| 91 | +Show Yoink's download UI. |
| 92 | + |
| 93 | +```ts-vue [{{currentMethod}}] |
| 94 | +import { {{ currentMethod === 'On-Demand' ? 'showDownloadUi' : 'yoinkIos' }} } from '{{ importPath }}' |
| 95 | +
|
| 96 | +const url = {{currentMethod === 'On-Demand' ? '' : 'yoinkIos.'}}showDownloadUi() |
| 97 | +``` |
| 98 | + |
| 99 | +<div class="flex justify-center"> |
| 100 | + <VPLink :href="showDownloadUi()" target="_self"> |
| 101 | + Show Yoink Download UI |
| 102 | + </VPLink> |
| 103 | +</div> |
| 104 | + |
| 105 | +### Download URL |
| 106 | + |
| 107 | +Download a URL in Yoink. |
| 108 | + |
| 109 | +```ts-vue [{{currentMethod}}] |
| 110 | +import { {{ currentMethod === 'On-Demand' ? 'downloadUrl' : 'yoinkIos' }} } from '{{ importPath }}' |
| 111 | +
|
| 112 | +const url = {{currentMethod === 'On-Demand' ? '' : 'yoinkIos.'}}downloadUrl({ |
| 113 | + url: 'https://eternalstorms.at/yoink/Yoink.zip', |
| 114 | +}) |
| 115 | +``` |
| 116 | + |
| 117 | +<div class="flex justify-center"> |
| 118 | + <VPLink :href="downloadUrl(downloadUrlParams)" target="_self"> |
| 119 | + Download URL in Yoink |
| 120 | + </VPLink> |
| 121 | +</div> |
| 122 | + |
| 123 | +### Add String |
| 124 | + |
| 125 | +Save a string in Yoink. |
| 126 | + |
| 127 | +```ts-vue [{{currentMethod}}] |
| 128 | +import { {{ currentMethod === 'On-Demand' ? 'addString' : 'yoinkIos' }} } from '{{ importPath }}' |
| 129 | +
|
| 130 | +const url = {{currentMethod === 'On-Demand' ? '' : 'yoinkIos.'}}addString({ |
| 131 | + string: 'Yoink is available on\u0002iOS and macOS', |
| 132 | + title: 'Yoink Availability', |
| 133 | +}) |
| 134 | +``` |
| 135 | + |
| 136 | +<div class="flex justify-center"> |
| 137 | + <VPLink :href="addString(addStringParams)" target="_self"> |
| 138 | + Add String to Yoink |
| 139 | + </VPLink> |
| 140 | +</div> |
| 141 | + |
| 142 | +## Generated URLs |
| 143 | + |
| 144 | +```ts |
| 145 | +pasteFromClipboard(pasteFromClipboardParams) |
| 146 | +// => 'yoinkios://pastefromclipboard?title=My%20Title&createStack=0' |
| 147 | + |
| 148 | +copyToClipboard(copyToClipboardParams) |
| 149 | +// => 'yoinkios://copytoclipboard?index=0' |
| 150 | + |
| 151 | +showDownloadUi() |
| 152 | +// => 'yoinkios://showdownloadui' |
| 153 | + |
| 154 | +downloadUrl(downloadUrlParams) |
| 155 | +// => 'yoinkios://downloadurl?url=https%3A%2F%2Feternalstorms.at%2Fyoink%2FYoink.zip' |
| 156 | + |
| 157 | +addString(addStringParams) |
| 158 | +// => 'yoinkios://addstring?string=Yoink%20is%20available%20on%02iOS%20and%20macOS&title=Yoink%20Availability' |
| 159 | +``` |
| 160 | + |
| 161 | +## Official Documentation |
| 162 | + |
| 163 | +- [Yoink for iPad and iPhone Usage Tips](https://eternalstorms.at/yoink/ios/tips/) |
0 commit comments