Skip to content

Commit 8c00e52

Browse files
harrison-fluxclaude
andcommitted
feat: migrate to Capacitor v7, add SPM support
- Bump peerDependency to @capacitor/core >=7.0.0 - Android: AGP 8.7.2, Gradle 8.11.1, Java 21, SDK 35, minSdk 23 - iOS: deployment target raised to 14.0 - Add Package.swift for Swift Package Manager support - Add CAPBridgedPlugin conformance for SPM plugin registration - Exclude SensitiveScreenPlugin.m from SPM target (CocoaPods uses it; SPM uses CAPBridgedPlugin instead) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f486ec9 commit 8c00e52

8 files changed

Lines changed: 435 additions & 606 deletions

File tree

JoinfluxCapacitorSensitiveScreen.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
1111
s.author = package['author']
1212
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
1313
s.source_files = 'ios/Plugin/**/*.{swift,h,m}'
14-
s.ios.deployment_target = '13.0'
14+
s.ios.deployment_target = '14.0'
1515
s.dependency 'Capacitor'
1616
s.swift_version = '5.1'
1717
end

Package.resolved

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// swift-tools-version: 5.9
2+
import PackageDescription
3+
4+
let package = Package(
5+
name: "JoinfluxCapacitorSensitiveScreen",
6+
platforms: [.iOS(.v14)],
7+
products: [
8+
.library(
9+
name: "JoinfluxCapacitorSensitiveScreen",
10+
targets: ["JoinfluxCapacitorSensitiveScreen"]
11+
)
12+
],
13+
dependencies: [
14+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
15+
],
16+
targets: [
17+
.target(
18+
name: "JoinfluxCapacitorSensitiveScreen",
19+
dependencies: [
20+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
21+
.product(name: "Cordova", package: "capacitor-swift-pm")
22+
],
23+
path: "ios/Plugin",
24+
exclude: ["SensitiveScreenPlugin.m"]
25+
)
26+
]
27+
)

android/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ buildscript {
1111
mavenCentral()
1212
}
1313
dependencies {
14-
classpath 'com.android.tools.build:gradle:8.2.1'
14+
classpath 'com.android.tools.build:gradle:8.7.2'
1515
}
1616
}
1717

1818
apply plugin: 'com.android.library'
1919

2020
android {
2121
namespace "com.joinflux.sensitivescreen"
22-
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
22+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
2323
defaultConfig {
24-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
25-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
24+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
25+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
2626
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2727
}
2828
buildTypes {
@@ -34,8 +34,8 @@ android {
3434
abortOnError false
3535
}
3636
compileOptions {
37-
sourceCompatibility JavaVersion.VERSION_17
38-
targetCompatibility JavaVersion.VERSION_17
37+
sourceCompatibility JavaVersion.VERSION_21
38+
targetCompatibility JavaVersion.VERSION_21
3939
}
4040
}
4141

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

ios/Plugin/SensitiveScreenPlugin.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import Capacitor
22
import UIKit
33

44
@objc(SensitiveScreenPlugin)
5-
public class SensitiveScreenPlugin: CAPPlugin {
5+
public class SensitiveScreenPlugin: CAPPlugin, CAPBridgedPlugin {
6+
public let identifier = "SensitiveScreenPlugin"
7+
public let jsName = "SensitiveScreen"
8+
public let pluginMethods: [CAPPluginMethod] = [
9+
CAPPluginMethod(name: "enable", returnType: CAPPluginReturnPromise),
10+
CAPPluginMethod(name: "disable", returnType: CAPPluginReturnPromise),
11+
]
612

713
private enum OverlayStyle: String {
814
case solid

0 commit comments

Comments
 (0)