Skip to content

DRAFT: all files #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions add_to_app/fullscreen/flutter_module/.fvm/flutter_sdk
4 changes: 4 additions & 0 deletions add_to_app/fullscreen/flutter_module/.fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"flutterSdkVersion": "3.10.0",
"flavors": {}
}
10 changes: 10 additions & 0 deletions add_to_app/fullscreen/flutter_module/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_module/plaid.dart';
import 'package:provider/provider.dart';

import 'dart:async';

import 'package:plaid_flutter/plaid_flutter.dart';

/// The entrypoint for the flutter module.
void main() {
// This call ensures the Flutter binding has been set up before creating the
Expand Down Expand Up @@ -68,6 +73,7 @@ class MyApp extends StatelessWidget {
routes: {
'/': (context) => const FullScreenView(),
'/mini': (context) => const Contents(),
'/plaid': (context) => PlaidApp(),
},
);
}
Expand Down Expand Up @@ -156,6 +162,10 @@ class Contents extends StatelessWidget {
child: const Text('Exit this screen'),
),
],
ElevatedButton(
onPressed: () => Navigator.pushNamed(context, '/plaid'),
child: const Text('Start plaid'),
),
],
),
),
Expand Down
128 changes: 128 additions & 0 deletions add_to_app/fullscreen/flutter_module/lib/plaid.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:plaid_flutter/plaid_flutter.dart';

class PlaidApp extends StatefulWidget {
@override
_PlaidAppState createState() => _PlaidAppState();
}

class _PlaidAppState extends State<PlaidApp> {
LinkConfiguration? _configuration;
StreamSubscription<LinkEvent>? _streamEvent;
StreamSubscription<LinkExit>? _streamExit;
StreamSubscription<LinkSuccess>? _streamSuccess;
LinkObject? _successObject;

@override
void initState() {
super.initState();

_streamEvent = PlaidLink.onEvent.listen(_onEvent);
_streamExit = PlaidLink.onExit.listen(_onExit);
_streamSuccess = PlaidLink.onSuccess.listen(_onSuccess);
}

@override
void dispose() {
_streamEvent?.cancel();
_streamExit?.cancel();
_streamSuccess?.cancel();
super.dispose();
}

void _createLegacyTokenConfiguration() {
setState(() {
_configuration = LegacyLinkConfiguration(
clientName: "CLIENT_NAME",
publicKey: "PUBLIC_KEY",
environment: LinkEnvironment.sandbox,
products: <LinkProduct>[
LinkProduct.auth,
],
language: "en",
countryCodes: ['US'],
userLegalName: "John Appleseed",
userEmailAddress: "jappleseed@youapp.com",
userPhoneNumber: "+1 (512) 555-1234",
);
});
}

void _createLinkTokenConfiguration() {
setState(() {
_configuration = LinkTokenConfiguration(
token: "link-production-xx",
);
});
}

void _onEvent(LinkEvent event) {
final name = event.name;
final metadata = event.metadata.description();
print("onEvent: $name, metadata: $metadata");
}

void _onSuccess(LinkSuccess event) {
final token = event.publicToken;
final metadata = event.metadata.description();
print("onSuccess: $token, metadata: $metadata");
setState(() => _successObject = event);
}

void _onExit(LinkExit event) {
final metadata = event.metadata.description();
final error = event.error?.description();
print("onExit metadata: $metadata, error: $error");
}

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Container(
width: double.infinity,
color: Colors.grey[200],
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(
child: Center(
child: Text(
_configuration?.toJson().toString() ?? "",
textAlign: TextAlign.center,
),
),
),
ElevatedButton(
onPressed: _createLegacyTokenConfiguration,
child: Text("Create Legacy Token Configuration"),
),
SizedBox(height: 15),
ElevatedButton(
onPressed: _createLinkTokenConfiguration,
child: Text("Create Link Token Configuration"),
),
SizedBox(height: 15),
ElevatedButton(
onPressed: _configuration != null
? () => PlaidLink.open(configuration: _configuration!)
: null,
child: Text("Open"),
),
Expanded(
child: Center(
child: Text(
_successObject?.toJson().toString() ?? "",
textAlign: TextAlign.center,
),
),
),
],
),
),
),
);
}
}
1 change: 1 addition & 0 deletions add_to_app/fullscreen/flutter_module/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ environment:
dependencies:
flutter:
sdk: flutter
plaid_flutter: ^3.1.1
provider: ^6.0.2

dev_dependencies:
Expand Down
1 change: 1 addition & 0 deletions add_to_app/fullscreen/ios_fullscreen/.fvm/flutter_sdk
4 changes: 4 additions & 0 deletions add_to_app/fullscreen/ios_fullscreen/.fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"flutterSdkVersion": "3.10.0",
"flavors": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@
26DF66D0233136460076ACA6 /* Sources */,
26DF66D1233136460076ACA6 /* Frameworks */,
26DF66D2233136460076ACA6 /* Resources */,
D1C2795C35803D65EBC8B371 /* [CP] Embed Pods Frameworks */,
2D6DA20CF3D3B0D3695CAB91 /* [CP-User] Embed Flutter Build flutter_module Script */,
1EB32B86D275CD1133E157AC /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -321,6 +322,33 @@
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;
};
1EB32B86D275CD1133E157AC /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-IOSFullScreen/Pods-IOSFullScreen-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-IOSFullScreen/Pods-IOSFullScreen-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-IOSFullScreen/Pods-IOSFullScreen-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
2D6DA20CF3D3B0D3695CAB91 /* [CP-User] Embed Flutter Build flutter_module Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
name = "[CP-User] Embed Flutter Build flutter_module Script";
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\nset -u\nsource \"${SRCROOT}/../flutter_module/.ios/Flutter/flutter_export_environment.sh\"\nexport VERBOSE_SCRIPT_LOGGING=1 && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/xcode_backend.sh embed_and_thin";
};
79D4306CA9A49DFDB68D2B71 /* [CP-User] Run Flutter Build flutter_module Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -375,23 +403,6 @@
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;
};
D1C2795C35803D65EBC8B371 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-IOSFullScreen/Pods-IOSFullScreen-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-IOSFullScreen/Pods-IOSFullScreen-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-IOSFullScreen/Pods-IOSFullScreen-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
1 change: 1 addition & 0 deletions add_to_app/fullscreen/ios_fullscreen/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

flutter_application_path = '../flutter_module'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
pod 'Plaid'

target 'IOSFullScreen' do
# Comment the next line if you don't want to use dynamic frameworks
Expand Down