序文
When you start to enjoy the update system of Capgo, like me for my apps, you will start to get the feeling “What if I want more?”
私も同じ気持ちでしたが、Capgoの製作者として、機能を確認することができました。
すべてがオープンソースなので、同じ力を持ちます。
The next pain I got in the Capacitor app distribution process is to make other teammates test the updates!
TestFlightでは、問題は簡単だ。チームに人を呼び、アップデートを取得する方法を理解させるのは時間がかかる!
アップデートをAppleに送ると、BOTによるランダムレビューが毎回行われる。5分か5時間か、わからない。
この問題で、プレゼンテーションが遅延することが何度もあった。
Googleの場合、さらに悪化する。私の生涯の謎は、プロダクションバージョンのリリースは2時間以内に完了するが、クローズバータのリリースは1-2日かかる。
解決策
To fix this, I crated the Channel system in Capgo.
npx @capgo/cli@latest bundle upload -c production すべてのユーザーにアップデートを送信します (プロダクションチャネルがデフォルトに設定されている場合)
もし npx @capgo/cli@latest bundle upload -c development すると、バージョンは異なるチャネルに到着します。このプロセスはCapgoのアクションで自動化できます。 GitHub action.
__CAPGO_KEEP_0__
スーパー自動方法
使用する場合、チャンネルセット用のバックエンドを作成する必要がなく、実装が速い
その場合、チャンネルを自分自身で設定するだけです

そして、Ionicsアプリのcodeに追加してください。最良の体験を得るには、ユーザーが「ベータ登録」ボタンをクリックした後で使用することをお勧めします
import { CapacitorUpdater } from '@capgo/capacitor-updater'
const deviceId = await CapacitorUpdater.setChannel({ channel: 'beta' })
手動方法
This can be useful for your internal team, this is fast to implement. Allow users to copy their deviceID from your app and send it to you manually, this code will help you to get it:
import { CapacitorUpdater } from '@capgo/capacitor-updater'
const deviceId = await CapacitorUpdater.getDeviceId()
ユーザーがアプリからデバイスIDをコピーし、自分で送信するように許可する admin __CAPGO_KEEP_0__は、デバイスIDを取得するのに役立ちます
Then Go to the Web app or native app Capgo, connect as app admin, select your app, click on the device list.
例えば developmentWebアプリまたはネイティブアプリの__CAPGO_KEEP_0__にアクセスし、アプリ管理者としてログインし、アプリを選択し、デバイスリストをクリックします。
彼はあなたのバージョンを受け取るはずです。
自動化された方法
この方法は、ベータテスター向けに便利ですが、実装には時間がかかります。
この方法は、手動の方法と同じです。デバイスIDを取得する必要があります。
import { CapacitorUpdater } from '@capgo/capacitor-updater'
const deviceId = await CapacitorUpdater.getDeviceId()
この回数は、自動的にあなたのバックエンドに送信する必要があります。実装方法はあなたに任せます。
データベースに保存することをお勧めします。後で役に立つでしょう。
あなたのバックエンドでは、Capgo バックエンドにも送信する必要があります。以下の2つのcode例があります。
Node.js
import axios from 'axios'
await axios.post('https://api.capgo.app/device', {
app_id: 'YOUR_APP_ID',
device_id: 'DEVICE_ID',
channel: 'CHANNEL_NAME', // The name of the channel, or undefined if version_id provided
version_id: 'VERSION_NAME' // this is optional, if provide it will override the channel, that useful when you want to debug only one user.
}, {
headers: {
authorization: 'YOUR_API_KEY' // choose a key with 'write' or 'all' rights
}
})
Cloudflare
addEventListener('fetch', (event) => {
event.respondWith(
handleRequest(event.request).catch(
err => new Response(err.stack, { status: 500 })
)
)
})
async function handleRequest(request) {
const { pathname, method } = new URL(request.url)
const body = await request.json()
const newBody = JSON.stringify({
app_id: 'YOUR_APP_ID',
device_id: body.device_id,
channel: 'alpha'
})
const newUrl = new URL('https://api.capgo.app/device')
const options = {
headers: {
authorization: 'YOUR_API_KEY',
},
method: 'POST',
body: newBody
}
if (request.method === 'DELETE') {
// DELETE the channel link
options.method = 'DELETE'
return fetch(newUrl.toString(), options)
}
return fetch(newUrl.toString(), options)
}
そして、デバイスIDを本文に含めて、URLにPOSTで送信し、追加と削除のメソッドを使用して削除してください。
この設定が完了したら、アプリにオプトインのボタンを追加し、Webアプリで設定が有効かどうかを確認してください。
また、 null to remove override
If you need to check programmatically what override is set on a device, you can get on the same URL
import axios from 'axios'
const res = await axios.get('https://api.capgo.app/device?app_id=YOUR_APP_ID&device_id=DEVICE_ID', {
headers: {
authorization: 'YOUR_API_KEY' // choose a key with 'write' or 'all' rights
}
})
console.log('data', res.json())
Keep going from How to send specific update to one user or a group
If you are using How to send specific update to one user or a group to plan channel routing and staged rollout, connect it with Channels for the implementation detail in Channels, Channels for the implementation detail in Channels, Channels for the implementation detail in Channels, Beta Testing Solution Beta Testing Solutionの製品ワークフロー Version Targeting Solution Version Targeting Solutionの製品ワークフロー