Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 15239ef

Browse files
merge: tenor
2 parents a4eb52a + f5c7b78 commit 15239ef

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
lines changed

studio/src/app/modals/editor/app-gif/app-gif.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ export class AppGif {
5555

5656
private addSlide(gif: TenorGif): Promise<void> {
5757
return new Promise<void>(async (resolve) => {
58-
const url: string = gif.media[0].gif.url;
58+
await this.gifService.registerShare(gif.id);
5959

60+
const url: string = gif.media[0].gif.url;
6061
const slide: any = await EditorUtils.createSlideGif(url);
62+
6163
await (this.el.closest('ion-modal') as HTMLIonModalElement).dismiss(slide);
6264

6365
resolve();

studio/src/app/pages/editor/app-editor/app-editor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ export class AppEditor {
504504
</ion-button>
505505

506506
<ion-button onClick={() => this.openSlideNavigate()} color="primary">
507-
<ion-icon slot="icon-only" ios="ios-list" md="ios-list"></ion-icon>
507+
<ion-icon slot="icon-only" ios="ios-bookmarks" md="ios-bookmarks"></ion-icon>
508508
</ion-button>
509509

510510
<ion-button onClick={() => this.toggleFullScreen()} color="primary">

studio/src/app/services/gif/gif.service.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class GifService {
2929

3030
const anonymousId: string = await this.getAnonymousId();
3131

32-
const searchUrl = config.url + 'categories?key=' + config.key + '&anon_id=' + anonymousId + '&media_filter=minimal';
32+
const searchUrl: string = config.url + 'categories?key=' + config.key + '&anon_id=' + anonymousId + '&media_filter=minimal';
3333

3434
try {
3535
const rawResponse: Response = await fetch(searchUrl);
@@ -55,7 +55,7 @@ export class GifService {
5555

5656
const anonymousId: string = await this.getAnonymousId();
5757

58-
const searchUrl = config.url + 'search?tag=' + searchTerm + '&key=' +
58+
const searchUrl: string = config.url + 'search?tag=' + searchTerm + '&key=' +
5959
config.key + '&ar_range=wide&limit=' + 16 + '&anon_id=' + anonymousId + '&media_filter=minimal&pos=' + next;
6060

6161
try {
@@ -77,6 +77,26 @@ export class GifService {
7777
});
7878
}
7979

80+
registerShare(gifId: string): Promise<void> {
81+
return new Promise<void>(async (resolve) => {
82+
const config: EnvironmentTenorConfig = EnvironmentConfigService.getInstance().get('tenor');
83+
84+
// It isn't mandatory to provide the anonymous ID therefore, as we rather not like to track even if anonymous, we don't provide it
85+
86+
const shareUrl: string = config.url + 'registershare?key=' + config.key + '&id=' + gifId;
87+
88+
try {
89+
await fetch(shareUrl);
90+
91+
// We don't check the status of the answer, user could still use the Gifs even if that would have failed
92+
resolve();
93+
} catch (err) {
94+
// We ignore the error, user could still use the Gifs
95+
resolve();
96+
}
97+
});
98+
}
99+
80100
private getAnonymousId(): Promise<string> {
81101
return new Promise<string>(async (resolve, reject) => {
82102
const localAnonymousId: string = await get('tenor_anonid');

studio/src/app/utils/tenor.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,7 @@ interface TenorCategoryResponse {
5555
interface TenorAnonymousResponse {
5656
anon_id: string;
5757
}
58+
59+
interface TenorRegisterShareResponse {
60+
status: string;
61+
}

studio/src/components.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import '@stencil/core';
99

1010
import '@ionic/core';
11+
import 'ionicons';
1112
import 'deckdeckgo';
1213
import 'deckdeckgo-inline-editor';
13-
import 'ionicons';
1414
import {
1515
EventEmitter,
1616
} from '@stencil/core';

0 commit comments

Comments
 (0)