Skip to content

Commit

Permalink
version 1.1.14.123
Browse files Browse the repository at this point in the history
☞ Bugs fixes
☞ Latest Ace editor v1.4.12
☞ Share file
☞ UI improvement
☞ Performance improvement
  • Loading branch information
deadlyjack committed Aug 7, 2020
1 parent 0573a30 commit c466b6a
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 18 deletions.
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8' ?>
<widget id="com.foxdebug.acode" android-versionCode="122" version="1.1.14.122"
<widget id="com.foxdebug.acode" android-versionCode="123" version="1.1.14.123"
xmlns="http://www.w3.org/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
Expand Down
2 changes: 1 addition & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
plugins: [
require('autoprefixer')
require('autoprefixer')({})
]
};
1 change: 1 addition & 0 deletions src/lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default {
HEX_COLOR: /^#([a-f0-9]{3}){1,2}([a-f0-9]{2})?$/i,
RGB_COLOR: /^rgba?\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(\s*,\s*\d?(\.\d+)?)?\)$/i,
HSL_COLOR: /^hsla?\(([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(\s*,\s*\d?(\.\d+)?)?\)$/i,
EXTERNAL_STORAGE: /^file:\/\/\/storage\/([0-9a-z\-]+)/i,
DEFAULT_FILE_SESSION: "default-session",
DEFAULT_FILE_NAME: "untitled.txt",
RATING_COUNT: 15,
Expand Down
15 changes: 7 additions & 8 deletions src/lib/fileSystem/fsOperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import path from "../utils/path";
import remoteFs from "./remoteFs";
import Url from "../utils/Url";
import dialogs from "../../components/dialogs";
import constants from "../constants";

/**
*
Expand All @@ -16,12 +17,12 @@ function fsOperation(uri) {
return new Promise((resolve, reject) => {
const protocol = Url.getProtocol(uri);
if (protocol === 'file:') {

if (/file:\/\/\/storage\/emulated/.test(uri)) {
createInternalFsOperation(internalFs, uri, resolve);
} else {
const match = constants.EXTERNAL_STORAGE.exec(uri);
if (match && match[1] !== "emulated") {
convertToContentUri(uri)
.then(res => createExternalFsOperation(externalFs, res, resolve));
} else {
createInternalFsOperation(internalFs, uri, resolve);
}

} else if (protocol === "content:") {
Expand Down Expand Up @@ -223,12 +224,10 @@ function fsOperation(uri) {
* @param {String} uri
*/
async function convertToContentUri(uri) {

const regEx = /^file:\/\/\/storage\/([0-9a-z\-]+)/i;
const uuid = regEx.exec(uri)[1];
const uuid = constants.EXTERNAL_STORAGE.exec(uri)[1];
const filePath = Url.join(
`content://com.android.externalstorage.documents/tree/${uuid}%3A`,
uri.replace(regEx, "")
uri.replace(constants.EXTERNAL_STORAGE, "")
);

const canWrite = await (() => new Promise((resolve, reject) => {
Expand Down
21 changes: 21 additions & 0 deletions src/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import Url from "./utils/Url";
import backupRestore from "../pages/settings/backup-restore";
import applySettings from "./applySettings";
import fsOperation from "./fileSystem/fsOperation";
import ajax from "./utils/ajax";
//@ts-check

loadPolyFill.apply(window);
Expand All @@ -61,6 +62,26 @@ function Main() {
lang = language;
}

ajax({
url: "https://acode.foxdebug.com/api/getad",
responseType: "json"
})
.then(res => {
window.ad = res;
if (res.image) {
return ajax({
url: res.image,
responseType: 'arraybuffer'
});
} else {
return Promise.resolve(res);
}
})
.then(res => {
if (res instanceof ArrayBuffer)
ad.image = URL.createObjectURL(new Blob([res]));
});

window.root = tag(window.root);
window.app = document.body = tag(document.body);
window.actionStack = ActionStack();
Expand Down
23 changes: 19 additions & 4 deletions src/pages/settings/mainSettings.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import tag from 'html-tag-js';
import mustache from 'mustache';

import Page from "../../components/page";
import dialogs from "../../components/dialogs";
import tag from 'html-tag-js';
import gen from "../../components/gen";
import About from "../about/about";
import editorSettings from "./editorSettings";
Expand All @@ -11,10 +13,12 @@ import internalFs from "../../lib/fileSystem/internalFs";
import backupRestore from "./backup-restore";
import themeSetting from "../themeSetting/themeSetting";

import $_ad from '../../views/ad.hbs';

export default function settingsMain(demo) {
const value = appSettings.value;
const $page = Page(strings.settings);
const settingsList = tag('div', {
const $settingsList = tag('div', {
className: 'main list',
style: {
textTransform: "capitalize"
Expand Down Expand Up @@ -82,7 +86,7 @@ export default function settingsMain(demo) {
});
}

gen.listItems(settingsList, settingsOptions, changeSetting);
gen.listItems($settingsList, settingsOptions, changeSetting);

function changeSetting() {
const lanuguages = [];
Expand Down Expand Up @@ -156,6 +160,17 @@ export default function settingsMain(demo) {
}
}

$page.appendChild(settingsList);
$page.appendChild($settingsList);
if (window.ad && !localStorage.hideAd) {
const $ad = tag.parse(mustache.render($_ad, window.ad));
$ad.onclick = function (e) {
const action = e.target.getAttribute("action");
if (action === "close") {
this.remove();
localStorage.hideAd = true;
}
};
$settingsList.append($ad);
}
document.body.append($page);
}
73 changes: 72 additions & 1 deletion src/styles/main.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
* {
margin: 0;
padding: 0;
font-family: "Roboto", sans-serif;

&:focus {
outline: none;
Expand All @@ -19,6 +18,9 @@ body {
}

body {
user-select: none;
font-family: "Roboto", sans-serif;
-webkit-tap-highlight-color: transparent;
background-color: #9999ff;
background-color: var(--primary-color);
color: #252525;
Expand Down Expand Up @@ -105,6 +107,75 @@ a {
}
}

#ad {
border-radius: 4px;
background-color: white;
color: #232323;
display: flex;
flex-direction: column;
width: calc(100% - 10px);
max-width: 600px;
margin: 60px auto;
box-sizing: border-box;
box-shadow: 0 0 4px 0 var(--box-shadow-color);

.heading {
margin-top: -5px;
height: 40px;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 1.4rem;

.text {
font-weight: 400;
margin: 0 10px;
}

.icon {
font-size: 1.2rem;
height: 30px;
width: 30px;
margin: 5px;
}
}

a {
text-decoration: none;
color: inherit;
}

.ad-body {
display: flex;

.image {
height: fit-content;
margin: auto;

img {
margin: 0 5px;
max-width: 100px;
border-radius: 4px;
}
}

.content {
margin-right: 5px;
display: flex;
flex-direction: column;

.title {
font-weight: 500;
}

.description {
white-space: pre-wrap;
font-size: 0.92rem;
}
}
}
}

#hints {
position: fixed;
top: 0;
Expand Down
21 changes: 21 additions & 0 deletions src/views/ad.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div id="ad">
<div class="heading">
<span class="text">A message from sponsor.</span>
<span class="icon clearclose" action="close"></span>
</div>
<a href="{{url}}">
<div class="ad-body">
{{#image}}
<div class="image"><img src="{{.}}"></div>
{{/image}}
<div class="content">
{{#title}}
<span class="title">{{.}}</span>
{{/title}}
{{#description}}
<span class="description">{{.}}</span>
{{/description}}
</div>
</div>
</a>
</div>
2 changes: 1 addition & 1 deletion updates.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version 1.1.14.121
version 1.1.14.123
☞ Bugs fixes
☞ Latest Ace editor v1.4.12
☞ Share file
Expand Down
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ module.exports = {
}
},
"css-loader?url=false",
"sass-loader",
"postcss-loader"
"postcss-loader",
"sass-loader"
]
}
]
Expand Down

0 comments on commit c466b6a

Please sign in to comment.