Re: iOS 13.x User Agent Shows iPad as Macintosh

2020-03-07 Thread Ronald Rosell via 4D_Tech
Hi Tom,

If your code is assessing the userAgent in the On Web Connection database 
method then you’d have an issue, because the code I provided relies upon 
testing the browser’s ability to  create a TouchEvent.  4D wouldn’t have a way 
to test that directly, but the browser can report its results back to the 
database.

If there’s a landing page for your site where people first log in, you could 
add some Javascript to that page that executes the code I provided to test for 
iOS v13 emulating Mac Safari.  If that returns true, you’d then need to track 
that information somehow.  You could keep it in a cookie, for example, and read 
that cookie in On Web Connection.  Or if 4D is managing sessions for you, you 
could store it it a process variable.  Or the browser could redirect the user 
to a different page on your site that is reserved as a starting point for iOS 
sessions.  (Again, keep in mind that you should also be supporting mobile 
displays on Android.). 

How exactly you’d handle it depends on aspects of your system design that I’d 
be wildly guessing about.  But the bottom line is you’d want to have the 
browser run the code that’s testing document.createEvent(“TouchEvent”), and 
then return the result to your back-end system, as a variable or a page 
request, to indicate that they’re running an iOS device.

If the only concern is page size as opposed to software features specific to 
iOS … that is, you want to present menus and so on that are optimized for 
mobile display … then rather than testing for iOS you might consider testing 
for the display size.  There are many ways to approach this, but here’s a good 
starting point (see the second recommended solution):

https://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-mobile-device
 


I hope this helps!

Ron
__

Ron Rosell
President
StreamLMS

301-3537 Oak Street
Vancouver, BC V6H 2M1
Canada

Direct phone (all numbers reach me)
Vancouver: (+1) (604) 628-1933  |  Seattle: (+1) (425) 956-3570  |  Palm Beach: 
(+1) (561) 351-6210 
email: r...@streamlms.com   |  fax: (+1) (815) 
301-9058  |  Skype: ronrosell

> On Mar 7, 2020, at 5:04 PM, Tom Benedict  wrote:
> 
> Hmmm.. I’m not very web savvy so I’m not quite understanding how this works.
> 
> In our app, when a user enters a URL in their browser, code in the On Web 
> Connection database method in our app parses the HTTP header and gets the 
> UserAgent value, then it serves either a desktop or a mobile html page. So 
> the browser detection is in 4D, not on the web page. How would I do browser 
> detection on a web page? It seems like this might be a significant 
> architecture change.
> 
> Tom
> 

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: iOS 13.x User Agent Shows iPad as Macintosh

2020-03-07 Thread Chip Scheide via 4D_Tech

> 
> As always, I recommend a pot of coffee and suitable mood music before 
> starting.
Metallica, Pantera, Rob Zombie come to mind...
 :)

Chip

Hell is other people 
 Jean-Paul Sartre
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: iOS 13.x User Agent Shows iPad as Macintosh

2020-03-07 Thread Tom Benedict via 4D_Tech
Hmmm.. I’m not very web savvy so I’m not quite understanding how this works.

In our app, when a user enters a URL in their browser, code in the On Web 
Connection database method in our app parses the HTTP header and gets the 
UserAgent value, then it serves either a desktop or a mobile html page. So the 
browser detection is in 4D, not on the web page. How would I do browser 
detection on a web page? It seems like this might be a significant architecture 
change.

Tom

> On Mar 7, 2020, at 16:23, Ronald Rosell  wrote:
> 
> Hi Tom,
> 
> Only necessary on web pages that need to differentiate between iOS and other 
> operating systems/browsers.  (Keep in mind, there are other mobile browsers 
> out there … Chrome on Android, for example.  So you shouldn’t be using 
> iPad/iPhone detection code just to determine if you’re working with a small 
> screen.)
> 
> We use it on pages that have embedded video, since the native iOS video 
> player works better on iOS devices than our standard player does.
> 
> It’s a good idea, generally, to have a single JS file that contains any 
> javascript routines that are commonly used across your site … and other JS 
> files that are specific to certain pages.  Browser detection may fall in the 
> former or latter category, depending on what you’re doing.  If you’ve 
> historically been using a browser detector somewhere that looked for the 
> iPhone/iPad userAgent, this code would go in to replace (really, to augment) 
> that.  If that detection code is actually spread across multiple pages, you 
> could either a) use this opportunity to put it in a single JS file and have 
> those pages reference that file, or b) use a program like BBEdit or 
> Dreamweaver to find those files and replace the code in each of them.
> 
> As always, I recommend a pot of coffee and suitable mood music before 
> starting.
> 
> Ron
> __
> 
> Ron Rosell
> President
> StreamLMS
> 
> 
>> On Mar 7, 2020, at 3:06 PM, Tom Benedict > > wrote:
>> 
>> Thanks Ron.
>> 
>> That looks like Javascript code. Do I need to add this to all my web pages?
>> 
>> Tom
> 

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Another Signing/Notarization Question

2020-03-07 Thread Keisuke Miyako via 4D_Tech
Hello,

in your posts,

you say that you

"tried to codesign the file as part of the app’s signing process, but haven’t 
had any luck with that"

and that you've

"tried several variations of signing the file, but haven’t had any luck."

but you do not describe at all, what you did that did not work for you.

---

as a test,
I added a text file under 4D.app/Contents/
but I don't see any issues with code signing, notarisation or stapling.

https://github.com/miyako/4d-utility-build-application/releases/tag/0.0.1

the code I used is here:

https://github.com/miyako/4d-utility-build-application

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: iOS 13.x User Agent Shows iPad as Macintosh

2020-03-07 Thread Ronald Rosell via 4D_Tech
Hi Tom,

Only necessary on web pages that need to differentiate between iOS and other 
operating systems/browsers.  (Keep in mind, there are other mobile browsers out 
there … Chrome on Android, for example.  So you shouldn’t be using iPad/iPhone 
detection code just to determine if you’re working with a small screen.)

We use it on pages that have embedded video, since the native iOS video player 
works better on iOS devices than our standard player does.

It’s a good idea, generally, to have a single JS file that contains any 
javascript routines that are commonly used across your site … and other JS 
files that are specific to certain pages.  Browser detection may fall in the 
former or latter category, depending on what you’re doing.  If you’ve 
historically been using a browser detector somewhere that looked for the 
iPhone/iPad userAgent, this code would go in to replace (really, to augment) 
that.  If that detection code is actually spread across multiple pages, you 
could either a) use this opportunity to put it in a single JS file and have 
those pages reference that file, or b) use a program like BBEdit or Dreamweaver 
to find those files and replace the code in each of them.

As always, I recommend a pot of coffee and suitable mood music before starting.

Ron
__

Ron Rosell
President
StreamLMS


> On Mar 7, 2020, at 3:06 PM, Tom Benedict  wrote:
> 
> Thanks Ron.
> 
> That looks like Javascript code. Do I need to add this to all my web pages?
> 
> Tom

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: iOS 13.x User Agent Shows iPad as Macintosh

2020-03-07 Thread Tom Benedict via 4D_Tech
Thanks Ron.

That looks like Javascript code. Do I need to add this to all my web pages?

Tom

> On Mar 7, 2020, at 13:32, Ronald Rosell via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Tom,
> 
> Here’s how we handled it.  Basically it does a userAgent text, but follows 
> that up with an additional check for creating a TouchEvent if the userAgent 
> includes “Macintosh”, as it will if iOS is emulating Safari on a Mac.
> 
> This may fail when touchscreen Macs appear, but for now it does the trick:
> 
> function testios(){
>//test for iOS
>var ua = window.navigator.userAgent;
>var testiOS = /iPad|iPhone|iPod/.test(ua) && !window.MSStream;
>if(testiOS){
>return true;
>}
>//iOS v13 emulating Mac Safari:
>if (ua.indexOf('Macintosh') > -1) {
>try {
>document.createEvent("TouchEvent");
>console.log("tryiOS")
>return true;
>} catch (e) {}
>}
>return false;
> }
> 
> var iOS = testios();
> __
> 
> Ron Rosell
> President
> StreamLMS
> 
> 
>> On Mar 6, 2020, at 12:12 PM, Tom Benedict via 4D_Tech <4d_tech@lists.4d.com> 
>> wrote:
>> 
>> In iOS v13.x there is a new feature, called “Request Desktop Website”, which 
>> allows iPads and iPhones to pretend that they are desktop devices. It does 
>> this by returning a value in the UserAgent included in the HTTP Header which 
>> indicates “Macintosh" instead of “iPad" or “iPhone”. This new feature 
>> defaults to “On” in iOS13.x.
>> 
>> The application I am supporting serves different HTML pages depending on 
>> whether a desktop or mobile device is detected during On Web Authentication. 
>> Currently our code parses the User Agent value returned by WEB GET HTTP 
>> HEADER to determine whether a desktop or a mobile page should be sent. Now 
>> that that approach is unreliable, I’m looking for another way to determine 
>> the hardware platform. I need something which I can reference with server 
>> side 4D code.
>> 
>> What do others do in this case? 
>> 
>> Thanks,
>> 
>> Tom Benedict

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: JSON File To Object

2020-03-07 Thread Kirk Brooks via 4D_Tech
Steve,
$text:=Document to text()
$obj:=JSON Parse($text)

On Sat, Mar 7, 2020 at 1:43 PM Stephen J. Orth via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> I'm having a brain-fart and looking for the fastest way to get a JSON
> formatted document imported and put into an object.
>
> Any insight would be appreciated!
>
> Best,
>
>
> Steve
>
> *
>   Stephen J. Orth
>   The Aquila Group, Inc.  Office:  (608) 834-9213
>   P.O. Box 690   Mobile:  (608) 347-6447
>   Sun Prairie, WI 53590
>
>   E-Mail:  s.o...@the-aquila-group.com
> *
>
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
Kirk Brooks
San Francisco, CA
==
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

JSON File To Object

2020-03-07 Thread Stephen J. Orth via 4D_Tech
I'm having a brain-fart and looking for the fastest way to get a JSON
formatted document imported and put into an object.

Any insight would be appreciated!

Best,


Steve

*
  Stephen J. Orth
  The Aquila Group, Inc.  Office:  (608) 834-9213
  P.O. Box 690   Mobile:  (608) 347-6447
  Sun Prairie, WI 53590

  E-Mail:  s.o...@the-aquila-group.com
*


**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: iOS 13.x User Agent Shows iPad as Macintosh

2020-03-07 Thread Ronald Rosell via 4D_Tech
… does a userAgent test* (oops), then checks for TouchEvent.

In any event, modifying our browser detection code this way solved the problem 
for us.  The !window.MSStream is in there because Microsoft injected “iPhone" 
into IE11’s user agent on Windows Phone. (Does anyone use Windows Phone?)

Note that the console.log line can be removed if you like.

Ron

> On Mar 7, 2020, at 1:32 PM, Ronald Rosell  wrote:
> 
> Tom,
> 
> Here’s how we handled it.  Basically it does a userAgent text, but follows 
> that up with an additional check for creating a TouchEvent if the userAgent 
> includes “Macintosh”, as it will if iOS is emulating Safari on a Mac.
> 
> This may fail when touchscreen Macs appear, but for now it does the trick:
> 
> function testios(){
> //test for iOS
> var ua = window.navigator.userAgent;
> var testiOS = /iPad|iPhone|iPod/.test(ua) && !window.MSStream;
> if(testiOS){
> return true;
> }
> //iOS v13 emulating Mac Safari:
> if (ua.indexOf('Macintosh') > -1) {
> try {
> document.createEvent("TouchEvent");
> console.log("tryiOS")
> return true;
> } catch (e) {}
> }
> return false;
> }
> 
>  var iOS = testios();
> __
> 
> Ron Rosell
> President
> StreamLMS
> 
> 
>> On Mar 6, 2020, at 12:12 PM, Tom Benedict via 4D_Tech <4d_tech@lists.4d.com 
>> > wrote:
>> 
>> In iOS v13.x there is a new feature, called “Request Desktop Website”, which 
>> allows iPads and iPhones to pretend that they are desktop devices. It does 
>> this by returning a value in the UserAgent included in the HTTP Header which 
>> indicates “Macintosh" instead of “iPad" or “iPhone”. This new feature 
>> defaults to “On” in iOS13.x.
>> 
>> The application I am supporting serves different HTML pages depending on 
>> whether a desktop or mobile device is detected during On Web Authentication. 
>> Currently our code parses the User Agent value returned by WEB GET HTTP 
>> HEADER to determine whether a desktop or a mobile page should be sent. Now 
>> that that approach is unreliable, I’m looking for another way to determine 
>> the hardware platform. I need something which I can reference with server 
>> side 4D code.
>> 
>> What do others do in this case? 
>> 
>> Thanks,
>> 
>> Tom Benedict
>> 

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: iOS 13.x User Agent Shows iPad as Macintosh

2020-03-07 Thread Ronald Rosell via 4D_Tech
Tom,

Here’s how we handled it.  Basically it does a userAgent text, but follows that 
up with an additional check for creating a TouchEvent if the userAgent includes 
“Macintosh”, as it will if iOS is emulating Safari on a Mac.

This may fail when touchscreen Macs appear, but for now it does the trick:

function testios(){
//test for iOS
var ua = window.navigator.userAgent;
var testiOS = /iPad|iPhone|iPod/.test(ua) && !window.MSStream;
if(testiOS){
return true;
}
//iOS v13 emulating Mac Safari:
if (ua.indexOf('Macintosh') > -1) {
try {
document.createEvent("TouchEvent");
console.log("tryiOS")
return true;
} catch (e) {}
}
return false;
}

 var iOS = testios();
__

Ron Rosell
President
StreamLMS


> On Mar 6, 2020, at 12:12 PM, Tom Benedict via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> In iOS v13.x there is a new feature, called “Request Desktop Website”, which 
> allows iPads and iPhones to pretend that they are desktop devices. It does 
> this by returning a value in the UserAgent included in the HTTP Header which 
> indicates “Macintosh" instead of “iPad" or “iPhone”. This new feature 
> defaults to “On” in iOS13.x.
> 
> The application I am supporting serves different HTML pages depending on 
> whether a desktop or mobile device is detected during On Web Authentication. 
> Currently our code parses the User Agent value returned by WEB GET HTTP 
> HEADER to determine whether a desktop or a mobile page should be sent. Now 
> that that approach is unreliable, I’m looking for another way to determine 
> the hardware platform. I need something which I can reference with server 
> side 4D code.
> 
> What do others do in this case? 
> 
> Thanks,
> 
> Tom Benedict
> 
> 
> 
> 
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Another Signing/Notarization Question

2020-03-07 Thread Cannon Smith via 4D_Tech
Hi Jim,

Thanks for the ideas. I tried to codesign the file as part of the app’s signing 
process, but haven’t had any luck with that working. The alias idea is 
intriguing. I’m going to look into that.

Thanks.

--
Cannon Smith
Synergy Farm Solutions Inc.



> On Mar 7, 2020, at 8:17 AM, James Crate via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Will the other apps work if you create an alias in the Contents folder and 
> move the file to the Resources folder? I’m not sure how 4D’s commands work 
> with aliases, or whether aliases need to be signed.
> 
>> So I’m wondering if there is a way to sign this file during the signing 
>> process. I’ve tried several variations of signing the file, but haven’t had 
>> any luck. I’m hoping someone knows of a way to sign a file like this so I 
>> don’t have to go down the difficult road of moving the file to another place.
> 
> My impression based on nothing more than all sample signing code I’ve seen 
> has done it this way, is that all subdirectory items must be signed before 
> the app bundle. So if you have to force sign the file, you likely have to 
> resign the app. But, you probably wouldn’t have to re-sign all other 
> sub-items like plugins and other bundles. So after the app is built, you 
> could run a script that signs that file and the app again.  So maybe 
> something like:

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Another Signing/Notarization Question

2020-03-07 Thread James Crate via 4D_Tech
On Mar 6, 2020, at 5:24 PM, Cannon Smith via 4D_Tech <4d_tech@lists.4d.com> 
wrote:
> 
> Thanks to Miyako and Rob Laveaux updating some plugins I use, and other help, 
> I now have all but one of my applications notarizing again since the recent 
> Apple changes. The problem with the last application is that some years ago I 
> started placing a small blob file (compressed XML, not an executable) just 
> inside the Contents folder during a build. Of course, the recent rules don’t 
> like files being inside the Contents folder.
> 
> I’m loathe to move this file somewhere else. Technically it is possible, but 
> several applications rely on it so they would all have to be upgraded at the 
> same time. And it affects the auto-update process itself which will cause 
> issues for users trying to upgrade to the latest version.

Will the other apps work if you create an alias in the Contents folder and move 
the file to the Resources folder? I’m not sure how 4D’s commands work with 
aliases, or whether aliases need to be signed.

> So I’m wondering if there is a way to sign this file during the signing 
> process. I’ve tried several variations of signing the file, but haven’t had 
> any luck. I’m hoping someone knows of a way to sign a file like this so I 
> don’t have to go down the difficult road of moving the file to another place.

My impression based on nothing more than all sample signing code I’ve seen has 
done it this way, is that all subdirectory items must be signed before the app 
bundle. So if you have to force sign the file, you likely have to resign the 
app. But, you probably wouldn’t have to re-sign all other sub-items like 
plugins and other bundles. So after the app is built, you could run a script 
that signs that file and the app again.  So maybe something like:


#!/bin/bash
cd "${BASH_SOURCE%/*}" || exit
devID="Developer ID Application: James Crate (CLJ9SRZQY3)"
appPath=“./MyApp.app”

if [[ -d $appPath ]]
then
  codesign --force --deep --verbose --sign "$devID" 
"${appPath}/Contents/SomeFile.blob"
  
  # the base app
  entPath="./sign_app.entitlements"
  codesign --force --deep --verbose --options=runtime --entitlements ${entPath} 
--sign "$devID" "${appPath}”

  # check code-signing
  echo "checking signing"
  spctl -av "$appPath"
  codesign --verify -v "$appPath”

fi

If you already are running a script to zip and upload for notarization, you 
could just incorporate the signing into that script. There is an entitlements 
file buried somewhere in the 4D app bundle so you could just directly reference 
that file if you use LEP to run each command from 4D if you have a project 
method that builds the app, or copy it to where you have your app built for 
easier referencing in a script.

Jim

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**