Skip to content

Commit

Permalink
1.0.51
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwynr committed Aug 23, 2021
1 parent a612110 commit e1d1969
Show file tree
Hide file tree
Showing 9 changed files with 285 additions and 210 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "io.filen.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 50
versionName "1.0.50"
versionCode 51
versionName "1.0.51"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
8 changes: 4 additions & 4 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 45;
CURRENT_PROJECT_VERSION = 51;
DEVELOPMENT_TEAM = 7YTW5D2K7P;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0.45;
MARKETING_VERSION = 1.0.51;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = io.filen.app;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -370,12 +370,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 45;
CURRENT_PROJECT_VERSION = 51;
DEVELOPMENT_TEAM = 7YTW5D2K7P;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0.45;
MARKETING_VERSION = 1.0.51;
PRODUCT_BUNDLE_IDENTIFIER = io.filen.app;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = io.filen.app;
Expand Down
26 changes: 13 additions & 13 deletions ios/App/App/capacitor.config.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"appId": "io.filen.app",
"appName": "Filen",
"bundledWebRuntime": false,
"npmClient": "npm",
"webDir": "build",
"plugins": {
"SplashScreen": {
"launchShowDuration": 15000,
"launchAutoHide": false,
"showSpinner": true
}
},
"cordova": {}
"appId": "io.filen.app",
"appName": "Filen",
"bundledWebRuntime": false,
"npmClient": "npm",
"webDir": "build",
"plugins": {
"SplashScreen": {
"launchShowDuration": 15000,
"launchAutoHide": false,
"showSpinner": true
}
},
"cordova": {}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "io.filen.app",
"version": "1.0.50",
"version": "1.0.51",
"private": true,
"dependencies": {
"@capacitor/android": "^2.4.2",
Expand Down
76 changes: 52 additions & 24 deletions src/components/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ export async function downloadFileChunk(file, index, tries, maxTries, callback,
if(!isPreview){
window.customVariables.downloadChunkSemaphore.release()
}

if(typeof window.customVariables.stoppedDownloads[file.uuid] !== "undefined"){
return callback("stopped")
}

return callback(null, index, decrypted)
})
Expand Down Expand Up @@ -438,19 +442,19 @@ export async function writeChunkToFile(file, dirObj, uuid, index, data, callback
if(!window.customVariables.downloads[uuid]){
window.customVariables.currentWriteThreads -= 1

return callback(new Error("Download does not exist"))
return false
}

if(window.customVariables.downloads[uuid].nextWriteChunk !== index){
return setTimeout(() => {
this.writeChunkToFile(file, dirObj, uuid, index, data, callback)
}, 10)
}, 5)
}

if(typeof window.customVariables.stoppedDownloads[uuid] !== "undefined"){
window.customVariables.currentWriteThreads -= 1

return callback("stopped")
return false
}

if(index == 0){
Expand Down Expand Up @@ -535,8 +539,8 @@ export async function queueFileDownload(file, isOfflineRequest = false){
let makeOffline = false
let fileName = file.name

window.customVariables.stoppedDownloads[uuid] = undefined
window.customVariables.stoppedDownloadsDone[uuid] = undefined
delete window.customVariables.stoppedDownloads[uuid]
delete window.customVariables.stoppedDownloadsDone[uuid]

if(isOfflineRequest){
if(typeof window.customVariables.offlineSavedFiles[file.uuid] !== "undefined"){
Expand All @@ -554,7 +558,16 @@ export async function queueFileDownload(file, isOfflineRequest = false){
return this.spawnToast(language.get(this.state.lang, "couldNotGetDownloadDir"))
}

let isRemovedFromState = false
let isAddedToState = false

const addToState = () => {
if(isAddedToState){
return false
}

isAddedToState = true

let currentDownloads = this.state.downloads

currentDownloads[uuid] = {
Expand Down Expand Up @@ -588,19 +601,34 @@ export async function queueFileDownload(file, isOfflineRequest = false){
return this.setState({
downloads: currentDownloads,
downloadsCount: (this.state.downloadsCount + 1)
})
}, () => {
this.forceUpdate()
})
}

const removeFromState = () => {
let currentDownloads = this.state.downloads
if(isRemovedFromState){
return false
}

delete currentDownloads[uuid]
delete window.customVariables.downloads[uuid]
isRemovedFromState = true

return this.setState({
downloads: currentDownloads,
downloadsCount: (this.state.downloadsCount - 1)
})
try{
let currentDownloads = this.state.downloads

delete currentDownloads[uuid]
delete window.customVariables.downloads[uuid]

return this.setState({
downloads: currentDownloads,
downloadsCount: (this.state.downloadsCount - 1)
}, () => {
this.forceUpdate()
})
}
catch(e){
console.log(e)
}
}

const setProgress = (progress) => {
Expand Down Expand Up @@ -630,7 +658,9 @@ export async function queueFileDownload(file, isOfflineRequest = false){

return this.setState({
downloads: currentDownloads
})
}, () => {
this.forceUpdate()
})
}
catch(e){
return console.log(e)
Expand Down Expand Up @@ -664,7 +694,9 @@ export async function queueFileDownload(file, isOfflineRequest = false){

return this.setState({
downloads: currentDownloads
})
}, () => {
this.forceUpdate()
})
}
catch(e){
return console.log(e)
Expand All @@ -688,11 +720,12 @@ export async function queueFileDownload(file, isOfflineRequest = false){

if(thisIndex < file.chunks && typeof window.customVariables.downloads[uuid] !== "undefined"){
this.downloadFileChunk(file, thisIndex, 0, 128, async (err, downloadIndex, downloadData) => {
window.customVariables.currentDownloadThreads -= 1

if(err){
console.log(err)

window.customVariables.downloadSemaphore.release()
window.customVariables.currentDownloadThreads -= 1
window.customVariables.currentWriteThreads -= 1

removeFromState()
Expand Down Expand Up @@ -731,7 +764,6 @@ export async function queueFileDownload(file, isOfflineRequest = false){
console.log(err)

window.customVariables.downloadSemaphore.release()
window.customVariables.currentDownloadThreads -= 1

removeFromState()

Expand Down Expand Up @@ -760,6 +792,8 @@ export async function queueFileDownload(file, isOfflineRequest = false){

try{
if(window.customVariables.downloads[uuid].chunksWritten >= window.customVariables.downloads[uuid].chunks){
window.customVariables.downloadSemaphore.release()

if(window.customVariables.downloads[uuid].makeOffline){
window.customVariables.offlineSavedFiles[file.uuid] = true

Expand Down Expand Up @@ -793,18 +827,12 @@ export async function queueFileDownload(file, isOfflineRequest = false){
removeFromState()

window.customFunctions.saveOfflineSavedFiles()

window.customVariables.downloadSemaphore.release()
window.customVariables.currentDownloadThreads -= 1

return this.forceUpdate()
}
else{
this.spawnToast(language.get(this.state.lang, "fileDownloadDone", true, ["__NAME__"], [file.name]))

window.customVariables.downloadSemaphore.release()
window.customVariables.currentDownloadThreads -= 1

return removeFromState()
}
}
Expand Down Expand Up @@ -1117,7 +1145,7 @@ export async function downloadPreview(file, progressCallback, callback, maxChunk
else{
return setTimeout(() => {
write(index, data, callback)
}, 25)
}, 5)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/items.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export async function updateItemList(showLoader = true, bypassItemsCache = false
type: "folder",
uuid: "default",
name: "Default",
date: language.get(this.state.lang, "defaultFolder"),
date: language.get(this.state.lang, "defaultDrive"),
timestamp: (((+new Date()) / 1000) - (86400 * 3650)),
parent: "base",
receiverId: 0,
Expand Down
6 changes: 1 addition & 5 deletions src/components/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,6 @@ export function render(){
{
this.state.uploads[key].progress < 100 && (
<IonBadge color="danger" slot="end" onClick={() => {
delete window.customVariables.uploads[this.state.uploads[key].uuid]

return window.customVariables.stoppedUploads[this.state.uploads[key].uuid] = true
}}>
{language.get(this.state.lang, "transferStop")}
Expand All @@ -550,9 +548,7 @@ export function render(){
</IonBadge>
{
this.state.downloads[key].progress < 100 && (
<IonBadge color="danger" slot="end" onClick={() => {
delete window.customVariables.downloads[this.state.downloads[key].uuid]

<IonBadge color="danger" slot="end" onClick={() => {
return window.customVariables.stoppedDownloads[this.state.downloads[key].uuid] = true
}}>
{language.get(this.state.lang, "transferStop")}
Expand Down
Loading

0 comments on commit e1d1969

Please sign in to comment.