Skip to content

Commit fd850f9

Browse files
committed
chore: working on alamofire
1 parent 12f85ee commit fd850f9

File tree

8 files changed

+212
-151
lines changed

8 files changed

+212
-151
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
2+
3+
<?xml version="1.0" encoding="UTF-8"?>
4+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
5+
<plist version="1.0">
6+
<dict>
7+
<key>CFBundleDevelopmentRegion</key>
8+
<string>en</string>
9+
<key>CFBundleDisplayName</key>
10+
<string>${PRODUCT_NAME}</string>
11+
<key>CFBundleExecutable</key>
12+
<string>${EXECUTABLE_NAME}</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>${PRODUCT_NAME}</string>
17+
<key>CFBundlePackageType</key>
18+
<string>APPL</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>1.0</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
<key>CFBundleSignature</key>
24+
<string>????</string>
25+
<key>CFBundleVersion</key>
26+
<string>1.0</string>
27+
<key>LSRequiresIPhoneOS</key>
28+
<true/>
29+
<key>UILaunchStoryboardName</key>
30+
<string>LaunchScreen</string>
31+
<key>UIRequiresFullScreen</key>
32+
<true/>
33+
<key>UIRequiredDeviceCapabilities</key>
34+
<array>
35+
<string>armv7</string>
36+
</array>
37+
<key>UISupportedInterfaceOrientations</key>
38+
<array>
39+
<string>UIInterfaceOrientationPortrait</string>
40+
<string>UIInterfaceOrientationLandscapeLeft</string>
41+
<string>UIInterfaceOrientationLandscapeRight</string>
42+
</array>
43+
<key>UISupportedInterfaceOrientations~ipad</key>
44+
<array>
45+
<string>UIInterfaceOrientationPortrait</string>
46+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
47+
<string>UIInterfaceOrientationLandscapeLeft</string>
48+
<string>UIInterfaceOrientationLandscapeRight</string>
49+
</array>
50+
<key>NSAppTransportSecurity</key>
51+
<dict>
52+
<key>NSExceptionDomains</key>
53+
<dict>
54+
<key>domain.com</key>
55+
<dict>
56+
<key>NSExceptionAllowsInsecureHTTPLoads</key>
57+
<true/>
58+
<key>NSIncludesSubdomains</key>
59+
<true/>
60+
</dict>
61+
</dict>
62+
</dict>
63+
</dict>
64+
</plist>

demo-snippets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"private": true,
44
"version": "0.0.1",
55
"dependencies": {
6-
"@nativescript-community/https": "4.0.11"
6+
"@nativescript-community/https": "*"
77
},
88
"nativescript": {
99
"platforms": {

demo-snippets/vue/BasicRequests.vue

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,31 @@
1212
<StackLayout class="p-20">
1313
<!-- GET Requests -->
1414
<Label class="h4 mt-20" text="GET Requests" />
15-
<Button text="GET - Simple Request" @tap="testGet" class="btn btn-primary" />
16-
<Button text="GET - With Query Params" @tap="testGetWithParams" class="btn btn-primary" />
17-
<Button text="GET - With Headers" @tap="testGetWithHeaders" class="btn btn-primary" />
18-
<Button text="GET - JSON Response" @tap="testGetJSON" class="btn btn-primary" />
19-
15+
<Button text="GET - Simple Request" class="btn btn-primary" @tap="testGet" />
16+
<Button text="GET - With Query Params" class="btn btn-primary" @tap="testGetWithParams" />
17+
<Button text="GET - With Headers" class="btn btn-primary" @tap="testGetWithHeaders" />
18+
<Button text="GET - JSON Response" class="btn btn-primary" @tap="testGetJSON" />
19+
2020
<!-- POST Requests -->
2121
<Label class="h4 mt-20" text="POST Requests" />
22-
<Button text="POST - JSON Body" @tap="testPostJSON" class="btn btn-primary" />
23-
<Button text="POST - Form Data" @tap="testPostForm" class="btn btn-primary" />
24-
<Button text="POST - With UTF-8" @tap="testPostUTF8" class="btn btn-primary" />
25-
22+
<Button text="POST - JSON Body" class="btn btn-primary" @tap="testPostJSON" />
23+
<Button text="POST - Form Data" class="btn btn-primary" @tap="testPostForm" />
24+
<Button text="POST - With UTF-8" class="btn btn-primary" @tap="testPostUTF8" />
25+
2626
<!-- Other Methods -->
2727
<Label class="h4 mt-20" text="Other HTTP Methods" />
28-
<Button text="PUT Request" @tap="testPut" class="btn btn-primary" />
29-
<Button text="PATCH Request" @tap="testPatch" class="btn btn-primary" />
30-
<Button text="DELETE Request" @tap="testDelete" class="btn btn-primary" />
31-
<Button text="HEAD Request" @tap="testHead" class="btn btn-primary" />
32-
<Button text="OPTIONS Request" @tap="testOptions" class="btn btn-primary" />
33-
28+
<Button text="PUT Request" class="btn btn-primary" @tap="testPut" />
29+
<Button text="PATCH Request" class="btn btn-primary" @tap="testPatch" />
30+
<Button text="DELETE Request" class="btn btn-primary" @tap="testDelete" />
31+
<Button text="HEAD Request" class="btn btn-primary" @tap="testHead" />
32+
<Button text="OPTIONS Request" class="btn btn-primary" @tap="testOptions" />
33+
3434
<!-- Response Format Tests -->
3535
<Label class="h4 mt-20" text="Response Format Tests" />
36-
<Button text="Test toString()" @tap="testToString" class="btn btn-primary" />
37-
<Button text="Test toJSON()" @tap="testToJSON" class="btn btn-primary" />
38-
<Button text="Test toArrayBuffer()" @tap="testToArrayBuffer" class="btn btn-primary" />
39-
36+
<Button text="Test toString()" class="btn btn-primary" @tap="testToString" />
37+
<Button text="Test toJSON()" class="btn btn-primary" @tap="testToJSON" />
38+
<Button text="Test toArrayBuffer()" class="btn btn-primary" @tap="testToArrayBuffer" />
39+
4040
<!-- Results -->
4141
<Label class="h4 mt-20" text="Results" />
4242
<TextView :text="results" class="result-box" editable="false" />
@@ -62,7 +62,7 @@ export default Vue.extend({
6262
this.results = `[${timestamp}] ${message}\n\n${this.results}`;
6363
console.log(message);
6464
},
65-
65+
6666
async testGet() {
6767
try {
6868
this.log('Testing GET request...');
@@ -76,7 +76,7 @@ export default Vue.extend({
7676
this.log(`✗ GET failed: ${error}`);
7777
}
7878
},
79-
79+
8080
async testGetWithParams() {
8181
try {
8282
this.log('Testing GET with query params...');
@@ -96,7 +96,7 @@ export default Vue.extend({
9696
this.log(`✗ GET with params failed: ${error}`);
9797
}
9898
},
99-
99+
100100
async testGetWithHeaders() {
101101
try {
102102
this.log('Testing GET with custom headers...');
@@ -106,7 +106,7 @@ export default Vue.extend({
106106
headers: {
107107
'X-Custom-Header': 'test-value',
108108
'X-API-Key': 'dummy-key-123',
109-
'Accept': 'application/json'
109+
Accept: 'application/json'
110110
}
111111
});
112112
this.log(`✓ GET with headers success: ${response.statusCode}`);
@@ -116,7 +116,7 @@ export default Vue.extend({
116116
this.log(`✗ GET with headers failed: ${error}`);
117117
}
118118
},
119-
119+
120120
async testGetJSON() {
121121
try {
122122
this.log('Testing GET JSON endpoint...');
@@ -131,7 +131,7 @@ export default Vue.extend({
131131
this.log(`✗ GET JSON failed: ${error}`);
132132
}
133133
},
134-
134+
135135
async testPostJSON() {
136136
try {
137137
this.log('Testing POST with JSON body...');
@@ -155,7 +155,7 @@ export default Vue.extend({
155155
this.log(`✗ POST JSON failed: ${error}`);
156156
}
157157
},
158-
158+
159159
async testPostForm() {
160160
try {
161161
this.log('Testing POST with form data...');
@@ -177,7 +177,7 @@ export default Vue.extend({
177177
this.log(`✗ POST form failed: ${error}`);
178178
}
179179
},
180-
180+
181181
async testPostUTF8() {
182182
try {
183183
this.log('Testing POST with UTF-8 characters...');
@@ -200,7 +200,7 @@ export default Vue.extend({
200200
this.log(`✗ POST UTF-8 failed: ${error}`);
201201
}
202202
},
203-
203+
204204
async testPut() {
205205
try {
206206
this.log('Testing PUT request...');
@@ -218,7 +218,7 @@ export default Vue.extend({
218218
this.log(`✗ PUT failed: ${error}`);
219219
}
220220
},
221-
221+
222222
async testPatch() {
223223
try {
224224
this.log('Testing PATCH request...');
@@ -235,7 +235,7 @@ export default Vue.extend({
235235
this.log(`✗ PATCH failed: ${error}`);
236236
}
237237
},
238-
238+
239239
async testDelete() {
240240
try {
241241
this.log('Testing DELETE request...');
@@ -249,7 +249,7 @@ export default Vue.extend({
249249
this.log(`✗ DELETE failed: ${error}`);
250250
}
251251
},
252-
252+
253253
async testHead() {
254254
try {
255255
this.log('Testing HEAD request...');
@@ -264,7 +264,7 @@ export default Vue.extend({
264264
this.log(`✗ HEAD failed: ${error}`);
265265
}
266266
},
267-
267+
268268
async testOptions() {
269269
try {
270270
this.log('Testing OPTIONS request...');
@@ -278,7 +278,7 @@ export default Vue.extend({
278278
this.log(`✗ OPTIONS failed: ${error}`);
279279
}
280280
},
281-
281+
282282
async testToString() {
283283
try {
284284
this.log('Testing toString() method...');
@@ -294,7 +294,7 @@ export default Vue.extend({
294294
this.log(`✗ toString() failed: ${error}`);
295295
}
296296
},
297-
297+
298298
async testToJSON() {
299299
try {
300300
this.log('Testing toJSON() method...');
@@ -310,7 +310,7 @@ export default Vue.extend({
310310
this.log(`✗ toJSON() failed: ${error}`);
311311
}
312312
},
313-
313+
314314
async testToArrayBuffer() {
315315
try {
316316
this.log('Testing toArrayBuffer() method...');

demo-snippets/vue/install.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import Vue from 'nativescript-vue';
22
import Basic from './Basic.vue';
3+
import CachingAndCookies from './CachingAndCookies.vue';
4+
import BasicRequests from './BasicRequests.vue';
5+
import ConditionalStreaming from './ConditionalStreaming.vue';
6+
import EarlyResolution from './EarlyResolution.vue';
7+
import ErrorHandling from './ErrorHandling.vue';
8+
import FileOperations from './FileOperations.vue';
9+
import ProgressAndCancellation from './ProgressAndCancellation.vue';
10+
import SSLPinning from './SSLPinning.vue';
311
import * as Https from '@nativescript-community/https';
412
import * as fs from '@nativescript/core/file-system';
513

@@ -15,4 +23,14 @@ Https.setCache({
1523

1624
export function installPlugin() {}
1725

18-
export const demos = [{ name: 'Basic', path: 'basic', component: Basic }];
26+
export const demos = [
27+
{ name: 'Basic', path: 'basic', component: Basic },
28+
{ name: 'BasicRequests', path: 'BasicRequests', component: BasicRequests },
29+
{ name: 'CachingAndCookies', path: 'CachingAndCookies', component: CachingAndCookies },
30+
{ name: 'ConditionalStreaming', path: 'ConditionalStreaming', component: ConditionalStreaming },
31+
{ name: 'EarlyResolution', path: 'EarlyResolution', component: EarlyResolution },
32+
{ name: 'ErrorHandling', path: 'ErrorHandling', component: ErrorHandling },
33+
{ name: 'FileOperations', path: 'FileOperations', component: FileOperations },
34+
{ name: 'ProgressAndCancellation', path: 'ProgressAndCancellation', component: ProgressAndCancellation },
35+
{ name: 'SSLPinning', path: 'SSLPinning', component: SSLPinning },
36+
];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pod 'Alamofire', '~> 5.9'
1+
pod 'Alamofire', '~> 5.11.2'

packages/https/platforms/ios/src/SecurityPolicyWrapper.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ extension SecurityPolicyWrapper: ServerTrustEvaluating {
7373
let isValid = SecTrustEvaluateWithError(trust, &error)
7474

7575
if !isValid && !allowInvalidCertificates {
76-
throw AFError.serverTrustEvaluationFailed(reason: .defaultEvaluationFailed(output: .init()))
76+
throw AFError.serverTrustEvaluationFailed(reason: .trustEvaluationFailed(error: error))
7777
}
7878
return
7979
}
@@ -144,7 +144,7 @@ extension SecurityPolicyWrapper: ServerTrustEvaluating {
144144
let isValid = SecTrustEvaluateWithError(trust, &error)
145145

146146
if !isValid && !allowInvalidCertificates {
147-
throw AFError.serverTrustEvaluationFailed(reason: .defaultEvaluationFailed(output: .init()))
147+
throw AFError.serverTrustEvaluationFailed(reason: .trustEvaluationFailed(error: error))
148148
}
149149
}
150150
}

0 commit comments

Comments
 (0)