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

Commit 620a059

Browse files
authored
[google_sign_in] Renames generated folder to js_interop. (#6915)
* Renames generated to js_interop * Fix analyze errors * Fix format * Fix version check * Add comment for public_member_api_docs
1 parent b1797c2 commit 620a059

File tree

8 files changed

+67
-70
lines changed

8 files changed

+67
-70
lines changed

packages/google_sign_in/google_sign_in_web/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
## NEXT
1+
## 0.10.2+1
22

33
* Updates code for `no_leading_underscores_for_local_identifiers` lint.
44
* Updates minimum Flutter version to 2.10.
5+
* Renames generated folder to js_interop.
56

67
## 0.10.2
78

packages/google_sign_in/google_sign_in_web/example/integration_test/gapi_utils_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// found in the LICENSE file.
44

55
import 'package:flutter_test/flutter_test.dart';
6-
import 'package:google_sign_in_web/src/generated/gapiauth2.dart' as gapi;
6+
import 'package:google_sign_in_web/src/js_interop/gapiauth2.dart' as gapi;
77
import 'package:google_sign_in_web/src/utils.dart';
88
import 'package:integration_test/integration_test.dart';
99

packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import 'package:flutter_web_plugins/flutter_web_plugins.dart';
1111
import 'package:google_sign_in_platform_interface/google_sign_in_platform_interface.dart';
1212
import 'package:js/js.dart';
1313

14-
import 'src/generated/gapiauth2.dart' as auth2;
14+
import 'src/js_interop/gapiauth2.dart' as auth2;
1515
import 'src/load_gapi.dart' as gapi;
1616
import 'src/utils.dart' show gapiUserToPluginUserData;
1717

packages/google_sign_in/google_sign_in_web/lib/src/generated/gapi.dart renamed to packages/google_sign_in/google_sign_in_web/lib/src/js_interop/gapi.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@
1010
1111
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/gapi
1212

13-
// ignore_for_file: public_member_api_docs, unused_element, sort_constructors_first, prefer_generic_function_type_aliases
13+
// ignore_for_file: public_member_api_docs,
14+
// * public_member_api_docs originally undocumented because the file was
15+
// autogenerated.
1416

1517
@JS()
1618
library gapi;
1719

1820
import 'package:js/js.dart';
1921

2022
// Module gapi
21-
typedef void LoadCallback(
23+
typedef LoadCallback = void Function(
2224
[dynamic args1,
2325
dynamic args2,
2426
dynamic args3,
@@ -28,6 +30,11 @@ typedef void LoadCallback(
2830
@anonymous
2931
@JS()
3032
abstract class LoadConfig {
33+
external factory LoadConfig(
34+
{LoadCallback callback,
35+
Function? onerror,
36+
num? timeout,
37+
Function? ontimeout});
3138
external LoadCallback get callback;
3239
external set callback(LoadCallback v);
3340
external Function? get onerror;
@@ -36,11 +43,6 @@ abstract class LoadConfig {
3643
external set timeout(num? v);
3744
external Function? get ontimeout;
3845
external set ontimeout(Function? v);
39-
external factory LoadConfig(
40-
{LoadCallback callback,
41-
Function? onerror,
42-
num? timeout,
43-
Function? ontimeout});
4446
}
4547

4648
/*type CallbackOrConfig = LoadConfig | LoadCallback;*/

packages/google_sign_in/google_sign_in_web/lib/src/generated/gapiauth2.dart renamed to packages/google_sign_in/google_sign_in_web/lib/src/js_interop/gapiauth2.dart

Lines changed: 51 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
1313
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/gapi.auth2
1414

15-
// ignore_for_file: public_member_api_docs, unused_element, non_constant_identifier_names, sort_constructors_first, always_specify_types, strict_raw_type
15+
// ignore_for_file: public_member_api_docs, non_constant_identifier_names,
16+
// * public_member_api_docs originally undocumented because the file was
17+
// autogenerated.
18+
// * non_constant_identifier_names required to be able to use the same parameter
19+
// names as the underlying library.
1620

1721
@JS()
1822
library gapiauth2;
@@ -122,6 +126,15 @@ abstract class CurrentUser {
122126
@anonymous
123127
@JS()
124128
abstract class SigninOptions {
129+
external factory SigninOptions(
130+
{String app_package_name,
131+
bool fetch_basic_profile,
132+
String prompt,
133+
String scope,
134+
String /*'popup'|'redirect'*/ ux_mode,
135+
String redirect_uri,
136+
String login_hint});
137+
125138
/// The package name of the Android app to install over the air.
126139
/// See Android app installs from your web site:
127140
/// https://developers.google.com/identity/sign-in/web/android-app-installs
@@ -162,15 +175,6 @@ abstract class SigninOptions {
162175
// https://developers.google.com/identity/protocols/OpenIDConnect?hl=en#authenticationuriparameters
163176
external String? get login_hint;
164177
external set login_hint(String? v);
165-
166-
external factory SigninOptions(
167-
{String app_package_name,
168-
bool fetch_basic_profile,
169-
String prompt,
170-
String scope,
171-
String /*'popup'|'redirect'*/ ux_mode,
172-
String redirect_uri,
173-
String login_hint});
174178
}
175179

176180
/// Definitions by: John <https://github.com/jhcao23>
@@ -179,23 +183,35 @@ abstract class SigninOptions {
179183
@anonymous
180184
@JS()
181185
abstract class OfflineAccessOptions {
186+
external factory OfflineAccessOptions(
187+
{String scope,
188+
String /*'select_account'|'consent'*/ prompt,
189+
String app_package_name});
182190
external String? get scope;
183191
external set scope(String? v);
184192
external String? /*'select_account'|'consent'*/ get prompt;
185193
external set prompt(String? /*'select_account'|'consent'*/ v);
186194
external String? get app_package_name;
187195
external set app_package_name(String? v);
188-
external factory OfflineAccessOptions(
189-
{String scope,
190-
String /*'select_account'|'consent'*/ prompt,
191-
String app_package_name});
192196
}
193197

194198
/// Interface that represents the different configuration parameters for the gapi.auth2.init method.
195199
/// Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2clientconfig
196200
@anonymous
197201
@JS()
198202
abstract class ClientConfig {
203+
external factory ClientConfig({
204+
String client_id,
205+
String cookie_policy,
206+
String scope,
207+
bool fetch_basic_profile,
208+
String? hosted_domain,
209+
String openid_realm,
210+
String /*'popup'|'redirect'*/ ux_mode,
211+
String redirect_uri,
212+
String plugin_name,
213+
});
214+
199215
/// The app's client ID, found and created in the Google Developers Console.
200216
external String? get client_id;
201217
external set client_id(String? v);
@@ -238,18 +254,6 @@ abstract class ClientConfig {
238254
/// See: https://github.com/flutter/flutter/issues/88084
239255
external String? get plugin_name;
240256
external set plugin_name(String? v);
241-
242-
external factory ClientConfig({
243-
String client_id,
244-
String cookie_policy,
245-
String scope,
246-
bool fetch_basic_profile,
247-
String? hosted_domain,
248-
String openid_realm,
249-
String /*'popup'|'redirect'*/ ux_mode,
250-
String redirect_uri,
251-
String plugin_name,
252-
});
253257
}
254258

255259
@JS('gapi.auth2.SigninOptionsBuilder')
@@ -290,20 +294,23 @@ abstract class AuthResponse {
290294
external set first_issued_at(num? v);
291295
external num? get expires_at;
292296
external set expires_at(num? v);
293-
external factory AuthResponse(
294-
{String? access_token,
295-
String? id_token,
296-
String? login_hint,
297-
String? scope,
298-
num? expires_in,
299-
num? first_issued_at,
300-
num? expires_at});
301297
}
302298

303299
/// Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2authorizeconfig
304300
@anonymous
305301
@JS()
306302
abstract class AuthorizeConfig {
303+
external factory AuthorizeConfig(
304+
{String client_id,
305+
String scope,
306+
String response_type,
307+
String prompt,
308+
String cookie_policy,
309+
String hosted_domain,
310+
String login_hint,
311+
String app_package_name,
312+
String openid_realm,
313+
bool include_granted_scopes});
307314
external String get client_id;
308315
external set client_id(String v);
309316
external String get scope;
@@ -324,23 +331,22 @@ abstract class AuthorizeConfig {
324331
external set openid_realm(String? v);
325332
external bool? get include_granted_scopes;
326333
external set include_granted_scopes(bool? v);
327-
external factory AuthorizeConfig(
328-
{String client_id,
329-
String scope,
330-
String response_type,
331-
String prompt,
332-
String cookie_policy,
333-
String hosted_domain,
334-
String login_hint,
335-
String app_package_name,
336-
String openid_realm,
337-
bool include_granted_scopes});
338334
}
339335

340336
/// Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2authorizeresponse
341337
@anonymous
342338
@JS()
343339
abstract class AuthorizeResponse {
340+
external factory AuthorizeResponse(
341+
{String access_token,
342+
String id_token,
343+
String code,
344+
String scope,
345+
num expires_in,
346+
num first_issued_at,
347+
num expires_at,
348+
String error,
349+
String error_subtype});
344350
external String get access_token;
345351
external set access_token(String v);
346352
external String get id_token;
@@ -359,16 +365,6 @@ abstract class AuthorizeResponse {
359365
external set error(String v);
360366
external String get error_subtype;
361367
external set error_subtype(String v);
362-
external factory AuthorizeResponse(
363-
{String access_token,
364-
String id_token,
365-
String code,
366-
String scope,
367-
num expires_in,
368-
num first_issued_at,
369-
num expires_at,
370-
String error,
371-
String error_subtype});
372368
}
373369

374370
/// A GoogleUser object represents one user account.
@@ -498,6 +494,4 @@ external void render(
498494
abstract class Promise<T> {
499495
external factory Promise(
500496
void Function(void Function(T result) resolve, Function reject) executor);
501-
external Promise then(void Function(T result) onFulfilled,
502-
[Function onRejected]);
503497
}

packages/google_sign_in/google_sign_in_web/lib/src/load_gapi.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'dart:async';
1010
import 'package:flutter/foundation.dart' show visibleForTesting;
1111
import 'package:js/js.dart';
1212

13-
import 'generated/gapi.dart' as gapi;
13+
import 'js_interop/gapi.dart' as gapi;
1414
import 'utils.dart' show injectJSLibraries;
1515

1616
@JS()

packages/google_sign_in/google_sign_in_web/lib/src/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'dart:html' as html;
77

88
import 'package:google_sign_in_platform_interface/google_sign_in_platform_interface.dart';
99

10-
import 'generated/gapiauth2.dart' as auth2;
10+
import 'js_interop/gapiauth2.dart' as auth2;
1111

1212
/// Injects a list of JS [libraries] as `script` tags into a [target] [html.HtmlElement].
1313
///

packages/google_sign_in/google_sign_in_web/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Flutter plugin for Google Sign-In, a secure authentication system
33
for signing in with a Google account on Android, iOS and Web.
44
repository: https://github.com/flutter/plugins/tree/main/packages/google_sign_in/google_sign_in_web
55
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
6-
version: 0.10.2
6+
version: 0.10.2+1
77

88
environment:
99
sdk: ">=2.12.0 <3.0.0"

0 commit comments

Comments
 (0)