@@ -18,6 +18,7 @@ <h2>Success!</h2>
1818 function dataLoadedHandler ( result , fromUpdate ) {
1919 if ( result && result . data && ( result . id || fromUpdate ) ) {
2020 var content = result . data . content ;
21+ var isHosted = content . url . includes ( 'drive.google.com' ) || content . url . includes ( 'dropbox.com' ) ;
2122 if ( content && content . url ) {
2223 buildfire . getContext ( function ( err , context ) {
2324 if ( context . device . platform == "web" ) {
@@ -26,20 +27,30 @@ <h2>Success!</h2>
2627 d . style . display = '' ;
2728 var a = document . getElementById ( "a" ) ;
2829 a . onclick = function ( ) {
29- buildfire . navigation . openWindow ( "https://docs.google.com/viewer?url=" + encodeURIComponent ( content . url ) , "_system" ) ;
30+ if ( isHosted ) {
31+ buildfire . navigation . openWindow ( content . url , "_blank" ) ;
32+ } else {
33+ buildfire . navigation . openWindow ( "https://docs.google.com/viewer?url=" + encodeURIComponent ( content . url ) , "_blank" ) ;
34+ }
3035 return false ;
3136 }
3237 }
3338 }
3439 else {
3540 if ( content . openInApp ) {
36- if ( context . device . platform . toLowerCase ( ) == "android" )
37- buildfire . navigation . openWindow ( "https://docs.google.com/viewer?url=" + encodeURIComponent ( content . url ) , "_blank" ) ;
38- else
39- buildfire . navigation . openWindow ( content . url , "_blank" ) ;
41+ if ( context . device . platform . toLowerCase ( ) == "android" ) {
42+ if ( isHosted ) {
43+ buildfire . navigation . openWindow ( content . url , "_blank" ) ;
44+ } else {
45+ buildfire . navigation . openWindow ( "https://docs.google.com/viewer?url=" + encodeURIComponent ( content . url ) , "_blank" ) ;
46+ }
47+ } else {
48+ buildfire . navigation . openWindow ( content . url , "_blank" ) ;
49+ }
4050 }
41- else
51+ else {
4252 buildfire . navigation . openWindow ( content . url , "_system" ) ;
53+ }
4354
4455 buildfire . navigation . goBack ( ) ;
4556 }
0 commit comments