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

feat(components/tool/app): Add network plugin #667

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions components/tool/app/bin/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ module.exports = async () => {

if (!hasDependency('@capacitor/browser')) installDependency('@capacitor/browser@6')

if (!hasDependency('@capacitor/network')) installDependency('@capacitor/network@6')

// If app has already been initialized
if (hasCapacitorConfig()) {
reportError(`\nThis project has already-been initialized. Please run sui-app remove before initializing again.\n`)
Expand Down
1 change: 1 addition & 0 deletions components/tool/app/bin/commands/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const uninstallPlugins = () => {
uninstallPackage('@capgo/capacitor-updater')
uninstallPackage('@capacitor/app')
uninstallPackage('@capacitor/browser')
uninstallPackage('@capacitor/network')
}

// Business logic
Expand Down
3 changes: 2 additions & 1 deletion components/tool/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
"dependencies": {
"@capacitor/android": "^6",
"@capacitor/app": "^6",
"@capacitor/browser": "^6",
"@capacitor/cli": "^6",
"@capacitor/core": "^6",
"@capacitor/ios": "^6",
"@capacitor/browser": "^6",
"@capacitor/network": "^6",
"@capgo/capacitor-native-biometric": "^5.1.0",
"@capgo/capacitor-updater": "^5.9.4",
"readline": "^1.3.0",
Expand Down
3 changes: 2 additions & 1 deletion components/tool/app/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import * as browser from './browser.js'
import * as core from './core.js'
import * as liveUpdates from './liveUpdates.js'
import * as localNotifications from './localNotifications.js'
import * as network from './network.js'

export default function SuiApp() {
throw new Error('sui-app is a set of tools and is not intended to be renderized as a React component')
}

export {biometric, browser, core, liveUpdates, localNotifications}
export {biometric, browser, core, liveUpdates, localNotifications, network}
5 changes: 5 additions & 0 deletions components/tool/app/src/network.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {Network} from '@capacitor/network'

export const onNetworkChange = callback => Network.addListener('networkStatusChange', callback)
export const removeOnNetworkChange = () => Network.removeAllListeners()
export const getStatus = () => Network.getStatus()
Loading