Skip to content

Commit

Permalink
Explain missing projectID to user
Browse files Browse the repository at this point in the history
  • Loading branch information
incorbador committed Mar 19, 2024
1 parent d5a1ae7 commit 091f5fc
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion packages/passkeys/passkeys/example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '11.0'
platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 160,7 @@
KnownAssetTags = (
New,
);
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9500F007C117D = {
Expand Down Expand Up @@ -347,7 347,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -429,7 429,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -478,7 478,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
11 changes: 11 additions & 0 deletions packages/passkeys/passkeys/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 1,7 @@
import 'package:corbado_auth/corbado_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:passkeys_example/pages/error_page.dart';
import 'package:passkeys_example/pages/loading_page.dart';
import 'package:passkeys_example/providers.dart';
import 'package:passkeys_example/router.dart';
Expand All @@ -18,6 19,16 @@ void main() async {

final relyingPartyServer = CustomCorbadoAuth();
const corbadoProjectId = String.fromEnvironment('CORBADO_PROJECT_ID');

if (corbadoProjectId.isEmpty) {
runApp(const ErrorPage(
error: 'CORBADO_PROJECT_ID is not set',
hint:
'Please add this at the end of your flutter run command: \n--dart-define=CORBADO_PROJECT_ID=pro-8751299119685489253',
));
return;
}

await relyingPartyServer.init(corbadoProjectId);

runApp(
Expand Down
47 changes: 47 additions & 0 deletions packages/passkeys/passkeys/example/lib/pages/error_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 1,47 @@
import 'package:flutter/material.dart';

// Only shown during initial loading of the app.
class ErrorPage extends StatelessWidget {
const ErrorPage({required this.error, this.hint, super.key});

final String error;
final String? hint;

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'Attention',
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.bold,
),
),
const Text('We could not load this example app'),
Text('Details: $error'),
if (hint != null)
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 20),
const Text(
'How can you solve this?',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
Text(hint!, textAlign: TextAlign.center, style: TextStyle(fontSize: 12),),
],
),
],
)),
),
);
}
}

0 comments on commit 091f5fc

Please sign in to comment.