@@ -9,7 +9,6 @@ module Language.Javascript.JSaddle.WKWebView
99 , runHTMLWithBaseURL
1010 , runFile
1111 , mainBundleResourcePath
12− , ApplicationState (..)
1312 , AppDelegateConfig (..)
1413 , AppDelegateNotificationConfig (..)
1514 , AuthorizationOption (..)
@@ -25,7 +24,7 @@ import Language.Javascript.JSaddle.WKWebView.Internal
2524 (jsaddleMain, jsaddleMainHTMLWithBaseURL, jsaddleMainFile, WKWebView(..), mainBundleResourcePath)
2625import System.Environment (getProgName)
2726import Foreign.C.String (CString, withCString)
28−import Foreign.C.Types (CBool, CInt)
27+import Foreign.C.Types (CBool)
2928import Foreign.StablePtr (StablePtr, newStablePtr)
3029import Language.Javascript.JSaddle (JSM)
3130
@@ -41,7 +40,6 @@ foreign import ccall runInWKWebView
4140 -> StablePtr (IO ()) -- applicationWillTerminate
4241 -> StablePtr (IO ()) -- applicationSignificantTimeChange
4342 -> StablePtr (CString -> IO ()) -- applicationUniversalLink
44− -> StablePtr (CInt -> CString -> IO ()) -- applicationDidReceiveRemoteNotification
4543 -> Word64 -- whether to run requestAuthorizationWithOptions
4644 -> Word64 -- Ask for Badge authorization
4745 -> Word64 -- Ask for Sound authorization
@@ -68,11 +66,6 @@ data AppDelegateConfig = AppDelegateConfig
6866 --
6967 -- The Core Foundation plist key CFBundleURLTypes controls which URL schemes
7068 -- 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
7669 , _appDelegateConfig_appDelegateNotificationConfig :: AppDelegateNotificationConfig
7770 , _appDelegateConfig_developerExtrasEnabled :: Bool
7871 -- ^ Allow devtools in the app. Defaults to 'True'
@@ -96,7 +89,6 @@ instance Default AppDelegateConfig where
9689 , _appDelegateConfig_applicationWillTerminate = return ()
9790 , _appDelegateConfig_applicationSignificantTimeChange = return ()
9891 , _appDelegateConfig_applicationUniversalLink = \_ -> return ()
99− , _appDelegateConfig_applicationDidReceiveRemoteNotification = \_ _ -> return ()
10092 , _appDelegateConfig_appDelegateNotificationConfig = def
10193 , _appDelegateConfig_developerExtrasEnabled = True
10294 , _appDelegateConfig_applicationOpenFile = \_ -> return False
@@ -108,12 +100,6 @@ data AuthorizationOption = AuthorizationOption_Badge
108100 | AuthorizationOption_CarPlay
109101 deriving (Show, Read, Eq, Ord)
110102
111−data ApplicationState = ApplicationState_Active
112− | ApplicationState_Inactive
113− | ApplicationState_Background
114− | ApplicationState_Unknown CInt
115− deriving (Show, Read, Eq, Ord)
116−
117103data AppDelegateNotificationConfig = AppDelegateNotificationConfig
118104 { _appDelegateNotificationConfig_requestAuthorizationWithOptions :: Maybe (Set AuthorizationOption)
119105 , _appDelegateNotificationConfig_registerForRemoteNotifications :: Bool
@@ -176,13 +162,6 @@ run' cfg main = do
176162 applicationWillTerminate <- newStablePtr $ _appDelegateConfig_applicationWillTerminate cfg
177163 applicationSignificantTimeChange <- newStablePtr $ _appDelegateConfig_applicationSignificantTimeChange cfg
178164 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
186165 applicationOpenFile <- newStablePtr $ fmap fromBool . _appDelegateConfig_applicationOpenFile cfg
187166
188167 -- AppDelegate notification configuration
@@ -206,7 +185,6 @@ run' cfg main = do
206185 applicationWillTerminate
207186 applicationSignificantTimeChange
208187 applicationUniversalLink
209− applicationDidReceiveRemoteNotification
210188 (fromBool requestAuthorizationWithOptions)
211189 (fromBool $ Set.member AuthorizationOption_Badge authorizationOptions)
212190 (fromBool $ Set.member AuthorizationOption_Sound authorizationOptions)