https://github.com/tidev/appcelerator.social-share
A collection of API's to Social Share
https://github.com/tidev/appcelerator.social-share
titanium-module
Last synced: 5 days ago
JSON representation
A collection of API's to Social Share
- Host: GitHub
- URL: https://github.com/tidev/appcelerator.social-share
- Owner: tidev
- License: other
- Created: 2021-02-16T09:05:23.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-03-06T21:48:36.000Z (about 1 year ago)
- Last Synced: 2024-05-01T11:49:16.687Z (about 1 year ago)
- Topics: titanium-module
- Language: Swift
- Homepage:
- Size: 154 KB
- Stars: 7
- Watchers: 13
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Appcelerator Social Share Module
- This module brings Social Share functionaliy into the mobile apps for titanium app developers.
## Getting Started
- Set the `` element in tiapp.xml, such as this:
``` xmlappcelerator.socialshare
```
- To access this module from JavaScript, you would do the following:
``` js
var socialshare = require("appcelerator.socialshare");
```
The `socialshare` variable is a reference to the Module object.## Follow basic steps to share using activity item provider:
- Use `createActivityItemProvider` to create item provider
``` js
const itemProvider = socialshare.createActivityItemProvider({
contentType: socialshare.Content_Type_String,
placeHolder: 'placeholder'
});
```
- Set `fetchItem` for `itemProvider` status
``` js
itemProvider.fetchItem = function () {
return 'This is Text To Share';
};
```
- Set `activityType` for `itemProvider` status
``` js
itemProvider.activityType = socialshare.Activity_Type_Message;
```
- Set `activityType` for `itemProvider` status
``` js
itemProvider.activityType = socialshare.Activity_Type_Message;
```
- create `customActivity` using `createCustomActivity` if custom activity is required
``` js
const customActivity = socialshare.createCustomActivity({
category: socialshare.Activity_Category_Share,
title: 'url share',
});
```
- call `shareWithItems` for share the content status
``` js
socialshare.shareWithItems({
activityItems: [ itemProvider ],
activities: [ customActivity ],
completionWithItemsHandler: function (e) {
if (e.errorCode !== null || e.errorDomain !== null || e.errorDescription !== null) {
alert('Error Occured: ' + e.errorDescription);
return;
}
}
});
```
## Follow basic steps to share using activity item source:- Use `createActivityItemSource` to create item source
``` js
const itemSource = socialshare.createActivityItemSource({
contentType: socialshare.Content_Type_String
});
```
- Set `fetchItem` for `itemSource` status
``` js
itemSource.fetchItem = function () {
return 'This is Text To Share';
};
```
- Set `fetchPlaceholderItem` for `itemSource` status
``` js
itemSource.fetchPlaceholderItem = function () {
return 'This is Text To Share';
};
```
- create `customActivity` using `createCustomActivity` if custom activity is required
``` js
const customActivity = socialshare.createCustomActivity({
category: socialshare.Activity_Category_Share,
title: 'url share',
});
```
- call `shareWithItems` for share the content status
``` js
socialshare.shareWithItems({
activityItems: [ itemSource ],
activities: [ customActivity ],
completionWithItemsHandler: function (e) {
if (e.errorCode !== null || e.errorDomain !== null || e.errorDescription !== null) {
alert('Error Occured: ' + e.errorDescription);
return;
}
}
});
```## Example
- Please see the `example/` folder.## Building
Simply run `appc run -p ios --build-only` which will compile and package your module.
Copy the module zip file into the root folder of your Titanium application or in the Titanium system folder (e.g. /Library/Application Support/Titanium).
## Author
Axway
## License
Copyright (c) 2020 by Axway, Inc. Please see the LICENSE file for further details.