[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
diff --git a/packages/google_sign_in/google_sign_in_web/CHANGELOG.md b/packages/google_sign_in/google_sign_in_web/CHANGELOG.md
index 2816e72..c5c5799 100644
--- a/packages/google_sign_in/google_sign_in_web/CHANGELOG.md
+++ b/packages/google_sign_in/google_sign_in_web/CHANGELOG.md
@@ -1,7 +1,8 @@
-## NEXT
+## 0.10.2+1
* Updates code for `no_leading_underscores_for_local_identifiers` lint.
* Updates minimum Flutter version to 2.10.
+* Renames generated folder to js_interop.
## 0.10.2
diff --git a/packages/google_sign_in/google_sign_in_web/example/integration_test/gapi_utils_test.dart b/packages/google_sign_in/google_sign_in_web/example/integration_test/gapi_utils_test.dart
index b341d1d..b9daac4 100644
--- a/packages/google_sign_in/google_sign_in_web/example/integration_test/gapi_utils_test.dart
+++ b/packages/google_sign_in/google_sign_in_web/example/integration_test/gapi_utils_test.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import 'package:flutter_test/flutter_test.dart';
-import 'package:google_sign_in_web/src/generated/gapiauth2.dart' as gapi;
+import 'package:google_sign_in_web/src/js_interop/gapiauth2.dart' as gapi;
import 'package:google_sign_in_web/src/utils.dart';
import 'package:integration_test/integration_test.dart';
diff --git a/packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart b/packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart
index c305cae..5d75c0d 100644
--- a/packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart
+++ b/packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart
@@ -11,7 +11,7 @@
import 'package:google_sign_in_platform_interface/google_sign_in_platform_interface.dart';
import 'package:js/js.dart';
-import 'src/generated/gapiauth2.dart' as auth2;
+import 'src/js_interop/gapiauth2.dart' as auth2;
import 'src/load_gapi.dart' as gapi;
import 'src/utils.dart' show gapiUserToPluginUserData;
diff --git a/packages/google_sign_in/google_sign_in_web/lib/src/generated/gapi.dart b/packages/google_sign_in/google_sign_in_web/lib/src/js_interop/gapi.dart
similarity index 90%
rename from packages/google_sign_in/google_sign_in_web/lib/src/generated/gapi.dart
rename to packages/google_sign_in/google_sign_in_web/lib/src/js_interop/gapi.dart
index a6d5b9d..3be4b2d 100644
--- a/packages/google_sign_in/google_sign_in_web/lib/src/generated/gapi.dart
+++ b/packages/google_sign_in/google_sign_in_web/lib/src/js_interop/gapi.dart
@@ -10,7 +10,9 @@
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/gapi
-// ignore_for_file: public_member_api_docs, unused_element, sort_constructors_first, prefer_generic_function_type_aliases
+// ignore_for_file: public_member_api_docs,
+// * public_member_api_docs originally undocumented because the file was
+// autogenerated.
@JS()
library gapi;
@@ -18,7 +20,7 @@
import 'package:js/js.dart';
// Module gapi
-typedef void LoadCallback(
+typedef LoadCallback = void Function(
[dynamic args1,
dynamic args2,
dynamic args3,
@@ -28,6 +30,11 @@
@anonymous
@JS()
abstract class LoadConfig {
+ external factory LoadConfig(
+ {LoadCallback callback,
+ Function? onerror,
+ num? timeout,
+ Function? ontimeout});
external LoadCallback get callback;
external set callback(LoadCallback v);
external Function? get onerror;
@@ -36,11 +43,6 @@
external set timeout(num? v);
external Function? get ontimeout;
external set ontimeout(Function? v);
- external factory LoadConfig(
- {LoadCallback callback,
- Function? onerror,
- num? timeout,
- Function? ontimeout});
}
/*type CallbackOrConfig = LoadConfig | LoadCallback;*/
diff --git a/packages/google_sign_in/google_sign_in_web/lib/src/generated/gapiauth2.dart b/packages/google_sign_in/google_sign_in_web/lib/src/js_interop/gapiauth2.dart
similarity index 97%
rename from packages/google_sign_in/google_sign_in_web/lib/src/generated/gapiauth2.dart
rename to packages/google_sign_in/google_sign_in_web/lib/src/js_interop/gapiauth2.dart
index f474e0d..35a2d08 100644
--- a/packages/google_sign_in/google_sign_in_web/lib/src/generated/gapiauth2.dart
+++ b/packages/google_sign_in/google_sign_in_web/lib/src/js_interop/gapiauth2.dart
@@ -12,7 +12,11 @@
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/gapi.auth2
-// ignore_for_file: public_member_api_docs, unused_element, non_constant_identifier_names, sort_constructors_first, always_specify_types, strict_raw_type
+// ignore_for_file: public_member_api_docs, non_constant_identifier_names,
+// * public_member_api_docs originally undocumented because the file was
+// autogenerated.
+// * non_constant_identifier_names required to be able to use the same parameter
+// names as the underlying library.
@JS()
library gapiauth2;
@@ -122,6 +126,15 @@
@anonymous
@JS()
abstract class SigninOptions {
+ external factory SigninOptions(
+ {String app_package_name,
+ bool fetch_basic_profile,
+ String prompt,
+ String scope,
+ String /*'popup'|'redirect'*/ ux_mode,
+ String redirect_uri,
+ String login_hint});
+
/// The package name of the Android app to install over the air.
/// See Android app installs from your web site:
/// https://developers.google.com/identity/sign-in/web/android-app-installs
@@ -162,15 +175,6 @@
// https://developers.google.com/identity/protocols/OpenIDConnect?hl=en#authenticationuriparameters
external String? get login_hint;
external set login_hint(String? v);
-
- external factory SigninOptions(
- {String app_package_name,
- bool fetch_basic_profile,
- String prompt,
- String scope,
- String /*'popup'|'redirect'*/ ux_mode,
- String redirect_uri,
- String login_hint});
}
/// Definitions by: John <https://github.com/jhcao23>
@@ -179,16 +183,16 @@
@anonymous
@JS()
abstract class OfflineAccessOptions {
+ external factory OfflineAccessOptions(
+ {String scope,
+ String /*'select_account'|'consent'*/ prompt,
+ String app_package_name});
external String? get scope;
external set scope(String? v);
external String? /*'select_account'|'consent'*/ get prompt;
external set prompt(String? /*'select_account'|'consent'*/ v);
external String? get app_package_name;
external set app_package_name(String? v);
- external factory OfflineAccessOptions(
- {String scope,
- String /*'select_account'|'consent'*/ prompt,
- String app_package_name});
}
/// Interface that represents the different configuration parameters for the gapi.auth2.init method.
@@ -196,6 +200,18 @@
@anonymous
@JS()
abstract class ClientConfig {
+ external factory ClientConfig({
+ String client_id,
+ String cookie_policy,
+ String scope,
+ bool fetch_basic_profile,
+ String? hosted_domain,
+ String openid_realm,
+ String /*'popup'|'redirect'*/ ux_mode,
+ String redirect_uri,
+ String plugin_name,
+ });
+
/// The app's client ID, found and created in the Google Developers Console.
external String? get client_id;
external set client_id(String? v);
@@ -238,18 +254,6 @@
/// See: https://github.com/flutter/flutter/issues/88084
external String? get plugin_name;
external set plugin_name(String? v);
-
- external factory ClientConfig({
- String client_id,
- String cookie_policy,
- String scope,
- bool fetch_basic_profile,
- String? hosted_domain,
- String openid_realm,
- String /*'popup'|'redirect'*/ ux_mode,
- String redirect_uri,
- String plugin_name,
- });
}
@JS('gapi.auth2.SigninOptionsBuilder')
@@ -290,20 +294,23 @@
external set first_issued_at(num? v);
external num? get expires_at;
external set expires_at(num? v);
- external factory AuthResponse(
- {String? access_token,
- String? id_token,
- String? login_hint,
- String? scope,
- num? expires_in,
- num? first_issued_at,
- num? expires_at});
}
/// Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2authorizeconfig
@anonymous
@JS()
abstract class AuthorizeConfig {
+ external factory AuthorizeConfig(
+ {String client_id,
+ String scope,
+ String response_type,
+ String prompt,
+ String cookie_policy,
+ String hosted_domain,
+ String login_hint,
+ String app_package_name,
+ String openid_realm,
+ bool include_granted_scopes});
external String get client_id;
external set client_id(String v);
external String get scope;
@@ -324,23 +331,22 @@
external set openid_realm(String? v);
external bool? get include_granted_scopes;
external set include_granted_scopes(bool? v);
- external factory AuthorizeConfig(
- {String client_id,
- String scope,
- String response_type,
- String prompt,
- String cookie_policy,
- String hosted_domain,
- String login_hint,
- String app_package_name,
- String openid_realm,
- bool include_granted_scopes});
}
/// Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2authorizeresponse
@anonymous
@JS()
abstract class AuthorizeResponse {
+ external factory AuthorizeResponse(
+ {String access_token,
+ String id_token,
+ String code,
+ String scope,
+ num expires_in,
+ num first_issued_at,
+ num expires_at,
+ String error,
+ String error_subtype});
external String get access_token;
external set access_token(String v);
external String get id_token;
@@ -359,16 +365,6 @@
external set error(String v);
external String get error_subtype;
external set error_subtype(String v);
- external factory AuthorizeResponse(
- {String access_token,
- String id_token,
- String code,
- String scope,
- num expires_in,
- num first_issued_at,
- num expires_at,
- String error,
- String error_subtype});
}
/// A GoogleUser object represents one user account.
@@ -498,6 +494,4 @@
abstract class Promise<T> {
external factory Promise(
void Function(void Function(T result) resolve, Function reject) executor);
- external Promise then(void Function(T result) onFulfilled,
- [Function onRejected]);
}
diff --git a/packages/google_sign_in/google_sign_in_web/lib/src/load_gapi.dart b/packages/google_sign_in/google_sign_in_web/lib/src/load_gapi.dart
index f60d6cd..57b9183 100644
--- a/packages/google_sign_in/google_sign_in_web/lib/src/load_gapi.dart
+++ b/packages/google_sign_in/google_sign_in_web/lib/src/load_gapi.dart
@@ -10,7 +10,7 @@
import 'package:flutter/foundation.dart' show visibleForTesting;
import 'package:js/js.dart';
-import 'generated/gapi.dart' as gapi;
+import 'js_interop/gapi.dart' as gapi;
import 'utils.dart' show injectJSLibraries;
@JS()
diff --git a/packages/google_sign_in/google_sign_in_web/lib/src/utils.dart b/packages/google_sign_in/google_sign_in_web/lib/src/utils.dart
index 72424d8..45acb1f 100644
--- a/packages/google_sign_in/google_sign_in_web/lib/src/utils.dart
+++ b/packages/google_sign_in/google_sign_in_web/lib/src/utils.dart
@@ -7,7 +7,7 @@
import 'package:google_sign_in_platform_interface/google_sign_in_platform_interface.dart';
-import 'generated/gapiauth2.dart' as auth2;
+import 'js_interop/gapiauth2.dart' as auth2;
/// Injects a list of JS [libraries] as `script` tags into a [target] [html.HtmlElement].
///
diff --git a/packages/google_sign_in/google_sign_in_web/pubspec.yaml b/packages/google_sign_in/google_sign_in_web/pubspec.yaml
index 42413e0..55bf760 100644
--- a/packages/google_sign_in/google_sign_in_web/pubspec.yaml
+++ b/packages/google_sign_in/google_sign_in_web/pubspec.yaml
@@ -3,7 +3,7 @@
for signing in with a Google account on Android, iOS and Web.
repository: https://github.com/flutter/plugins/tree/main/packages/google_sign_in/google_sign_in_web
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
-version: 0.10.2
+version: 0.10.2+1
environment:
sdk: ">=2.12.0 <3.0.0"