-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #392 from Telegram-Mini-Apps/feature/v7-7
Add Mini Apps v7.7 features
- Loading branch information
Showing
27 changed files
with
352 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@telegram-apps/sdk-react": minor | ||
"@telegram-apps/sdk-solid": minor | ||
"@telegram-apps/sdk": minor | ||
--- | ||
|
||
Add the `SwipeBehavior` component, related hooks and HOCs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
apps/docs/packages/telegram-apps-sdk/components/swipe-behavior.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# `SwipeBehavior` | ||
|
||
Implements Telegram Mini Apps swipe behavior functionality. | ||
|
||
## Initialization | ||
|
||
To initialize the component, use the `initSwipeBehavior` function: | ||
|
||
```typescript | ||
import { initSwipeBehavior } from '@telegram-apps/sdk'; | ||
|
||
const [swipeBehavior] = initSwipeBehavior(); | ||
``` | ||
|
||
## Vertical Swipe | ||
|
||
By default, users are allowed to hide the application just by swiping the application down. | ||
To prevent a possible closure, you can disable this behavior by calling the `disableVerticalSwipe()` method, or enable via the `enableVerticalSwipe()` method. In turn, | ||
both of these methods update the `isVerticalSwipeEnabled` property: | ||
|
||
```typescript | ||
swipeBehaviour.enableVerticalSwipe(); | ||
console.log(swipeBehaviour.isVerticalSwipeEnabled); // true | ||
|
||
swipeBehaviour.disableVerticalSwipe(); | ||
console.log(swipeBehaviour.isVerticalSwipeEnabled); // false | ||
``` | ||
|
||
## Events | ||
|
||
List of events, which could be [tracked](../components#events): | ||
|
||
| Event | Listener | Triggered when | | ||
|---------------------------------|----------------------------|-------------------------------------------| | ||
| `change` | `() => void` | Something in component changed | | ||
| `change:isVerticalSwipeEnabled` | `(value: boolean) => void` | `isVerticalSwipeEnabled` property changed | | ||
|
||
## Methods Support | ||
|
||
List of methods, which could be used in [support checks](../components#methods-support): | ||
`disableVerticalSwipe`, `enableVerticalSwipe`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { initSwipeBehavior } from '@telegram-apps/sdk'; | ||
|
||
import { createHOCs } from '../createHOCs.js'; | ||
import { createHooks } from '../createHooks.js'; | ||
|
||
export const [useSwipeBehaviorRaw, useSwipeBehavior] = createHooks(initSwipeBehavior); | ||
|
||
export const [withSwipeBehaviorRaw, withSwipeBehavior] = createHOCs( | ||
useSwipeBehaviorRaw, | ||
useSwipeBehavior, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { initSwipeBehavior } from '@telegram-apps/sdk'; | ||
|
||
import { createHOC } from '../createHOC.js'; | ||
import { createHook } from '../createHook.js'; | ||
|
||
/** | ||
* Hook to receive the SwipeBehavior component instance. | ||
*/ | ||
export const useSwipeBehavior = createHook(initSwipeBehavior); | ||
|
||
/** | ||
* HOC to pass the SwipeBehavior component instance to the wrapped component. | ||
*/ | ||
export const withSwipeBehavior = createHOC(useSwipeBehavior); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/sdk/src/components/BiometryManager/initBiometryManager.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.