on fee357d help sign in
.travis.yml+40−37
since splitsnapshots
unifiedsplit
@@ -1,47 +1,50 @@
1−language: nix
1+language: c
2−nix: 2.2.2
3
2
4−jobs:
3+#ghc:
4+# - "8.4.4"
5+
6+sudo: false
7+
8+dist: xenial
9+#addons:
10+# apt:
11+# sources:
12+# - ppa:hvr/ghc
13+# packages:
14+# - libgirepository1.0-dev
15+# - libwebkit2gtk-4.0-dev,phantomjs
16+
17+cache:
18+ directories:
19+ - $HOME/.cabal
20+ - $HOME/.ghc
21+
22+matrix:
5 include:
23 include:
6− - stage: Build
7− env: OS=linux GHCVER=ghc865
24+# - env: CABALVER=2.0 GHCVER=8.2.2
8− - stage: Build
25+# addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2,happy-1.19.5,alex-3.1.7,libgirepository1.0-dev,libwebkit2gtk-4.0-dev,phantomjs], sources: [hvr-ghc]}}
9− env: OS=linux GHCVER=ghc881
10− - env: OS=macos GHCVER=ghc865
26+ - env: CABALVER=2.2 GHCVER=8.4.4
11− os: osx
27+ addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.4,happy-1.19.5,alex-3.1.7,libgirepository1.0-dev,libwebkit2gtk-4.0-dev,phantomjs], sources: [hvr-ghc]}}
12− # Fix OSX, see https://travis-ci.community/t/cannot-use-nix-support-on-osx/2927
28+# - env: CABALVER=2.4 GHCVER=8.6.3
13− language: generic
29+# addons: {apt: {packages: [cabal-install-2.4,ghc-8.6.3,happy-1.19.5,alex-3.1.7,libgirepository1.0-dev,libwebkit2gtk-4.0-dev,phantomjs], sources: [hvr-ghc]}}
14− before_install:
30+# - env: CABALVER=head GHCVER=head
15− - curl https://nixos.org/nix/install | sh
31+# addons: {apt: {packages: [cabal-install-head,ghc-head,happy-1.19.5,alex-3.1.7,libgirepository1.0-dev,libwebkit2gtk-4.0-dev,phantomjs], sources: [hvr-ghc]}}
16− - source /Users/travis/.nix-profile/etc/profile.d/nix.sh
32+ allow_failures:
17− - env: OS=macos GHCVER=ghc881
33+ - env: CABALVER=head GHCVER=head
18− os: osx
34+
19− # Fix OSX, see https://travis-ci.community/t/cannot-use-nix-support-on-osx/2927
20− language: generic
21− before_install:
35+before_install:
22− - curl https://nixos.org/nix/install | sh
36+ - export PATH=$HOME/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/alex/3.1.7/bin:/opt/happy/1.19.5/bin:$PATH
23− - source /Users/travis/.nix-profile/etc/profile.d/nix.sh
24
37
25install:
38install:
26−- sudo mkdir -p /etc/nix
39+ - cabal --version
27−- echo "substituters = https://cache.nixos.org https://hydra.iohk.io" | sudo tee -a /etc/nix/nix.conf > /dev/null
40+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
28−- echo "trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" | sudo tee -a /etc/nix/nix.conf > /dev/null
41+ - cabal update
29
42
30script:
43script:
31−- nix-build --argstr haskellCompiler $GHCVER -A hsPkgs.jsaddle.components.library
44+ ./travis/build.sh
32−- nix-build --argstr haskellCompiler $GHCVER -A hsPkgs.jsaddle-warp.components.library
33−- nix-build --argstr haskellCompiler $GHCVER -A hsPkgs.jsaddle-clib.components.library
34−- |
35− if [ "$OS" == "macos" ]; then
36− nix-build --argstr haskellCompiler $GHCVER -A hsPkgs.jsaddle-wkwebview.components.library
37− fi
38−# TODO try to find how to get working webkitgtk with nix on macOS
39−- |
40− if [ "$OS" != "macos" ]; then
41− nix-build --argstr haskellCompiler $GHCVER -A hsPkgs.jsaddle-webkit2gtk.components.library
42− fi
43
45
44notifications:
46notifications:
45 irc:
47 irc:
46 channels: "irc.freenode.net#ghcjs"
48 channels: "irc.freenode.net#ghcjs"
49+ skip_join: true
47− email: true
50+ email: true
README.md+3−3
@@ -137,7 +137,7 @@ The first five keys `[0..4]` are
137these values. Both the Haskell code and `jsaddle.js` can allocate new `JSVal` keys. The Haskell code allocates negative
137these values. Both the Haskell code and `jsaddle.js` can allocate new `JSVal` keys. The Haskell code allocates negative
138keys and `jsaddle.js` allocates positive keys to avoid clashing.
138keys and `jsaddle.js` allocates positive keys to avoid clashing.
139
139
140−The haskell code will not know the value to go with the key, but it will include it in commands to the server
140+The haskell code will not know the value of the to go with the key, but it will include it in commands to the server
141that are sort of "hey call this function and put the result in the map with this key"). This allows for the
141that are sort of "hey call this function and put the result in the map with this key"). This allows for the
142lazy execution of the JSaddle code.
142lazy execution of the JSaddle code.
143
143
@@ -146,7 +146,7 @@ when the JSVal is no longer reachable. The `jsaddle.js` code then deletes the k
146
146
147### JSStrings
147### JSStrings
148
148
149−These are haskell `Text` type and so reside on the native side of the WebSocket. If you want to avoid transferring large string values over the WebSocket use `toJSVal` to convert it to a `JSVal`.
149+These are haskell `Text` type and so reside on the native side of the WebSocket. If you want to make avoid transferring large string values over the WebSocket use `toJSVal` to convert it to a `JSVal`.
150
150
151### Lazy Execution
151### Lazy Execution
152
152
@@ -213,7 +213,7 @@ JSaddle does not support exceptions well. When compiled with GHCJS an exception
213at the point the exception is thrown.
213at the point the exception is thrown.
214
214
215When using GHC the Haskell executions will probably continue for a while before the exception is received at all by the Haskell code
215When using GHC the Haskell executions will probably continue for a while before the exception is received at all by the Haskell code
216−(because the lazy execution of the JS code). The exception will be thrown when the next synchronous command is executed.
216+(because the lazy execution of the JS code). The exception will be thrown when the the next synchronous command is executed.
217When it reaches the synchronous command a haskell type JSException will be thrown (this may not be the thread that initiated the
217When it reaches the synchronous command a haskell type JSException will be thrown (this may not be the thread that initiated the
218command that caused the exception). You can use `syncPoint` and `syncAfter` to force the exception to be thrown.
218command that caused the exception). You can use `syncPoint` and `syncAfter` to force the exception to be thrown.
219There are `JSM` versions of `catch` and `bracket` that also include a `syncPoint` call.
219There are `JSM` versions of `catch` and `bracket` that also include a `syncPoint` call.
cabal.project+35−3
@@ -1,10 +1,42 @@
1+flags: -overloaded-methods -overloaded-signals -overloaded-properties
2+
1packages:
3packages:
2 jsaddle/
4 jsaddle/
3 jsaddle-warp/
5 jsaddle-warp/
4 jsaddle-wkwebview/
6 jsaddle-wkwebview/
7+-- jsaddle-webkitgtk/
5 jsaddle-webkit2gtk/
8 jsaddle-webkit2gtk/
6 jsaddle-clib/
9 jsaddle-clib/
7
10
8−constraints: haskell-gi-overloading == 0.0
11+package gi-atk
9−
12+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
10−allow-newer: websockets:random, splitmix:time, *:time, *:unix, *:process, stm:base
13+package gi-cairo
14+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
15+package gi-gdk
16+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
17+package gi-gdkpixbuf
18+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
19+package gi-gio
20+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
21+package gi-glib
22+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
23+package gi-gobject
24+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
25+package gi-gtk
26+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
27+package gi-gtk-hs
28+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
29+package gi-gtkosxapplication
30+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
31+package gi-gtksource
32+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
33+package gi-javascriptcore
34+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
35+package gi-pango
36+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
37+package gi-soup
38+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
39+package gi-webkit
40+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
41+package gi-webkit2
42+ flags: -overloaded-methods -overloaded-signals -overloaded-properties
jsaddle-clib/jsaddle-clib.cabal+3−4
@@ -1,5 +1,5 @@
1name: jsaddle-clib
1name: jsaddle-clib
2−version: 0.9.8.0
2+version: 0.9.6.0
3cabal-version: >=1.10
3cabal-version: >=1.10
4build-type: Simple
4build-type: Simple
5license: MIT
5license: MIT
@@ -21,9 +21,8 @@ library
21 Language.Javascript.JSaddle.CLib
21 Language.Javascript.JSaddle.CLib
22 Language.Javascript.JSaddle.CLib.Internal
22 Language.Javascript.JSaddle.CLib.Internal
23 build-depends:
23 build-depends:
24− aeson >=0.8.0.2 && <1.6,
24+ aeson >=0.8.0.2 && <1.5,
25 base <5,
25 base <5,
26− base-compat >=0.9.0 && <0.12,
27 bytestring >=0.10.6.0 && <0.11,
26 bytestring >=0.10.6.0 && <0.11,
28 jsaddle >= 0.9.0.0 && <0.10,
27 jsaddle >= 0.9.0.0 && <0.10,
29 data-default,
28 data-default,
@@ -33,7 +32,7 @@ library
33 Include-dirs: cbits/include
32 Include-dirs: cbits/include
34 Includes: jsaddle.h
33 Includes: jsaddle.h
35 Install-includes: jsaddle.h
34 Install-includes: jsaddle.h
36− ghc-options: -ferror-spans -Wall
35+ ghc-options: -ferror-spans -Wall -Werror
37 if impl(ghcjs)
36 if impl(ghcjs)
38 hs-source-dirs: src-ghcjs
37 hs-source-dirs: src-ghcjs
39 else
38 else
jsaddle-clib/src-ghc/Language/Javascript/JSaddle/CLib.hs+1−3
@@ -8,9 +8,6 @@ module Language.Javascript.JSaddle.CLib
8 , appConfigToAppCallbacks
8 , appConfigToAppCallbacks
9 ) where
9 ) where
10
10
11−import Prelude ()
12−import Prelude.Compat
13−
14import Control.Monad (void)
11import Control.Monad (void)
15import Control.Concurrent (forkIO)
12import Control.Concurrent (forkIO)
16
13
@@ -19,6 +16,7 @@ import Data.ByteString (useAsCString, packCString)
19import Data.ByteString.Char8 (unpack)
16import Data.ByteString.Char8 (unpack)
20import Data.ByteString.Lazy (ByteString, toStrict, fromStrict)
17import Data.ByteString.Lazy (ByteString, toStrict, fromStrict)
21import Data.Default (def, Default)
18import Data.Default (def, Default)
19+import Data.Monoid ((<>))
22import Data.Text (Text)
20import Data.Text (Text)
23import qualified Data.Text.Encoding as T
21import qualified Data.Text.Encoding as T
24
22
jsaddle-warp/jsaddle-warp.cabal+7−7
@@ -1,5 +1,5 @@
1name: jsaddle-warp
1name: jsaddle-warp
2−version: 0.9.8.0
2+version: 0.9.6.0
3cabal-version: >=1.10
3cabal-version: >=1.10
4build-type: Simple
4build-type: Simple
5license: MIT
5license: MIT
@@ -10,7 +10,7 @@ description:
10 This package provides an EDSL for calling JavaScript that
10 This package provides an EDSL for calling JavaScript that
11 can be used both from GHCJS and GHC. When using GHC
11 can be used both from GHCJS and GHC. When using GHC
12 the application is run using Warp and WebSockets to
12 the application is run using Warp and WebSockets to
13− drive a small JavaScript helper.
13+ drive a small JavaScipt helper.
14category: Web, Javascript
14category: Web, Javascript
15author: Hamish Mackenzie
15author: Hamish Mackenzie
16
16
@@ -27,7 +27,7 @@ library
27 other-modules:
27 other-modules:
28 Language.Javascript.JSaddle.WebSockets.Compat
28 Language.Javascript.JSaddle.WebSockets.Compat
29 build-depends:
29 build-depends:
30− aeson >=0.8.0.2 && <1.6,
30+ aeson >=0.8.0.2 && <1.5,
31 bytestring >=0.10.6.0 && <0.11,
31 bytestring >=0.10.6.0 && <0.11,
32 containers >=0.5.6.2 && <0.7,
32 containers >=0.5.6.2 && <0.7,
33 foreign-store >=0.2 && <0.3,
33 foreign-store >=0.2 && <0.3,
@@ -35,11 +35,11 @@ library
35 jsaddle >=0.9.4.0 && <0.10,
35 jsaddle >=0.9.4.0 && <0.10,
36 stm >=2.4.4 && <2.6,
36 stm >=2.4.4 && <2.6,
37 text >=1.2.1.3 && <1.3,
37 text >=1.2.1.3 && <1.3,
38− time >=1.5.0.1 && <1.11,
38+ time >=1.5.0.1 && <1.9,
39 transformers >=0.4.2.0 && <0.6,
39 transformers >=0.4.2.0 && <0.6,
40 wai >=3.0.3.0 && <3.3,
40 wai >=3.0.3.0 && <3.3,
41 wai-websockets >=3.0.0.6 && <3.1,
41 wai-websockets >=3.0.0.6 && <3.1,
42− warp >=3.1.2 && <3.4,
42+ warp >=3.1.2 && <3.3,
43 websockets >=0.9.5.0 && <0.13
43 websockets >=0.9.5.0 && <0.13
44 exposed-modules:
44 exposed-modules:
45 Language.Javascript.JSaddle.Warp
45 Language.Javascript.JSaddle.Warp
@@ -59,7 +59,7 @@ test-suite test-tool
59 bytestring -any,
59 bytestring -any,
60 containers -any,
60 containers -any,
61 deepseq -any,
61 deepseq -any,
62− doctest >=0.10.1 && <0.19,
62+ doctest >=0.10.1 && <0.17,
63 exceptions -any,
63 exceptions -any,
64 filepath >=1.4.0.0 && <1.5,
64 filepath >=1.4.0.0 && <1.5,
65 foreign-store -any,
65 foreign-store -any,
@@ -81,7 +81,7 @@ test-suite test-tool
81 wai -any,
81 wai -any,
82 wai-websockets -any,
82 wai-websockets -any,
83 warp -any,
83 warp -any,
84− webdriver >=0.8.4 && <0.10,
84+ webdriver >=0.8.4 && <1.0,
85 websockets -any
85 websockets -any
86 type: exitcode-stdio-1.0
86 type: exitcode-stdio-1.0
87 main-is: DocTest.hs
87 main-is: DocTest.hs
jsaddle-warp/src/Language/Javascript/JSaddle/WebSockets.hs+1−1
@@ -176,7 +176,7 @@ jsaddleJs = jsaddleJs' Nothing
176-- sed -e 's|\\|\\\\|g' -e 's|^| \\|' -e 's|$|\\n\\|' -e 's|"|\\"|g' data/jsaddle.js | pbcopy
176-- sed -e 's|\\|\\\\|g' -e 's|^| \\|' -e 's|$|\\n\\|' -e 's|"|\\"|g' data/jsaddle.js | pbcopy
177jsaddleJs' :: Maybe ByteString -> Bool -> ByteString
177jsaddleJs' :: Maybe ByteString -> Bool -> ByteString
178jsaddleJs' jsaddleUri refreshOnLoad = "\
178jsaddleJs' jsaddleUri refreshOnLoad = "\
179− \if(typeof global !== \"undefined\" && typeof require === \"function\") {\n\
179+ \if(typeof global !== \"undefined\") {\n\
180 \ global.window = global;\n\
180 \ global.window = global;\n\
181 \ global.WebSocket = require('ws');\n\
181 \ global.WebSocket = require('ws');\n\
182 \}\n\
182 \}\n\
jsaddle-webkit2gtk/jsaddle-webkit2gtk.cabal+3−3
@@ -1,5 +1,5 @@
1name: jsaddle-webkit2gtk
1name: jsaddle-webkit2gtk
2−version: 0.9.8.0
2+version: 0.9.6.0
3cabal-version: >=1.10
3cabal-version: >=1.10
4build-type: Simple
4build-type: Simple
5license: MIT
5license: MIT
@@ -26,7 +26,7 @@ library
26 base <5
26 base <5
27 if !impl(ghcjs -any)
27 if !impl(ghcjs -any)
28 build-depends:
28 build-depends:
29− aeson >=0.8.0.2 && <1.6,
29+ aeson >=0.8.0.2 && <1.5,
30 base <5,
30 base <5,
31 bytestring >=0.10.6.0 && <0.11,
31 bytestring >=0.10.6.0 && <0.11,
32 directory >=1.0.0.2 && <1.4,
32 directory >=1.0.0.2 && <1.4,
@@ -35,7 +35,7 @@ library
35 gi-gtk >=3.0.17 && <3.1,
35 gi-gtk >=3.0.17 && <3.1,
36 gi-webkit2 >=4.0.14 && <4.1,
36 gi-webkit2 >=4.0.14 && <4.1,
37 gi-javascriptcore >=4.0.14 && <4.1,
37 gi-javascriptcore >=4.0.14 && <4.1,
38− haskell-gi-base >=0.20 && <0.26,
38+ haskell-gi-base >=0.20 && <0.24,
39 haskell-gi-overloading >=0.0 && < 2.0,
39 haskell-gi-overloading >=0.0 && < 2.0,
40 jsaddle >=0.9.4.0 && <0.10,
40 jsaddle >=0.9.4.0 && <0.10,
41 text >=1.2.1.3 && <1.3,
41 text >=1.2.1.3 && <1.3,
jsaddle-webkit2gtk/src/Language/Javascript/JSaddle/WebKitGTK.hs+2−8
@@ -55,11 +55,11 @@ import GI.GLib (timeoutAdd, idleAdd, pattern PRIORITY_HIGH, pattern PRIORITY_DEF
55import qualified GI.Gtk as Gtk (main, init)
55import qualified GI.Gtk as Gtk (main, init)
56import GI.Gtk
56import GI.Gtk
57 (windowSetPosition, windowSetDefaultSize, windowNew,
57 (windowSetPosition, windowSetDefaultSize, windowNew,
58− scrolledWindowNew, Adjustment, containerAdd,
58+ scrolledWindowNew, noAdjustment, containerAdd,
59 WindowType(..), WindowPosition(..), widgetDestroy,
59 WindowType(..), WindowPosition(..), widgetDestroy,
60 widgetGetToplevel, widgetShowAll, onWidgetDestroy,
60 widgetGetToplevel, widgetShowAll, onWidgetDestroy,
61 mainQuit)
61 mainQuit)
62−import GI.Gio (Cancellable)
62+import GI.Gio (noCancellable)
63import GI.JavaScriptCore (valueToString)
63import GI.JavaScriptCore (valueToString)
64import GI.WebKit2
64import GI.WebKit2
65 (scriptDialogPromptSetText, scriptDialogPromptGetDefaultText,
65 (scriptDialogPromptSetText, scriptDialogPromptGetDefaultText,
@@ -82,12 +82,6 @@ import Language.Javascript.JSaddle (JSM, Results, Batch)
82import Language.Javascript.JSaddle.Run (runJavaScript)
82import Language.Javascript.JSaddle.Run (runJavaScript)
83import Language.Javascript.JSaddle.Run.Files (initState, runBatch, ghcjsHelpers)
83import Language.Javascript.JSaddle.Run.Files (initState, runBatch, ghcjsHelpers)
84
84
85−noAdjustment :: Maybe Adjustment
86−noAdjustment = Nothing
87−
88−noCancellable :: Maybe Cancellable
89−noCancellable = Nothing
90−
91quitWebView :: WebView -> IO ()
85quitWebView :: WebView -> IO ()
92quitWebView wv = postGUIAsync $ do w <- widgetGetToplevel wv --TODO: Shouldn't this be postGUISync?
86quitWebView wv = postGUIAsync $ do w <- widgetGetToplevel wv --TODO: Shouldn't this be postGUISync?
93 widgetDestroy w
87 widgetDestroy w
jsaddle-wkwebview/cbits-uikit/AppDelegate.m−12
@@ -5,7 +5,6 @@
5
5
6extern void callIO(HsStablePtr);
6extern void callIO(HsStablePtr);
7extern void callWithCString(const char * _Nonnull, HsStablePtr);
7extern void callWithCString(const char * _Nonnull, HsStablePtr);
8−extern void callWithCIntCString(int n, const char * _Nonnull, HsStablePtr);
9
8
10@interface AppDelegate ()
9@interface AppDelegate ()
11
10
@@ -21,7 +20,6 @@ HsStablePtr global_applicationWillEnterForeground = 0;
21HsStablePtr global_applicationWillTerminate = 0;
20HsStablePtr global_applicationWillTerminate = 0;
22HsStablePtr global_applicationSignificantTimeChange = 0;
21HsStablePtr global_applicationSignificantTimeChange = 0;
23HsStablePtr global_applicationUniversalLink = 0;
22HsStablePtr global_applicationUniversalLink = 0;
24−HsStablePtr global_applicationDidReceiveRemoteNotification = 0;
25uint64_t global_requestAuthorizationWithOptions = 0;
23uint64_t global_requestAuthorizationWithOptions = 0;
26uint64_t global_requestAuthorizationOptionBadge = 0;
24uint64_t global_requestAuthorizationOptionBadge = 0;
27uint64_t global_requestAuthorizationOptionSound = 0;
25uint64_t global_requestAuthorizationOptionSound = 0;
@@ -117,14 +115,6 @@ HsStablePtr global_didFailToRegisterForRemoteNotificationsWithError = 0;
117 if ([userInfo valueForKeyPath:@"aps.badge"] != nil) {
115 if ([userInfo valueForKeyPath:@"aps.badge"] != nil) {
118 [UIApplication sharedApplication].applicationIconBadgeNumber=[[[userInfo objectForKey:@"aps"] objectForKey:@"badge"] intValue];
116 [UIApplication sharedApplication].applicationIconBadgeNumber=[[[userInfo objectForKey:@"aps"] objectForKey:@"badge"] intValue];
119 }
117 }
120− NSError *error;
121− NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo options:0 error:&error];
122− if (jsonData) {
123− NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
124− callWithCIntCString((int) application.applicationState, [jsonString UTF8String], global_applicationDidReceiveRemoteNotification);
125− } else {
126− NSLog(@"jsaddle-wkwebview didReceiveRemoteNotification handler: error while serialising push notification as JSON");
127− }
128 completionHandler(UIBackgroundFetchResultNewData);
118 completionHandler(UIBackgroundFetchResultNewData);
129}
119}
130
120
@@ -162,7 +152,6 @@ void runInWKWebView(HsStablePtr handler,
162 HsStablePtr hs_applicationWillTerminate,
152 HsStablePtr hs_applicationWillTerminate,
163 HsStablePtr hs_applicationSignificantTimeChange,
153 HsStablePtr hs_applicationSignificantTimeChange,
164 HsStablePtr hs_applicationUniversalLink,
154 HsStablePtr hs_applicationUniversalLink,
165− HsStablePtr hs_applicationDidReceiveRemoteNotification,
166 const uint64_t hs_requestAuthorizationWithOptions,
155 const uint64_t hs_requestAuthorizationWithOptions,
167 const uint64_t hs_requestAuthorizationOptionBadge,
156 const uint64_t hs_requestAuthorizationOptionBadge,
168 const uint64_t hs_requestAuthorizationOptionSound,
157 const uint64_t hs_requestAuthorizationOptionSound,
@@ -183,7 +172,6 @@ void runInWKWebView(HsStablePtr handler,
183 global_applicationWillTerminate = hs_applicationWillTerminate;
172 global_applicationWillTerminate = hs_applicationWillTerminate;
184 global_applicationSignificantTimeChange = hs_applicationSignificantTimeChange;
173 global_applicationSignificantTimeChange = hs_applicationSignificantTimeChange;
185 global_applicationUniversalLink = hs_applicationUniversalLink;
174 global_applicationUniversalLink = hs_applicationUniversalLink;
186− global_applicationDidReceiveRemoteNotification = hs_applicationDidReceiveRemoteNotification;
187 global_requestAuthorizationWithOptions = hs_requestAuthorizationWithOptions;
175 global_requestAuthorizationWithOptions = hs_requestAuthorizationWithOptions;
188 global_requestAuthorizationOptionBadge = hs_requestAuthorizationOptionBadge;
176 global_requestAuthorizationOptionBadge = hs_requestAuthorizationOptionBadge;
189 global_requestAuthorizationOptionSound = hs_requestAuthorizationOptionSound;
177 global_requestAuthorizationOptionSound = hs_requestAuthorizationOptionSound;
jsaddle-wkwebview/default.nixdeleted−14
@@ -1,14 +0,0 @@
1−{ filterSource ? (x: x) }:
2−self: super:
3−let
4− pkgs = self.callPackage ({pkgs}: pkgs) {};
5− inherit (pkgs) lib;
6−in
7−with pkgs.haskell.lib;
8−overrideCabal (self.callCabal2nix "jsaddle-wkwebview" (filterSource ./.) {}) (drv: {
9− libraryFrameworkDepends = (drv.libraryFrameworkDepends or []) ++
10− (if pkgs.stdenv.hostPlatform.useiOSPrebuilt then [
11− "${pkgs.buildPackages.darwin.xcode}/Contents/Developer/Platforms/${pkgs.stdenv.hostPlatform.xcodePlatform}.platform/Developer/SDKs/${pkgs.stdenv.hostPlatform.xcodePlatform}.sdk/System"
12− ] else (with pkgs.buildPackages.darwin.apple_sdk.frameworks; [ Cocoa WebKit ]));
13− buildDepends = lib.optional (!pkgs.stdenv.hostPlatform.useiOSPrebuilt) [ pkgs.buildPackages.darwin.cf-private ];
14−})
jsaddle-wkwebview/jsaddle-wkwebview.cabal+3−5
@@ -1,5 +1,5 @@
1name: jsaddle-wkwebview
1name: jsaddle-wkwebview
2−version: 0.9.8.0
2+version: 0.9.6.0
3cabal-version: >=1.10
3cabal-version: >=1.10
4build-type: Simple
4build-type: Simple
5license: MIT
5license: MIT
@@ -29,15 +29,13 @@ library
29 base <5
29 base <5
30 default-language: Haskell2010
30 default-language: Haskell2010
31 hs-source-dirs: src
31 hs-source-dirs: src
32+ frameworks: Foundation, WebKit
32 ghc-options: -ferror-spans -Wall
33 ghc-options: -ferror-spans -Wall
33− if os(linux)
34− buildable: False
35 if impl(ghcjs)
34 if impl(ghcjs)
36 hs-source-dirs: src-ghcjs
35 hs-source-dirs: src-ghcjs
37 else
36 else
38− frameworks: Foundation, WebKit
39 build-depends:
37 build-depends:
40− aeson >=0.8.0.2 && <1.6,
38+ aeson >=0.8.0.2 && <1.5,
41 bytestring >=0.10.6.0 && <0.11,
39 bytestring >=0.10.6.0 && <0.11,
42 directory,
40 directory,
43 jsaddle >= 0.9.4.0 && <0.10,
41 jsaddle >= 0.9.4.0 && <0.10,
jsaddle-wkwebview/src-ghc/Language/Javascript/JSaddle/WKWebView.hs+1−23
@@ -9,7 +9,6 @@ module Language.Javascript.JSaddle.WKWebView
9 , runHTMLWithBaseURL
9 , runHTMLWithBaseURL
10 , runFile
10 , runFile
11 , mainBundleResourcePath
11 , mainBundleResourcePath
12− , ApplicationState (..)
13 , AppDelegateConfig (..)
12 , AppDelegateConfig (..)
14 , AppDelegateNotificationConfig (..)
13 , AppDelegateNotificationConfig (..)
15 , AuthorizationOption (..)
14 , AuthorizationOption (..)
@@ -25,7 +24,7 @@ import Language.Javascript.JSaddle.WKWebView.Internal
25 (jsaddleMain, jsaddleMainHTMLWithBaseURL, jsaddleMainFile, WKWebView(..), mainBundleResourcePath)
24 (jsaddleMain, jsaddleMainHTMLWithBaseURL, jsaddleMainFile, WKWebView(..), mainBundleResourcePath)
26import System.Environment (getProgName)
25import System.Environment (getProgName)
27import Foreign.C.String (CString, withCString)
26import Foreign.C.String (CString, withCString)
28−import Foreign.C.Types (CBool, CInt)
27+import Foreign.C.Types (CBool)
29import Foreign.StablePtr (StablePtr, newStablePtr)
28import Foreign.StablePtr (StablePtr, newStablePtr)
30import Language.Javascript.JSaddle (JSM)
29import Language.Javascript.JSaddle (JSM)
31
30
@@ -41,7 +40,6 @@ foreign import ccall runInWKWebView
41 -> StablePtr (IO ()) -- applicationWillTerminate
40 -> StablePtr (IO ()) -- applicationWillTerminate
42 -> StablePtr (IO ()) -- applicationSignificantTimeChange
41 -> StablePtr (IO ()) -- applicationSignificantTimeChange
43 -> StablePtr (CString -> IO ()) -- applicationUniversalLink
42 -> StablePtr (CString -> IO ()) -- applicationUniversalLink
44− -> StablePtr (CInt -> CString -> IO ()) -- applicationDidReceiveRemoteNotification
45 -> Word64 -- whether to run requestAuthorizationWithOptions
43 -> Word64 -- whether to run requestAuthorizationWithOptions
46 -> Word64 -- Ask for Badge authorization
44 -> Word64 -- Ask for Badge authorization
47 -> Word64 -- Ask for Sound authorization
45 -> Word64 -- Ask for Sound authorization
@@ -68,11 +66,6 @@ data AppDelegateConfig = AppDelegateConfig
68 --
66 --
69 -- The Core Foundation plist key CFBundleURLTypes controls which URL schemes
67 -- The Core Foundation plist key CFBundleURLTypes controls which URL schemes
70 -- the app should respond to.
68 -- the app should respond to.
71− , _appDelegateConfig_applicationDidReceiveRemoteNotification :: ApplicationState -> CString -> IO ()
72− -- ^ Called when the application receives a remote notification.
73− -- 'ApplicationState' is the current state of the app.
74− -- The 'CString' JSON-encoded user info contained in the notification.
75− -- For more information see https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623117-application?language=objc
76 , _appDelegateConfig_appDelegateNotificationConfig :: AppDelegateNotificationConfig
69 , _appDelegateConfig_appDelegateNotificationConfig :: AppDelegateNotificationConfig
77 , _appDelegateConfig_developerExtrasEnabled :: Bool
70 , _appDelegateConfig_developerExtrasEnabled :: Bool
78 -- ^ Allow devtools in the app. Defaults to 'True'
71 -- ^ Allow devtools in the app. Defaults to 'True'
@@ -96,7 +89,6 @@ instance Default AppDelegateConfig where
96 , _appDelegateConfig_applicationWillTerminate = return ()
89 , _appDelegateConfig_applicationWillTerminate = return ()
97 , _appDelegateConfig_applicationSignificantTimeChange = return ()
90 , _appDelegateConfig_applicationSignificantTimeChange = return ()
98 , _appDelegateConfig_applicationUniversalLink = \_ -> return ()
91 , _appDelegateConfig_applicationUniversalLink = \_ -> return ()
99− , _appDelegateConfig_applicationDidReceiveRemoteNotification = \_ _ -> return ()
100 , _appDelegateConfig_appDelegateNotificationConfig = def
92 , _appDelegateConfig_appDelegateNotificationConfig = def
101 , _appDelegateConfig_developerExtrasEnabled = True
93 , _appDelegateConfig_developerExtrasEnabled = True
102 , _appDelegateConfig_applicationOpenFile = \_ -> return False
94 , _appDelegateConfig_applicationOpenFile = \_ -> return False
@@ -108,12 +100,6 @@ data AuthorizationOption = AuthorizationOption_Badge
108 | AuthorizationOption_CarPlay
100 | AuthorizationOption_CarPlay
109 deriving (Show, Read, Eq, Ord)
101 deriving (Show, Read, Eq, Ord)
110
102
111−data ApplicationState = ApplicationState_Active
112− | ApplicationState_Inactive
113− | ApplicationState_Background
114− | ApplicationState_Unknown CInt
115− deriving (Show, Read, Eq, Ord)
116−
117data AppDelegateNotificationConfig = AppDelegateNotificationConfig
103data AppDelegateNotificationConfig = AppDelegateNotificationConfig
118 { _appDelegateNotificationConfig_requestAuthorizationWithOptions :: Maybe (Set AuthorizationOption)
104 { _appDelegateNotificationConfig_requestAuthorizationWithOptions :: Maybe (Set AuthorizationOption)
119 , _appDelegateNotificationConfig_registerForRemoteNotifications :: Bool
105 , _appDelegateNotificationConfig_registerForRemoteNotifications :: Bool
@@ -176,13 +162,6 @@ run' cfg main = do
176 applicationWillTerminate <- newStablePtr $ _appDelegateConfig_applicationWillTerminate cfg
162 applicationWillTerminate <- newStablePtr $ _appDelegateConfig_applicationWillTerminate cfg
177 applicationSignificantTimeChange <- newStablePtr $ _appDelegateConfig_applicationSignificantTimeChange cfg
163 applicationSignificantTimeChange <- newStablePtr $ _appDelegateConfig_applicationSignificantTimeChange cfg
178 applicationUniversalLink <- newStablePtr $ _appDelegateConfig_applicationUniversalLink cfg
164 applicationUniversalLink <- newStablePtr $ _appDelegateConfig_applicationUniversalLink cfg
179− applicationDidReceiveRemoteNotification <- newStablePtr $ \n s -> do
180− let appState = case n of
181− 0 -> ApplicationState_Active
182− 1 -> ApplicationState_Inactive
183− 2 -> ApplicationState_Background
184− _ -> ApplicationState_Unknown n
185− _appDelegateConfig_applicationDidReceiveRemoteNotification cfg appState s
186 applicationOpenFile <- newStablePtr $ fmap fromBool . _appDelegateConfig_applicationOpenFile cfg
165 applicationOpenFile <- newStablePtr $ fmap fromBool . _appDelegateConfig_applicationOpenFile cfg
187
166
188 -- AppDelegate notification configuration
167 -- AppDelegate notification configuration
@@ -206,7 +185,6 @@ run' cfg main = do
206 applicationWillTerminate
185 applicationWillTerminate
207 applicationSignificantTimeChange
186 applicationSignificantTimeChange
208 applicationUniversalLink
187 applicationUniversalLink
209− applicationDidReceiveRemoteNotification
210 (fromBool requestAuthorizationWithOptions)
188 (fromBool requestAuthorizationWithOptions)
211 (fromBool $ Set.member AuthorizationOption_Badge authorizationOptions)
189 (fromBool $ Set.member AuthorizationOption_Badge authorizationOptions)
212 (fromBool $ Set.member AuthorizationOption_Sound authorizationOptions)
190 (fromBool $ Set.member AuthorizationOption_Sound authorizationOptions)
jsaddle-wkwebview/src/Language/Javascript/JSaddle/WKWebView/Internal.hs+1−7
@@ -20,7 +20,7 @@ import qualified Data.Text as T (pack)
20import Data.Text.Encoding (encodeUtf8)
20import Data.Text.Encoding (encodeUtf8)
21
21
22import Foreign.C.String (CString)
22import Foreign.C.String (CString)
23−import Foreign.C.Types (CBool(..), CInt(..))
23+import Foreign.C.Types (CBool(..))
24import Foreign.Ptr (Ptr, nullPtr)
24import Foreign.Ptr (Ptr, nullPtr)
25import Foreign.StablePtr (StablePtr, newStablePtr, deRefStablePtr)
25import Foreign.StablePtr (StablePtr, newStablePtr, deRefStablePtr)
26
26
@@ -37,7 +37,6 @@ foreign export ccall jsaddleStart :: StablePtr (IO ()) -> IO ()
37foreign export ccall jsaddleResult :: StablePtr (Results -> IO ()) -> CString -> IO ()
37foreign export ccall jsaddleResult :: StablePtr (Results -> IO ()) -> CString -> IO ()
38foreign export ccall jsaddleSyncResult :: StablePtr (Results -> IO Batch) -> JSaddleHandler -> CString -> IO ()
38foreign export ccall jsaddleSyncResult :: StablePtr (Results -> IO Batch) -> JSaddleHandler -> CString -> IO ()
39foreign export ccall callWithWebView :: WKWebView -> StablePtr (WKWebView -> IO ()) -> IO ()
39foreign export ccall callWithWebView :: WKWebView -> StablePtr (WKWebView -> IO ()) -> IO ()
40−foreign export ccall callWithCIntCString :: CInt -> CString -> StablePtr (CInt -> CString -> IO ()) -> IO ()
41foreign export ccall callWithCString :: CString -> StablePtr (CString -> IO ()) -> IO ()
40foreign export ccall callWithCString :: CString -> StablePtr (CString -> IO ()) -> IO ()
42foreign export ccall callWithCStringReturningBool :: CString -> StablePtr (CString -> IO CBool) -> IO CBool
41foreign export ccall callWithCStringReturningBool :: CString -> StablePtr (CString -> IO CBool) -> IO CBool
43foreign export ccall callIO :: StablePtr (IO ()) -> IO ()
42foreign export ccall callIO :: StablePtr (IO ()) -> IO ()
@@ -129,11 +128,6 @@ callWithCString c fptr = do
129 f <- deRefStablePtr fptr
128 f <- deRefStablePtr fptr
130 f c
129 f c
131
130
132−callWithCIntCString :: CInt -> CString -> StablePtr (CInt -> CString -> IO ()) -> IO ()
133−callWithCIntCString n s fptr = do
134− f <- deRefStablePtr fptr
135− f n s
136−
137callWithCStringReturningBool :: CString -> StablePtr (CString -> IO CBool) -> IO CBool
131callWithCStringReturningBool :: CString -> StablePtr (CString -> IO CBool) -> IO CBool
138callWithCStringReturningBool c fptr = do
132callWithCStringReturningBool c fptr = do
139 f <- deRefStablePtr fptr
133 f <- deRefStablePtr fptr
jsaddle/jsaddle.cabal+9−10
@@ -1,5 +1,5 @@
1name: jsaddle
1name: jsaddle
2−version: 0.9.8.0
2+version: 0.9.6.0
3cabal-version: >=1.10
3cabal-version: >=1.10
4build-type: Simple
4build-type: Simple
5license: MIT
5license: MIT
@@ -10,7 +10,7 @@ description:
10 This package provides an EDSL for calling JavaScript that
10 This package provides an EDSL for calling JavaScript that
11 can be used both from GHCJS and GHC. When using GHC
11 can be used both from GHCJS and GHC. When using GHC
12 the application is run using Warp and WebSockets to
12 the application is run using Warp and WebSockets to
13− drive a small JavaScript helper.
13+ drive a small JavaScipt helper.
14category: Web, Javascript
14category: Web, Javascript
15author: Hamish Mackenzie
15author: Hamish Mackenzie
16
16
@@ -42,14 +42,14 @@ library
42 ghc-prim,
42 ghc-prim,
43 http-types >=0.8.6 && <0.13,
43 http-types >=0.8.6 && <0.13,
44 process >=1.2.3.0 && <1.7,
44 process >=1.2.3.0 && <1.7,
45− random >= 1.1 && < 1.3,
45+ random >= 1.1 && < 1.2,
46 ref-tf >=0.4.0.1 && <0.5,
46 ref-tf >=0.4.0.1 && <0.5,
47 scientific >=0.3 && <0.4,
47 scientific >=0.3 && <0.4,
48 stm >=2.4.4 && <2.6,
48 stm >=2.4.4 && <2.6,
49− time >=1.5.0.1 && <1.11,
49+ time >=1.5.0.1 && <1.9,
50 unordered-containers >=0.2 && <0.3,
50 unordered-containers >=0.2 && <0.3,
51 vector >=0.10 && <0.13,
51 vector >=0.10 && <0.13,
52− unliftio-core >=0.1 && < 0.3
52+ unliftio-core >=0.1 && < 0.2
53 exposed-modules:
53 exposed-modules:
54 Data.JSString
54 Data.JSString
55 Data.JSString.Internal
55 Data.JSString.Internal
@@ -107,14 +107,13 @@ library
107 Language.Javascript.JSaddle.Value
107 Language.Javascript.JSaddle.Value
108 Language.Javascript.JSaddle.Types
108 Language.Javascript.JSaddle.Types
109 build-depends:
109 build-depends:
110− aeson >=0.11.3.0 && <1.6,
110+ aeson >=0.8.0.2 && <1.5,
111 base >=4.9 && <5,
111 base >=4.9 && <5,
112− base-compat >=0.9.0 && <0.12,
113− base64-bytestring >=1.0.0.1 && <1.2,
112+ base64-bytestring >=1.0.0.1 && <1.1,
114 bytestring >=0.10.6.0 && <0.11,
113 bytestring >=0.10.6.0 && <0.11,
115 exceptions >=0.8 && <0.11,
114 exceptions >=0.8 && <0.11,
116− lens >=3.8.5 && <5.1,
115+ lens >=3.8.5 && <4.18,
117− primitive >=0.6.1.0 && <0.8,
116+ primitive >=0.6.1.0 && <0.7,
118 text >=1.2.1.3 && <1.3,
117 text >=1.2.1.3 && <1.3,
119 transformers >=0.4.2.0 && <0.6
118 transformers >=0.4.2.0 && <0.6
120 default-language: Haskell2010
119 default-language: Haskell2010
jsaddle/src/Language/Javascript/JSaddle/Object.hs+4−3
@@ -526,11 +526,12 @@ array args = do
526 Object . coerce <$> fromListIO rargs
526 Object . coerce <$> fromListIO rargs
527
527
528-- | JavaScript's global object
528-- | JavaScript's global object
529+global :: Object
529#ifdef ghcjs_HOST_OS
530#ifdef ghcjs_HOST_OS
531+global = js_window
530−foreign import javascript unsafe "$r = globalThis"
532+foreign import javascript unsafe "$r = window"
531− global :: Object
533+ js_window :: Object
532#else
534#else
533−global :: Object
534global = Object . JSVal . unsafePerformIO $ newIORef 4
535global = Object . JSVal . unsafePerformIO $ newIORef 4
535#endif
536#endif
536
537
jsaddle/src/Language/Javascript/JSaddle/Run/Files.hs+1−1
@@ -41,7 +41,7 @@ initState = "\
41 \ jsaddle_values.set(1, undefined);\n\
41 \ jsaddle_values.set(1, undefined);\n\
42 \ jsaddle_values.set(2, false);\n\
42 \ jsaddle_values.set(2, false);\n\
43 \ jsaddle_values.set(3, true);\n\
43 \ jsaddle_values.set(3, true);\n\
44− \ jsaddle_values.set(4, globalThis);\n\
44+ \ jsaddle_values.set(4, window);\n\
45 \ var jsaddle_index = 100;\n\
45 \ var jsaddle_index = 100;\n\
46 \ var expectedBatch = 1;\n\
46 \ var expectedBatch = 1;\n\
47 \ var lastResults = [0, {\"tag\": \"Success\", \"contents\": [[], []]}];\n\
47 \ var lastResults = [0, {\"tag\": \"Success\", \"contents\": [[], []]}];\n\
nix/hix.nixdeleted−8
@@ -1,8 +0,0 @@
1−{pkgs, ...}:
2−{ modules = [({pkgs, ...}: {
3− packages.webkit2gtk3-javascriptcore.components.library.doHaddock = false;
4− })];
5− shell.buildInputs = [ pkgs.nodejs ];
6− shell.tools.cabal = {};
7− shell.crossPlatforms = p: [ p.ghcjs ];
8−}