Skip to content

Commit b797738

Browse files
committed
Some changes to use the OkHttp NuGet instead of the embedded version
- Using the Square.OkHttp NuGet instead of embedding the jar - Make the component include the NuGet installation - Updated the sample project files
1 parent 2f0ef1e commit b797738

16 files changed

+87
-35
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ build/
55
*.userprefs
66
build/
77
*.xam
8+
packages

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "vendor/okhttp"]
2-
path = vendor/okhttp
3-
url = https://github.com/paulcbetts/OkHttp-Xamarin.git

Makefile

+4-12
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,20 @@ package: ModernHttpClient.iOS.dll ModernHttpClient.iOS64.dll ModernHttpClient.An
88
mono vendor/nuget/NuGet.exe pack ./ModernHttpClient.nuspec
99
mv modernhttpclient*.nupkg ./build/
1010

11-
submodule:
12-
git submodule sync
13-
git submodule update --init --recursive
14-
15-
OkHttp.dll: submodule
16-
$(MDTOOL) build -c:Release ./vendor/okhttp/OkHttp/OkHttp.csproj
17-
cp ./vendor/okhttp/OkHttp/bin/Release/OkHttp.dll ./vendor/okhttp/OkHttp.dll
18-
19-
ModernHttpClient.Android.dll: OkHttp.dll
11+
ModernHttpClient.Android.dll:
2012
$(MDTOOL) build -c:Release ./src/ModernHttpClient/ModernHttpClient.Android.csproj
2113
mkdir -p ./build/MonoAndroid
22-
mv ./src/ModernHttpClient/bin/Release/MonoAndroid/* ./build/MonoAndroid
14+
mv ./src/ModernHttpClient/bin/Release/MonoAndroid/Modern* ./build/MonoAndroid
2315

2416
ModernHttpClient.iOS.dll:
2517
$(MDTOOL) build -c:Release ./src/ModernHttpClient/ModernHttpClient.iOS.csproj
2618
mkdir -p ./build/MonoTouch
27-
mv ./src/ModernHttpClient/bin/Release/MonoTouch/* ./build/MonoTouch
19+
mv ./src/ModernHttpClient/bin/Release/MonoTouch/Modern* ./build/MonoTouch
2820

2921
ModernHttpClient.iOS64.dll:
3022
$(MDTOOL) build -c:Release ./src/ModernHttpClient/ModernHttpClient.iOS64.csproj
3123
mkdir -p ./build/Xamarin.iOS10
32-
mv ./src/ModernHttpClient/bin/Release/Xamarin.iOS10/* ./build/Xamarin.iOS10
24+
mv ./src/ModernHttpClient/bin/Release/Xamarin.iOS10/Modern* ./build/Xamarin.iOS10
3325

3426
ModernHttpClient.Portable.dll:
3527
$(MDTOOL) build -c:Release ./src/ModernHttpClient/ModernHttpClient.Portable.csproj

ModernHttpClient.nuspec

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
<description>Write your app using System.Net.Http, but drop this library in and it will go drastically faster.</description>
1313
<summary>Write your app using System.Net.Http, but drop this library in and it will go drastically faster.</summary>
1414
<copyright>Copyright Paul Betts © 2012</copyright>
15+
<dependencies>
16+
<dependency id="Square.OkHttp" version="2.4.0.3" />
17+
</dependencies>
1518
</metadata>
1619

1720
<files>

component/component.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,16 @@ libraries:
1818
ios-unified:
1919
- ../build/Xamarin.iOS10/ModernHttpClient.dll
2020
android:
21-
- ../build/MonoAndroid/OkHttp.dll
2221
- ../build/MonoAndroid/ModernHttpClient.dll
22+
is_shell: true
23+
packages:
24+
android:
25+
- Square.OkHttp, Version=2.4.0.3
26+
- modernhttpclient, Version=2.4.2
27+
ios:
28+
- modernhttpclient, Version=2.4.2
29+
ios-unified:
30+
- modernhttpclient, Version=2.4.2
2331
samples:
2432
- name: "HttpClient.iOS Unified API Sample"
2533
path: ../samples/HttpClient.iOS/HttpClient.iOS.sln

samples/HttpClient.Android/HttpClient.Android.csproj

+8-4
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,22 @@
3838
<WarningLevel>4</WarningLevel>
3939
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
4040
<ConsolePause>false</ConsolePause>
41-
<AndroidSupportedAbis>armeabi,armeabi-v7a</AndroidSupportedAbis>
41+
<AndroidSupportedAbis>armeabi;armeabi-v7a;x86;arm64-v8a;x86_64</AndroidSupportedAbis>
4242
</PropertyGroup>
4343
<ItemGroup>
4444
<Reference Include="System" />
4545
<Reference Include="System.Xml" />
4646
<Reference Include="System.Core" />
4747
<Reference Include="Mono.Android" />
4848
<Reference Include="System.Net.Http" />
49-
<Reference Include="ModernHttpClient.Android">
49+
<Reference Include="ModernHttpClient">
5050
<HintPath>..\..\build\MonoAndroid\ModernHttpClient.dll</HintPath>
5151
</Reference>
52-
<Reference Include="OkHttp">
53-
<HintPath>..\..\build\MonoAndroid\OkHttp.dll</HintPath>
52+
<Reference Include="Square.OkIO">
53+
<HintPath>packages\Square.OkIO.1.5.0.0\lib\MonoAndroid\Square.OkIO.dll</HintPath>
54+
</Reference>
55+
<Reference Include="Square.OkHttp">
56+
<HintPath>packages\Square.OkHttp.2.4.0.3\lib\MonoAndroid\Square.OkHttp.dll</HintPath>
5457
</Reference>
5558
</ItemGroup>
5659
<ItemGroup>
@@ -65,6 +68,7 @@
6568
<None Include="Resources\AboutResources.txt" />
6669
<None Include="Assets\AboutAssets.txt" />
6770
<None Include="Properties\AndroidManifest.xml" />
71+
<None Include="packages.config" />
6872
</ItemGroup>
6973
<ItemGroup>
7074
<AndroidResource Include="Resources\layout\Main.axml" />
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="HttpClient.Android">
3-
<uses-sdk android:minSdkVersion="8" />
4-
<application android:label="HttpClient.Android">
3+
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10" />
4+
<application android:label="HttpClient.Android" android:icon="@drawable/icon">
55
</application>
6-
<uses-permission android:name="android.permission.INTERNET" />
6+
<uses-permission android:name="android.permission.INTERNET" />
77
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Square.OkHttp" version="2.4.0.3" targetFramework="MonoAndroid23" />
4+
<package id="Square.OkIO" version="1.5.0.0" targetFramework="MonoAndroid23" />
5+
</packages>

samples/HttpClient.iOS/HttpClient.csproj

+15-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
<WarningLevel>4</WarningLevel>
2323
<MtouchDebug>True</MtouchDebug>
2424
<MtouchLink>None</MtouchLink>
25-
<MtouchSdkVersion>7.0</MtouchSdkVersion>
2625
<MtouchI18n>
2726
</MtouchI18n>
28-
<MtouchArch>ARMv7, ARM64</MtouchArch>
27+
<MtouchArch>i386, x86_64</MtouchArch>
28+
<MtouchUseRefCounting>true</MtouchUseRefCounting>
2929
</PropertyGroup>
3030
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
3131
<DebugType>none</DebugType>
@@ -34,6 +34,11 @@
3434
<ErrorReport>prompt</ErrorReport>
3535
<WarningLevel>4</WarningLevel>
3636
<MtouchLink>None</MtouchLink>
37+
<CodesignKey>iPhone Developer</CodesignKey>
38+
<MtouchUseRefCounting>true</MtouchUseRefCounting>
39+
<MtouchI18n>
40+
</MtouchI18n>
41+
<MtouchArch>i386, x86_64</MtouchArch>
3742
</PropertyGroup>
3843
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
3944
<DebugSymbols>True</DebugSymbols>
@@ -49,7 +54,8 @@
4954
</IpaPackageName>
5055
<MtouchI18n>
5156
</MtouchI18n>
52-
<MtouchArch>ARMv7, ARM64</MtouchArch>
57+
<MtouchArch>ARMv7, ARMv7s, ARM64</MtouchArch>
58+
<MtouchUseRefCounting>true</MtouchUseRefCounting>
5359
</PropertyGroup>
5460
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
5561
<DebugType>none</DebugType>
@@ -58,7 +64,12 @@
5864
<ErrorReport>prompt</ErrorReport>
5965
<WarningLevel>4</WarningLevel>
6066
<CodesignKey>iPhone Developer</CodesignKey>
61-
<MtouchArch>ARMv7, ARM64</MtouchArch>
67+
<MtouchArch>ARMv7, ARMv7s, ARM64</MtouchArch>
68+
<MtouchUseRefCounting>true</MtouchUseRefCounting>
69+
<IpaPackageName>
70+
</IpaPackageName>
71+
<MtouchI18n>
72+
</MtouchI18n>
6273
</PropertyGroup>
6374
<ItemGroup>
6475
<Reference Include="System" />

samples/HttpClient.iOS/Info.plist

+14
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,19 @@
2828
<string>UIInterfaceOrientationLandscapeLeft</string>
2929
<string>UIInterfaceOrientationLandscapeRight</string>
3030
</array>
31+
<key>UISupportedInterfaceOrientations~ipad</key>
32+
<array>
33+
<string>UIInterfaceOrientationPortrait</string>
34+
<string>UIInterfaceOrientationLandscapeLeft</string>
35+
<string>UIInterfaceOrientationLandscapeRight</string>
36+
</array>
37+
<key>CFBundleIdentifier</key>
38+
<string>com.modernhttpclient.httpclient</string>
39+
<key>CFBundleDisplayName</key>
40+
<string>HttpClient</string>
41+
<key>CFBundleShortVersionString</key>
42+
<string>1.0</string>
43+
<key>CFBundleVersion</key>
44+
<string>1.0</string>
3145
</dict>
3246
</plist>

src/ModernHttpClient/Android/OkHttpNetworkHandler.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Linq;
66
using System.Net;
77
using System.Net.Http;
8-
using OkHttp;
8+
using Square.OkHttp;
99
using Javax.Net.Ssl;
1010
using System.Text.RegularExpressions;
1111
using Java.IO;

src/ModernHttpClient/ModernHttpClient.Android.csproj

+7-3
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,16 @@
5454
<Folder Include="Properties\" />
5555
<Compile Include="Properties\AssemblyInfo.cs" />
5656
<Compile Include="ProgressStreamContent.cs" />
57-
<Reference Include="OkHttp">
58-
<HintPath>..\..\vendor\okhttp\OkHttp.dll</HintPath>
59-
</Reference>
6057
<Compile Include="Utility.cs" />
6158
<Compile Include="CaptiveNetworkException.cs" />
6259
<Compile Include="Android\NativeCookieHandler.cs" />
60+
<Reference Include="Square.OkIO">
61+
<HintPath>..\..\packages\Square.OkIO.1.5.0.0\lib\MonoAndroid\Square.OkIO.dll</HintPath>
62+
</Reference>
63+
<None Include="packages.config" />
64+
<Reference Include="Square.OkHttp">
65+
<HintPath>..\..\packages\Square.OkHttp.2.4.0.3\lib\MonoAndroid\Square.OkHttp.dll</HintPath>
66+
</Reference>
6367
</ItemGroup>
6468
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
6569
</Project>

src/ModernHttpClient/packages.config

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Square.OkHttp" version="2.4.0.3" targetFramework="MonoAndroid23" />
4+
<package id="Square.OkIO" version="1.5.0.0" targetFramework="MonoAndroid23" />
5+
</packages>

src/Playground.Android/Playground.Android.csproj

+7-3
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,13 @@
5050
<Reference Include="System.Xml" />
5151
<Reference Include="System.Core" />
5252
<Reference Include="Mono.Android" />
53-
<Reference Include="OkHttp">
54-
<HintPath>..\..\vendor\okhttp\OkHttp.dll</HintPath>
55-
</Reference>
5653
<Reference Include="System.Net.Http" />
54+
<Reference Include="Square.OkIO">
55+
<HintPath>..\..\packages\Square.OkIO.1.5.0.0\lib\MonoAndroid\Square.OkIO.dll</HintPath>
56+
</Reference>
57+
<Reference Include="Square.OkHttp">
58+
<HintPath>..\..\packages\Square.OkHttp.2.4.0.3\lib\MonoAndroid\Square.OkHttp.dll</HintPath>
59+
</Reference>
5760
</ItemGroup>
5861
<ItemGroup>
5962
<Compile Include="MainActivity.cs" />
@@ -64,6 +67,7 @@
6467
<None Include="Resources\AboutResources.txt" />
6568
<None Include="Assets\AboutAssets.txt" />
6669
<None Include="Properties\AndroidManifest.xml" />
70+
<None Include="packages.config" />
6771
</ItemGroup>
6872
<ItemGroup>
6973
<AndroidResource Include="Resources\layout\Main.axml" />
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Square.OkHttp" version="2.4.0.3" targetFramework="MonoAndroid403" />
4+
<package id="Square.OkIO" version="1.5.0.0" targetFramework="MonoAndroid403" />
5+
</packages>

vendor/okhttp

-1
This file was deleted.

0 commit comments

Comments
 (0)