diff --git a/android-app/capacitor-bridge.js b/android-app/capacitor-bridge.js index 0f284e3..d86f4ba 100644 --- a/android-app/capacitor-bridge.js +++ b/android-app/capacitor-bridge.js @@ -1,5 +1,4 @@ import { Preferences } from '@capacitor/preferences'; -import { Http } from '@capacitor/http'; const BACKEND_BASE_URL = window.BACKEND_BASE_URL || 'https://api.example.com'; @@ -17,20 +16,19 @@ export async function syncApp(appId) { const appData = JSON.parse(value); - const response = await Http.request({ + const response = await fetch(`${BACKEND_BASE_URL}/desktop/apps/sync`, { method: 'POST', - url: `${BACKEND_BASE_URL}/desktop/apps/sync`, headers: { 'Content-Type': 'application/json', }, - data: appData, + body: JSON.stringify(appData), }); - if (response.status < 200 || response.status >= 300) { + if (!response.ok) { throw new Error(`Sync failed: ${response.status}`); } - return response.data; + return response.json(); } export async function runOpencodeTask(appId, taskName, args = []) { diff --git a/android-app/capacitor.config.json b/android-app/capacitor.config.json index 6341428..97a045e 100644 --- a/android-app/capacitor.config.json +++ b/android-app/capacitor.config.json @@ -6,7 +6,7 @@ "androidScheme": "https" }, "plugins": { - "Http": { + "CapacitorHttp": { "enabled": true }, "Preferences": { diff --git a/android-app/package.json b/android-app/package.json index 3a57e82..fec5aff 100644 --- a/android-app/package.json +++ b/android-app/package.json @@ -14,8 +14,7 @@ "dependencies": { "@capacitor/android": "^5.6.0", "@capacitor/core": "^5.6.0", - "@capacitor/preferences": "^5.0.7", - "@capacitor/http": "^5.0.7" + "@capacitor/preferences": "^5.0.7" }, "devDependencies": { "@capacitor/cli": "^5.6.0",