Merge branch 'main' of ssh://git.planpostai.com:2222/planpostai/fake-checker-nativeapp
This commit is contained in:
commit
50acb05f23
4 changed files with 228 additions and 114 deletions
121
LICENSE
Normal file
121
LICENSE
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
Creative Commons Legal Code
|
||||
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
this CC0 or use of the Work.
|
||||
126
README.md
126
README.md
|
|
@ -1,93 +1,61 @@
|
|||
# fake-checker-nativeapp
|
||||
# Fact Checker App
|
||||
|
||||
A mobile application built with Expo that helps users verify information and detect misinformation across various sources.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
## Getting started
|
||||
|
||||
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
||||
|
||||
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
||||
|
||||
## Add your files
|
||||
|
||||
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
||||
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
||||
|
||||
```
|
||||
cd existing_repo
|
||||
git remote add origin https://git.planpostai.com/smfahimhossen/fake-checker-nativeapp.git
|
||||
git branch -M main
|
||||
git push -uf origin main
|
||||
```
|
||||
|
||||
## Integrate with your tools
|
||||
|
||||
- [ ] [Set up project integrations](https://git.planpostai.com/smfahimhossen/fake-checker-nativeapp/-/settings/integrations)
|
||||
|
||||
## Collaborate with your team
|
||||
|
||||
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
||||
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
||||
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
||||
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
||||
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
||||
|
||||
## Test and Deploy
|
||||
|
||||
Use the built-in continuous integration in GitLab.
|
||||
|
||||
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
||||
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
||||
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
||||
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
||||
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
||||
|
||||
***
|
||||
|
||||
# Editing this README
|
||||
|
||||
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
||||
|
||||
## Suggestions for a good README
|
||||
|
||||
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
||||
|
||||
## Name
|
||||
Choose a self-explaining name for your project.
|
||||
|
||||
## Description
|
||||
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
||||
|
||||
## Badges
|
||||
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
||||
|
||||
## Visuals
|
||||
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
||||
- [Node.js](https://nodejs.org/) (v16 or higher)
|
||||
- [npm](https://www.npmjs.com/) (v8 or higher)
|
||||
- [Expo CLI](https://docs.expo.dev/workflow/expo-cli/) (`npm install -g expo-cli`)
|
||||
|
||||
## Installation
|
||||
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
||||
|
||||
## Usage
|
||||
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
||||
1. Clone the repository:
|
||||
```bash
|
||||
git clone https://github.com/yourusername/fact-checker-app.git
|
||||
cd fact-checker-app
|
||||
```
|
||||
|
||||
## Support
|
||||
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
||||
2. Install dependencies:
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
## Roadmap
|
||||
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
||||
3. Start the development server:
|
||||
```bash
|
||||
npx expo start
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
- Run in development mode:
|
||||
```bash
|
||||
npx expo start
|
||||
```
|
||||
|
||||
- Run with specific platform:
|
||||
```bash
|
||||
npx expo start --android
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
npm run test
|
||||
```
|
||||
|
||||
## Contributing
|
||||
State if you are open to contributions and what your requirements are for accepting them.
|
||||
|
||||
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
||||
|
||||
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
||||
|
||||
## Authors and acknowledgment
|
||||
Show your appreciation to those who have contributed to the project.
|
||||
1. Fork the repository
|
||||
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
||||
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
||||
4. Push to the branch (`git push origin feature/amazing-feature`)
|
||||
5. Open a Pull Request
|
||||
|
||||
## License
|
||||
For open source projects, say how it is licensed.
|
||||
|
||||
## Project status
|
||||
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
||||
This project is released under Creative Commons CC0 1.0 Universal (CC0 1.0) Public Domain Dedication.
|
||||
|
||||
To the extent possible under law, the author has waived all copyright and related or neighboring rights to this work. This work is published from: [Your Country].
|
||||
|
||||
For more information, please visit: https://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
|
|
|||
2
app.json
2
app.json
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"expo": {
|
||||
"name": "FactChecker",
|
||||
"name": "Fact checker",
|
||||
"slug": "fake-check-bd",
|
||||
"version": "1.0.0",
|
||||
"orientation": "portrait",
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export default function HomeScreen() {
|
|||
const [isApiCallInProgress, setIsApiCallInProgress] = useState(false);
|
||||
|
||||
// Function to call the fact-check API
|
||||
const checkFacts = async (caption) => {
|
||||
const checkFacts = async (caption, imageUrl) => {
|
||||
try {
|
||||
|
||||
const response = await fetch('https://factcheck.planpostai.com/check-facts', {
|
||||
|
|
@ -17,7 +17,7 @@ export default function HomeScreen() {
|
|||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ query: caption }),
|
||||
body: JSON.stringify({ query: caption, url:imageUrl }),
|
||||
});
|
||||
|
||||
const responseText = await response.text();
|
||||
|
|
@ -28,14 +28,22 @@ export default function HomeScreen() {
|
|||
}
|
||||
|
||||
const result = JSON.parse(responseText);
|
||||
let color;
|
||||
if (result?.verdict === 'True') {
|
||||
color = "#2E7D32";
|
||||
} else if (result?.verdict === 'False') {
|
||||
color = "#D32F2F";
|
||||
} else {
|
||||
color = "#F9A825";
|
||||
}
|
||||
|
||||
// Send the result back to WebView to show toast
|
||||
webviewRef.current?.injectJavaScript(`
|
||||
(function() {
|
||||
showToast('${result.evidence.replace(/'/g, "\\'")}');
|
||||
return true;
|
||||
})();
|
||||
`);
|
||||
// Send the result back to WebView to show toast
|
||||
webviewRef.current?.injectJavaScript(`
|
||||
(function() {
|
||||
showToast('${result.evidence.replace(/'/g, "\\'")}', 10000, '${color}');
|
||||
return true;
|
||||
})();
|
||||
`);
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
|
|
@ -60,7 +68,6 @@ export default function HomeScreen() {
|
|||
const handleMessage = async (event) => {
|
||||
try {
|
||||
const data = JSON.parse(event.nativeEvent.data);
|
||||
|
||||
switch (data.type) {
|
||||
case 'postData':
|
||||
setPostData(prevData => [...prevData, {
|
||||
|
|
@ -76,7 +83,7 @@ export default function HomeScreen() {
|
|||
setIsApiCallInProgress(true);
|
||||
|
||||
try {
|
||||
const result = await checkFacts(data.caption);
|
||||
const result = await checkFacts(data.caption, data.imageUrls[0]);
|
||||
|
||||
setIsApiCallInProgress(false);
|
||||
webviewRef.current?.injectJavaScript(`
|
||||
|
|
@ -98,12 +105,18 @@ export default function HomeScreen() {
|
|||
setIsApiCallInProgress(false);
|
||||
webviewRef.current?.injectJavaScript(`
|
||||
(function() {
|
||||
const svgCode=\`<svg width="100" height="35" viewBox="0 0 100 35" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="100" height="35" rx="17.5" fill="#F9BF32"/>
|
||||
<path d="M38.716 14.824C38.372 14.824 38.064 14.892 37.792 15.028C37.528 15.164 37.304 15.36 37.12 15.616C36.936 15.864 36.796 16.168 36.7 16.528C36.612 16.888 36.568 17.292 36.568 17.74C36.568 18.348 36.64 18.868 36.784 19.3C36.936 19.724 37.172 20.048 37.492 20.272C37.812 20.496 38.22 20.608 38.716 20.608C39.068 20.608 39.416 20.568 39.76 20.488C40.112 20.408 40.492 20.296 40.9 20.152V21.676C40.524 21.828 40.152 21.94 39.784 22.012C39.416 22.084 39.004 22.12 38.548 22.12C37.668 22.12 36.94 21.94 36.364 21.58C35.796 21.212 35.376 20.7 35.104 20.044C34.832 19.38 34.696 18.608 34.696 17.728C34.696 17.08 34.784 16.488 34.96 15.952C35.136 15.408 35.392 14.94 35.728 14.548C36.072 14.156 36.492 13.852 36.988 13.636C37.492 13.42 38.068 13.312 38.716 13.312C39.14 13.312 39.564 13.368 39.988 13.48C40.42 13.584 40.832 13.728 41.224 13.912L40.636 15.388C40.316 15.236 39.992 15.104 39.664 14.992C39.344 14.88 39.028 14.824 38.716 14.824ZM44.3646 14.74C44.3646 15.06 44.3526 15.368 44.3286 15.664C44.3126 15.96 44.2966 16.168 44.2806 16.288H44.3766C44.5206 16.064 44.6886 15.884 44.8806 15.748C45.0726 15.604 45.2846 15.5 45.5166 15.436C45.7566 15.364 46.0086 15.328 46.2726 15.328C46.7446 15.328 47.1566 15.412 47.5086 15.58C47.8606 15.748 48.1326 16.008 48.3246 16.36C48.5246 16.712 48.6246 17.168 48.6246 17.728V22H46.8366V18.172C46.8366 17.7 46.7486 17.348 46.5726 17.116C46.4046 16.876 46.1406 16.756 45.7806 16.756C45.4206 16.756 45.1366 16.84 44.9286 17.008C44.7286 17.176 44.5846 17.42 44.4966 17.74C44.4086 18.06 44.3646 18.452 44.3646 18.916V22H42.5766V12.88H44.3646V14.74ZM53.1633 15.328C53.7713 15.328 54.2913 15.444 54.7233 15.676C55.1633 15.908 55.5033 16.244 55.7433 16.684C55.9833 17.124 56.1033 17.664 56.1033 18.304V19.168H51.8793C51.8953 19.672 52.0433 20.068 52.3233 20.356C52.6113 20.644 53.0073 20.788 53.5113 20.788C53.9353 20.788 54.3193 20.748 54.6633 20.668C55.0073 20.58 55.3633 20.448 55.7313 20.272V21.652C55.4113 21.812 55.0713 21.928 54.7113 22C54.3593 22.08 53.9313 22.12 53.4273 22.12C52.7713 22.12 52.1913 22 51.6873 21.76C51.1833 21.512 50.7873 21.14 50.4993 20.644C50.2113 20.148 50.0673 19.524 50.0673 18.772C50.0673 18.004 50.1953 17.368 50.4513 16.864C50.7153 16.352 51.0793 15.968 51.5433 15.712C52.0073 15.456 52.5473 15.328 53.1633 15.328ZM53.1753 16.6C52.8313 16.6 52.5433 16.712 52.3113 16.936C52.0873 17.16 51.9553 17.508 51.9153 17.98H54.4233C54.4233 17.716 54.3753 17.48 54.2793 17.272C54.1913 17.064 54.0553 16.9 53.8713 16.78C53.6873 16.66 53.4553 16.6 53.1753 16.6ZM60.2172 22.12C59.5692 22.12 59.0172 22.004 58.5612 21.772C58.1052 21.532 57.7572 21.164 57.5172 20.668C57.2772 20.172 57.1572 19.536 57.1572 18.76C57.1572 17.96 57.2932 17.308 57.5652 16.804C57.8372 16.3 58.2132 15.928 58.6932 15.688C59.1812 15.448 59.7412 15.328 60.3732 15.328C60.8212 15.328 61.2092 15.372 61.5372 15.46C61.8732 15.548 62.1652 15.652 62.4132 15.772L61.8852 17.152C61.6052 17.04 61.3412 16.948 61.0932 16.876C60.8532 16.804 60.6132 16.768 60.3732 16.768C60.0612 16.768 59.8012 16.844 59.5932 16.996C59.3852 17.14 59.2292 17.36 59.1252 17.656C59.0292 17.944 58.9812 18.308 58.9812 18.748C58.9812 19.18 59.0332 19.54 59.1372 19.828C59.2492 20.108 59.4092 20.32 59.6172 20.464C59.8252 20.6 60.0772 20.668 60.3732 20.668C60.7492 20.668 61.0812 20.62 61.3692 20.524C61.6572 20.42 61.9372 20.28 62.2092 20.104V21.628C61.9372 21.804 61.6492 21.928 61.3452 22C61.0492 22.08 60.6732 22.12 60.2172 22.12ZM65.5053 16.96C65.5053 17.208 65.4933 17.456 65.4693 17.704C65.4533 17.944 65.4333 18.188 65.4093 18.436H65.4333C65.5133 18.324 65.5933 18.212 65.6733 18.1C65.7613 17.988 65.8493 17.876 65.9373 17.764C66.0253 17.652 66.1173 17.544 66.2133 17.44L68.0493 15.448H70.0653L67.4613 18.292L70.2213 22H68.1573L66.2733 19.348L65.5053 19.96V22H63.7173V12.88H65.5053V16.96ZM70.5827 19.516V18.052H73.7267V19.516H70.5827ZM76.8138 15.448V22H75.0258V15.448H76.8138ZM75.9258 12.88C76.1898 12.88 76.4178 12.944 76.6098 13.072C76.8018 13.192 76.8978 13.42 76.8978 13.756C76.8978 14.084 76.8018 14.312 76.6098 14.44C76.4178 14.568 76.1898 14.632 75.9258 14.632C75.6538 14.632 75.4218 14.568 75.2298 14.44C75.0458 14.312 74.9538 14.084 74.9538 13.756C74.9538 13.42 75.0458 13.192 75.2298 13.072C75.4218 12.944 75.6538 12.88 75.9258 12.88ZM82.4021 15.328C83.1061 15.328 83.6701 15.52 84.0941 15.904C84.5181 16.28 84.7301 16.888 84.7301 17.728V22H82.9421V18.172C82.9421 17.7 82.8581 17.348 82.6901 17.116C82.5221 16.876 82.2541 16.756 81.8861 16.756C81.3421 16.756 80.9701 16.944 80.7701 17.32C80.5701 17.688 80.4701 18.22 80.4701 18.916V22H78.6821V15.448H80.0501L80.2901 16.288H80.3861C80.5301 16.064 80.7061 15.884 80.9141 15.748C81.1221 15.604 81.3541 15.5 81.6101 15.436C81.8661 15.364 82.1301 15.328 82.4021 15.328Z" fill="white"/>
|
||||
<path d="M16.7778 23.4545L12.3333 19.0909L13.9 17.5527L16.7778 20.3673L24.1 13.1782L25.6667 14.7273M19 6L9 10.3636V16.9091C9 22.9636 13.2667 28.6255 19 30C24.7333 28.6255 29 22.9636 29 16.9091V10.3636L19 6Z" fill="white"/>
|
||||
</svg>
|
||||
\`;
|
||||
enableAllButtons();
|
||||
const button = document.querySelector('button[data-post-id="${data.postId}"]');
|
||||
if (button) {
|
||||
button.disabled = false;
|
||||
button.style.opacity = '1';
|
||||
button.textContent = 'Check';
|
||||
button.innerHTML = svgCode;
|
||||
}
|
||||
return true;
|
||||
})();
|
||||
|
|
@ -182,26 +195,38 @@ export default function HomeScreen() {
|
|||
};
|
||||
|
||||
// Toast notification function
|
||||
window.showToast = function(message, duration = 5000, isError = false) {
|
||||
const container = document.getElementById('toast-container') ||
|
||||
(() => {
|
||||
const cont = document.createElement('div');
|
||||
cont.id = 'toast-container';
|
||||
document.body.appendChild(cont);
|
||||
return cont;
|
||||
})();
|
||||
window.showToast = function showToast(message, duration, color = '#333') {
|
||||
// Create the toast element
|
||||
const toast = document.createElement('div');
|
||||
toast.textContent = message;
|
||||
|
||||
const toast = document.createElement('div');
|
||||
toast.className = 'toast' + (isError ? ' error-toast' : '');
|
||||
toast.textContent = message;
|
||||
container.appendChild(toast);
|
||||
// Apply basic styles
|
||||
toast.style.position = 'fixed';
|
||||
toast.style.top = '5px';
|
||||
toast.style.left = '50%';
|
||||
toast.style.fontSize="16px";
|
||||
toast.style.fontWeight="800";
|
||||
toast.style.transform = 'translateX(-50%)';
|
||||
toast.style.padding = '10px 20px';
|
||||
toast.style.color = '#fff';
|
||||
toast.style.backgroundColor = color; // Dynamic background color
|
||||
toast.style.borderRadius = '8px';
|
||||
toast.style.boxShadow = '0 2px 10px rgba(0, 0, 0, 0.3)';
|
||||
toast.style.zIndex = '9999';
|
||||
toast.style.opacity = '1';
|
||||
toast.style.transition = 'opacity 0.5s ease-in-out';
|
||||
toast.style.width = '85%';
|
||||
|
||||
setTimeout(() => {
|
||||
toast.classList.add('fade-out');
|
||||
toast.addEventListener('transitionend', () => {
|
||||
toast.remove();
|
||||
});
|
||||
}, duration);
|
||||
// Add toast to the DOM
|
||||
document.body.appendChild(toast);
|
||||
|
||||
// Auto-remove the toast after the specified duration
|
||||
setTimeout(() => {
|
||||
toast.style.opacity = '0'; // Fade out
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(toast); // Remove from DOM
|
||||
}, 500); // Match fade-out duration
|
||||
}, duration);
|
||||
};
|
||||
|
||||
// Function to handle "See More" click
|
||||
|
|
@ -285,7 +310,7 @@ export default function HomeScreen() {
|
|||
}
|
||||
|
||||
// Create button if there's a caption or at least one image
|
||||
if ((caption && caption.length > 40) || imagesToUse.length > 0) {
|
||||
if ((caption && caption.length > 50) || imagesToUse.length > 0) {
|
||||
const postId = 'post_' + Math.random().toString(36).substr(2, 9);
|
||||
createButton(post, caption, imagesToUse, postId);
|
||||
}
|
||||
|
|
@ -308,14 +333,14 @@ export default function HomeScreen() {
|
|||
border: "none",
|
||||
borderRadius: "8px",
|
||||
cursor: "pointer",
|
||||
zIndex: 1000000,
|
||||
zIndex: 9999,
|
||||
pointerEvents: "auto",
|
||||
transition: "all 0.3s",
|
||||
});
|
||||
|
||||
button.addEventListener("click", async () => {
|
||||
disableAllButtons();
|
||||
button.textContent = "Processing...";
|
||||
button.textContent = "Processing";
|
||||
button.style.opacity = "0.5";
|
||||
button.style.color="white";
|
||||
button.style.padding="5px 5px";
|
||||
|
|
@ -381,6 +406,6 @@ export default function HomeScreen() {
|
|||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
marginTop: 30,
|
||||
marginTop: 35,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue