Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6B29417A73 for ; Tue, 17 Mar 2015 15:07:23 +0000 (UTC) Received: (qmail 79572 invoked by uid 500); 17 Mar 2015 15:07:23 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 79534 invoked by uid 500); 17 Mar 2015 15:07:23 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 79522 invoked by uid 99); 17 Mar 2015 15:07:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Mar 2015 15:07:22 +0000 X-ASF-Spam-Status: No, hits=2.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of csantana23@gmail.com designates 209.85.214.172 as permitted sender) Received: from [209.85.214.172] (HELO mail-ob0-f172.google.com) (209.85.214.172) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Mar 2015 15:07:18 +0000 Received: by obfv9 with SMTP id v9so9318182obf.2 for ; Tue, 17 Mar 2015 08:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=48OXaq494RiPkNUZsu7yRlWQ6rfc2spBcOkZUErFXRw=; b=YOfUgxWSWEh3z0KA9vr9wI3DlSgQOdlAqkl5iR/VKCMO0ROR2TbVdWAV+tij8ODhyJ GU3c1uCPVGEfigPLZ2EhanN8bjdfRc4m6ZSwsDGLm+xYGj2TfpkYAmICOTc6VRK7y4c6 SS4LjdfJAGM1QQEkQfp4GYRfO4t/QaU8gn2bv2JzBRRTmTLalWAhGPFgQKpkMBMIVnqb czgcg4xrQkUwpGVMvYdf+TV8ipm+7tr4kmEp1Zg49CaUwjVSBTZX9oul9j0LtGfmlmH5 jwtHGldt4cDUiNBKnt+nip0/XI2YoePN14TB4gpezpNIOk5z7HIDRAx2wrZ+84hqu0zD AM4Q== MIME-Version: 1.0 X-Received: by 10.182.144.136 with SMTP id sm8mr52882372obb.63.1426604818050; Tue, 17 Mar 2015 08:06:58 -0700 (PDT) Received: by 10.60.29.38 with HTTP; Tue, 17 Mar 2015 08:06:57 -0700 (PDT) In-Reply-To: References: Date: Tue, 17 Mar 2015 11:06:57 -0400 Message-ID: Subject: Re: Deprecation of Config and the embedded use case (4.0.x related) From: Carlos Santana To: "dev@cordova.apache.org" Content-Type: multipart/alternative; boundary=089e0149cd5e6a58bf05117d5191 X-Virus-Checked: Checked by ClamAV on apache.org --089e0149cd5e6a58bf05117d5191 Content-Type: text/plain; charset=UTF-8 Andrew similar requirement we have for iOS. If we implement something like that in CLI to have an option to produce a library instead of an App. In theory this is something we have discussed here in IBM, to do something similar with Cocoa Pods, produce a cocoapod that represent the iOS Cordova Web View to be easily added to a existing iOS Native App and using Pod is an easy way to be added and managed. On Tue, Mar 17, 2015 at 11:03 AM, Carlos Santana wrote: > Andrew where is this new enhancements documented, Only place I can find > any documentation is here: > http://cordova.apache.org/docs/en/4.0.0/guide_platforms_android_webview.md.html#Android%20WebViews > > Can you update this Docs? > > In addition to having the docs updated I think it will be great beneficial > if one the Android Gurus do a blog post with tutorial style, from end to > end on how to do this, and a quick video would not hurt also ;-) > > > On Tue, Mar 17, 2015 at 10:57 AM, Andrew Grieve > wrote: > >> On Tue, Mar 17, 2015 at 10:10 AM, Carlos Santana >> wrote: >> >> > @Michal >> > I would get together with Marcel and Martin, they are our Android goto >> SME >> > >> > @Joe >> > Do we have all the test cases created now are some missing? >> > How do you run this specific test cases on Android Studio? Google team >> any >> > help on gradle to run this test cases on CI I think is very important to >> > have a healhty CI running test cases on every pull request or commit >> > >> I've already ported the unit test over to gradle and they are easy to run >> in Android Studio. There are some instructions in the test/README.md >> >> To be clear, the embedding ability was *improved* in 3.7.0, in that you >> can >> now control all configurations directly from Java. >> >> >> >> > >> > Hum I don't know how I feel about the Plugins not working, I think this >> is >> > the key on using Cordova. >> > If I'm just going to have a Web View with no Cordova then I would use In >> > App Browser. >> > >> > The whole purpose of Including a "Cordova" Web View in to a full Native >> > Android App, It's the "Cordova" functionality which resides mostly in >> the >> > Plugins! >> > Maybe I misunderstood your statements about plugins not working. >> > >> > >> > >> > On Mon, Mar 16, 2015 at 9:31 PM, Joe Bowser wrote: >> > >> > > Well, this feature was tested using TDD, and when the tests were >> > re-written >> > > I assumed that they would be run. In this case, I'll blame Android >> > Studio, >> > > since we're still battling with the learning curve on that one. (I >> have >> > no >> > > clue how to run the new tests from Gradle on the command line, only in >> > > Android Studio). >> > > >> > > The thing is that another refactor removing layouts broke the tests, >> > which >> > > is how I know that they weren't run. So, I landed a couple of >> commits to >> > > refactor the unit tests so that they test this use case with the new >> API >> > > and the tests now pass. This works again, and we can update the >> > > documentation, >> > > >> > > There's still the matter of getting the plugins to work, but I'm fine >> > with >> > > leaving that to be an exercise for the downstreams that support this, >> and >> > > not Cordova itself. >> > > >> > > >> > > >> > > On Mon, Mar 16, 2015 at 6:27 PM Michal Mocny >> > wrote: >> > > >> > > > Carlos, thats great, then perhaps you could give 4.0 embedded >> webview a >> > > > shot to confirm that it is still adequately supported for your >> > customers? >> > > > >> > > > I think this thread has been too much talk and not enough trying it >> out >> > > in >> > > > practice. Everyone agrees the use case is important, what's left >> is to >> > > > confirm we got it right. >> > > > >> > > > -Michal >> > > > >> > > > On Mon, Mar 16, 2015 at 8:58 PM, Carlos Santana < >> csantana23@gmail.com> >> > > > wrote: >> > > > >> > > > > I just want to add that Joe is not alone on thinking that are >> > > developers >> > > > > with this use case. >> > > > > For us we have customers that start with Native Android alone, and >> > then >> > > > > later want to add a Cordova Web View to a portion of their App. >> > > > > And they want an easy way to add a Cordova Web View. >> > > > > For 4.x, I would assume that the developer can choose to make this >> > > > embedded >> > > > > Cordova Web View CrossWalk based. >> > > > > >> > > > > >> > > > > On Wed, Mar 11, 2015 at 10:24 AM, Joe Bowser >> > > wrote: >> > > > > >> > > > > > That's why we have tests! I just changed the activity and saw >> that >> > we >> > > > > have >> > > > > > one failure. I'm not sure why this test in particular is >> failing, >> > > > since >> > > > > > there's too many assertions in one method, so I'll have to try >> and >> > > > debug >> > > > > it >> > > > > > today. >> > > > > > >> > > > > > The thing is that if we're deprecating something and replacing >> it >> > > with >> > > > > > something else, we should write tests for it. Releasing a 4.0.x >> > and >> > > > > > changing how we embed a WebView by changing class names but not >> > > fixing >> > > > up >> > > > > > the deprecation is bizzare. >> > > > > > >> > > > > > On Wed, Mar 11, 2015 at 7:15 AM Andrew Grieve < >> > agrieve@chromium.org> >> > > > > > wrote: >> > > > > > >> > > > > > > I wanted to make sure that I didn't break the old way of doing >> > > > things. >> > > > > > > >> > > > > > > On Tue, Mar 10, 2015 at 2:24 PM, Joe Bowser < >> bowserj@gmail.com> >> > > > wrote: >> > > > > > > >> > > > > > > > The main issue is that this isn't documented anywhere, and >> this >> > > is >> > > > > > > > necessary for people to use a Third Party WebView. Also, >> why >> > > > didn't >> > > > > > you >> > > > > > > > bother updating the test with the new API? >> > > > > > > > >> > > > > > > > On Mon, Mar 9, 2015 at 5:19 PM Andrew Grieve < >> > > agrieve@chromium.org >> > > > > >> > > > > > > wrote: >> > > > > > > > >> > > > > > > > > Here's an example: >> > > > > > > > > >> > > > > > > > > ConfigXmlParser parser = new ConfigXmlParser(); >> > > > > > > > > parser.parse(activity); >> > > > > > > > > webView.init(cordova, parser.getPluginEntries(), >> > > > > > > > parser.getPreferences()); >> > > > > > > > > >> > > > > > > > > Feel free to iterate if you think the API is too obtuse, >> but >> > I >> > > > > think >> > > > > > > it's >> > > > > > > > > good to allow a file-less mode, and to allow different >> > WebViews >> > > > to >> > > > > > have >> > > > > > > > > different settings. >> > > > > > > > > >> > > > > > > > > >> > > > > > > > > >> > > > > > > > > >> > > > > > > > > On Mon, Mar 9, 2015 at 8:08 PM, Joe Bowser < >> > bowserj@gmail.com> >> > > > > > wrote: >> > > > > > > > > >> > > > > > > > > > Do you have an example of how this would work? This >> seems >> > to >> > > > be a >> > > > > > lot >> > > > > > > > > more >> > > > > > > > > > complex than it needs to be. >> > > > > > > > > > >> > > > > > > > > > On Mon, Mar 9, 2015 at 5:05 PM Andrew Grieve < >> > > > > agrieve@chromium.org >> > > > > > > >> > > > > > > > > wrote: >> > > > > > > > > > >> > > > > > > > > > > It's so that you can have multiple CordovaWebViews >> that >> > use >> > > > > > > different >> > > > > > > > > > > configs within one application. It's also so that you >> > don't >> > > > > have >> > > > > > to >> > > > > > > > > have >> > > > > > > > > > a >> > > > > > > > > > > config.xml if you prefer to build up your config in >> code >> > > > > instead. >> > > > > > > > > > > >> > > > > > > > > > > I don't think loadConfig() is deprecated. It has >> > > > > > > > > > > a @SuppressWarnings("deprecation"), which just >> silences a >> > > > > warning >> > > > > > > > > about >> > > > > > > > > > it >> > > > > > > > > > > setting the config of the Config class (which is done >> for >> > > > > > backwards >> > > > > > > > > > > compatibility). >> > > > > > > > > > > >> > > > > > > > > > > >> > > > > > > > > > > On Mon, Mar 9, 2015 at 3:54 PM, Joe Bowser < >> > > > bowserj@gmail.com> >> > > > > > > > wrote: >> > > > > > > > > > > >> > > > > > > > > > > > OK, this actually makes using the WebView as a >> > component >> > > a >> > > > > lot >> > > > > > > > > harder, >> > > > > > > > > > > > since you now have to have this loadConfig method >> which >> > > you >> > > > > > also >> > > > > > > > > marked >> > > > > > > > > > > for >> > > > > > > > > > > > deprecation required to get all of the necessary >> > > attributes >> > > > > out >> > > > > > > of >> > > > > > > > > > this. >> > > > > > > > > > > > I'm pretty sure this is a major step backwards in >> that >> > > > people >> > > > > > > > looking >> > > > > > > > > > to >> > > > > > > > > > > > use Cordova as a component now have to jump through >> > > > > additional >> > > > > > > > hoops >> > > > > > > > > to >> > > > > > > > > > > get >> > > > > > > > > > > > this to work. What is the benefit of deprecating >> the >> > > > Config >> > > > > > > static >> > > > > > > > > > class >> > > > > > > > > > > > and replacing it with the ConfigXmlParser again? I >> > don't >> > > > > > remember >> > > > > > > > why >> > > > > > > > > > > this >> > > > > > > > > > > > was done. >> > > > > > > > > > > > >> > > > > > > > > > > > On Mon, Mar 9, 2015 at 9:04 AM Andrew Grieve < >> > > > > > > agrieve@chromium.org >> > > > > > > > > >> > > > > > > > > > > wrote: >> > > > > > > > > > > > >> > > > > > > > > > > > > On Mon, Mar 9, 2015 at 11:56 AM, Joe Bowser < >> > > > > > bowserj@gmail.com >> > > > > > > > >> > > > > > > > > > wrote: >> > > > > > > > > > > > > >> > > > > > > > > > > > > > On Mon, Mar 9, 2015 at 7:39 AM Andrew Grieve < >> > > > > > > > > agrieve@chromium.org >> > > > > > > > > > > >> > > > > > > > > > > > > wrote: >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > > You can now instantiate a CordovaWebView >> without >> > a >> > > > > > > > config.xml, >> > > > > > > > > > and >> > > > > > > > > > > > > > without >> > > > > > > > > > > > > > > using Config. This happened when I added an >> > > "init()" >> > > > > > method >> > > > > > > > to >> > > > > > > > > > > > > > > CordovaWebView. You can pass in a >> > > CordovaPreferences >> > > > > > > object, >> > > > > > > > > and >> > > > > > > > > > a >> > > > > > > > > > > > list >> > > > > > > > > > > > > > of >> > > > > > > > > > > > > > > PluginEntry. Maybe we just need a better >> comment >> > on >> > > > > > Config >> > > > > > > > > saying >> > > > > > > > > > > to >> > > > > > > > > > > > > use >> > > > > > > > > > > > > > > these instead? >> > > > > > > > > > > > > > > >> > > > > > > > > > > > > > > >> > > > > > > > > > > > > > Where does one get this PluginEntry list when >> > they're >> > > > > > > > embedding a >> > > > > > > > > > > > > WebView? >> > > > > > > > > > > > > > This needs to be documented or at least put in >> the >> > > test >> > > > > > that >> > > > > > > > > tests >> > > > > > > > > > > this >> > > > > > > > > > > > > use >> > > > > > > > > > > > > > case. >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > > > That has nothing to do with InAppBrowser, >> this >> > is >> > > > to >> > > > > do >> > > > > > > > with >> > > > > > > > > > > > > embedding >> > > > > > > > > > > > > > a >> > > > > > > > > > > > > > > > WebView inside an Android application. I >> don't >> > > > think >> > > > > > you >> > > > > > > > > > > understand >> > > > > > > > > > > > > > what >> > > > > > > > > > > > > > > I >> > > > > > > > > > > > > > > > mean when I say the embedded use case. >> > > > > > > > > > > > > > > > >> > > > > > > > > > > > > > > Maybe try explaining a bit more? >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Even though you edited the test that explicitly >> > > covers >> > > > > this >> > > > > > > > use, >> > > > > > > > > > > case, >> > > > > > > > > > > > > and >> > > > > > > > > > > > > > even though we've talked about using >> CordovaWebView >> > > as >> > > > an >> > > > > > > > Android >> > > > > > > > > > > View >> > > > > > > > > > > > > for >> > > > > > > > > > > > > > over a year, you need it explained more? >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > So, not everyone wants to use all of Cordova, >> for >> > > many >> > > > > > > reasons. >> > > > > > > > > > > > Instead, >> > > > > > > > > > > > > > they really just want to take advantage of the >> > > WebView >> > > > > > > > component >> > > > > > > > > in >> > > > > > > > > > > > their >> > > > > > > > > > > > > > native apps so that they can create hybrid apps >> > that >> > > > are >> > > > > > > mostly >> > > > > > > > > > > native >> > > > > > > > > > > > > with >> > > > > > > > > > > > > > only some parts that use Cordova. This is where >> > you >> > > > > would >> > > > > > > > > declare >> > > > > > > > > > > your >> > > > > > > > > > > > > > view in your layout XML like this: >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > android:id="@+id/WebViewComponent" >> > > > > > > > > > > > > > android:layout_width="match_parent" >> > > > > > > > > > > > > > >> android:layout_height="match_parent"> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > And then, in the activity start up your view >> like >> > > this: >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > private CordovaWebView webInterface; >> > > > > > > > > > > > > > private CordovaInterfaceImpl systemInterface = >> > new >> > > > > > > > > > > > > > CordovaInterfaceImpl(this); >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > //Set up the webview >> > > > > > > > > > > > > > SystemWebView webView = (SystemWebView) >> > > > > > > > > > > > > > findViewById(R.id.WebViewComponent); >> > > > > > > > > > > > > > webInterface = new >> CordovaWebViewImpl(this, >> > > new >> > > > > > > > > > > > > > SystemWebViewEngine(webView)); >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Config.init(); >> > > > > > > > > > > > > > webInterface.init(systemInterface, >> > > > > > > > > > > Config.getPluginEntries(), >> > > > > > > > > > > > > > Config.getPreferences()); >> > > > > > > > > > > > > > webView.loadUrl(Config.getStartUrl()); >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Right now, we're getting the configuration from >> the >> > > > > Config >> > > > > > > > class, >> > > > > > > > > > > > because >> > > > > > > > > > > > > > we at least have access to this. If we don't >> have >> > > > this, >> > > > > > how >> > > > > > > do >> > > > > > > > > > > people >> > > > > > > > > > > > > get >> > > > > > > > > > > > > > access to the list of plugin entries specified >> in >> > > > > > Config.xml? >> > > > > > > > > I'm >> > > > > > > > > > > > pretty >> > > > > > > > > > > > > > sure we still want to support this feature. >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Does that make sense? >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >> > > > > > > > > > > > > I gotcha. So, I think the answer is to use >> > > > > ConfigXmlParser() >> > > > > > to >> > > > > > > > > > extract >> > > > > > > > > > > > the >> > > > > > > > > > > > > information required by init. You shouldn't need >> the >> > > call >> > > > > > > > > > Config.init() >> > > > > > > > > > > > at >> > > > > > > > > > > > > all. >> > > > > > > > > > > > > >> > > > > > > > > > > > >> > > > > > > > > > > >> > > > > > > > > > >> > > > > > > > > >> > > > > > > > >> > > > > > > >> > > > > > >> > > > > >> > > > > >> > > > > >> > > > > -- >> > > > > Carlos Santana >> > > > > >> > > > > >> > > > >> > > >> > >> > >> > >> > -- >> > Carlos Santana >> > >> > >> > > > > -- > Carlos Santana > > -- Carlos Santana --089e0149cd5e6a58bf05117d5191--