Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions hooks/post-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ deleteDirRecursively(resPath, [
'xml',
]);
copyDirRecursively(localResPath, resPath);
enableLegacyJni()
enableStaticContext()
patchTargetSdkVersion()
enableLegacyJni();
enableStaticContext();
patchTargetSdkVersion();


function patchTargetSdkVersion() {
Expand All @@ -48,19 +48,19 @@ function patchTargetSdkVersion() {
const sdkRegex = /targetSdkVersion\s+(cordovaConfig\.SDK_VERSION|\d+)/;

if (sdkRegex.test(content)) {
let api = "35"
let api = "35";
const froidFlag = path.join(prefix, 'fdroid.bool');
if(fs.existsSync(froidFlag)){

if (fs.existsSync(froidFlag)) {
const fdroid = fs.readFileSync(froidFlag, 'utf-8').trim();
if(fdroid == "true"){
api = "28"
if (fdroid == "true") {
api = "28";
}
}
content = content.replace(sdkRegex, 'targetSdkVersion '+api);

content = content.replace(sdkRegex, 'targetSdkVersion ' + api);
fs.writeFileSync(gradleFile, content, 'utf-8');
console.log('[Cordova Hook] ✅ Patched targetSdkVersion to '+api);
console.log('[Cordova Hook] ✅ Patched targetSdkVersion to ' + api);
} else {
console.warn('[Cordova Hook] ⚠️ targetSdkVersion not found');
}
Expand Down
101 changes: 45 additions & 56 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@

<script>
(function () {
var color = localStorage.getItem("__primary_color");
var __bg_color = "#20202c";
if (color) {
__bg_color = color;
}

document.querySelector(":root").style.cssText =
"--bg-color: " + __bg_color;

var __testEl = document.createElement("div");
var __testChildEl = document.createElement("div");
if (__testEl.append) {
Expand All @@ -30,54 +39,50 @@
this.appendChild(docFrag);
};
}
})();

function startsWith(string, needle) {
return string.indexOf(needle) === 0;
// save all touch events added by ace editor so it can be use in src/ade/touchHandler.js
var __oldAddEventListener = HTMLElement.prototype.addEventListener;
HTMLElement.prototype.addEventListener = function (
type,
listener,
useCapture,
allowed,
) {
if (typeof useCapture === "boolean") {
allowed = useCapture;
useCapture = undefined;
}

// save all touch events added by ace editor so it can be use in src/ade/touchHandler.js
var __oldAddEventListener = HTMLElement.prototype.addEventListener;
HTMLElement.prototype.addEventListener = function (
type,
listener,
useCapture,
allowed,
) {
if (typeof useCapture === "boolean") {
allowed = useCapture;
useCapture = undefined;
}
if (type === "contextmenu" && !allowed) {
return;
}

if (type === "contextmenu" && !allowed) {
return;
}
if (allowed) {
__oldAddEventListener.call(this, type, listener, useCapture);
return;
}

if (allowed) {
__oldAddEventListener.call(this, type, listener, useCapture);
return;
if (
this.classList.contains("editor-container") &&
type.indexOf("touch") === 0
) {
if (!this.eventListeners) {
this.eventListeners = {};
}

if (
this.classList.contains("editor-container") &&
startsWith(type, "touch")
) {
if (!this.eventListeners) {
this.eventListeners = {};
}

if (!this.eventListeners[type]) {
this.eventListeners[type] = [];
}
this.eventListeners[type].push({
listener: listener,
useCapture: useCapture,
});

return;
if (!this.eventListeners[type]) {
this.eventListeners[type] = [];
}
__oldAddEventListener.call(this, type, listener, useCapture);
};
})();
this.eventListeners[type].push({
listener: listener,
useCapture: useCapture,
});

return;
}
__oldAddEventListener.call(this, type, listener, useCapture);
};
</script>

<script src="cordova.js"></script>
Expand All @@ -98,21 +103,6 @@
<script src="./js/ace/ext-static_highlight.js"></script>
<script src="./js/ace/ext-inline_autocomplete.js"></script>

<script>
(function () {
var color = localStorage.getItem("__primary_color");
var __bg_color = "#20202c";
if (color) {
__bg_color = color;
}

document.querySelector(":root").style.cssText =
"--bg-color: " + __bg_color;
})();
</script>

<script></script>

<style>
:root {
--test-height: 45px;
Expand Down Expand Up @@ -162,7 +152,6 @@

<script src="./build/main.js"></script>
<link rel="stylesheet" href="./build/main.css">

<title>Acode</title>
</head>

Expand Down