Coder Social home page Coder Social logo

gustash / react-native-siri-shortcut Goto Github PK

View Code? Open in Web Editor NEW
300.0 5.0 47.0 2.26 MB

A React Native package for using iOS 12+ Siri Shortcuts.

Home Page: https://gustash.github.io/react-native-siri-shortcut/

License: MIT License

JavaScript 15.67% Java 23.35% Objective-C 35.84% Ruby 4.29% Starlark 0.62% Makefile 1.58% C++ 7.20% Objective-C++ 1.56% Swift 2.46% TypeScript 7.43%
ios react react-native siri siri-shortcuts

react-native-siri-shortcut's Introduction

React Native Siri Shortcut

This module lets you use Siri Shortcuts inside your React Native app.

Read the Docs

Example project

Feel free to clone this repo and run the example/ project.

Run npm install or yarn install in the example/ directory.

Run pod install in the example/ios/ directory.

Build the app in XCode.

Mentions

Siri icon by Icons8

react-native-siri-shortcut's People

Contributors

danvass avatar dependabot[bot] avatar dvassilev avatar eughene-cherepov avatar gavrichards avatar gustash avatar hakansaglam29 avatar jackca avatar jdmunro avatar mars-lan avatar timmywil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-native-siri-shortcut's Issues

Delete siri shortcut right after add it through AddSiriButton cause presentShortcut modal can't show properly

Description

Delete siri shortcut right after add it through AddSiriButton cause presentShortcut modal can't show properly

Version

React Native: 0.59.10
react-native-siri-shortcut: 1.6.4
ios: 13.1 or above (as far as i tested on real devices)

Steps To Reproduce

  1. Using AddSiriButton to emit onPress to tigger presentShortcut method
  2. Swipe App to background
  3. Delete the shortcut just created
  4. Back to App and press AddSiriButton to tigger presentShortcut method again

Error Behavior And Expected Result

  • Error Behavior
    Siri Shortcut error
  • Expected Behavior
    sirir Shortcut expected behavior

License?

I noticed the package.json says this project is under the Apache 2. But, there is no license file in the repository. Could you please add a license so this project can be used as open source.

Add to Siri UI Button

Library should include a component for adding to Siri from the app and not needing to go via the Settings app. The following Swift generates the UI:

‘’’
let addShortcutButton = INUIAddVoiceShortcutButton(style: .whiteOutline)
addShortcutButton.shortcut = INShortcut(intent: order.intent)
addShortcutButton.delegate = self
‘’’

I’ll take a look at incorporating this too at some stage.

Siri shortcut requires phone to be unlocked for triggering app

When I say a trigger word via Siri and the phone is locked, it says that the phone needs to be unlocked in order to continue. I think there is a setting that allows Siri commands to be triggered without the phone being unlocked. I know this because I have an app that allows shortcuts and I can trigger those shortcuts without having the phone unlocked.

What I am playing on doing is having Siri play a podcast without having to go into my podcast app

Is there an existing setting to enable this in the current library or any guidance to achieve this? Thank you.

presentShortcut main thread warning

During the very first execution in devices, function presentShortcut of RNSiriShortcuts.swift gives a runtime warning that modalPresentationStyle could only be used inside the main thread. This causes the Modal presentation being stuck, sometimes for more than 15 seconds, looking like for the average user that the app crashed. I tweaked a bit the function and now is fixed with the if else statement inside the scope of DispatchQueue.main.async:

    @available(iOS 12.0, *)
    @objc func presentShortcut(_ jsonOptions: Dictionary<String, Any>, callback: @escaping RCTResponseSenderBlock) {
        presentShortcutCallback = callback
        let activity = ShortcutsModule.generateUserActivity(jsonOptions)
        
        let shortcut = INShortcut(userActivity: activity)
        
        // To preserve compatilibility with iOS >9.0, the array contains NSObjects, so we need to convert here
        let addedVoiceShortcut = (voiceShortcuts as! Array<INVoiceShortcut>).first { (voiceShortcut) -> Bool in
            if let userActivity = voiceShortcut.shortcut.userActivity, userActivity.activityType == activity.activityType {
                return true
            }
            return false
        }

        DispatchQueue.main.async {
            // The shortcut was not added yet, so present a form to add it
            if (addedVoiceShortcut == nil) {
                self.presenterViewController = INUIAddVoiceShortcutViewController(shortcut: shortcut)
                self.presenterViewController!.modalPresentationStyle = .formSheet
                (self.presenterViewController as! INUIAddVoiceShortcutViewController).delegate = self
            } // The shortcut was already added, so we present a form to edit it
            else {
                self.presenterViewController = INUIEditVoiceShortcutViewController(voiceShortcut: addedVoiceShortcut!)
                self.presenterViewController!.modalPresentationStyle = .formSheet
                (self.presenterViewController as! INUIEditVoiceShortcutViewController).delegate = self
            }

            UIApplication.shared.keyWindow!.rootViewController!.present(self.presenterViewController!, animated: true, completion: nil)
        }
    }

Could it be fixed in the next release? I tested this fix with an iPhone 6s and an iPhone 11 Pro Max.
Thanks for the amazing job with the lib @Gustash .

`getShortcuts` returns empty

like to remove shortcuts that are outdated or no longer relevant, making a call to getShortcuts returns empty after just setting a short right above

any reason why getShortcuts returns empty after donateShortcut is called?

clearAllShortcuts Method not working

async clearShortcuts() {
clearAllShortcuts()
.then(res => {
console.log("deleted", res);
})
.catch(e => {
console.log("Cant clear on <iOS 12", e);
});
}
but its not woking for me plz help .

Migrate to Objective C

To ditch the react-native-swift dependancy we could migrate the code to objective C, make the library a little slimmer.

SiriShortcutsEvent does not called

I'm testing siri shortcut features following README instructions.

donate shortcut and present shortcut work like a charm.
However, when I came in the app through the shortcut, SiriShortcutsEvent was never called.
Also, suggestShortcuts does not work either. I couldn't find shortcut when I only used suggestShortcuts.

What did I wrong?

This is my full code.

import React, {useState, Component} from 'react';
import {
  SafeAreaView,
  View,
  Button,
  StyleSheet,
  Text,
} from 'react-native';
import {
  SiriShortcutsEvent,
  donateShortcut,
  suggestShortcuts,
  clearAllShortcuts,
  clearShortcutsWithIdentifiers,
  getShortcuts,
  presentShortcut,
} from 'react-native-siri-shortcut';
import AddToSiriButton, {
  SiriButtonStyles,
} from 'react-native-siri-shortcut/AddToSiriButton';

const opts = {
  activityType: 'com.alt.reactnativetdd.test', // This activity type needs to be set in `NSUserActivityTypes` on the Info.plist
  title: 'Say Hi',
  userInfo: {
    foo: 1,
    bar: 'baz',
  },
  keywords: ['kek', 'foo', 'bar'],
  persistentIdentifier: 'yourPersistentIdentifier',
  isEligibleForSearch: true,
  isEligibleForPrediction: true,
  suggestedInvocationPhrase: 'Say something',
  needsSave: true,
};

class App extends Component {
  state = {
    shortcuts: [],
  };
  componentDidMount() {
    SiriShortcutsEvent.addListener(
      'SiriShortcutListener',
      ({userInfo, activityType}) => {
        // Do something with the userInfo and/or activityType
        console.log('userInfo', userInfo);
        console.log('activityType', activityType);
      },
    );

    suggestShortcuts([opts]);
    this.updateShortcutList();
  }

  async updateShortcutList() {
    try {
      const shortcuts = await getShortcuts();

      this.setState({
        shortcuts,
      });
    } catch (e) {
      alert("You're not running iOS 12!");
    }
  }

  render() {
    const {shortcuts} = this.state;
    return (
      <SafeAreaView style={styles.container}>
        <Button
          title="Present Shortcut"
          onPress={() => {
            presentShortcut(opts, ({status}) => {
              console.log('status', status);
            });
          }}
        />
        <Button title="Donate Shortcut" onPress={() => donateShortcut(opts)} />
        <Button
          title="Clear Shortcuts With Identifiers"
          onPress={async () => {
            try {
              await clearShortcutsWithIdentifiers([
                'com.alt.reactnativetdd.test',
                'some.identifier',
                'another.identifier',
                ,
              ]);
              // Shortcuts cleared
            } catch (e) {
              // Can't clear shortcuts on <iOS 12 because they don't exist
            }
          }}
        />
        <Button
          title="Clear All Shortcuts"
          onPress={async () => {
            try {
              await clearAllShortcuts();
              // Shortcuts were successfully cleared
            } catch (e) {
              // Can't clear shortcuts on <iOS 12 because they don't exist
            }
          }}
        />
        <AddToSiriButton
          style={{flex: 1}}
          buttonStyle={SiriButtonStyles.whiteOutline}
          onPress={() => {
            console.log('You clicked me');
          }}
        />
        {shortcuts.length ? (
          shortcuts.map(({identifier, phrase, options}, i) => (
            <View key={identifier}>
              <Text>Shortcut {i + 1}:</Text>
              <Text>Identifier - {identifier}</Text>
              <Text>Phrase - {phrase}</Text>
              <Text>Options - {JSON.stringify(options)}</Text>
            </View>
          ))
        ) : (
          <Text>No Shortcuts yet</Text>
        )}
      </SafeAreaView>
    );
  }
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#F5FCFF',
  },
  contentContainer: {
    justifyContent: 'center',
    alignItems: 'center',
  },
});

export default App;

Expo Integration

Hey guys I would like to know if it is possible to integrate with the Expo?

Using a single activity type for multiple shortcuts

Hello, I'm not sure if what I'm trying to do is correct and it is a bug, or whether I haven't understood the relationship between shortcuts and activity types.

Is it possible to have a single activity type, and to create multiple shortcuts that use the type but with different userInfo data? For example, to generate the options from a function when a user wants to create the shortcut:

const createShortcutOptions = ({ pageName, pageId, pageType }) => ({
  activityType: 'com.me.openPage',
  title: 'Open a page',
  persistentIdentifier: `com.me.openPage.${pageType}.${pageId}`,
  suggestedInvocationPhrase: "Let's open a page!",
  isEligibleForSearch: true,
  isEligibleForPrediction: true,
  needsSave: true,
  userInfo: {
    pageName,
    pageId,
    pageType,
  },
});

And then to have multiple buttons that use that function to register shortcuts:

<>
<AddToSiriButton
  buttonStyle={SiriButtonStyles.whiteOutline}
  onPress={() => {
    presentShortcut(
      createShortcutOptions({ pageName: 'A', pageId: 'page.A', pageType: 'foo' }),
      result => {
        console.log(`Siri shortcut for page A: ${result.status}`);
      },
    );
  }}
/>
<AddToSiriButton
  buttonStyle={SiriButtonStyles.whiteOutline}
  onPress={() => {
    presentShortcut(
      createShortcutOptions({ pageName: 'B', pageId: 'page.B', pageType: 'bar' }),
      result => {
        console.log(`Siri shortcut for page B: ${result.status}`);
      },
    );
  }}
/>
</>

When I do this, if I create a shortcut for Page A, and then attempt to add one for Page B, it seems to think I'm editing the existing shortcut rather than adding a new one.

My understanding was that using unique persistentIdentifier would mean it created a unique shortcut, but this doesn't appear to be the case. How would I achieve this, or is this a bug?

Thanks!

Background Support

Currently in order to execute a shortcut the app needs to open to the foreground. This removes the possibility to create shortcuts that can run, for example, from the lock screen.

I'm wondering if there is a way currently to allow shortcuts to run in the background? Or if not, what is required in order for this to happen?

P.s, Kudos for the great work so far!

Use of undeclared identifier 'ShortcutsModule'

Use of undeclared identifier 'ShortcutsModule'
This error is preventing the project from building. I am following the use_frameworks! approach on a fresh project. The only other RN dependency in the project is react-native-webview. This is NOT an expo project.

Here is my AppDelegate.m

#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>

// react-native-siri-shortcut
@import RNSiriShortcuts;

static void InitializeFlipper(UIApplication *application) {
  FlipperClient *client = [FlipperClient sharedClient];
  SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
  [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
  [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
  [client addPlugin:[FlipperKitReactPlugin new]];
  [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
  [client start];
}
#endif

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifdef FB_SONARKIT_ENABLED
  InitializeFlipper(application);
#endif

  // react-native-siri-shortcut
  // Check if the app launched with any shortcuts
  BOOL launchedFromShortcut = [launchOptions objectForKey:@"UIApplicationLaunchOptionsUserActivityDictionaryKey"] != nil;
  // Add a boolean to the initialProperties to let the app know you got the initial shortcut
  NSDictionary *initialProperties = @{ @"launchedFromShortcut":@(launchedFromShortcut) };
  
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"MyProject"
                                            initialProperties:initialProperties]; // react-native-siri-shortcut (was nil)

  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

// react-native-siri-shortcut
// This method checks for shortcuts issued to the app
- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
 restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *restorableObjects))restorationHandler
{
  UIViewController *viewController = [self.window rootViewController];
  RCTRootView *rootView = (RCTRootView*) [viewController view];

  // If the initial properties say the app launched from a shortcut (see above), tell the library about it.
  if ([[rootView.appProperties objectForKey:@"launchedFromShortcut"] boolValue]) {
    ShortcutsModule.initialUserActivity = userActivity;

    rootView.appProperties = @{ @"launchedFromShortcut":@NO };
  }

  [ShortcutsModule onShortcutReceivedWithUserActivity:userActivity];

  return YES;
}

@end

here is my podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'MyProject' do
  use_frameworks!
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  target 'MyProjectTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  # use_flipper!
  # post_install do |installer|
  #   flipper_post_install(installer)
  # end
end

target 'MyProject-tvOS' do
  # Pods for MyProject-tvOS

  target 'MyProject-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

Unable to add and use this library with vanilla react-native project.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"17.0.1" from the root project
npm ERR! peer react@"^16.8.0 || ^17.0.0" from [email protected]
npm ERR! node_modules/use-subscription
npm ERR! use-subscription@"^1.0.0" from [email protected]
npm ERR! node_modules/react-native
npm ERR! react-native@"0.64.0" from the root project
npm ERR! 1 more (@react-native-community/cli)
npm ERR! 2 more (react-native, react-test-renderer)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.6" from [email protected]
npm ERR! node_modules/react-native-siri-shortcut
npm ERR! react-native-siri-shortcut@"^2.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Having trouble natively installing the library in the first place

Possible n00b question here, but I've followed the install instructions (yarn install lib + react-native-swift, react-native link, AppDelegate.m changes, Siri capabilities and then added an activityType to info.plist).

Now when I try and build I'm getting 35 build errors relating to RNSiriShortcuts. Screenshot below, but generally it's errors like Use of undeclared type 'INUIAddVoiceShortcutButtonStyle', Use of undeclared type 'INUIAddVoiceShortcutButton' - lots of missing types/references.

I've tried all the usual tricks (cleaning, re-building, manually linking etc.). Any idea from the errors what I could be missing?

Thanks
Screen Shot 2019-03-27 at 18 50 44

Does this support dual sided communication with Siri?

Suppose i want to create something that does this.
I register "create a data model" as a shortcut with Siri (already works).

User: "Hey siri, create a data model"
Siri: "Sure, select a model type"
User: "Model ABC"
=> Here Siri sends "Model ABC" to my app and i use some API to check on my server if that Model exists or if the user is allowed to choose that option and pass result back to Siri.
Siri: (if the app sends true response) : "Model added!" and opens the app.
Siri: (if the app sends false response) : "Sorry, that model doesn't exist Please select another!"

Something like this?

Not building on React Native 0.60.4

I saw there was a commit bumping this to RN 0.60.4 but I just can't get it to build. It seems it's not able to recognize the Swift code since I get this error:
'RNSiriShortcuts/RNSiriShortcuts-Swift.h' file not found

It does however manage to find RNSiriShortcuts-Bridging-Header.h, so the project is there alright.

I've tried everything in the instructions - including the linking part - even though I'm guessing it shouldn't be required for RN 0.60.4.

Any help would be appreciated :)

Can you adapt React- Native 0.59?

I tried to integrate Siri into the project, but there was no progress for two days. I think the problem is that it has not been adapted to version 0.59. I hope it can be improved

Slow app startup caused by INVoiceShortcutCenter.shared.getAllVoiceShortcuts

Recently I noticed that my app has been slow to startup. After removing every dependency I was able to narrow it down to a problem in react-native-siri-shortcut.

The problem is that on initializing the native module we call INVoiceShortcutCenter.shared.getAllVoiceShortcuts from syncVoiceShortcuts: https://github.com/Gustash/react-native-siri-shortcut/blob/master/ios/RNSiriShortcuts.swift#L315

The problem is that this call seems to take 1-2 seconds and it blocks the rest of my native modules from initializing. This causes the app loading to stall for the same duration. If I comment out this call, the delay in app launch is gone.

This is with iOS 14 and Xcode 12.0.1

Is it possible we could load this on demand, and therefore not block the app on launch?

Siri shortcuts invoke app when called.

Hello
Existing Functionality: I can create a shortcut and when that particular shortcut is called the app gets invoked and calls the function.
Expected Functionality: I can create a shortcut and when that particular shortcut is called the function get called directly without invoking the app in foreground.

Listener method not working in react 0.66.4

I have created a blank react native project to test this package. I am able to add shortcuts via the presentShortcut() method and trigger the shortcut via Siri to open my app without issues. However, the listener method does not get activated as it does in the example project provided when the app is triggered by the shortcut. I have added a repo for you to try as well.

Steps to reproduce:

  • Click the button to add shortcut in-app
  • Trigger Siri and say "Say something"
  • The console logs should say "triggered ..." ( it doesn't)

Here is the example repo: https://github.com/maidul98/test-siri-shortcut

  • I am using use_frameworks!
  • I have no issues installing

Would really love some help as I am not sure what is up since I followed all steps. Thank you in advance for taking a look

'ShortcutsModule' is unavailable: cannot find Swift declaration for this class

I tried to install this package without use_frameworks!. Bridging header was present in project, tried to use@import RNSiriShortcuts in Objective-C file, but module was not found. Interesting thing was in that module RNSiriShortcuts is importing fine in Swift class, so I wrote Swift wrapper around RNSiriShortcuts methods. But it is working only in Debug, in release mode I have error 'ShortcutsModule' is unavailable: cannot find Swift declaration for this class

Actions not showing up in Shortcuts iOS14.2

The shortcuts that I suggest or donate are no longer showing up in the Shortcuts app at all. Anyone else experienced this?

There has been no changes to our implementation of this library since it worked, so I'm suspecting it could be caused by either iOS 14.X or React Native 0.62.X?

Env:
React Native 0.62.2
react-native-siri-shortcut 1.9.2
iOS: 14.2

Example project not starting shortcut

Hey, great start on the project! I tried running the example, however, and nothing would happen when I clicked create shortcut. Any thing I might be missing? I made sure to change identifiers in the javascript and info.plist to match the identifier I set on it but nothing seems to be happening. Let me know if you can provide some more detailed instruction steps to get started :) Thanks!

Event not working on cold boot

If the app is in the background and then I apply shortcuts it will work. But if the app is closed and then I apply any shortcut it will not work see the demo video. Please let me know how to fix this?

I have one more question is it possible to retrieve some data from the app into a shortcut. For example, I have a counter with the name "X" in my app with the value 10. so when I click the shortcut without opening the app is it possible I get that X value back and show them instantly without opening the app?

Screen.Recording.2020-12-26.at.9.38.06.PM.mov

LICENSE change

I am planning to change the license of this project from the MIT license to the GPLv3 license. The main reason for this is my belief that all software should be free (free as in freedom, not as in free beer) because that empowers every user and curtails the possibility of monopolistic aproaches to software development.

Even though I am the owner and maintainer of this project, I believe in democracy everywhere and am not looking to be a "dictator" of sorts when it comes to managing this project. As such, I am setting a deadline at the end of the year (31st of December) to let you argument against this change and have you vote in whether this license change happens or not.

As such, if until the end of the year I have 30% of users which starred this project (42) by the time of this issue's creation (126) against this change, the license shall remain as MIT. I will count a vote in favour of this change as a 👍 reaction to this issue, and a vote against it as a 👎 . I would prefer if, when casting your vote, you comment on this issue as to why you voted for/against this decision.

As a clarification, I shall only count votes induvidually from companies, as to avoid large companies using the software having a major say over the community at large, so I shall discard any votes if I find them to be additional votes from a company's staff or from an account created after the posting of this issue.

If the license change ends up happening, this does not bar you from using versions currently licensed under MIT as such, but it will require you to comply to GPLv3 if using any version published after the change.

Thank you for understanding and for your input.

Can I use this with react-native-navigation

The problem with react-native-navigation is that it doesn't take an initialProperties parameter. This is what my applicationDidFinishLaunchingWithOptions method looks like.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;

  #ifdef DEBUG
    jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  #else
    jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  #endif

  [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
  
  return YES;
}

Is there a way I can make my app work with this library?

Call the SiriKit API to create Automation Shortcuts

I am using react-native-siri-shortcut and have successfully created a "Shortcut", however, it seems that it's only a shortcut that takes the user back to my App.

What I'm trying to do is allow them to create Automation shortcuts from within the app, whether it be "Open this app at 5pm every day" or something similar.

Is it possible to call the API to create Shortcut Automations? Is there another way, that doesn't use react-native-siri-shortcut?

Any help is greatly appreciated, thank you!

https://stackoverflow.com/questions/71120759/call-the-sirikit-api-to-create-automation-shortcuts

Present Shortcut

This issue is in order to keep track of the second half of the features requested in issue #6.

There should be an API exposing the INUIAddVoiceShortcutViewController functionality. Please refer to https://developer.apple.com/documentation/sirikit/inuiaddvoiceshortcutviewcontroller

This API should expose a way to open the native "form" for registering a shortcut with Siri, which could be either coupled with the AddToSiriButton component that this package provides, or with a custom component, should the user prefer.

Using react-native-siri-shortcut withoud use_framework

Good day devs,

Our app fails to build and messes up our headers when we use "use_frameworks!". But on the other hand, if I remove it I get this error: 'RNSiriShortcuts/RNSiriShortcuts-Swift.h' file not found. Instead of using use_frameworks! is there a work around it?

Returning a result?

Is it possible to return a string of text, so that in the shortcuts app, something could be dictated after invoking the app?

Is it expedted that suggest/present shortcuts dont appear in search with the shortcut description like donate shortcuts do?

When I add a shortcut with suggest or present function and I search it, this doesn't show the app icon and the shortcut description like so:
presentedShortcut

But when I donate the shortcut and do the same search query it shows the description:
donatedShortcut

Is this difference between suggest/present and donate shortcut something expected? Can present shortcuts show description and app icon in search? Or is normal that they show like the first image?
Thanks in advance

Donate Shortcut vs createShortcut

I've had a read of https://developer.apple.com/documentation/sirikit/donating_shortcuts and noticed they recommend to "donate shortcut" with "becomeCurrent" each time the action is executed, from my understanding. I saw you have used becomeCurrent in https://github.com/Gustash/react-native-siri-shortcut/blob/master/ios/RNSiriShortcuts.swift#L103 - does that mean we should call "createShortcut" each time the action is executed? If so, is it better to rename that function to "donateShortcut"?

AppDelegate.m changes not supported by ExpoKit

Hello, I have followed everything but when I run build I get this error

"Use of undeclared identifier 'jsCodeLocation", I added code in appDelegate.m is explained and did other things.

react-native-cli: 2.0.1
react-native: 0.57.1
npm -v: 6.7.0
Xcode Version: 10.2 (10E125)

The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 4.0, 4.2, 5.0. This setting can be set in the build settings editor.

After opening the project in Xcode, getting the below error and app is not building.

The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 4.0, 4.2, 5.0. This setting can be set in the build settings editor.

Use of undeclared identifier 'ShortcutsModule'

First of all, many thanks to Gustash creating this great library. It has been working great for me in the development environment, but I need help getting the code to compile in Release mode. Like the other user for Issue #58, I am getting the dreaded Use of undeclared identifier 'ShortcutsModule' error.

I have created the simplest clean repo to reproduce the problem.
To reproduce, do the following:

> git clone https://github.com/adrianso/react-native-siri-shortcut-reproduction.git
> yarn
> cd ios && pod install

The following compiles with no problems

> yarn ios

The next command will reproduce the compilation error Use of undeclared identifier 'ShortcutsModule'

> yarn ios --configuration="Release"

Some background

  • React Native 0.63.4
  • No other native modules apart from react-native-siri-shortcut
  • Did not (cannot) use framework

Not able to run after import of module 'glog.glog.log_severity' appears within namespace 'google'

In pod i have used
use_modular_headers! at top

=====================
"react": "16.8.6",
"react-native": "^0.59.9",

=====================
error showing like when i run npx react-native run-ios --simulator="iPhone 8"

info import of module 'glog.glog.log_severity' appears within namespace 'google'
info #include "glog/log_severity.h"

../ios/Pods/Headers/Public/glog/glog/logging.h:509:1:
info note: namespace 'google' begins here

ANY SOLUTION? i have tried to solve by google it but not able resolve this issue. i have tried to use use_framework! still comes different error but not able to run app

please provide solution.
Thanks

Description to donated shortcut

Hi!

I'm wondering if it's possible to add a description to my donated shortcuts. I've looked around the code and the web and can't find anything related to NSUserActivity having a description parameter.

How do these other apps do it? Is it using NSUserActivity or some other API?
F0FECC5A-C4B8-40BF-9A44-120A1A90DD8E_4_5005_c

Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.