From 8b4342670973be94354f56466f64407516052428 Mon Sep 17 00:00:00 2001 From: arjun_mahr Date: Sat, 27 Jan 2024 13:16:40 +0500 Subject: [PATCH 1/4] Improved payment sheet --- .flutter-plugins | 6 +- .flutter-plugins-dependencies | 2 +- example/ios/Flutter/Debug.xcconfig | 1 + example/ios/Flutter/Release.xcconfig | 1 + example/ios/Podfile | 44 ++++++ example/ios/Podfile.lock | 22 +++ example/ios/Runner.xcodeproj/project.pbxproj | 149 ++++++++++++++++-- .../contents.xcworkspacedata | 3 + example/lib/main.dart | 33 +++- example/macos/Flutter/Flutter-Debug.xcconfig | 1 + .../macos/Flutter/Flutter-Release.xcconfig | 1 + example/macos/Podfile | 43 +++++ lib/src/checkout/widgets/checkout_modal.dart | 95 +++++------ lib/src/flutter_intasend.dart | 64 ++++---- pubspec.yaml | 2 +- 15 files changed, 366 insertions(+), 101 deletions(-) create mode 100644 example/ios/Podfile create mode 100644 example/ios/Podfile.lock create mode 100644 example/macos/Podfile diff --git a/.flutter-plugins b/.flutter-plugins index 0ff853f..0ed3852 100644 --- a/.flutter-plugins +++ b/.flutter-plugins @@ -1,4 +1,4 @@ # This is a generated file; do not edit or check into version control. -webview_flutter=/home/eiji-otieno/.pub-cache/hosted/pub.dev/webview_flutter-4.4.2/ -webview_flutter_android=/home/eiji-otieno/.pub-cache/hosted/pub.dev/webview_flutter_android-3.13.1/ -webview_flutter_wkwebview=/home/eiji-otieno/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.10.0/ +webview_flutter=/Users/arjun/.pub-cache/hosted/pub.dev/webview_flutter-4.4.4/ +webview_flutter_android=/Users/arjun/.pub-cache/hosted/pub.dev/webview_flutter_android-3.14.0/ +webview_flutter_wkwebview=/Users/arjun/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.10.2/ diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index d33cd0d..e373b00 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"webview_flutter_wkwebview","path":"/home/eiji-otieno/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.10.0/","native_build":true,"dependencies":[]}],"android":[{"name":"webview_flutter_android","path":"/home/eiji-otieno/.pub-cache/hosted/pub.dev/webview_flutter_android-3.13.1/","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"webview_flutter","dependencies":["webview_flutter_android","webview_flutter_wkwebview"]},{"name":"webview_flutter_android","dependencies":[]},{"name":"webview_flutter_wkwebview","dependencies":[]}],"date_created":"2024-01-18 11:47:43.916089","version":"3.16.5"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"webview_flutter_wkwebview","path":"/Users/arjun/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.10.2/","native_build":true,"dependencies":[]}],"android":[{"name":"webview_flutter_android","path":"/Users/arjun/.pub-cache/hosted/pub.dev/webview_flutter_android-3.14.0/","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"webview_flutter","dependencies":["webview_flutter_android","webview_flutter_wkwebview"]},{"name":"webview_flutter_android","dependencies":[]},{"name":"webview_flutter_wkwebview","dependencies":[]}],"date_created":"2024-01-27 13:00:25.569322","version":"3.16.5"} \ No newline at end of file diff --git a/example/ios/Flutter/Debug.xcconfig b/example/ios/Flutter/Debug.xcconfig index 592ceee..ec97fc6 100644 --- a/example/ios/Flutter/Debug.xcconfig +++ b/example/ios/Flutter/Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Flutter/Release.xcconfig b/example/ios/Flutter/Release.xcconfig index 592ceee..c4855bf 100644 --- a/example/ios/Flutter/Release.xcconfig +++ b/example/ios/Flutter/Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Podfile b/example/ios/Podfile new file mode 100644 index 0000000..fdcc671 --- /dev/null +++ b/example/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/example/ios/Podfile.lock b/example/ios/Podfile.lock new file mode 100644 index 0000000..b2d92b9 --- /dev/null +++ b/example/ios/Podfile.lock @@ -0,0 +1,22 @@ +PODS: + - Flutter (1.0.0) + - webview_flutter_wkwebview (0.0.1): + - Flutter + +DEPENDENCIES: + - Flutter (from `Flutter`) + - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`) + +EXTERNAL SOURCES: + Flutter: + :path: Flutter + webview_flutter_wkwebview: + :path: ".symlinks/plugins/webview_flutter_wkwebview/ios" + +SPEC CHECKSUMS: + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a + +PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189 + +COCOAPODS: 1.12.1 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 75c0e50..1248559 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -7,13 +7,15 @@ objects = { /* Begin PBXBuildFile section */ + 0ABDCFE5776B508911F0DE2C /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 514FE3926AB4500CD22116E5 /* Pods_RunnerTests.framework */; }; 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 */; }; + 6E943F945A00ECDBE6110C92 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B92AD14CC7B906E51736C356 /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 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 */; }; - 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -42,32 +44,57 @@ /* Begin PBXFileReference section */ 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 = ""; }; + 1640D7578CFAD40BE5D8B186 /* 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 = ""; }; + 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 = ""; }; + 514FE3926AB4500CD22116E5 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6DCA3B250621F538CE2646A1 /* 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 = ""; }; + 8692C46842E050EEBD2A69E2 /* 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 = ""; }; 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 = ""; }; + 97C000F040CA6BF3D5DB9A0D /* 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 = ""; }; 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 = ""; }; - 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; }; + B92AD14CC7B906E51736C356 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + C426F141FDC1299F6AFCFB8D /* 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 = ""; }; + F0E515E8797E653F2E2C4FE6 /* 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 = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 6B60A72993C7F8F4983063FA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 0ABDCFE5776B508911F0DE2C /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 97C146EB1CF9000F007C117D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 6E943F945A00ECDBE6110C92 /* Pods_Runner.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 = ( @@ -79,14 +106,6 @@ name = Flutter; sourceTree = ""; }; - 331C8082294A63A400263BE5 /* RunnerTests */ = { - isa = PBXGroup; - children = ( - 331C807B294A618700263BE5 /* RunnerTests.swift */, - ); - path = RunnerTests; - sourceTree = ""; - }; 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( @@ -94,6 +113,8 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, 331C8082294A63A400263BE5 /* RunnerTests */, + B0ED37C49430E538AEF84100 /* Pods */, + CA0E04000BFD92F3B2A48904 /* Frameworks */, ); sourceTree = ""; }; @@ -121,6 +142,28 @@ path = Runner; sourceTree = ""; }; + B0ED37C49430E538AEF84100 /* Pods */ = { + isa = PBXGroup; + children = ( + F0E515E8797E653F2E2C4FE6 /* Pods-Runner.debug.xcconfig */, + 1640D7578CFAD40BE5D8B186 /* Pods-Runner.release.xcconfig */, + 97C000F040CA6BF3D5DB9A0D /* Pods-Runner.profile.xcconfig */, + 8692C46842E050EEBD2A69E2 /* Pods-RunnerTests.debug.xcconfig */, + C426F141FDC1299F6AFCFB8D /* Pods-RunnerTests.release.xcconfig */, + 6DCA3B250621F538CE2646A1 /* Pods-RunnerTests.profile.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + CA0E04000BFD92F3B2A48904 /* Frameworks */ = { + isa = PBXGroup; + children = ( + B92AD14CC7B906E51736C356 /* Pods_Runner.framework */, + 514FE3926AB4500CD22116E5 /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -128,9 +171,10 @@ isa = PBXNativeTarget; buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( + FBEE34A4511085389714D390 /* [CP] Check Pods Manifest.lock */, 331C807D294A63A400263BE5 /* Sources */, - 331C807E294A63A400263BE5 /* Frameworks */, 331C807F294A63A400263BE5 /* Resources */, + 6B60A72993C7F8F4983063FA /* Frameworks */, ); buildRules = ( ); @@ -146,12 +190,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 735FF7AB9B784FD573B17341 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + D20BE270B58D1D0725914B55 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -239,6 +285,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 735FF7AB9B784FD573B17341 /* [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; @@ -254,6 +322,45 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + D20BE270B58D1D0725914B55 /* [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; + }; + FBEE34A4511085389714D390 /* [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; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -360,7 +467,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 566DYKNXCB; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -369,6 +479,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; @@ -377,7 +488,7 @@ }; 331C8088294A63A400263BE5 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = AE0B7B92F70575B8D7E0D07E /* Pods-RunnerTests.debug.xcconfig */; + baseConfigurationReference = 8692C46842E050EEBD2A69E2 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -395,7 +506,7 @@ }; 331C8089294A63A400263BE5 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 89B67EB44CE7B6631473024E /* Pods-RunnerTests.release.xcconfig */; + baseConfigurationReference = C426F141FDC1299F6AFCFB8D /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -411,7 +522,7 @@ }; 331C808A294A63A400263BE5 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 640959BDD8F10B91D80A66BE /* Pods-RunnerTests.profile.xcconfig */; + baseConfigurationReference = 6DCA3B250621F538CE2646A1 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -538,7 +649,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 566DYKNXCB; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -547,6 +661,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -560,7 +675,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 566DYKNXCB; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -569,6 +687,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/example/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/example/lib/main.dart b/example/lib/main.dart index 8811a7a..50876b3 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,3 +1,5 @@ +import 'dart:developer'; + import 'package:flutter/material.dart'; import 'package:flutter_intasend/flutter_intasend.dart'; @@ -12,6 +14,7 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return const MaterialApp( + debugShowCheckedModeBanner: false, home: HomePage(), ); } @@ -33,21 +36,39 @@ class _HomePageState extends State { ), body: Center( child: FilledButton.tonal( - onPressed: () { + onPressed: () async{ // Initiating the Intasend checkout process when the button is pressed - FlutterIntasend.initCheckOut( + await FlutterIntasend.initCheckOut( context: context, isTest: true, publicKey: "ISPubKey_test_c319353e-ada9-41e6-a793-1a5ad8991e22", currency: Currency.kes, + firstName: 'Test', + lastName: 'User', + email: 'jHbZt@example.com', amount: 15, - accentColor: Colors.red, - backgroundColor: Colors.yellow, - height: MediaQuery.of(context).size.height * 0.7, borderRadius: 16.0, // Callback function for processing status onProcessing: () { - debugPrint("PROCESSING PAYMENT"); + log("PROCESSING PAYMENT"); + }, + onCanceled: () { + log("CANCELED PAYMENT"); + }, + onComplete: () { + log("COMPLETED PAYMENT"); + }, + onFailed: () { + log("FAILED PAYMENT"); + }, + onPartial: () { + log("PARTIAL PAYMENT"); + }, + onPending: () { + log("PENDING PAYMENT"); + }, + onRetry: () { + log("RETRY PAYMENT"); }, ); }, diff --git a/example/macos/Flutter/Flutter-Debug.xcconfig b/example/macos/Flutter/Flutter-Debug.xcconfig index c2efd0b..4b81f9b 100644 --- a/example/macos/Flutter/Flutter-Debug.xcconfig +++ b/example/macos/Flutter/Flutter-Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/example/macos/Flutter/Flutter-Release.xcconfig b/example/macos/Flutter/Flutter-Release.xcconfig index c2efd0b..5caa9d1 100644 --- a/example/macos/Flutter/Flutter-Release.xcconfig +++ b/example/macos/Flutter/Flutter-Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/example/macos/Podfile b/example/macos/Podfile new file mode 100644 index 0000000..c795730 --- /dev/null +++ b/example/macos/Podfile @@ -0,0 +1,43 @@ +platform :osx, '10.14' + +# 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', 'ephemeral', '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 Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_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_macos_build_settings(target) + end +end diff --git a/lib/src/checkout/widgets/checkout_modal.dart b/lib/src/checkout/widgets/checkout_modal.dart index 70827bc..cc8182c 100644 --- a/lib/src/checkout/widgets/checkout_modal.dart +++ b/lib/src/checkout/widgets/checkout_modal.dart @@ -1,5 +1,6 @@ // Importing necessary libraries import 'dart:async'; + import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; @@ -190,6 +191,7 @@ class _CheckOutModalWidgetState extends State { // Building the widget structure return Scaffold( backgroundColor: Colors.transparent, + resizeToAvoidBottomInset: false, body: buildBody(gestureRecognizers: gestureRecognizers), ); } @@ -197,37 +199,44 @@ class _CheckOutModalWidgetState extends State { Widget buildBody({ required Set> gestureRecognizers, }) => - Column( - mainAxisSize: MainAxisSize.min, - children: [ - const Spacer(), - Container( - decoration: BoxDecoration( - borderRadius: widget.borderRadius == null - ? null - : BorderRadius.only( - topLeft: Radius.circular(widget.borderRadius!), - topRight: Radius.circular(widget.borderRadius!), - ), - color: widget.backgroundColor ?? - Theme.of(context).scaffoldBackgroundColor, - ), - child: Align( - alignment: Alignment.centerRight, - child: IconButton( - onPressed: () { - Navigator.pop(context); - }, - icon: const Icon(Icons.close_rounded), + SingleChildScrollView( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: widget.borderRadius == null + ? null + : BorderRadius.only( + topLeft: Radius.circular(widget.borderRadius!), + topRight: Radius.circular(widget.borderRadius!), + ), + color: widget.backgroundColor ?? + Theme.of(context).scaffoldBackgroundColor, + ), + child: Align( + alignment: Alignment.centerRight, + child: IconButton( + onPressed: () { + Navigator.pop(context); + }, + icon: const Icon(Icons.close_rounded), + ), ), ), - ), - buildWebView( - backgroundColor: widget.backgroundColor ?? - Theme.of(context).scaffoldBackgroundColor, - gestureRecognizers: gestureRecognizers, - ) - ], + SizedBox( + height: MediaQuery.of(context).size.height, + child: buildWebView( + backgroundColor: widget.backgroundColor ?? + Theme.of(context).scaffoldBackgroundColor, + gestureRecognizers: gestureRecognizers, + ), + ) + ], + ), ); Widget buildWebView({ @@ -235,25 +244,21 @@ class _CheckOutModalWidgetState extends State { required Set> gestureRecognizers, }) => _webViewController == null - ? Flexible( - child: Container( - color: widget.backgroundColor ?? - Theme.of(context).scaffoldBackgroundColor, - child: Center( - child: CircularProgressIndicator( - color: widget.accentColor, - ), + ? Container( + color: widget.backgroundColor ?? + Theme.of(context).scaffoldBackgroundColor, + child: Center( + child: CircularProgressIndicator( + color: widget.accentColor, ), ), ) - : Flexible( - child: Container( - color: widget.backgroundColor ?? - Theme.of(context).scaffoldBackgroundColor, - child: WebViewWidget( - controller: _webViewController!, - gestureRecognizers: gestureRecognizers, - ), + : Container( + color: widget.backgroundColor ?? + Theme.of(context).scaffoldBackgroundColor, + child: WebViewWidget( + controller: _webViewController!, + gestureRecognizers: gestureRecognizers, ), ); } diff --git a/lib/src/flutter_intasend.dart b/lib/src/flutter_intasend.dart index 1557ccd..ff94d96 100644 --- a/lib/src/flutter_intasend.dart +++ b/lib/src/flutter_intasend.dart @@ -1,7 +1,8 @@ // Importing necessary libraries and classes import 'package:flutter/material.dart'; import 'package:flutter_intasend/src/checkout/enums/currency.dart'; -import 'package:flutter_intasend/src/checkout/widgets/checkout_modal.dart'; + +import 'checkout/widgets/checkout_modal.dart'; // Class for handling Intasend functionalities in Flutter class FlutterIntasend { @@ -31,34 +32,37 @@ class FlutterIntasend { double? borderRadius, }) async { // Showing a loading dialog while processing the checkout initialization - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return PopScope( - canPop: false, - child: CheckOutModalWidget( - isTest: isTest, - publicKey: publicKey, - currency: currency, - amount: amount, - backgroundColor: backgroundColor, - accentColor: accentColor, - height: height, - email: email, - lastName: lastName, - firstName: firstName, - onCanceled: onCanceled, - onComplete: onCanceled, - onFailed: onFailed, - onPartial: onPartial, - onPending: onPending, - onProcessing: onProcessing, - onRetry: onRetry, - borderRadius: borderRadius, - ), - ); - }, - ); + showModalBottomSheet( + context: context, + isDismissible: true, + enableDrag: false, + isScrollControlled: true, + constraints: BoxConstraints.expand( + height: height ?? MediaQuery.of(context).size.height * 0.95), + builder: (BuildContext context) { + return PopScope( + canPop: false, + child: CheckOutModalWidget( + isTest: isTest, + publicKey: publicKey, + currency: currency, + amount: amount, + backgroundColor: backgroundColor, + accentColor: accentColor, + height: height, + email: email, + lastName: lastName, + firstName: firstName, + onCanceled: onCanceled, + onComplete: onCanceled, + onFailed: onFailed, + onPartial: onPartial, + onPending: onPending, + onProcessing: onProcessing, + onRetry: onRetry, + borderRadius: borderRadius, + ), + ); + }); } } diff --git a/pubspec.yaml b/pubspec.yaml index 7585f94..49f26da 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,7 +12,7 @@ dependencies: sdk: flutter http: ^1.1.2 - webview_flutter: ^4.4.2 + webview_flutter: ^4.4.4 dev_dependencies: flutter_test: From 8d1e7b46ca05b4d1c44351f1c226cd0acf64b7c2 Mon Sep 17 00:00:00 2001 From: arjun_mahr Date: Sat, 27 Jan 2024 13:39:45 +0500 Subject: [PATCH 2/4] Improved payment sheet --- lib/src/checkout/widgets/checkout_modal.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/src/checkout/widgets/checkout_modal.dart b/lib/src/checkout/widgets/checkout_modal.dart index cc8182c..c40be0e 100644 --- a/lib/src/checkout/widgets/checkout_modal.dart +++ b/lib/src/checkout/widgets/checkout_modal.dart @@ -73,6 +73,9 @@ class _CheckOutModalWidgetState extends State { publicKey: widget.publicKey, currency: widget.currency, amount: widget.amount, + firstName: widget.firstName, + lastName: widget.lastName, + email: widget.email, context: context); String id = idSi['id']; @@ -254,6 +257,7 @@ class _CheckOutModalWidgetState extends State { ), ) : Container( + height: MediaQuery.of(context).size.height, color: widget.backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, child: WebViewWidget( From 7627871a9f76d10a3ad8f43a7af9b342587cf9c8 Mon Sep 17 00:00:00 2001 From: arjun_mahr Date: Sat, 27 Jan 2024 14:30:30 +0500 Subject: [PATCH 3/4] Improved payment sheet --- example/lib/main.dart | 17 ++++- lib/src/checkout/widgets/checkout_modal.dart | 76 ++++++++++---------- lib/src/flutter_intasend.dart | 3 + 3 files changed, 57 insertions(+), 39 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 50876b3..aa8a409 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -36,9 +36,9 @@ class _HomePageState extends State { ), body: Center( child: FilledButton.tonal( - onPressed: () async{ + onPressed: () async { // Initiating the Intasend checkout process when the button is pressed - await FlutterIntasend.initCheckOut( + await FlutterIntasend.initCheckOut( context: context, isTest: true, publicKey: "ISPubKey_test_c319353e-ada9-41e6-a793-1a5ad8991e22", @@ -46,6 +46,7 @@ class _HomePageState extends State { firstName: 'Test', lastName: 'User', email: 'jHbZt@example.com', + height: MediaQuery.of(context).size.height * 0.95, amount: 15, borderRadius: 16.0, // Callback function for processing status @@ -75,6 +76,18 @@ class _HomePageState extends State { child: const Text("Complete Payment"), ), ), + bottomNavigationBar: BottomNavigationBar( + items: const [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + label: 'Home', + ), + BottomNavigationBarItem( + icon: Icon(Icons.settings), + label: 'Settings', + ) + ], + ), ); } } diff --git a/lib/src/checkout/widgets/checkout_modal.dart b/lib/src/checkout/widgets/checkout_modal.dart index c40be0e..f6c8cfd 100644 --- a/lib/src/checkout/widgets/checkout_modal.dart +++ b/lib/src/checkout/widgets/checkout_modal.dart @@ -113,7 +113,6 @@ class _CheckOutModalWidgetState extends State { @override void initState() { _loadPage(); - super.initState(); // Setting up a periodic timer to check payment status every 3 seconds _timer = Timer.periodic( const Duration(seconds: 3), @@ -148,6 +147,7 @@ class _CheckOutModalWidgetState extends State { }, ), ); + super.initState(); } @override @@ -202,44 +202,46 @@ class _CheckOutModalWidgetState extends State { Widget buildBody({ required Set> gestureRecognizers, }) => - SingleChildScrollView( - padding: EdgeInsets.only( - bottom: MediaQuery.of(context).viewInsets.bottom, - ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - decoration: BoxDecoration( - borderRadius: widget.borderRadius == null - ? null - : BorderRadius.only( - topLeft: Radius.circular(widget.borderRadius!), - topRight: Radius.circular(widget.borderRadius!), - ), - color: widget.backgroundColor ?? - Theme.of(context).scaffoldBackgroundColor, - ), - child: Align( - alignment: Alignment.centerRight, - child: IconButton( - onPressed: () { - Navigator.pop(context); - }, - icon: const Icon(Icons.close_rounded), + CustomScrollView( + slivers: [ + SliverFillRemaining( + hasScrollBody: true, + fillOverscroll: true, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: widget.borderRadius == null + ? null + : BorderRadius.only( + topLeft: Radius.circular(widget.borderRadius!), + topRight: Radius.circular(widget.borderRadius!), + ), + color: widget.backgroundColor ?? + Theme.of(context).scaffoldBackgroundColor, + ), + child: Align( + alignment: Alignment.centerRight, + child: IconButton( + onPressed: () { + Navigator.pop(context); + }, + icon: const Icon(Icons.close_rounded), + ), + ), ), - ), + Flexible( + child: buildWebView( + backgroundColor: widget.backgroundColor ?? + Theme.of(context).scaffoldBackgroundColor, + gestureRecognizers: gestureRecognizers, + ), + ) + ], ), - SizedBox( - height: MediaQuery.of(context).size.height, - child: buildWebView( - backgroundColor: widget.backgroundColor ?? - Theme.of(context).scaffoldBackgroundColor, - gestureRecognizers: gestureRecognizers, - ), - ) - ], - ), + ), + ], ); Widget buildWebView({ diff --git a/lib/src/flutter_intasend.dart b/lib/src/flutter_intasend.dart index ff94d96..ee7070c 100644 --- a/lib/src/flutter_intasend.dart +++ b/lib/src/flutter_intasend.dart @@ -37,6 +37,9 @@ class FlutterIntasend { isDismissible: true, enableDrag: false, isScrollControlled: true, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(borderRadius ?? 16.0), + ), constraints: BoxConstraints.expand( height: height ?? MediaQuery.of(context).size.height * 0.95), builder: (BuildContext context) { From 31705b0eb04f4bd45b4620edd77dbc5f37c9a420 Mon Sep 17 00:00:00 2001 From: arjun_mahr Date: Sat, 27 Jan 2024 14:52:36 +0500 Subject: [PATCH 4/4] Improved payment sheet --- example/lib/main.dart | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index aa8a409..519c074 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -76,18 +76,6 @@ class _HomePageState extends State { child: const Text("Complete Payment"), ), ), - bottomNavigationBar: BottomNavigationBar( - items: const [ - BottomNavigationBarItem( - icon: Icon(Icons.home), - label: 'Home', - ), - BottomNavigationBarItem( - icon: Icon(Icons.settings), - label: 'Settings', - ) - ], - ), ); } }