Skip to content

Commit fb2ef7c

Browse files
committed
updated sample
1 parent 598196d commit fb2ef7c

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

samples/GoogleClientSample/GoogleClientSample.Android/GoogleClientSample.Android.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@
5757
<PackageReference Include="PropertyChanged.Fody">
5858
<Version>2.6.1</Version>
5959
</PackageReference>
60-
<PackageReference Include="Plugin.GoogleClient">
61-
<Version>2.0.17-beta</Version>
62-
</PackageReference>
6360
<PackageReference Include="Xamarin.Android.Support.Annotations">
6461
<Version>28.0.0.3</Version>
6562
</PackageReference>
@@ -87,6 +84,9 @@
8784
<PackageReference Include="Xamarin.GooglePlayServices.Basement">
8885
<Version>71.1620.0</Version>
8986
</PackageReference>
87+
<PackageReference Include="Plugin.GoogleClient">
88+
<Version>2.0.18-beta</Version>
89+
</PackageReference>
9090
</ItemGroup>
9191
<ItemGroup>
9292
<Compile Include="MainActivity.cs" />

samples/GoogleClientSample/GoogleClientSample.iOS/GoogleClientSample.iOS.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@
127127
<PackageReference Include="PropertyChanged.Fody">
128128
<Version>2.6.1</Version>
129129
</PackageReference>
130-
<PackageReference Include="Plugin.GoogleClient">
131-
<Version>2.0.17-beta</Version>
132-
</PackageReference>
133130
<PackageReference Include="Xamarin.Firebase.iOS.Core">
134131
<Version>6.1.0</Version>
135132
</PackageReference>
@@ -139,6 +136,9 @@
139136
<PackageReference Include="Xamarin.Google.iOS.SignIn">
140137
<Version>5.0.1</Version>
141138
</PackageReference>
139+
<PackageReference Include="Plugin.GoogleClient">
140+
<Version>2.0.18-beta</Version>
141+
</PackageReference>
142142
</ItemGroup>
143143
<ItemGroup>
144144
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />

src/Plugin.GoogleClient/GoogleClientManager.apple.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ params string[] scopes
6565
)
6666
{
6767
SignIn.SharedInstance.Delegate = CrossGoogleClient.Current as ISignInDelegate;
68-
if (scopes.Length > 0)
68+
if (scopes != null && scopes.Length > 0)
6969
{
7070

7171
var currentScopes = SignIn.SharedInstance.Scopes;
@@ -170,8 +170,7 @@ public async Task<GoogleResponse<GoogleUser>> SilentLoginAsync()
170170
}
171171

172172
//SignIn.SharedInstance.CurrentUser.Authentication.ClientId != _clientId
173-
var task = CreateLoginTask();
174-
173+
_loginTcs = new TaskCompletionSource<GoogleResponse<GoogleUser>>();
175174

176175
if (SignIn.SharedInstance.HasPreviousSignIn)
177176
SignIn.SharedInstance.RestorePreviousSignIn();
@@ -191,8 +190,8 @@ public async Task<GoogleResponse<GoogleUser>> SilentLoginAsync()
191190
_onError?.Invoke(this, errorEventArgs);
192191
_loginTcs.TrySetException(new GoogleClientBaseException());
193192
}
194-
195-
return await task;
193+
194+
return await _loginTcs.Task;
196195
}
197196

198197
public static bool OnOpenUrl(UIApplication app, NSUrl url, NSDictionary options)
@@ -306,13 +305,6 @@ private void UpdatePresentedViewController()
306305
}
307306

308307

309-
private static Task<GoogleResponse<GoogleUser>> CreateLoginTask()
310-
{
311-
_loginTcs = new TaskCompletionSource<GoogleResponse<GoogleUser>>();
312-
313-
return _loginTcs.Task;
314-
}
315-
316308
private void OnSignInSuccessful(Google.SignIn.GoogleUser user)
317309
{
318310
GoogleUser googleUser = new GoogleUser

0 commit comments

Comments
 (0)