diff --git a/flutter-ory-network/.gitignore b/flutter-ory-network/.gitignore new file mode 100644 index 0000000..189b569 --- /dev/null +++ b/flutter-ory-network/.gitignore @@ -0,0 +1,46 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release + +.env diff --git a/flutter-ory-network/.metadata b/flutter-ory-network/.metadata new file mode 100644 index 0000000..de745e4 --- /dev/null +++ b/flutter-ory-network/.metadata @@ -0,0 +1,45 @@ +# 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. + +version: + revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + channel: stable + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + - platform: android + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + - platform: ios + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + - platform: linux + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + - platform: macos + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + - platform: web + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + - platform: windows + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + + # 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/flutter-ory-network/README.md b/flutter-ory-network/README.md new file mode 100644 index 0000000..bfe6210 --- /dev/null +++ b/flutter-ory-network/README.md @@ -0,0 +1,36 @@ +# Integrate Ory Network with Flutter + +This example demonstrates how to use Ory Network with a Flutter app. It includes +login and registration with email and password. + +## Develop + +### Prerequisites + +1. [Flutter](https://docs.flutter.dev/get-started/install) version 3.13.1 +2. Xcode and Android Studio +3. iOS Simulator or Android Emulator +4. [Ory Network](https://console.ory.sh/) project + +### Environmental variables + +Create .env file with your project url in the root folder of the Flutter app + +```env +ORY_BASE_URL=https://{your-project-slug}.projects.oryapis.com +``` + +### Run locally + +1. Install dependencies from `pubspec.yaml` + +```console +flutter pub get +``` + +2. open iOS Simulator or Android Emulator +3. Start the app + +```console +flutter run +``` diff --git a/flutter-ory-network/analysis_options.yaml b/flutter-ory-network/analysis_options.yaml new file mode 100644 index 0000000..fd16f92 --- /dev/null +++ b/flutter-ory-network/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/flutter-ory-network/android/.gitignore b/flutter-ory-network/android/.gitignore new file mode 100644 index 0000000..6f56801 --- /dev/null +++ b/flutter-ory-network/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/flutter-ory-network/android/app/build.gradle b/flutter-ory-network/android/app/build.gradle new file mode 100644 index 0000000..9410838 --- /dev/null +++ b/flutter-ory-network/android/app/build.gradle @@ -0,0 +1,72 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + namespace "com.example.ory_network_flutter" + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.ory_network_flutter" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdkVersion 18 + targetSdkVersion flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} diff --git a/flutter-ory-network/android/app/src/debug/AndroidManifest.xml b/flutter-ory-network/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/flutter-ory-network/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/flutter-ory-network/android/app/src/main/AndroidManifest.xml b/flutter-ory-network/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..097b25f --- /dev/null +++ b/flutter-ory-network/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/flutter-ory-network/android/app/src/main/kotlin/com/example/kratos_flutter/MainActivity.kt b/flutter-ory-network/android/app/src/main/kotlin/com/example/kratos_flutter/MainActivity.kt new file mode 100644 index 0000000..7a4c9c7 --- /dev/null +++ b/flutter-ory-network/android/app/src/main/kotlin/com/example/kratos_flutter/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.ory_network_flutter + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/flutter-ory-network/android/app/src/main/res/drawable-v21/launch_background.xml b/flutter-ory-network/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/flutter-ory-network/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/flutter-ory-network/android/app/src/main/res/drawable/launch_background.xml b/flutter-ory-network/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/flutter-ory-network/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/flutter-ory-network/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/flutter-ory-network/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/flutter-ory-network/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/flutter-ory-network/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/flutter-ory-network/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/flutter-ory-network/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/flutter-ory-network/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/flutter-ory-network/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/flutter-ory-network/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/flutter-ory-network/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/flutter-ory-network/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/flutter-ory-network/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/flutter-ory-network/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/flutter-ory-network/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/flutter-ory-network/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/flutter-ory-network/android/app/src/main/res/values-night/styles.xml b/flutter-ory-network/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/flutter-ory-network/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/flutter-ory-network/android/app/src/main/res/values/styles.xml b/flutter-ory-network/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/flutter-ory-network/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/flutter-ory-network/android/app/src/profile/AndroidManifest.xml b/flutter-ory-network/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/flutter-ory-network/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/flutter-ory-network/android/build.gradle b/flutter-ory-network/android/build.gradle new file mode 100644 index 0000000..f7eb7f6 --- /dev/null +++ b/flutter-ory-network/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.7.10' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.3.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/flutter-ory-network/android/gradle.properties b/flutter-ory-network/android/gradle.properties new file mode 100644 index 0000000..94adc3a --- /dev/null +++ b/flutter-ory-network/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/flutter-ory-network/android/gradle/wrapper/gradle-wrapper.properties b/flutter-ory-network/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..3c472b9 --- /dev/null +++ b/flutter-ory-network/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/flutter-ory-network/android/settings.gradle b/flutter-ory-network/android/settings.gradle new file mode 100644 index 0000000..44e62bc --- /dev/null +++ b/flutter-ory-network/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/flutter-ory-network/assets/icons/eye-off.png b/flutter-ory-network/assets/icons/eye-off.png new file mode 100644 index 0000000..65924f7 Binary files /dev/null and b/flutter-ory-network/assets/icons/eye-off.png differ diff --git a/flutter-ory-network/assets/icons/eye.png b/flutter-ory-network/assets/icons/eye.png new file mode 100644 index 0000000..e8d3e11 Binary files /dev/null and b/flutter-ory-network/assets/icons/eye.png differ diff --git a/flutter-ory-network/assets/images/flows-auth-buttons-social-apple.png b/flutter-ory-network/assets/images/flows-auth-buttons-social-apple.png new file mode 100644 index 0000000..2a25944 Binary files /dev/null and b/flutter-ory-network/assets/images/flows-auth-buttons-social-apple.png differ diff --git a/flutter-ory-network/assets/images/flows-auth-buttons-social-github.png b/flutter-ory-network/assets/images/flows-auth-buttons-social-github.png new file mode 100644 index 0000000..b41817a Binary files /dev/null and b/flutter-ory-network/assets/images/flows-auth-buttons-social-github.png differ diff --git a/flutter-ory-network/assets/images/flows-auth-buttons-social-google.png b/flutter-ory-network/assets/images/flows-auth-buttons-social-google.png new file mode 100644 index 0000000..9a9c46c Binary files /dev/null and b/flutter-ory-network/assets/images/flows-auth-buttons-social-google.png differ diff --git a/flutter-ory-network/assets/images/flows-auth-buttons-social-linkedin.png b/flutter-ory-network/assets/images/flows-auth-buttons-social-linkedin.png new file mode 100644 index 0000000..1bac417 Binary files /dev/null and b/flutter-ory-network/assets/images/flows-auth-buttons-social-linkedin.png differ diff --git a/flutter-ory-network/assets/images/ory_logo.png b/flutter-ory-network/assets/images/ory_logo.png new file mode 100644 index 0000000..41915eb Binary files /dev/null and b/flutter-ory-network/assets/images/ory_logo.png differ diff --git a/flutter-ory-network/ios/.gitignore b/flutter-ory-network/ios/.gitignore new file mode 100644 index 0000000..7a7f987 --- /dev/null +++ b/flutter-ory-network/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/flutter-ory-network/ios/Flutter/AppFrameworkInfo.plist b/flutter-ory-network/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..9625e10 --- /dev/null +++ b/flutter-ory-network/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 11.0 + + diff --git a/flutter-ory-network/ios/Flutter/Debug.xcconfig b/flutter-ory-network/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..ec97fc6 --- /dev/null +++ b/flutter-ory-network/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/flutter-ory-network/ios/Flutter/Release.xcconfig b/flutter-ory-network/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..c4855bf --- /dev/null +++ b/flutter-ory-network/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/flutter-ory-network/ios/Podfile b/flutter-ory-network/ios/Podfile new file mode 100644 index 0000000..fdcc671 --- /dev/null +++ b/flutter-ory-network/ios/Podfile @@ -0,0 +1,44 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '11.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/flutter-ory-network/ios/Podfile.lock b/flutter-ory-network/ios/Podfile.lock new file mode 100644 index 0000000..8d11310 --- /dev/null +++ b/flutter-ory-network/ios/Podfile.lock @@ -0,0 +1,29 @@ +PODS: + - Flutter (1.0.0) + - flutter_secure_storage (6.0.0): + - Flutter + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS + +DEPENDENCIES: + - Flutter (from `Flutter`) + - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) + - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) + +EXTERNAL SOURCES: + Flutter: + :path: Flutter + flutter_secure_storage: + :path: ".symlinks/plugins/flutter_secure_storage/ios" + path_provider_foundation: + :path: ".symlinks/plugins/path_provider_foundation/darwin" + +SPEC CHECKSUMS: + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be + path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 + +PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189 + +COCOAPODS: 1.12.1 diff --git a/flutter-ory-network/ios/Runner.xcodeproj/project.pbxproj b/flutter-ory-network/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..f7804ea --- /dev/null +++ b/flutter-ory-network/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,721 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 806A4268FA350FE41F8569DA /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B1C3FAC3908A19FDC95DF8C /* Pods_RunnerTests.framework */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + 99C4A8A0D8F4812473034146 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2FC830B17BFE3D0034060C69 /* Pods_Runner.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 0CB57777B6627A48BB9FA8C8 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 2FC830B17BFE3D0034060C69 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 5049002C15409643EB52610C /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + 572786F99F7DFEE344A536D0 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7B1C3FAC3908A19FDC95DF8C /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A7A031BF64D7C0BBC9510C27 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + B9F2C68CEBAD8576F94DBFA2 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + BFB18E6C40720455AECECC2B /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 99C4A8A0D8F4812473034146 /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A11DA63E44DE6327E50E646B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 806A4268FA350FE41F8569DA /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + A665270B796B85815C608C0F /* Pods */, + F2402B6CEE3498843683A976 /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; + A665270B796B85815C608C0F /* Pods */ = { + isa = PBXGroup; + children = ( + A7A031BF64D7C0BBC9510C27 /* Pods-Runner.debug.xcconfig */, + B9F2C68CEBAD8576F94DBFA2 /* Pods-Runner.release.xcconfig */, + BFB18E6C40720455AECECC2B /* Pods-Runner.profile.xcconfig */, + 0CB57777B6627A48BB9FA8C8 /* Pods-RunnerTests.debug.xcconfig */, + 5049002C15409643EB52610C /* Pods-RunnerTests.release.xcconfig */, + 572786F99F7DFEE344A536D0 /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + F2402B6CEE3498843683A976 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 2FC830B17BFE3D0034060C69 /* Pods_Runner.framework */, + 7B1C3FAC3908A19FDC95DF8C /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 3834015CF9820D05956C35E2 /* [CP] Check Pods Manifest.lock */, + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + A11DA63E44DE6327E50E646B /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 41429A30DBA960B328EE0121 /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 15FE7AA82ACE92C893182D64 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1430; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 15FE7AA82ACE92C893182D64 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 3834015CF9820D05956C35E2 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 41429A30DBA960B328EE0121 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.ory_network_flutter; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 0CB57777B6627A48BB9FA8C8 /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.ory_network_flutter.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 5049002C15409643EB52610C /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.ory_network_flutter.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 572786F99F7DFEE344A536D0 /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.ory_network_flutter.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.ory_network_flutter; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.ory_network_flutter; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/flutter-ory-network/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/flutter-ory-network/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/flutter-ory-network/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/flutter-ory-network/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/flutter-ory-network/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/flutter-ory-network/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/flutter-ory-network/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/flutter-ory-network/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/flutter-ory-network/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/flutter-ory-network/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/flutter-ory-network/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..87131a0 --- /dev/null +++ b/flutter-ory-network/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/flutter-ory-network/ios/Runner.xcworkspace/contents.xcworkspacedata b/flutter-ory-network/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..21a3cc1 --- /dev/null +++ b/flutter-ory-network/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/flutter-ory-network/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/flutter-ory-network/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/flutter-ory-network/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/flutter-ory-network/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/flutter-ory-network/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/flutter-ory-network/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/flutter-ory-network/ios/Runner/AppDelegate.swift b/flutter-ory-network/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..70693e4 --- /dev/null +++ b/flutter-ory-network/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..e882ab9 --- /dev/null +++ b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images": [ + { + "size": "20x20", + "idiom": "iphone", + "filename": "Icon-App-20x20@2x.png", + "scale": "2x" + }, + { + "size": "20x20", + "idiom": "iphone", + "filename": "Icon-App-20x20@3x.png", + "scale": "3x" + }, + { + "size": "29x29", + "idiom": "iphone", + "filename": "Icon-App-29x29@1x.png", + "scale": "1x" + }, + { + "size": "29x29", + "idiom": "iphone", + "filename": "Icon-App-29x29@2x.png", + "scale": "2x" + }, + { + "size": "29x29", + "idiom": "iphone", + "filename": "Icon-App-29x29@3x.png", + "scale": "3x" + }, + { + "size": "40x40", + "idiom": "iphone", + "filename": "Icon-App-40x40@2x.png", + "scale": "2x" + }, + { + "size": "40x40", + "idiom": "iphone", + "filename": "Icon-App-40x40@3x.png", + "scale": "3x" + }, + { + "size": "60x60", + "idiom": "iphone", + "filename": "Icon-App-60x60@2x.png", + "scale": "2x" + }, + { + "size": "60x60", + "idiom": "iphone", + "filename": "Icon-App-60x60@3x.png", + "scale": "3x" + }, + { + "size": "20x20", + "idiom": "ipad", + "filename": "Icon-App-20x20@1x.png", + "scale": "1x" + }, + { + "size": "20x20", + "idiom": "ipad", + "filename": "Icon-App-20x20@2x.png", + "scale": "2x" + }, + { + "size": "29x29", + "idiom": "ipad", + "filename": "Icon-App-29x29@1x.png", + "scale": "1x" + }, + { + "size": "29x29", + "idiom": "ipad", + "filename": "Icon-App-29x29@2x.png", + "scale": "2x" + }, + { + "size": "40x40", + "idiom": "ipad", + "filename": "Icon-App-40x40@1x.png", + "scale": "1x" + }, + { + "size": "40x40", + "idiom": "ipad", + "filename": "Icon-App-40x40@2x.png", + "scale": "2x" + }, + { + "size": "76x76", + "idiom": "ipad", + "filename": "Icon-App-76x76@1x.png", + "scale": "1x" + }, + { + "size": "76x76", + "idiom": "ipad", + "filename": "Icon-App-76x76@2x.png", + "scale": "2x" + }, + { + "size": "83.5x83.5", + "idiom": "ipad", + "filename": "Icon-App-83.5x83.5@2x.png", + "scale": "2x" + }, + { + "size": "1024x1024", + "idiom": "ios-marketing", + "filename": "Icon-App-1024x1024@1x.png", + "scale": "1x" + } + ], + "info": { + "version": 1, + "author": "xcode" + } +} diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..dc9ada4 Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..7353c41 Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..6ed2d93 Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cd7b00 Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..fe73094 Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..321773c Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..502f463 Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..e9f5fea Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..84ac32a Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..8953cba Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..0467bf1 Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..781d7cd --- /dev/null +++ b/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images": [ + { + "idiom": "universal", + "filename": "LaunchImage.png", + "scale": "1x" + }, + { + "idiom": "universal", + "filename": "LaunchImage@2x.png", + "scale": "2x" + }, + { + "idiom": "universal", + "filename": "LaunchImage@3x.png", + "scale": "3x" + } + ], + "info": { + "version": 1, + "author": "xcode" + } +} diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..09c4940 --- /dev/null +++ b/flutter-ory-network/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,8 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing +the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with +`open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project +Navigator and dropping in the desired images. diff --git a/flutter-ory-network/ios/Runner/Base.lproj/LaunchScreen.storyboard b/flutter-ory-network/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/flutter-ory-network/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/flutter-ory-network/ios/Runner/Base.lproj/Main.storyboard b/flutter-ory-network/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/flutter-ory-network/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/flutter-ory-network/ios/Runner/Info.plist b/flutter-ory-network/ios/Runner/Info.plist new file mode 100644 index 0000000..f3fb7dd --- /dev/null +++ b/flutter-ory-network/ios/Runner/Info.plist @@ -0,0 +1,51 @@ + + + + + CADisableMinimumFrameDurationOnPhone + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Ory Network Flutter + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ory_network_flutter + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/flutter-ory-network/ios/Runner/Runner-Bridging-Header.h b/flutter-ory-network/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/flutter-ory-network/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/flutter-ory-network/ios/RunnerTests/RunnerTests.swift b/flutter-ory-network/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..86a7c3b --- /dev/null +++ b/flutter-ory-network/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/flutter-ory-network/lib/blocs/auth/auth_bloc.dart b/flutter-ory-network/lib/blocs/auth/auth_bloc.dart new file mode 100644 index 0000000..6d49f03 --- /dev/null +++ b/flutter-ory-network/lib/blocs/auth/auth_bloc.dart @@ -0,0 +1,70 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:bloc/bloc.dart'; +import 'package:equatable/equatable.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:ory_client/ory_client.dart'; + +import '../../repositories/auth.dart'; +import '../../services/exceptions.dart'; + +part 'auth_event.dart'; +part 'auth_state.dart'; +part 'auth_bloc.freezed.dart'; + +class AuthBloc extends Bloc { + final AuthRepository repository; + AuthBloc({required this.repository}) + : super(const AuthState(status: AuthStatus.uninitialized)) { + on(_onGetCurrentSessionInformation); + on(_onChangeAuthStatus); + on(_onLogOut); + } + + _onChangeAuthStatus(ChangeAuthStatus event, Emitter emit) { + emit(state.copyWith(status: event.status, isLoading: false)); + } + + Future _onGetCurrentSessionInformation( + GetCurrentSessionInformation event, Emitter emit) async { + try { + emit(state.copyWith(isLoading: true, errorMessage: null)); + + final session = await repository.getCurrentSessionInformation(); + + emit(state.copyWith( + isLoading: false, + status: AuthStatus.authenticated, + session: session)); + } on UnauthorizedException catch (_) { + emit(state.copyWith( + status: AuthStatus.unauthenticated, session: null, isLoading: false)); + } on TwoFactorAuthRequiredException catch (_) { + emit(state.copyWith( + isLoading: false, session: null, status: AuthStatus.aal2Requested)); + } on UnknownException catch (e) { + emit(state.copyWith(isLoading: false, errorMessage: e.message)); + } catch (_) { + emit(state.copyWith(isLoading: false)); + } + } + + Future _onLogOut(LogOut event, Emitter emit) async { + try { + emit(state.copyWith(isLoading: true, errorMessage: null)); + + await repository.logout(); + + emit(state.copyWith( + isLoading: false, status: AuthStatus.unauthenticated, session: null)); + } on UnauthorizedException catch (_) { + emit(state.copyWith( + status: AuthStatus.unauthenticated, session: null, isLoading: false)); + } on UnknownException catch (e) { + emit(state.copyWith(isLoading: false, errorMessage: e.message)); + } catch (_) { + emit(state.copyWith(isLoading: false)); + } + } +} diff --git a/flutter-ory-network/lib/blocs/auth/auth_bloc.freezed.dart b/flutter-ory-network/lib/blocs/auth/auth_bloc.freezed.dart new file mode 100644 index 0000000..c9fb075 --- /dev/null +++ b/flutter-ory-network/lib/blocs/auth/auth_bloc.freezed.dart @@ -0,0 +1,201 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'auth_bloc.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +/// @nodoc +mixin _$AuthState { + AuthStatus get status => throw _privateConstructorUsedError; + Session? get session => throw _privateConstructorUsedError; + bool get isLoading => throw _privateConstructorUsedError; + String? get errorMessage => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $AuthStateCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AuthStateCopyWith<$Res> { + factory $AuthStateCopyWith(AuthState value, $Res Function(AuthState) then) = + _$AuthStateCopyWithImpl<$Res, AuthState>; + @useResult + $Res call( + {AuthStatus status, + Session? session, + bool isLoading, + String? errorMessage}); +} + +/// @nodoc +class _$AuthStateCopyWithImpl<$Res, $Val extends AuthState> + implements $AuthStateCopyWith<$Res> { + _$AuthStateCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? status = null, + Object? session = freezed, + Object? isLoading = null, + Object? errorMessage = freezed, + }) { + return _then(_value.copyWith( + status: null == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as AuthStatus, + session: freezed == session + ? _value.session + : session // ignore: cast_nullable_to_non_nullable + as Session?, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + errorMessage: freezed == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_AuthStateCopyWith<$Res> implements $AuthStateCopyWith<$Res> { + factory _$$_AuthStateCopyWith( + _$_AuthState value, $Res Function(_$_AuthState) then) = + __$$_AuthStateCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {AuthStatus status, + Session? session, + bool isLoading, + String? errorMessage}); +} + +/// @nodoc +class __$$_AuthStateCopyWithImpl<$Res> + extends _$AuthStateCopyWithImpl<$Res, _$_AuthState> + implements _$$_AuthStateCopyWith<$Res> { + __$$_AuthStateCopyWithImpl( + _$_AuthState _value, $Res Function(_$_AuthState) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? status = null, + Object? session = freezed, + Object? isLoading = null, + Object? errorMessage = freezed, + }) { + return _then(_$_AuthState( + status: null == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as AuthStatus, + session: freezed == session + ? _value.session + : session // ignore: cast_nullable_to_non_nullable + as Session?, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + errorMessage: freezed == errorMessage + ? _value.errorMessage + : errorMessage // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc + +class _$_AuthState implements _AuthState { + const _$_AuthState( + {required this.status, + this.session, + this.isLoading = false, + this.errorMessage}); + + @override + final AuthStatus status; + @override + final Session? session; + @override + @JsonKey() + final bool isLoading; + @override + final String? errorMessage; + + @override + String toString() { + return 'AuthState(status: $status, session: $session, isLoading: $isLoading, errorMessage: $errorMessage)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_AuthState && + (identical(other.status, status) || other.status == status) && + (identical(other.session, session) || other.session == session) && + (identical(other.isLoading, isLoading) || + other.isLoading == isLoading) && + (identical(other.errorMessage, errorMessage) || + other.errorMessage == errorMessage)); + } + + @override + int get hashCode => + Object.hash(runtimeType, status, session, isLoading, errorMessage); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_AuthStateCopyWith<_$_AuthState> get copyWith => + __$$_AuthStateCopyWithImpl<_$_AuthState>(this, _$identity); +} + +abstract class _AuthState implements AuthState { + const factory _AuthState( + {required final AuthStatus status, + final Session? session, + final bool isLoading, + final String? errorMessage}) = _$_AuthState; + + @override + AuthStatus get status; + @override + Session? get session; + @override + bool get isLoading; + @override + String? get errorMessage; + @override + @JsonKey(ignore: true) + _$$_AuthStateCopyWith<_$_AuthState> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/flutter-ory-network/lib/blocs/auth/auth_event.dart b/flutter-ory-network/lib/blocs/auth/auth_event.dart new file mode 100644 index 0000000..041a607 --- /dev/null +++ b/flutter-ory-network/lib/blocs/auth/auth_event.dart @@ -0,0 +1,22 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +part of 'auth_bloc.dart'; + +@immutable +sealed class AuthEvent extends Equatable { + @override + List get props => []; +} + +final class ChangeAuthStatus extends AuthEvent { + final AuthStatus status; + + ChangeAuthStatus({required this.status}); + @override + List get props => [status]; +} + +final class GetCurrentSessionInformation extends AuthEvent {} + +final class LogOut extends AuthEvent {} diff --git a/flutter-ory-network/lib/blocs/auth/auth_state.dart b/flutter-ory-network/lib/blocs/auth/auth_state.dart new file mode 100644 index 0000000..eaa742e --- /dev/null +++ b/flutter-ory-network/lib/blocs/auth/auth_state.dart @@ -0,0 +1,13 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +part of 'auth_bloc.dart'; + +@freezed +sealed class AuthState with _$AuthState { + const factory AuthState( + {required AuthStatus status, + Session? session, + @Default(false) bool isLoading, + String? errorMessage}) = _AuthState; +} diff --git a/flutter-ory-network/lib/blocs/login/login_bloc.dart b/flutter-ory-network/lib/blocs/login/login_bloc.dart new file mode 100644 index 0000000..103b574 --- /dev/null +++ b/flutter-ory-network/lib/blocs/login/login_bloc.dart @@ -0,0 +1,88 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:bloc/bloc.dart'; +import 'package:equatable/equatable.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:ory_client/ory_client.dart'; + +import '../../repositories/auth.dart'; +import '../../services/exceptions.dart'; +import '../auth/auth_bloc.dart'; + +part 'login_event.dart'; +part 'login_state.dart'; +part 'login_bloc.freezed.dart'; + +class LoginBloc extends Bloc { + final AuthBloc authBloc; + final AuthRepository repository; + LoginBloc({required this.authBloc, required this.repository}) + : super(const LoginState()) { + on(_onCreateLoginFlow); + on(_onGetLoginFlow); + on(_onChangeNodeValue); + on(_onUpdateLoginFlow); + } + + Future _onCreateLoginFlow( + CreateLoginFlow event, Emitter emit) async { + try { + emit(state.copyWith(isLoading: true, message: null)); + + final loginFlow = await repository.createLoginFlow(aal: event.aal); + + emit(state.copyWith(loginFlow: loginFlow, isLoading: false)); + } on UnknownException catch (e) { + emit(state.copyWith(isLoading: false, message: e.message)); + } catch (_) { + emit(state.copyWith(isLoading: false)); + } + } + + Future _onGetLoginFlow( + GetLoginFlow event, Emitter emit) async { + try { + emit(state.copyWith(isLoading: true, message: null)); + final loginFlow = await repository.getLoginFlow(flowId: event.flowId); + emit(state.copyWith(loginFlow: loginFlow, isLoading: false)); + } on UnknownException catch (e) { + emit(state.copyWith(isLoading: false, message: e.message)); + } catch (_) { + emit(state.copyWith(isLoading: false)); + } + } + + _onChangeNodeValue(ChangeNodeValue event, Emitter emit) { + if (state.loginFlow != null) { + final newLoginState = repository.changeLoginNodeValue( + settings: state.loginFlow!, name: event.name, value: event.value); + emit(state.copyWith(loginFlow: newLoginState, message: null)); + } + } + + _onUpdateLoginFlow(UpdateLoginFlow event, Emitter emit) async { + try { + emit(state.copyWith(isLoading: true, message: null)); + await repository.updateLoginFlow( + flowId: state.loginFlow!.id, + group: event.group, + name: event.name, + value: event.value, + nodes: state.loginFlow!.ui.nodes.toList()); + authBloc.add(ChangeAuthStatus(status: AuthStatus.authenticated)); + } on BadRequestException catch (e) { + emit(state.copyWith(loginFlow: e.flow, isLoading: false)); + } on UnauthorizedException catch (_) { + authBloc.add(ChangeAuthStatus(status: AuthStatus.unauthenticated)); + } on FlowExpiredException catch (e) { + add(GetLoginFlow(flowId: e.flowId)); + } on TwoFactorAuthRequiredException catch (_) { + authBloc.add(ChangeAuthStatus(status: AuthStatus.aal2Requested)); + } on UnknownException catch (e) { + emit(state.copyWith(isLoading: false, message: e.message)); + } catch (_) { + emit(state.copyWith(isLoading: false)); + } + } +} diff --git a/flutter-ory-network/lib/blocs/login/login_bloc.freezed.dart b/flutter-ory-network/lib/blocs/login/login_bloc.freezed.dart new file mode 100644 index 0000000..805f093 --- /dev/null +++ b/flutter-ory-network/lib/blocs/login/login_bloc.freezed.dart @@ -0,0 +1,173 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'login_bloc.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +/// @nodoc +mixin _$LoginState { + LoginFlow? get loginFlow => throw _privateConstructorUsedError; + bool get isLoading => throw _privateConstructorUsedError; + String? get message => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $LoginStateCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $LoginStateCopyWith<$Res> { + factory $LoginStateCopyWith( + LoginState value, $Res Function(LoginState) then) = + _$LoginStateCopyWithImpl<$Res, LoginState>; + @useResult + $Res call({LoginFlow? loginFlow, bool isLoading, String? message}); +} + +/// @nodoc +class _$LoginStateCopyWithImpl<$Res, $Val extends LoginState> + implements $LoginStateCopyWith<$Res> { + _$LoginStateCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? loginFlow = freezed, + Object? isLoading = null, + Object? message = freezed, + }) { + return _then(_value.copyWith( + loginFlow: freezed == loginFlow + ? _value.loginFlow + : loginFlow // ignore: cast_nullable_to_non_nullable + as LoginFlow?, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + message: freezed == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_LoginStateCopyWith<$Res> + implements $LoginStateCopyWith<$Res> { + factory _$$_LoginStateCopyWith( + _$_LoginState value, $Res Function(_$_LoginState) then) = + __$$_LoginStateCopyWithImpl<$Res>; + @override + @useResult + $Res call({LoginFlow? loginFlow, bool isLoading, String? message}); +} + +/// @nodoc +class __$$_LoginStateCopyWithImpl<$Res> + extends _$LoginStateCopyWithImpl<$Res, _$_LoginState> + implements _$$_LoginStateCopyWith<$Res> { + __$$_LoginStateCopyWithImpl( + _$_LoginState _value, $Res Function(_$_LoginState) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? loginFlow = freezed, + Object? isLoading = null, + Object? message = freezed, + }) { + return _then(_$_LoginState( + loginFlow: freezed == loginFlow + ? _value.loginFlow + : loginFlow // ignore: cast_nullable_to_non_nullable + as LoginFlow?, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + message: freezed == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc + +class _$_LoginState implements _LoginState { + const _$_LoginState({this.loginFlow, this.isLoading = false, this.message}); + + @override + final LoginFlow? loginFlow; + @override + @JsonKey() + final bool isLoading; + @override + final String? message; + + @override + String toString() { + return 'LoginState(loginFlow: $loginFlow, isLoading: $isLoading, message: $message)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_LoginState && + (identical(other.loginFlow, loginFlow) || + other.loginFlow == loginFlow) && + (identical(other.isLoading, isLoading) || + other.isLoading == isLoading) && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => Object.hash(runtimeType, loginFlow, isLoading, message); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_LoginStateCopyWith<_$_LoginState> get copyWith => + __$$_LoginStateCopyWithImpl<_$_LoginState>(this, _$identity); +} + +abstract class _LoginState implements LoginState { + const factory _LoginState( + {final LoginFlow? loginFlow, + final bool isLoading, + final String? message}) = _$_LoginState; + + @override + LoginFlow? get loginFlow; + @override + bool get isLoading; + @override + String? get message; + @override + @JsonKey(ignore: true) + _$$_LoginStateCopyWith<_$_LoginState> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/flutter-ory-network/lib/blocs/login/login_event.dart b/flutter-ory-network/lib/blocs/login/login_event.dart new file mode 100644 index 0000000..b048895 --- /dev/null +++ b/flutter-ory-network/lib/blocs/login/login_event.dart @@ -0,0 +1,46 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +part of 'login_bloc.dart'; + +@immutable +sealed class LoginEvent extends Equatable { + @override + List get props => []; +} + +final class CreateLoginFlow extends LoginEvent { + final String aal; + + CreateLoginFlow({required this.aal}); + @override + List get props => [aal]; +} + +class ChangeNodeValue extends LoginEvent { + final String value; + final String name; + + ChangeNodeValue({required this.value, required this.name}); + @override + List get props => [value, name]; +} + +class GetLoginFlow extends LoginEvent { + final String flowId; + + GetLoginFlow({required this.flowId}); + @override + List get props => [flowId]; +} + +class UpdateLoginFlow extends LoginEvent { + final UiNodeGroupEnum group; + final String name; + final String value; + + UpdateLoginFlow( + {required this.group, required this.name, required this.value}); + @override + List get props => [group, name, value]; +} diff --git a/flutter-ory-network/lib/blocs/login/login_state.dart b/flutter-ory-network/lib/blocs/login/login_state.dart new file mode 100644 index 0000000..f28cce9 --- /dev/null +++ b/flutter-ory-network/lib/blocs/login/login_state.dart @@ -0,0 +1,12 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +part of 'login_bloc.dart'; + +@freezed +sealed class LoginState with _$LoginState { + const factory LoginState( + {LoginFlow? loginFlow, + @Default(false) bool isLoading, + String? message}) = _LoginState; +} diff --git a/flutter-ory-network/lib/blocs/registration/registration_bloc.dart b/flutter-ory-network/lib/blocs/registration/registration_bloc.dart new file mode 100644 index 0000000..cc861f0 --- /dev/null +++ b/flutter-ory-network/lib/blocs/registration/registration_bloc.dart @@ -0,0 +1,88 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:bloc/bloc.dart'; +import 'package:equatable/equatable.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:ory_client/ory_client.dart'; + +import '../../repositories/auth.dart'; +import '../../services/exceptions.dart'; +import '../auth/auth_bloc.dart'; + +part 'registration_event.dart'; +part 'registration_state.dart'; +part 'registration_bloc.freezed.dart'; + +class RegistrationBloc extends Bloc { + final AuthBloc authBloc; + final AuthRepository repository; + RegistrationBloc({required this.authBloc, required this.repository}) + : super(const RegistrationState()) { + on(_onCreateRegistrationFlow); + on(_onGetRegistrationFlow); + on(_onChangeNodeValue); + on(_onUpdateRegistrationFlow); + } + + Future _onCreateRegistrationFlow( + CreateRegistrationFlow event, Emitter emit) async { + try { + emit(state.copyWith(isLoading: true, message: null)); + final flow = await repository.createRegistrationFlow(); + emit(state.copyWith(registrationFlow: flow, isLoading: false)); + } on UnknownException catch (e) { + emit(state.copyWith(isLoading: false, message: e.message)); + } catch (_) { + emit(state.copyWith(isLoading: false)); + } + } + + Future _onGetRegistrationFlow( + GetRegistrationFlow event, Emitter emit) async { + try { + emit(state.copyWith(isLoading: true, message: null)); + final flow = await repository.getRegistrationFlow(flowId: event.flowId); + emit(state.copyWith(registrationFlow: flow, isLoading: false)); + } on UnknownException catch (e) { + emit(state.copyWith(isLoading: false, message: e.message)); + } catch (_) { + emit(state.copyWith(isLoading: false)); + } + } + + _onChangeNodeValue(ChangeNodeValue event, Emitter emit) { + if (state.registrationFlow != null) { + final newRegistrationState = repository.changeRegistrationNodeValue( + settings: state.registrationFlow!, + name: event.name, + value: event.value); + emit(state.copyWith( + registrationFlow: newRegistrationState, message: null)); + } + } + + Future _onUpdateRegistrationFlow( + UpdateRegistrationFlow event, Emitter emit) async { + try { + if (state.registrationFlow != null) { + emit(state.copyWith(isLoading: true, message: null)); + await repository.updateRegistrationFlow( + flowId: state.registrationFlow!.id, + group: event.group, + name: event.name, + value: event.value, + nodes: state.registrationFlow!.ui.nodes.toList()); + authBloc.add(ChangeAuthStatus(status: AuthStatus.authenticated)); + } + } on BadRequestException catch (e) { + emit(state.copyWith(registrationFlow: e.flow, isLoading: false)); + } on FlowExpiredException catch (e) { + add(GetRegistrationFlow(flowId: e.flowId)); + } on UnknownException catch (e) { + emit(state.copyWith(isLoading: false, message: e.message)); + } catch (_) { + emit(state.copyWith(isLoading: false)); + } + } +} diff --git a/flutter-ory-network/lib/blocs/registration/registration_bloc.freezed.dart b/flutter-ory-network/lib/blocs/registration/registration_bloc.freezed.dart new file mode 100644 index 0000000..f31c6b2 --- /dev/null +++ b/flutter-ory-network/lib/blocs/registration/registration_bloc.freezed.dart @@ -0,0 +1,178 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'registration_bloc.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +/// @nodoc +mixin _$RegistrationState { + RegistrationFlow? get registrationFlow => throw _privateConstructorUsedError; + bool get isLoading => throw _privateConstructorUsedError; + String? get message => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $RegistrationStateCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RegistrationStateCopyWith<$Res> { + factory $RegistrationStateCopyWith( + RegistrationState value, $Res Function(RegistrationState) then) = + _$RegistrationStateCopyWithImpl<$Res, RegistrationState>; + @useResult + $Res call( + {RegistrationFlow? registrationFlow, bool isLoading, String? message}); +} + +/// @nodoc +class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState> + implements $RegistrationStateCopyWith<$Res> { + _$RegistrationStateCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? registrationFlow = freezed, + Object? isLoading = null, + Object? message = freezed, + }) { + return _then(_value.copyWith( + registrationFlow: freezed == registrationFlow + ? _value.registrationFlow + : registrationFlow // ignore: cast_nullable_to_non_nullable + as RegistrationFlow?, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + message: freezed == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$_RegistrationStateCopyWith<$Res> + implements $RegistrationStateCopyWith<$Res> { + factory _$$_RegistrationStateCopyWith(_$_RegistrationState value, + $Res Function(_$_RegistrationState) then) = + __$$_RegistrationStateCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {RegistrationFlow? registrationFlow, bool isLoading, String? message}); +} + +/// @nodoc +class __$$_RegistrationStateCopyWithImpl<$Res> + extends _$RegistrationStateCopyWithImpl<$Res, _$_RegistrationState> + implements _$$_RegistrationStateCopyWith<$Res> { + __$$_RegistrationStateCopyWithImpl( + _$_RegistrationState _value, $Res Function(_$_RegistrationState) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? registrationFlow = freezed, + Object? isLoading = null, + Object? message = freezed, + }) { + return _then(_$_RegistrationState( + registrationFlow: freezed == registrationFlow + ? _value.registrationFlow + : registrationFlow // ignore: cast_nullable_to_non_nullable + as RegistrationFlow?, + isLoading: null == isLoading + ? _value.isLoading + : isLoading // ignore: cast_nullable_to_non_nullable + as bool, + message: freezed == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc + +class _$_RegistrationState implements _RegistrationState { + const _$_RegistrationState( + {this.registrationFlow, this.isLoading = false, this.message}); + + @override + final RegistrationFlow? registrationFlow; + @override + @JsonKey() + final bool isLoading; + @override + final String? message; + + @override + String toString() { + return 'RegistrationState(registrationFlow: $registrationFlow, isLoading: $isLoading, message: $message)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_RegistrationState && + (identical(other.registrationFlow, registrationFlow) || + other.registrationFlow == registrationFlow) && + (identical(other.isLoading, isLoading) || + other.isLoading == isLoading) && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => + Object.hash(runtimeType, registrationFlow, isLoading, message); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_RegistrationStateCopyWith<_$_RegistrationState> get copyWith => + __$$_RegistrationStateCopyWithImpl<_$_RegistrationState>( + this, _$identity); +} + +abstract class _RegistrationState implements RegistrationState { + const factory _RegistrationState( + {final RegistrationFlow? registrationFlow, + final bool isLoading, + final String? message}) = _$_RegistrationState; + + @override + RegistrationFlow? get registrationFlow; + @override + bool get isLoading; + @override + String? get message; + @override + @JsonKey(ignore: true) + _$$_RegistrationStateCopyWith<_$_RegistrationState> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/flutter-ory-network/lib/blocs/registration/registration_event.dart b/flutter-ory-network/lib/blocs/registration/registration_event.dart new file mode 100644 index 0000000..164cac0 --- /dev/null +++ b/flutter-ory-network/lib/blocs/registration/registration_event.dart @@ -0,0 +1,40 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +part of 'registration_bloc.dart'; + +@immutable +sealed class RegistrationEvent extends Equatable { + @override + List get props => []; +} + +final class CreateRegistrationFlow extends RegistrationEvent {} + +final class GetRegistrationFlow extends RegistrationEvent { + final String flowId; + + GetRegistrationFlow({required this.flowId}); + @override + List get props => [flowId]; +} + +class ChangeNodeValue extends RegistrationEvent { + final String value; + final String name; + + ChangeNodeValue({required this.value, required this.name}); + @override + List get props => [value, name]; +} + +class UpdateRegistrationFlow extends RegistrationEvent { + final UiNodeGroupEnum group; + final String name; + final String value; + + UpdateRegistrationFlow( + {required this.group, required this.name, required this.value}); + @override + List get props => [group, name, value]; +} diff --git a/flutter-ory-network/lib/blocs/registration/registration_state.dart b/flutter-ory-network/lib/blocs/registration/registration_state.dart new file mode 100644 index 0000000..35eb520 --- /dev/null +++ b/flutter-ory-network/lib/blocs/registration/registration_state.dart @@ -0,0 +1,12 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +part of 'registration_bloc.dart'; + +@freezed +sealed class RegistrationState with _$RegistrationState { + const factory RegistrationState( + {RegistrationFlow? registrationFlow, + @Default(false) bool isLoading, + String? message}) = _RegistrationState; +} diff --git a/flutter-ory-network/lib/main.dart b/flutter-ory-network/lib/main.dart new file mode 100644 index 0000000..2ece2df --- /dev/null +++ b/flutter-ory-network/lib/main.dart @@ -0,0 +1,113 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:dio/dio.dart'; +import 'package:dio/io.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:ory_network_flutter/widgets/ory_theme.dart'; + +import 'blocs/auth/auth_bloc.dart'; +import 'pages/home.dart'; +import 'pages/login.dart'; +import 'pages/entry.dart'; + +import 'repositories/auth.dart'; +import 'services/auth.dart'; + +Future main() async { + await dotenv.load(fileName: '.env'); + final baseUrl = dotenv.get('ORY_BASE_URL'); + + // create the dio client for http requests + final options = BaseOptions( + baseUrl: baseUrl, + connectTimeout: const Duration(seconds: 10000), + receiveTimeout: const Duration(seconds: 5000), + headers: { + 'Accept': 'application/json', + }, + validateStatus: (status) { + // prevent the request from throwing null exception + return status != null && status < 500 ? true : false; + }, + ); + final dio = DioForNative(options); + + final authService = AuthService(dio); + final authRepository = AuthRepository(service: authService); + runApp(RepositoryProvider.value( + value: authRepository, + child: BlocProvider( + create: (context) => AuthBloc(repository: authRepository) + ..add(GetCurrentSessionInformation()), + child: const MyApp(), + ))); +} + +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return const MaterialApp( + title: 'Flutter Ory Network Demo', + home: MyAppView(), + ); + } +} + +class MyAppView extends StatefulWidget { + const MyAppView({super.key}); + + @override + State createState() => _MyAppViewState(); +} + +class _MyAppViewState extends State { + final _navigatorKey = GlobalKey(); + + NavigatorState get _navigator => _navigatorKey.currentState!; + + @override + Widget build(BuildContext context) { + return MaterialApp( + theme: OryTheme.defaultTheme, + navigatorKey: _navigatorKey, + builder: (context, child) { + return BlocListener( + // navigate to pages only when auth status has changed + listenWhen: (previous, current) => previous.status != current.status, + listener: (context, state) { + switch (state.status) { + case AuthStatus.authenticated: + _navigator.pushAndRemoveUntil( + MaterialPageRoute( + builder: (BuildContext context) => const HomePage()), + (Route route) => false); + case AuthStatus.unauthenticated: + _navigator.pushAndRemoveUntil( + MaterialPageRoute( + builder: (BuildContext context) => + const LoginPage(aal: 'aal1')), + (Route route) => false); + case AuthStatus.aal2Requested: + _navigator.pushAndRemoveUntil( + MaterialPageRoute( + builder: (BuildContext context) => + const LoginPage(aal: 'aal2')), + (Route route) => false); + case AuthStatus.uninitialized: + break; + } + }, + child: child, + ); + }, + onGenerateRoute: (_) => MaterialPageRoute( + builder: (BuildContext context) => const EntryPage()), + ); + } +} diff --git a/flutter-ory-network/lib/pages/entry.dart b/flutter-ory-network/lib/pages/entry.dart new file mode 100644 index 0000000..3a961ac --- /dev/null +++ b/flutter-ory-network/lib/pages/entry.dart @@ -0,0 +1,20 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:flutter/material.dart'; + +class EntryPage extends StatelessWidget { + const EntryPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center( + child: Image.asset( + 'assets/images/ory_logo.png', + width: 100, + ), + ), + ); + } +} diff --git a/flutter-ory-network/lib/pages/home.dart b/flutter-ory-network/lib/pages/home.dart new file mode 100644 index 0000000..af459fe --- /dev/null +++ b/flutter-ory-network/lib/pages/home.dart @@ -0,0 +1,154 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:ory_client/ory_client.dart'; + +import '../blocs/auth/auth_bloc.dart'; + +class HomePage extends StatefulWidget { + const HomePage({super.key}); + + @override + State createState() => _HomePageState(); +} + +class _HomePageState extends State { + @override + void initState() { + super.initState(); + // get current session information when the page opens + context.read().add(GetCurrentSessionInformation()); + } + + @override + Widget build(BuildContext context) { + // get loading state + final isLoading = + context.select((AuthBloc authBloc) => authBloc.state.isLoading); + + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.transparent, + title: Image.asset( + 'assets/images/ory_logo.png', + width: 40, + ), + elevation: 0, + //shape: Border(bottom: BorderSide(color: Colors.green, width: 1)), + actions: [ + // if auth is loading, show progress indicator, otherwise a logout icon + isLoading + ? const Padding( + padding: EdgeInsets.only(right: 20.0), + child: Center( + widthFactor: 1, + heightFactor: 1, + child: SizedBox( + height: 24, + width: 24, + child: CircularProgressIndicator(), + ), + ), + ) + : IconButton( + onPressed: () => context.read()..add(LogOut()), + icon: const Icon(Icons.logout), + ), + ], + ), + body: BlocBuilder( + bloc: context.read(), + builder: (BuildContext context, AuthState state) { + if (state.session != null) { + return _buildSessionInformation(context, state.session!); + } else { + return _buildSessionNotFetched(context, state); + } + }, + )); + } + + _buildSessionInformation(BuildContext context, Session session) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 32), + child: SingleChildScrollView( + physics: const BouncingScrollPhysics(), + child: Column( + children: [ + Text( + "Welcome back,\n${session.identity!.id}!", + style: const TextStyle(fontWeight: FontWeight.w900, fontSize: 35), + ), + const Padding( + padding: EdgeInsets.only(top: 15.0), + child: Text( + "Hello, nice to have you! You signed up with this data:"), + ), + Padding( + padding: const EdgeInsets.only(top: 15.0), + child: Container( + padding: const EdgeInsets.all(35), + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.grey[600]), + child: Text(session.identity!.traits.toString(), + style: const TextStyle( + fontWeight: FontWeight.w500, color: Colors.white)), + ), + ), + const Padding( + padding: EdgeInsets.only(top: 15.0), + child: + Text("You are signed in using an ORY Kratos Session Token:"), + ), + Padding( + padding: const EdgeInsets.only(top: 15.0), + child: Container( + padding: const EdgeInsets.all(35), + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.grey[600]), + child: Text(session.id, + style: const TextStyle( + fontWeight: FontWeight.w500, color: Colors.white)), + ), + ), + const Padding( + padding: EdgeInsets.only(top: 15.0), + child: Text( + "This app mackes REST requests to ORY Kratos' Public API to validate and decode the ORY Kratos Session payload:")), + Padding( + padding: const EdgeInsets.only(top: 15.0), + child: Container( + padding: const EdgeInsets.all(35), + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.grey[600]), + child: Text(session.toString(), + style: const TextStyle( + fontWeight: FontWeight.w500, color: Colors.white)), + ), + ), + ], + ), + ), + ); + } + + _buildSessionNotFetched(BuildContext context, AuthState state) { + if (state.errorMessage != null) { + return Center( + child: Text( + state.errorMessage!, + style: const TextStyle(color: Colors.red), + )); + } else { + return const Center(child: CircularProgressIndicator()); + } + } +} diff --git a/flutter-ory-network/lib/pages/login.dart b/flutter-ory-network/lib/pages/login.dart new file mode 100644 index 0000000..6227a3a --- /dev/null +++ b/flutter-ory-network/lib/pages/login.dart @@ -0,0 +1,216 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:ory_client/ory_client.dart'; +import 'package:ory_network_flutter/widgets/nodes/provider.dart'; + +import '../blocs/auth/auth_bloc.dart'; +import '../blocs/login/login_bloc.dart'; +import '../repositories/auth.dart'; +import '../widgets/helpers.dart'; +import 'registration.dart'; + +class LoginPage extends StatelessWidget { + final String aal; + const LoginPage({super.key, required this.aal}); + + @override + Widget build(BuildContext context) { + return Scaffold( + extendBodyBehindAppBar: true, + body: BlocProvider( + create: (context) => LoginBloc( + authBloc: context.read(), + repository: RepositoryProvider.of(context)) + ..add(CreateLoginFlow(aal: aal)), + child: const LoginForm()), + ); + } +} + +class LoginForm extends StatelessWidget { + const LoginForm({super.key}); + + @override + Widget build(BuildContext context) { + return BlocBuilder( + buildWhen: (previous, current) => previous.isLoading != current.isLoading, + builder: (context, state) { + if (state.loginFlow != null) { + return _buildUi(context, state); + } else { + return buildFlowNotCreated(context, state.message); + } + }, + ); + } + + _buildUi(BuildContext context, LoginState state) { + final nodes = state.loginFlow!.ui.nodes; + + // get default nodes from all nodes + final defaultNodes = + nodes.where((node) => node.group == UiNodeGroupEnum.default_).toList(); + + // get password nodes from all nodes + final passwordNodes = + nodes.where((node) => node.group == UiNodeGroupEnum.password).toList(); + + // get lookup secret nodes from all nodes + final lookupSecretNodes = nodes + .where((node) => node.group == UiNodeGroupEnum.lookupSecret) + .toList(); + + // get totp nodes from all nodes + final totpNodes = + nodes.where((node) => node.group == UiNodeGroupEnum.totp).toList(); + + // get oidc nodes from all nodes + final oidcNodes = + nodes.where((node) => node.group == UiNodeGroupEnum.oidc).toList(); + + return Stack(children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 32), + child: SingleChildScrollView( + // do not show scrolling indicator + physics: const BouncingScrollPhysics(), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + //status bar height + padding + top: MediaQuery.of(context).viewPadding.top + 48), + child: Image.asset( + 'assets/images/ory_logo.png', + width: 70, + ), + ), + const SizedBox( + height: 32, + ), + // show header depending on auth state + BlocSelector( + bloc: (context).read(), + selector: (AuthState state) => + state.status == AuthStatus.aal2Requested, + builder: (BuildContext context, bool boolState) { + return Text( + boolState ? 'Two-Factor Authentication' : 'Sign in', + style: const TextStyle( + fontWeight: FontWeight.w600, + height: 1.5, + fontSize: 18)); + }, + ), + + if (oidcNodes.isNotEmpty) + Padding( + padding: const EdgeInsets.only(top: 32.0), + child: Column( + mainAxisSize: MainAxisSize.max, + children: oidcNodes + .map((node) => SocialProviderInput(node: node)) + .toList()), + ), + if (defaultNodes.isNotEmpty) + buildGroup(context, UiNodeGroupEnum.default_, + defaultNodes, _onInputChange, _onInputSubmit), + if (passwordNodes.isNotEmpty) + buildGroup(context, UiNodeGroupEnum.password, + passwordNodes, _onInputChange, _onInputSubmit), + if (lookupSecretNodes.isNotEmpty) + buildGroup(context, UiNodeGroupEnum.lookupSecret, + lookupSecretNodes, _onInputChange, _onInputSubmit), + if (totpNodes.isNotEmpty) + buildGroup(context, UiNodeGroupEnum.totp, totpNodes, + _onInputChange, _onInputSubmit), + const SizedBox( + height: 32, + ), + if (state.loginFlow?.ui.messages != null) + for (var message in state.loginFlow!.ui.messages!) + Text( + message.text, + style: TextStyle(color: getMessageColor(message.type)), + ), + // show logout button if aal2 requested, otherwise sign up + BlocSelector( + bloc: (context).read(), + selector: (AuthState state) => + state.status == AuthStatus.aal2Requested, + builder: (BuildContext context, bool isAal2Requested) { + if (isAal2Requested) { + return Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + const Text('Something\'s not working?'), + TextButton( + onPressed: () => + (context).read().add(LogOut()), + child: const Text('Logout')) + ], + ); + } else { + return Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + const Text('No account?'), + TextButton( + onPressed: () => Navigator.of(context) + .pushReplacement(MaterialPageRoute( + builder: (context) => + const RegistrationPage())), + child: const Text('Sign up')) + ], + ); + } + }), + ], + ), + ), + ), + // build progress indicator when state is loading + BlocSelector( + bloc: (context).read(), + selector: (LoginState state) => state.isLoading, + builder: (BuildContext context, bool isLoading) { + if (isLoading) { + return const Opacity( + opacity: 0.8, + child: ModalBarrier(dismissible: false, color: Colors.white30), + ); + } else { + return Container(); + } + }), + BlocSelector( + bloc: (context).read(), + selector: (LoginState state) => state.isLoading, + builder: (BuildContext context, bool isLoading) { + if (isLoading) { + return const Center( + child: CircularProgressIndicator(), + ); + } else { + return Container(); + } + }) + ]); + } + + _onInputChange(BuildContext context, String value, String name) { + context.read().add(ChangeNodeValue(value: value, name: name)); + } + + _onInputSubmit( + BuildContext context, UiNodeGroupEnum group, String name, String value) { + context + .read() + .add(UpdateLoginFlow(group: group, name: name, value: value)); + } +} diff --git a/flutter-ory-network/lib/pages/registration.dart b/flutter-ory-network/lib/pages/registration.dart new file mode 100644 index 0000000..adedae7 --- /dev/null +++ b/flutter-ory-network/lib/pages/registration.dart @@ -0,0 +1,197 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:ory_client/ory_client.dart'; + +import '../blocs/auth/auth_bloc.dart'; +import '../blocs/registration/registration_bloc.dart'; +import '../repositories/auth.dart'; +import '../widgets/helpers.dart'; +import '../widgets/nodes/provider.dart'; +import 'login.dart'; + +class RegistrationPage extends StatelessWidget { + const RegistrationPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: BlocProvider( + create: (context) => RegistrationBloc( + authBloc: context.read(), + repository: RepositoryProvider.of(context)) + ..add(CreateRegistrationFlow()), + child: const RegistrationForm()), + ); + } +} + +class RegistrationForm extends StatefulWidget { + const RegistrationForm({super.key}); + + @override + State createState() => RegistrationFormState(); +} + +class RegistrationFormState extends State { + final emailController = TextEditingController(); + final passwordController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return BlocBuilder( + buildWhen: (previous, current) => previous.isLoading != current.isLoading, + builder: (context, state) { + if (state.registrationFlow != null) { + return _buildUi(context, state); + } else { + return buildFlowNotCreated(context, state.message); + } + }, + ); + } + + _buildUi(BuildContext context, RegistrationState state) { + final nodes = state.registrationFlow!.ui.nodes; + + // get default nodes from all nodes + final defaultNodes = + nodes.where((node) => node.group == UiNodeGroupEnum.default_).toList(); + + // get password nodes from all nodes + final passwordNodes = + nodes.where((node) => node.group == UiNodeGroupEnum.password).toList(); + + // get lookup secret nodes from all nodes + final lookupSecretNodes = nodes + .where((node) => node.group == UiNodeGroupEnum.lookupSecret) + .toList(); + + // get totp nodes from all nodes + final totpNodes = + nodes.where((node) => node.group == UiNodeGroupEnum.totp).toList(); + + // get oidc nodes from all nodes + final oidcNodes = + nodes.where((node) => node.group == UiNodeGroupEnum.oidc).toList(); + + return Stack(children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 32), + child: SingleChildScrollView( + // do not show scrolling indicator + physics: const BouncingScrollPhysics(), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + //status bar height + padding + top: MediaQuery.of(context).viewPadding.top + 48), + child: Image.asset( + 'assets/images/ory_logo.png', + width: 70, + ), + ), + const SizedBox( + height: 32, + ), + const Text('Sign up', + style: TextStyle( + fontWeight: FontWeight.w600, height: 1.5, fontSize: 18)), + if (oidcNodes.isNotEmpty) + Padding( + padding: const EdgeInsets.only(top: 32.0), + child: Column( + mainAxisSize: MainAxisSize.max, + children: oidcNodes + .map((node) => SocialProviderInput(node: node)) + .toList()), + ), + if (defaultNodes.isNotEmpty) + buildGroup(context, UiNodeGroupEnum.default_, + defaultNodes, _onInputChange, _onInputSubmit), + if (passwordNodes.isNotEmpty) + buildGroup(context, UiNodeGroupEnum.password, + passwordNodes, _onInputChange, _onInputSubmit), + if (lookupSecretNodes.isNotEmpty) + buildGroup( + context, + UiNodeGroupEnum.lookupSecret, + lookupSecretNodes, + _onInputChange, + _onInputSubmit), + if (totpNodes.isNotEmpty) + buildGroup(context, UiNodeGroupEnum.totp, + totpNodes, _onInputChange, _onInputSubmit), + const SizedBox( + height: 32, + ), + if (state.registrationFlow?.ui.messages != null) + for (var message in state.registrationFlow!.ui.messages!) + Text( + message.text, + style: TextStyle(color: getMessageColor(message.type)), + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + const Text('Already have an account?'), + TextButton( + onPressed: () => Navigator.of(context) + .pushReplacement(MaterialPageRoute( + builder: (context) => const LoginPage( + aal: 'aal1', + ))), + child: const Text('Sign in')) + ], + ) + ], + ), + ), + ), + // build progress indicator when state is loading + BlocSelector( + bloc: (context).read(), + selector: (RegistrationState state) => state.isLoading, + builder: (BuildContext context, bool isLoading) { + if (isLoading) { + return const Opacity( + opacity: 0.8, + child: ModalBarrier(dismissible: false, color: Colors.white30), + ); + } else { + return Container(); + } + }), + BlocSelector( + bloc: (context).read(), + selector: (RegistrationState state) => state.isLoading, + builder: (BuildContext context, bool isLoading) { + if (isLoading) { + return const Center( + child: CircularProgressIndicator(), + ); + } else { + return Container(); + } + }) + ]); + } + + _onInputChange(BuildContext context, String value, String name) { + context + .read() + .add(ChangeNodeValue(value: value, name: name)); + } + + _onInputSubmit( + BuildContext context, UiNodeGroupEnum group, String name, String value) { + context + .read() + .add(UpdateRegistrationFlow(group: group, name: name, value: value)); + } +} diff --git a/flutter-ory-network/lib/repositories/auth.dart b/flutter-ory-network/lib/repositories/auth.dart new file mode 100644 index 0000000..a482b94 --- /dev/null +++ b/flutter-ory-network/lib/repositories/auth.dart @@ -0,0 +1,184 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/json_object.dart'; +import 'package:deep_collection/deep_collection.dart'; +import 'package:one_of/one_of.dart'; +import 'package:ory_client/ory_client.dart'; +import 'package:collection/collection.dart'; + +import '../services/auth.dart'; + +enum AuthStatus { uninitialized, authenticated, unauthenticated, aal2Requested } + +class AuthRepository { + final AuthService service; + + AuthRepository({required this.service}); + + Future getCurrentSessionInformation() async { + final session = await service.getCurrentSessionInformation(); + return session; + } + + Future createLoginFlow({required String aal}) async { + final flow = await service.createLoginFlow(aal: aal); + return flow; + } + + Future createRegistrationFlow() async { + final flow = await service.createRegistrationFlow(); + return flow; + } + + Future getLoginFlow({required String flowId}) async { + final flow = await service.getLoginFlow(flowId: flowId); + return flow; + } + + Future getRegistrationFlow({required String flowId}) async { + final flow = await service.getRegistrationFlow(flowId: flowId); + return flow; + } + + Future logout() async { + await service.logout(); + } + + Future updateRegistrationFlow( + {required String flowId, + required UiNodeGroupEnum group, + required String name, + required String value, + required List nodes}) async { + // create request body + final body = _createRequestBody( + group: group, name: name, value: value, nodes: nodes); + // submit registration + final registration = await service.updateRegistrationFlow( + flowId: flowId, group: group, value: body); + return registration; + } + + Future updateLoginFlow( + {required String flowId, + required UiNodeGroupEnum group, + required String name, + required String value, + required List nodes}) async { + // create request body + final body = _createRequestBody( + group: group, name: name, value: value, nodes: nodes); + // submit login + final login = await service.updateLoginFlow( + flowId: flowId, group: group, value: body); + return login; + } + + Map _createRequestBody( + {required UiNodeGroupEnum group, + required String name, + required String value, + required List nodes}) { + // if name of submitted node is method, find all nodes that belong to the group + if (name == 'method') { + // get input nodes of the same group + final inputNodes = nodes.where((p0) { + if (p0.attributes.oneOf.isType(UiNodeInputAttributes)) { + final attributes = p0.attributes.oneOf.value as UiNodeInputAttributes; + // if group is password, find identifier + if (group == UiNodeGroupEnum.password && + p0.group == UiNodeGroupEnum.default_ && + attributes.name == 'identifier') { + return true; + } + return p0.group == group && + attributes.type != UiNodeInputAttributesTypeEnum.button && + attributes.type != UiNodeInputAttributesTypeEnum.submit; + } else { + return false; + } + }); + // create maps from attribute names and their values + final nestedMaps = inputNodes.map((e) { + final attributes = e.attributes.oneOf.value as UiNodeInputAttributes; + + return generateNestedMap( + attributes.name, attributes.value?.asString ?? ''); + }).toList(); + + // merge nested maps into one + final mergedMap = + nestedMaps.reduce((value, element) => value.deepMerge(element)); + + return mergedMap; + } else { + return {name: value}; + } + } + + RegistrationFlow changeRegistrationNodeValue( + {required RegistrationFlow settings, + required String name, + required String value}) { + // update node value + final updatedNodes = + updateNodes(nodes: settings.ui.nodes, name: name, value: value); + // update settings' node + final newFlow = + settings.rebuild((p0) => p0..ui.nodes.replace(updatedNodes)); + return newFlow; + } + + LoginFlow changeLoginNodeValue( + {required LoginFlow settings, + required String name, + required String value}) { + // update node value + final updatedNodes = + updateNodes(nodes: settings.ui.nodes, name: name, value: value); + // update settings' node + final newFlow = + settings.rebuild((p0) => p0..ui.nodes.replace(updatedNodes)); + return newFlow; + } + + BuiltList updateNodes( + {required BuiltList nodes, + required String name, + required String value}) { + // get edited node + final node = nodes.firstWhereOrNull((element) { + if (element.attributes.oneOf.isType(UiNodeInputAttributes)) { + return (element.attributes.oneOf.value as UiNodeInputAttributes).name == + name; + } else { + return false; + } + }); + + // udate value of edited node + final updatedNode = node?.rebuild((p0) => p0 + ..attributes.update((b) { + final oldValue = b.oneOf?.value as UiNodeInputAttributes; + final newValue = oldValue.rebuild((p0) => p0.value = JsonObject(value)); + b.oneOf = OneOf1(value: newValue); + })); + // get index of to be updated node + final nodeIndex = nodes.indexOf(node!); + // update list of nodes to iclude updated node + return nodes.rebuild((p0) => p0 + ..removeAt(nodeIndex) + ..insert(nodeIndex, updatedNode!)); + } + + Map generateNestedMap(String path, String value) { + var steps = path.split('.'); + Object? result = value; + for (var step in steps.reversed) { + result = {step: result}; + } + return result as Map; + } +} diff --git a/flutter-ory-network/lib/services/auth.dart b/flutter-ory-network/lib/services/auth.dart new file mode 100644 index 0000000..2917ed5 --- /dev/null +++ b/flutter-ory-network/lib/services/auth.dart @@ -0,0 +1,266 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:built_value/json_object.dart'; +import 'package:dio/dio.dart'; +import 'package:one_of/one_of.dart'; +import 'package:ory_client/ory_client.dart'; + +import 'exceptions.dart'; +import 'storage.dart'; + +class AuthService { + final storage = SecureStorage(); + final FrontendApi _ory; + AuthService(Dio dio) : _ory = OryClient(dio: dio).getFrontendApi(); + + /// Get current session information + Future getCurrentSessionInformation() async { + try { + final token = await storage.getToken(); + final response = await _ory.toSession(xSessionToken: token); + + if (response.data != null) { + // return session + return response.data!; + } else { + throw const CustomException.unknown(); + } + } on DioException catch (e) { + if (e.response?.statusCode == 401) { + await storage.deleteToken(); + throw const CustomException.unauthorized(); + } else if (e.response?.statusCode == 403) { + if (e.response?.data['error']['id'] == 'session_aal2_required') { + throw const CustomException.twoFactorAuthRequired(); + } else { + throw _handleUnknownException(e.response?.data); + } + } else { + throw _handleUnknownException(e.response?.data); + } + } + } + + /// Create login flow + Future createLoginFlow({required String aal}) async { + try { + final token = await storage.getToken(); + final response = + await _ory.createNativeLoginFlow(aal: aal, xSessionToken: token); + if (response.data != null) { + // return flow id + return response.data!; + } else { + throw const CustomException.unknown(); + } + } on DioException catch (e) { + throw _handleUnknownException(e.response?.data); + } + } + + /// Create registration flow + Future createRegistrationFlow() async { + try { + final response = await _ory.createNativeRegistrationFlow(); + if (response.data != null) { + // return flow id + return response.data!; + } else { + throw const CustomException.unknown(); + } + } on DioException catch (e) { + throw _handleUnknownException(e.response?.data); + } + } + + /// Update login flow with [flowId] for [group] with [value] + Future updateLoginFlow( + {required String flowId, + required UiNodeGroupEnum group, + required Map value}) async { + try { + final token = await storage.getToken(); + final OneOf oneOf; + + // create update body depending on method + switch (group) { + case UiNodeGroupEnum.password: + oneOf = OneOf.fromValue1( + value: UpdateLoginFlowWithPasswordMethod((b) => b + ..method = group.name + ..identifier = value['identifier'] + ..password = value['password'])); + case UiNodeGroupEnum.lookupSecret: + oneOf = OneOf.fromValue1( + value: UpdateLoginFlowWithLookupSecretMethod((b) => b + // use pre-defined string as enum value doesn't include an underscore + ..method = 'lookup_secret' + ..lookupSecret = value['lookup_secret'])); + case UiNodeGroupEnum.totp: + oneOf = OneOf.fromValue1( + value: UpdateLoginFlowWithTotpMethod((b) => b + ..method = group.name + ..totpCode = value['totp_code'])); + + // if method is not implemented, throw exception + default: + throw const CustomException.unknown(); + } + + final response = await _ory.updateLoginFlow( + flow: flowId, + xSessionToken: token, + updateLoginFlowBody: UpdateLoginFlowBody((b) => b..oneOf = oneOf)); + + if (response.data?.session != null) { + // save session token after successful login + await storage.persistToken(response.data!.sessionToken!); + if (response.data!.session.identity != null) { + return response.data!; + } else { + // identity is null, aal2 is required + throw const CustomException.twoFactorAuthRequired(); + } + } else { + throw const CustomException.unknown(); + } + } on DioException catch (e) { + if (e.response?.statusCode == 401) { + await storage.deleteToken(); + throw const CustomException.unauthorized(); + } else if (e.response?.statusCode == 400) { + final loginFlow = standardSerializers.deserializeWith( + LoginFlow.serializer, e.response?.data); + if (loginFlow != null) { + throw CustomException.badRequest(flow: loginFlow); + } else { + throw const CustomException.unknown(); + } + } else if (e.response?.statusCode == 410) { + // settings flow expired, use new flow id + throw CustomException.flowExpired( + flowId: e.response?.data['use_flow_id']); + } else { + throw _handleUnknownException(e.response?.data); + } + } + } + + /// Get login flow with [flowId] + Future getLoginFlow({required String flowId}) async { + try { + final response = await _ory.getLoginFlow(id: flowId); + + if (response.data != null) { + // return flow + return response.data!; + } else { + throw const CustomException.unknown(); + } + } on DioException catch (e) { + throw _handleUnknownException(e.response?.data); + } + } + + /// Get registration flow with [flowId] + Future getRegistrationFlow({required String flowId}) async { + try { + final response = await _ory.getRegistrationFlow(id: flowId); + + if (response.data != null) { + // return flow + return response.data!; + } else { + throw const CustomException.unknown(); + } + } on DioException catch (e) { + throw _handleUnknownException(e.response?.data); + } + } + + /// Update registration flow with [flowId] for [group] with [value] + Future updateRegistrationFlow( + {required String flowId, + required UiNodeGroupEnum group, + required Map value}) async { + try { + final OneOf oneOf; + + // create update body depending on method + switch (group) { + case UiNodeGroupEnum.password: + oneOf = OneOf.fromValue1( + value: UpdateRegistrationFlowWithPasswordMethod((b) => b + ..method = group.name + ..traits = JsonObject(value['traits']) + ..password = value['password'])); + + // if method is not implemented, throw exception + default: + throw const CustomException.unknown(); + } + + final response = await _ory.updateRegistrationFlow( + flow: flowId, + updateRegistrationFlowBody: + UpdateRegistrationFlowBody((b) => b..oneOf = oneOf)); + + if (response.data?.session != null) { + // save session token after successful login + await storage.persistToken(response.data!.sessionToken!); + return response.data!; + } else { + throw const CustomException.unknown(); + } + } on DioException catch (e) { + if (e.response?.statusCode == 400) { + final registrationFlow = standardSerializers.deserializeWith( + RegistrationFlow.serializer, e.response?.data); + if (registrationFlow != null) { + throw CustomException.badRequest( + flow: registrationFlow); + } else { + throw const CustomException.unknown(); + } + } else if (e.response?.statusCode == 410) { + // settings flow expired, use new flow id and add error message + throw CustomException.flowExpired( + flowId: e.response?.data['use_flow_id']); + } else { + throw _handleUnknownException(e.response?.data); + } + } + } + + Future logout() async { + try { + final token = await storage.getToken(); + + final PerformNativeLogoutBody logoutBody = + PerformNativeLogoutBody((b) => b..sessionToken = token); + final response = + await _ory.performNativeLogout(performNativeLogoutBody: logoutBody); + if (response.statusCode == 204) { + await storage.deleteToken(); + return; + } + } on DioException catch (e) { + if (e.response?.statusCode == 401) { + await storage.deleteToken(); + throw const CustomException.unauthorized(); + } else { + throw _handleUnknownException(e.response?.data); + } + } + } + + CustomException _handleUnknownException(Map? response) { + // use error message if response contains it, otherwise use default value + if (response != null && response.containsKey('error')) { + return CustomException.unknown(message: response['error']['message']); + } else { + return const CustomException.unknown(); + } + } +} diff --git a/flutter-ory-network/lib/services/exceptions.dart b/flutter-ory-network/lib/services/exceptions.dart new file mode 100644 index 0000000..677d5b9 --- /dev/null +++ b/flutter-ory-network/lib/services/exceptions.dart @@ -0,0 +1,23 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:flutter/foundation.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:ory_client/ory_client.dart'; + +part 'exceptions.freezed.dart'; + +@freezed +sealed class CustomException with _$CustomException { + const CustomException._(); + const factory CustomException.badRequest({required T flow}) = + BadRequestException; + const factory CustomException.unauthorized() = UnauthorizedException; + const factory CustomException.flowExpired( + {required String flowId, String? message}) = FlowExpiredException; + const factory CustomException.twoFactorAuthRequired({Session? session}) = + TwoFactorAuthRequiredException; + const factory CustomException.unknown( + {@Default('An error occured. Please try again later.') + String? message}) = UnknownException; +} diff --git a/flutter-ory-network/lib/services/exceptions.freezed.dart b/flutter-ory-network/lib/services/exceptions.freezed.dart new file mode 100644 index 0000000..f7a7d4b --- /dev/null +++ b/flutter-ory-network/lib/services/exceptions.freezed.dart @@ -0,0 +1,918 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'exceptions.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +/// @nodoc +mixin _$CustomException { + @optionalTypeArgs + TResult when({ + required TResult Function(T flow) badRequest, + required TResult Function() unauthorized, + required TResult Function(String flowId, String? message) flowExpired, + required TResult Function(Session? session) twoFactorAuthRequired, + required TResult Function(String? message) unknown, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(T flow)? badRequest, + TResult? Function()? unauthorized, + TResult? Function(String flowId, String? message)? flowExpired, + TResult? Function(Session? session)? twoFactorAuthRequired, + TResult? Function(String? message)? unknown, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(T flow)? badRequest, + TResult Function()? unauthorized, + TResult Function(String flowId, String? message)? flowExpired, + TResult Function(Session? session)? twoFactorAuthRequired, + TResult Function(String? message)? unknown, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(BadRequestException value) badRequest, + required TResult Function(UnauthorizedException value) unauthorized, + required TResult Function(FlowExpiredException value) flowExpired, + required TResult Function(TwoFactorAuthRequiredException value) + twoFactorAuthRequired, + required TResult Function(UnknownException value) unknown, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BadRequestException value)? badRequest, + TResult? Function(UnauthorizedException value)? unauthorized, + TResult? Function(FlowExpiredException value)? flowExpired, + TResult? Function(TwoFactorAuthRequiredException value)? + twoFactorAuthRequired, + TResult? Function(UnknownException value)? unknown, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BadRequestException value)? badRequest, + TResult Function(UnauthorizedException value)? unauthorized, + TResult Function(FlowExpiredException value)? flowExpired, + TResult Function(TwoFactorAuthRequiredException value)? + twoFactorAuthRequired, + TResult Function(UnknownException value)? unknown, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $CustomExceptionCopyWith { + factory $CustomExceptionCopyWith( + CustomException value, $Res Function(CustomException) then) = + _$CustomExceptionCopyWithImpl>; +} + +/// @nodoc +class _$CustomExceptionCopyWithImpl> + implements $CustomExceptionCopyWith { + _$CustomExceptionCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$BadRequestExceptionCopyWith { + factory _$$BadRequestExceptionCopyWith(_$BadRequestException value, + $Res Function(_$BadRequestException) then) = + __$$BadRequestExceptionCopyWithImpl; + @useResult + $Res call({T flow}); +} + +/// @nodoc +class __$$BadRequestExceptionCopyWithImpl + extends _$CustomExceptionCopyWithImpl> + implements _$$BadRequestExceptionCopyWith { + __$$BadRequestExceptionCopyWithImpl(_$BadRequestException _value, + $Res Function(_$BadRequestException) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? flow = freezed, + }) { + return _then(_$BadRequestException( + flow: freezed == flow + ? _value.flow + : flow // ignore: cast_nullable_to_non_nullable + as T, + )); + } +} + +/// @nodoc + +class _$BadRequestException extends BadRequestException + with DiagnosticableTreeMixin { + const _$BadRequestException({required this.flow}) : super._(); + + @override + final T flow; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'CustomException<$T>.badRequest(flow: $flow)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'CustomException<$T>.badRequest')) + ..add(DiagnosticsProperty('flow', flow)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BadRequestException && + const DeepCollectionEquality().equals(other.flow, flow)); + } + + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(flow)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BadRequestExceptionCopyWith> get copyWith => + __$$BadRequestExceptionCopyWithImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(T flow) badRequest, + required TResult Function() unauthorized, + required TResult Function(String flowId, String? message) flowExpired, + required TResult Function(Session? session) twoFactorAuthRequired, + required TResult Function(String? message) unknown, + }) { + return badRequest(flow); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(T flow)? badRequest, + TResult? Function()? unauthorized, + TResult? Function(String flowId, String? message)? flowExpired, + TResult? Function(Session? session)? twoFactorAuthRequired, + TResult? Function(String? message)? unknown, + }) { + return badRequest?.call(flow); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(T flow)? badRequest, + TResult Function()? unauthorized, + TResult Function(String flowId, String? message)? flowExpired, + TResult Function(Session? session)? twoFactorAuthRequired, + TResult Function(String? message)? unknown, + required TResult orElse(), + }) { + if (badRequest != null) { + return badRequest(flow); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BadRequestException value) badRequest, + required TResult Function(UnauthorizedException value) unauthorized, + required TResult Function(FlowExpiredException value) flowExpired, + required TResult Function(TwoFactorAuthRequiredException value) + twoFactorAuthRequired, + required TResult Function(UnknownException value) unknown, + }) { + return badRequest(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BadRequestException value)? badRequest, + TResult? Function(UnauthorizedException value)? unauthorized, + TResult? Function(FlowExpiredException value)? flowExpired, + TResult? Function(TwoFactorAuthRequiredException value)? + twoFactorAuthRequired, + TResult? Function(UnknownException value)? unknown, + }) { + return badRequest?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BadRequestException value)? badRequest, + TResult Function(UnauthorizedException value)? unauthorized, + TResult Function(FlowExpiredException value)? flowExpired, + TResult Function(TwoFactorAuthRequiredException value)? + twoFactorAuthRequired, + TResult Function(UnknownException value)? unknown, + required TResult orElse(), + }) { + if (badRequest != null) { + return badRequest(this); + } + return orElse(); + } +} + +abstract class BadRequestException extends CustomException { + const factory BadRequestException({required final T flow}) = + _$BadRequestException; + const BadRequestException._() : super._(); + + T get flow; + @JsonKey(ignore: true) + _$$BadRequestExceptionCopyWith> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$UnauthorizedExceptionCopyWith { + factory _$$UnauthorizedExceptionCopyWith(_$UnauthorizedException value, + $Res Function(_$UnauthorizedException) then) = + __$$UnauthorizedExceptionCopyWithImpl; +} + +/// @nodoc +class __$$UnauthorizedExceptionCopyWithImpl + extends _$CustomExceptionCopyWithImpl> + implements _$$UnauthorizedExceptionCopyWith { + __$$UnauthorizedExceptionCopyWithImpl(_$UnauthorizedException _value, + $Res Function(_$UnauthorizedException) _then) + : super(_value, _then); +} + +/// @nodoc + +class _$UnauthorizedException extends UnauthorizedException + with DiagnosticableTreeMixin { + const _$UnauthorizedException() : super._(); + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'CustomException<$T>.unauthorized()'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + .add(DiagnosticsProperty('type', 'CustomException<$T>.unauthorized')); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$UnauthorizedException); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(T flow) badRequest, + required TResult Function() unauthorized, + required TResult Function(String flowId, String? message) flowExpired, + required TResult Function(Session? session) twoFactorAuthRequired, + required TResult Function(String? message) unknown, + }) { + return unauthorized(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(T flow)? badRequest, + TResult? Function()? unauthorized, + TResult? Function(String flowId, String? message)? flowExpired, + TResult? Function(Session? session)? twoFactorAuthRequired, + TResult? Function(String? message)? unknown, + }) { + return unauthorized?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(T flow)? badRequest, + TResult Function()? unauthorized, + TResult Function(String flowId, String? message)? flowExpired, + TResult Function(Session? session)? twoFactorAuthRequired, + TResult Function(String? message)? unknown, + required TResult orElse(), + }) { + if (unauthorized != null) { + return unauthorized(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BadRequestException value) badRequest, + required TResult Function(UnauthorizedException value) unauthorized, + required TResult Function(FlowExpiredException value) flowExpired, + required TResult Function(TwoFactorAuthRequiredException value) + twoFactorAuthRequired, + required TResult Function(UnknownException value) unknown, + }) { + return unauthorized(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BadRequestException value)? badRequest, + TResult? Function(UnauthorizedException value)? unauthorized, + TResult? Function(FlowExpiredException value)? flowExpired, + TResult? Function(TwoFactorAuthRequiredException value)? + twoFactorAuthRequired, + TResult? Function(UnknownException value)? unknown, + }) { + return unauthorized?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BadRequestException value)? badRequest, + TResult Function(UnauthorizedException value)? unauthorized, + TResult Function(FlowExpiredException value)? flowExpired, + TResult Function(TwoFactorAuthRequiredException value)? + twoFactorAuthRequired, + TResult Function(UnknownException value)? unknown, + required TResult orElse(), + }) { + if (unauthorized != null) { + return unauthorized(this); + } + return orElse(); + } +} + +abstract class UnauthorizedException extends CustomException { + const factory UnauthorizedException() = _$UnauthorizedException; + const UnauthorizedException._() : super._(); +} + +/// @nodoc +abstract class _$$FlowExpiredExceptionCopyWith { + factory _$$FlowExpiredExceptionCopyWith(_$FlowExpiredException value, + $Res Function(_$FlowExpiredException) then) = + __$$FlowExpiredExceptionCopyWithImpl; + @useResult + $Res call({String flowId, String? message}); +} + +/// @nodoc +class __$$FlowExpiredExceptionCopyWithImpl + extends _$CustomExceptionCopyWithImpl> + implements _$$FlowExpiredExceptionCopyWith { + __$$FlowExpiredExceptionCopyWithImpl(_$FlowExpiredException _value, + $Res Function(_$FlowExpiredException) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? flowId = null, + Object? message = freezed, + }) { + return _then(_$FlowExpiredException( + flowId: null == flowId + ? _value.flowId + : flowId // ignore: cast_nullable_to_non_nullable + as String, + message: freezed == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc + +class _$FlowExpiredException extends FlowExpiredException + with DiagnosticableTreeMixin { + const _$FlowExpiredException({required this.flowId, this.message}) + : super._(); + + @override + final String flowId; + @override + final String? message; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'CustomException<$T>.flowExpired(flowId: $flowId, message: $message)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'CustomException<$T>.flowExpired')) + ..add(DiagnosticsProperty('flowId', flowId)) + ..add(DiagnosticsProperty('message', message)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$FlowExpiredException && + (identical(other.flowId, flowId) || other.flowId == flowId) && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => Object.hash(runtimeType, flowId, message); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$FlowExpiredExceptionCopyWith> get copyWith => + __$$FlowExpiredExceptionCopyWithImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(T flow) badRequest, + required TResult Function() unauthorized, + required TResult Function(String flowId, String? message) flowExpired, + required TResult Function(Session? session) twoFactorAuthRequired, + required TResult Function(String? message) unknown, + }) { + return flowExpired(flowId, message); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(T flow)? badRequest, + TResult? Function()? unauthorized, + TResult? Function(String flowId, String? message)? flowExpired, + TResult? Function(Session? session)? twoFactorAuthRequired, + TResult? Function(String? message)? unknown, + }) { + return flowExpired?.call(flowId, message); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(T flow)? badRequest, + TResult Function()? unauthorized, + TResult Function(String flowId, String? message)? flowExpired, + TResult Function(Session? session)? twoFactorAuthRequired, + TResult Function(String? message)? unknown, + required TResult orElse(), + }) { + if (flowExpired != null) { + return flowExpired(flowId, message); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BadRequestException value) badRequest, + required TResult Function(UnauthorizedException value) unauthorized, + required TResult Function(FlowExpiredException value) flowExpired, + required TResult Function(TwoFactorAuthRequiredException value) + twoFactorAuthRequired, + required TResult Function(UnknownException value) unknown, + }) { + return flowExpired(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BadRequestException value)? badRequest, + TResult? Function(UnauthorizedException value)? unauthorized, + TResult? Function(FlowExpiredException value)? flowExpired, + TResult? Function(TwoFactorAuthRequiredException value)? + twoFactorAuthRequired, + TResult? Function(UnknownException value)? unknown, + }) { + return flowExpired?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BadRequestException value)? badRequest, + TResult Function(UnauthorizedException value)? unauthorized, + TResult Function(FlowExpiredException value)? flowExpired, + TResult Function(TwoFactorAuthRequiredException value)? + twoFactorAuthRequired, + TResult Function(UnknownException value)? unknown, + required TResult orElse(), + }) { + if (flowExpired != null) { + return flowExpired(this); + } + return orElse(); + } +} + +abstract class FlowExpiredException extends CustomException { + const factory FlowExpiredException( + {required final String flowId, + final String? message}) = _$FlowExpiredException; + const FlowExpiredException._() : super._(); + + String get flowId; + String? get message; + @JsonKey(ignore: true) + _$$FlowExpiredExceptionCopyWith> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$TwoFactorAuthRequiredExceptionCopyWith { + factory _$$TwoFactorAuthRequiredExceptionCopyWith( + _$TwoFactorAuthRequiredException value, + $Res Function(_$TwoFactorAuthRequiredException) then) = + __$$TwoFactorAuthRequiredExceptionCopyWithImpl; + @useResult + $Res call({Session? session}); +} + +/// @nodoc +class __$$TwoFactorAuthRequiredExceptionCopyWithImpl + extends _$CustomExceptionCopyWithImpl> + implements _$$TwoFactorAuthRequiredExceptionCopyWith { + __$$TwoFactorAuthRequiredExceptionCopyWithImpl( + _$TwoFactorAuthRequiredException _value, + $Res Function(_$TwoFactorAuthRequiredException) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? session = freezed, + }) { + return _then(_$TwoFactorAuthRequiredException( + session: freezed == session + ? _value.session + : session // ignore: cast_nullable_to_non_nullable + as Session?, + )); + } +} + +/// @nodoc + +class _$TwoFactorAuthRequiredException + extends TwoFactorAuthRequiredException with DiagnosticableTreeMixin { + const _$TwoFactorAuthRequiredException({this.session}) : super._(); + + @override + final Session? session; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'CustomException<$T>.twoFactorAuthRequired(session: $session)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty( + 'type', 'CustomException<$T>.twoFactorAuthRequired')) + ..add(DiagnosticsProperty('session', session)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$TwoFactorAuthRequiredException && + (identical(other.session, session) || other.session == session)); + } + + @override + int get hashCode => Object.hash(runtimeType, session); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$TwoFactorAuthRequiredExceptionCopyWith> + get copyWith => __$$TwoFactorAuthRequiredExceptionCopyWithImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(T flow) badRequest, + required TResult Function() unauthorized, + required TResult Function(String flowId, String? message) flowExpired, + required TResult Function(Session? session) twoFactorAuthRequired, + required TResult Function(String? message) unknown, + }) { + return twoFactorAuthRequired(session); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(T flow)? badRequest, + TResult? Function()? unauthorized, + TResult? Function(String flowId, String? message)? flowExpired, + TResult? Function(Session? session)? twoFactorAuthRequired, + TResult? Function(String? message)? unknown, + }) { + return twoFactorAuthRequired?.call(session); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(T flow)? badRequest, + TResult Function()? unauthorized, + TResult Function(String flowId, String? message)? flowExpired, + TResult Function(Session? session)? twoFactorAuthRequired, + TResult Function(String? message)? unknown, + required TResult orElse(), + }) { + if (twoFactorAuthRequired != null) { + return twoFactorAuthRequired(session); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BadRequestException value) badRequest, + required TResult Function(UnauthorizedException value) unauthorized, + required TResult Function(FlowExpiredException value) flowExpired, + required TResult Function(TwoFactorAuthRequiredException value) + twoFactorAuthRequired, + required TResult Function(UnknownException value) unknown, + }) { + return twoFactorAuthRequired(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BadRequestException value)? badRequest, + TResult? Function(UnauthorizedException value)? unauthorized, + TResult? Function(FlowExpiredException value)? flowExpired, + TResult? Function(TwoFactorAuthRequiredException value)? + twoFactorAuthRequired, + TResult? Function(UnknownException value)? unknown, + }) { + return twoFactorAuthRequired?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BadRequestException value)? badRequest, + TResult Function(UnauthorizedException value)? unauthorized, + TResult Function(FlowExpiredException value)? flowExpired, + TResult Function(TwoFactorAuthRequiredException value)? + twoFactorAuthRequired, + TResult Function(UnknownException value)? unknown, + required TResult orElse(), + }) { + if (twoFactorAuthRequired != null) { + return twoFactorAuthRequired(this); + } + return orElse(); + } +} + +abstract class TwoFactorAuthRequiredException extends CustomException { + const factory TwoFactorAuthRequiredException({final Session? session}) = + _$TwoFactorAuthRequiredException; + const TwoFactorAuthRequiredException._() : super._(); + + Session? get session; + @JsonKey(ignore: true) + _$$TwoFactorAuthRequiredExceptionCopyWith> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$UnknownExceptionCopyWith { + factory _$$UnknownExceptionCopyWith(_$UnknownException value, + $Res Function(_$UnknownException) then) = + __$$UnknownExceptionCopyWithImpl; + @useResult + $Res call({String? message}); +} + +/// @nodoc +class __$$UnknownExceptionCopyWithImpl + extends _$CustomExceptionCopyWithImpl> + implements _$$UnknownExceptionCopyWith { + __$$UnknownExceptionCopyWithImpl( + _$UnknownException _value, $Res Function(_$UnknownException) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? message = freezed, + }) { + return _then(_$UnknownException( + message: freezed == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc + +class _$UnknownException extends UnknownException + with DiagnosticableTreeMixin { + const _$UnknownException( + {this.message = 'An error occured. Please try again later.'}) + : super._(); + + @override + @JsonKey() + final String? message; + + @override + String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { + return 'CustomException<$T>.unknown(message: $message)'; + } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(DiagnosticsProperty('type', 'CustomException<$T>.unknown')) + ..add(DiagnosticsProperty('message', message)); + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$UnknownException && + (identical(other.message, message) || other.message == message)); + } + + @override + int get hashCode => Object.hash(runtimeType, message); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$UnknownExceptionCopyWith> get copyWith => + __$$UnknownExceptionCopyWithImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(T flow) badRequest, + required TResult Function() unauthorized, + required TResult Function(String flowId, String? message) flowExpired, + required TResult Function(Session? session) twoFactorAuthRequired, + required TResult Function(String? message) unknown, + }) { + return unknown(message); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(T flow)? badRequest, + TResult? Function()? unauthorized, + TResult? Function(String flowId, String? message)? flowExpired, + TResult? Function(Session? session)? twoFactorAuthRequired, + TResult? Function(String? message)? unknown, + }) { + return unknown?.call(message); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(T flow)? badRequest, + TResult Function()? unauthorized, + TResult Function(String flowId, String? message)? flowExpired, + TResult Function(Session? session)? twoFactorAuthRequired, + TResult Function(String? message)? unknown, + required TResult orElse(), + }) { + if (unknown != null) { + return unknown(message); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(BadRequestException value) badRequest, + required TResult Function(UnauthorizedException value) unauthorized, + required TResult Function(FlowExpiredException value) flowExpired, + required TResult Function(TwoFactorAuthRequiredException value) + twoFactorAuthRequired, + required TResult Function(UnknownException value) unknown, + }) { + return unknown(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(BadRequestException value)? badRequest, + TResult? Function(UnauthorizedException value)? unauthorized, + TResult? Function(FlowExpiredException value)? flowExpired, + TResult? Function(TwoFactorAuthRequiredException value)? + twoFactorAuthRequired, + TResult? Function(UnknownException value)? unknown, + }) { + return unknown?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(BadRequestException value)? badRequest, + TResult Function(UnauthorizedException value)? unauthorized, + TResult Function(FlowExpiredException value)? flowExpired, + TResult Function(TwoFactorAuthRequiredException value)? + twoFactorAuthRequired, + TResult Function(UnknownException value)? unknown, + required TResult orElse(), + }) { + if (unknown != null) { + return unknown(this); + } + return orElse(); + } +} + +abstract class UnknownException extends CustomException { + const factory UnknownException({final String? message}) = + _$UnknownException; + const UnknownException._() : super._(); + + String? get message; + @JsonKey(ignore: true) + _$$UnknownExceptionCopyWith> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/flutter-ory-network/lib/services/storage.dart b/flutter-ory-network/lib/services/storage.dart new file mode 100644 index 0000000..615cda0 --- /dev/null +++ b/flutter-ory-network/lib/services/storage.dart @@ -0,0 +1,37 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; + +class SecureStorage { + static SecureStorage? _instance; + + factory SecureStorage() => + _instance ?? SecureStorage._(const FlutterSecureStorage()); + + SecureStorage._(this._storage); + + final FlutterSecureStorage _storage; + static const _tokenKey = 'TOKEN'; + + Future persistToken(String token) async { + await _storage.write(key: _tokenKey, value: token); + } + + Future hasToken() async { + var value = await _storage.read(key: _tokenKey); + return value != null; + } + + Future deleteToken() async { + return _storage.delete(key: _tokenKey); + } + + Future getToken() async { + return _storage.read(key: _tokenKey); + } + + Future deleteAll() async { + return _storage.deleteAll(); + } +} diff --git a/flutter-ory-network/lib/widgets/helpers.dart b/flutter-ory-network/lib/widgets/helpers.dart new file mode 100644 index 0000000..6cb8675 --- /dev/null +++ b/flutter-ory-network/lib/widgets/helpers.dart @@ -0,0 +1,98 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:bloc/bloc.dart'; +import 'package:flutter/material.dart'; +import 'package:ory_client/ory_client.dart'; + +import 'nodes/input.dart'; +import 'nodes/input_submit.dart'; +import 'nodes/text.dart'; + +getMessageColor(UiTextTypeEnum type) { + switch (type) { + case UiTextTypeEnum.success: + return Colors.green; + case UiTextTypeEnum.error: + return Colors.red; + case UiTextTypeEnum.info: + return Colors.grey; + } +} + +buildFlowNotCreated(BuildContext context, String? message) { + if (message != null) { + return Center( + child: Text( + message, + style: const TextStyle(color: Colors.red), + )); + } else { + return const Center(child: CircularProgressIndicator()); + } +} + +buildGroup( + BuildContext context, + UiNodeGroupEnum group, + List nodes, + void Function(BuildContext, String, String) onInputChange, + void Function(BuildContext, UiNodeGroupEnum, String, String) + onInputSubmit) { + final formKey = GlobalKey(); + return Padding( + padding: const EdgeInsets.only(bottom: 0), + child: Form( + key: formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListView.builder( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: ((BuildContext context, index) { + final attributes = nodes[index].attributes.oneOf; + if (attributes.isType(UiNodeInputAttributes)) { + return buildInputNode(context, formKey, nodes[index], + onInputChange, onInputSubmit); + } else if (attributes.isType(UiNodeTextAttributes)) { + return TextNode(node: nodes[index]); + } else { + return Container(); + } + }), + itemCount: nodes.length), + ], + ), + ), + ); +} + +buildInputNode( + BuildContext context, + GlobalKey formKey, + UiNode node, + void Function(BuildContext, String, String) onInputChange, + void Function(BuildContext, UiNodeGroupEnum, String, String) + onInputSubmit) { + final inputNode = node.attributes.oneOf.value as UiNodeInputAttributes; + switch (inputNode.type) { + case UiNodeInputAttributesTypeEnum.submit: + return InputSubmitNode( + node: node, + formKey: formKey, + onChange: onInputChange, + onSubmit: onInputSubmit); + case UiNodeInputAttributesTypeEnum.button: + return InputSubmitNode( + node: node, + formKey: formKey, + onChange: onInputChange, + onSubmit: onInputSubmit); + case UiNodeInputAttributesTypeEnum.hidden: + return const SizedBox.shrink(); + + default: + return InputNode(node: node, onChange: onInputChange); + } +} diff --git a/flutter-ory-network/lib/widgets/nodes/input.dart b/flutter-ory-network/lib/widgets/nodes/input.dart new file mode 100644 index 0000000..05731b3 --- /dev/null +++ b/flutter-ory-network/lib/widgets/nodes/input.dart @@ -0,0 +1,158 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:collection/collection.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:ory_client/ory_client.dart'; +import 'package:ory_network_flutter/blocs/login/login_bloc.dart'; +import 'package:ory_network_flutter/blocs/registration/registration_bloc.dart'; + +import '../helpers.dart'; + +class InputNode extends StatefulWidget { + final UiNode node; + final void Function(BuildContext, String, String) onChange; + + const InputNode({super.key, required this.node, required this.onChange}); + @override + State createState() => _InputNodeState(); +} + +class _InputNodeState extends State { + TextEditingController textEditingController = TextEditingController(); + bool? isPasswordHidden; + + @override + void initState() { + super.initState(); + final attributes = + widget.node.attributes.oneOf.value as UiNodeInputAttributes; + // if this is a password field, hide the text + if (attributes.name == 'password') { + setState(() { + isPasswordHidden = true; + }); + } + final fieldValue = attributes.value; + // assign node value to text controller on init + textEditingController.text = fieldValue != null ? fieldValue.asString : ''; + } + +// get text input type of a specific node + _getTextInputType(UiNodeInputAttributesTypeEnum type) { + switch (type) { + case UiNodeInputAttributesTypeEnum.datetimeLocal: + return TextInputType.datetime; + case UiNodeInputAttributesTypeEnum.email: + return TextInputType.emailAddress; + case UiNodeInputAttributesTypeEnum.hidden: + return TextInputType.none; + case UiNodeInputAttributesTypeEnum.number: + return TextInputType.number; + case UiNodeInputAttributesTypeEnum.password: + return TextInputType.text; + case UiNodeInputAttributesTypeEnum.tel: + return TextInputType.phone; + case UiNodeInputAttributesTypeEnum.text: + return TextInputType.text; + case UiNodeInputAttributesTypeEnum.url: + return TextInputType.url; + default: + return null; + } + } + + @override + Widget build(BuildContext context) { + final attributes = + widget.node.attributes.oneOf.value as UiNodeInputAttributes; + + return BlocListener( + bloc: (context).read(), + listener: (context, state) { + UiNode? node; + // find current node in updated state + if (state is LoginState) { + node = state.loginFlow?.ui.nodes.firstWhereOrNull((element) { + if (element.attributes.oneOf.isType(UiNodeInputAttributes)) { + return (element.attributes.oneOf.value as UiNodeInputAttributes) + .name == + attributes.name; + } else { + return false; + } + }); + } else if (state is RegistrationState) { + node = state.registrationFlow?.ui.nodes.firstWhereOrNull((element) { + if (element.attributes.oneOf.isType(UiNodeInputAttributes)) { + return (element.attributes.oneOf.value as UiNodeInputAttributes) + .name == + attributes.name; + } else { + return false; + } + }); + } + + // assign new value of node to text controller + textEditingController.text = + (node?.attributes.oneOf.value as UiNodeInputAttributes) + .value + ?.asString ?? + ''; + }, + child: Padding( + padding: const EdgeInsets.only(bottom: 20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (widget.node.meta.label?.text != null) + Text( + widget.node.meta.label!.text, + style: const TextStyle(fontWeight: FontWeight.w600), + ), + const SizedBox( + height: 4, + ), + TextFormField( + controller: textEditingController, + enabled: !attributes.disabled, + keyboardType: _getTextInputType(attributes.type), + onChanged: (String value) { + widget.onChange(context, value, attributes.name); + }, + obscureText: isPasswordHidden ?? false, + decoration: isPasswordHidden == null + ? null + : InputDecoration( + suffixIcon: GestureDetector( + onTap: () => setState(() { + isPasswordHidden = !isPasswordHidden!; + }), + child: ImageIcon(isPasswordHidden! + ? const AssetImage('assets/icons/eye.png') + : const AssetImage('assets/icons/eye-off.png')), + )), + validator: (value) { + if (attributes.required_ != null) { + if (attributes.required_! && + (value == null || value.isEmpty)) { + return 'Property is required'; + } + } + return null; + }, + ), + for (var message in widget.node.messages) + Padding( + padding: const EdgeInsets.only(top: 20), + child: Text(message.text, + style: TextStyle(color: getMessageColor(message.type))), + ), + ], + ), + ), + ); + } +} diff --git a/flutter-ory-network/lib/widgets/nodes/input_submit.dart b/flutter-ory-network/lib/widgets/nodes/input_submit.dart new file mode 100644 index 0000000..c2fed9c --- /dev/null +++ b/flutter-ory-network/lib/widgets/nodes/input_submit.dart @@ -0,0 +1,56 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:flutter/material.dart'; +import 'package:ory_client/ory_client.dart'; + +class InputSubmitNode extends StatelessWidget { + final GlobalKey formKey; + final UiNode node; + final void Function(BuildContext, String, String) onChange; + final void Function(BuildContext, UiNodeGroupEnum, String, String) onSubmit; + + const InputSubmitNode( + {super.key, + required this.formKey, + required this.node, + required this.onChange, + required this.onSubmit}); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + SizedBox( + width: double.infinity, + child: FilledButton( + // validate input fields that belong to this buttons group + onPressed: () { + if (formKey.currentState!.validate()) { + final attributes = + node.attributes.oneOf.value as UiNodeInputAttributes; + final type = attributes.type; + // if attribute type is a button with value 'false', set its value to true on submit + if (type == UiNodeInputAttributesTypeEnum.button || + type == UiNodeInputAttributesTypeEnum.submit && + attributes.value?.value == 'false') { + final nodeName = attributes.name; + + onChange(context, 'true', nodeName); + } + onSubmit( + context, + node.group, + attributes.name, + attributes.value!.isString + ? attributes.value!.asString + : ''); + } + }, + child: Text(node.meta.label?.text ?? ''), + ), + ), + ], + ); + } +} diff --git a/flutter-ory-network/lib/widgets/nodes/provider.dart b/flutter-ory-network/lib/widgets/nodes/provider.dart new file mode 100644 index 0000000..d389084 --- /dev/null +++ b/flutter-ory-network/lib/widgets/nodes/provider.dart @@ -0,0 +1,28 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:flutter/material.dart'; +import 'package:ory_client/ory_client.dart'; + +class SocialProviderInput extends StatelessWidget { + final UiNode node; + + const SocialProviderInput({super.key, required this.node}); + @override + Widget build(BuildContext context) { + final provider = node.attributes.oneOf.isType(UiNodeInputAttributes) + ? (node.attributes.oneOf.value as UiNodeInputAttributes).value?.asString + : null; + return SizedBox( + width: double.infinity, + child: OutlinedButton.icon( + icon: Image.asset( + 'assets/images/flows-auth-buttons-social-$provider.png'), + label: Text(node.meta.label?.text ?? ''), + onPressed: () { + //TODO + }, + ), + ); + } +} diff --git a/flutter-ory-network/lib/widgets/nodes/text.dart b/flutter-ory-network/lib/widgets/nodes/text.dart new file mode 100644 index 0000000..f8a115b --- /dev/null +++ b/flutter-ory-network/lib/widgets/nodes/text.dart @@ -0,0 +1,28 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:flutter/material.dart'; +import 'package:ory_client/ory_client.dart'; + +class TextNode extends StatelessWidget { + final UiNode node; + + const TextNode({super.key, required this.node}); + @override + Widget build(BuildContext context) { + final attributes = node.attributes.oneOf.value as UiNodeTextAttributes; + return Padding( + padding: const EdgeInsets.only(bottom: 20.0), + child: Column( + children: [ + // show label test if it is available + if (node.meta.label?.text != null) Text(node.meta.label!.text), + const SizedBox( + height: 10, + ), + Text(attributes.text.text), + ], + ), + ); + } +} diff --git a/flutter-ory-network/lib/widgets/ory_theme.dart b/flutter-ory-network/lib/widgets/ory_theme.dart new file mode 100644 index 0000000..e9bf977 --- /dev/null +++ b/flutter-ory-network/lib/widgets/ory_theme.dart @@ -0,0 +1,83 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; + +class OryTheme { + OryTheme._(); + + static const Color primaryColor = Color(0xFF1E293B); + static const Color linkColor = Color(0xFF4F46E5); + static const Color errorColor = Color(0xFFEF4444); + static const Color formDefaultColor = Color(0xFF64748B); + static const Color formBorderColor = Color(0xFFE2E8F0); + static const Color formBorderFocusColor = Color(0xFF0F172A); + + static MaterialColor primaryColorSwatch = MaterialColor( + primaryColor.value, + const { + 50: Color(0xFF1E293B), + 100: Color(0xFF1E293B), + 200: Color(0xFF1E293B), + 300: Color(0xFF1E293B), + 400: Color(0xFF1E293B), + 500: Color(0xFF1E293B), + 600: Color(0xFF1E293B), + 700: Color(0xFF1E293B), + 800: Color(0xFF1E293B), + 900: Color(0xFF1E293B), + }, + ); + + static const InputDecorationTheme textFieldTheme = InputDecorationTheme( + contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 12), + hintStyle: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + height: 1.25, + color: formDefaultColor), + errorStyle: TextStyle(color: errorColor), + suffixIconColor: formDefaultColor, + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(width: 1, color: formBorderFocusColor)), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(width: 1, color: formBorderColor), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide(width: 1, color: errorColor)), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide(width: 1, color: errorColor))); + +// buttons + static final TextButtonThemeData textButtonThemeData = TextButtonThemeData( + style: ButtonStyle( + visualDensity: VisualDensity.compact, + tapTargetSize: MaterialTapTargetSize.shrinkWrap, + padding: MaterialStateProperty.all( + EdgeInsets.zero, + ), + foregroundColor: MaterialStateProperty.all(linkColor), + textStyle: MaterialStateProperty.all(const TextStyle( + fontSize: 14, fontWeight: FontWeight.w500, height: 1.5)), + )); + + static final FilledButtonThemeData filledButtonThemeData = + FilledButtonThemeData( + style: ButtonStyle( + padding: MaterialStateProperty.all( + const EdgeInsets.symmetric(vertical: 12, horizontal: 16)), + shape: MaterialStateProperty.all( + RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4.0))))); + + static final ThemeData defaultTheme = ThemeData( + primarySwatch: primaryColorSwatch, + fontFamily: GoogleFonts.getFont('Inter').fontFamily, + textButtonTheme: textButtonThemeData, + appBarTheme: + const AppBarTheme(iconTheme: IconThemeData(color: primaryColor)), + filledButtonTheme: filledButtonThemeData, + inputDecorationTheme: textFieldTheme, + ); +} diff --git a/flutter-ory-network/lib/widgets/social_provider_box.dart b/flutter-ory-network/lib/widgets/social_provider_box.dart new file mode 100644 index 0000000..5c1e788 --- /dev/null +++ b/flutter-ory-network/lib/widgets/social_provider_box.dart @@ -0,0 +1,28 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +import 'package:flutter/material.dart'; + +class SocialProviderBox extends StatelessWidget { + final SocialProvider provider; + + const SocialProviderBox({super.key, required this.provider}); + @override + Widget build(BuildContext context) { + return Expanded( + child: AspectRatio( + aspectRatio: 1.6, + child: Container( + padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16), + decoration: BoxDecoration( + border: Border.all(width: 1, color: const Color(0xFFE2E8F0))), + child: // get icon from assets depending on provider + Image.asset( + 'assets/images/flows-auth-buttons-social-${provider.name}.png'), + ), + ), + ); + } +} + +enum SocialProvider { google, github, apple, linkedin } diff --git a/flutter-ory-network/pubspec.lock b/flutter-ory-network/pubspec.lock new file mode 100644 index 0000000..9ce2d1f --- /dev/null +++ b/flutter-ory-network/pubspec.lock @@ -0,0 +1,818 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 + url: "https://pub.dev" + source: hosted + version: "64.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" + url: "https://pub.dev" + source: hosted + version: "6.2.0" + args: + dependency: transitive + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + bloc: + dependency: "direct main" + description: + name: bloc + sha256: "3820f15f502372d979121de1f6b97bfcf1630ebff8fe1d52fb2b0bfa49be5b49" + url: "https://pub.dev" + source: hosted + version: "8.1.2" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "6c4dd11d05d056e76320b828a1db0fc01ccd376922526f8e9d6c796a5adbac20" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b" + url: "https://pub.dev" + source: hosted + version: "2.4.6" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "6d6ee4276b1c5f34f21fdf39425202712d2be82019983d52f351c94aafbc2c41" + url: "https://pub.dev" + source: hosted + version: "7.2.10" + built_collection: + dependency: "direct main" + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: "direct main" + description: + name: built_value + sha256: ff627b645b28fb8bdb69e645f910c2458fd6b65f6585c3a53e0626024897dedf + url: "https://pub.dev" + source: hosted + version: "8.6.2" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "4ad01d6e56db961d29661561effde45e519939fdaeb46c351275b182eac70189" + url: "https://pub.dev" + source: hosted + version: "4.5.0" + collection: + dependency: "direct main" + description: + name: collection + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + url: "https://pub.dev" + source: hosted + version: "1.17.2" + 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" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + url: "https://pub.dev" + source: hosted + version: "1.0.5" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "1efa911ca7086affd35f463ca2fc1799584fb6aa89883cf0af8e3664d6a02d55" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + deep_collection: + dependency: "direct main" + description: + name: deep_collection + sha256: "59abffbfd9add6d47e04d623c50c3e2bcf3ed6a1606513dbe3325a738f77cb0c" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + dio: + dependency: "direct main" + description: + name: dio + sha256: ce75a1b40947fea0a0e16ce73337122a86762e38b982e1ccb909daa3b9bc4197 + url: "https://pub.dev" + source: hosted + version: "5.3.2" + dotenv: + dependency: "direct main" + description: + name: dotenv + sha256: e169b516bc7b88801919e1c508772bcb8e3d0d1776a43f74ab692c57e741cd8a + url: "https://pub.dev" + source: hosted + version: "4.1.0" + effective_dart: + dependency: transitive + description: + name: effective_dart + sha256: "6a69783c808344084b65667e87ff600823531e95810a8a15882cb542fe22de80" + url: "https://pub.dev" + source: hosted + version: "1.3.2" + equatable: + dependency: "direct main" + description: + name: equatable + sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 + url: "https://pub.dev" + source: hosted + version: "2.0.5" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + file: + dependency: transitive + description: + name: file + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_bloc: + dependency: "direct main" + description: + name: flutter_bloc + sha256: e74efb89ee6945bcbce74a5b3a5a3376b088e5f21f55c263fc38cbdc6237faae + url: "https://pub.dev" + source: hosted + version: "8.1.3" + flutter_dotenv: + dependency: "direct main" + description: + name: flutter_dotenv + sha256: "9357883bdd153ab78cbf9ffa07656e336b8bbb2b5a3ca596b0b27e119f7c7d77" + url: "https://pub.dev" + source: hosted + version: "5.1.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + flutter_secure_storage: + dependency: "direct main" + description: + name: flutter_secure_storage + sha256: "98352186ee7ad3639ccc77ad7924b773ff6883076ab952437d20f18a61f0a7c5" + url: "https://pub.dev" + source: hosted + version: "8.0.0" + flutter_secure_storage_linux: + dependency: transitive + description: + name: flutter_secure_storage_linux + sha256: "0912ae29a572230ad52d8a4697e5518d7f0f429052fd51df7e5a7952c7efe2a3" + url: "https://pub.dev" + source: hosted + version: "1.1.3" + flutter_secure_storage_macos: + dependency: transitive + description: + name: flutter_secure_storage_macos + sha256: "083add01847fc1c80a07a08e1ed6927e9acd9618a35e330239d4422cd2a58c50" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + flutter_secure_storage_platform_interface: + dependency: transitive + description: + name: flutter_secure_storage_platform_interface + sha256: b3773190e385a3c8a382007893d678ae95462b3c2279e987b55d140d3b0cb81b + url: "https://pub.dev" + source: hosted + version: "1.0.1" + flutter_secure_storage_web: + dependency: transitive + description: + name: flutter_secure_storage_web + sha256: "42938e70d4b872e856e678c423cc0e9065d7d294f45bc41fc1981a4eb4beaffe" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter_secure_storage_windows: + dependency: transitive + description: + name: flutter_secure_storage_windows + sha256: fc2910ec9b28d60598216c29ea763b3a96c401f0ce1d13cdf69ccb0e5c93c3ee + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + freezed: + dependency: "direct dev" + description: + name: freezed + sha256: "83462cfc33dc9680533a7f3a4a6ab60aa94f287db5f4ee6511248c22833c497f" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + freezed_annotation: + dependency: "direct main" + description: + name: freezed_annotation + sha256: c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d + url: "https://pub.dev" + source: hosted + version: "2.4.1" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + sha256: e20ff62b158b96f392bfc8afe29dee1503c94fbea2cbe8186fd59b756b8ae982 + url: "https://pub.dev" + source: hosted + version: "5.1.0" + graphs: + dependency: transitive + description: + name: graphs + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 + url: "https://pub.dev" + source: hosted + version: "2.3.1" + http: + dependency: transitive + description: + name: http + sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + json_annotation: + dependency: "direct main" + description: + name: json_annotation + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + url: "https://pub.dev" + source: hosted + version: "4.8.1" + json_serializable: + dependency: "direct dev" + description: + name: json_serializable + sha256: aa1f5a8912615733e0fdc7a02af03308933c93235bdc8d50d0b0c8a8ccb0b969 + url: "https://pub.dev" + source: hosted + version: "6.7.1" + lints: + dependency: transitive + description: + name: lints + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + logging: + dependency: transitive + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" + source: hosted + version: "0.12.16" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + meta: + dependency: transitive + description: + name: meta + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + mime: + dependency: transitive + description: + name: mime + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + url: "https://pub.dev" + source: hosted + version: "1.0.4" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + one_of: + dependency: "direct main" + description: + name: one_of + sha256: "25fe0fcf181e761c6fcd604caf9d5fdf952321be17584ba81c72c06bdaa511f0" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + one_of_serializer: + dependency: transitive + description: + name: one_of_serializer + sha256: "3f3dfb5c1578ba3afef1cb47fcc49e585e797af3f2b6c2cc7ed90aad0c5e7b83" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + ory_client: + dependency: "direct main" + description: + name: ory_client + sha256: "151372511353601d4afd81213523ea0662be0f754b44b4be17c40c91bf1967cc" + url: "https://pub.dev" + source: hosted + version: "1.2.10" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path: + dependency: transitive + description: + name: path + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" + source: hosted + version: "1.8.3" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: "909b84830485dbcd0308edf6f7368bc8fd76afa26a270420f34cabea2a6467a0" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "5d44fc3314d969b84816b569070d7ace0f1dea04bd94a83f74c4829615d22ad8" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "1b744d3d774e5a879bb76d6cd1ecee2ba2c6960c03b1020cd35212f6aa267ac5" + url: "https://pub.dev" + source: hosted + version: "2.3.0" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: ba2b77f0c52a33db09fc8caf85b12df691bf28d983e84cf87ff6d693cfa007b3 + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: bced5679c7df11190e1ddc35f3222c858f328fff85c3942e46e7f5589bf9eb84 + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: ee0e0d164516b90ae1f970bdf29f726f1aa730d7cfc449ecc74c495378b705da + url: "https://pub.dev" + source: hosted + version: "2.2.0" + platform: + dependency: transitive + description: + name: platform + sha256: "57c07bf82207aee366dfaa3867b3164e4f03a238a461a11b0e8a3a510d51203d" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "43798d895c929056255600343db8f049921cbec94d31ec87f1dc5c16c01935dd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + provider: + dependency: transitive + description: + name: provider + sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f + url: "https://pub.dev" + source: hosted + version: "6.0.5" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 + url: "https://pub.dev" + source: hosted + version: "1.2.3" + quiver: + dependency: transitive + description: + name: quiver + sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47 + url: "https://pub.dev" + source: hosted + version: "3.2.1" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: fc0da689e5302edb6177fdd964efcb7f58912f43c28c2047a808f5bfff643d16 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: "6adebc0006c37dd63fe05bca0a929b99f06402fc95aa35bf36d67f5c06de01fd" + url: "https://pub.dev" + source: hosted + version: "1.3.4" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" + source: hosted + version: "1.11.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + url: "https://pub.dev" + source: hosted + version: "0.6.0" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.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: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + 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 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" + source: hosted + version: "2.4.0" + win32: + dependency: transitive + description: + name: win32 + sha256: f2add6fa510d3ae152903412227bda57d0d5a8da61d2c39c1fb022c9429a41c0 + url: "https://pub.dev" + source: hosted + version: "5.0.6" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: f0c26453a2d47aa4c2570c6a033246a3fc62da2fe23c7ffdd0a7495086dc0247 + url: "https://pub.dev" + source: hosted + version: "1.0.2" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.1.0-185.0.dev <4.0.0" + flutter: ">=3.3.0" diff --git a/flutter-ory-network/pubspec.yaml b/flutter-ory-network/pubspec.yaml new file mode 100644 index 0000000..dcc0062 --- /dev/null +++ b/flutter-ory-network/pubspec.yaml @@ -0,0 +1,108 @@ +name: ory_network_flutter +description: A new Flutter project. +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: "none" # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: ">=3.0.6 <4.0.0" + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + bloc: ^8.1.2 + flutter_bloc: ^8.1.3 + dio: ^5.3.2 + ory_client: ^1.1.44 + flutter_dotenv: ^5.1.0 + freezed_annotation: ^2.4.1 + json_annotation: ^4.8.1 + equatable: ^2.0.5 + one_of: ^1.5.0 + flutter_secure_storage: ^8.0.0 + dotenv: ^4.1.0 + google_fonts: ^5.1.0 + built_value: ^8.6.2 + deep_collection: ^1.0.2 + collection: ^1.17.2 + built_collection: ^5.1.1 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^2.0.0 + build_runner: ^2.4.6 + freezed: ^2.4.2 + json_serializable: ^6.7.1 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + assets: + - .env + - assets/images/ + - assets/icons/ + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages