Skip to content

Commit

Permalink
Merge branch 'main' into macos-15
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Nov 22, 2024
2 parents cdc2f9d + b65958e commit 3f87b24
Show file tree
Hide file tree
Showing 67 changed files with 78 additions and 257 deletions.
2 changes: 1 addition & 1 deletion action-sheet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ npx cap sync

This plugin will use the following project variables (defined in your app's `variables.gradle` file):

- `androidxMaterialVersion`: version of `com.google.android.material:material` (default: `1.10.0`)
- `androidxMaterialVersion`: version of `com.google.android.material:material` (default: `1.12.0`)

## PWA Notes

Expand Down
2 changes: 1 addition & 1 deletion action-sheet/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ext {
capacitorVersion = System.getenv('CAPACITOR_VERSION')
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
androidxMaterialVersion = project.hasProperty('androidxMaterialVersion') ? rootProject.ext.androidxMaterialVersion : '1.10.0'
androidxMaterialVersion = project.hasProperty('androidxMaterialVersion') ? rootProject.ext.androidxMaterialVersion : '1.12.0'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
}
Expand Down
4 changes: 2 additions & 2 deletions action-sheet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
"swiftlint": "node-swiftlint",
"docgen": "docgen --api ActionSheetPlugin --output-readme README.md --output-json dist/docs.json",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
"prepublishOnly": "npm run build",
Expand All @@ -58,7 +58,7 @@
"prettier": "~2.3.0",
"prettier-plugin-java": "~1.0.2",
"rimraf": "^3.0.0",
"rollup": "^2.29.0",
"rollup": "^4.26.0",
"swiftlint": "^1.0.1",
"typescript": "~4.1.5"
},
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions app-launcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
"swiftlint": "node-swiftlint",
"docgen": "docgen --api AppLauncherPlugin --output-readme README.md --output-json dist/docs.json",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
"prepublishOnly": "npm run build",
Expand All @@ -58,7 +58,7 @@
"prettier": "~2.3.0",
"prettier-plugin-java": "~1.0.2",
"rimraf": "^3.0.2",
"rollup": "^2.32.0",
"rollup": "^4.26.0",
"swiftlint": "^1.0.1",
"typescript": "~4.1.5"
},
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
"swiftlint": "node-swiftlint",
"docgen": "docgen --api AppPlugin --output-readme README.md",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
"prepublishOnly": "npm run build",
Expand All @@ -58,7 +58,7 @@
"prettier": "~2.3.0",
"prettier-plugin-java": "~1.0.2",
"rimraf": "^3.0.0",
"rollup": "^2.29.0",
"rollup": "^4.26.0",
"swiftlint": "^1.0.1",
"typescript": "~4.1.5"
},
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ npx cap sync

This plugin will use the following project variables (defined in your app's `variables.gradle` file):

- `androidxBrowserVersion`: version of `androidx.browser:browser` (default: `1.7.0`)
- `androidxBrowserVersion`: version of `androidx.browser:browser` (default: `1.8.0`)

## Example

Expand Down
2 changes: 1 addition & 1 deletion browser/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ext {
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
androidxBrowserVersion = project.hasProperty('androidxBrowserVersion') ? rootProject.ext.androidxBrowserVersion : '1.7.0'
androidxBrowserVersion = project.hasProperty('androidxBrowserVersion') ? rootProject.ext.androidxBrowserVersion : '1.8.0'
}

buildscript {
Expand Down
4 changes: 2 additions & 2 deletions browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
"swiftlint": "node-swiftlint",
"docgen": "docgen --api BrowserPlugin --output-readme README.md --output-json dist/docs.json",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
"prepublishOnly": "npm run build",
Expand All @@ -58,7 +58,7 @@
"prettier": "~2.3.0",
"prettier-plugin-java": "~1.0.2",
"rimraf": "^3.0.0",
"rollup": "^2.29.0",
"rollup": "^4.26.0",
"swiftlint": "^1.0.1",
"typescript": "~4.1.5"
},
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions camera/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ Additionally, because the Camera API launches a separate Activity to handle taki

This plugin will use the following project variables (defined in your app's `variables.gradle` file):

- `androidxExifInterfaceVersion`: version of `androidx.exifinterface:exifinterface` (default: `1.3.6`)
- `androidxMaterialVersion`: version of `com.google.android.material:material` (default: `1.10.0`)
- `androidxExifInterfaceVersion`: version of `androidx.exifinterface:exifinterface` (default: `1.3.7`)
- `androidxMaterialVersion`: version of `com.google.android.material:material` (default: `1.12.0`)

## PWA Notes

Expand Down
4 changes: 2 additions & 2 deletions camera/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ ext {
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
androidxExifInterfaceVersion = project.hasProperty('androidxExifInterfaceVersion') ? rootProject.ext.androidxExifInterfaceVersion : '1.3.6'
androidxExifInterfaceVersion = project.hasProperty('androidxExifInterfaceVersion') ? rootProject.ext.androidxExifInterfaceVersion : '1.3.7'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
androidxMaterialVersion = project.hasProperty('androidxMaterialVersion') ? rootProject.ext.androidxMaterialVersion : '1.10.0'
androidxMaterialVersion = project.hasProperty('androidxMaterialVersion') ? rootProject.ext.androidxMaterialVersion : '1.12.0'
}

buildscript {
Expand Down
4 changes: 2 additions & 2 deletions camera/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
"swiftlint": "node-swiftlint",
"docgen": "docgen --api CameraPlugin --output-readme README.md --output-json dist/docs.json",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
"prepublishOnly": "npm run build",
Expand All @@ -58,7 +58,7 @@
"prettier": "~2.3.0",
"prettier-plugin-java": "~1.0.2",
"rimraf": "^3.0.0",
"rollup": "^2.29.0",
"rollup": "^4.26.0",
"swiftlint": "^1.0.1",
"typescript": "~4.1.5"
},
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions clipboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
"swiftlint": "node-swiftlint",
"docgen": "docgen --api ClipboardPlugin --output-readme README.md --output-json dist/docs.json",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
"prepublishOnly": "npm run build",
Expand All @@ -58,7 +58,7 @@
"prettier": "~2.3.0",
"prettier-plugin-java": "~1.0.2",
"rimraf": "^3.0.0",
"rollup": "^2.29.0",
"rollup": "^4.26.0",
"swiftlint": "^1.0.1",
"typescript": "~4.1.5"
},
Expand Down
File renamed without changes.
37 changes: 0 additions & 37 deletions device/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,6 @@ npm install @capacitor/device
npx cap sync
```

## Apple Privacy Manifest Requirements

Apple mandates that app developers now specify approved reasons for API usage to enhance user privacy. By May 1st, 2024, it's required to include these reasons when submitting apps to the App Store Connect.

When using this specific plugin in your app, you must create a `PrivacyInfo.xcprivacy` file in `/ios/App` or use the VS Code Extension to generate it, specifying the usage reasons.

For detailed steps on how to do this, please see the [Capacitor Docs](https://capacitorjs.com/docs/ios/privacy-manifest).

**For this plugin, the required dictionary key is [NSPrivacyAccessedAPICategoryDiskSpace](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278397) and the recommended reason is [85F4.1](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278397).**

### Example PrivacyInfo.xcprivacy

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<!-- Add this dict entry to the array if the PrivacyInfo file already exists -->
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>85F4.1</string>
</array>
</dict>
</array>
</dict>
</plist>
```

## Example Plugin Usage

```typescript
Expand Down Expand Up @@ -176,10 +143,6 @@ Get the device's current language locale tag.
| **`manufacturer`** | <code>string</code> | The manufacturer of the device. | 1.0.0 |
| **`isVirtual`** | <code>boolean</code> | Whether the app is running in a simulator/emulator. | 1.0.0 |
| **`memUsed`** | <code>number</code> | Approximate memory used by the current app, in bytes. Divide by 1048576 to get the number of MBs used. | 1.0.0 |
| **`diskFree`** | <code>number</code> | How much free disk space is available on the normal data storage path for the os, in bytes. On Android it returns the free disk space on the "system" partition holding the core Android OS. On iOS this value is not accurate. | 1.0.0 |
| **`diskTotal`** | <code>number</code> | The total size of the normal data storage path for the OS, in bytes. On Android it returns the disk space on the "system" partition holding the core Android OS. | 1.0.0 |
| **`realDiskFree`** | <code>number</code> | How much free disk space is available on the normal data storage, in bytes. | 1.1.0 |
| **`realDiskTotal`** | <code>number</code> | The total size of the normal data storage path, in bytes. | 1.1.0 |
| **`webViewVersion`** | <code>string</code> | The web view browser version | 1.0.0 |


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import android.content.pm.PackageManager;
import android.os.BatteryManager;
import android.os.Build;
import android.os.Environment;
import android.os.StatFs;
import android.provider.Settings;
import android.webkit.WebView;

Expand All @@ -26,26 +24,6 @@ public long getMemUsed() {
return usedMem;
}

public long getDiskFree() {
StatFs statFs = new StatFs(Environment.getRootDirectory().getAbsolutePath());
return statFs.getAvailableBlocksLong() * statFs.getBlockSizeLong();
}

public long getDiskTotal() {
StatFs statFs = new StatFs(Environment.getRootDirectory().getAbsolutePath());
return statFs.getBlockCountLong() * statFs.getBlockSizeLong();
}

public long getRealDiskFree() {
StatFs statFs = new StatFs(Environment.getDataDirectory().getAbsolutePath());
return statFs.getAvailableBlocksLong() * statFs.getBlockSizeLong();
}

public long getRealDiskTotal() {
StatFs statFs = new StatFs(Environment.getDataDirectory().getAbsolutePath());
return statFs.getBlockCountLong() * statFs.getBlockSizeLong();
}

public String getPlatform() {
return "android";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ public void getInfo(PluginCall call) {
JSObject r = new JSObject();

r.put("memUsed", implementation.getMemUsed());
r.put("diskFree", implementation.getDiskFree());
r.put("diskTotal", implementation.getDiskTotal());
r.put("realDiskFree", implementation.getRealDiskFree());
r.put("realDiskTotal", implementation.getRealDiskTotal());
r.put("model", android.os.Build.MODEL);
r.put("operatingSystem", "android");
r.put("osVersion", android.os.Build.VERSION.RELEASE);
Expand Down
42 changes: 0 additions & 42 deletions device/ios/Sources/DevicePlugin/Device.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,48 +21,6 @@ import UIKit
}
}

/**
* Get free disk space
*/
public func getFreeDiskSize() -> Int64? {
let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
if let dictionary = try? FileManager.default.attributesOfFileSystem(forPath: paths.last!) {
if let freeSize = dictionary[FileAttributeKey.systemFreeSize] as? NSNumber {
return freeSize.int64Value
}
}
return nil
}

/**
* Get real free disk space
*/
public func getRealFreeDiskSize() -> Int64? {
do {
let values = try URL(fileURLWithPath: NSHomeDirectory() as String).resourceValues(forKeys: [URLResourceKey.volumeAvailableCapacityForImportantUsageKey])
if let available = values.volumeAvailableCapacityForImportantUsage {
return available
} else {
return nil
}
} catch {
return nil
}
}

/**
* Get total disk size
*/
public func getTotalDiskSize() -> Int64? {
let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
if let dictionary = try? FileManager.default.attributesOfFileSystem(forPath: paths.last!) {
if let freeSize = dictionary[FileAttributeKey.systemSize] as? NSNumber {
return freeSize.int64Value
}
}
return nil
}

public func getLanguageCode() -> String {
return String(Locale.preferredLanguages[0].prefix(2))
}
Expand Down
7 changes: 0 additions & 7 deletions device/ios/Sources/DevicePlugin/DevicePlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,10 @@ public class DevicePlugin: CAPPlugin, CAPBridgedPlugin {
#endif

let memUsed = implementation.getMemoryUsage()
let diskFree = implementation.getFreeDiskSize() ?? 0
let realDiskFree = implementation.getRealFreeDiskSize() ?? 0
let diskTotal = implementation.getTotalDiskSize() ?? 0
let systemVersionNum = implementation.getSystemVersionInt() ?? 0

call.resolve([
"memUsed": memUsed,
"diskFree": diskFree,
"diskTotal": diskTotal,
"realDiskFree": realDiskFree,
"realDiskTotal": diskTotal,
"name": UIDevice.current.name,
"model": modelName,
"operatingSystem": "ios",
Expand Down
4 changes: 2 additions & 2 deletions device/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
"swiftlint": "node-swiftlint",
"docgen": "docgen --api DevicePlugin --output-readme README.md --output-json dist/docs.json",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
"prepublishOnly": "npm run build",
Expand All @@ -60,7 +60,7 @@
"prettier": "~2.3.0",
"prettier-plugin-java": "~1.0.2",
"rimraf": "^3.0.0",
"rollup": "^2.29.0",
"rollup": "^4.26.0",
"swiftlint": "^1.0.1",
"ts-node": "^9.1.1",
"typescript": "~4.1.5",
Expand Down
File renamed without changes.
4 changes: 1 addition & 3 deletions device/src/__tests__/useragent.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import type { WebPluginConfig } from '@capacitor/core';
import { test } from 'uvu';
import * as assert from 'uvu/assert';

import { DeviceWeb } from '../web';

const config: WebPluginConfig = { name: 'DevicePlugin' };
const web = new DeviceWeb(config);
const web = new DeviceWeb();

test('Chrome', () => {
// Mock empty navigator/window objects
Expand Down
Loading

0 comments on commit 3f87b24

Please sign in to comment.