Skip to content

Commit bce5254

Browse files
author
Elena Hristova
committed
chore: unify create content function names
1 parent bc868d5 commit bce5254

File tree

7 files changed

+33
-33
lines changed

7 files changed

+33
-33
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -279,38 +279,38 @@ export class LoginViewModel extends Observable {
279279
### Create Sharing Content
280280
For sharing, you have to create sharing content first.
281281
Currently the available content types are:
282-
- **createLinksShareContent(link: string, quote?: string, addition?: ShareAdditionContent)** available for every condition
283-
- **createPhotosShareContent(images: ImageSource[] | string[], userGenerated: boolean, addition?: ShareAdditionContent)** available for ShareButton and `showShareDialog` ( only when user have native Facebook installed, version 7.0 or higher )
284-
- **createShareMessengerGenericTemplateContent(contentConfig: MessageGenericTemplateElementContent)** available for SendButton and `showMessageDialog`
282+
- **createShareLinksContent(link: string, quote?: string, addition?: ShareAdditionContent)** available for every condition
283+
- **createSharePhotosContent(images: ImageSource[] | string[], userGenerated: boolean, addition?: ShareAdditionContent)** available for ShareButton and `showShareDialog` ( only when user have native Facebook installed, version 7.0 or higher )
284+
- **createShareMessageGenericTemplateContent(contentConfig: MessageGenericTemplateContent)** available for SendButton and `showMessageDialog`
285285
- **createShareMessageMediaTemplateContent(contentConfig: MessageMediaTemplateContent)** available for SendButton and `showMessageDialog`
286286

287287
You can see more information from [https://developers.facebook.com/docs/sharing/overview#content](https://developers.facebook.com/docs/sharing/overview#content) and [https://developers.facebook.com/docs/sharing/messenger#share-types](https://developers.facebook.com/docs/sharing/messenger#share-types)
288288
```TypeScript
289289
import {
290290
LoginEventData,
291291
getCurrentAccessToken,
292-
createLinksShareContent,
293-
createPhotosShareContent,
294-
createShareMessengerGenericTemplateContent,
292+
createShareLinksContent,
293+
createSharePhotosContent,
294+
createShareMessageGenericTemplateContent,
295295
MessageGenericTemplateImageAspectRatio,
296296
showShareDialog,
297297
showMessageDialog,
298298
canShareDialogShow,
299299
canMessageDialogShow
300300
} from 'nativescript-facebook';
301301

302-
const linkContent = createLinksShareContent('https://www.nativescript.org',
302+
const linkContent = createShareLinksContent('https://www.nativescript.org',
303303
'Create Native iOS and Android Apps With JavaScript',
304304
{
305305
hashtag: '#Nativescript'
306306
});
307307

308308
// you can also pass in imageUrls as string[] in here
309309
const logoImage = fromResource('logo');
310-
const photosContent = createPhotosShareContent([logoImage], false, {
310+
const photosContent = createSharePhotosContent([logoImage], false, {
311311
hashtag: '#Nativescript'
312312
});
313-
const GenericTemplate = createShareMessengerGenericTemplateContent({
313+
const GenericTemplate = createShareMessageGenericTemplateContent({
314314
element: {
315315
title: 'Nativescript',
316316
subtitle: 'Create Native iOS and Android Apps With JavaScript',

demo-angular/app/pages/login/login.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class LoginComponent {
6363
}
6464

6565
generateLinksShareContent() {
66-
return Facebook.createLinksShareContent('https://www.nativescript.org',
66+
return Facebook.createShareLinksContent('https://www.nativescript.org',
6767
'Create Native iOS and Android Apps With JavaScript',
6868
{
6969
hashtag: '#Nativescript'
@@ -72,13 +72,13 @@ export class LoginComponent {
7272

7373
generatePhotosShareContent() {
7474
const logoImage = fromResource('logo');
75-
return Facebook.createPhotosShareContent([logoImage], false, {
75+
return Facebook.createSharePhotosContent([logoImage], false, {
7676
hashtag: '#Nativescript'
7777
});
7878
}
7979

8080
generateGenericTemplateContent() {
81-
return Facebook.createShareMessengerGenericTemplateContent({
81+
return Facebook.createShareMessageGenericTemplateContent({
8282
element: {
8383
title: 'Nativescript',
8484
subtitle: 'Create Native iOS and Android Apps With JavaScript',

demo/app/login-view-model.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import {
44
LoginEventData,
55
login as fbLogin,
66
getCurrentAccessToken,
7-
createLinksShareContent,
8-
createPhotosShareContent,
9-
createShareMessengerGenericTemplateContent,
7+
createShareLinksContent,
8+
createSharePhotosContent,
9+
createShareMessageGenericTemplateContent,
1010
MessageGenericTemplateImageAspectRatio,
1111
showShareDialog,
1212
showMessageDialog,
@@ -62,7 +62,7 @@ export class LoginViewModel extends Observable {
6262
}
6363

6464
public generateLinksShareContent() {
65-
return createLinksShareContent('https://www.nativescript.org',
65+
return createShareLinksContent('https://www.nativescript.org',
6666
'Create Native iOS and Android Apps With JavaScript',
6767
{
6868
hashtag: '#Nativescript'
@@ -71,13 +71,13 @@ export class LoginViewModel extends Observable {
7171

7272
public generatePhotosShareContent() {
7373
const logoImage = fromResource('logo');
74-
return createPhotosShareContent([logoImage], false, {
74+
return createSharePhotosContent([logoImage], false, {
7575
hashtag: '#Nativescript'
7676
});
7777
}
7878

7979
public generateGenericTemplateContent() {
80-
return createShareMessengerGenericTemplateContent({
80+
return createShareMessageGenericTemplateContent({
8181
element: {
8282
title: 'Nativescript',
8383
subtitle: 'Create Native iOS and Android Apps With JavaScript',

src/share-manager.android.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {ImageSource} from 'tns-core-modules/image-source';
44
import {android as androidApp} from 'tns-core-modules/application';
55
import {
66
MessageActionButton,
7-
MessageGenericTemplateElementContent,
7+
MessageGenericTemplateContent,
88
MessageGenericTemplateImageAspectRatio, MessageMediaTemplateContent, MessageMediaTemplateMediaType,
99
ShareAdditionContent
1010
} from './share-manager.common';
@@ -22,7 +22,7 @@ function attachAdditionalContent(content: any, addition?: ShareAdditionContent)
2222
}
2323

2424

25-
export function createLinksShareContent(link: string, quote?: string, addition?: ShareAdditionContent) {
25+
export function createShareLinksContent(link: string, quote?: string, addition?: ShareAdditionContent) {
2626
const content: com.facebook.share.model.ShareLinkContent.Builder = new com.facebook.share.model.ShareLinkContent
2727
.Builder()
2828
.setContentUrl(android.net.Uri.parse(link));
@@ -34,7 +34,7 @@ export function createLinksShareContent(link: string, quote?: string, addition?:
3434
return content.build();
3535
}
3636

37-
export function createPhotosShareContent(images: ImageSource[] | string[], userGenerated: boolean, addition?: ShareAdditionContent) {
37+
export function createSharePhotosContent(images: ImageSource[] | string[], userGenerated: boolean, addition?: ShareAdditionContent) {
3838
let nativeImages;
3939
if (typeof images[0] === 'string') {
4040
nativeImages = (images as string[]).map(each => {
@@ -86,7 +86,7 @@ function createMessageActionButton(config?: MessageActionButton) {
8686
return null;
8787
}
8888

89-
export function createShareMessengerGenericTemplateContent(contentConfig: MessageGenericTemplateElementContent) {
89+
export function createShareMessageGenericTemplateContent(contentConfig: MessageGenericTemplateContent) {
9090
const elementConfig = contentConfig.element;
9191
const elementBuilder = new com.facebook.share.model.ShareMessengerGenericTemplateElement
9292
.Builder()

src/share-manager.common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface MessageGenericTemplateElement {
1515
defaultAction?: MessageActionButton;
1616
}
1717

18-
export interface MessageGenericTemplateElementContent {
18+
export interface MessageGenericTemplateContent {
1919
element: MessageGenericTemplateElement;
2020
imageAspectRatio?: MessageGenericTemplateImageAspectRatio;
2121
pageID?: string;

src/share-manager.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {ImageSource} from 'tns-core-modules/image-source';
1+
import { ImageSource } from 'tns-core-modules/image-source';
22
import {
3-
MessageGenericTemplateElementContent,
3+
MessageGenericTemplateContent,
44
MessageMediaTemplateContent,
55
ShareAdditionContent
66
} from './share-manager.common';
@@ -23,7 +23,7 @@ export declare enum MessageMediaTemplateMediaType {
2323
* @param {string} quote You can enable people to highlight text to appear as a quote with a shared link. Alternatively, you can predefine a quote, for example, a pull quote in an article, to appear with the shared link. In either case, the quote appears in its own field separate from the user comments.
2424
* @param {ShareAdditionContent} addition When you use the Facebook share dialog, you have additional options that aren't available when you share by using the API.
2525
*/
26-
export declare function createLinksShareContent(link: string, quote?: string, addition?: ShareAdditionContent): any;
26+
export declare function createShareLinksContent(link: string, quote?: string, addition?: ShareAdditionContent): any;
2727

2828
/**
2929
* People can share photos from your app to Facebook with the Share Dialog or with a custom interface.
@@ -32,14 +32,14 @@ export declare function createLinksShareContent(link: string, quote?: string, ad
3232
* @param {ImageSource[] | string[]} images : ImageSources or image urls of the photo to be shared
3333
* @param {ShareAdditionContent} addition When you use the Facebook share dialog, you have additional options that aren't available when you share by using the API.
3434
*/
35-
export declare function createPhotosShareContent(images: ImageSource[] | string[], userGenerated: boolean, addition?: ShareAdditionContent): any;
35+
export declare function createSharePhotosContent(images: ImageSource[] | string[], userGenerated: boolean, addition?: ShareAdditionContent): any;
3636

3737
/**
3838
* The generic template is a simple structured message that includes a title, subtitle, image, a button. You may also specify a default_action object that sets a URL that will be opened in the Messenger webview when the template is tapped.
3939
* see https://developers.facebook.com/docs/messenger-platform/send-messages/template/generic for more.
40-
* @param {MessageGenericTemplateElementContent} contentConfig : config of the structure
40+
* @param {MessageGenericTemplateContent} contentConfig : config of the structure
4141
*/
42-
export declare function createShareMessengerGenericTemplateContent(contentConfig: MessageGenericTemplateElementContent): any;
42+
export declare function createShareMessageGenericTemplateContent(contentConfig: MessageGenericTemplateContent): any;
4343

4444
/**
4545
* The media template allows you to send images, GIFs, and video as a structured message with an optional button. Videos and animated GIFs sent with the media template are playable in the conversation.

src/share-manager.ios.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export * from './share-manager.common';
33
import {ImageSource} from 'tns-core-modules/image-source';
44
import {
55
MessageActionButton,
6-
MessageGenericTemplateElementContent,
6+
MessageGenericTemplateContent,
77
MessageGenericTemplateImageAspectRatio,
88
MessageMediaTemplateContent,
99
MessageMediaTemplateMediaType,
@@ -25,7 +25,7 @@ function attachAdditionalContent(content: any, addition?: ShareAdditionContent)
2525
}
2626

2727

28-
export function createLinksShareContent(link: string, quote?: string, addition?: ShareAdditionContent) {
28+
export function createShareLinksContent(link: string, quote?: string, addition?: ShareAdditionContent) {
2929
const content: FBSDKShareLinkContent = FBSDKShareLinkContent.new();
3030
content.contentURL = NSURL.URLWithString(link);
3131
if (quote) {
@@ -36,7 +36,7 @@ export function createLinksShareContent(link: string, quote?: string, addition?:
3636
return content;
3737
}
3838

39-
export function createPhotosShareContent(images: ImageSource[] | string[], userGenerated: boolean, addition?: ShareAdditionContent) {
39+
export function createSharePhotosContent(images: ImageSource[] | string[], userGenerated: boolean, addition?: ShareAdditionContent) {
4040
let nativeImages;
4141
if (typeof images[0] === 'string') {
4242
nativeImages = (images as string[]).map(each => {
@@ -64,7 +64,7 @@ function createMessageActionButton(config?: MessageActionButton) {
6464
return null;
6565
}
6666

67-
export function createShareMessengerGenericTemplateContent(contentConfig: MessageGenericTemplateElementContent) {
67+
export function createShareMessageGenericTemplateContent(contentConfig: MessageGenericTemplateContent) {
6868
const elementConfig = contentConfig.element;
6969
const element: FBSDKShareMessengerGenericTemplateElement = FBSDKShareMessengerGenericTemplateElement.new();
7070
element.title = elementConfig.title;

0 commit comments

Comments
 (0)