Giter Site home page Giter Site logo

secure_application's People

Contributors

abhinandval avatar ariefwijaya avatar neckaros avatar tneotia avatar weicongcong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

secure_application's Issues

SecureGate not triggering lockedBuilder when authenticated = false

Hi,

I am facing an issue in the following scenario:

  1. I have a SecureApplication with the following controller:
final SecureApplicationController _controller = SecureApplicationController(
    SecureApplicationState(locked: true, secured: true, authenticated: false,)
);
  1. When I open my app, the lockedBuilder function is not called, making my screen blur, but without the lock widget.

Question - is locking (and the blur effect) supposed to be automatic when going to app switcher/background?

if I manually lock here:

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    super.didChangeAppLifecycleState(state);
    if (state == AppLifecycleState.inactive || state == AppLifecycleState.paused) {
      SecureApplicationProvider.of(context)?.lock();
    } else if (state == AppLifecycleState.resumed) {
      SecureApplicationProvider.of(context)?.unlock();
    }
  }

I get locking when opening app switcher on iOS. on Android it blurs the screen but then the blur goes away after app is in background. The docs make it seem like I should not have to manually call lock to get this to work, is that correct?

How to change color when in application switcher on iOS?

On iOS whenever I open my app (with secured state), and open task switcher, the task switcher hides the content of the app with a white color. Can I change this color (my use case is that I want to support dark mode)?
Thanks.

Why application not locked after opening?

Hi, is there a reason this package doesn’t lock an app after launch? I’ve tried it and it just works when I switch to another app and come back. Can we make it work even when after we launch an app?

SecureApplicationState(secured:) issue

Setting secured in the state init doesn't work:
_secureAppController = SecureApplicationController(SecureApplicationState(secured: true));
Current workaround:
_secureAppController = SecureApplicationController(SecureApplicationState()); _secureAppController.secure();

I'm on iOS, secure_application version 3.7.1

Build warning on Flutter 3.0.0

When building an app with Flutter version 3.0.0 or above that uses the secure_application package I am seeing the warnings below. Could a new version on pub.dev be published that makes this package compatible with Flutter 3.0.0 please?

../../../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/secure_application-3.8.0/lib/secure_application.dart:102:20: Warning: Operand of null-aware operation '!' has type
'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../Library/flutter/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance!.addObserver(this);
                   ^
../../../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/secure_application-3.8.0/lib/secure_application.dart:112:20: Warning: Operand of null-aware operation '!' has type
'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../Library/flutter/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance!.removeObserver(this);
                   ^
../../../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/secure_application-3.8.0/lib/secure_application.dart:134:30: Warning: Operand of null-aware operation '!' has type
'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../Library/flutter/packages/flutter/lib/src/widgets/binding.dart').
              WidgetsBinding.instance!.addPostFrameCallback((_) {
                             ^

iOS issue - applicationWillResignActive - Fatal Exception: NSInternalInconsistencyException unexpected start state

Hello,

using version 3.8.0, I found that many issues occurs on my production application (only on iOS) on this line : https://github.com/neckaros/secure_application/blob/master/ios/Classes/SwiftSecureApplicationPlugin.swift#L53

Crashlytics log the following message : applicationWillResignActive - Fatal Exception: NSInternalInconsistencyException unexpected start state

It looks like the issue is occurring only on iOS 13.

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x131344 __exceptionPreprocess
1  libobjc.A.dylib                0x5cc0 objc_exception_throw
2  CoreFoundation                 0x2e878 +[_CFXNotificationTokenRegistration keyCallbacks]
3  Foundation                     0xdcc74 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:]
4  UIKitCore                      0xa6766c _prepareForCAFlush
5  UIKitCore                      0xa98e34 _beforeCACommitHandler
6  CoreFoundation                 0xac11c __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
7  CoreFoundation                 0xa6e4c __CFRunLoopDoObservers
8  CoreFoundation                 0xa6be8 CFRunLoopRunSpecific
9  Foundation                     0x8598 -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
10 Foundation                     0x8470 -[NSRunLoop(NSRunLoop) runUntilDate:]
11 secure_application             0x79c4 applicationWillResignActive + 53 (SwiftSecureApplicationPlugin.swift:53)
12 secure_application             0x6b90 applicationWillResignActive (<compiler-generated>)
13 Flutter                        0x1f0ac -[FlutterPluginAppLifeCycleDelegate handleWillResignActive:] + 196 (FlutterPluginAppLifeCycleDelegate.mm:196)
14 CoreFoundation                 0x89824 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
15 CoreFoundation                 0x89874 ___CFXRegistrationPost1_block_invoke
16 CoreFoundation                 0x88b64 _CFXRegistrationPost1
17 CoreFoundation                 0x88818 ___CFXNotificationPost_block_invoke
18 CoreFoundation                 0x2058 -[_CFXNotificationRegistrar find:object:observer:enumerator:]
19 CoreFoundation                 0x88158 _CFXNotificationPost
20 Foundation                     0x6e2c -[NSNotificationCenter postNotificationName:object:userInfo:]
21 UIKitCore                      0xa63278 -[UIApplication _deactivateForReason:notify:]
22 UIKitCore                      0x1dd204 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:]
23 UIKitCore                      0x1dd6b0 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
24 UIKitCore                      0x1dcf38 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:]
25 UIKitCore                      0x1e1654 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke_2
26 UIKitCore                      0x5c6f8c +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:]
27 UIKitCore                      0x6c222c _UISceneSettingsDiffActionPerformChangesWithTransitionContext
28 UIKitCore                      0x1e1390 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke
29 UIKitCore                      0x6c2114 _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext
30 UIKitCore                      0x1e11e8 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]
31 UIKitCore                      0x47918 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke
32 UIKitCore                      0x46418 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:]
33 UIKitCore                      0x47648 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:]
34 UIKitCore                      0x5edc18 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:]
35 FrontBoardServices             0xdb7c -[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]
36 FrontBoardServices             0x33b68 __88-[FBSWorkspaceScenesClient sceneID:updateWithSettingsDiff:transitionContext:completion:]_block_invoke_2
37 FrontBoardServices             0x17f40 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
38 FrontBoardServices             0x33a84 __88-[FBSWorkspaceScenesClient sceneID:updateWithSettingsDiff:transitionContext:completion:]_block_invoke
39 libdispatch.dylib              0x35ac _dispatch_client_callout
40 libdispatch.dylib              0x633c _dispatch_block_invoke_direct
41 FrontBoardServices             0x596c8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
42 FrontBoardServices             0x59374 -[FBSSerialQueue _queue_performNextIfPossible]
43 FrontBoardServices             0x3d3dc -[FBSWorkspaceFencingImpl synchronizeSystemAnimationFencesWithCleanUpBlock:]
44 FrontBoardServices             0x5c68 -[FBSUIApplicationWorkspaceShim synchronizeSystemAnimationFencesWithCleanUpBlock:]
45 UIKitCore                      0xa671f8 -[UIApplication _synchronizeSystemAnimationFencesWithSpinCleanUpBlock:]
46 UIKitCore                      0xab394c __realPreCommitHandler_block_invoke_3
47 QuartzCore                     0xaef1c CA::Context::commit_transaction(CA::Transaction*, double)
48 QuartzCore                     0xd98c4 CA::Transaction::commit()
49 QuartzCore                     0xda4b4 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
50 CoreFoundation                 0xac11c __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
51 CoreFoundation                 0xa6e4c __CFRunLoopDoObservers
52 CoreFoundation                 0xa72dc __CFRunLoopRun
53 CoreFoundation                 0xa6bc8 CFRunLoopRunSpecific
54 GraphicsServices               0x35cc GSEventRunModal
55 UIKitCore                      0xa6e744 UIApplicationMain
56 Runner                         0x5c98 main + 8 (Double+extension.swift:8)
57 libdyld.dylib                  0x1384 start

Does this issue had already been logged ?

Thx,

Missing license.

I'd like to use this great package in an app but I'd like to know what type of license I'm getting into.

Need help in implementation as I am unable to stop screen capture

I have tried to implement your library as per documentation instructions.
But When I use your demo app , I am unable to capture screen and also any screen recorder app don't capture app screen , just black screen AS it should be.
But In my app it never works.
Please guide me what step I am missing.

My code :

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MultiProvider(
        providers: [
          ChangeNotifierProvider.value(
            value: ProviderCall(),
          ),
        ],
        child: Consumer<ProviderCall>(
            builder: (ctx, auth, _) => MaterialApp(
                  title: AllStrings.appName,
                  theme: new ThemeData(
                    primaryColor: Colors.deepPurple,
                    primarySwatch: Colors.deepPurple,
                    primaryColorDark: Colors.deepPurple,
                    hintColor: Colors.blue,
                  ),
                  debugShowCheckedModeBanner: false,
                  home: SecureApplication(
                      nativeRemoveDelay: 800,
                      onNeedUnlock: (secureApplicationController) async {},
                      child: MyHomePage(title: 'My  App')),
                )));
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  var valueNotifier ;
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    valueNotifier = SecureApplicationProvider.of(context);
    return PickupLayout(
        scaffold: Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SecureGate(
          blurr: 0,
          opacity: 0,
          child: new Center(
            child: new Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                new Row(
                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                  children: <Widget>[
                    new RaisedButton(
                      padding: const EdgeInsets.all(8.0),
                      textColor: Colors.white,
                      color: Colors.blue,
                      onPressed: () => secure(context),
                      child: new Text("Secure"),
                    ),
                    new RaisedButton(
                      onPressed: () => open(context),
                      textColor: Colors.white,
                      color: Colors.red,
                      padding: const EdgeInsets.all(8.0),
                      child: new Text(
                        "Open",
                      ),
                    ),
                  ],
                ),
              ],
            ),
          )),
    ));
  }

  void secure(BuildContext context) {
      valueNotifier.secure();
  }

  void open(BuildContext context) {
    valueNotifier.open();
  }
}

As per my understanding of your library , I want to secure the screen and don't want to lock the screen.
I guess I am missing some step.
Plese guide me to solution.

Issue with the dependency setting

I've tried playing around with this package and ran into a problem getting it to work. I reduced your example to the most basic structure:
main.dart:

return MaterialApp(
  home: SecureApplication(
    nativeRemoveDelay: 1000,
    child: MainBody(),
  ),
);

}
main_body.dart:

var width = MediaQuery.of(context).size.width * 0.8;
return Scaffold(
  appBar: AppBar(
    title: const Text('Secure Window Example'),
  ),
  body: Center(
    child: FlutterLogo(
      size: width,
    ),
  ),
);

}
When I changed the dependency from:

dev_dependencies:
  secure_application:
    path: ../

Screen Shot 2020-08-22 at 10 21 18 AM

to the prescibed:

dependencies:
  secure_application: ^3.5.3

Screen Shot 2020-08-22 at 10 24 14 AM

The blur no longer worked when the app was minimized. I've tried this with a few different configuration and always get the same result. Can you provide any insight into what's going on?

Support Up-to-date dependencies

Currently, this package depends on rxdart ^0.26.0. Can you please update the rxdart version (to rxdart ^0.27.3)? I want to use this package but I cannot install it because of this version issue :( Thank you.

Can I use it to block only screenshots?

Hi,

I'm building an app where we have a mode that should block screenshot when enabled (but the user should be able the use the app normal)

Is there a way to use this library to do it?

type 'List<Widget?>' is not a subtype of type 'List<Widget>' in type cast

flutter: [debug] Capture from onError type 'List<Widget?>' is not a subtype of type 'List<Widget>' in type cast

======== Exception caught by widgets library =======================================================
The following _CastError was thrown building SecureGate(dirty, dependencies: [_EffectiveTickerMode, SecureApplicationProvider], state: _SecureGateState#93e4b(ticker inactive)):
type 'List<Widget?>' is not a subtype of type 'List<Widget>' in type cast

The relevant error-causing widget was: 
  SecureGate file:///Users/ying/workspace/FlutterProjects/gitter/lib/main.dart:297:21
When the exception was thrown, this was the stack: 
#0      _SecureGateState.build (package:secure_application/secure_gate.dart:118:9)
#1      StatefulElement.build (package:flutter/src/widgets/framework.dart:4612:27)
#2      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4495:15)
#3      StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4667:11)
#4      Element.rebuild (package:flutter/src/widgets/framework.dart:4189:5)
...
====================================================================================================

The example in the code does not work properly

The example in the code does not work properly.

Running pod install...                                             815ms
CocoaPods' output:
↳

    [!] Invalid `Podfile` file: no implicit conversion of nil into String.

     #  from /Users/ying/workspace/GitHub/secure_application/example/ios/Podfile:57
     #  -------------------------------------------
     #      unless File.exist?(copied_framework_path)
     >        FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
     #      end
     #  -------------------------------------------

    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:318:in `rescue in block in from_ruby'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:312:in `block in from_ruby'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:50:in `instance_eval'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:50:in `initialize'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:310:in `new'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:310:in `from_ruby'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:276:in `from_file'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/config.rb:205:in `podfile'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:46:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'

Error running pod install
Error launching application on iPhone 12 Pro Max.

No signature of method: build_…android() applicable for argument types: (build_…_run_closure2)

Hello!

I can't build my Flutter app for Android after adding the secure_application package, it crashes with error below:

Build file '/usr/local/Caskroom/flutter/2.2.2/flutter/.pub-cache/hosted/pub.dartlang.org/secure_application-3.7.3/android/build.gradle' line: 27

A problem occurred evaluating project ':secure_application'.
> No signature of method: build_c5ahy1849z3l6msywlxga8k28.android() is applicable for argument types: (build_c5ahy1849z3l6msywlxga8k28$_run_closure2) values: [build_c5ahy1849z3l6msywlxga8k28$_run_closure2@62470d9]

Here is my build.gradle of app module:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 30

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.mobile"
        minSdkVersion 24
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
    buildToolsVersion '30.0.3'
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

build.gradle of project:

buildscript {
    ext.kotlin_version = '1.5.21'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

And pubspec.yaml of Flutter:

name: mobile
description: Mobile

version: 1.0.0+1

environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  intl: ^0.17.0
  cupertino_icons: ^1.0.3
  equatable: ^2.0.3
  flutter_bloc: ^7.0.1
  get_it: ^7.2.0
  hex: ^0.2.0
  path: ^1.8.0
  qr_flutter: ^4.0.0
  qr_code_scanner: ^0.5.2
  secp256k1: ^0.3.0
  sqflite_sqlcipher: ^2.0.0
  sha3: ^0.2.0
  share_plus: ^2.1.4
  shared_preferences: ^2.0.6
  secure_application: ^3.7.3

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner:
  test:

flutter:
  generate: true
  uses-material-design: true
  assets:
    - assets/scripts/sqlite_v1.sql

What am I doing wrong? Where can the problem be?

Crash upon exiting app [onDetachedFromActivity causing kotlin.NotImplementedError]

Hi,

There seems to be an unimplemented method causing a crash when you exit the Android app.
I was able to reproduce it using the provided example main.dart

SecureApplicationPlugin.kt Line 27:

override fun onDetachedFromActivity() {
    TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}

Error log:

D/FlutterView( 3985): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@f9aac6e
D/FlutterActivityAndFragmentDelegate( 3985): Detaching FlutterEngine from the Activity that owns this Fragment.
D/AndroidRuntime( 3985): Shutting down VM
E/AndroidRuntime( 3985): FATAL EXCEPTION: main
E/AndroidRuntime( 3985): Process: com.[redacted], PID: 3985
E/AndroidRuntime( 3985): kotlin.NotImplementedError: An operation is not implemented: not implemented
E/AndroidRuntime( 3985): 	at org.jezequel.secure_application.SecureApplicationPlugin.onDetachedFromActivity(SecureApplicationPlugin.kt:27)
E/AndroidRuntime( 3985): 	at io.flutter.embedding.engine.FlutterEnginePluginRegistry.detachFromActivity(FlutterEnginePluginRegistry.java:339)
E/AndroidRuntime( 3985): 	at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onDetach(FlutterActivityAndFragmentDelegate.java:453)
E/AndroidRuntime( 3985): 	at io.flutter.embedding.android.FlutterActivity.onDestroy(FlutterActivity.java:588)
E/AndroidRuntime( 3985): 	at android.app.Activity.performDestroy(Activity.java:7218)
E/AndroidRuntime( 3985): 	at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1249)
E/AndroidRuntime( 3985): 	at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4370)
E/AndroidRuntime( 3985): 	at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4401)
E/AndroidRuntime( 3985): 	at android.app.ActivityThread.-wrap5(Unknown Source:0)
E/AndroidRuntime( 3985): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1649)
E/AndroidRuntime( 3985): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 3985): 	at android.os.Looper.loop(Looper.java:164)
E/AndroidRuntime( 3985): 	at android.app.ActivityThread.main(ActivityThread.java:6494)
E/AndroidRuntime( 3985): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 3985): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
E/AndroidRuntime( 3985): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

SecureApplicationProvider.of(context) crashes

I've wrapped my app as guided in to SecureApplication

return MaterialApp(
        title: Strings.appName,
        theme: ThemeData(...),
        home: SecureApplication(
          child: SecureGate(
              lockedBuilder: (context, secureApplicationController) =>
                  AuthPage(secureApplicationController),
              child: RatesPage()),
        ),
        navigatorObservers: [
          FirebaseAnalyticsObserver(...)
        ]);

And now after multiple navigations to other pages I'm trying to get instance of SecureApplicaitonController to enable/disable securing

class SecurityPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _SecurityPageState();
}

class _SecurityPageState extends State<SecurityPage> {
  final LocalAuthentication _auth = LocalAuthentication();
  SecurityState _state = SecurityState(null, null);
  SharedPreferences _prefs;

  @override
  void initState() {
    super.initState();
    SharedPreferences.getInstance().then(onPreferencesAcquired);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(...),
      body: SecureGate(
        child: Builder(
          builder: (context) {
            var valueNotifier = SecureApplicationProvider.of(context); // <- Here comes the problems
            return Column(children: _getSettingsList(valueNotifier));
          },
        ),
      ),
    );
  }

And now I'm getting this error:

When the exception was thrown, this was the stack:
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
#1      SecureApplicationProvider.of (package:secure_application/secure_application_provider.dart:24:12)
#2      _SecureGateState.didChangeDependencies (package:secure_application/secure_gate.dart:60:64)
#3      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4705:12)
#4      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4520:5)
...     Normal element mounting (19 frames)
#23     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
#24     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5991:32)
...     Normal element mounting (210 frames)
#234    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
#235    Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
#236    RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5624:32)
#237    MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6001:17)
#238    Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#239    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#240    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#241    Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#242    StatefulElement.update (package:flutter/src/widgets/framework.dart:4751:5)
#243    Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#244    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#245    Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#246    ProxyElement.update (package:flutter/src/widgets/framework.dart:4906:5)
#247    _InheritedNotifierElement.update (package:flutter/src/widgets/inherited_notifier.dart:183:11)
#248    Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#249    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#250    Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#251    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#252    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#253    Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#254    StatefulElement.update (package:flutter/src/widgets/framework.dart:4751:5)
#255    Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#256    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#257    Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#258    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5881:14)
#259    Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#260    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#261    Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#262    StatelessElement.update (package:flutter/src/widgets/framework.dart:4627:5)
#263    Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#264    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#265    Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#266    ProxyElement.update (package:flutter/src/widgets/framework.dart:4906:5)
#267    Element.updateChild (package:flutter/src/widgets/framework.dart:3245:15)
#268    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4571:16)
#269    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
#270    Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
#271    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2667:33)
#272    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:866:20)
#273    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:286:5)
#274    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1117:15)
#275    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1056:9)
#276    SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:972:5)
#280    _invoke (dart:ui/hooks.dart:253:10)
#281    _drawFrame (dart:ui/hooks.dart:211:3)
(elided 3 frames from dart:async)

════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following NoSuchMethodError was thrown building _BodyBuilder:
The getter 'secureData' was called on null.
Receiver: null
Tried calling: secureData

The relevant error-causing widget was: 
  Scaffold file:///Users/kostya1375/FlutterProjects/GodexApp/lib/ui/screen/settings_screen.dart:255:12
When the exception was thrown, this was the stack: 
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
#1      SecureApplicationProvider.of (package:secure_application/secure_application_provider.dart:24:12)
#2      _SecureGateState.didChangeDependencies (package:secure_application/secure_gate.dart:60:64)
#3      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4705:12)
#4      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4520:5)
...

Show toast on screenshot on a secure app

How can I show a toast when the user wants to take a screenshot of my app which is under your very good package? I used the example for testing purposes. Your early response will be highly appreciated.

Compatibility with open_file

I am having compatibility issues when using packages that call native views.

For example, I am having an issue with: open_file
https://pub.dev/packages/open_file

It appears that when a native view is up, then you go home or to the app switcher, you are returned to a blank screen.
I think this is happening because secure_application is dismissing the native view instead of the secure view.

Please advise on how to proceed.

Version Solving failed.

Error while version solving: -

Running "flutter pub get" in meet7-flutter...                   
Because secure_application 3.8.0 depends on rxdart ^0.26.0 and no versions of secure_application match >3.8.0 <4.0.0, secure_application ^3.8.0 requires rxdart ^0.26.0.
So, because meet7 depends on both rxdart ^0.27.3 and secure_application ^3.8.0, version solving failed.
pub get failed (1; So, because meet7 depends on both rxdart ^0.27.3 and secure_application ^3.8.0, version solving failed.)
[15:12:02] [cost 32.283s] fvm flutter pub get

Web implementation

Hey there
I was searching for something that could completely prevent screenshots of my app and found your package
So what I'm asking is this, does it show blur on web when the the browser goes to background?
And if not, can this be done or anything equivalent to locking the app content when it goes to background in web or when the tab is inactive?
Also is there such a thing to prevent screenshots on web when the browsed in a mobile?

How to secure all the pages of the app?

I am trying to develop an app that has multiple screens. Whenever the user goes to the background and then comes to foreground, then I should be prompted to authenticate before going to other screen. I have tried many things but unable to understand how to implement it.
Can you help me on how to do that @neckaros ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.