Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 6935d1e

Browse files
author
Brendan Ingham
committed
I'm, going to say we have feature parity for Android and IOS as now they both Error the same way!
Waiting on Eddy to Update the Demo's Cloud Functions to a onCall request and then we will see if it works as it should!
1 parent ce0109a commit 6935d1e

File tree

4 files changed

+42
-16
lines changed

4 files changed

+42
-16
lines changed

demo/app/main-view-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export class HelloWorldModel extends Observable {
209209
.catch((e) => {
210210
alert({
211211
title: "An Error Occurred",
212-
message: e.message,
212+
message: e,
213213
okButtonText: "OK, thanks"
214214
});
215215
});

demo/firebase.nativescript.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"external_push_client_only": false,
3-
"using_ios": false,
3+
"using_ios": true,
44
"using_android": true,
55
"firestore": true,
66
"realtimedb": true,

demo/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"nativescript": {
33
"id": "org.nativescript.firebasedemo",
4-
"tns-ios": {
5-
"version": "4.2.0"
6-
},
74
"tns-android": {
8-
"version": "4.2.0"
5+
"version": "4.3.0-2018-09-21-01"
6+
},
7+
"tns-ios": {
8+
"version": "4.3.0-2018-09-19-01"
99
}
1010
},
1111
"dependencies": {
12-
"nativescript-plugin-firebase": "7.0.1",
12+
"nativescript-plugin-firebase": "file:../publish/package/nativescript-plugin-firebase-7.0.1.tgz",
1313
"nativescript-theme-core": "^1.0.4",
1414
"nativescript-unit-test-runner": "^0.3.4",
15-
"tns-core-modules": "~4.2.0"
15+
"tns-core-modules": "^4.3.0-2018-09-20-01"
1616
},
1717
"devDependencies": {
1818
"@types/jasmine": "~2.8.0",

src/functions/functions.ios.ts

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,45 @@
11
import {HttpsCallable} from './functions';
2+
import { firebaseUtils } from '../utils';
23

34

45
export function httpsCallable< I = {}, O = {} >( functionName: string ): HttpsCallable<I, O> {
56

67
const functions = FIRFunctions.functions();
78

89
return (data: I ) => new Promise((resolve, reject) => {
9-
functions.HTTPSCallableWithName(functionName).callWithObjectCompletion(data, (result: FIRHTTPSCallableResult, err: NSError) => {
10-
if ( err ) {
11-
if ( err.domain === FIRFunctionsErrorDomain ) {
12-
const message = err.localizedDescription;
13-
reject( message );
10+
11+
const callable = functions.HTTPSCallableWithName(functionName);
12+
13+
if ( data ) {
14+
callable.callWithObjectCompletion(data, (result: FIRHTTPSCallableResult, err: NSError) => {
15+
if ( err ) {
16+
if ( err.domain === FIRFunctionsErrorDomain ) {
17+
const message = err.localizedDescription;
18+
reject( message );
19+
}
20+
21+
reject( err.localizedDescription );
22+
}
23+
24+
if ( result ) {
25+
console.dir(result);
26+
resolve(result.data as O);
27+
}
28+
});
29+
} else {
30+
callable.callWithCompletion((result: FIRHTTPSCallableResult, err: NSError) => {
31+
if ( err ) {
32+
if ( err.domain === FIRFunctionsErrorDomain ) {
33+
const message = err.localizedDescription;
34+
reject( message );
35+
}
36+
reject( err.localizedDescription );
37+
}
38+
if ( result ) {
39+
console.dir(result);
40+
resolve(result.data as O);
1441
}
15-
}
16-
resolve(result.data as O);
17-
});
42+
});
43+
}
1844
});
1945
}

0 commit comments

Comments
 (0)