Skip to content

Commit

Permalink
fix: update ios 17
Browse files Browse the repository at this point in the history
  • Loading branch information
fonkamloic committed Jul 15, 2024
1 parent 8f2be51 commit 77ee4a5
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 57 deletions.
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
16 changes: 8 additions & 8 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PODS:
- Flutter (1.0.0)
- no_screenshot (0.0.1):
- "no_screenshot (0.0.1+4)":
- Flutter
- ScreenProtectorKit (~> 1.2.0)
- ScreenProtectorKit (1.2.0)
- ScreenProtectorKit (~> 1.3.1)
- ScreenProtectorKit (1.3.1)

DEPENDENCIES:
- Flutter (from `Flutter`)
Expand All @@ -20,10 +20,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/no_screenshot/ios"

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
no_screenshot: 85ed02c4d27c344d72e3ae376c97cc85a18b06c6
ScreenProtectorKit: 823e5b0342eea5acd7e9b8d92956a5a7f9c2ce40
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
no_screenshot: 67d110f12466f4913b488803d4e498d03ef2889e
ScreenProtectorKit: 83a6281b02c7a5902ee6eac4f5045f674e902ae4

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011

COCOAPODS: 1.11.3
COCOAPODS: 1.15.2
61 changes: 32 additions & 29 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
0814FB06D267CE31EABF78B0 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 698C11874CD746C99897BBF7 /* Pods_Runner.framework */; };
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
CCBC7B611A5FD2E48601E0F3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9D1B571F0A390229A737590 /* Pods_Runner.framework */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -30,56 +30,48 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
0BBE2FA8D63EBF8B4CD211B6 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
1C83BDA86114E95372A97511 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
698C11874CD746C99897BBF7 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
9267DCF63049471B2653F152 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
B9D1B571F0A390229A737590 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
F554EF76088E822313F80AAA /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
A6EF89069952D5FDBCB028A7 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
C3244B7C683D691A8D4831D0 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
CCBC7B611A5FD2E48601E0F3 /* Pods_Runner.framework in Frameworks */,
0814FB06D267CE31EABF78B0 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
7F9318418A0C0FF028C04684 /* Pods */ = {
4BF1BA6E527616F5CA5ACC42 /* Pods */ = {
isa = PBXGroup;
children = (
F554EF76088E822313F80AAA /* Pods-Runner.debug.xcconfig */,
0BBE2FA8D63EBF8B4CD211B6 /* Pods-Runner.release.xcconfig */,
1C83BDA86114E95372A97511 /* Pods-Runner.profile.xcconfig */,
9267DCF63049471B2653F152 /* Pods-Runner.debug.xcconfig */,
A6EF89069952D5FDBCB028A7 /* Pods-Runner.release.xcconfig */,
C3244B7C683D691A8D4831D0 /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
8190C14D4C311E8833C7012A /* Frameworks */ = {
isa = PBXGroup;
children = (
B9D1B571F0A390229A737590 /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
Expand All @@ -97,8 +89,8 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
7F9318418A0C0FF028C04684 /* Pods */,
8190C14D4C311E8833C7012A /* Frameworks */,
4BF1BA6E527616F5CA5ACC42 /* Pods */,
FD51E6B3E9DAF57D8093A6D7 /* Frameworks */,
);
sourceTree = "<group>";
};
Expand All @@ -125,21 +117,29 @@
path = Runner;
sourceTree = "<group>";
};
FD51E6B3E9DAF57D8093A6D7 /* Frameworks */ = {
isa = PBXGroup;
children = (
698C11874CD746C99897BBF7 /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
E252C179BFD8F3BBBF219E6E /* [CP] Check Pods Manifest.lock */,
CABA82BDCCB5DE42A41D7B6F /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
B9B459A54E41A98CF7522F89 /* [CP] Embed Pods Frameworks */,
99C723D8C882D8BED156EBD0 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand All @@ -156,7 +156,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -200,10 +200,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand All @@ -214,6 +216,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -226,7 +229,7 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
B9B459A54E41A98CF7522F89 /* [CP] Embed Pods Frameworks */ = {
99C723D8C882D8BED156EBD0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -243,7 +246,7 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
E252C179BFD8F3BBBF219E6E /* [CP] Check Pods Manifest.lock */ = {
CABA82BDCCB5DE42A41D7B6F /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down Expand Up @@ -340,7 +343,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -418,7 +421,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -467,7 +470,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class _MyAppState extends State<MyApp> {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
title: const Text('NoScreenShot Plugin app'),
),
body: Center(
child: Column(
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ packages:
dependency: transitive
description:
name: plugin_platform_interface
sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev"
source: hosted
version: "2.1.3"
version: "2.1.8"
sky_engine:
dependency: transitive
description: flutter
Expand Down
10 changes: 4 additions & 6 deletions ios/Classes/SwiftNoScreenshotPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Flutter
import UIKit
import ScreenProtectorKit


public class SwiftNoScreenshotPlugin: NSObject, FlutterPlugin {
private var screenProtectorKit: ScreenProtectorKit? = nil
private static var channel: FlutterMethodChannel? = nil
Expand All @@ -12,8 +11,8 @@ public class SwiftNoScreenshotPlugin: NSObject, FlutterPlugin {
self.screenProtectorKit = screenProtectorKit
}


public static func register(with registrar: FlutterPluginRegistrar) {
// Corrected the domain name in the method channel to match a typical domain format
SwiftNoScreenshotPlugin.channel = FlutterMethodChannel(name: "com.flutterplaza.no_screenshot", binaryMessenger: registrar.messenger())
let window = UIApplication.shared.delegate?.window

Expand All @@ -25,7 +24,6 @@ public class SwiftNoScreenshotPlugin: NSObject, FlutterPlugin {
registrar.addApplicationDelegate(instance)
}


public func applicationWillResignActive(_ application: UIApplication) {
if SwiftNoScreenshotPlugin.preventScreenShot == true {
screenProtectorKit?.enabledPreventScreenshot()
Expand All @@ -51,8 +49,9 @@ public class SwiftNoScreenshotPlugin: NSObject, FlutterPlugin {
SwiftNoScreenshotPlugin.preventScreenShot = true
shotOn()
} else if (call.method == "toggleScreenshot") {
SwiftNoScreenshotPlugin.preventScreenShot = !SwiftNoScreenshotPlugin.preventScreenShot;
SwiftNoScreenshotPlugin.preventScreenShot ? shotOn() : shotOff()
let res:Bool = SwiftNoScreenshotPlugin.preventScreenShot
SwiftNoScreenshotPlugin.preventScreenShot = !res
res ? shotOff() : shotOn()
}
result(true)
}
Expand All @@ -62,7 +61,6 @@ public class SwiftNoScreenshotPlugin: NSObject, FlutterPlugin {
}

private func shotOn() {

screenProtectorKit?.disablePreventScreenshot()
}

Expand Down
6 changes: 4 additions & 2 deletions ios/no_screenshot.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ A new Flutter plugin project.
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.dependency 'ScreenProtectorKit', '~> 1.3.*'
# Updated the dependency version to remove the wildcard and use a specific version range
s.dependency 'ScreenProtectorKit', '~> 1.3.1'
s.platform = :ios, '10.0'

# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.swift_version = ["4.0", "4.1", "4.2", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5"]
# Updated swift_version to a single version as an array is not supported for this attribute
s.swift_version = "5.0"
end
11 changes: 6 additions & 5 deletions test_driver/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ void main() {
.setMockMethodCallHandler(channel, (MethodCall methodCall) async {
switch (methodCall.method) {
case screenShotOffConst:
break;
return true;
case screenShotOnConst:
break;
return true;
case toggleScreenShotConst:
break;
return true;
default:
return false;
}
});
});
Expand Down Expand Up @@ -68,8 +69,8 @@ void main() {
forthScreenshot = await driver.screenshot();
expect(thirdScreenshot != forthScreenshot, true);
}
final fithScreenshot = await driver.screenshot();
expect(forthScreenshot == fithScreenshot, true);
final fifthScreenshot = await driver.screenshot();
expect(forthScreenshot == fifthScreenshot, true);
});
});
tearDown(() {
Expand Down

0 comments on commit 77ee4a5

Please sign in to comment.