Skip to content
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

[GSoC][Feature Request #1346 ]: Enabling Plugins , Donation as a Plugin, Refractor for TalawaPluginProvider Widget #1355

Merged
merged 62 commits into from
Oct 18, 2022

Conversation

SiddheshKukade
Copy link
Member

@SiddheshKukade SiddheshKukade commented Sep 2, 2022

This Pull Request is associated with Google Summer of Code 2022 Project link

Details will be added soon

What kind of change does this PR introduce?
Feature Request : for Enabling Plugins in Navbar, Implementing Donation as a Plugin, Refractor for TalawaPluginProvider Widget
Issue Number:

Fixes #1346

Did you add tests for your changes?
Will be added soon.

Snapshots/Videos:
Will be added soon

If relevant, did you update the documentation?
Not needed for now but will be added later if required

Summary
Problems and their solutions are described below

1. Donation feature as a plugin (c75a482)

Problem :

Currently the donation feature in the talawa app is not functional and also not implemented as a plugin so that the admins can't control it's visibility

Solution :

Donation UI must be implemented as a plugin in order control it's visibility across the organization in the talwa app by the talawa-admin panel. Donations feature should be implemented by using payment pacakges like flutter_braintree etc.

Approach :

  1. Wrap the Donation with TalawaPluginProvider Widget (to enable as plugin)
  2. Implement the payment button by using the
    flutter_braintree package (https://pub.dev/packages/flutter_braintree)
  3. After successful payment the donation transaction must be stored in the database and can be accessed by talawa-admin
     
    More on braintree : https://www.braintreepayments.com/about-braintree

2. Plugin architecture in the Navbar : (7709191)

Video :

Talwa.Demo.Admin.and.App.mp4

Problem : The main features of the talawa app are Events, Posts , etc. These features are not implemented as plugins which means that admin can't control whether to enable these features in the org or not.

We need some solution to implement it as a plugin

Solution :

Implement a mechanism to control visibility of those main features

Approach :

The main feature of the talawa app are only accessible from the navbar of the app So, to implement them as plugin we have to :

  1. Create a separate widget TalwaPluginProviderNav that will be used for wrapping around theses navbar items.
  2. TalwaPluginProvider will make sure to only show those components that are installed for that org only
  3. If a Plugin has installed in the Organization by the admin then some of it's property should be like
{
Visible : true,
installedOrgs : [,<YOUR_ORG_ID>]
}

a. The TalawaPluginProviderNav will make sure that these properties are valid and then and only then it will insert that items in the flutter UI tree for that navbar
b. Specific Icons for specific features are need to be specified already in a Object called as insert-here and then the Icons would also be dynamically rendered according to visibility of those features as plugins
c. The visible property of the navbar items can be set to true for development purposes . If true the features will be visible and  accessible in the organization even if they are not installed for that organization (use this for development only)

  1. Working of the TalwaPluginProvider class :

3. Fixing how the components are rendered using TalawaPluginProvider (20fc546)

Problem :

TalawaPluginProvider widget is used for implementing features as plugins.  It uses Visiblity widget to control  the visibility of the UI that It is wrapped over. Visiblity widget have some a issue that it does not remove that component from the Flutter UI tree . This can create some bugs in the future and  needs to be resolved

Solution :

We should directly return the componet instead of wrapping it in Visiblity Component

Approach :

Replace the Visibility widget by an empty Container() widget.


Does this PR introduce a breaking change?
No
Other information
Not needed.

Have you read the contributing guide?
Yes

@SiddheshKukade SiddheshKukade changed the title Add Donation as Plugin [Feature Request #1346 ]: Enabling Plugins , Donation as a Plugin, Refractor for TalawaPluginProvider Widget Sep 2, 2022
@codecov-commenter
Copy link

codecov-commenter commented Sep 29, 2022

Codecov Report

Merging #1355 (2a14faa) into develop (d87c8db) will decrease coverage by 3.02%.
The diff coverage is 48.28%.

@@             Coverage Diff             @@
##           develop    #1355      +/-   ##
===========================================
- Coverage    71.10%   68.08%   -3.03%     
===========================================
  Files          127      143      +16     
  Lines         6379     7159     +780     
===========================================
+ Hits          4536     4874     +338     
- Misses        1843     2285     +442     
Impacted Files Coverage Δ
lib/models/chats/chat_message.dart 0.00% <ø> (ø)
lib/models/chats/chat_message.g.dart 0.00% <0.00%> (ø)
lib/plugins/fetch_plugin_list.dart 0.00% <0.00%> (ø)
lib/services/chat_service.dart 0.00% <0.00%> (ø)
lib/services/database_mutation_functions.dart 6.25% <0.00%> (-0.28%) ⬇️
lib/services/event_service.dart 15.38% <0.00%> (-2.01%) ⬇️
lib/services/graphql_config.dart 100.00% <ø> (+58.62%) ⬆️
lib/utils/chat_queries.dart 0.00% <0.00%> (ø)
lib/utils/queries.dart 59.25% <0.00%> (-12.17%) ⬇️
...odels/chat_view_models/direct_chat_view_model.dart 31.11% <0.00%> (-4.79%) ⬇️
... and 73 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

DMills27
DMills27 previously approved these changes Oct 9, 2022
Copy link
Member

@DMills27 DMills27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@palisadoes
Copy link
Contributor

@SiddheshKukade Please fix the failing tests.

@SiddheshKukade
Copy link
Member Author

SiddheshKukade commented Oct 14, 2022

@SiddheshKukade Please fix the failing tests.

@palisadoes Sir the now current CI/CD is not passing due to the code coverage. But I've added tests for the entire utils folder .

you can check them here Test for utils folder.

But it looks like the codecov.io is not recognizing tests from utils folder. is that folder ignored from the code coverage ?

image

and I think the other check greeting message is failing due to some of it's internal errors with packages
image

ERROR Message

image

The greeting message is also failing for PR #1363 as well with the same error output


@palisadoes
Copy link
Contributor

palisadoes commented Oct 15, 2022

I'm wondering if this could be caused by the extra comments we have been adding in the code as part of our documentation project

@palisadoes
Copy link
Contributor

palisadoes commented Oct 15, 2022

You can see the files that are not covered here. Click on the show more link under the Annotations heading

@SiddheshKukade
Copy link
Member Author

SiddheshKukade commented Oct 16, 2022

You can see the files that are not covered here. Click on the show more link under the Annotations heading

@palisadoes Sir I just checked out that the Current code coverage of talawa for the develop branch is around 68%
From Codecov.io : talawa
image

And in the workflow file pull-request.yml it is set as 71% ( 3% more than current coverage )
image

I think the expected coverage (workflow file) should be less than the current coverage (codecov). What is your opinion about this?

@palisadoes
Copy link
Contributor

OK. I'll adjust it.

@palisadoes palisadoes merged commit 0b29763 into PalisadoesFoundation:develop Oct 18, 2022
@SiddheshKukade SiddheshKukade changed the title [Feature Request #1346 ]: Enabling Plugins , Donation as a Plugin, Refractor for TalawaPluginProvider Widget [GSoC][Feature Request #1346 ]: Enabling Plugins , Donation as a Plugin, Refractor for TalawaPluginProvider Widget Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request : Enabling Plugins , Donation as a Plugin, Refractor for TalawaPluginProvider Widget
4 participants