Skip to content

Commit 4a49410

Browse files
committed
referrer wip
1 parent e99a890 commit 4a49410

28 files changed

+90
-22
lines changed

apps

Submodule apps updated from 144c192 to 7cc93ac

ghcjs/delivery-calculator/delivery-calculator.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.2
22
name: delivery-calculator
3-
version: 0.1.0.17
3+
version: 0.1.0.18
44
synopsis: Delivery Calculator
55
category: Web
66
build-type: Simple

ghcjs/delivery-calculator/package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ghcjs/delivery-calculator/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@capacitor/toast": "^6.0.2",
2020
"@ionic/pwa-elements": "^3.3.0",
2121
"@lowlighter/matcha": "^3.0.0",
22+
"capacitor-play-install-referrer-library": "^0.0.2",
2223
"capacitor-webview-print": "^6.0.1"
2324
},
2425
"devDependencies": {

ghcjs/delivery-calculator/src/App/Types.hs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module App.Types
2424
btc,
2525
cny,
2626
rub,
27-
googlePlayLink,
27+
mkGooglePlayLink,
2828
testGroupLink,
2929
functoraLink,
3030
sourceLink,
@@ -522,10 +522,27 @@ cny = CurrencyInfo (CurrencyCode "cny") mempty
522522
rub :: CurrencyInfo
523523
rub = CurrencyInfo (CurrencyCode "rub") mempty
524524

525-
googlePlayLink :: URI
526-
googlePlayLink =
527-
either impureThrow id
528-
$ mkURI "https://play.google.com/apps/testing/com.functora.delivery_calculator"
525+
mkGooglePlayLink :: Model -> URI
526+
mkGooglePlayLink st =
527+
either impureThrow id $ do
528+
ref <- mkURI mempty
529+
k <- URI.mkQueryKey "referrer"
530+
v <-
531+
URI.mkQueryValue
532+
$ URI.render
533+
ref
534+
{ URI.uriQuery =
535+
toQuery
536+
. uniqueToIdentity
537+
$ modelState st
538+
}
539+
uri <-
540+
mkURI
541+
"https://play.google.com/apps/testing/com.functora.delivery_calculator"
542+
pure
543+
$ uri
544+
{ URI.uriQuery = [URI.QueryParam k v]
545+
}
529546

530547
testGroupLink :: URI
531548
testGroupLink =

ghcjs/delivery-calculator/src/App/Widgets/GooglePlay.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ googlePlay st =
5050
text " group and then install the app from ",
5151
BrowserLink.browserLink
5252
BrowserLink.Args
53-
{ BrowserLink.argsLink = googlePlayLink,
53+
{ BrowserLink.argsLink = mkGooglePlayLink st,
5454
BrowserLink.argsLabel = "Google Play",
5555
BrowserLink.argsAction = PushUpdate
5656
},
@@ -70,7 +70,7 @@ googlePlay st =
7070
text " Join testing (closed beta)"
7171
],
7272
button_
73-
[ onClick $ openBrowser googlePlayLink
73+
[ onClick . openBrowser $ mkGooglePlayLink st
7474
]
7575
[ icon Icon.IconGooglePlay,
7676
text " Google Play (closed beta)"

ghcjs/delivery-calculator/src/Main.hs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,25 @@ updateModel (InitUpdate mShortSt) prevSt = do
130130
mvSink <- newMVar sink
131131
let nextSt = prevSt {modelSink = mvSink}
132132
Jsm.selectStorage ("current-" <> vsn) $ \case
133-
Nothing -> do
134-
liftIO
135-
. sink
136-
. PushUpdate
137-
. PureUpdate
138-
$ #modelLoading
139-
.~ False
140-
opfsSync sink nextSt
133+
Nothing ->
134+
Jsm.fetchInstallReferrerUri $ \case
135+
Nothing -> do
136+
liftIO
137+
. sink
138+
. PushUpdate
139+
. PureUpdate
140+
$ #modelLoading
141+
.~ False
142+
opfsSync sink nextSt
143+
Just ref -> do
144+
alert ref
145+
liftIO
146+
. sink
147+
. PushUpdate
148+
. PureUpdate
149+
$ #modelLoading
150+
.~ False
151+
opfsSync sink nextSt
141152
Just uri -> do
142153
mLongSt <- unLongUri uri
143154
let st =

ghcjs/delivery-calculator/trapeze.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
platforms:
22
android:
33
appName: Delivery Calculator
4-
versionCode: 17
5-
versionName: 0.1.0.17
4+
versionCode: 18
5+
versionName: 0.1.0.18
66
packageName: com.functora.delivery_calculator
77
manifest:
88
- file: AndroidManifest.xml
167 KB
Binary file not shown.
-168 KB
Binary file not shown.

0 commit comments

Comments
 (0)