Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/capacitor-community/twitter
Capacitor plugin to enable TwitterKit
https://github.com/capacitor-community/twitter
angular capacitor capacitor-plugin ionic twitter
Last synced: 3 months ago
JSON representation
Capacitor plugin to enable TwitterKit
- Host: GitHub
- URL: https://github.com/capacitor-community/twitter
- Owner: capacitor-community
- Archived: true
- Created: 2019-01-21T20:17:33.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-09-30T15:54:35.000Z (about 2 years ago)
- Last Synced: 2024-04-27T08:36:04.775Z (7 months ago)
- Topics: angular, capacitor, capacitor-plugin, ionic, twitter
- Language: TypeScript
- Homepage: https://capacitor.ionicframework.com/docs/
- Size: 12.5 MB
- Stars: 11
- Watchers: 11
- Forks: 9
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-capacitorjs - @capacitor-community/twitter - Capacitor plugin to enable TwitterKit. (Plugins / Community Plugins)
- awesome-capacitor - Twitter - Enable TwitterKit features for Capacitor. (Community plugins)
README
Capacitor Twitter
@capacitor-community/twitter
Capacitor community plugin for enabling TwitterKit capabilities## Sponsors
## Maintainers
| Maintainer | GitHub | Social |
| ------------ | --------------------------------------- | ----------------------------------------- |
| Stewan Silva | [stewones](https://github.com/stewones) | [@stewones](https://twitter.com/stewones) |## Notice 🚀
We're starting fresh under an official org. If you were using the previous npm package `capacitor-twitter`, please update your package.json to `@capacitor-community/twitter`. Check out [changelog](/CHANGELOG.md) for more info.
## Installation
Using npm:
```bash
npm install @capacitor-community/twitter
```Using yarn:
```bash
yarn add @capacitor-community/twitter
```Sync native files:
```bash
npx cap sync
```## API
- Login
- Logout
- isLogged## Usage
```js
import { Twitter } from "@capacitor-community/twitter";
const twitter = new Twitter();
.login()
.then((r) => console.log(r)) // { authToken:string, authTokenSecret:string, userName:string, userID:string }
.catch((err) => console.log(err));
.isLogged()
.then((r) => console.log(r)) // returns { in: boolean, out: boolean }
.catch((err) => console.log(err));twitter.logout();
```## iOS setup
- `ionic start my-cap-app --capacitor`
- `cd my-cap-app`
- `npm install —-save @capacitor-community/twitter`
- `mkdir www && touch www/index.html`
- `npx cap add ios`
- add the consumer keys at `capacitor.config.json````
{
…
"plugins": {
"Twitter": {
"consumerKey": "xxx",
"consumerSecret": "yyy"
}
}
…
}
```- npx cap open ios
- sign your app at xcode (general tab)
- add a new url type at Xcode (info tab) and make sure the url scheme follows the format `twitterkit-your_consumer_api_key` (grab a key at twitter developer site)
- also at twitter developer site, add a new callback url in the same format: `twitterkit-your_consumer_api_key://` (with nothing behind it)Then you should be set to go. Run `ionic cap run ios --livereload` to start the server and play it through xcode
> Important Notice: every time you change a native code you may need to clean the cache (Product > Clean build folder) and then run the app again.
## Android setup
- `ionic start my-cap-app --capacitor`
- `cd my-cap-app`
- `npm install —-save @capacitor-community/twitter`
- `mkdir www && touch www/index.html`
- `npx cap add android`
- add the consumer keys at `capacitor.config.json````
{
…
"plugins": {
"Twitter": {
"consumerKey": "xxx",
"consumerSecret": "yyy"
}
}
…
}
```- at twitter developer site, add this callback url: `twittersdk://` (with nothing behind it)
- `[extra step]` in android case we need to tell Capacitor to initialise the plugin:> on your `MainActivity.java` file add `import com.getcapacitor.community.twitter.TwitterPlugin;` and then inside the init callback `add(TwitterPlugin.class);`
Now you should be set to go. Try `ionic cap run android --livereload` to start the server and play/debug it through Android Studio
> Important Notice: every time you change a native code you may need to clean the cache (Build > Clean Project | Build > Rebuild Project) and then run the app again.
## Example
- https://github.com/capacitor-community/twitter/blob/master/example
## License
MIT
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Stew
💻 📖
Luca Ban
📖
eidanfi
🚧
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!