Phecda

feat: add RNQuickAction

@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 #import <React/RCTBundleURLProvider.h> 11 #import <React/RCTBundleURLProvider.h>
12 #import <React/RCTLinkingManager.h> 12 #import <React/RCTLinkingManager.h>
13 #import <React/RCTRootView.h> 13 #import <React/RCTRootView.h>
  14 +#import "RNQuickActionManager.h"
14 15
15 #if DEBUG 16 #if DEBUG
16 #import <FlipperKit/FlipperClient.h> 17 #import <FlipperKit/FlipperClient.h>
@@ -58,6 +59,10 @@ static void InitializeFlipper(UIApplication *application) { @@ -58,6 +59,10 @@ static void InitializeFlipper(UIApplication *application) {
58 return YES; 59 return YES;
59 } 60 }
60 61
  62 +- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL succeeded)) completionHandler {
  63 + [RNQuickActionManager onQuickActionPress:shortcutItem completionHandler:completionHandler];
  64 +}
  65 +
61 - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 66 - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
62 { 67 {
63 #if DEBUG 68 #if DEBUG
@@ -337,6 +337,8 @@ PODS: @@ -337,6 +337,8 @@ PODS:
337 - React 337 - React
338 - RNPermissions (2.1.2): 338 - RNPermissions (2.1.2):
339 - React 339 - React
  340 + - RNQuickAction (0.3.13):
  341 + - React
340 - RNReanimated (1.7.1): 342 - RNReanimated (1.7.1):
341 - React 343 - React
342 - RNScreens (2.4.0): 344 - RNScreens (2.4.0):
@@ -399,6 +401,7 @@ DEPENDENCIES: @@ -399,6 +401,7 @@ DEPENDENCIES:
399 - RNImageCropPicker (from `../node_modules/react-native-image-crop-picker`) 401 - RNImageCropPicker (from `../node_modules/react-native-image-crop-picker`)
400 - RNLocalize (from `../node_modules/react-native-localize`) 402 - RNLocalize (from `../node_modules/react-native-localize`)
401 - RNPermissions (from `../node_modules/react-native-permissions`) 403 - RNPermissions (from `../node_modules/react-native-permissions`)
  404 + - RNQuickAction (from `../node_modules/react-native-quick-actions`)
402 - RNReanimated (from `../node_modules/react-native-reanimated`) 405 - RNReanimated (from `../node_modules/react-native-reanimated`)
403 - RNScreens (from `../node_modules/react-native-screens`) 406 - RNScreens (from `../node_modules/react-native-screens`)
404 - RNSVG (from `../node_modules/react-native-svg`) 407 - RNSVG (from `../node_modules/react-native-svg`)
@@ -502,6 +505,8 @@ EXTERNAL SOURCES: @@ -502,6 +505,8 @@ EXTERNAL SOURCES:
502 :path: "../node_modules/react-native-localize" 505 :path: "../node_modules/react-native-localize"
503 RNPermissions: 506 RNPermissions:
504 :path: "../node_modules/react-native-permissions" 507 :path: "../node_modules/react-native-permissions"
  508 + RNQuickAction:
  509 + :path: "../node_modules/react-native-quick-actions"
505 RNReanimated: 510 RNReanimated:
506 :path: "../node_modules/react-native-reanimated" 511 :path: "../node_modules/react-native-reanimated"
507 RNScreens: 512 RNScreens:
@@ -565,6 +570,7 @@ SPEC CHECKSUMS: @@ -565,6 +570,7 @@ SPEC CHECKSUMS:
565 RNImageCropPicker: cf129d17e042ce3e96fb9ada967c28f21f977c82 570 RNImageCropPicker: cf129d17e042ce3e96fb9ada967c28f21f977c82
566 RNLocalize: b6df30cc25ae736d37874f9bce13351db2f56796 571 RNLocalize: b6df30cc25ae736d37874f9bce13351db2f56796
567 RNPermissions: a96580116f7894146552e92b000ac30bf1661947 572 RNPermissions: a96580116f7894146552e92b000ac30bf1661947
  573 + RNQuickAction: 6d404a869dc872cde841ad3147416a670d13fa93
568 RNReanimated: 4e102df74a9674fa943e05f97f3362b6e44d0b48 574 RNReanimated: 4e102df74a9674fa943e05f97f3362b6e44d0b48
569 RNScreens: b5c0e1b2b04512919e78bd3898e144a157ce2363 575 RNScreens: b5c0e1b2b04512919e78bd3898e144a157ce2363
570 RNSVG: ce9d996113475209013317e48b05c21ee988d42e 576 RNSVG: ce9d996113475209013317e48b05c21ee988d42e
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
35 "react-native-localize": "^1.4.0", 35 "react-native-localize": "^1.4.0",
36 "react-native-permissions": "^2.1.2", 36 "react-native-permissions": "^2.1.2",
37 "react-native-progress": "^4.1.2", 37 "react-native-progress": "^4.1.2",
  38 + "react-native-quick-actions": "https://github.com/Phecda/react-native-quick-actions#master",
38 "react-native-reanimated": "^1.7.1", 39 "react-native-reanimated": "^1.7.1",
39 "react-native-safe-area-context": "^0.7.3", 40 "react-native-safe-area-context": "^0.7.3",
40 "react-native-screens": "^2.4.0", 41 "react-native-screens": "^2.4.0",
@@ -41,6 +41,12 @@ const Library = ({ navigation }: MainTabScreenProps<'Library'>) => { @@ -41,6 +41,12 @@ const Library = ({ navigation }: MainTabScreenProps<'Library'>) => {
41 onPress={() => navigation.navigate('RNCode')} 41 onPress={() => navigation.navigate('RNCode')}
42 chevron 42 chevron
43 /> 43 />
  44 + <Divider />
  45 + <ListItem
  46 + title={'Shortcut'}
  47 + onPress={() => navigation.navigate('ShortcutItem')}
  48 + chevron
  49 + />
44 </BGScroll> 50 </BGScroll>
45 ); 51 );
46 }; 52 };
  1 +import React from 'react';
  2 +import { BGScroll, Card, ListItem } from '../component/View';
  3 +import {
  4 + clearShortcutItems,
  5 + ShortcutItem,
  6 + setShortcutItems,
  7 +} from 'react-native-quick-actions';
  8 +import { NativeModules, Alert } from 'react-native';
  9 +
  10 +const items: ShortcutItem[] = [
  11 + {
  12 + type: 'Library',
  13 + title: 'Shortcut',
  14 + subtitle: 'Show shortcut page',
  15 + userInfo: { url: 'ngplay://open.my.app/ShortcutItem?id=trigger' },
  16 + icon: 'Compose',
  17 + },
  18 +];
  19 +
  20 +const ShortcutPage = () => {
  21 + return (
  22 + <BGScroll>
  23 + <Card round>
  24 + <ListItem title="set" onPress={() => setShortcutItems(items)} />
  25 + <ListItem title="clear" onPress={clearShortcutItems} />
  26 + <ListItem
  27 + title="post"
  28 + onPress={() => {
  29 + NativeModules.RNQuickActionManager.postLaunchOptions();
  30 + }}
  31 + />
  32 + <ListItem
  33 + title="initial"
  34 + onPress={() => {
  35 + Alert.alert(
  36 + '',
  37 + JSON.stringify(NativeModules.RNQuickActionManager.initialAction)
  38 + );
  39 + }}
  40 + />
  41 + </Card>
  42 + </BGScroll>
  43 + );
  44 +};
  45 +
  46 +export default ShortcutPage;
@@ -7098,6 +7098,10 @@ react-native-progress@^4.1.2: @@ -7098,6 +7098,10 @@ react-native-progress@^4.1.2:
7098 "@react-native-community/art" "^1.1.2" 7098 "@react-native-community/art" "^1.1.2"
7099 prop-types "^15.7.2" 7099 prop-types "^15.7.2"
7100 7100
  7101 +"react-native-quick-actions@https://github.com/Phecda/react-native-quick-actions#master":
  7102 + version "0.3.13"
  7103 + resolved "https://github.com/Phecda/react-native-quick-actions#63d7680ed97e23c99889fb8573bcc8c0693e8e42"
  7104 +
7101 react-native-ratings@^6.3.0: 7105 react-native-ratings@^6.3.0:
7102 version "6.5.0" 7106 version "6.5.0"
7103 resolved "https://registry.npm.taobao.org/react-native-ratings/download/react-native-ratings-6.5.0.tgz#a1606ccba3c5b54eec8e6cfa4765a45cf0e4ab8d" 7107 resolved "https://registry.npm.taobao.org/react-native-ratings/download/react-native-ratings-6.5.0.tgz#a1606ccba3c5b54eec8e6cfa4765a45cf0e4ab8d"