Skip to content

Commit fd29ed7

Browse files
author
radeva
authored
Merge branch 'master' into android-utf8
2 parents 9db03a0 + 0e4f5f2 commit fd29ed7

File tree

8 files changed

+28
-20
lines changed

8 files changed

+28
-20
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[submodule "github.io"]
2-
path = github.io
3-
url = [email protected]:NativeScript/nativescript-background-http.git
41
[submodule "deps/android-upload-service"]
52
path = deps/android-upload-service
63
url = [email protected]:NativeScript/android-upload-service.git

examples/SimpleBackgroundHttp/app/main-page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ function start_upload(should_fail, isMulti) {
5858
"Content-Type": "application/octet-stream",
5959
"File-Name": name
6060
},
61-
description: description
61+
description: description,
62+
androidDisplayNotificationProgress: false
6263
};
6364

6465
if (should_fail) {

examples/SimpleBackgroundHttp/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "org.nativescript.SimpleBackgroundHttp",
2+
"name": "org.nativescript.simplebackgroundhttp",
33
"nativescript": {
44
"id": "org.nativescript.SimpleBackgroundHttp",
55
"tns-android": {
@@ -11,7 +11,7 @@
1111
},
1212
"dependencies": {
1313
"nativescript-background-http": "file:../../nativescript-background-http/",
14-
"tns-core-modules": "^3.0.0 || ^3.0.0-rc.1"
14+
"tns-core-modules": "^3.2.0"
1515
},
1616
"devDependencies": {
1717
"babel-traverse": "6.24.1",

github.io

Lines changed: 0 additions & 1 deletion
This file was deleted.

nativescript-background-http/background-http.android.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ class Session {
9090
this._id = id;
9191
}
9292

93-
public uploadFile(file: string, options: common.Request): Task {
94-
return Task.create(this, file, options);
93+
public uploadFile(fileUri: string, options: common.Request): Task {
94+
return Task.create(this, fileUri, options);
9595
}
9696

9797
public multipartUpload(params: Array<any>, options: common.Request): Task {
@@ -127,7 +127,10 @@ class Task extends ObservableBase {
127127

128128
request.setFileToUpload(file);
129129

130-
request.setNotificationConfig(new (<any>net).gotev.uploadservice.UploadNotificationConfig());
130+
var displayNotificationProgress = typeof options.androidDisplayNotificationProgress === "boolean" ? options.androidDisplayNotificationProgress : true;
131+
if (displayNotificationProgress) {
132+
request.setNotificationConfig(new (<any>net).gotev.uploadservice.UploadNotificationConfig());
133+
}
131134

132135
var headers = options.headers;
133136
if (headers) {
@@ -189,7 +192,10 @@ class Task extends ObservableBase {
189192
request.setUtf8Charset();
190193
}
191194

192-
request.setNotificationConfig(new (<any>net).gotev.uploadservice.UploadNotificationConfig());
195+
var displayNotificationProgress = typeof options.androidDisplayNotificationProgress === "boolean" ? options.androidDisplayNotificationProgress : true;
196+
if (displayNotificationProgress) {
197+
request.setNotificationConfig(new (<any>net).gotev.uploadservice.UploadNotificationConfig());
198+
}
193199

194200
var headers = options.headers;
195201
if (headers) {

nativescript-background-http/background-http.ios.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ class MultiMultiPartForm {
317317
if (!this.fields[i].filename) {
318318
results += CRLF + CRLF + this.fields[i].value + CRLF;
319319
} else {
320-
results += '; filename="' + this.fields[i].filename + '"';
320+
results += '; filename="' + this.fields[i].destFilename + '"';
321321
if (this.fields[i].mimeType) {
322322
results += CRLF + "Content-Type: " + this.fields[i].mimeType;
323323
}
@@ -338,7 +338,7 @@ class MultiMultiPartForm {
338338

339339
}
340340
// Add final part of it...
341-
results += CRLF + "--" + this.boundary + "--" + CRLF;
341+
results += "--" + this.boundary + "--" + CRLF;
342342
tempString = NSString.stringWithString(results);
343343
newData = tempString.dataUsingEncoding(NSUTF8StringEncoding);
344344
combinedData.appendData(newData);

nativescript-background-http/index.d.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ export interface Session {
115115
/**
116116
* Initiate a new background file upload task.
117117
* @param fileUri A file path to upload.
118-
* @param request Options for the upload, sets uri, headers, task description etc.
118+
* @param options Options for the upload, sets uri, headers, task description etc.
119119
*/
120-
uploadFile(fileUri: string, request: Request): Task;
120+
uploadFile(fileUri: string, options: Request): Task;
121121
multipartUpload(params: Array<any>, options: any): Task;
122122

123123
}
@@ -153,4 +153,9 @@ export interface Request {
153153
* Use utf8 encode in requests
154154
*/
155155
utf8?: boolean;
156+
157+
/*
158+
* Use this to set if progress notification should be displayed or not
159+
*/
160+
androidDisplayNotificationProgress?: boolean;
156161
}

nativescript-background-http/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"url": "https://github.com/NativeScript/nativescript-background-http"
55
},
66
"name": "nativescript-background-http",
7-
"version": "3.0.0",
7+
"version": "3.1.0",
88
"nativescript": {
99
"platforms": {
1010
"android": "3.0.0",
@@ -26,12 +26,12 @@
2626
"NativeScript"
2727
],
2828
"peerDependencies": {
29-
"tns-core-modules": "^3.0.0 || ^3.0.0-rc.1"
29+
"tns-core-modules": "^3.2.0"
3030
},
3131
"devDependencies": {
32-
"tns-core-modules": "^3.0.0 || ^3.0.0-rc.1",
33-
"tns-platform-declarations": "^3.0.0 || ^3.0.0-rc.1",
34-
"typescript": "^2.2.2"
32+
"tns-core-modules": "^3.2.0",
33+
"tns-platform-declarations": "^3.2.0",
34+
"typescript": "~2.3.0"
3535
},
3636
"scripts": {
3737
"tsc": "tsc",

0 commit comments

Comments
 (0)