From 4cc09ba8879e7f6fd523403576dae226b1436ecd Mon Sep 17 00:00:00 2001 From: Michiel Vrins Date: Tue, 2 May 2023 16:52:46 +0200 Subject: [PATCH 01/13] FP-87: Move loginSection into seperate widget and rename login_screen --- example/lib/main.dart | 4 +- .../{login_screen.dart => auth_screen.dart} | 270 ++++++++++-------- example/lib/screens/otp_screen.dart | 4 +- example/lib/screens/user_screen.dart | 8 +- 4 files changed, 151 insertions(+), 135 deletions(-) rename example/lib/screens/{login_screen.dart => auth_screen.dart} (86%) diff --git a/example/lib/main.dart b/example/lib/main.dart index 6eccea43..ebf34aa0 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -3,7 +3,7 @@ import 'package:flutter/services.dart'; import 'package:onegini/onegini.dart'; import 'package:onegini/onegini.gen.dart'; import 'package:onegini_example/components/display_toast.dart'; -import 'package:onegini_example/screens/login_screen.dart'; +import 'package:onegini_example/screens/auth_screen.dart'; final RouteObserver routeObserver = RouteObserver(); @@ -72,7 +72,7 @@ class _BodyWidgetState extends State { Navigator.pushReplacement( context, - MaterialPageRoute(builder: (context) => LoginScreen()), + MaterialPageRoute(builder: (context) => AuthScreen()), ); } diff --git a/example/lib/screens/login_screen.dart b/example/lib/screens/auth_screen.dart similarity index 86% rename from example/lib/screens/login_screen.dart rename to example/lib/screens/auth_screen.dart index cbe4729c..2b373e2a 100644 --- a/example/lib/screens/login_screen.dart +++ b/example/lib/screens/auth_screen.dart @@ -15,17 +15,15 @@ import 'package:collection/collection.dart'; import '../components/display_toast.dart'; -class LoginScreen extends StatefulWidget { +class AuthScreen extends StatefulWidget { @override - _LoginScreenState createState() => _LoginScreenState(); + _AuthScreenState createState() => _AuthScreenState(); } -class _LoginScreenState extends State { +class _AuthScreenState extends State { bool isLoading = false; List>? registrationSubscriptions; List>? authenticationSubscriptions; - List userProfiles = []; - String? selectedProfileId; @override initState() { @@ -35,14 +33,12 @@ class _LoginScreenState extends State { this.authenticationSubscriptions = OWBroadcastHelper.initAuthenticationSubscriptions(context); super.initState(); - getUserProfiles(); } @override void dispose() { OWBroadcastHelper.stopListening(registrationSubscriptions); OWBroadcastHelper.stopListening(authenticationSubscriptions); - super.dispose(); } @@ -94,24 +90,6 @@ class _LoginScreenState extends State { } } - authenticate(String profileId, OWAuthenticatorType? authenticatorType) async { - try { - var registrationResponse = await Onegini.instance.userClient - .authenticateUser(profileId, authenticatorType); - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute( - builder: (context) => UserScreen( - userProfileId: registrationResponse.userProfile.profileId, - )), - (Route route) => false); - } catch (error) { - if (error is PlatformException) { - showFlutterToast(error.message); - } - } - } - cancelRegistration() async { setState(() => isLoading = false); try { @@ -124,53 +102,6 @@ class _LoginScreenState extends State { } } - Future> getUserProfiles() async { - try { - final profiles = await Onegini.instance.userClient.getUserProfiles(); - setState(() { - userProfiles = profiles; - if (selectedProfileId == null) { - selectedProfileId = profiles.firstOrNull?.profileId; - } - }); - return profiles; - } catch (err) { - print("caught error in getUserProfiles: $err"); - return []; - } - } - - Future getImplicitUserDetails(String profileId) async { - try { - await Onegini.instance.userClient - .authenticateUserImplicitly(profileId, ["read"]); - var response = await Onegini.instance.resourcesMethods.requestResource( - ResourceRequestType.implicit, - RequestDetails( - path: "user-id-decorated", method: HttpRequestMethod.get)); - - var res = json.decode(response.body); - - return res["decorated_user_id"]; - } catch (err) { - print("Caught error: $err"); - return "Error occured check logs"; - } - } - - Widget _buildImplicitUserData(String profileId) { - return FutureBuilder( - future: getImplicitUserDetails(profileId), - builder: (context, snapshot) { - if (snapshot.hasData) { - return Text("${snapshot.data}"); - } else if (snapshot.hasError) { - return Text("Error getting implicit details."); - } - return CircularProgressIndicator(); - }); - } - @override Widget build(BuildContext context) { return Scaffold( @@ -195,7 +126,7 @@ class _LoginScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox(height: 20), - _buildLoginWidget(), + LoginSection(), SizedBox(height: 20), _buildRegisterWidget(), ], @@ -204,60 +135,6 @@ class _LoginScreenState extends State { ); } - Widget _buildLoginWidget() { - final profileId = selectedProfileId; - return (userProfiles.length > 0 && profileId != null) - ? Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "──── Login ────", - style: TextStyle(fontSize: 30), - textAlign: TextAlign.center, - ), - _buildSelectUserProfile(userProfiles), - _buildImplicitUserData(profileId), - ElevatedButton( - onPressed: () { - authenticate(profileId, null); - }, - child: Text('Preferred authenticator'), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ElevatedButton( - onPressed: () { - authenticate(profileId, OWAuthenticatorType.pin); - }, - child: Text('Pin'), - ), - SizedBox(height: 10, width: 10), - ElevatedButton( - onPressed: () { - authenticate(profileId, OWAuthenticatorType.biometric); - }, - child: Text('Biometrics'), - ), - ], - ), - ]) - : SizedBox.shrink(); - } - - DropdownButton _buildSelectUserProfile(List profiles) { - return DropdownButton( - value: selectedProfileId, - items: profiles - .map((e) => - DropdownMenuItem(value: e.profileId, child: Text(e.profileId))) - .toList(), - onChanged: (profileId) => { - setState(() => {selectedProfileId = profileId}) - }); - } - Column _buildRegisterWidget() { return Column( children: [ @@ -325,3 +202,142 @@ class _LoginScreenState extends State { ); } } + +class LoginSection extends StatefulWidget { + @override + _LoginSectionState createState() => _LoginSectionState(); +} + +class _LoginSectionState extends State { + List userProfiles = []; + String? selectedProfileId; + + @override + initState() { + super.initState(); + fetchUserProfiles(); + } + + @override + Widget build(BuildContext context) { + final _selectedProfileId = selectedProfileId; + return (userProfiles.length > 0 && _selectedProfileId != null) + ? Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "──── Login ────", + style: TextStyle(fontSize: 30), + textAlign: TextAlign.center, + ), + _buildSelectUserProfile(userProfiles), + _buildImplicitUserData(_selectedProfileId), + ElevatedButton( + onPressed: () { + authenticate(_selectedProfileId, null); + }, + child: Text('Preferred authenticator'), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ElevatedButton( + onPressed: () { + authenticate( + _selectedProfileId, OWAuthenticatorType.pin); + }, + child: Text('Pin'), + ), + SizedBox(height: 10, width: 10), + ElevatedButton( + onPressed: () { + authenticate( + _selectedProfileId, OWAuthenticatorType.biometric); + }, + child: Text('Biometrics'), + ), + ], + ), + ]) + : SizedBox.shrink(); + } + + DropdownButton _buildSelectUserProfile(List profiles) { + return DropdownButton( + value: selectedProfileId, + items: profiles + .map((e) => + DropdownMenuItem(value: e.profileId, child: Text(e.profileId))) + .toList(), + onChanged: (profileId) => { + setState(() => {selectedProfileId = profileId}) + }); + } + + Future> fetchUserProfiles() async { + try { + final profiles = await Onegini.instance.userClient.getUserProfiles(); + setState(() { + userProfiles = profiles; + selectedProfileId = + selectedProfileId ?? profiles.firstOrNull?.profileId; + }); + return profiles; + } catch (err) { + print("caught error in getUserProfiles: $err"); + return []; + } + } + + Widget _buildImplicitUserData(final String profileId) { + return FutureBuilder( + future: getImplicitUserDetails(profileId), + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + return Text("${snapshot.data}"); + } else if (snapshot.hasError) { + return Text("Error getting implicit details."); + } + return CircularProgressIndicator(); + }); + } + + Future getImplicitUserDetails(final String profileId) async { + try { + await Onegini.instance.userClient + .authenticateUserImplicitly(profileId, ["read"]); + var response = await Onegini.instance.resourcesMethods.requestResource( + ResourceRequestType.implicit, + RequestDetails( + path: "user-id-decorated", method: HttpRequestMethod.get)); + + var res = json.decode(response.body); + + return res["decorated_user_id"]; + } catch (err) { + print("Caught error: $err"); + return "Error occured check logs"; + } + } + + authenticate( + final String profileId, OWAuthenticatorType? authenticatorType) async { + try { + var registrationResponse = await Onegini.instance.userClient + .authenticateUser(profileId, authenticatorType); + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute( + builder: (context) => UserScreen( + userProfileId: registrationResponse.userProfile.profileId, + )), + (Route route) => false); + } catch (error) { + if (error is PlatformException) { + showFlutterToast(error.message); + } + } + } +} diff --git a/example/lib/screens/otp_screen.dart b/example/lib/screens/otp_screen.dart index 725e9b0e..f7b6573f 100644 --- a/example/lib/screens/otp_screen.dart +++ b/example/lib/screens/otp_screen.dart @@ -3,7 +3,7 @@ import 'package:flutter/services.dart'; import 'package:onegini/callbacks/onegini_custom_registration_callback.dart'; import 'package:onegini_example/components/display_toast.dart'; -import 'login_screen.dart'; +import 'auth_screen.dart'; class OtpScreen extends StatefulWidget { final String password; @@ -42,7 +42,7 @@ class _OtpScreenState extends State { }); Navigator.pushReplacement( context, - MaterialPageRoute(builder: (context) => LoginScreen()), + MaterialPageRoute(builder: (context) => AuthScreen()), ); } diff --git a/example/lib/screens/user_screen.dart b/example/lib/screens/user_screen.dart index 7750e2dd..00c77320 100644 --- a/example/lib/screens/user_screen.dart +++ b/example/lib/screens/user_screen.dart @@ -17,7 +17,7 @@ import 'package:onegini/onegini.gen.dart'; // ignore: import_of_legacy_library_into_null_safe import '../main.dart'; // ignore: import_of_legacy_library_into_null_safe -import 'login_screen.dart'; +import 'auth_screen.dart'; class UserScreen extends StatefulWidget { final String userProfileId; @@ -112,7 +112,7 @@ class _UserScreenState extends State with RouteAware { }); Navigator.pushReplacement( context, - MaterialPageRoute(builder: (_) => LoginScreen()), + MaterialPageRoute(builder: (_) => AuthScreen()), ); } @@ -126,7 +126,7 @@ class _UserScreenState extends State with RouteAware { }); Navigator.pushReplacement( context, - MaterialPageRoute(builder: (_) => LoginScreen()), + MaterialPageRoute(builder: (_) => AuthScreen()), ); } @@ -144,7 +144,7 @@ class _UserScreenState extends State with RouteAware { error.code == "10012") { Navigator.pushReplacement( context, - MaterialPageRoute(builder: (_) => LoginScreen()), + MaterialPageRoute(builder: (_) => AuthScreen()), ); } } From a3dc49ebd27631bce78c632d9ce6d67a474b768d Mon Sep 17 00:00:00 2001 From: Michiel Vrins Date: Thu, 25 May 2023 11:22:37 +0200 Subject: [PATCH 02/13] Don't expose internal api to end users We use an internal api generated by Pigeon to communicate with the native side. This api should not be directly exposed to our users as we might want to do some extra processing. This commit makes that api private. --- lib/onegini.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/onegini.dart b/lib/onegini.dart index 27dfc597..dc284442 100644 --- a/lib/onegini.dart +++ b/lib/onegini.dart @@ -11,7 +11,7 @@ import 'package:onegini/onegini.gen.dart'; class Onegini { // UserClientApi is the flutter to native api created by the Pigeon package, see /pigeons/README.md /// User client methods. - final UserClientApi api = UserClientApi(); + final UserClientApi _api = UserClientApi(); late final UserClient userClient; @@ -24,7 +24,7 @@ class Onegini { Finalizer((owEventStreamController) => owEventStreamController.close()); Onegini._internal() { - userClient = UserClient(api); + userClient = UserClient(_api); } static final Onegini instance = Onegini._internal(); @@ -51,7 +51,7 @@ class Onegini { List? additionalResourceUrls, }) async { NativeCallFlutterApi.setup(OneginiEventListener(owEventStreamController)); - await api.startApplication( + await _api.startApplication( securityControllerClassName, configModelClassName, customIdentityProviderConfigs, From 4f71899550eda4393ec033aa980f4e170851f8c2 Mon Sep 17 00:00:00 2001 From: Michiel Vrins Date: Thu, 25 May 2023 11:35:47 +0200 Subject: [PATCH 03/13] Bump minimum version of flutter sdk to 2.17.0 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 79ec54e5..c76a20f3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 3.0.0 homepage: https://www.onegini.com environment: - sdk: ">=2.12.0 <4.0.0" + sdk: ">=2.17.0 <4.0.0" flutter: ">=1.12.0" dependencies: From f64c4404a8e921358af40477937351358023d256 Mon Sep 17 00:00:00 2001 From: Michiel Vrins Date: Thu, 25 May 2023 11:39:29 +0200 Subject: [PATCH 04/13] Fix Flutter Linter problems for new Flutter cli version --- example/android/build.gradle | 124 +++++++++++++------------- example/lib/screens/login_screen.dart | 9 +- example/lib/screens/pin_screen.dart | 4 +- 3 files changed, 68 insertions(+), 69 deletions(-) diff --git a/example/android/build.gradle b/example/android/build.gradle index b8f7cd2c..302ffed1 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,62 +1,62 @@ -buildscript { - ext.kotlin_version = '1.8.0' - repositories { - mavenCentral() - google() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.2.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - repositories { - google() - def (artifactoryUser, artifactoryPassword) = getArtifactoryCredentials() - if (artifactoryUser?.trim() && artifactoryPassword?.trim()) { - maven { - url "https://repo.onewelcome.com/artifactory/onegini-sdk" - credentials { - username artifactoryUser.trim() - password artifactoryPassword.trim() - } - } - } else { - throw new InvalidUserDataException("You must configure the 'ARTIFACTORY_USER' and 'ARTIFACTORY_PASSWORD' environment variables before you can " + - "build the project.") - } - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -task clean(type: Delete) { - delete rootProject.buildDir -} - -def getArtifactoryCredentials() { - // Leave onegini_ property for backwards compatibility - if (project.hasProperty('onegini_artifactory_user') && project.hasProperty('onegini_artifactory_password')) { - return [onegini_artifactory_user, onegini_artifactory_password] - } else if (project.hasProperty('artifactory_user') && project.hasProperty('artifactory_password')) { - return [artifactory_user, artifactory_password] - } else if (System.env.ARTIFACTORY_USER && System.env.ARTIFACTORY_PASSWORD) { - return [System.env.ARTIFACTORY_USER, System.env.ARTIFACTORY_PASSWORD] - } else { - def artifactoryFile = file("${project.rootDir}/artifactory.properties") - if (artifactoryFile.exists()) { - def props = new Properties() - artifactoryFile.withInputStream { props.load(it) } - return [props.getProperty("artifactoryUser"), props.getProperty("artifactoryPassword")] - } - } - return ["", ""] -} +buildscript { + ext.kotlin_version = '1.8.0' + repositories { + mavenCentral() + google() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.2.2' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + def (artifactoryUser, artifactoryPassword) = getArtifactoryCredentials() + if (artifactoryUser?.trim() && artifactoryPassword?.trim()) { + maven { + url "https://repo.onewelcome.com/artifactory/onegini-sdk" + credentials { + username artifactoryUser.trim() + password artifactoryPassword.trim() + } + } + } else { + throw new InvalidUserDataException("You must configure the 'ARTIFACTORY_USER' and 'ARTIFACTORY_PASSWORD' environment variables before you can " + + "build the project.") + } + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} + +def getArtifactoryCredentials() { + // Leave onegini_ property for backwards compatibility + if (project.hasProperty('onegini_artifactory_user') && project.hasProperty('onegini_artifactory_password')) { + return [onegini_artifactory_user, onegini_artifactory_password] + } else if (project.hasProperty('artifactory_user') && project.hasProperty('artifactory_password')) { + return [artifactory_user, artifactory_password] + } else if (System.env.ARTIFACTORY_USER && System.env.ARTIFACTORY_PASSWORD) { + return [System.env.ARTIFACTORY_USER, System.env.ARTIFACTORY_PASSWORD] + } else { + def artifactoryFile = file("${project.rootDir}/artifactory.properties") + if (artifactoryFile.exists()) { + def props = new Properties() + artifactoryFile.withInputStream { props.load(it) } + return [props.getProperty("artifactoryUser"), props.getProperty("artifactoryPassword")] + } + } + return ["", ""] +} diff --git a/example/lib/screens/login_screen.dart b/example/lib/screens/login_screen.dart index cbe4729c..4fd74a61 100644 --- a/example/lib/screens/login_screen.dart +++ b/example/lib/screens/login_screen.dart @@ -48,7 +48,7 @@ class _LoginScreenState extends State { openWeb() async { /// Start registration - setState(() => {isLoading = true}); + setState(() => isLoading = true); try { var registrationResponse = await Onegini.instance.userClient.registerUser( @@ -72,7 +72,7 @@ class _LoginScreenState extends State { } registrationWithIdentityProvider(String identityProviderId) async { - setState(() => {isLoading = true}); + setState(() => isLoading = true); try { var registrationResponse = await Onegini.instance.userClient.registerUser( identityProviderId, @@ -253,9 +253,8 @@ class _LoginScreenState extends State { .map((e) => DropdownMenuItem(value: e.profileId, child: Text(e.profileId))) .toList(), - onChanged: (profileId) => { - setState(() => {selectedProfileId = profileId}) - }); + onChanged: (profileId) => + {setState(() => selectedProfileId = profileId)}); } Column _buildRegisterWidget() { diff --git a/example/lib/screens/pin_screen.dart b/example/lib/screens/pin_screen.dart index 26aa471e..9166ef20 100644 --- a/example/lib/screens/pin_screen.dart +++ b/example/lib/screens/pin_screen.dart @@ -59,7 +59,7 @@ class _PinScreenState extends State { } submit() { - setState(() => {isLoading = true}); + setState(() => isLoading = true); String pin = ""; pinCode.forEach((element) { pin += element; @@ -68,7 +68,7 @@ class _PinScreenState extends State { .acceptAuthenticationRequest(pin) .catchError((error) { if (error is PlatformException) { - setState(() => {isLoading = false}); + setState(() => isLoading = false); showFlutterToast(error.message); } }); From 802238df0441ac598fb8076472c459f32298d9d3 Mon Sep 17 00:00:00 2001 From: Michiel Vrins Date: Wed, 24 May 2023 16:22:37 +0200 Subject: [PATCH 05/13] FP-89: Android: Use new 'access' tokenserver --- .../mobile/onegini_example/OneginiConfig.kt | 55 ----------- .../onegini_example/OneginiConfigModel.java | 93 ++++++++++++++++++ .../onegini_example/SecurityController.java | 7 ++ .../onegini_example/SecurityController.kt | 7 -- .../android/app/src/main/res/raw/keystore.bks | Bin 1063 -> 2679 bytes 5 files changed, 100 insertions(+), 62 deletions(-) delete mode 100644 example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/OneginiConfig.kt create mode 100755 example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/OneginiConfigModel.java create mode 100755 example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/SecurityController.java delete mode 100644 example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/SecurityController.kt diff --git a/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/OneginiConfig.kt b/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/OneginiConfig.kt deleted file mode 100644 index 663474f6..00000000 --- a/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/OneginiConfig.kt +++ /dev/null @@ -1,55 +0,0 @@ -package com.onegini.mobile.onegini_example - -import android.os.Build -import com.onegini.mobile.sdk.android.model.OneginiClientConfigModel - - -class OneginiConfigModel : OneginiClientConfigModel { - - private val appIdentifier = "FlutterExampleApp" - private val appPlatform = "android" - private val redirectionUri = "oneginiexample://loginsuccess" - private val appVersion = "1.0.2" - private val baseURL = "https://token-mobile.test.onegini.com" - private val resourceBaseURL = "https://token-mobile.test.onegini.com/resources/" - private val keystoreHash = "ebbcab87e2d16b9441559767a7c85fbaea9a3feef94451990423019a31e5bf1f" - override fun getAppIdentifier(): String { - return appIdentifier - } - - override fun getAppPlatform(): String { - return appPlatform - } - - override fun getRedirectUri(): String { - return redirectionUri - } - - override fun getAppVersion(): String { - return appVersion - } - - override fun getBaseUrl(): String { - return baseURL - } - - override fun getResourceBaseUrl(): String { - return resourceBaseURL - } - - override fun getCertificatePinningKeyStore(): Int { - return R.raw.keystore - } - - override fun getKeyStoreHash(): String { - return keystoreHash - } - - override fun getDeviceName(): String { - return Build.BRAND + " " + Build.MODEL - } - - override fun getServerPublicKey(): String? { - return null - } -} \ No newline at end of file diff --git a/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/OneginiConfigModel.java b/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/OneginiConfigModel.java new file mode 100755 index 00000000..deef60a0 --- /dev/null +++ b/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/OneginiConfigModel.java @@ -0,0 +1,93 @@ +package com.onegini.mobile.onegini_example; + +import android.os.Build; +import com.onegini.mobile.onegini_example.R; +import com.onegini.mobile.sdk.android.model.OneginiClientConfigModel; + +public class OneginiConfigModel implements OneginiClientConfigModel { + + /* Config model generated by SDK Configurator version: v5.1.0 */ + + private final String appIdentifier = "FlutterExampleApp"; + private final String appPlatform = "android"; + private final String redirectionUri = "oneginiexample://loginsuccess"; + private final String appVersion = "1.0.2"; + private final String baseURL = "https://mobile-security-proxy.test.onegini.com"; + private final String resourceBaseURL = "https://mobile-security-proxy.test.onegini.com/resources/"; + private final String keystoreHash = "90cf65bea23977e84dcddfb38b8cecb5469d8ca43aa6b01575864ef2ca6eaa48"; + private final int maxPinFailures = 3; + private final String serverPublicKey = "17DDB4086A1D3FA37950CBDDC6F1173A0C5902A3B71DAD261290CEFEE13CC9CA"; + + public String getAppIdentifier() { + return appIdentifier; + } + + public String getAppPlatform() { + return appPlatform; + } + + public String getRedirectUri() { + return redirectionUri; + } + + public String getAppVersion() { + return appVersion; + } + + public String getBaseUrl() { + return baseURL; + } + + public String getResourceBaseUrl() { + return resourceBaseURL; + } + + public int getCertificatePinningKeyStore() { + return R.raw.keystore; + } + + public String getKeyStoreHash() { + return keystoreHash; + } + + public String getDeviceName() { + return Build.BRAND + " " + Build.MODEL; + } + + public String getServerPublicKey() { + return serverPublicKey; + } + + /** + * @Deprecated Since Android SDK 8.0.0 this attribute is not required. + */ + public boolean shouldGetIdToken() { + return false; + } + + /** + * Get the max PIN failures. This attribute is just used for visual representation towards the end-user. + * + * @Deprecated Since Android SDK 6.01.00 this attribute is fetched from the Device config. + * + * @return The max PIN failures + */ + public int getMaxPinFailures() { + return maxPinFailures; + } + + @Override + public String toString() { + return "ConfigModel{" + + " appIdentifier='" + appIdentifier + "'" + + ", appPlatform='" + appPlatform + "'" + + ", redirectionUri='" + redirectionUri + "'" + + ", appVersion='" + appVersion + "'" + + ", baseURL='" + baseURL + "'" + + ", maxPinFailures='" + maxPinFailures + "'" + + ", resourceBaseURL='" + resourceBaseURL + "'" + + ", keyStoreHash='" + getKeyStoreHash() + "'" + + ", serverPublicKey='" + serverPublicKey + "'" + + "}"; + } +} diff --git a/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/SecurityController.java b/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/SecurityController.java new file mode 100755 index 00000000..a8b259d7 --- /dev/null +++ b/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/SecurityController.java @@ -0,0 +1,7 @@ +package com.onegini.mobile.onegini_example; + +@SuppressWarnings({ "unused", "WeakerAccess" }) +public final class SecurityController { + public static final boolean rootDetection = false; + public static final boolean debugDetection = false; +} \ No newline at end of file diff --git a/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/SecurityController.kt b/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/SecurityController.kt deleted file mode 100644 index 9169d324..00000000 --- a/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/SecurityController.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.onegini.mobile.onegini_example - -object SecurityController { - const val debugDetection = false - const val rootDetection = false - const val debugLogs = true -} diff --git a/example/android/app/src/main/res/raw/keystore.bks b/example/android/app/src/main/res/raw/keystore.bks index bfcdf1b19c4af3596199a1826a984c9c8bfb1976..9abf5941273e71cb633b269522a6de203f5eb8ad 100644 GIT binary patch delta 1682 zcmaJ=c~BEq9NtaB62eU)DGIX6p`gaM0fblzgvhCa5I_p88k1n6K%8X}@d^Y89tEwD ziXg`bEuf;Hhr8pLg<5jT*K^<{C@BkUEZa^9Rr#tgz-}`>Q_q}hw_iY({h~)u6 z5KImhl<#2tPu4g@3BH4Fqrrkj{ zmgd#mZmN=O5lY2`e1jq&o{-{kQi)tdNT*t6j+5jNq!Y<;0Xzso*g%Cafr>g(Or^jS zipkFC5c`@f7fl}#=K7a~hGoDI(Q{P$tA`9>*gyvYskDCg<)urlt@zG zn=lSosI60(c9S(cF@Zosg?v;X#R++gTr48wig=WtNXQg8$p>b$4KX(i16(lqM6nH> z0LFDvlEa1P!ixf_`@a(F=Z(z*7E@x){BS90368E5#fxRq1agX*0HZ0*xmLnO|is9+enm*8~ozB_sw>SX)W-Sf~r=Gn%7%>_5AV#hud-89QJ zUgVjz5;jm7vz6;PFY5f0N6gcLD(`dcH0O02F0AsbSka{Pa(uy?c$nI5ZO-NYonn8% zW?LpYyLST3bI)0($V@~Ic-3$<=6WV{8;{P%nZ}BrLs%Ob@|Iv2mv`LJtcar(m&{V_ zs?NLcs->{Sb!$-`-FYN}6WOe1gh-+30qs}msO)afct z;kJUttKLe>CzQAS-GQBN4j9!mdYQjfWOxTkhDt&4cmtMG8xp+z@qqL10H%O3#D* zs|D}QP-AWaD{X@j&78){`ejXXSmoXxkn|#dIA5oy4$czwOkS#$F$_=8Xk^0GlfkrN zYS(mtkS_`hY5HMQIZMlf(#Yfj1fh{r2+$E^L#hExfx#+m(V7+j{D4ofpqQ`rlo7<{ zrHdDf@mNk`0+~;3SUF-v+~Vozl8N{xxYN1ikek33guVcQb#!!Ln6?qffYS2|04Qpw zX?Eg&*!dDknD$r!pJXI}-82ELw)jk-5GQQ@mf`F0k^eJQMSefGL3BlFVa@|+v~GSepL_h zLK=JWl1|; z_e_)yFL9#_dB@V7k6OI1H#&LO*7c=L`PSQap1(QhCt1&%`=)isw0>?zYs@lR`)m_# z)^*J(-NH1F#Se!+`euvk8=uv5{c&qfxtfvlkdt9Qb8NJ_cC~k0&RIO$7lCF-Q$|=U^t4f2i?4k zy!*_Mk?rqWO=au z``R5te7RrzQ%y5>zBp6RSH<;U+*#gWlh1PCFUX@=YZeW(@%-H@qs){upzHIy|D5*@ TPv4u}Id1zygl#zI^y~is-gtY} delta 81 zcmew^vYf++fq{V$h()$!ZQt*#`B+v#WHZ<298Vp;lcC=k7}(kv8Q6Uz9eq3 Date: Mon, 22 May 2023 13:39:11 +0200 Subject: [PATCH 06/13] FP-89: Use a different tokenserver --- example/ios/Configuration/OneginiConfigModel.m | 10 +++++----- example/ios/Runner.xcodeproj/project.pbxproj | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/example/ios/Configuration/OneginiConfigModel.m b/example/ios/Configuration/OneginiConfigModel.m index 486e4e1c..4175b2ae 100755 --- a/example/ios/Configuration/OneginiConfigModel.m +++ b/example/ios/Configuration/OneginiConfigModel.m @@ -6,7 +6,7 @@ @implementation OneginiConfigModel + (NSArray *)certificates { -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tL0NQUzALBglghkgBhv1sAQIwCAYGZ4EMAQIBMAgGBmeBDAECAjAIBgZngQwBAgMwDQYJKoZIhvcNAQELBQADggEBAAUkHd0bsCrrmNaF4zlNXmtXnYJX/OvoMaJXkGUFvhZEOFp3ArnPEELG4ZKk40Un+ABHLGioVplTVI+tnkDB0A+21w0LOEhsUCxJkAZbZB2LzEgwLt4I4ptJIsCSDBFelpKU1fwg3FZs5ZKTv3ocwDfjhUkV+ivhdDkYD7fa86JXWGBPzI6UAPxGezQxPk1HgoE6y/SJXQ7vTQ1unBuCJN0yJV0ReFEQPaA1IwQvZW+cwdFD19Ae8zFnWSfda9J1CZMRJCQUzym+5iPDuI9yP+kHyCREU3qzuWFloUwOxkgAyXVjBYdwRVKD05WdRerw6DEdfgkfCv4+3ao8XnTSrLE="]; //Base64Certificates } + (NSDictionary *)configuration @@ -14,16 +14,16 @@ + (NSDictionary *)configuration return @{ @"ONGAppIdentifier" : @"FlutterExampleApp", @"ONGAppPlatform" : @"ios", - @"ONGAppVersion" : @"1.0.3", - @"ONGAppBaseURL" : @"https://token-mobile.test.onegini.com", - @"ONGResourceBaseURL" : @"https://token-mobile.test.onegini.com/resources/", + @"ONGAppVersion" : @"1.0.0", + @"ONGAppBaseURL" : @"https://mobile-security-proxy.test.onegini.com", + @"ONGResourceBaseURL" : @"https://mobile-security-proxy.test.onegini.com/resources/", @"ONGRedirectURL" : @"oneginiexample://loginsuccess", }; } + (NSString *)serverPublicKey { - return @"4B8E698FEAA9F0A1E99644E77E1AB9EF5F63FBBFBA5EE52D881AADB2C0373336"; + return @"E23EDEC22396C17B204D9996295ED0045E5500B3281F0D00F242D71B5A4F3EC9"; } @end \ No newline at end of file diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 6b9ecbf2..e8b5841d 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -423,6 +423,7 @@ files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( From aea528d79f1c308150ab9ee6fe199c3af831b9ee Mon Sep 17 00:00:00 2001 From: Michiel Vrins Date: Thu, 25 May 2023 13:39:13 +0200 Subject: [PATCH 07/13] Enable dubug logs for android --- .../com/onegini/mobile/onegini_example/SecurityController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/SecurityController.java b/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/SecurityController.java index a8b259d7..f937a8ae 100755 --- a/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/SecurityController.java +++ b/example/android/app/src/main/kotlin/com/onegini/mobile/onegini_example/SecurityController.java @@ -4,4 +4,5 @@ public final class SecurityController { public static final boolean rootDetection = false; public static final boolean debugDetection = false; -} \ No newline at end of file + public static final boolean debugLogs = true; +} From e82edce770d13ac7fa7b9af2729d8173d896bc3d Mon Sep 17 00:00:00 2001 From: Michiel Vrins Date: Fri, 26 May 2023 16:04:08 +0200 Subject: [PATCH 08/13] FP-87: Convert methods to private in auth_screen --- example/lib/screens/auth_screen.dart | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/example/lib/screens/auth_screen.dart b/example/lib/screens/auth_screen.dart index 26c7cf7e..e254053a 100644 --- a/example/lib/screens/auth_screen.dart +++ b/example/lib/screens/auth_screen.dart @@ -42,7 +42,7 @@ class _AuthScreenState extends State { super.dispose(); } - openWeb() async { + _openWeb() async { /// Start registration setState(() => isLoading = true); @@ -67,7 +67,7 @@ class _AuthScreenState extends State { } } - registrationWithIdentityProvider(String identityProviderId) async { + _registraterWithIdentityProvider(String identityProviderId) async { setState(() => isLoading = true); try { var registrationResponse = await Onegini.instance.userClient.registerUser( @@ -90,7 +90,7 @@ class _AuthScreenState extends State { } } - cancelRegistration() async { + _cancelRegistration() async { setState(() => isLoading = false); try { await Future.any([ @@ -145,7 +145,7 @@ class _AuthScreenState extends State { SizedBox(height: 20), ElevatedButton( onPressed: () { - openWeb(); + _openWeb(); }, child: Text('Run WEB'), ), @@ -168,7 +168,7 @@ class _AuthScreenState extends State { ), ), onSelected: (value) { - registrationWithIdentityProvider(value); + _registraterWithIdentityProvider(value); }, itemBuilder: (context) { return identityProviders @@ -194,7 +194,7 @@ class _AuthScreenState extends State { SizedBox(height: 20), ElevatedButton( onPressed: () { - cancelRegistration(); + _cancelRegistration(); }, child: Text('Cancel'), ), @@ -215,7 +215,7 @@ class _LoginSectionState extends State { @override initState() { super.initState(); - fetchUserProfiles(); + _fetchUserProfiles(); } @override @@ -235,7 +235,7 @@ class _LoginSectionState extends State { _buildImplicitUserData(_selectedProfileId), ElevatedButton( onPressed: () { - authenticate(_selectedProfileId, null); + _authenticate(_selectedProfileId, null); }, child: Text('Preferred authenticator'), ), @@ -244,7 +244,7 @@ class _LoginSectionState extends State { children: [ ElevatedButton( onPressed: () { - authenticate( + _authenticate( _selectedProfileId, OWAuthenticatorType.pin); }, child: Text('Pin'), @@ -252,7 +252,7 @@ class _LoginSectionState extends State { SizedBox(height: 10, width: 10), ElevatedButton( onPressed: () { - authenticate( + _authenticate( _selectedProfileId, OWAuthenticatorType.biometric); }, child: Text('Biometrics'), @@ -274,7 +274,7 @@ class _LoginSectionState extends State { {setState(() => selectedProfileId = profileId)}); } - Future> fetchUserProfiles() async { + Future> _fetchUserProfiles() async { try { final profiles = await Onegini.instance.userClient.getUserProfiles(); setState(() { @@ -291,7 +291,7 @@ class _LoginSectionState extends State { Widget _buildImplicitUserData(final String profileId) { return FutureBuilder( - future: getImplicitUserDetails(profileId), + future: _getImplicitUserDetails(profileId), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { @@ -303,7 +303,7 @@ class _LoginSectionState extends State { }); } - Future getImplicitUserDetails(final String profileId) async { + Future _getImplicitUserDetails(final String profileId) async { try { await Onegini.instance.userClient .authenticateUserImplicitly(profileId, ["read"]); @@ -321,7 +321,7 @@ class _LoginSectionState extends State { } } - authenticate( + _authenticate( final String profileId, OWAuthenticatorType? authenticatorType) async { try { var registrationResponse = await Onegini.instance.userClient From d5dca6134cd63d5f3f1d8a5cedb32cc0212d526b Mon Sep 17 00:00:00 2001 From: Michiel Vrins Date: Tue, 30 May 2023 09:57:00 +0200 Subject: [PATCH 09/13] Add bitrise.yml and exclude it from publishing --- .pubignore | 3 + bitrise.yml | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 .pubignore create mode 100644 bitrise.yml diff --git a/.pubignore b/.pubignore new file mode 100644 index 00000000..014d3355 --- /dev/null +++ b/.pubignore @@ -0,0 +1,3 @@ +bitrise.yml +.github +releasing.md diff --git a/bitrise.yml b/bitrise.yml new file mode 100644 index 00000000..897884b1 --- /dev/null +++ b/bitrise.yml @@ -0,0 +1,159 @@ +--- +format_version: '11' +default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git +project_type: flutter +workflows: + Android: + description: | + Builds project and runs tests. + + Next steps: + - Check out [Getting started with Flutter apps](https://devcenter.bitrise.io/en/getting-started/getting-started-with-flutter-apps.html). + steps: + - git-clone@7: {} + - flutter-installer@0: {} + - script@1: + title: Script - flutter pub get + inputs: + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + # write your script here + cd $BITRISE_FLUTTER_PROJECT_LOCATION + flutter pub get + - install-missing-android-tools@3: + inputs: + - gradlew_path: "./example/android/gradlew" + - android-unit-test@1: + inputs: + - module: "$MODULE" + - project_location: "$BITRISE_SOURCE_DIR/example/android" + - script@1: + inputs: + - content: |- + #!/bin/env bash + set -ex + + # Deleting any old test results from BITRISE_TEST_RESULT_DIR + rm -rf "$BITRISE_TEST_RESULT_DIR/"* + + # Creating the sub-directory for the test run within the BITRISE_TEST_RESULT_DIR: + test_run_dir="$BITRISE_TEST_RESULT_DIR/unit_test_results" + mkdir "$test_run_dir" + + + # Exporting the JUnit XML test report: + cp $BITRISE_SOURCE_DIR/example/build/$MODULE/test-results/testDebugUnitTest/*.xml $test_run_dir/ + + # Creating the test-info.json file with the name of the test run defined: + echo '{"test-name":"Unit tests"}' >> "$test_run_dir/test-info.json" + is_always_run: true + - deploy-to-bitrise-io@2: {} + iOS: + description: | + Builds project and runs tests. + + Next steps: + - Check out [Getting started with Flutter apps](https://devcenter.bitrise.io/en/getting-started/getting-started-with-flutter-apps.html). + steps: + - git-clone@7: {} + - flutter-installer@0: {} + - cache-pull@2: {} + - script@1: + inputs: + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + # write your script here + cd $BITRISE_FLUTTER_PROJECT_LOCATION + flutter pub get + flutter precache --ios + title: Script - flutter pub get + - script@1: + inputs: + - content: | + #!/usr/bin/env bash + # fail if any commands fails + set -e + # debug log + set -x + + gem install cocoapods-art -v 1.0.1 + > /Users/vagrant/.netrc + echo "machine repo.onewelcome.com" > /Users/vagrant/.netrc + echo "login $ARTIFACTORY_USER" >> /Users/vagrant/.netrc + echo "password $ARTIFACTORY_PASSWORD" >> /Users/vagrant/.netrc + chmod 600 /Users/vagrant/.netrc + pod repo-art add onegini https://repo.onewelcome.com/artifactory/api/pods/cocoapods-public + title: Script - setup artifactory credentials + - cocoapods-install@2: + inputs: + - source_root_path: "$BITRISE_SOURCE_DIR/example/ios" + - xcodebuild@0: + inputs: + - xcodebuild_actions: build + - xcodebuild_output_formatter: tee + - cache-push@2: {} + - deploy-to-bitrise-io@2: {} + envs: + - opts: + is_expand: false + SIMULATOR_DEVICE: iPhone 14 + - opts: + is_expand: false + SIMULATOR_OS_VERSION: latest + - opts: + is_expand: false + BITRISE_PROJECT_PATH: example/ios/Runner.xcworkspace + - opts: + is_expand: false + BITRISE_SCHEME: Runner + primary: + description: | + Builds project and runs tests. + + Next steps: + - Check out [Getting started with Flutter apps](https://devcenter.bitrise.io/en/getting-started/getting-started-with-flutter-apps.html). + steps: + - build-router-start@0: + inputs: + - access_token: "$BITRISE_API_TOKEN" + - workflows: iOS + title: Bitrise Start iOS + - build-router-start@0: + title: Bitrise Start Android + inputs: + - access_token: "$BITRISE_API_TOKEN" + - workflows: Android + - git-clone@7: {} + - flutter-installer@0: {} + - deploy-to-bitrise-io@2: {} + - build-router-wait@0: + inputs: + - access_token: "$BITRISE_API_TOKEN" +meta: + bitrise.io: + stack: osx-xcode-14.2.x-ventura +app: + envs: + - opts: + is_expand: false + BITRISE_FLUTTER_PROJECT_LOCATION: example + - opts: + is_expand: false + MODULE: onegini +trigger_map: +- pull_request_source_branch: "*" + workflow: primary From 6b76d40d23f2ffc79a82c73dcfba83b417a4a585 Mon Sep 17 00:00:00 2001 From: Michiel Vrins Date: Tue, 30 May 2023 09:57:17 +0200 Subject: [PATCH 10/13] Remove some very old merge conflicts in LICENCE file --- LICENSE | 4 ---- 1 file changed, 4 deletions(-) diff --git a/LICENSE b/LICENSE index 729d8cca..e6df6a69 100644 --- a/LICENSE +++ b/LICENSE @@ -198,8 +198,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and -<<<<<<< HEAD - limitations under the License. -======= limitations under the License. ->>>>>>> dev/release_first From 00fd3878b774ef74ec5a2ac14656aae89fd77903 Mon Sep 17 00:00:00 2001 From: Michiel Vrins Date: Tue, 30 May 2023 15:15:00 +0200 Subject: [PATCH 11/13] Release version 3.0.1 --- CHANGELOG.md | 3 +++ pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd991747..1db5a9d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 3.0.1, May 30, 2023 +* Changed access modifier of a native api in order to hide it from the sdk user. + ## 3.0.0, May 3, 2023 You can find the full changelog [here](https://developer.onewelcome.com/flutter/plugin/v2-x) and an overview containing the upgrade instructions [here](https://developer.onewelcome.com/flutter/plugin/v2-0). diff --git a/pubspec.yaml b/pubspec.yaml index c76a20f3..73d9e19d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: onegini description: The Onegini Flutter Plugin is a plugin that allows you to utilize the Onegini Mobile SDKs in your Flutter applications. -version: 3.0.0 +version: 3.0.1 homepage: https://www.onegini.com environment: From a46ccff8954ac456d8c9173b8df0be8a2ba55a9d Mon Sep 17 00:00:00 2001 From: Michiel Vrins Date: Tue, 30 May 2023 15:35:52 +0200 Subject: [PATCH 12/13] Remove some files from the ios example app which were ignored but in git --- example/ios/Flutter/Flutter.podspec | 18 ------ example/ios/Podfile.lock | 89 ----------------------------- 2 files changed, 107 deletions(-) delete mode 100644 example/ios/Flutter/Flutter.podspec delete mode 100644 example/ios/Podfile.lock diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec deleted file mode 100644 index 8ce43943..00000000 --- a/example/ios/Flutter/Flutter.podspec +++ /dev/null @@ -1,18 +0,0 @@ -# -# NOTE: This podspec is NOT to be published. It is only used as a local source! -# This is a generated file; do not edit or check into version control. -# - -Pod::Spec.new do |s| - s.name = 'Flutter' - s.version = '1.0.0' - s.summary = 'A UI toolkit for beautiful and fast apps.' - s.homepage = 'https://flutter.dev' - s.license = { :type => 'BSD' } - s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } - s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } - s.ios.deployment_target = '11.0' - # Framework linking is handled by Flutter tooling, not CocoaPods. - # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. - s.vendored_frameworks = 'path/to/nothing' -end diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock deleted file mode 100644 index 97d8d58e..00000000 --- a/example/ios/Podfile.lock +++ /dev/null @@ -1,89 +0,0 @@ -PODS: - - AFNetworking (4.0.1): - - AFNetworking/NSURLSession (= 4.0.1) - - AFNetworking/Reachability (= 4.0.1) - - AFNetworking/Security (= 4.0.1) - - AFNetworking/Serialization (= 4.0.1) - - AFNetworking/UIKit (= 4.0.1) - - AFNetworking/NSURLSession (4.0.1): - - AFNetworking/Reachability - - AFNetworking/Security - - AFNetworking/Serialization - - AFNetworking/Reachability (4.0.1) - - AFNetworking/Security (4.0.1) - - AFNetworking/Serialization (4.0.1) - - AFNetworking/UIKit (4.0.1): - - AFNetworking/NSURLSession - - Flutter (1.0.0) - - fluttertoast (0.0.2): - - Flutter - - Toast - - MTBBarcodeScanner (5.0.11) - - onegini (1.2.1): - - Flutter - - OneginiSDKiOS (~> 12.2.2) - - OneginiSDKiOS (12.2.2): - - AFNetworking (~> 4.0.1) - - Typhoon (~> 4.0.8) - - qr_code_scanner (0.2.0): - - Flutter - - MTBBarcodeScanner - - SwiftLint (0.51.0) - - Toast (4.0.0) - - Typhoon (4.0.9): - - Typhoon/DeallocNotifier (= 4.0.9) - - Typhoon/IntrospectionUtils (= 4.0.9) - - Typhoon/no-arc (= 4.0.9) - - Typhoon/DeallocNotifier (4.0.9) - - Typhoon/IntrospectionUtils (4.0.9) - - Typhoon/no-arc (4.0.9): - - Typhoon/IntrospectionUtils - - url_launcher_ios (0.0.1): - - Flutter - -DEPENDENCIES: - - Flutter (from `Flutter`) - - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) - - onegini (from `.symlinks/plugins/onegini/ios`) - - qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`) - - SwiftLint - - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - -SPEC REPOS: - https://github.com/CocoaPods/Specs.git: - - AFNetworking - - MTBBarcodeScanner - - SwiftLint - - Toast - - Typhoon - https://repo.onewelcome.com/artifactory/api/pods/cocoapods-public: - - OneginiSDKiOS - -EXTERNAL SOURCES: - Flutter: - :path: Flutter - fluttertoast: - :path: ".symlinks/plugins/fluttertoast/ios" - onegini: - :path: ".symlinks/plugins/onegini/ios" - qr_code_scanner: - :path: ".symlinks/plugins/qr_code_scanner/ios" - url_launcher_ios: - :path: ".symlinks/plugins/url_launcher_ios/ios" - -SPEC CHECKSUMS: - AFNetworking: 3bd23d814e976cd148d7d44c3ab78017b744cd58 - Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 - fluttertoast: eb263d302cc92e04176c053d2385237e9f43fad0 - MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb - onegini: 28cf385b65961a518044f8ad5d0657193c4c3312 - OneginiSDKiOS: 33f5b66aacefbb54825ecde2d6b3e1fb22117dbd - qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e - SwiftLint: 1b7561918a19e23bfed960e40759086e70f4dba5 - Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 - Typhoon: 1973c93ecfb3edb963d78b10e715bc2911475bd2 - url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 - -PODFILE CHECKSUM: e49c186fd5db1b7547d2a80e7096f4e0713e90f9 - -COCOAPODS: 1.11.3 From a8d19e006a682383d2b8164b0d6955f5aa61c257 Mon Sep 17 00:00:00 2001 From: Michiel Vrins Date: Tue, 30 May 2023 15:54:02 +0200 Subject: [PATCH 13/13] Don't ignore gradlew so we can use it in pipelines --- .gitignore | 3 --- example/android/.gitignore | 3 --- 2 files changed, 6 deletions(-) diff --git a/.gitignore b/.gitignore index 99b1862b..2e484732 100644 --- a/.gitignore +++ b/.gitignore @@ -52,11 +52,8 @@ build/ **/example/.dart_tool/ # Android related -**/android/**/gradle-wrapper.jar **/android/.gradle **/android/captures/ -**/android/gradlew -**/android/gradlew.bat **/android/local.properties **/android/**/GeneratedPluginRegistrant.java diff --git a/example/android/.gitignore b/example/android/.gitignore index fa57afe4..176e81d3 100644 --- a/example/android/.gitignore +++ b/example/android/.gitignore @@ -1,8 +1,5 @@ -gradle-wrapper.jar /.gradle /captures/ -/gradlew -/gradlew.bat /local.properties GeneratedPluginRegistrant.java