diff --git a/.metadata b/.metadata index 4129ce95..b05acbb3 100644 --- a/.metadata +++ b/.metadata @@ -1,10 +1,36 @@ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # -# This file should be version controlled and should not be manually edited. +# This file should be version controlled. version: - revision: 84f3d28555368a70270e9ac8390a9441df95e752 + revision: 2ad6cd72c040113b47ee9055e722606a490ef0da channel: stable project_type: plugin + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + - platform: android + create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + - platform: ios + create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + - platform: web + create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 00000000..f74085f3 --- /dev/null +++ b/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 00000000..06952be7 --- /dev/null +++ b/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/lib/main.dart b/example/lib/main.dart index 5967edeb..22e7ef44 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -20,7 +20,6 @@ void main() async { // using the configuration for the example app. const String exampleAppApiKey = '4_mL-YkAEegR9vzt6QvHWI5Q'; const String exampleAppApiDomain = 'us1.gigya.com'; - const String exampleCname = 'YOUR-CNAME-HERE'; try { await sdk.initSdk( diff --git a/example/lib/routes/account_information_page.dart b/example/lib/routes/account_information_page.dart index 6f3482a9..3d159fd8 100644 --- a/example/lib/routes/account_information_page.dart +++ b/example/lib/routes/account_information_page.dart @@ -68,7 +68,7 @@ class _AccountInformationPageState extends State super.initState(); accountInformationFuture = _getAccountInformation(); } - + Widget _buildAccountInformationPage(BuildContext context, Account account) { return SingleChildScrollView( child: Column( diff --git a/example/lib/routes/biometrics_page.dart b/example/lib/routes/biometrics_page.dart index cd6895be..03a7e2af 100644 --- a/example/lib/routes/biometrics_page.dart +++ b/example/lib/routes/biometrics_page.dart @@ -144,7 +144,7 @@ class _BiometricsPageState extends State ), trailing: Wrap( crossAxisAlignment: WrapCrossAlignment.center, - children: [ + children: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 5), child: Switch( @@ -167,7 +167,7 @@ class _BiometricsPageState extends State ), trailing: Wrap( crossAxisAlignment: WrapCrossAlignment.center, - children: [ + children: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 5), child: Switch( diff --git a/example/lib/routes/login_with_credentials_page.dart b/example/lib/routes/login_with_credentials_page.dart index c7827dca..d88c327f 100644 --- a/example/lib/routes/login_with_credentials_page.dart +++ b/example/lib/routes/login_with_credentials_page.dart @@ -66,7 +66,7 @@ class _LoginWithCredentialsPageState extends State { if (mounted) { setState(() { _inProgress = false; - _requestResult = 'Login success: \n\n ${account.uid}'; + _requestResult = 'Login success: \n\n ${account.toJson()}'; }); } } @@ -112,15 +112,15 @@ class _LoginWithCredentialsPageState extends State { } void _resolveLinkAccount(LinkAccountResolver resolver) async { - final ConflictingAccounts? conflictingAccounts = - await resolver.conflictingAccounts; + final ConflictingAccount? conflictingAccount = + await resolver.conflictingAccount; - if (!mounted || conflictingAccounts == null) { + if (!mounted || conflictingAccount == null) { return; } - if (conflictingAccounts.loginProviders.contains('site')) { - _showLinkToSiteBottomSheet(conflictingAccounts.loginID, resolver); + if (conflictingAccount.loginProviders.contains('site')) { + _showLinkToSiteBottomSheet(conflictingAccount.loginID, resolver); } else { _showLinkToSocialBottomSheet(resolver); } @@ -234,6 +234,7 @@ class _LoginWithCredentialsPageState extends State { ), TextField( controller: _linkPasswordController, + obscureText: true, decoration: const InputDecoration(hintText: 'password'), ), Padding( @@ -351,6 +352,7 @@ class _LoginWithCredentialsPageState extends State { padding: const EdgeInsets.all(8.0), child: TextFormField( controller: _passwordController, + obscureText: true, decoration: const InputDecoration(hintText: 'Enter password'), validator: (String? value) { if (value == null || value.trim().isEmpty) { diff --git a/example/lib/routes/manage_connections_page.dart b/example/lib/routes/manage_connections_page.dart index 581e913f..74bf268e 100644 --- a/example/lib/routes/manage_connections_page.dart +++ b/example/lib/routes/manage_connections_page.dart @@ -79,9 +79,9 @@ class _ManageConnectionsPageState extends State { case ConnectionState.none: case ConnectionState.active: case ConnectionState.waiting: - return Column( + return const Column( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ CircularProgressIndicator(), Text('Fetching account...'), ], @@ -109,19 +109,23 @@ class _ManageConnectionsPageState extends State { } final Account account = snapshot.data!; - final String socialProviders = account.socialProviders ?? ''; return Column( children: [ const Text('Social connections for this account'), Expanded( - child: socialProviders.isEmpty + child: account.socialProviders.isEmpty ? const Center( child: Text( 'No social connections for this account', ), ) - : Text(socialProviders), + : ListView.builder( + itemBuilder: (_, int index) => Text( + account.socialProviders[index], + ), + itemCount: account.socialProviders.length, + ), ), Padding( padding: const EdgeInsets.symmetric(vertical: 16), diff --git a/example/pubspec.lock b/example/pubspec.lock index bccba544..56e27951 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,6 +1,30 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a + url: "https://pub.dev" + source: hosted + version: "61.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 + url: "https://pub.dev" + source: hosted + version: "5.13.0" + args: + dependency: transitive + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" async: dependency: transitive description: @@ -37,10 +61,26 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" fake_async: dependency: transitive description: @@ -49,6 +89,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" flutter: dependency: "direct main" description: flutter @@ -79,6 +127,14 @@ packages: relative: true source: path version: "1.0.2" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" google_sign_in: dependency: "direct main" description: @@ -91,26 +147,26 @@ packages: dependency: transitive description: name: google_sign_in_android - sha256: "8d76099cb220d4f10c7e3c24492814c733f48ecb574c45c0ccadf5d5e50b012d" + sha256: "6031f59074a337fdd81be821aba84cee3a41338c6e958499a5cd34d3e1db80ef" url: "https://pub.dev" source: hosted - version: "6.1.19" + version: "6.1.20" google_sign_in_ios: dependency: transitive description: name: google_sign_in_ios - sha256: "8edfde9698b5951f3d02632eceb39cc283865c3cff0b03216bf951089f10345b" + sha256: e050cd907db1ee441b8efc0d8db63f3514f343872fdef6de36940fb09a92b2d7 url: "https://pub.dev" source: hosted - version: "5.6.3" + version: "5.7.0" google_sign_in_platform_interface: dependency: transitive description: name: google_sign_in_platform_interface - sha256: "35ceee5f0eadc1c07b0b4af7553246e315c901facbb7d3dadf734ba2693ceec4" + sha256: e10eaaa30a0cb03af12dd324fb2e630ac7e9d854d0530f7a87a4d825031f9a4a url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.4.3" google_sign_in_web: dependency: transitive description: @@ -155,10 +211,18 @@ packages: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" path: dependency: transitive description: @@ -167,22 +231,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.3" + pigeon: + dependency: transitive + description: + name: pigeon + sha256: "5a79fd0b10423f6b5705525e32015597f861c31220b522a67d1e6b580da96719" + url: "https://pub.dev" + source: hosted + version: "11.0.1" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d + sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8 url: "https://pub.dev" source: hosted - version: "2.1.6" - quiver: + version: "2.1.7" + pub_semver: dependency: transitive description: - name: quiver - sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47 + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" url: "https://pub.dev" source: hosted - version: "3.2.1" + version: "2.1.4" sky_engine: dependency: transitive description: flutter @@ -200,18 +272,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: @@ -232,10 +304,18 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.6.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" vector_math: dependency: transitive description: @@ -244,14 +324,30 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" web: dependency: transitive description: name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" + source: hosted + version: "0.3.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "3.1.2" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=3.7.0" + dart: ">=3.2.0 <4.0.0" + flutter: ">=3.16.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index c24bb346..2d7505d9 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -5,7 +5,8 @@ homepage: https://www.sap.com publish_to: none environment: - sdk: ">=2.18.0 <4.0.0" + sdk: ">=3.0.0 <4.0.0" + flutter: ">=3.10.0" dependencies: flutter: diff --git a/example/web/favicon.png b/example/web/favicon.png new file mode 100644 index 00000000..8aaa46ac Binary files /dev/null and b/example/web/favicon.png differ diff --git a/example/web/icons/Icon-192.png b/example/web/icons/Icon-192.png new file mode 100644 index 00000000..b749bfef Binary files /dev/null and b/example/web/icons/Icon-192.png differ diff --git a/example/web/icons/Icon-512.png b/example/web/icons/Icon-512.png new file mode 100644 index 00000000..88cfd48d Binary files /dev/null and b/example/web/icons/Icon-512.png differ diff --git a/example/web/icons/Icon-maskable-192.png b/example/web/icons/Icon-maskable-192.png new file mode 100644 index 00000000..eb9b4d76 Binary files /dev/null and b/example/web/icons/Icon-maskable-192.png differ diff --git a/example/web/icons/Icon-maskable-512.png b/example/web/icons/Icon-maskable-512.png new file mode 100644 index 00000000..d69c5669 Binary files /dev/null and b/example/web/icons/Icon-maskable-512.png differ diff --git a/example/web/index.html b/example/web/index.html new file mode 100644 index 00000000..8ccf713b --- /dev/null +++ b/example/web/index.html @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + gigya_flutter_plugin_example + + + + + + + + + + diff --git a/example/web/manifest.json b/example/web/manifest.json new file mode 100644 index 00000000..7db4a594 --- /dev/null +++ b/example/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "gigya_flutter_plugin_example", + "short_name": "gigya_flutter_plugin_example", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "Demonstrates how to use the gigya_flutter_plugin plugin.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/lib/gigya_flutter_plugin.dart b/lib/gigya_flutter_plugin.dart index c1a3148b..5a7e4043 100644 --- a/lib/gigya_flutter_plugin.dart +++ b/lib/gigya_flutter_plugin.dart @@ -1,15 +1,15 @@ import 'src/models/enums/social_provider.dart'; import 'src/models/screenset_event.dart'; import 'src/platform_interface/gigya_flutter_plugin_platform_interface.dart'; -import 'src/services/biometric_service/biometric_service.dart'; -import 'src/services/interruption_resolver/interruption_resolver.dart'; -import 'src/services/otp_service/otp_service.dart'; -import 'src/services/web_authentication_service/web_authentication_service.dart'; +import 'src/services/biometric_service.dart'; +import 'src/services/interruption_resolver.dart'; +import 'src/services/otp_service.dart'; +import 'src/services/web_authentication_service.dart'; export 'src/models/account.dart'; export 'src/models/address.dart'; export 'src/models/certification.dart'; -export 'src/models/conflicting_accounts.dart'; +export 'src/models/conflicting_account.dart'; export 'src/models/education.dart'; export 'src/models/emails.dart'; export 'src/models/enums/screen_set_event_type.dart'; @@ -27,10 +27,10 @@ export 'src/models/screenset_event.dart'; export 'src/models/session_info.dart'; export 'src/models/skill.dart'; export 'src/models/work.dart'; -export 'src/services/biometric_service/biometric_service.dart'; -export 'src/services/interruption_resolver/interruption_resolver.dart'; -export 'src/services/otp_service/otp_service.dart'; -export 'src/services/web_authentication_service/web_authentication_service.dart'; +export 'src/services/biometric_service.dart'; +export 'src/services/interruption_resolver.dart'; +export 'src/services/otp_service.dart'; +export 'src/services/web_authentication_service.dart'; /// This class represents the Gigya SDK plugin. class GigyaSdk { diff --git a/lib/src/platform_interface/gigya_flutter_plugin_method_channel.dart b/lib/src/method_channel/gigya_flutter_plugin_method_channel.dart similarity index 88% rename from lib/src/platform_interface/gigya_flutter_plugin_method_channel.dart rename to lib/src/method_channel/gigya_flutter_plugin_method_channel.dart index 3354ba51..caf3e10c 100644 --- a/lib/src/platform_interface/gigya_flutter_plugin_method_channel.dart +++ b/lib/src/method_channel/gigya_flutter_plugin_method_channel.dart @@ -7,15 +7,15 @@ import '../models/enums/methods.dart'; import '../models/enums/social_provider.dart'; import '../models/gigya_error.dart'; import '../models/screenset_event.dart'; -import '../services/biometric_service/biometric_service.dart'; -import '../services/biometric_service/method_channel_biometric_service.dart'; -import '../services/interruption_resolver/interruption_resolver.dart'; -import '../services/interruption_resolver/method_channel_interruption_resolver.dart'; -import '../services/otp_service/method_channel_otp_service.dart'; -import '../services/otp_service/otp_service.dart'; -import '../services/web_authentication_service/method_channel_web_authentication_service.dart'; -import '../services/web_authentication_service/web_authentication_service.dart'; -import 'gigya_flutter_plugin_platform_interface.dart'; +import '../platform_interface/gigya_flutter_plugin_platform_interface.dart'; +import '../services/biometric_service.dart'; +import '../services/interruption_resolver.dart'; +import '../services/otp_service.dart'; +import '../services/web_authentication_service.dart'; +import 'method_channel_biometric_service.dart'; +import 'method_channel_interruption_resolver.dart'; +import 'method_channel_otp_service.dart'; +import 'method_channel_web_authentication_service.dart'; /// An implementation of [GigyaFlutterPluginPlatform] that uses method channels. class MethodChannelGigyaFlutterPlugin extends GigyaFlutterPluginPlatform { @@ -359,32 +359,19 @@ class MethodChannelGigyaFlutterPlugin extends GigyaFlutterPluginPlatform { throw GigyaError.fromPlatformException(exception); } - yield* screenSetEvents.receiveBroadcastStream().map((dynamic event) { - // The binary messenger sends things back as `dynamic`. - // If the event is a `Map`, - // it does not have type information and comes back as `Map`. - // Cast it using `Map.cast()` to at least recover the type of the key. - // The values are still `Object?`, though. - final Map typedEvent = - (event as Map).cast(); - - // Now grab the data of the event, - // using `Map.cast()` to recover the type of the keys. - final Map? data = - (typedEvent['data'] as Map?) - ?.cast(); - - return ScreensetEvent( - typedEvent['event'] as String, - data ?? {}, - ); - }); + // The binary messenger sends things back as `dynamic`, + // but the events are actually a `Map`. + yield* screenSetEvents + .receiveBroadcastStream() + .cast>() + .map(ScreensetEvent.fromMap); } @override Future dismissScreenSet() async { try { - await methodChannel.invokeMethod(Methods.dismissScreenSet.methodName); + await methodChannel + .invokeMethod(Methods.dismissScreenSet.methodName); } on PlatformException catch (exception) { throw GigyaError.fromPlatformException(exception); } diff --git a/lib/src/services/biometric_service/method_channel_biometric_service.dart b/lib/src/method_channel/method_channel_biometric_service.dart similarity index 98% rename from lib/src/services/biometric_service/method_channel_biometric_service.dart rename to lib/src/method_channel/method_channel_biometric_service.dart index 4ce4bfab..23608ff5 100644 --- a/lib/src/services/biometric_service/method_channel_biometric_service.dart +++ b/lib/src/method_channel/method_channel_biometric_service.dart @@ -1,7 +1,7 @@ import 'package:flutter/services.dart' show MethodChannel, PlatformException; import 'package:gigya_flutter_plugin/gigya_flutter_plugin.dart'; -import '../../models/enums/methods.dart'; +import '../models/enums/methods.dart'; /// This class represents a [BiometricService] that uses a [MethodChannel] /// for its implementation. diff --git a/lib/src/services/interruption_resolver/method_channel_interruption_resolver.dart b/lib/src/method_channel/method_channel_interruption_resolver.dart similarity index 83% rename from lib/src/services/interruption_resolver/method_channel_interruption_resolver.dart rename to lib/src/method_channel/method_channel_interruption_resolver.dart index ed50eb9b..8af6d252 100644 --- a/lib/src/services/interruption_resolver/method_channel_interruption_resolver.dart +++ b/lib/src/method_channel/method_channel_interruption_resolver.dart @@ -1,10 +1,10 @@ import 'package:flutter/services.dart' show MethodChannel, PlatformException; -import '../../models/conflicting_accounts.dart'; -import '../../models/enums/methods.dart'; -import '../../models/enums/social_provider.dart'; -import '../../models/gigya_error.dart'; -import 'interruption_resolver.dart'; +import '../models/conflicting_account.dart'; +import '../models/enums/methods.dart'; +import '../models/enums/social_provider.dart'; +import '../models/gigya_error.dart'; +import '../services/interruption_resolver.dart'; /// This class represents an [InterruptionResolver] that uses a [MethodChannel] /// for its implementation. @@ -32,25 +32,25 @@ class MethodChannelInterruptionResolverFactory class _MethodChannelLinkAccountResolver extends LinkAccountResolver { _MethodChannelLinkAccountResolver(this._channel) { - _conflictingAccounts = _getConflictingAccounts(); + _conflictingAccount = _getConflictingAccount(); } final MethodChannel _channel; - late final Future? _conflictingAccounts; + late final Future? _conflictingAccount; @override - Future? get conflictingAccounts => _conflictingAccounts; + Future? get conflictingAccount => _conflictingAccount; - /// Get the conflicting accounts for the user. - Future _getConflictingAccounts() async { + /// Get the conflicting account for the user. + Future _getConflictingAccount() async { try { final Map? result = await _channel.invokeMapMethod( Methods.getConflictingAccounts.methodName, ); - return ConflictingAccounts.fromJson(result ?? const {}); + return ConflictingAccount.fromJson(result ?? const {}); } on PlatformException catch (exception) { throw GigyaError.fromPlatformException(exception); } diff --git a/lib/src/services/otp_service/method_channel_otp_service.dart b/lib/src/method_channel/method_channel_otp_service.dart similarity index 95% rename from lib/src/services/otp_service/method_channel_otp_service.dart rename to lib/src/method_channel/method_channel_otp_service.dart index 1bc03122..e57155b4 100644 --- a/lib/src/services/otp_service/method_channel_otp_service.dart +++ b/lib/src/method_channel/method_channel_otp_service.dart @@ -1,8 +1,8 @@ import 'package:flutter/services.dart' show MethodChannel, PlatformException; -import '../../models/enums/methods.dart'; -import '../../models/gigya_error.dart'; -import 'otp_service.dart'; +import '../models/enums/methods.dart'; +import '../models/gigya_error.dart'; +import '../services/otp_service.dart'; /// This class represents an [OtpService] that uses a [MethodChannel] /// for its implementation. diff --git a/lib/src/services/web_authentication_service/method_channel_web_authentication_service.dart b/lib/src/method_channel/method_channel_web_authentication_service.dart similarity index 95% rename from lib/src/services/web_authentication_service/method_channel_web_authentication_service.dart rename to lib/src/method_channel/method_channel_web_authentication_service.dart index 4b905a0d..cf06eb3e 100644 --- a/lib/src/services/web_authentication_service/method_channel_web_authentication_service.dart +++ b/lib/src/method_channel/method_channel_web_authentication_service.dart @@ -1,9 +1,9 @@ import 'dart:convert'; import 'package:flutter/services.dart' show MethodChannel, PlatformException; -import 'package:gigya_flutter_plugin/gigya_flutter_plugin.dart'; -import '../../models/enums/methods.dart'; +import '../../gigya_flutter_plugin.dart'; +import '../models/enums/methods.dart'; /// This class represents a [WebAuthenticationService] that uses a [MethodChannel] /// for its implementation. diff --git a/lib/src/models/account.dart b/lib/src/models/account.dart index 159a196d..70fbd5f3 100644 --- a/lib/src/models/account.dart +++ b/lib/src/models/account.dart @@ -1,65 +1,83 @@ import 'emails.dart'; import 'profile.dart'; -import 'session_info.dart'; /// This class represents an account. class Account { /// The default constructor. Account({ - required this.emails, + this.emails = const Emails(), this.created, - this.createdTimestamp, + this.data = const {}, this.isActive, this.isRegistered, this.isVerified, - this.lastLoginTimestamp, - this.lastUpdatedTimestamp, + this.lastLogin, + this.lastUpdated, this.loginProvider, - this.oldestUpdateTimestamp, + this.oldestDataUpdated, this.profile, this.registered, - this.registeredTimestamp, this.signatureTimestamp, - this.socialProviders, + this.socialProviders = const [], this.uid, this.uidSignature, this.verified, - this.verifiedTimestamp, }); /// Construct an account from the given [json]. factory Account.fromJson(Map json) { - final Map? emails = json['emails'] == null ? null : json['emails'].cast() as Map; - final Map? profile = json['profile'] == null ? null : json['profile'].cast() as Map; + final String? created = json['created'] as String?; + final Map? emails = + (json['emails'] as Map?)?.cast(); + final Map? profile = + (json['profile'] as Map?)?.cast(); + final String? lastLogin = json['lastLogin'] as String?; + final String? lastUpdated = json['lastUpdated'] as String?; + final String? oldestDataUpdated = json['oldestDataUpdated'] as String?; + final String? registered = json['registered'] as String?; + final String? verified = json['verified'] as String?; + final String socialProviders = json['socialProviders'] as String? ?? ''; + + // The signature timestamp can be either an ISO 8601 date, + // or the number of seconds since the UNIX epoch (1 Jan 1970). + final DateTime? signatureTimestamp = switch (json['signatureTimestamp']) { + final String timestamp => DateTime.parse(timestamp), + final int timestamp => + DateTime.fromMillisecondsSinceEpoch(timestamp * 1000), + final double timestamp => + DateTime.fromMillisecondsSinceEpoch(timestamp.toInt() * 1000), + _ => null, + }; return Account( + created: DateTime.tryParse(created ?? ''), + data: (json['data'] as Map?)?.cast(), emails: emails == null ? const Emails() : Emails.fromJson(emails), - created: json['created'] as String?, - createdTimestamp: json['createdTimestamp'] as Object?, isActive: json['isActive'] as bool?, isRegistered: json['isRegistered'] as bool?, isVerified: json['isVerified'] as bool?, - lastLoginTimestamp: json['lastLoginTimestamp'] as Object?, - lastUpdatedTimestamp: json['lastUpdatedTimestamp'] as Object?, + lastLogin: DateTime.tryParse(lastLogin ?? ''), + lastUpdated: DateTime.tryParse(lastUpdated ?? ''), loginProvider: json['loginProvider'] as String?, - oldestUpdateTimestamp: json['oldestDataUpdatedTimestamp'] as Object?, + oldestDataUpdated: DateTime.tryParse(oldestDataUpdated ?? ''), profile: profile == null ? null : Profile.fromJson(profile), - registered: json['registered'] as String?, - registeredTimestamp: json['registeredTimestamp'] as Object?, - signatureTimestamp: json['signatureTimestamp'] as Object?, - socialProviders: json['socialProviders'] as String?, + registered: DateTime.tryParse(registered ?? ''), + signatureTimestamp: signatureTimestamp, + socialProviders: socialProviders.split(','), uid: json['UID'] as String?, uidSignature: json['UIDSignature'] as String?, - verified: json['verified'] as String?, - verifiedTimestamp: json['verifiedTimestamp'] as Object?, + verified: DateTime.tryParse(verified ?? ''), ); } - /// The created status of the account. - final String? created; + /// The timestamp, in UTC, on which the account was created. + final DateTime? created; - /// The creation timestamp of the account. - final Object? createdTimestamp; // TODO: this should be a `DateTime?`. + /// The custom data for the account, which is not part of the [profile]. + final Map? data; + + /// The list of email addresses for the account. + final Emails emails; /// Whether this account is active. final bool? isActive; @@ -70,14 +88,12 @@ class Account { /// Whether this account is verified. final bool? isVerified; - /// The list of email addresses for the account. - final Emails emails; - - /// The timestamp of the last login. - final Object? lastLoginTimestamp; // TODO: this should be a `DateTime?`. + /// The timestamp of the last login of the user. + final DateTime? lastLogin; - /// The timestamp of the last update. - final Object? lastUpdatedTimestamp; // TODO: this should be a `DateTime?`. + /// The timestamp, in UTC, when the user's profile, preferences, + /// or subscriptions data was last updated. + final DateTime? lastUpdated; /// The name of current login provider for this account. /// @@ -85,23 +101,21 @@ class Account { /// then the value of this attribute will be `site`. final String? loginProvider; - /// The timestamp of the oldest data update. - final Object? oldestUpdateTimestamp; // TODO: this should be a `DateTime?`. + /// The timestamp, in UTC, of the oldest update to the user's account data. + final DateTime? oldestDataUpdated; /// The profile linked to this account. final Profile? profile; - /// The registered status of the account. - final String? registered; + /// The timestamp, in UTC, when the user was registered. + final DateTime? registered; - /// The timestamp of the account registration. - final Object? registeredTimestamp; // TODO: this should be a `DateTime?`. - - /// The timestamp of the [uidSignature]. - final Object? signatureTimestamp; // TODO: this should be a `DateTime?`. + /// The timestamp of the [uidSignature], in UTC. + /// This signature should be used for login validation. + final DateTime? signatureTimestamp; /// The social providers linked to this account. - final String? socialProviders; // TODO: This should be a `List` + final List socialProviders; /// The UID of the account. final String? uid; @@ -109,36 +123,31 @@ class Account { /// The UID signature of the account. final String? uidSignature; - /// The verified status of this account. - final String? verified; - - /// The timestamp of the [verified] status. - final Object? verifiedTimestamp; // TODO: this should be a `DateTime?`. + /// The timestamp, in UTC, when the user was verified. + final DateTime? verified; /// Convert this object into a JSON object. Map toJson() { final Profile? accountProfile = profile; return { - 'created': created, - 'createdTimestamp': createdTimestamp?.toString(), + 'created': created?.toIso8601String(), + 'data': data, 'emails': emails.toJson(), 'isActive': isActive, 'isRegistered': isRegistered, 'isVerified': isVerified, - 'lastLoginTimestamp': lastLoginTimestamp?.toString(), - 'lastUpdatedTimestamp': lastUpdatedTimestamp?.toString(), + 'lastLogin': lastLogin?.toIso8601String(), + 'lastUpdated': lastUpdated?.toIso8601String(), 'loginProvider': loginProvider, - 'oldestDataUpdatedTimestamp': oldestUpdateTimestamp?.toString(), + 'oldestDataUpdated': oldestDataUpdated?.toIso8601String(), if (accountProfile != null) 'profile': accountProfile.toJson(), - 'registered': registered, - 'registeredTimestamp': registeredTimestamp?.toString(), - 'signatureTimestamp': signatureTimestamp?.toString(), + 'registered': registered?.toIso8601String(), + 'signatureTimestamp': signatureTimestamp?.toIso8601String(), 'socialProviders': socialProviders, 'UID': uid, 'UIDSignature': uidSignature, - 'verified': verified, - 'verifiedTimestamp': verifiedTimestamp?.toString(), + 'verified': verified?.toIso8601String(), }; } } diff --git a/lib/src/models/certification.dart b/lib/src/models/certification.dart index 03d4c3bc..c5ebe554 100644 --- a/lib/src/models/certification.dart +++ b/lib/src/models/certification.dart @@ -13,10 +13,10 @@ class Certification { factory Certification.fromJson(Map json) { return Certification._( authority: json['authority'] as String?, - endDate: json['endDate'] as String?, + endDate: DateTime.tryParse(json['endDate'] as String? ?? ''), name: json['name'] as String?, number: json['number'] as String?, - startDate: json['startDate'] as String?, + startDate: DateTime.tryParse(json['startDate'] as String? ?? ''), ); } @@ -24,7 +24,7 @@ class Certification { final String? authority; /// The end date of the validity of the certification. - final String? endDate; // TODO: this should be a DateTime? + final DateTime? endDate; /// The name of the certification. final String? name; @@ -33,16 +33,16 @@ class Certification { final String? number; /// The start date of the validity of the certification. - final String? startDate; // TODO: this should be a DateTime? + final DateTime? startDate; /// Convert this object to a JSON object. Map toJson() { return { 'authority': authority, - 'endDate': endDate, + 'endDate': endDate?.toIso8601String(), 'name': name, 'number': number, - 'startDate': startDate, + 'startDate': startDate?.toIso8601String(), }; } } diff --git a/lib/src/models/conflicting_accounts.dart b/lib/src/models/conflicting_account.dart similarity index 56% rename from lib/src/models/conflicting_accounts.dart rename to lib/src/models/conflicting_account.dart index add986fa..1244d3d7 100644 --- a/lib/src/models/conflicting_accounts.dart +++ b/lib/src/models/conflicting_account.dart @@ -1,16 +1,19 @@ /// This class represents a model that is used to resolve an account conflict. -class ConflictingAccounts { - /// The private constructor. - const ConflictingAccounts._(this.loginID, this.loginProviders); +class ConflictingAccount { + /// The default constructor. + const ConflictingAccount({ + this.loginID, + this.loginProviders = const [], + }); /// The default constructor. - factory ConflictingAccounts.fromJson(Map json) { + factory ConflictingAccount.fromJson(Map json) { // Lists coming from `jsonDecode` always have dynamic as type. final List? providers = json['loginProviders'] as List?; - return ConflictingAccounts._( - json['loginID'] as String?, - providers?.cast() ?? [], + return ConflictingAccount( + loginID: json['loginID'] as String?, + loginProviders: providers?.cast() ?? [], ); } diff --git a/lib/src/models/favorite.dart b/lib/src/models/favorite.dart index ef7ec437..5a954015 100644 --- a/lib/src/models/favorite.dart +++ b/lib/src/models/favorite.dart @@ -103,6 +103,7 @@ class Favorites { 'books': books.map((Favorite b) => b.toJson()).toList(), 'interests': interests.map((Favorite i) => i.toJson()).toList(), 'movies': movies.map((Favorite m) => m.toJson()).toList(), + 'music': music.map((Favorite m) => m.toJson()).toList(), 'television': television.map((Favorite t) => t.toJson()).toList(), }; } diff --git a/lib/src/models/like.dart b/lib/src/models/like.dart index ca9df63c..dc54c11c 100644 --- a/lib/src/models/like.dart +++ b/lib/src/models/like.dart @@ -6,7 +6,6 @@ class Like { this.id, this.name, this.time, - this.timestamp, }); /// The default constructor. @@ -15,8 +14,7 @@ class Like { category: json['category'] as String?, id: json['id'] as String?, name: json['name'] as String?, - time: json['time'] as String?, - timestamp: json['timestamp'] as double?, + time: DateTime.tryParse(json['time'] as String? ?? ''), ); } @@ -29,11 +27,8 @@ class Like { /// The name of the like. final String? name; - /// The formatted time of the like. - final String? time; // TODO: this parameter is redundant, timestamp is enough? - /// The timestamp of the like. - final double? timestamp; // TODO: this should be a `DateTime?` + final DateTime? time; /// Convert this object into a JSON object. Map toJson() { @@ -41,8 +36,7 @@ class Like { 'category': category, 'id': id, 'name': name, - 'time': time, - 'timestamp': timestamp, + 'time': time?.toIso8601String(), }; } } diff --git a/lib/src/models/oidc_data.dart b/lib/src/models/oidc_data.dart index 22c5a451..d7787627 100644 --- a/lib/src/models/oidc_data.dart +++ b/lib/src/models/oidc_data.dart @@ -76,7 +76,7 @@ class OidcData { 'name': name, 'phone_number': phoneNumber, 'phone_number_verified': phoneNumberVerified, - 'updated_at': updatedAt?.toString(), + 'updated_at': updatedAt?.toIso8601String(), 'website': website, 'zoneinfo': zoneInfo, }; diff --git a/lib/src/models/patent.dart b/lib/src/models/patent.dart index d912a626..ef79ec63 100644 --- a/lib/src/models/patent.dart +++ b/lib/src/models/patent.dart @@ -50,7 +50,7 @@ class Patent { /// Convert this object into a JSON object. Map toJson() { return { - 'date': date?.toString(), + 'date': date?.toIso8601String(), 'number': number, 'office': office, 'status': status, diff --git a/lib/src/models/profile.dart b/lib/src/models/profile.dart index 6e273c67..57210f03 100644 --- a/lib/src/models/profile.dart +++ b/lib/src/models/profile.dart @@ -36,11 +36,15 @@ class Profile { this.honors, this.industry, this.interests, + this.isConnected, + this.isSiteUser, this.languages, this.lastLoginLocation, this.lastName, this.likes = const [], this.locale, + this.loginProvider, + this.loginProviderUID, this.name, this.nickname, this.oidcData, @@ -50,6 +54,7 @@ class Profile { this.politicalView, this.professionalHeadline, this.profileUrl, + this.providers = const [], this.proxyEmail, this.publications = const [], this.relationshipStatus, @@ -77,6 +82,7 @@ class Profile { json['oidcData'] as Map?; final List? patents = json['patents'] as List?; final List? phones = json['phones'] as List?; + final List? providers = json['providers'] as List?; final List? publications = json['publications'] as List?; final List? skills = json['skills'] as List?; final List? work = json['work'] as List?; @@ -98,13 +104,15 @@ class Profile { email: json['email'] as String?, favorites: _listFromJson(favorites, Favorite.fromJson), firstName: json['firstName'] as String?, - followers: json['followersCounts'] as int?, + followers: json['followersCount'] as int?, following: json['followingCount'] as int?, gender: json['gender'] as String?, hometown: json['hometown'] as String?, honors: json['honors'] as String?, industry: json['industry'] as String?, interests: json['interests'] as String?, + isConnected: json['isConnected'] as bool?, + isSiteUser: json['isSiteUser'] as bool?, languages: json['languages'] as String?, lastLoginLocation: lastLoginLocation == null ? null @@ -112,6 +120,8 @@ class Profile { lastName: json['lastName'] as String?, likes: _listFromJson(likes, Like.fromJson), locale: json['locale'] as String?, + loginProvider: json['loginProvider'] as String?, + loginProviderUID: json['loginProviderUID'] as String?, name: json['name'] as String?, nickname: json['nickname'] as String?, oidcData: oidcStruct == null ? null : OidcData.fromJson(oidcStruct), @@ -121,6 +131,7 @@ class Profile { politicalView: json['politicalView'] as String?, professionalHeadline: json['professionalHeadline'] as String?, profileUrl: json['profileURL'] as String?, + providers: providers?.cast() ?? const [], proxyEmail: json['proxyEmail'] as String?, publications: _listFromJson(publications, Publication.fromJson), @@ -204,6 +215,12 @@ class Profile { /// The person's interests. final String? interests; + /// Whether the user is connected to any available provider. + final bool? isConnected; + + /// Whether the current user is a user of the site. + final bool? isSiteUser; + /// The different languages that the person is proficient in. final String? languages; @@ -219,6 +236,12 @@ class Profile { /// The language locale of the person's primary language. final String? locale; + /// The name of the provider that the user used in order to log in. + final String? loginProvider; + + /// The user's ID from the login provider. + final String? loginProviderUID; + /// The person's full name. final String? name; @@ -246,6 +269,9 @@ class Profile { /// The url to the person's profile page. final String? profileUrl; + /// The names of the providers to which the user is connected/logged in. + final List providers; + /// The person's proxy email address. final String? proxyEmail; @@ -323,18 +349,22 @@ class Profile { if (favorites.isNotEmpty) 'favorites': favorites.map((Favorite f) => f.toJson()).toList(), 'firstName': firstName, - 'followersCounts': followers, + 'followersCount': followers, 'followingCount': following, 'gender': gender, 'hometown': hometown, 'honors': honors, 'industry': industry, 'interests': interests, + 'isConnected': isConnected, + 'isSiteUser': isSiteUser, 'languages': languages, if (lastLogin != null) 'lastLoginLocation': lastLogin.toJson(), 'lastName': lastName, if (likes.isNotEmpty) 'likes': likes.map((Like l) => l.toJson()).toList(), 'locale': locale, + 'loginProvider': loginProvider, + 'loginProviderUID': loginProviderUID, 'name': name, 'nickname': nickname, if (oidcStruct != null) 'oidcData': oidcStruct.toJson(), @@ -346,6 +376,7 @@ class Profile { 'politicalView': politicalView, 'professionalHeadline': professionalHeadline, 'profileURL': profileUrl, + 'providers': providers, 'proxyEmail': proxyEmail, if (publications.isNotEmpty) 'publications': diff --git a/lib/src/models/publication.dart b/lib/src/models/publication.dart index 06d37062..729e8a29 100644 --- a/lib/src/models/publication.dart +++ b/lib/src/models/publication.dart @@ -40,7 +40,7 @@ class Publication { /// Convert this object to a JSON object. Map toJson() { return { - 'date': date?.toString(), + 'date': date?.toIso8601String(), 'publisher': publisher, 'summary': summary, 'title': title, diff --git a/lib/src/models/screenset_event.dart b/lib/src/models/screenset_event.dart index f4d26951..8929c6ad 100644 --- a/lib/src/models/screenset_event.dart +++ b/lib/src/models/screenset_event.dart @@ -13,6 +13,19 @@ class ScreensetEvent { return ScreensetEvent._(resolvedType, data); } + /// Construct a new [ScreensetEvent] from the given, loosely-typed [map]. + /// + /// The map is expected to have an `event` key, denoting the name of the event. + /// The map can have a `data` key, which is a [Map] that contains any data for the event. + factory ScreensetEvent.fromMap(Map map) { + final Map? data = map['data'] as Map?; + + return ScreensetEvent( + map['event'] as String, + data?.cast() ?? const {}, + ); + } + /// The private constructor. const ScreensetEvent._(this.type, this.data); diff --git a/lib/src/models/session_info.dart b/lib/src/models/session_info.dart index 4dce0f42..7a140a6d 100644 --- a/lib/src/models/session_info.dart +++ b/lib/src/models/session_info.dart @@ -1,21 +1,44 @@ /// This class represents a session info object. +/// +/// When running on native platforms, this session info contains a session token and secret. +/// When running on the web, this session info contains a session cookie. class SessionInfo { /// The default constructor. SessionInfo.fromJson(Map json) - : expiresIn = json['expires_in'] as int, - sessionSecret = json['sessionSecret'] as String, - sessionToken = json['sessionToken'] as String; + : cookieName = json['cookieName'] as String?, + cookieValue = json['cookieValue'] as String?, + expiresIn = json['expires_in'] as int?, + sessionSecret = json['sessionSecret'] as String?, + sessionToken = json['sessionToken'] as String?; + + /// The name of the session cookie. + /// + /// This is null when not running on the web. + final String? cookieName; + + /// The value of the session cookie. + /// + /// This is null when not running on the web. + final String? cookieValue; /// The expiration time of the session, in seconds. - final int expiresIn; + /// + /// This is null when running on the web. + final int? expiresIn; /// The session secret. - final String sessionSecret; + /// + /// This is null when running on the web. + final String? sessionSecret; /// The session token. - final String sessionToken; + /// + /// This is null when running on the web. + final String? sessionToken; /// Convert this object into a JSON object. + /// + /// The session cookie is not serialized when calling this method. Map toJson() { return { 'sessionToken': sessionToken, diff --git a/lib/src/models/work.dart b/lib/src/models/work.dart index 7f48f020..db4728c1 100644 --- a/lib/src/models/work.dart +++ b/lib/src/models/work.dart @@ -16,22 +16,22 @@ class Work { /// The default constructor. factory Work.fromJson(Map json) { - final String? endDate = json['endDate'] as String?; - final String? startDate = json['startDate'] as String?; - - // TODO: company size should be an int, not a double. - final double? companySize = json['companySize'] as double?; + final int? companySize = switch (json['companySize']) { + final int size => size, + final double size => size.toInt(), + _ => null, + }; return Work._( company: json['company'] as String?, companyID: json['companyID'] as String?, - companySize: companySize?.toInt(), + companySize: companySize, description: json['description'] as String?, - endDate: endDate == null ? null : DateTime.tryParse(endDate), + endDate: DateTime.tryParse(json['endDate'] as String? ?? ''), industry: json['industry'] as String?, isCurrent: json['isCurrent'] as bool?, location: json['location'] as String?, - startDate: startDate == null ? null : DateTime.tryParse(startDate), + startDate: DateTime.tryParse(json['startDate'] as String? ?? ''), title: json['title'] as String?, ); } @@ -71,14 +71,13 @@ class Work { return { 'company': company, 'companyID': companyID, - // TODO: company size should be an int, not a double. - 'companySize': companySize?.toDouble(), + 'companySize': companySize, 'description': description, - 'endDate': endDate?.toString(), + 'endDate': endDate?.toIso8601String(), 'industry': industry, 'isCurrent': isCurrent, 'location': location, - 'startDate': startDate?.toString(), + 'startDate': startDate?.toIso8601String(), 'title': title, }; } diff --git a/lib/src/platform_interface/gigya_flutter_plugin_platform_interface.dart b/lib/src/platform_interface/gigya_flutter_plugin_platform_interface.dart index be7e656f..5ba0b470 100644 --- a/lib/src/platform_interface/gigya_flutter_plugin_platform_interface.dart +++ b/lib/src/platform_interface/gigya_flutter_plugin_platform_interface.dart @@ -1,12 +1,12 @@ import 'package:plugin_platform_interface/plugin_platform_interface.dart'; +import '../method_channel/gigya_flutter_plugin_method_channel.dart'; import '../models/enums/social_provider.dart'; import '../models/screenset_event.dart'; -import '../services/biometric_service/biometric_service.dart'; -import '../services/interruption_resolver/interruption_resolver.dart'; -import '../services/otp_service/otp_service.dart'; -import '../services/web_authentication_service/web_authentication_service.dart'; -import 'gigya_flutter_plugin_method_channel.dart'; +import '../services/biometric_service.dart'; +import '../services/interruption_resolver.dart'; +import '../services/otp_service.dart'; +import '../services/web_authentication_service.dart'; /// The platform interface for the Gigya Flutter Plugin. abstract class GigyaFlutterPluginPlatform extends PlatformInterface { diff --git a/lib/src/services/biometric_service/biometric_service.dart b/lib/src/services/biometric_service.dart similarity index 100% rename from lib/src/services/biometric_service/biometric_service.dart rename to lib/src/services/biometric_service.dart diff --git a/lib/src/services/interruption_resolver/interruption_resolver.dart b/lib/src/services/interruption_resolver.dart similarity index 91% rename from lib/src/services/interruption_resolver/interruption_resolver.dart rename to lib/src/services/interruption_resolver.dart index 4dba769d..7888fd14 100644 --- a/lib/src/services/interruption_resolver/interruption_resolver.dart +++ b/lib/src/services/interruption_resolver.dart @@ -1,6 +1,6 @@ -import '../../models/conflicting_accounts.dart'; -import '../../models/enums/social_provider.dart'; -import '../../models/gigya_error.dart'; +import '../models/conflicting_account.dart'; +import '../models/enums/social_provider.dart'; +import '../models/gigya_error.dart'; /// This interface represents the base interruption resolver. abstract class InterruptionResolver { @@ -22,7 +22,7 @@ abstract class InterruptionResolverFactory { /// The resolver for a link account flow interruption. abstract class LinkAccountResolver extends InterruptionResolver { /// Get the conflicting accounts of the user. - Future? get conflictingAccounts { + Future? get conflictingAccount { throw UnimplementedError('conflictingAccounts is not implemented.'); } diff --git a/lib/src/services/otp_service/otp_service.dart b/lib/src/services/otp_service.dart similarity index 100% rename from lib/src/services/otp_service/otp_service.dart rename to lib/src/services/otp_service.dart diff --git a/lib/src/services/web_authentication_service/web_authentication_service.dart b/lib/src/services/web_authentication_service.dart similarity index 100% rename from lib/src/services/web_authentication_service/web_authentication_service.dart rename to lib/src/services/web_authentication_service.dart diff --git a/pubspec.yaml b/pubspec.yaml index 19fbcf86..95a6a464 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,8 +4,8 @@ version: 1.0.3 homepage: https://github.com/SAP/gigya-flutter-plugin environment: - sdk: ">=2.18.0 <4.0.0" - flutter: ">=3.3.0" + sdk: ">=3.0.0 <4.0.0" + flutter: ">=3.10.0" dependencies: flutter: