tkyaji / cordova-plugin-crypt-file

This plugin to encrypt the source files.
Apache License 2.0
178 stars 116 forks source link

Thank you for cordova-plugin-crypt-file #5

Closed seion999 closed 8 years ago

seion999 commented 8 years ago

Thank you very much for cordova-plugin-crypt-file. I have encrypted files(.html, .htm, .js, .css) and run my application.

But, setting up cordova-plugin-device into my application, cordova-plugin-device doesn't work. My cordova version is 5.1.1.

I would appreciate if you could advice this comment. Thank you in advance.

derek82511 commented 8 years ago

I have the same problem about this. Does anyone have solution about this?

Here are my error message which cordova.js occurs:

deviceready has not fired after 5 seconds. Channel not fired: onCordovaConnectionReady Channel not fired: onCordovaInfoReady

Thanks a lot!

EDIT: I got the problem. the script cordova.js should include with "cordova.js" in index.html but the plugin replace it to "android_asset/www/cordova.js"

tkyaji commented 8 years ago

Please tell me the occurrence conditions. android version, cordova version, browser type, etc...

shariajoe commented 8 years ago

derek82511 Kindly share how you solved this issue it is really giving me a headache tkyaji Much Thanks for the plugin seion999 Did you find a solution??

seion999 commented 8 years ago

I apologize for this late reply.

I thank tkyaji and everyone for your amazing help. I'd really appreciate it.

seion999 commented 8 years ago

Hi, shariajoe, I do not find any solution.

At the time I opened this thread, I tried hard to take care the problem. But now, I'm afraid I gave up this problem-solving.

shariajoe commented 8 years ago

seion999 Thanks for responding i just started on this, let me keep on brainstorming i'll alert should I find a solution

derek82511 commented 8 years ago

Just do not encrypt and decrypt your cordova.js file. You can skip encrypt and decrypt it in your hooks file and DecryptResource.java

Hope this help !

seion999 commented 8 years ago

Thanks, derek82511.

I have tried your help. Unfortunately, the result is the same: cordova-plugin-device doesn't work.

My developing environment is that: Android 4.4.2 Cordova version 5.1.1 No use of crosswalk

vincentFA commented 8 years ago

Hi seion999,

did you find a solution ?

seion999 commented 8 years ago

Hi vincentFA,

No, I didn't. This plugin doesn't work on Android os, but, it will work well on iOS because I have checked the correct behavior of it using iOS simulator in xcode7.

vincentFA commented 8 years ago

Hi seion999,

I find a solution, but may be not safe. Are you still interessted ?

Vincent

seion999 commented 8 years ago

THX, Vincent, I have interest with your solution. Your solution will help everyone understand Cordova plugin.

vincentFA commented 8 years ago

So edit the file \platforms\android\CordovaLib\src\org\apache\cordova\CordovaBridge.java

and coment some lines :

        else if (defaultValue != null && defaultValue.startsWith("gap_init:")) {
            // Protect against random iframes being able to talk through the bridge.
            // Trust only pages which the app would have been allowed to navigate to anyway.
            //if (pluginManager.shouldAllowBridgeAccess(origin)) {
                // Enable the bridge
                int bridgeMode = Integer.parseInt(defaultValue.substring(9));
                jsMessageQueue.setBridgeMode(bridgeMode);
                // Tell JS the bridge secret.
                int secret = generateBridgeSecret();
                return ""+secret;
            //} else {
            //    Log.e(LOG_TAG, "gap_init called from restricted origin: " + origin);
            //}
            //return "";
        }
        return null;
    }   
}   

Not sure this is safe

seion999 commented 8 years ago

THX, vincentFA,

I have tried checking the plugin after implementing your solution. Then, the plugin works well on Android.

I think your idea is an excellent one.