Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: External plugins #74

Merged
merged 59 commits into from Nov 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
c4e7911
Base implementation of external plugins
ziulev Sep 2, 2021
e0bc63e
Add events; settings providers
ziulev Sep 2, 2021
945882c
Update lock files
ziulev Sep 2, 2021
6e8d21e
Add navigation, actions support
ziulev Sep 2, 2021
9d80ec3
Add onInit event, update core commands
ziulev Sep 2, 2021
967510b
Clean up
ziulev Sep 3, 2021
a7ddff8
Fix setting options; catch plugin errors
ziulev Sep 6, 2021
3ac8fcb
Remove PluginsRegistry
ziulev Sep 6, 2021
f97bff1
Init plugins storage
ziulev Sep 6, 2021
e526c83
Hide settings
ziulev Sep 6, 2021
eb33779
Add action arguments
ziulev Sep 6, 2021
0b07eea
Fix active option text color
ziulev Sep 6, 2021
6b43803
Fix register and display options
ziulev Sep 6, 2021
d53a7ac
Fix search
ziulev Sep 6, 2021
b206c8f
Clean up
ziulev Sep 6, 2021
5276fd2
Implement handlecommands method
ziulev Sep 7, 2021
650a0e2
Add show options debouncer
ziulev Sep 7, 2021
01dc38c
Disable async options
ziulev Sep 7, 2021
2ee7ba1
Clean up
ziulev Sep 7, 2021
a2ea8d7
Remove registries
ziulev Sep 8, 2021
800f2e5
Uninstall lodash
ziulev Sep 8, 2021
b5a6138
Remove rxjs
ziulev Sep 8, 2021
9c418f0
Implement initial internal plugin
ziulev Sep 8, 2021
5987d62
Add query action support for internal plugins
ziulev Sep 8, 2021
d8c5014
Fix hint, add loading indicator
ziulev Sep 8, 2021
1aa471d
Implement installing plugins cli
ziulev Sep 8, 2021
d780a54
Change plugins install option title
ziulev Sep 8, 2021
b64ac0a
Add oninit timeout
ziulev Sep 9, 2021
ecfd13c
Add install plugin autocomplete
ziulev Sep 9, 2021
872128b
Clean up; fix build
ziulev Sep 9, 2021
b5a0f04
Add history provider
ziulev Sep 9, 2021
e3de44d
Remove applications internal plugin
ziulev Sep 9, 2021
d4741c4
Fix scrollToIndex if there is no option
ziulev Sep 9, 2021
cb90674
Remove preferences internal plugin
ziulev Sep 9, 2021
4f04a89
Add basic hotkeys settings
ziulev Sep 9, 2021
7a79d56
Update lock files
ziulev Sep 9, 2021
df98847
Implement onQueryAction support
ziulev Sep 10, 2021
27705f7
Install local plugins
ziulev Sep 10, 2021
b8adf6c
Update bundle display name
ziulev Sep 10, 2021
1adfcff
Implement plugins storage
ziulev Sep 10, 2021
3d47001
Fix saving storage data
ziulev Sep 10, 2021
8b92316
Update api
ziulev Sep 13, 2021
8d6f7c2
Catch plugins errors
ziulev Sep 14, 2021
f88d869
Fix exec local plugins actions
ziulev Sep 14, 2021
4accdd1
Implement onPrefix
ziulev Sep 14, 2021
aee496c
Remove calculator plugin
ziulev Sep 14, 2021
ebc5fca
Fix reset registered prefixes
ziulev Sep 14, 2021
be60396
Implement async onPrefix
ziulev Sep 14, 2021
5b0313e
Fix display spinner when has option
ziulev Sep 14, 2021
7cfe749
Preinstall plugins
ziulev Oct 12, 2021
bd490c4
Add TODO
ziulev Oct 12, 2021
352623b
Preinstall nodejs
ziulev Oct 12, 2021
adf7775
Filter plugins
ziulev Oct 12, 2021
c1eeb12
Add dotenv
ziulev Nov 28, 2021
0872a62
Pass tokens with storage
ziulev Nov 28, 2021
b2469ca
Add setHint support
ziulev Nov 28, 2021
c529ce1
Add potify plugin to preinstall list
ziulev Nov 28, 2021
cf4296d
Remove :mac prefix
ziulev Nov 28, 2021
dc0e130
Merge branch 'master' into external-plugins
ziulev Nov 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
@@ -0,0 +1,3 @@
SPOTIFY_CLIENT_ID=
SPOTIFY_CLIENT_SECRET=
SPOTIFY_REDIRECT_URI=
3 changes: 2 additions & 1 deletion .eslintrc.json
Expand Up @@ -25,6 +25,7 @@
],
"rules": {
"react/jsx-filename-extension": [1, { "extensions": [".tsx", ".ts", ".js"] }],
"react/prop-types": "off"
"react/prop-types": "off",
"quotes": [2, "single", { "avoidEscape": true }]
}
}
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -57,3 +57,5 @@ buck-out/

# CocoaPods
/ios/Pods/

.env
5 changes: 5 additions & 0 deletions babel.config.js
@@ -1,3 +1,8 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
'plugins': [
['module:react-native-dotenv', {
'allowUndefined': true
}]
]
};
41 changes: 30 additions & 11 deletions index.js
Expand Up @@ -3,26 +3,45 @@ import { AppRegistry, YellowBox } from 'react-native';
import { QueryPanel } from './src/components/spotter.component.tsx';
import { name as appName } from './app.json';
import { Settings } from './src/components/settings/settings.component.tsx';
import { ThemeProvider, ApiProvider } from './src/providers';
import {
ThemeProvider,
ApiProvider,
EventsProvider,
SettingsProvider,
HistoryProvider,
StorageProvider,
} from './src/providers';

// TODO: Check
YellowBox.ignoreWarnings([
'RCTBridge'
]);

const AppWithModules = () => (
<ThemeProvider>
<ApiProvider>
<QueryPanel/>
</ApiProvider>
</ThemeProvider>
<ApiProvider>
<SettingsProvider>
<HistoryProvider>
<StorageProvider>
<EventsProvider>
<ThemeProvider>
<QueryPanel />
</ThemeProvider>
</EventsProvider>
</StorageProvider>
</HistoryProvider>
</SettingsProvider>
</ApiProvider>
);
const SettingsWithModules = () => (
<ThemeProvider>
<ApiProvider>
<Settings/>
</ApiProvider>
</ThemeProvider>
<ApiProvider>
<SettingsProvider>
{/* <EventsProvider> */}
<ThemeProvider>
<Settings />
</ThemeProvider>
{/* </EventsProvider> */}
</SettingsProvider>
</ApiProvider>
);

AppRegistry.registerComponent(appName, () => AppWithModules);
Expand Down
57 changes: 0 additions & 57 deletions macos/Podfile
@@ -1,63 +1,6 @@
# require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

# abstract_target 'Shared' do
# # Pods for spotter
# pod 'FBLazyVector', :path => '../node_modules/react-native-macos/Libraries/FBLazyVector'
# pod 'FBReactNativeSpec', :path => '../node_modules/react-native-macos/Libraries/FBReactNativeSpec'
# pod 'RCTRequired', :path => '../node_modules/react-native-macos/Libraries/RCTRequired'
# pod 'RCTTypeSafety', :path => '../node_modules/react-native-macos/Libraries/TypeSafety'
# pod 'React', :path => '../node_modules/react-native-macos/'
# pod 'React-Core', :path => '../node_modules/react-native-macos/'
# pod 'React-CoreModules', :path => '../node_modules/react-native-macos/React/CoreModules'
# pod 'React-Core/DevSupport', :path => '../node_modules/react-native-macos/'
# pod 'React-RCTActionSheet', :path => '../node_modules/react-native-macos/Libraries/ActionSheetIOS'
# pod 'React-RCTAnimation', :path => '../node_modules/react-native-macos/Libraries/NativeAnimation'
# pod 'React-RCTBlob', :path => '../node_modules/react-native-macos/Libraries/Blob'
# pod 'React-RCTImage', :path => '../node_modules/react-native-macos/Libraries/Image'
# pod 'React-RCTLinking', :path => '../node_modules/react-native-macos/Libraries/LinkingIOS'
# pod 'React-RCTNetwork', :path => '../node_modules/react-native-macos/Libraries/Network'
# pod 'React-RCTSettings', :path => '../node_modules/react-native-macos/Libraries/Settings'
# pod 'React-RCTText', :path => '../node_modules/react-native-macos/Libraries/Text'
# pod 'React-RCTVibration', :path => '../node_modules/react-native-macos/Libraries/Vibration'
# pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native-macos/'

# pod 'React-cxxreact', :path => '../node_modules/react-native-macos/ReactCommon/cxxreact'
# pod 'React-jsi', :path => '../node_modules/react-native-macos/ReactCommon/jsi'
# pod 'React-jsiexecutor', :path => '../node_modules/react-native-macos/ReactCommon/jsiexecutor'
# pod 'React-jsinspector', :path => '../node_modules/react-native-macos/ReactCommon/jsinspector'
# pod 'ReactCommon/callinvoker', :path => '../node_modules/react-native-macos/ReactCommon'
# pod 'ReactCommon/turbomodule/core', :path => '../node_modules/react-native-macos/ReactCommon'
# pod 'Yoga', :path => '../node_modules/react-native-macos/ReactCommon/yoga'

# pod 'boost-for-react-native', :podspec => '../node_modules/react-native-macos/third-party-podspecs/boost-for-react-native.podspec'
# pod 'DoubleConversion', :podspec => '../node_modules/react-native-macos/third-party-podspecs/DoubleConversion.podspec'
# pod 'glog', :podspec => '../node_modules/react-native-macos/third-party-podspecs/glog.podspec'
# pod 'RCT-Folly', :podspec => '../node_modules/react-native-macos/third-party-podspecs/RCT-Folly.podspec'

# pod 'ShellOut'
# pod 'Magnet'
# pod 'KeyHolder'

# target 'spotter-macOS' do
# platform :macos, '10.14'
# use_native_modules!
# # Pods specifically for macOS target
# end

# # target 'spotter-iOS' do
# # platform :ios, '9'
# # use_native_modules!
# # # Pods specifically for iOS target
# # end
# end




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

pod 'ShellOut'
pod 'Magnet'
pod 'KeyHolder'

Expand Down
18 changes: 7 additions & 11 deletions macos/Podfile.lock
Expand Up @@ -249,12 +249,11 @@ PODS:
- React-Core (= 0.63.27)
- React-cxxreact (= 0.63.27)
- React-jsi (= 0.63.27)
- RNCAsyncStorage (1.13.2):
- React
- RNSqlite2 (1.0.0):
- RNCAsyncStorage (1.15.11):
- React-Core
- RNSqlite2 (3.3.0):
- React-Core
- Sauce (2.1.0)
- ShellOut (2.0.0)
- Yoga (1.14.0)

DEPENDENCIES:
Expand Down Expand Up @@ -290,15 +289,13 @@ DEPENDENCIES:
- ReactCommon/turbomodule/core (from `../node_modules/react-native-macos/ReactCommon`)
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- RNSqlite2 (from `../node_modules/react-native-sqlite-2`)
- ShellOut
- Yoga (from `../node_modules/react-native-macos/ReactCommon/yoga`)

SPEC REPOS:
trunk:
- KeyHolder
- Magnet
- Sauce
- ShellOut

EXTERNAL SOURCES:
boost-for-react-native:
Expand Down Expand Up @@ -389,12 +386,11 @@ SPEC CHECKSUMS:
React-RCTText: 5582eafe1164c2ff6105fe5e80f38fceb7b57f47
React-RCTVibration: 23458306eaf4b927518e6cc352563e6b87cd2492
ReactCommon: 5a71bfd6f9fa344bbeee26749682ef3880f786b1
RNCAsyncStorage: 05bae7ecfab1cbd5441993f1ca098f7c3b3f8d0e
RNSqlite2: aba98937d707abaf15d97f7bdeaf99335268c283
RNCAsyncStorage: eb05c0284dd6b50b32f92fad55e2a41e03358c43
RNSqlite2: df25f1fefd82da39a3f956504149fb32d23831fb
Sauce: a4075a04b6041e7a0c992a952cc79f7a0ebdb8e3
ShellOut: 1393eefc56892e80d85339e233d3935e2e1ff6f9
Yoga: b4c6f1be0c16f6a112d81c7fb09d23dcbe40a1b4

PODFILE CHECKSUM: 4505f9ae7945002d2c6ea1c294eae96380ef1adf
PODFILE CHECKSUM: e73099f05fb738deb644b6f8f5117d186a3985c7

COCOAPODS: 1.10.2
COCOAPODS: 1.11.2
1 change: 0 additions & 1 deletion macos/spotter-macOS/Applications/Applications.swift
@@ -1,5 +1,4 @@
import Foundation
import ShellOut

@objc(Applications)
class Applications: RCTEventEmitter {
Expand Down
1 change: 0 additions & 1 deletion macos/spotter-macOS/Clipboard/Clipboard.swift
@@ -1,5 +1,4 @@
import Foundation
import ShellOut
import Magnet
import Carbon

Expand Down
1 change: 0 additions & 1 deletion macos/spotter-macOS/Hotkey/Hotkey.swift
Expand Up @@ -3,7 +3,6 @@ enum Events {
}

import Foundation
import ShellOut
import Magnet
import Carbon

Expand Down
2 changes: 2 additions & 0 deletions macos/spotter-macOS/Info.plist
Expand Up @@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Spotter</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
Expand Down
1 change: 0 additions & 1 deletion macos/spotter-macOS/Notifications/Notifications.swift
@@ -1,5 +1,4 @@
import Foundation
import ShellOut
import Magnet
import Carbon

Expand Down
1 change: 0 additions & 1 deletion macos/spotter-macOS/Panel/Panel.swift
@@ -1,5 +1,4 @@
import Foundation
import ShellOut

@objc(Panel)
class Panel: RCTEventEmitter {
Expand Down
14 changes: 7 additions & 7 deletions macos/spotter-macOS/Shell/Shell.swift
@@ -1,27 +1,27 @@
import Foundation
import ShellOut

@objc(Shell)
class Shell: RCTEventEmitter {

@objc
func execute(_ command: String,
resolver resolve: RCTPromiseResolveBlock,
rejecter reject: RCTPromiseRejectBlock) -> Void {
rejecter reject: RCTPromiseRejectBlock) -> Void {
do {
let output = try shellOut(to: command)
let output = try shellOut(to: command, at: "/")
resolve(output)
} catch {
let error = error as! ShellOutError
print(error.message)
print(error.output)
reject("code", error.message, error)
}
}
override func supportedEvents() -> [String]! {

override func supportedEvents() -> [String]? {
return []
}

@objc override static func requiresMainQueueSetup() -> Bool {
return false
}
Expand Down