Skip to content

Commit

Permalink
Merge pull request OpenFlutter#43 from jigarfumakiya/master
Browse files Browse the repository at this point in the history
Added complete support for iOS.
  • Loading branch information
lizhuoyuan authored Aug 10, 2021
2 parents 478f304 + 4125f34 commit a62981c
Show file tree
Hide file tree
Showing 22 changed files with 535 additions and 254 deletions.
175 changes: 110 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ support:

**I hope someone can submit iOS support.**


**Note: This plugin is still under development, and some APIs might not be available yet.
Feedback and Pull Requests are most welcome!**

Expand All @@ -26,18 +27,11 @@ dependencies:
flutter:
sdk: flutter
# add flutter_share_me
flutter_share_me: ^0.9.2
```

## Usage

#### Add the following imports to your Dart code:

```
import 'package:flutter_share_me/flutter_share_me.dart';
flutter_share_me: ^0.11.0
```
## Setup

#### Add facebook id
#### Android

Add "facebook app id" to the application tag of AndroidManifest.xml
```
Expand All @@ -64,6 +58,82 @@ string.xml:
</resources>
```


#### IOS

##### setup facebook

make sure you add below deatils in your plist file.


```
<key>FacebookAppID</key>
<string>fbid</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb-your-fb-id</string>
</array>
</dict>
</array>
```
Note-: Make sure you add fb in at start of your fb Id in CFBundleURLSchemes.

Add below value in url scheme.



```<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbauth2</string>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbapi20160328</string>
<string>fbauth</string>
<string>fb-messenger-share-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
```

### Setup Whatsapp

Make sure you add whatsapp in plist.

````<key>LSApplicationQueriesSchemes</key>
<array>
<string>whatsapp</string>
</array>
````

#### Setup Twiter

````<key>LSApplicationQueriesSchemes</key>
<array>
<string>twitter</string>
</array>
````

## Usage

#### Add the following imports to your Dart code:

```
import 'package:flutter_share_me/flutter_share_me.dart';
```


## Methods

#### shareToFacebook({String msg, String url})
Expand All @@ -83,61 +153,36 @@ These methods will return "success" if they successfully jump to the correspondi
## Example
```
Container(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.memory(
base64.decode(base64Image.split(',')[1]),
height: 312,
width: 175.3,
fit: BoxFit.fill,
gaplessPlayback: true,
),
SizedBox(height: 30),
RaisedButton(
child: Text('share to twitter'),
onPressed: () async {
var response = await FlutterShareMe().shareToTwitter(
url: 'https://github.com/lizhuoyuan', msg: msg);
if (response == 'success') {
print('navigate success');
}
},
),
RaisedButton(
child: Text('share to WhatsApp'),
onPressed: () {
FlutterShareMe()
.shareToWhatsApp(base64Image: base64Image, msg: msg);
},
),
RaisedButton(
child: Text('share to WhatsApp Business'),
onPressed: () {
FlutterShareMe()
.shareToWhatsApp4Biz(base64Image: base64Image, msg: msg);
},
),
RaisedButton(
child: Text('share to shareFacebook'),
onPressed: () {
FlutterShareMe().shareToFacebook(
url: 'https://github.com/lizhuoyuan', msg: msg);
},
),
RaisedButton(
child: Text('share to System'),
onPressed: () async {
var response = await FlutterShareMe().shareToSystem(msg: msg);
if (response == 'success') {
print('navigate success');
}
},
),
],
),
)
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(height: 30),
ElevatedButton(
onPressed: () => onButtonTap(Share.twitter),
child: Text('share to twitter')),
ElevatedButton(
onPressed: () => onButtonTap(Share.whatsapp),
child: Text('share to WhatsApp'),
),
ElevatedButton(
onPressed: () => onButtonTap(Share.whatsapp_business),
child: Text('share to WhatsApp Business'),
),
ElevatedButton(
onPressed: () => onButtonTap(Share.facebook),
child: Text('share to FaceBook'),
),
ElevatedButton(
onPressed: () => onButtonTap(Share.share_system),
child: Text('share to System'),
),
],
),
)
```


### Checkout the full example [here](https://github.com/OpenFlutter/flutter_share_me/blob/master/example/lib/main.dart)


6 changes: 6 additions & 0 deletions android/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions android/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions android/.idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion android/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions android/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions android/.idea/runConfigurations.xml

This file was deleted.

6 changes: 6 additions & 0 deletions android/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Empty file modified android/gradlew
100644 → 100755
Empty file.
Loading

0 comments on commit a62981c

Please sign in to comment.