Skip to content
This repository was archived by the owner on Jun 2, 2023. It is now read-only.

Commit e1255c8

Browse files
committed
feat(): add a comprehensive guide to ios/android
1 parent 8431fb8 commit e1255c8

File tree

1 file changed

+67
-11
lines changed

1 file changed

+67
-11
lines changed

README.md

+67-11
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,82 @@
22

33
Capacitor plugin to enable some native twitter features
44

5-
## Notice
5+
## API
66

7-
This plugin is currently under active development and has not yet been published.
7+
- Login
8+
- Logout
9+
- isLogged
810

9-
## iOS
11+
## iOS Setup
1012

11-
- [x] login
12-
- [x] logout
13-
- [ ] share (wip)
13+
- `ionic start my-cap-app --capacitor`
14+
- `cd my-cap-app`
15+
- `npm install —save capacitor-twitter`
16+
- `mkdir www && touch www/index.html`
17+
- `npx cap add ios`
18+
- add the consumer keys at `capacitor.config.json`
1419

15-
## Android
20+
```
21+
{
22+
23+
"plugins": {
24+
"TwitterPlugin": {
25+
"consumerKey": "xxx",
26+
"consumerSecret": "yyy"
27+
}
28+
}
29+
30+
}
31+
```
1632

17-
- [ ] login
18-
- [ ] logout
19-
- [ ] share
33+
- npx cap open ios
34+
- sign your app at xcode (general tab)
35+
- 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)
36+
- also at twitter developer site, add a new callback url in the same format: `twitterkit-your_consumer_api_key`
2037

21-
Check it out on the [ionic sample app](https://github.com/stewwan/capacitor-twitter-example) using this plugin.
38+
Then you should be set to go. Run `ionic cap run ios --livereload` to start the server and then play it through xcode
39+
40+
> 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.
41+
42+
## Android Setup
43+
44+
- `ionic start my-cap-app --capacitor`
45+
- `cd my-cap-app`
46+
- `npm install —save capacitor-twitter`
47+
- `mkdir www && touch www/index.html`
48+
- `npx cap add android`
49+
- add the consumer keys at `capacitor.config.json`
50+
51+
```
52+
{
53+
54+
"plugins": {
55+
"TwitterPlugin": {
56+
"consumerKey": "xxx",
57+
"consumerSecret": "yyy"
58+
}
59+
}
60+
61+
}
62+
```
63+
64+
- at twitter developer site, add the callback url in the following format: `twittersdk://`
65+
- `[extra step]` in android case we need to tell Capacitor to initialise the plugin:
66+
67+
> on your `MainActivity.java` file add to the header `import cap.twitter.plugin.TwitterPlugin;` and then inside the init callback `add(TwitterPlugin.class);`
68+
69+
Now you should be set to go. Try `ionic cap run android --livereload` to start the server and then play/debug it through Android Studio
70+
71+
> 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.
72+
73+
## Sample app
74+
75+
Check it out on the [sample app](https://github.com/stewwan/capacitor-twitter-example) using this plugin.
2276

2377
Follow me [@Twitter](https://twitter.com/StewanSilva)
2478

79+
Cheers 🍻
80+
2581
## License
2682

2783
MIT

0 commit comments

Comments
 (0)