diff --git a/example/android/build.gradle b/example/android/build.gradle index 83ae220..3cdaac9 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 9625e10..7c56964 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 11.0 + 12.0 diff --git a/example/ios/Podfile b/example/ios/Podfile index 88359b2..279576f 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -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' diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 8733349..72987e5 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -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`) @@ -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 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 11412b2..7c79571 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -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 */ @@ -30,14 +30,14 @@ /* 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 = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 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 = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 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 = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 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 = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -45,8 +45,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 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 = ""; }; + 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 = ""; }; + 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 = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -54,32 +54,24 @@ 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 = ""; }; - 8190C14D4C311E8833C7012A /* Frameworks */ = { - isa = PBXGroup; - children = ( - B9D1B571F0A390229A737590 /* Pods_Runner.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -97,8 +89,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - 7F9318418A0C0FF028C04684 /* Pods */, - 8190C14D4C311E8833C7012A /* Frameworks */, + 4BF1BA6E527616F5CA5ACC42 /* Pods */, + FD51E6B3E9DAF57D8093A6D7 /* Frameworks */, ); sourceTree = ""; }; @@ -125,6 +117,14 @@ path = Runner; sourceTree = ""; }; + FD51E6B3E9DAF57D8093A6D7 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 698C11874CD746C99897BBF7 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -132,14 +132,14 @@ 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 = ( ); @@ -156,7 +156,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -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 = ( @@ -214,6 +216,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -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 = ( @@ -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 = ( @@ -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; @@ -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; @@ -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; diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index c87d15a..5e31d3d 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ { return MaterialApp( home: Scaffold( appBar: AppBar( - title: const Text('Plugin example app'), + title: const Text('NoScreenShot Plugin app'), ), body: Center( child: Column( diff --git a/example/pubspec.lock b/example/pubspec.lock index 76c0646..cf2d64e 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -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 diff --git a/ios/Classes/SwiftNoScreenshotPlugin.swift b/ios/Classes/SwiftNoScreenshotPlugin.swift index 6952fc0..c7f7065 100644 --- a/ios/Classes/SwiftNoScreenshotPlugin.swift +++ b/ios/Classes/SwiftNoScreenshotPlugin.swift @@ -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 @@ -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 @@ -25,7 +24,6 @@ public class SwiftNoScreenshotPlugin: NSObject, FlutterPlugin { registrar.addApplicationDelegate(instance) } - public func applicationWillResignActive(_ application: UIApplication) { if SwiftNoScreenshotPlugin.preventScreenShot == true { screenProtectorKit?.enabledPreventScreenshot() @@ -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) } @@ -62,7 +61,6 @@ public class SwiftNoScreenshotPlugin: NSObject, FlutterPlugin { } private func shotOn() { - screenProtectorKit?.disablePreventScreenshot() } diff --git a/ios/no_screenshot.podspec b/ios/no_screenshot.podspec index 8e8c420..6436798 100644 --- a/ios/no_screenshot.podspec +++ b/ios/no_screenshot.podspec @@ -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 diff --git a/test_driver/app_test.dart b/test_driver/app_test.dart index 675e696..fb65faf 100644 --- a/test_driver/app_test.dart +++ b/test_driver/app_test.dart @@ -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; } }); }); @@ -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(() {