stripe kill me

This commit is contained in:
Hitesh Ale
2023-02-26 14:17:19 -05:00
parent d053a0bdaf
commit 60aee74146
11 changed files with 200 additions and 4 deletions

View File

@@ -1,5 +1,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ruswipeshare">
<queries>
<!-- If your app checks for SMS support -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https:" />
</intent>
</queries>
<uses-permission android:name="android.permission.INTERNET" />
<application

View File

@@ -6,6 +6,8 @@
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Ruswipeshare</string>
<key>io.flutter.embedded_views_preview</key>
<string>YES</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>

40
lib/my_webview.dart Normal file
View File

@@ -0,0 +1,40 @@
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
class WebViewApp extends StatefulWidget {
String selectedUrl = "";
WebViewApp({required this.selectedUrl});
@override
State<WebViewApp> createState() => _WebViewAppState();
}
class _WebViewAppState extends State<WebViewApp> {
late final WebViewController controller;
String get selectedUrl => selectedUrl;
@override
void initState() {
super.initState();
controller = WebViewController()
..loadRequest(
Uri.parse(selectedUrl),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Flutter WebView'),
),
body: WebViewWidget(
controller: controller,
),
);
}
}

View File

@@ -5,7 +5,7 @@
// ignore_for_file: implementation_imports
import 'dart:convert';
import 'package:url_launcher/url_launcher.dart';
import 'package:firebase_auth/firebase_auth.dart'
show ActionCodeSettings, FirebaseAuth, FirebaseAuthException, User;
import 'package:flutter/cupertino.dart' hide Title;
@@ -18,7 +18,7 @@ import 'package:flutter_stripe/flutter_stripe.dart';
import 'package:http/http.dart' as http;
import 'package:flutterfire_ui/auth.dart';
import 'package:flutterfire_ui/src/auth/widgets/internal/loading_button.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutterfire_ui/src/auth/widgets/internal/universal_button.dart';
import 'package:flutterfire_ui/src/auth/screens/internal/multi_provider_screen.dart';
@@ -28,6 +28,8 @@ import 'package:flutterfire_ui/src/auth/widgets/internal/subtitle.dart';
import 'package:flutterfire_ui/src/auth/widgets/internal/universal_icon_button.dart';
import 'package:ruswipeshare/credit_view.dart';
import 'my_webview.dart';
class EditButton extends StatelessWidget {
final bool isEditing;
final VoidCallback? onPressed;
@@ -273,8 +275,24 @@ class ProfileScreenCustom extends MultiProviderScreen {
foregroundColor: MaterialStateProperty.all<Color>(Colors.red),
),
onPressed: () async {
var Ddata = await http.get(Uri.parse('http://172.20.10.2:5000/setup-seller'));
var data = jsonDecode(Ddata.body);
String url = data['url'];
final uri = Uri.parse(url);
await launchUrl(uri);
final FirebaseAuth auth = FirebaseAuth.instance;
final User? user = auth.currentUser;
final uid = user?.uid;
String acc = "";
for(String element in url.split("/")){
if(element.contains("acc"))
acc = element;
}
CollectionReference users = FirebaseFirestore.instance.collection('users');
users.add(ASell(acc, uid));
/*
try {
// 1. create payment intent on the server
@@ -307,6 +325,7 @@ class ProfileScreenCustom extends MultiProviderScreen {
}
await Stripe.instance.presentPaymentSheet();
*/
},
child: Text('Setup Seller'),
@@ -362,3 +381,21 @@ class ProfileScreenCustom extends MultiProviderScreen {
);
}
}
class ASell implements Comparable<ASell> {
String suid = "";
String? uid = "";
ASell(this.suid, String? this.uid, );
@override
String toString() {
return "Suid: $suid, uid: $uid";
}
@override
int compareTo(ASell other) {
return suid.compareTo(other.suid);
}
}

View File

@@ -7,9 +7,13 @@
#include "generated_plugin_registrant.h"
#include <desktop_webview_auth/desktop_webview_auth_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) desktop_webview_auth_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopWebviewAuthPlugin");
desktop_webview_auth_plugin_register_with_registrar(desktop_webview_auth_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
}

View File

@@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
desktop_webview_auth
url_launcher_linux
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST

View File

@@ -14,6 +14,7 @@ import geolocator_apple
import path_provider_foundation
import sign_in_with_apple
import twitter_login
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
@@ -25,4 +26,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SignInWithApplePlugin.register(with: registry.registrar(forPlugin: "SignInWithApplePlugin"))
TwitterLoginPlugin.register(with: registry.registrar(forPlugin: "TwitterLoginPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}

View File

@@ -762,6 +762,70 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.1"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
sha256: "75f2846facd11168d007529d6cd8fcb2b750186bea046af9711f10b907e1587e"
url: "https://pub.dev"
source: hosted
version: "6.1.10"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: "1f4d9ebe86f333c15d318f81dcdc08b01d45da44af74552608455ebdc08d9732"
url: "https://pub.dev"
source: hosted
version: "6.0.24"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: c9cd648d2f7ab56968e049d4e9116f96a85517f1dd806b96a86ea1018a3a82e5
url: "https://pub.dev"
source: hosted
version: "6.1.1"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
sha256: e29039160ab3730e42f3d811dc2a6d5f2864b90a70fb765ea60144b03307f682
url: "https://pub.dev"
source: hosted
version: "3.0.3"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: "2dddb3291a57b074dade66b5e07e64401dd2487caefd4e9e2f467138d8c7eb06"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: "6c9ca697a5ae218ce56cece69d46128169a58aa8653c1b01d26fcd4aad8c4370"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: "574cfbe2390666003c3a1d129bdc4574aaa6728f0c00a4829a81c316de69dd9b"
url: "https://pub.dev"
source: hosted
version: "2.0.15"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: "97c9067950a0d09cbd93e2e3f0383d1403989362b97102fbf446473a48079a4b"
url: "https://pub.dev"
source: hosted
version: "3.0.4"
vector_math:
dependency: transitive
description:
@@ -770,6 +834,38 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
webview_flutter:
dependency: "direct main"
description:
name: webview_flutter
sha256: "9ba213434f13e760ea0f175fbc4d6bb6aeafd7dfc6c7d973f15d3e47a5d6686e"
url: "https://pub.dev"
source: hosted
version: "4.0.5"
webview_flutter_android:
dependency: transitive
description:
name: webview_flutter_android
sha256: "48c8cfb023168473c0a3a4c21ffea6c23a32cc7156701c39f618b303c6a3c96e"
url: "https://pub.dev"
source: hosted
version: "3.3.1"
webview_flutter_platform_interface:
dependency: transitive
description:
name: webview_flutter_platform_interface
sha256: df6472164b3f4eaf3280422227f361dc8424b106726b7f21d79a8656ba53f71f
url: "https://pub.dev"
source: hosted
version: "2.0.2"
webview_flutter_wkwebview:
dependency: transitive
description:
name: webview_flutter_wkwebview
sha256: "283a38c2a2544768033864c698e0133aa9eee0f2c800f494b538a3d1044f7ecb"
url: "https://pub.dev"
source: hosted
version: "3.1.1"
win32:
dependency: transitive
description:

View File

@@ -46,6 +46,8 @@ dependencies:
material_dialogs: any
google_fonts: ^4.0.3
http: any
webview_flutter: any
url_launcher: ^6.1.7
dev_dependencies:
flutter_test:

View File

@@ -8,10 +8,13 @@
#include <desktop_webview_auth/desktop_webview_auth_plugin.h>
#include <geolocator_windows/geolocator_windows.h>
#include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
DesktopWebviewAuthPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("DesktopWebviewAuthPlugin"));
GeolocatorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("GeolocatorWindows"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}

View File

@@ -5,6 +5,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
desktop_webview_auth
geolocator_windows
url_launcher_windows
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST