Skip to content

Commit 5d615f3

Browse files
feat. update plugin base url
1 parent 7ba87aa commit 5d615f3

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

src/handlers/intent.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ const handlers = [];
1010
* @param {Intent} intent
1111
*/
1212
export default async function HandleIntent(intent = {}) {
13-
const type = intent.action.split(".").slice(-1)[0];
14-
15-
if (["SEND", "VIEW", "EDIT"].includes(type)) {
13+
if (intent !== undefined && intent.action !== undefined && ["SEND", "VIEW", "EDIT"].includes(intent.action.split(".").slice(-1)[0])) {
1614
/**@type {string} */
1715
const url = intent.fileUri || intent.data;
1816
if (!url) return;

src/lib/checkFiles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default async function checkFiles() {
4747
* @returns {Promise<void>}
4848
*/
4949
async function checkFile(file) {
50-
if (file.isUnsaved || !file.loaded || file.loading) return;
50+
if (!file.loaded || file.loading || file.isUnsaved) return;
5151

5252
if (file.uri) {
5353
const fs = fsOperation(file.uri);

src/lib/loadPlugin.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,16 @@ export default async function loadPlugin(pluginId, justInstalled = false) {
8282
await fsOperation(CACHE_STORAGE).createFile(pluginId);
8383
}
8484

85-
await acode.initPlugin(pluginId, baseUrl, $page, {
86-
cacheFileUrl: await helpers.toInternalUri(cacheFile),
87-
cacheFile: fsOperation(cacheFile),
88-
firstInit: justInstalled,
89-
});
90-
91-
console.log("done xx");
85+
await acode.initPlugin(
86+
pluginId,
87+
Capacitor.convertFileSrc(baseUrl),
88+
$page,
89+
{
90+
cacheFileUrl: Capacitor.convertFileSrc(cacheFile),
91+
cacheFile: fsOperation(cacheFile),
92+
firstInit: justInstalled,
93+
},
94+
);
9295

9396
resolve();
9497
} catch (error) {

0 commit comments

Comments
 (0)