capacitor-clear-cache 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapacitorClearCache.podspec +1 -1
- package/Package.swift +28 -0
- package/android/build.gradle +9 -9
- package/dist/plugin.cjs.js +0 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +0 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/ClearCachePlugin/ClearCachePlugin.swift +68 -0
- package/ios/Sources/ClearCachePlugin/Info.plist +24 -0
- package/package.json +19 -18
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
13
|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target
|
|
14
|
+
s.ios.deployment_target = '14.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.swift_version = '5.1'
|
|
17
17
|
end
|
package/Package.swift
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "CapacitorClearCache",
|
|
6
|
+
platforms: [.iOS(.v14)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(
|
|
9
|
+
name: "CapacitorClearCache",
|
|
10
|
+
targets: ["ClearCachePlugin"])
|
|
11
|
+
],
|
|
12
|
+
dependencies: [
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
|
|
14
|
+
],
|
|
15
|
+
targets: [
|
|
16
|
+
.target(
|
|
17
|
+
name: "ClearCachePlugin",
|
|
18
|
+
dependencies: [
|
|
19
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
20
|
+
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
|
+
],
|
|
22
|
+
path: "ios/Sources/ClearCachePlugin"),
|
|
23
|
+
.testTarget(
|
|
24
|
+
name: "ClearCachePluginTests",
|
|
25
|
+
dependencies: ["ClearCachePlugin"],
|
|
26
|
+
path: "ios/Tests/ClearCachePluginTests")
|
|
27
|
+
]
|
|
28
|
+
)
|
package/android/build.gradle
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
ext {
|
|
2
2
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.
|
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1
|
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
@@ -11,7 +11,7 @@ buildscript {
|
|
|
11
11
|
mavenCentral()
|
|
12
12
|
}
|
|
13
13
|
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:8.2
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.7.2'
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -19,10 +19,10 @@ apply plugin: 'com.android.library'
|
|
|
19
19
|
|
|
20
20
|
android {
|
|
21
21
|
namespace "dev.harding.plugins.clearcache"
|
|
22
|
-
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
22
|
+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
|
|
23
23
|
defaultConfig {
|
|
24
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
25
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
24
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
|
|
26
26
|
versionCode 1
|
|
27
27
|
versionName "1.0"
|
|
28
28
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -37,8 +37,8 @@ android {
|
|
|
37
37
|
abortOnError false
|
|
38
38
|
}
|
|
39
39
|
compileOptions {
|
|
40
|
-
sourceCompatibility JavaVersion.
|
|
41
|
-
targetCompatibility JavaVersion.
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_21
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_21
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
package/dist/plugin.cjs.js
CHANGED
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst ClearCache = registerPlugin('ClearCache', {\n web: () => import('./web').then(m => new m.ClearCacheWeb()),\n});\nexport * from './definitions';\nexport { ClearCache };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ClearCacheWeb extends WebPlugin {\n async clear() {\n this.unavailable('Not available on web platform');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst ClearCache = registerPlugin('ClearCache', {\n web: () => import('./web').then(m => new m.ClearCacheWeb()),\n});\nexport * from './definitions';\nexport { ClearCache };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ClearCacheWeb extends WebPlugin {\n async clear() {\n this.unavailable('Not available on web platform');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;AAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AAC/D,CAAC;;ACFM,MAAM,aAAa,SAASC,cAAS,CAAC;AAC7C,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,IAAI,CAAC,WAAW,CAAC,+BAA+B,CAAC;AACzD;AACA;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst ClearCache = registerPlugin('ClearCache', {\n web: () => import('./web').then(m => new m.ClearCacheWeb()),\n});\nexport * from './definitions';\nexport { ClearCache };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ClearCacheWeb extends WebPlugin {\n async clear() {\n this.unavailable('Not available on web platform');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;IAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;IAC/D,CAAC;;ICFM,MAAM,aAAa,SAASC,cAAS,CAAC;IAC7C,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,IAAI,CAAC,WAAW,CAAC,+BAA+B,CAAC
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst ClearCache = registerPlugin('ClearCache', {\n web: () => import('./web').then(m => new m.ClearCacheWeb()),\n});\nexport * from './definitions';\nexport { ClearCache };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ClearCacheWeb extends WebPlugin {\n async clear() {\n this.unavailable('Not available on web platform');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;IAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;IAC/D,CAAC;;ICFM,MAAM,aAAa,SAASC,cAAS,CAAC;IAC7C,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,IAAI,CAAC,WAAW,CAAC,+BAA+B,CAAC;IACzD;IACA;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
import SafariServices
|
|
4
|
+
|
|
5
|
+
@objc(ClearCachePlugin)
|
|
6
|
+
public class ClearCachePlugin: CAPPlugin, CAPBridgedPlugin {
|
|
7
|
+
public let identifier = "ClearCachePlugin"
|
|
8
|
+
public let jsName = "ClearCache"
|
|
9
|
+
public let pluginMethods: [CAPPluginMethod] = [
|
|
10
|
+
CAPPluginMethod(name: "clear", returnType: CAPPluginReturnPromise),
|
|
11
|
+
]
|
|
12
|
+
@objc func clear(_ call: CAPPluginCall) {
|
|
13
|
+
if #available(iOS 16.0, *) {
|
|
14
|
+
SFSafariViewController.DataStore.default.clearWebsiteData { [weak self] in
|
|
15
|
+
guard self != nil else { return }
|
|
16
|
+
|
|
17
|
+
HTTPCookieStorage.shared.removeCookies(since: Date.distantPast)
|
|
18
|
+
URLCache.shared.removeAllCachedResponses()
|
|
19
|
+
|
|
20
|
+
if #available(iOS 17.0, *) {
|
|
21
|
+
WKWebsiteDataStore.default().removeData(ofTypes: [
|
|
22
|
+
WKWebsiteDataTypeCookies,
|
|
23
|
+
WKWebsiteDataTypeDiskCache,
|
|
24
|
+
WKWebsiteDataTypeMemoryCache,
|
|
25
|
+
WKWebsiteDataTypeFetchCache,
|
|
26
|
+
WKWebsiteDataTypeSessionStorage,
|
|
27
|
+
WKWebsiteDataTypeServiceWorkerRegistrations,
|
|
28
|
+
WKWebsiteDataTypeOfflineWebApplicationCache,
|
|
29
|
+
|
|
30
|
+
WKWebsiteDataTypeFileSystem,
|
|
31
|
+
|
|
32
|
+
WKWebsiteDataTypeSearchFieldRecentSearches,
|
|
33
|
+
WKWebsiteDataTypeHashSalt,
|
|
34
|
+
WKWebsiteDataTypeMediaKeys,
|
|
35
|
+
], modifiedSince: Date(timeIntervalSince1970: 0), completionHandler: {
|
|
36
|
+
call.resolve()
|
|
37
|
+
})
|
|
38
|
+
} else {
|
|
39
|
+
WKWebsiteDataStore.default().removeData(ofTypes: [
|
|
40
|
+
WKWebsiteDataTypeCookies,
|
|
41
|
+
WKWebsiteDataTypeDiskCache,
|
|
42
|
+
WKWebsiteDataTypeMemoryCache,
|
|
43
|
+
WKWebsiteDataTypeFetchCache,
|
|
44
|
+
WKWebsiteDataTypeSessionStorage,
|
|
45
|
+
WKWebsiteDataTypeServiceWorkerRegistrations,
|
|
46
|
+
WKWebsiteDataTypeOfflineWebApplicationCache,
|
|
47
|
+
|
|
48
|
+
WKWebsiteDataTypeFileSystem,
|
|
49
|
+
], modifiedSince: Date(timeIntervalSince1970: 0), completionHandler: {
|
|
50
|
+
call.resolve()
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
WKWebsiteDataStore.default().removeData(ofTypes: [
|
|
56
|
+
WKWebsiteDataTypeCookies,
|
|
57
|
+
WKWebsiteDataTypeDiskCache,
|
|
58
|
+
WKWebsiteDataTypeMemoryCache,
|
|
59
|
+
WKWebsiteDataTypeFetchCache,
|
|
60
|
+
WKWebsiteDataTypeSessionStorage,
|
|
61
|
+
WKWebsiteDataTypeServiceWorkerRegistrations,
|
|
62
|
+
WKWebsiteDataTypeOfflineWebApplicationCache
|
|
63
|
+
], modifiedSince: Date(timeIntervalSince1970: 0), completionHandler: {
|
|
64
|
+
call.resolve()
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
+
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
7
|
+
<key>CFBundleExecutable</key>
|
|
8
|
+
<string>$(EXECUTABLE_NAME)</string>
|
|
9
|
+
<key>CFBundleIdentifier</key>
|
|
10
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
11
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
12
|
+
<string>6.0</string>
|
|
13
|
+
<key>CFBundleName</key>
|
|
14
|
+
<string>$(PRODUCT_NAME)</string>
|
|
15
|
+
<key>CFBundlePackageType</key>
|
|
16
|
+
<string>FMWK</string>
|
|
17
|
+
<key>CFBundleShortVersionString</key>
|
|
18
|
+
<string>1.0</string>
|
|
19
|
+
<key>CFBundleVersion</key>
|
|
20
|
+
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
21
|
+
<key>NSPrincipalClass</key>
|
|
22
|
+
<string></string>
|
|
23
|
+
</dict>
|
|
24
|
+
</plist>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capacitor-clear-cache",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Clear various app caches",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"android/src/main/",
|
|
11
11
|
"android/build.gradle",
|
|
12
12
|
"dist/",
|
|
13
|
-
"ios/
|
|
13
|
+
"ios/Sources/",
|
|
14
|
+
"Package.swift",
|
|
14
15
|
"CapacitorClearCache.podspec"
|
|
15
16
|
],
|
|
16
17
|
"author": "",
|
|
@@ -35,32 +36,32 @@
|
|
|
35
36
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
36
37
|
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
|
|
37
38
|
"eslint": "eslint . --ext ts",
|
|
38
|
-
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
39
|
+
"prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
|
|
39
40
|
"swiftlint": "node-swiftlint",
|
|
40
41
|
"docgen": "docgen --api ClearCachePlugin --output-readme README.md --output-json dist/docs.json",
|
|
41
|
-
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.
|
|
42
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
42
43
|
"clean": "rimraf ./dist",
|
|
43
44
|
"watch": "tsc --watch",
|
|
44
45
|
"prepublishOnly": "npm run build"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@capacitor/android": "^
|
|
48
|
-
"@capacitor/core": "^
|
|
49
|
-
"@capacitor/docgen": "^0.0
|
|
50
|
-
"@capacitor/ios": "^
|
|
51
|
-
"@ionic/eslint-config": "^0.
|
|
52
|
-
"@ionic/prettier-config": "^
|
|
53
|
-
"@ionic/swiftlint-config": "^
|
|
54
|
-
"eslint": "^
|
|
55
|
-
"prettier": "
|
|
56
|
-
"prettier-plugin-java": "
|
|
57
|
-
"rimraf": "^
|
|
58
|
-
"rollup": "^
|
|
59
|
-
"swiftlint": "^
|
|
48
|
+
"@capacitor/android": "^7.0.0",
|
|
49
|
+
"@capacitor/core": "^7.0.0",
|
|
50
|
+
"@capacitor/docgen": "^0.3.0",
|
|
51
|
+
"@capacitor/ios": "^7.0.0",
|
|
52
|
+
"@ionic/eslint-config": "^0.4.0",
|
|
53
|
+
"@ionic/prettier-config": "^4.0.0",
|
|
54
|
+
"@ionic/swiftlint-config": "^2.0.0",
|
|
55
|
+
"eslint": "^8.57.0",
|
|
56
|
+
"prettier": "^3.4.2",
|
|
57
|
+
"prettier-plugin-java": "^2.6.6",
|
|
58
|
+
"rimraf": "^6.0.1",
|
|
59
|
+
"rollup": "^4.30.1",
|
|
60
|
+
"swiftlint": "^2.0.0",
|
|
60
61
|
"typescript": "~4.1.5"
|
|
61
62
|
},
|
|
62
63
|
"peerDependencies": {
|
|
63
|
-
"@capacitor/core": "
|
|
64
|
+
"@capacitor/core": ">=7.0.0"
|
|
64
65
|
},
|
|
65
66
|
"prettier": "@ionic/prettier-config",
|
|
66
67
|
"swiftlint": "@ionic/swiftlint-config",
|