flutter_conscent_plugin 0.0.1 copy "flutter_conscent_plugin: ^0.0.1" to clipboard
flutter_conscent_plugin: ^0.0.1 copied to clipboard

Conscent Plugin SDK.

Features of Paywall

  1. Default Paywall:

Default paywall can contain up to 3 CTAs with the flexibilty to display any of the CTAa at a time over the paywall. Is has three options to offer:
(a) Pass: - (b) Micropayment: - (c) Subscription:- All the enabling and disabling of the CTAs can be done through the Client Dashboard.

  1. Embedded Paywall:

this is a direct access to subscription over the given pawall and the reduces the steps to purchase a subscription as compared to the default paywall. In this paywall all the subscription appear up front with there respective tiers making the subscription selection a process to be a easier.

Getting started of Paywall

Step- In your sample project class, pass client_id and Environment Mode to be used in your app as below sample project (a) contentID:- This will be your article or content id for which detail needs to be checked. (b) Client ID:- Pass your client_id received from Conscent.

Usage of Paywall:-

Particular Content to show a paywall in a particular paid Content.Conscent CallBack Reference: You can pass a callbackReference which will get called after success or failure in processing. If you pass a callbackReference, after successfull processing, the success reference will be called and for failed event, failure event will be called. You can implement ConscentCallBack in your activity and then pass it as a reference.

Dependencies of paywall :-

  1. webView:- A Flutter plugin that provides a WebView widget. On iOS the WebView widget is backed by a WKWebView. On Android the WebView widget is backed by a WebView.

Android iOS Support SDK 19+ or 20+ 9.0+

Add webview_flutter as a dependency in your pubspec.yaml file.

You can now display a WebView by: Instantiating a WebViewController.

to /example folder.

Widget build(BuildContext context) {

return Scaffold(
  appBar: AppBar(
    title: const Text('Conscent'),
  ),
 WebView(
          initialUrl:
              'https://conscent.netlify.app/overlay?clientId=${ConscentInitializer.mClientId}&clientContentId=${ConscentInitializer.mContentId}&loginChallenge=$loginId',
          javascriptMode: JavascriptMode.unrestricted,
          onProgress: (int progress) async {
            javascriptChannels:
            <JavascriptChannel>{_javascriptChannel()};
            print('WebView is loading (progress : $progress%)');
          }
          onWebViewCreated: (controller) {
            print('---onWebViewCreated----${controller.currentUrl()}');
         )}
  1. shared_preferences: - To use this plugin, add shared_preferences as a dependency in your pubspec.yaml file.

Examples Here are small examples that show you how to use the API.

to /example folder.

Future<String?>? getClientId() async { final prefs = await SharedPreferences.getInstance(); return prefs.getString(CLIENT_ID); }

Future<Future

  1. uuid:- If all you want is a unique ID, you should probably call uuid1() or uuid4(). Note that uuid1() may compromise privacy since it creates a UUID containing the computer’s network address. uuid4() creates a random UUID.

to /example folder.

var uuid = '${DateTime.now().millisecondsSinceEpoch.toString()}${Uuid()}';

  1. http :- A composable, Future-based library for making HTTP requests.This package contains a set of high-level functions and classes that make it easy to consume HTTP resources. It's multi-platform, and supports mobile, desktop, and the browser.

Future

to /example folder.


FutureBuilder<ContentAccessModel?>(
                future: getLoginChallengeId(),
                builder: (context, snapshot) {
                  var responseDttta = snapshot.data;
                  print(responseDttta?.signature);
                  if (snapshot.hasData) {
                    return Center(
                      child: Column(
                        children: [
                          responseDttta?.signature == null
                              ? Padding(
                                  padding: EdgeInsets.all(20.0),
                                  child: Text(
                                    'Early use Scientists are still debating when people started wearing clothes. ',
                                    maxLines: showContent ? null : 4,
                                  ),
                                )
                              : SizedBox.shrink(),
                          showContent
                              ? Container()
                              : Expanded(
                                  flex: 2,
                                  // child: MyApppp((response)
                                  child: responseDttta?.signature != null
                                      ? Center(
                                          child: Text(
                                              'Early use Scientists are still debating when people started wearing clothes'.
                                        )
                                      : MyApppp((response) {
                                         
                                          if (responseDttta != null &&
                                              responseDttta.signature != null) {
                                            showContent = true;
                                          } else {
                                            showContent = false;
                                          }
                                          print(showContent);
                                          setState(() {});

                                          (context as Element).reassemble();
                                        })),
                        ],
                      ),
                    );
                  } else if (snapshot.hasError) {
                    return Text('error');
                  } else {
                    return SizedBox.shrink();
                  }
                }),


Additional information :-

In webview to Login the Conscent Paywall and put the otp in field and purchase the content after payment and the lock content will opened in the page. There is a particular content to be a paid you need to purchase that content. You can able to see partially content free after that you need to purchase the complete content to read.