├── .npmignore ├── README.md ├── background-task.android.js ├── background-task.ios.js ├── demo ├── app │ ├── App_Resources │ │ ├── Android │ │ │ ├── AndroidManifest.xml │ │ │ ├── app.gradle │ │ │ ├── drawable-hdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-ldpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-nodpi │ │ │ │ ├── splash_screen.xml │ │ │ │ └── splashscreen.9.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ ├── values-v21 │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ └── values │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ └── iOS │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── icon-29.png │ │ │ │ ├── icon-29@2x.png │ │ │ │ ├── icon-29@3x.png │ │ │ │ ├── icon-40.png │ │ │ │ ├── icon-40@2x.png │ │ │ │ ├── icon-40@3x.png │ │ │ │ ├── icon-50.png │ │ │ │ ├── icon-50@2x.png │ │ │ │ ├── icon-57.png │ │ │ │ ├── icon-57@2x.png │ │ │ │ ├── icon-60@2x.png │ │ │ │ ├── icon-60@3x.png │ │ │ │ ├── icon-72.png │ │ │ │ ├── icon-72@2x.png │ │ │ │ ├── icon-76.png │ │ │ │ ├── icon-76@2x.png │ │ │ │ └── icon-83.5@2x.png │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.launchimage │ │ │ │ ├── Contents.json │ │ │ │ ├── Default-568h@2x.png │ │ │ │ ├── Default-667h@2x.png │ │ │ │ ├── Default-736h@3x.png │ │ │ │ ├── Default-Landscape.png │ │ │ │ ├── Default-Landscape@2x.png │ │ │ │ ├── Default-Landscape@3x.png │ │ │ │ ├── Default-Portrait.png │ │ │ │ ├── Default-Portrait@2x.png │ │ │ │ ├── Default.png │ │ │ │ └── Default@2x.png │ │ │ ├── LaunchScreen.AspectFill.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchScreen-AspectFill.png │ │ │ │ └── LaunchScreen-AspectFill@2x.png │ │ │ └── LaunchScreen.Center.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchScreen-Center.png │ │ │ │ └── LaunchScreen-Center@2x.png │ │ │ ├── Default-568h@2x.png │ │ │ ├── Default-667h@2x.png │ │ │ ├── Default-736h@3x.png │ │ │ ├── Default-Landscape-568h@2x.png │ │ │ ├── Default-Landscape-667h@2x.png │ │ │ ├── Default-Landscape.png │ │ │ ├── Default-Landscape@2x.png │ │ │ ├── Default-Landscape@3x.png │ │ │ ├── Default-Portrait.png │ │ │ ├── Default-Portrait@2x.png │ │ │ ├── Default.png │ │ │ ├── Default@2x.png │ │ │ ├── Icon-Small-50.png │ │ │ ├── Icon-Small-50@2x.png │ │ │ ├── Icon-Small.png │ │ │ ├── Icon-Small@2x.png │ │ │ ├── Info.plist │ │ │ ├── LaunchScreen.storyboard │ │ │ ├── build.xcconfig │ │ │ ├── icon-40.png │ │ │ ├── icon-40@2x.png │ │ │ ├── icon-60.png │ │ │ ├── icon-60@2x.png │ │ │ ├── icon-72.png │ │ │ ├── icon-72@2x.png │ │ │ ├── icon-76.png │ │ │ ├── icon-76@2x.png │ │ │ ├── icon.png │ │ │ └── icon@2x.png │ ├── app.css │ ├── app.js │ ├── main-page.js │ ├── main-page.xml │ ├── package.json │ └── res │ │ ├── big_buck_bunny.mp4 │ │ └── mobilemind.png └── package.json ├── index.js ├── native-src ├── android │ ├── NativescriptBackgroundTask.iml │ ├── NativescriptBackgroundTask │ │ └── .idea │ │ │ └── workspace.xml │ ├── android.iml │ ├── app │ │ ├── .gitignore │ │ ├── app.iml │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ ├── release │ │ │ └── MobileMindNSTaskPlugin.aar │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ └── br │ │ │ └── com │ │ │ └── mobilemind │ │ │ └── ns │ │ │ └── task │ │ │ ├── CompleteCallback.java │ │ │ ├── CopyFilesTask.java │ │ │ ├── DbInsertBatchTask.java │ │ │ ├── HttpPostData.java │ │ │ ├── HttpPostDataTask.java │ │ │ ├── HttpPostFileFormDataTask.java │ │ │ ├── HttpPostFileTask.java │ │ │ ├── HttpRequestToFileTask.java │ │ │ ├── LargeFilePersisterTask.java │ │ │ ├── SplitFilesTask.java │ │ │ ├── UnzipTask.java │ │ │ └── sql │ │ │ └── DBHelper.java │ ├── build.gradle │ ├── compile │ ├── gradle.properties │ ├── local.properties │ └── settings.gradle ├── ios │ ├── NSBackgroundTask.h │ ├── NSBackgroundTaskCopyFiles.m │ ├── NSBackgroundTaskHttpRequestToFile.m │ ├── NSBackgroundTaskUnzipTask.m │ └── NativeScriptBackgroundTask.podspec └── server-mock │ ├── app.js │ ├── bin │ └── www │ ├── package.json │ ├── public │ └── stylesheets │ │ └── style.css │ ├── routes │ ├── index.js │ └── users.js │ └── views │ ├── error.pug │ ├── index.pug │ └── layout.pug ├── package-lock.json ├── package.json └── platforms ├── android ├── AndroidManifest.xml ├── MobileMindNSTaskPlugin.aar └── include.gradle └── ios ├── Podfile └── headers └── module.modulemap /.npmignore: -------------------------------------------------------------------------------- 1 | # Exclude the native source code. The native libraries are included in the push-plugin as compiled resources (i.e. jar & framework) 2 | native-src/ 3 | demo/ 4 | demo_old/ 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nativescript-background-task 2 | 3 | Run background task 4 | 5 | **Attention!!** this plugin not is registered on npm. To use you should add the repository directly on your package.json: 6 | 7 | ``` 8 | dependencies: { 9 | "nativescript-background-task": "https://github.com/mobilemindtec/nativescript-background-task.git" 10 | } 11 | ``` 12 | 13 | ## Features 14 | 15 | * unzip file 16 | * download big files, supports partial/resume download 17 | * move many files 18 | * save large file 19 | * post large file base64 gzip json or form data (base64 gzip) 20 | * split large file 21 | * run sql batch (insert, update, delete) 22 | 23 | ** IOS Pod code at http://github.com/mobilemindtec/nativescript-background-task-ios-source 24 | 25 | ## Configs 26 | ### Android 27 | Add at app.gradle 28 | 29 | ``` 30 | allprojects { 31 | repositories { 32 | jcenter() 33 | mavenCentral() 34 | maven { 35 | url "https://raw.githubusercontent.com/mobilemindtec/m2/master" 36 | } 37 | } 38 | } 39 | 40 | android { 41 | useLibrary 'org.apache.http.legacy' 42 | } 43 | dependencies{ 44 | compile('br.com.mobilemind.api:mobilemind-droid-util:1.4', { 45 | exclude group: 'com.google.android', module: 'android' 46 | exclude group: 'com.google.android', module: 'support-v4' 47 | exclude group: 'br.com.mobilemind.api', module: 'mobilemind-utils' 48 | }) 49 | compile 'br.com.mobilemind.api:mobilemind-utils:1.3' 50 | } 51 | 52 | ``` 53 | ## Using 54 | 55 | ``` 56 | 57 | var BackgroundTask = require("nativescript-background-task") 58 | 59 | ``` 60 | ### Unzip file 61 | 62 | ``` 63 | BackgroundTask.unzip({ 64 | fromFile: zipFile, 65 | toFile: extractPath, 66 | doneCallback: function(){ 67 | // done 68 | }, 69 | errorCallback: function(error){ 70 | // error 71 | }, 72 | }) 73 | 74 | ``` 75 | 76 | ### Download to file 77 | 78 | if you set `checkPartialDownload: true` the plugin will test, using `HEAD` request to know if server accepts (header Accept-Ranges: bytes). If server supports, the plugin make partial download of `partBytesSize` bytes (default is 2MB). Partial download enable resume download if some part of download already done. The server can supports `HEAD` request to work. 79 | 80 | ``` 81 | BackgroundTask.getFile({ 82 | url: 'http://www.mobilemind.com.br/makeyourself/coollife/images-2.1.zip', 83 | toFile: destinationFile, 84 | identifier: 1, 85 | partBytesSize: 0, // use default 2MB 86 | checkPartialDownload: true, 87 | headers: [ 88 | { 'CustonHeader': 'Custon Value' } 89 | ], 90 | doneCallback: function(identifier){ 91 | // done 92 | }, 93 | errorCallback: function(error){ 94 | var identifier = error[0] 95 | var message = error[1] 96 | // error 97 | }, 98 | }) 99 | ``` 100 | 101 | ### Copy many files to destination directory 102 | 103 | ``` 104 | BackgroundTask.copyFiles({ 105 | fromFile: extractPath, 106 | toFile: movePath, 107 | doneCallback: function(){ 108 | // done 109 | }, 110 | errorCallback: function(){ 111 | // error 112 | }, 113 | }) 114 | ``` 115 | 116 | ### Save a or copy a large file or Image to destination. 117 | 118 | You can set Image or file source 119 | 120 | ``` 121 | var files = [] 122 | files.push({ 123 | image: image, // to save android Bitmap, ios UIImage or nativescript Image 124 | fileDst: fileDst, // destination file path 125 | fileSrc: doc.fileSrc, // to pdf or another doc.. copy to destination 126 | quality: 30 // quality if is bitmap 127 | }) 128 | BackgroundTask.saveLargeFiles({ 129 | files: files 130 | doneCallback: function(){ 131 | // done 132 | }, 133 | errorCallback: function(error){ 134 | // error 135 | } 136 | }) 137 | 138 | ``` 139 | 140 | ### Post files 141 | 142 | Post a file using json format or form data. 143 | 144 | * JSON format - To post json files, you need provide a key that the content will be stored in json object. For example, if you set `jsonKey: 'photo'` the plugin make a json `{ photo: 'photo content' }` and add in `photo content` the file content using Base64 and, if you want GZip. 145 | 146 | * Form Data - To post Form Data, you need provide a key that the content will be stored in form data. For example, if you set `jsonKey: 'photo'` the plugin make a form data `dataform[jsonKey] = 'photo content'` and add in `photo content` the file content using Base64 and, if you want GZip. 147 | 148 | The file always will be store in `jsonKey` field, and not in post content. The server need supports this logic. 149 | 150 | ``` 151 | BackgroundTask.postFiles({ 152 | url: apiUrl, // api url 153 | formData: false, // use form data to post. default is json 154 | gzip: true, // use base64 gzip 155 | items: [{ 156 | fileSrc: fileSrc, // file origin path 157 | jsonKey: jsonKey, // internally post data[jsonKey] = file content 158 | identifier: identifier, // identifier to result 159 | data: { // you json object to post + data[jsonKey] = file content 160 | Id: 1 161 | } 162 | }], 163 | headers: [ 164 | { 'X-Auth-Token': token } 165 | ], 166 | doneCallback: function(dataPostList) { 167 | 168 | // to ios use array converter 169 | // var utils require("utils/utils") 170 | // if(application.ios) 171 | // dataPostList = utils.ios.collections.nsArrayToJSArray(dataPostList) 172 | 173 | for(var i in dataPostList){ 174 | var postData = dataPostList[i] 175 | var data = JSON.parse(postData.result) 176 | var identifier = postData.identifier 177 | // get response headers names postData.getHeaderNames() 178 | // get response header value postData.getHeaderValue("name") 179 | // get response headers postData.getHeaders() 180 | // get response object postData.response 181 | // process result 182 | } 183 | }, 184 | errorCallback: function(error){ 185 | // error 186 | } 187 | }) 188 | ``` 189 | 190 | ### SQL Batch 191 | 192 | Execute sql back in background. 193 | 194 | ``` 195 | // sql batch 196 | var items = [] 197 | 198 | // insert / update / delete 199 | items.push({ 200 | query: 'insert into foo name values(?)', 201 | args: ['john'] 202 | }) 203 | 204 | // to insert or update 205 | items.push({ 206 | insertQuery: 'insert into foo name values(?)', 207 | updateQuery: 'update foo set name = ? where id = ?', 208 | tableName: 'foo', 209 | updateKey: 'id', 210 | updateKeyValue: '1', 211 | args: ['john'] 212 | }) 213 | 214 | BackgroundTask.dbBatch({ 215 | dbName: dbName, 216 | items: items, 217 | doneCallback: function(){ 218 | // done 219 | }, 220 | errorCallback: function(error){ 221 | // error 222 | } 223 | }) 224 | 225 | ``` 226 | 227 | ### Split large file and save parts 228 | 229 | ``` 230 | BackgroundTask.splitFiles({ 231 | files: [{ 232 | fileSrc: "/file/to/split.mp4" 233 | filePartPath: "/path/to/save/part/" 234 | fileParthName: "FileName" 235 | fileParteSufix: "part" // create FileName.part 236 | filePartMaxSize: 3 // 3MB 237 | }], 238 | doneCallback: function(data){ 239 | 240 | var files = [] 241 | for(i in data){ 242 | for(filePath in data[i].fileParts) 243 | files.push(it) // get name of parts 244 | } 245 | }, 246 | errorCallback: function(error){ 247 | // error 248 | } 249 | }) 250 | 251 | ``` 252 | -------------------------------------------------------------------------------- /background-task.android.js: -------------------------------------------------------------------------------- 1 | var Application = require("@nativescript/core").Application 2 | 3 | /* 4 | args = { 5 | 6 | url: 7 | toFile: - file path to save 8 | 9 | } 10 | */ 11 | exports.getFile = function(args){ 12 | var callback = createCallback(args) 13 | var toFile = args.toFile 14 | var url = args.url 15 | var identifier = args.identifier + "" 16 | var partBytesSize = args.partBytesSize 17 | var checkPartialDownload = args.checkPartialDownload 18 | 19 | var task = new br.com.mobilemind.ns.task.HttpRequestToFileTask(callback, url, toFile, identifier) 20 | task.setCheckPartialDownload(checkPartialDownload == undefined ? false : checkPartialDownload) 21 | task.setPartBytesSize( partBytesSize || 0) 22 | 23 | if(args.headers){ 24 | for(var i in args.headers){ 25 | var header = args.headers[i] 26 | for(var key in header){ 27 | task.addHeader(key, header[key]) 28 | } 29 | } 30 | } 31 | 32 | task.executeOnExecutor(android.os.AsyncTask.THREAD_POOL_EXECUTOR, null) 33 | } 34 | 35 | exports.isPartialDownloadCompleted = function(args) { 36 | return br.com.mobilemind.ns.task.HttpRequestToFileTask.isCompletedDownload(args.toFile) 37 | } 38 | 39 | /* 40 | 41 | args = { 42 | fromFile: 43 | toFile: 44 | } 45 | 46 | */ 47 | exports.unzip = function(args){ 48 | var callback = createCallback(args) 49 | var toFile = args.toFile 50 | var fromFile = args.fromFile 51 | br.com.mobilemind.ns.task.UnzipTask.doIt(callback, fromFile, toFile); 52 | } 53 | 54 | /* 55 | 56 | args = { 57 | fromFile: 58 | toFile: 59 | } 60 | 61 | */ 62 | exports.copyFiles = function(args){ 63 | var callback = createCallback(args) 64 | var toFile = args.toFile 65 | var fromFile = args.fromFile 66 | br.com.mobilemind.ns.task.CopyFilesTask.doIt(callback, fromFile, toFile); 67 | } 68 | 69 | /* 70 | args = { 71 | files: [ 72 | { 73 | image: // bitmap or uiimage 74 | fileDst: 75 | fileSrc: 76 | quality: 77 | } 78 | ] 79 | } 80 | 81 | */ 82 | exports.saveLargeFiles = function(args){ 83 | 84 | var callback = createCallback(args) 85 | 86 | try{ 87 | 88 | if(!args.files || args.files.length == 0){ 89 | if(args.doneCallback){ 90 | args.doneCallback() 91 | return 92 | } 93 | } 94 | 95 | var largeFiles = [] 96 | 97 | for(var i in args.files) { 98 | 99 | var item = args.files[i] 100 | var large = new br.com.mobilemind.ns.task.LargeFilePersisterTask.LargeFile() 101 | large.bitmap = item.image.android || item.image 102 | large.fileDst = item.fileDst 103 | large.fileSrc = item.fileSrc 104 | large.quality = item.quality 105 | 106 | largeFiles.push(large) 107 | 108 | } 109 | 110 | br.com.mobilemind.ns.task.LargeFilePersisterTask.doIt(callback, largeFiles); 111 | }catch(error){ 112 | console.log("BackgroundTask.saveLargeFiles error=" + error) 113 | if(args.errorCallback) 114 | args.errorCallback(error) 115 | } 116 | 117 | } 118 | 119 | /* 120 | args = { 121 | files: [ 122 | { 123 | fileSrc: 124 | filePartPath: 125 | filePartName: 126 | filePartSufix: default is "part" 127 | filePartMaxSize: default is 5 (5MB) 128 | } 129 | ] 130 | } 131 | 132 | */ 133 | 134 | exports.splitFiles = function(args){ 135 | 136 | var callback = createCallback(args) 137 | 138 | try{ 139 | 140 | if(!args.files || args.files.length == 0){ 141 | if(args.doneCallback){ 142 | args.doneCallback() 143 | return 144 | } 145 | } 146 | 147 | var splitFiles = [] 148 | 149 | for(var i in args.files) { 150 | 151 | var item = args.files[i] 152 | var splitFile = new br.com.mobilemind.ns.task.SplitFilesTask.SplitFile() 153 | 154 | splitFile.fileSrc = item.fileSrc 155 | splitFile.filePartPath = item.filePartPath 156 | splitFile.filePartMaxSize = item.filePartMaxSize || splitFile.filePartMaxSize 157 | splitFile.filePartName = item.filePartName 158 | splitFile.filePartSufix = item.filePartSufix || splitFile.filePartSufix 159 | 160 | splitFiles.push(splitFile) 161 | 162 | } 163 | 164 | br.com.mobilemind.ns.task.SplitFilesTask.doIt(callback, splitFiles); 165 | 166 | }catch(error){ 167 | console.log("BackgroundTask.splitFiles error=" + error) 168 | if(args.errorCallback) 169 | args.errorCallback(error) 170 | } 171 | 172 | } 173 | 174 | /* 175 | 176 | args = { 177 | url: 178 | items: [ 179 | { 180 | jsonKey: 181 | fileSrc: 182 | data: - json data 183 | } 184 | ] 185 | headers: [ 186 | {} 187 | ] 188 | } 189 | 190 | */ 191 | 192 | exports.postFiles = function(args){ 193 | 194 | var callback = createCallback(args) 195 | 196 | try{ 197 | 198 | var httpPostFileTask 199 | 200 | if(args.formData){ 201 | httpPostFileTask = new br.com.mobilemind.ns.task.HttpPostFileFormDataTask(args.url, callback) 202 | } else { 203 | httpPostFileTask = new br.com.mobilemind.ns.task.HttpPostFileTask(args.url, callback) 204 | } 205 | 206 | for(var i in args.items){ 207 | var jsonItem = args.items[i] 208 | var fileSrc = jsonItem.fileSrc 209 | var jsonKey = jsonItem.jsonKey 210 | var jsonData = jsonItem.data 211 | 212 | var httpPostData = new br.com.mobilemind.ns.task.HttpPostData(fileSrc, jsonKey) 213 | httpPostData.identifier = jsonItem.identifier 214 | 215 | for(var key in jsonData){ 216 | httpPostData.addJsonValue(key, jsonData[key]) 217 | } 218 | 219 | httpPostFileTask.addData(httpPostData) 220 | 221 | } 222 | 223 | if(args.gzip) 224 | httpPostFileTask.setUseGzip(args.gzip) 225 | 226 | if(args.headers){ 227 | for(var i in args.headers){ 228 | var header = args.headers[i] 229 | for(var key in header){ 230 | httpPostFileTask.addHeader(key, header[key]) 231 | } 232 | } 233 | } 234 | 235 | httpPostFileTask.executeOnExecutor(android.os.AsyncTask.THREAD_POOL_EXECUTOR, null) 236 | }catch(error){ 237 | console.log("BackgroundTask.postFiles error=" + error) 238 | 239 | if(args.errorCallback) 240 | args.errorCallback(error) 241 | } 242 | } 243 | 244 | exports.postData = function(args){ 245 | 246 | var callback = createCallback(args) 247 | 248 | try{ 249 | 250 | var task = new br.com.mobilemind.ns.task.HttpPostDataTask(args.url, callback) 251 | 252 | 253 | for(var i in args.items){ 254 | var jsonItem = args.items[i] 255 | var fileSrc = jsonItem.fileSrc 256 | var jsonKey = jsonItem.jsonKey 257 | var jsonData = jsonItem.data 258 | 259 | var httpPostData = new br.com.mobilemind.ns.task.HttpPostData(fileSrc, jsonKey) 260 | httpPostData.identifier = jsonItem.identifier 261 | 262 | for(var key in jsonData){ 263 | httpPostData.addJsonValue(key, jsonData[key]) 264 | } 265 | 266 | task.addData(httpPostData) 267 | 268 | } 269 | 270 | if(args.gzip) 271 | task.setUseGzip(args.gzip) 272 | 273 | if(args.splitMaxSize > 0) 274 | task.setSplitMaxSize(args.splitMaxSize) 275 | 276 | 277 | if(args.headers){ 278 | for(var i in args.headers){ 279 | var header = args.headers[i] 280 | for(var key in header){ 281 | task.addHeader(key, header[key]) 282 | } 283 | } 284 | } 285 | 286 | task.executeOnExecutor(android.os.AsyncTask.THREAD_POOL_EXECUTOR, null) 287 | 288 | }catch(error){ 289 | console.log("BackgroundTask.postFiles error=" + error) 290 | 291 | if(args.errorCallback) 292 | args.errorCallback(error) 293 | } 294 | } 295 | 296 | /* 297 | 298 | insert/update/delete 299 | 300 | args = { 301 | dbName 302 | items: [ 303 | { 304 | query: 305 | args 306 | } 307 | ] 308 | } 309 | 310 | insert or update 311 | 312 | args = { 313 | dbName 314 | items: [ 315 | { 316 | insertQuery: 317 | updateQuery: 318 | tableName: 319 | updateKey: // where column name 320 | updateKeyValue: // where column value 321 | params: 322 | } 323 | ] 324 | } 325 | 326 | */ 327 | exports.dbBatch = function(args){ 328 | var callback = createCallback(args) 329 | 330 | try{ 331 | var context = Application.android.foregroundActivity || Application.android.startActivity 332 | var dbName = args.dbName 333 | 334 | var dbInsertBatchTask = new br.com.mobilemind.ns.task.DbInsertBatchTask(context, dbName, callback) 335 | 336 | for(var i in args.items){ 337 | var item = args.items[i] 338 | if(item.query) 339 | dbInsertBatchTask.addQuery(item.query, item.args) 340 | else 341 | dbInsertBatchTask.addInsertOrUpdateQuery(item.insertQuery, item.updateQuery, item.tableName, item.updateKey + "", item.updateKeyValue, item.args) 342 | } 343 | 344 | dbInsertBatchTask.executeOnExecutor(android.os.AsyncTask.THREAD_POOL_EXECUTOR, null) 345 | 346 | }catch(error){ 347 | console.log("BackgroundTask.dbBatchInsert error=" + error) 348 | 349 | if(args.errorCallback) 350 | args.errorCallback(error) 351 | } 352 | 353 | } 354 | 355 | function createCallback(args){ 356 | 357 | var doneCallback = args.doneCallback 358 | var errorCallback = args.errorCallback 359 | 360 | var callback = new br.com.mobilemind.ns.task.CompleteCallback({ 361 | onComplete: function(result){ 362 | if(doneCallback) 363 | doneCallback(result) 364 | }, 365 | onError: function(e){ 366 | if(errorCallback) 367 | errorCallback(e) 368 | } 369 | }) 370 | 371 | return callback 372 | 373 | } 374 | -------------------------------------------------------------------------------- /background-task.ios.js: -------------------------------------------------------------------------------- 1 | var fs = require("@nativescript/core/file-system") 2 | 3 | exports.getFile = function(args){ 4 | 5 | var CompleteCallback = createCallback(args) 6 | 7 | var toFile = args.toFile 8 | var url = args.url 9 | var identifier = args.identifier + "" 10 | var partBytesSize = args.partBytesSize 11 | var checkPartialDownload = args.checkPartialDownload 12 | var debug = args.debug 13 | 14 | 15 | var task = NSBackgroundTaskHttpRequestToFile.alloc().initWithUrlToFileIdentifier(url, toFile, identifier) 16 | 17 | task.setCheckPartialDownload(checkPartialDownload == undefined ? false : checkPartialDownload) 18 | task.setPartBytesSize(partBytesSize || 0) 19 | task.setDebug(debug == undefined ? false : debug) 20 | 21 | if(args.headers){ 22 | for(var i in args.headers){ 23 | var header = args.headers[i] 24 | for(var key in header){ 25 | task.addHeaderWithNameAndValue(key, header[key]) 26 | } 27 | } 28 | } 29 | 30 | task.delegate = CompleteCallback.new() 31 | task.runTask(); 32 | } 33 | 34 | exports.unzip = function(args){ 35 | 36 | var CompleteCallback = createCallback(args) 37 | 38 | var task = NSBackgroundTaskUnzipTask.alloc().initWithFromFileToFile(args.fromFile, args.toFile) 39 | task.delegate = CompleteCallback.new() 40 | task.runTask(); 41 | } 42 | 43 | exports.copyFiles = function(args){ 44 | 45 | var CompleteCallback = createCallback(args) 46 | 47 | var task = NSBackgroundTaskCopyFiles.alloc().initWithFromFileToFile(args.fromFile, args.toFile) 48 | task.delegate = CompleteCallback.new() 49 | task.runTask(); 50 | } 51 | 52 | /* 53 | args = { 54 | files: [ 55 | { 56 | image: 57 | fileDst: 58 | fileSrc: 59 | quality: 60 | } 61 | ] 62 | } 63 | 64 | */ 65 | exports.saveLargeFiles = function(args){ 66 | 67 | var CompleteCallback = createCallback(args) 68 | 69 | try{ 70 | 71 | if(!args.files || args.files.length == 0){ 72 | if(args.doneCallback){ 73 | args.doneCallback() 74 | return 75 | } 76 | } 77 | 78 | var task = NSLargeFilePersisterTask.new() 79 | task.delegate = CompleteCallback.new() 80 | 81 | for(var i in args.files) { 82 | 83 | var item = args.files[i] 84 | var largeFile = NSLargeFile.new() 85 | 86 | if (item.image instanceof UIImage) 87 | largeFile.image = item.image 88 | else if(item.image && item.image.ios) 89 | largeFile.image = item.image.ios 90 | 91 | largeFile.fileDst = item.fileDst 92 | largeFile.fileSrc = item.fileSrc 93 | largeFile.quality = item.quality || 0 94 | 95 | task.addLargeFile(largeFile) 96 | } 97 | 98 | task.runTask() 99 | 100 | }catch(error){ 101 | console.log("BackgroundTask.saveLargeFiles error=" + error) 102 | if(args.errorCallback) 103 | args.errorCallback(error) 104 | } 105 | 106 | } 107 | 108 | /* 109 | args = { 110 | files: [ 111 | { 112 | fileSrc: 113 | filePartPath: 114 | fileParthName: 115 | fileParteSufix: default is "part" 116 | filePartMaxSize: default is 5 (5MB) 117 | } 118 | ] 119 | } 120 | 121 | */ 122 | 123 | exports.splitFiles = function(args){ 124 | 125 | var CompleteCallback = createCallback(args) 126 | 127 | try{ 128 | 129 | if(!args.files || args.files.length == 0){ 130 | if(args.doneCallback) 131 | args.doneCallback() 132 | } 133 | 134 | var task = NSSplitFileTask.new() 135 | task.delegate = CompleteCallback.new() 136 | 137 | for(var i in args.files) { 138 | 139 | var item = args.files[i] 140 | 141 | var splitFile = NSSplitFile.new() 142 | splitFile.fileSrc = item.fileSrc 143 | splitFile.filePartPath = item.filePartPath 144 | splitFile.filePartMaxSize = item.filePartMaxSize || splitFile.filePartMaxSize 145 | splitFile.filePartName = item.filePartName 146 | splitFile.filePartSufix = item.filePartSufix || splitFile.filePartSufix 147 | 148 | task.addSplitFile(splitFile) 149 | } 150 | 151 | task.runTask() 152 | 153 | }catch(error){ 154 | console.log("BackgroundTask.splitFiles error=" + error) 155 | if(args.errorCallback) 156 | args.errorCallback(error) 157 | } 158 | 159 | } 160 | 161 | /* 162 | 163 | args = { 164 | url: 165 | items: [ 166 | { 167 | jsonKey: 168 | fileSrc: 169 | data: - json data 170 | } 171 | ] 172 | headers: [ 173 | {} 174 | ] 175 | } 176 | 177 | */ 178 | 179 | exports.postFiles = function(args){ 180 | 181 | var CompleteCallback = createCallback(args) 182 | 183 | try{ 184 | 185 | var task = NSHttpPostFileTask.alloc().initWithUrl(args.url) 186 | task.delegate = CompleteCallback.new() 187 | 188 | if(args.formData){ 189 | task.setUseFormData(true) 190 | } 191 | 192 | if(args.gzip){ 193 | task.setUseGzip(true) 194 | } 195 | 196 | if(args.debug) 197 | task.setDebug(true) 198 | 199 | for(var i in args.items){ 200 | var jsonItem = args.items[i] 201 | var fileSrc = jsonItem.fileSrc 202 | var jsonKey = jsonItem.jsonKey 203 | var jsonData = jsonItem.data 204 | 205 | var httpPostFile = NSHttpPostFile.alloc().initWithFileSrcJsonKey(fileSrc, jsonKey) 206 | httpPostFile.identifier = jsonItem.identifier 207 | 208 | for(var key in jsonData){ 209 | httpPostFile.addJsonKeyValue(key, jsonData[key]) 210 | } 211 | 212 | task.addPostFile(httpPostFile) 213 | 214 | } 215 | 216 | if(args.gzip == false) 217 | task.setUseGzip(false) 218 | 219 | if(args.headers){ 220 | for(var i in args.headers){ 221 | var header = args.headers[i] 222 | for(var key in header){ 223 | task.addHeaderWithNameAndValue(key, header[key]) 224 | } 225 | } 226 | } 227 | 228 | task.runTask() 229 | 230 | 231 | }catch(error){ 232 | console.log("BackgroundTask.postFiles error=" + error) 233 | 234 | if(args.errorCallback) 235 | args.errorCallback(error) 236 | } 237 | } 238 | 239 | 240 | /* 241 | 242 | insert/update/delete 243 | 244 | args = { 245 | dbName 246 | items: [ 247 | { 248 | query: 249 | args 250 | } 251 | ] 252 | } 253 | 254 | insert or update 255 | 256 | args = { 257 | dbName 258 | items: [ 259 | { 260 | insertQuery: 261 | updateQuery: 262 | tableName: 263 | updateKey: // where column name 264 | updateKeyValue: // where column value 265 | params: 266 | } 267 | ] 268 | } 269 | 270 | */ 271 | exports.dbBatch = function(args){ 272 | var CompleteCallback = createCallback(args) 273 | 274 | var dbPath = fs.path.join(fs.knownFolders.documents().path, args.dbName) 275 | 276 | try{ 277 | 278 | var task = NSDbBatchTask.alloc().initWithDbPath(dbPath) 279 | task.delegate = CompleteCallback.new() 280 | 281 | if(args.debug) 282 | task.setDebug(true) 283 | 284 | for(var i in args.items){ 285 | var item = args.items[i] 286 | 287 | var query = NSQuery.new() 288 | 289 | if(item.query){ 290 | query.query = item.query 291 | query.params = item.args 292 | } else { 293 | query.insertQuery = item.insertQuery 294 | query.updateQuery = item.updateQuery 295 | query.tableName = item.tableName 296 | query.updateKey = item.updateKey + "" 297 | query.updateKeyValue = item.updateKeyValue + "" 298 | query.updateKeyDataType = item.updateKeyDataType || "text" 299 | query.params = item.args 300 | } 301 | 302 | task.addQuery(query) 303 | 304 | } 305 | 306 | task.runTask() 307 | 308 | }catch(error){ 309 | console.log("BackgroundTask.dbBatchInsert error=" + error) 310 | 311 | if(args.errorCallback) 312 | args.errorCallback(error) 313 | } 314 | 315 | } 316 | 317 | function createCallback(args){ 318 | 319 | var CompleteCallback = (function(_super){ 320 | __extends(CompleteCallback, _super); 321 | function CompleteCallback(){ 322 | _super.apply(this, arguments); 323 | } 324 | 325 | CompleteCallback.prototype.onComplete = function(result){ 326 | if(args.doneCallback) 327 | invokeOnRunLoop(()=>{ 328 | args.doneCallback(result) 329 | }) 330 | } 331 | 332 | CompleteCallback.prototype.onError = function(message){ 333 | if(args.errorCallback) 334 | invokeOnRunLoop(()=>{ 335 | args.errorCallback(message) 336 | }) 337 | } 338 | 339 | CompleteCallback.ObjCProtocols = [NSBackgroundTaskCompleteCallback] 340 | 341 | return CompleteCallback 342 | 343 | }(NSObject)) 344 | 345 | return CompleteCallback 346 | } 347 | 348 | let invokeOnRunLoop = (function() { 349 | var runloop = CFRunLoopGetMain(); 350 | return function(func) { 351 | CFRunLoopPerformBlock(runloop, kCFRunLoopDefaultMode, func); 352 | CFRunLoopWakeUp(runloop); 353 | } 354 | }()); 355 | 356 | exports.invokeOnRunLoop = invokeOnRunLoop -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/app.gradle: -------------------------------------------------------------------------------- 1 | // Add your native dependencies here: 2 | 3 | // Uncomment to add recyclerview-v7 dependency 4 | //dependencies { 5 | // compile 'com.android.support:recyclerview-v7:+' 6 | //} 7 | 8 | android { 9 | defaultConfig { 10 | generatedDensities = [] 11 | } 12 | aaptOptions { 13 | additionalParameters "--no-version-vectors" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-hdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-hdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-hdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-hdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-ldpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-ldpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-ldpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-ldpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-mdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-mdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-mdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-mdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-nodpi/splash_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-nodpi/splashscreen.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-nodpi/splashscreen.9.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-xhdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-xhdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-xxhdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-xxhdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-xxxhdpi/background.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/values-v21/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3d5afe 4 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 14 | 15 | 16 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #F5F5F5 4 | #757575 5 | #33B5E5 6 | #272734 7 | -------------------------------------------------------------------------------- /demo/app/App_Resources/Android/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 21 | 22 | 23 | 31 | 32 | 34 | 35 | 36 | 42 | 43 | 45 | 46 | -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "icon-29.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "icon-29@2x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "icon-29@3x.png", 19 | "scale" : "3x" 20 | }, 21 | { 22 | "size" : "40x40", 23 | "idiom" : "iphone", 24 | "filename" : "icon-40@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "icon-40@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "57x57", 35 | "idiom" : "iphone", 36 | "filename" : "icon-57.png", 37 | "scale" : "1x" 38 | }, 39 | { 40 | "size" : "57x57", 41 | "idiom" : "iphone", 42 | "filename" : "icon-57@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "icon-60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "icon-60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "29x29", 59 | "idiom" : "ipad", 60 | "filename" : "icon-29.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "29x29", 65 | "idiom" : "ipad", 66 | "filename" : "icon-29@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "40x40", 71 | "idiom" : "ipad", 72 | "filename" : "icon-40.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "40x40", 77 | "idiom" : "ipad", 78 | "filename" : "icon-40@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "50x50", 83 | "idiom" : "ipad", 84 | "filename" : "icon-50.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "50x50", 89 | "idiom" : "ipad", 90 | "filename" : "icon-50@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "72x72", 95 | "idiom" : "ipad", 96 | "filename" : "icon-72.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "72x72", 101 | "idiom" : "ipad", 102 | "filename" : "icon-72@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "76x76", 107 | "idiom" : "ipad", 108 | "filename" : "icon-76.png", 109 | "scale" : "1x" 110 | }, 111 | { 112 | "size" : "76x76", 113 | "idiom" : "ipad", 114 | "filename" : "icon-76@2x.png", 115 | "scale" : "2x" 116 | }, 117 | { 118 | "size" : "83.5x83.5", 119 | "idiom" : "ipad", 120 | "filename" : "icon-83.5@2x.png", 121 | "scale" : "2x" 122 | } 123 | ], 124 | "info" : { 125 | "version" : 1, 126 | "author" : "xcode" 127 | } 128 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "iphone", 6 | "subtype" : "736h", 7 | "filename" : "Default-736h@3x.png", 8 | "minimum-system-version" : "8.0", 9 | "orientation" : "portrait", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "extent" : "full-screen", 14 | "idiom" : "iphone", 15 | "subtype" : "736h", 16 | "filename" : "Default-Landscape@3x.png", 17 | "minimum-system-version" : "8.0", 18 | "orientation" : "landscape", 19 | "scale" : "3x" 20 | }, 21 | { 22 | "extent" : "full-screen", 23 | "idiom" : "iphone", 24 | "subtype" : "667h", 25 | "filename" : "Default-667h@2x.png", 26 | "minimum-system-version" : "8.0", 27 | "orientation" : "portrait", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "orientation" : "portrait", 32 | "idiom" : "iphone", 33 | "filename" : "Default@2x.png", 34 | "extent" : "full-screen", 35 | "minimum-system-version" : "7.0", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "extent" : "full-screen", 40 | "idiom" : "iphone", 41 | "subtype" : "retina4", 42 | "filename" : "Default-568h@2x.png", 43 | "minimum-system-version" : "7.0", 44 | "orientation" : "portrait", 45 | "scale" : "2x" 46 | }, 47 | { 48 | "orientation" : "portrait", 49 | "idiom" : "ipad", 50 | "filename" : "Default-Portrait.png", 51 | "extent" : "full-screen", 52 | "minimum-system-version" : "7.0", 53 | "scale" : "1x" 54 | }, 55 | { 56 | "orientation" : "landscape", 57 | "idiom" : "ipad", 58 | "filename" : "Default-Landscape.png", 59 | "extent" : "full-screen", 60 | "minimum-system-version" : "7.0", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "orientation" : "portrait", 65 | "idiom" : "ipad", 66 | "filename" : "Default-Portrait@2x.png", 67 | "extent" : "full-screen", 68 | "minimum-system-version" : "7.0", 69 | "scale" : "2x" 70 | }, 71 | { 72 | "orientation" : "landscape", 73 | "idiom" : "ipad", 74 | "filename" : "Default-Landscape@2x.png", 75 | "extent" : "full-screen", 76 | "minimum-system-version" : "7.0", 77 | "scale" : "2x" 78 | }, 79 | { 80 | "orientation" : "portrait", 81 | "idiom" : "iphone", 82 | "filename" : "Default.png", 83 | "extent" : "full-screen", 84 | "scale" : "1x" 85 | }, 86 | { 87 | "orientation" : "portrait", 88 | "idiom" : "iphone", 89 | "filename" : "Default@2x.png", 90 | "extent" : "full-screen", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "orientation" : "portrait", 95 | "idiom" : "iphone", 96 | "filename" : "Default-568h@2x.png", 97 | "extent" : "full-screen", 98 | "subtype" : "retina4", 99 | "scale" : "2x" 100 | }, 101 | { 102 | "orientation" : "portrait", 103 | "idiom" : "ipad", 104 | "extent" : "to-status-bar", 105 | "scale" : "1x" 106 | }, 107 | { 108 | "orientation" : "portrait", 109 | "idiom" : "ipad", 110 | "filename" : "Default-Portrait.png", 111 | "extent" : "full-screen", 112 | "scale" : "1x" 113 | }, 114 | { 115 | "orientation" : "landscape", 116 | "idiom" : "ipad", 117 | "extent" : "to-status-bar", 118 | "scale" : "1x" 119 | }, 120 | { 121 | "orientation" : "landscape", 122 | "idiom" : "ipad", 123 | "filename" : "Default-Landscape.png", 124 | "extent" : "full-screen", 125 | "scale" : "1x" 126 | }, 127 | { 128 | "orientation" : "portrait", 129 | "idiom" : "ipad", 130 | "extent" : "to-status-bar", 131 | "scale" : "2x" 132 | }, 133 | { 134 | "orientation" : "portrait", 135 | "idiom" : "ipad", 136 | "filename" : "Default-Portrait@2x.png", 137 | "extent" : "full-screen", 138 | "scale" : "2x" 139 | }, 140 | { 141 | "orientation" : "landscape", 142 | "idiom" : "ipad", 143 | "extent" : "to-status-bar", 144 | "scale" : "2x" 145 | }, 146 | { 147 | "orientation" : "landscape", 148 | "idiom" : "ipad", 149 | "filename" : "Default-Landscape@2x.png", 150 | "extent" : "full-screen", 151 | "scale" : "2x" 152 | } 153 | ], 154 | "info" : { 155 | "version" : 1, 156 | "author" : "xcode" 157 | } 158 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-AspectFill.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-AspectFill@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-Center.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-Center@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Default-568h@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Default-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Default-667h@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Default-736h@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Default-736h@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Default-Landscape-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Default-Landscape-568h@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Default-Landscape-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Default-Landscape-667h@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Default-Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Default-Landscape.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Default-Landscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Default-Landscape@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Default-Landscape@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Default-Landscape@3x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Default-Portrait.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Default-Portrait@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Default.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Default@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Icon-Small-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Icon-Small-50.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Icon-Small-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Icon-Small-50@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Icon-Small.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/Icon-Small@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | icon.png 13 | CFBundleIcons 14 | 15 | CFBundlePrimaryIcon 16 | 17 | CFBundleIconFiles 18 | 19 | icon-40 20 | icon-60 21 | icon-72 22 | icon-76 23 | Icon-Small 24 | Icon-Small-50 25 | 26 | UIPrerenderedIcon 27 | 28 | 29 | 30 | CFBundleInfoDictionaryVersion 31 | 6.0 32 | CFBundleName 33 | ${PRODUCT_NAME} 34 | CFBundlePackageType 35 | APPL 36 | CFBundleShortVersionString 37 | 1.0 38 | CFBundleSignature 39 | ???? 40 | CFBundleVersion 41 | 1.0 42 | LSRequiresIPhoneOS 43 | 44 | UILaunchStoryboardName 45 | LaunchScreen 46 | UIRequiresFullScreen 47 | 48 | UIRequiredDeviceCapabilities 49 | 50 | armv7 51 | 52 | UISupportedInterfaceOrientations 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationLandscapeLeft 56 | UIInterfaceOrientationLandscapeRight 57 | 58 | UISupportedInterfaceOrientations~ipad 59 | 60 | UIInterfaceOrientationPortrait 61 | UIInterfaceOrientationPortraitUpsideDown 62 | UIInterfaceOrientationLandscapeLeft 63 | UIInterfaceOrientationLandscapeRight 64 | 65 | 66 | NSAppTransportSecurity 67 | 68 | NSAllowsArbitraryLoads 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/build.xcconfig: -------------------------------------------------------------------------------- 1 | // You can add custom settings here 2 | // for example you can uncomment the following line to force distribution code signing 3 | // CODE_SIGN_IDENTITY = iPhone Distribution 4 | // ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 5 | // ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Brand Assets; 6 | 7 | DEVELOPMENT_TEAM = QVUFUDQE96 8 | -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/icon-40.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/icon-40@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/icon-60.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/icon-60@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/icon-72.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/icon-72@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/icon-76.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/icon-76@2x.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/icon.png -------------------------------------------------------------------------------- /demo/app/App_Resources/iOS/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobilemindtec/nativescript-background-task/d580b3711e47c4d52b7bb2fba6ff65badd5fc1d0/demo/app/App_Resources/iOS/icon@2x.png -------------------------------------------------------------------------------- /demo/app/app.css: -------------------------------------------------------------------------------- 1 | .title { 2 | font-size: 30; 3 | horizontal-align: center; 4 | } 5 | 6 | 7 | StackLayout{ 8 | padding: 20; 9 | } 10 | 11 | button { 12 | font-size: 15; 13 | margin-top: 15; 14 | horizontal-align: center; 15 | width: 100%; 16 | background-color: #2980b9; 17 | color: #FFFFFF; 18 | } 19 | 20 | .message { 21 | font-size: 20; 22 | color: #284848; 23 | horizontal-align: center; 24 | margin: 0 20; 25 | text-align: center; 26 | } 27 | -------------------------------------------------------------------------------- /demo/app/app.js: -------------------------------------------------------------------------------- 1 | var application = require("application"); 2 | application.start({ moduleName: "main-page" }); 3 | -------------------------------------------------------------------------------- /demo/app/main-page.js: -------------------------------------------------------------------------------- 1 | 2 | var observableModule = require("data/observable"); 3 | var fs = require("file-system"); 4 | var BackgroundTask = require("nativescript-background-task") 5 | var dialogs = require("ui/dialogs"); 6 | var imageSource = require("image-source") 7 | var orm = require("nativescript-db-orm"); 8 | var Model = orm.Model 9 | var application = require("application") 10 | 11 | var viewModel = new observableModule.Observable({ 12 | 'message': '', 13 | 'loading': false 14 | }) 15 | 16 | //var server = "http://192.168.0.4:3000/" 17 | var server = "http://10.0.0.102:3000/" 18 | 19 | var Person = (function(_super){ 20 | 21 | __extends(Person, _super); 22 | 23 | function Person(params){ 24 | _super.apply(this, params); 25 | 26 | params = params || {} 27 | 28 | this.clazz = Person 29 | this.tableName = "person" 30 | this.columns = [ 31 | { name: 'id', key: true }, 32 | { name: 'name', type: 'string' } 33 | ] 34 | 35 | this.attrs = {} 36 | 37 | for(i in this.columns){ 38 | this.attrs[this.columns[i].name] = params[this.columns[i].name] 39 | } 40 | 41 | Model.prototype._init.call(this, this, this.attrs) 42 | } 43 | 44 | return Person 45 | 46 | })(Model) 47 | 48 | exports.loaded = function(args) { 49 | var page = args.object; 50 | page.bindingContext = viewModel; 51 | 52 | var DbChecker = orm.DbChecker 53 | var dbChecker = new DbChecker() 54 | 55 | //dbChecker.onDebug(true) 56 | 57 | dbChecker.createOrUpdate(true, "demo.db", [ 58 | new Person() 59 | ], function(){ 60 | console.log("orm init successful") 61 | }, function (error) { 62 | console.log("error orm init " + error) 63 | }) 64 | 65 | //console.log("---------------------------------") 66 | //console.log(android.database.sqlite.SQLiteDatabase.openOrCreateDatabase("test.db", {})) 67 | //console.log("---------------------------------") 68 | 69 | } 70 | 71 | exports.onUnzip = function(){ 72 | 73 | var temp = fs.knownFolders.temp(); 74 | var extractPath = fs.path.join(temp.path, 'unziped_files') 75 | var zipFile = fs.path.join(temp.path, "images-2.1.zip") 76 | 77 | if(!fs.File.exists(zipFile)){ 78 | showAlert('Zip file does not exists.. do zip download.') 79 | return 80 | } 81 | 82 | viewModel.set('loading', true) 83 | 84 | BackgroundTask.unzip({ 85 | fromFile: zipFile, 86 | toFile: extractPath, 87 | doneCallback: function(){ 88 | // done 89 | 90 | fs.Folder.fromPath(extractPath).getEntities().then(function(entities){ 91 | viewModel.set('loading', false) 92 | showAlert("Unziped " + entities.length + " files to " + extractPath) 93 | 94 | }).then(function(error){ 95 | viewModel.set('loading', false) 96 | showAlert('Error on list directory ' + extractPath + ': ' + error) 97 | }) 98 | }, 99 | errorCallback: function(error){ 100 | // error 101 | viewModel.set('loading', false) 102 | showAlert('Error on extract zip: ' + error) 103 | }, 104 | }) 105 | } 106 | 107 | exports.onGetWebFile = function(){ 108 | 109 | var temp = fs.knownFolders.temp().path; 110 | var destinationFile = fs.path.join(temp, "images-2.1.zip") 111 | 112 | viewModel.set('loading', true) 113 | 114 | BackgroundTask.getFile({ 115 | url: 'http://mobilemind.com.br/makeyourself/coollife/images-2.1.zip', 116 | toFile: destinationFile, 117 | headers: [ 118 | { 'CustonHeader': 'Custon Value' } 119 | ], 120 | doneCallback: function(){ 121 | // done 122 | viewModel.set('loading', false) 123 | 124 | if(fs.File.exists(destinationFile)){ 125 | showAlert("download success in path " + destinationFile); 126 | }else{ 127 | showAlert("ops.. file not downloaded"); 128 | } 129 | 130 | }, 131 | errorCallback: function(message){ 132 | // error 133 | viewModel.set('loading', false) 134 | showAlert("Ops.. download error: " + message); 135 | }, 136 | }) 137 | } 138 | 139 | exports.onGetPartialWebFile = function() { 140 | var temp = fs.knownFolders.temp().path; 141 | var destinationFile = fs.path.join(temp, "large_file.pdf") 142 | 143 | viewModel.set('loading', true) 144 | 145 | BackgroundTask.getFile({ 146 | url: server + 'partial-download', 147 | toFile: destinationFile, 148 | partBytesSize: 0, // use default 149 | checkPartialDownload: true, 150 | headers: [ 151 | 152 | ], 153 | doneCallback: function(){ 154 | // done 155 | viewModel.set('loading', false) 156 | 157 | if(fs.File.exists(destinationFile)){ 158 | showAlert("download success in path " + destinationFile); 159 | }else{ 160 | showAlert("ops.. file not downloaded"); 161 | } 162 | 163 | }, 164 | errorCallback: function(obj){ 165 | // error 166 | viewModel.set('loading', false) 167 | showAlert("Ops.. download error: " + obj[1]); 168 | }, 169 | }) 170 | } 171 | 172 | exports.onCopyFiles = function(){ 173 | var temp = fs.knownFolders.temp().path; 174 | var extractPath = fs.path.join(temp, 'unziped_files') 175 | var movePath = fs.path.join(temp, "moved_files") 176 | 177 | if(!fs.Folder.exists(extractPath)){ 178 | showAlert('Unziped folder does not exists.. do unzip file.') 179 | return 180 | } 181 | 182 | viewModel.set('loading', true) 183 | 184 | BackgroundTask.copyFiles({ 185 | fromFile: extractPath, 186 | toFile: movePath, 187 | doneCallback: function(){ 188 | viewModel.set('loading', false) 189 | // done 190 | fs.Folder.fromPath(movePath).getEntities().then(function(entities){ 191 | showAlert("Moved " + entities.length + " files to " + movePath) 192 | }).then(function(error){ 193 | showAlert('Error on list directory ' + movePath + ': ' + error) 194 | }) 195 | }, 196 | errorCallback: function(error){ 197 | // error 198 | viewModel.set('loading', false) 199 | showAlert('Error on move files: ' + error) 200 | }, 201 | }) 202 | } 203 | 204 | 205 | exports.onSaveLargeFile = function(){ 206 | var current = fs.knownFolders.currentApp() 207 | var videoPath = fs.path.join(current.path, 'res/big_buck_bunny.mp4') 208 | var imagePath = fs.path.join(current.path, 'res/mobilemind.png') 209 | var temp = fs.knownFolders.temp().path; 210 | 211 | viewModel.set('loading', true) 212 | 213 | var img = imageSource.fromFile(imagePath); 214 | 215 | BackgroundTask.saveLargeFiles({ 216 | files: [{ 217 | fileSrc: videoPath, 218 | fileDst: fs.path.join(temp, "big_buck_bunny.mp4") 219 | },{ 220 | image: img, 221 | fileDst: fs.path.join(temp, "image.png") 222 | }], 223 | doneCallback: function(result){ 224 | viewModel.set('loading', false) 225 | showAlert('large file saved') 226 | }, 227 | errorCallback: function(error){ 228 | viewModel.set('loading', false) 229 | showAlert('Error on save large file: ' + error) 230 | } 231 | }) 232 | } 233 | 234 | exports.onPostFile = function(){ 235 | 236 | var current = fs.knownFolders.currentApp() 237 | var videoPath = fs.path.join(current.path, 'res/big_buck_bunny.mp4') 238 | 239 | viewModel.set('loading', true) 240 | 241 | BackgroundTask.postFiles({ 242 | url: server, 243 | formData: false, 244 | gzip: true, 245 | items: [{ 246 | fileSrc: videoPath, 247 | jsonKey: 'video', 248 | identifier: '10', 249 | data: { 250 | name: 'jonh', 251 | age: '33' 252 | } 253 | }], 254 | headers: [ 255 | { 'X-Auth-Toke': 'token' }, 256 | {'Content-Type': 'application/json'} 257 | ], 258 | doneCallback: function(results) { 259 | viewModel.set('loading', false) 260 | showAlert('post result: ' + results[0].result) 261 | }, 262 | errorCallback: function(error) { 263 | viewModel.set('loading', false) 264 | showAlert('Error post file file: ' + error) 265 | } 266 | }) 267 | } 268 | 269 | exports.onPostData = function(){ 270 | 271 | var current = fs.knownFolders.currentApp() 272 | var videoPath = fs.path.join(current.path, 'res/big_buck_bunny.mp4') 273 | 274 | viewModel.set('loading', true) 275 | 276 | BackgroundTask.postData({ 277 | url: server + 'raw', 278 | formData: false, 279 | gzip: true, 280 | items: [{ 281 | fileSrc: videoPath, 282 | identifier: '10', 283 | }], 284 | headers: [ 285 | {"Content-Type": "application/octet-stream"} 286 | ], 287 | doneCallback: function(results) { 288 | viewModel.set('loading', false) 289 | showAlert('post result: ' + results[0].result) 290 | }, 291 | errorCallback: function(error) { 292 | viewModel.set('loading', false) 293 | showAlert('Error post file file: ' + error) 294 | } 295 | }) 296 | } 297 | 298 | exports.onDbBatch = function () { 299 | 300 | var items = [] 301 | 302 | for(var i = 0; i < 1000; i++){ 303 | items.push({ 304 | query: "insert into person (name) values (?)", 305 | args: ["Person " + i] 306 | }) 307 | } 308 | 309 | viewModel.set('loading', true) 310 | 311 | BackgroundTask.dbBatch({ 312 | dbName: "demo.db", 313 | items: items, 314 | doneCallback: function(){ 315 | 316 | viewModel.set('loading', false) 317 | 318 | var model = new Person() 319 | 320 | model.count(function(err, result){ 321 | showAlert('data count after batch insert: ' + result) 322 | }) 323 | 324 | }, 325 | errorCallback: function (error) { 326 | viewModel.set('loading', false) 327 | showAlert('Error db batch: ' + error) 328 | } 329 | }) 330 | 331 | } 332 | 333 | exports.onSplitFile = function () { 334 | 335 | var current = fs.knownFolders.currentApp() 336 | var videoPath = fs.path.join(current.path, 'res/big_buck_bunny.mp4') 337 | var temp = fs.knownFolders.temp().path; 338 | 339 | viewModel.set('loading', true) 340 | 341 | BackgroundTask.splitFiles({ 342 | files: [{ 343 | fileSrc: videoPath, 344 | filePartPath: temp, 345 | filePartName: 'video_', 346 | filePartSufix: 'part', 347 | filePartMaxSize: 1 // 1MB 348 | }], 349 | doneCallback: function(result){ 350 | viewModel.set('loading', false) 351 | console.log(result[0].fileParts) 352 | showAlert('Split OK. Parts: ' + result[0].fileParts) 353 | }, 354 | errorCallback: function(error){ 355 | viewModel.set('loading', false) 356 | showAlert('Error on split file: ' + error) 357 | } 358 | }) 359 | } 360 | 361 | function showAlert(message) { 362 | var options = { 363 | title: "Background Tasks", 364 | message: message, 365 | okButtonText: "OK" 366 | } 367 | 368 | dialogs.alert(options) 369 | } 370 | 371 | 372 | 373 | -------------------------------------------------------------------------------- /demo/app/main-page.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 |