Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Implement OAuth #3382

Merged
merged 211 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
211 commits
Select commit Hold shift + click to select a range
cfd12f3
rm old login code
haileyok Apr 2, 2024
9128cb1
rm some more code and add some new code
haileyok Apr 2, 2024
103d441
remove some more unnecessary stuff
haileyok Apr 2, 2024
6856b76
add auth session browser for native
haileyok Apr 2, 2024
0c6eebf
remove unnecessary
haileyok Apr 2, 2024
fd8e886
a simple redirect on web
haileyok Apr 2, 2024
b4741a8
change
haileyok Apr 4, 2024
55acb43
merge main
haileyok Apr 4, 2024
872f5c0
merge main
haileyok Apr 4, 2024
c9c8e00
adjust `app.config.js` to prevent development manifest error
haileyok Apr 5, 2024
02697bb
rev change
haileyok Apr 5, 2024
b295e84
add oauth client
haileyok Apr 5, 2024
28acdf7
remove
haileyok Apr 5, 2024
aa32f84
Merge branch 'main' into hailey/oauth
haileyok Apr 5, 2024
857503e
Merge branch 'main' into hailey/oauth
haileyok Apr 8, 2024
d61fc5f
add `expo-secure-store`
haileyok Apr 8, 2024
71721b5
copy over a few files for now
haileyok Apr 8, 2024
352d375
save
haileyok Apr 8, 2024
db750e3
add `rn-quick-crypto` and `rn-quick-base64`
haileyok Apr 9, 2024
e165d49
metro config "polyfill"
haileyok Apr 9, 2024
ec58082
add jwk lib
haileyok Apr 9, 2024
1461c0a
decent base
haileyok Apr 9, 2024
c649795
remove all the test files
haileyok Apr 9, 2024
6522853
add `expo-sqlite`
haileyok Apr 10, 2024
ba4e95f
update deps (last time)
haileyok Apr 10, 2024
f7e8946
Merge branch 'main' into hailey/oauth
haileyok Apr 10, 2024
e831bc1
native crypto setup
haileyok Apr 10, 2024
9007810
Search - only enable queries once tab is active (#3471)
mozzius Apr 10, 2024
740cd02
Improve Android haptic, offer toggle for haptics in the app (#3482)
haileyok Apr 11, 2024
4e51772
Make bio area scrollable on iOS (#2931)
haileyok Apr 11, 2024
491116c
Fix useGate lint rule (#3486)
gaearon Apr 11, 2024
e3e8f10
Added `new_profile_scroll_component` to `Gate` type (#3487)
haileyok Apr 11, 2024
25e5ee7
remove bogus packages
haileyok Apr 12, 2024
b521933
Merge branch 'hailey/expo-oauth-helper' into hailey/oauth
haileyok Apr 12, 2024
def2f77
Merge branch 'hailey/expo-oauth-helper' into hailey/oauth
haileyok Apr 12, 2024
72e22a2
revert babel changes
haileyok Apr 12, 2024
70251e5
few small changes
haileyok Apr 12, 2024
d948e73
update dev variables
haileyok Apr 12, 2024
472dbf5
Merge branch 'hailey/expo-oauth-helper' into hailey/oauth
haileyok Apr 12, 2024
951f5f2
it works!
haileyok Apr 12, 2024
bedb0c3
Use getSuggestions endpoint behind the gate (#3499)
gaearon Apr 12, 2024
24bd3d6
add `likeCount` etal. to `embedViewRecordToPostView` (#3500)
haileyok Apr 12, 2024
ad97d43
[Embeds] Create vite project and add to build pipeline (#3448)
mozzius Apr 12, 2024
ed2c8b7
Dont apply the content-language filter if it will remove all content …
pfrazee Apr 12, 2024
f3951f2
remove build-embed from Dockerfile (#3502)
mozzius Apr 12, 2024
7047755
Fix optimistic like/repost (#3503)
gaearon Apr 12, 2024
bc67bdb
rm some useless code
haileyok Apr 12, 2024
eb2fd53
QT Jump Pt. 2 - Remove code duplication (#3506)
haileyok Apr 12, 2024
14208ee
Fix: dont let notifications count go behind the icon (#3505)
pfrazee Apr 12, 2024
835f2e6
Fix stale Notifications after push (#3507)
gaearon Apr 12, 2024
44039c6
Store QP authors in the DID cache (#3509)
haileyok Apr 12, 2024
ec5c492
PWI improvements (#3489)
pfrazee Apr 12, 2024
4fab3c4
Remove report post option from PWI (#3510)
pfrazee Apr 12, 2024
7b02b5d
Update Korean localization (#3491)
quiple Apr 12, 2024
a306fbf
Update zh-TW Localization (#3478)
auroursa Apr 12, 2024
5aed7db
Update Catalan messages.po (#3476)
ivanbea Apr 12, 2024
f6dc216
Update pt-BR localization to latest version (#3472)
gildaswise Apr 12, 2024
aa1d4d4
Update German translations (#3466)
imbstt Apr 12, 2024
1f587ea
Remove obsolete strings from `en` message catalog (#3462)
surfdude29 Apr 12, 2024
f91aa37
Enable updates for `production` behind `receive_updates` gate (#3496)
haileyok Apr 12, 2024
1f61109
Profile card hover preview (#3508)
estrattonbailey Apr 12, 2024
6218eb0
Zhuzh sign in dialog (#3512)
estrattonbailey Apr 12, 2024
c3821fd
Remove vertical scrollbars from views on native (#3429)
haileyok Apr 12, 2024
cefa0a5
android: fix navigation bar always being bright even in dark mode (#3…
kisaragi-hiu Apr 12, 2024
7d01ff9
wait a sec before showing card (#3516)
haileyok Apr 12, 2024
93731e6
cache fix for search post results (#3520)
haileyok Apr 13, 2024
8e29b1f
[Embeds] Embed for single post (#3450)
mozzius Apr 13, 2024
4b3ec55
[Embeds] Embed subdomain landing page (#3501)
mozzius Apr 13, 2024
4c966e5
[Embeds] "Embed post" post dropdown option (#3513)
mozzius Apr 13, 2024
a845587
[Embeds] Show error for users with PWI flag on landing (#3524)
gaearon Apr 13, 2024
f5bb348
Profile hovers (#3518)
estrattonbailey Apr 13, 2024
826f6b0
Moderate content in embeds (#3525)
haileyok Apr 13, 2024
c1137c3
[Embeds] Tweak homepage styles (#3526)
mozzius Apr 13, 2024
acbadc6
add hideRecord prop (#3527)
mozzius Apr 13, 2024
c3f7533
More obvious click area (#3528)
gaearon Apr 13, 2024
1390b1d
[Statsig] Send ref source (#3531)
gaearon Apr 13, 2024
9fb2091
[Embed] Don't reuse DOM when changing embed (#3530)
gaearon Apr 13, 2024
4c95ec2
add ref_src (#3532)
mozzius Apr 13, 2024
1a9eeb7
[Embeds] Add ref_url (#3533)
mozzius Apr 13, 2024
228d947
Fade in animation for card (#3521)
haileyok Apr 13, 2024
2164d32
Fix oopsie (#3538)
gaearon Apr 13, 2024
a8c1e71
Update Japanese translation (#3425)
tkusano Apr 13, 2024
196dd3a
Increase hit slop for web's app language picker (#3535)
mary-ext Apr 13, 2024
58842d0
rebased embedr (#3511)
bnewbold Apr 13, 2024
bb67757
add oEmbed links to public post HTML meta headers (#3522)
bnewbold Apr 13, 2024
eeb1b5e
Update Ukrainian translation (#3537)
Dovgonosyk Apr 13, 2024
41925bd
Fix hover card animation with a reducer (#3547)
gaearon Apr 13, 2024
7543f72
Remove extra wrapper on notification user links (#3548)
haileyok Apr 13, 2024
3b9c5ce
Cache DID and profile basic on profile card presses (#3523)
haileyok Apr 14, 2024
cb3f246
Fix Android in-app browser closing when switching apps (#3546)
npmanos Apr 14, 2024
23056da
fix: only close drawer if directly tapping backdrop (#3534)
mary-ext Apr 14, 2024
0b43d72
Improve the language behaviors around the PWI (#3545)
pfrazee Apr 14, 2024
4b69948
Release 1.77.0 (#3549)
pfrazee Apr 14, 2024
de9f9ce
Merge branch 'hailey/expo-oauth-helper' into hailey/oauth
haileyok Apr 15, 2024
bb4f973
Merge branch 'hailey/expo-oauth-helper' into hailey/oauth
haileyok Apr 15, 2024
db80f6e
changes
haileyok Apr 15, 2024
dbbcd27
Merge branch 'hailey/expo-oauth-helper' into hailey/oauth
haileyok Apr 15, 2024
d56116a
few more things
haileyok Apr 15, 2024
f265d65
embedr: improved HTML snippet, with links (#3559)
bnewbold Apr 15, 2024
68d002a
Fix error getting through by primary feed sort (#3562)
pfrazee Apr 16, 2024
d5db632
1.78
pfrazee Apr 16, 2024
f771a59
Add icons for onboarding (#3571)
estrattonbailey Apr 16, 2024
6980cc7
Hide translate/copy text options when `!no-unauthenticated` (#3573)
mozzius Apr 16, 2024
3807485
Allow a post to contain only a quote (#3577)
haileyok Apr 16, 2024
45e572b
bump api, remove `as number` from types (#3580)
haileyok Apr 16, 2024
2974b40
add sort to searchPosts request (#3581)
mozzius Apr 16, 2024
a66c9d0
Always send ref_ params (#3582)
gaearon Apr 16, 2024
48bd98f
Use the existing `ExternalLinkEmbed` for embed previews in the compos…
haileyok Apr 16, 2024
71c427c
Make ref_ always strings (#3583)
gaearon Apr 16, 2024
09e1f0e
Add a handler for /download that directs you to the device-appropriat…
ericvolp12 Apr 16, 2024
046e11d
Automatically add a link card for URLs in the composer (#3566)
haileyok Apr 16, 2024
69d3768
Better dist strings for Sentry (#3584)
haileyok Apr 16, 2024
8864e9a
Restructure feed hover state machine code (#3550)
gaearon Apr 16, 2024
4a771b9
Merge pull request #3585 from bluesky-social/download_url
ericvolp12 Apr 16, 2024
1e26654
Scrolling while target is hovered and card is visible should hide the…
gaearon Apr 16, 2024
480fa10
Add hovercards to "Reply To" (#3587)
gaearon Apr 16, 2024
d598289
properly animate the profile hover card (#3590)
haileyok Apr 17, 2024
a2df814
delete useMyFollowsQuery (#3529)
mozzius Apr 17, 2024
410f155
Cleanup files after upload on native (#3597)
haileyok Apr 17, 2024
56828c0
NOOP deploy test
Jacob2161 Apr 17, 2024
7e16276
embedr: return null width (#3598)
bnewbold Apr 17, 2024
086dc93
don't underline handle in post meta (#3591)
haileyok Apr 18, 2024
02becdf
[Statsig] Make gate checks lazily (#3594)
gaearon Apr 18, 2024
41b5b5b
Add our own cache in front of Statsig (#3604)
gaearon Apr 18, 2024
6101c32
[Statsig] Prefetch configs for other accounts (#3607)
gaearon Apr 18, 2024
bef7d8a
[Statsig] Slightly block the UI on gates (#3608)
gaearon Apr 18, 2024
1a5b8b2
Add layout transitions to the composer photo gallery on iOS (#3609)
mozzius Apr 18, 2024
7e72a73
Update Korean localization (#3551)
quiple Apr 18, 2024
91190e1
Update Ukrainian translation (#3552)
Dovgonosyk Apr 18, 2024
3beb4ec
Update messages.po (#3610)
gildaswise Apr 18, 2024
08c6014
Fix splash screen language picker appearance on Chrome (#2952)
mary-ext Apr 18, 2024
bf2dccd
Update catalan messages.po (#3595)
ivanbea Apr 18, 2024
2fb4156
Update zh-CN localization (#3565)
auroursa Apr 18, 2024
bf5363c
Update zh-TW localization (#3564)
auroursa Apr 18, 2024
2090738
Update Japanese translation (#3557)
tkusano Apr 18, 2024
ba1c483
Add GIF select to composer (#3600)
mozzius Apr 19, 2024
c91f065
add dimensions to data (#3616)
haileyok Apr 19, 2024
f709fbc
align center post meta in threaded (#3615)
haileyok Apr 19, 2024
55aea34
[Statsig] Update experiments (#3617)
gaearon Apr 19, 2024
c42a557
[Statsig] Send locale info (#3621)
gaearon Apr 19, 2024
ade2ea6
Ungate Top/Latest search (#3627)
gaearon Apr 19, 2024
8b33ffd
Add disable autoplay preference and group related settings into a ded…
mozzius Apr 19, 2024
edbb18a
Throttle gif search by 500ms (#3622)
mozzius Apr 19, 2024
22e86c9
fix onEndReached issue by forcing flatlist to scroll (#3623)
mozzius Apr 19, 2024
c0ca891
Player improvement pre-reqs (#3618)
haileyok Apr 19, 2024
d3c0b48
Top/Latest for hashtags (#3625)
gaearon Apr 19, 2024
ce1c1e1
Search in PWI (#3628)
gaearon Apr 19, 2024
0e3a13b
docs(build): update build instructions (#3641)
matthieusieben Apr 22, 2024
243769e
remove gate from updates (#3646)
haileyok Apr 22, 2024
bcd88b0
add maxwidth to app language dropdown (#3635)
mozzius Apr 22, 2024
b09903e
only open tag menu on long press (#3553)
mozzius Apr 22, 2024
551e333
remove unnecessary padding from the right hand side of the post in th…
haileyok Apr 22, 2024
0e082cb
Update messages.po (#3639)
quiple Apr 22, 2024
c525974
Update Japanese translations (#3632)
tkusano Apr 22, 2024
94ea2a3
Update Finnish translations (#3630)
jaoler Apr 22, 2024
27c4054
Revert "Add layout transitions to the composer photo gallery on iOS (…
mozzius Apr 22, 2024
f4e72cc
[GIFs] Add error boundary to GIF picker (#3643)
mozzius Apr 22, 2024
0b3cc59
Update French translations (#3644)
surfdude29 Apr 22, 2024
f49d73d
[GIFs] Reset scroll on query change (#3642)
mozzius Apr 22, 2024
1a4e05e
properly close the switch account dialog (#3558)
haileyok Apr 22, 2024
76449fb
[GIFs] Replace GIPHY with Tenor (#3651)
mozzius Apr 22, 2024
8618046
[GIFs] Remove consent flow (#3652)
gaearon Apr 22, 2024
49b5d42
rm country param (#3653)
mozzius Apr 22, 2024
fe9b3f0
Ungate profile scroll fix (#3655)
gaearon Apr 22, 2024
cbb817b
GIF Viewer (#3605)
haileyok Apr 23, 2024
710e913
Email auth factor (#3602)
pfrazee Apr 23, 2024
30c2c05
Quick fix to ensure disable 2fa dialog adjusts to keyboard (#3658)
pfrazee Apr 23, 2024
0967251
[Statsig] Add test gates and events (#3659)
gaearon Apr 23, 2024
dc3f694
Update Japanese translation (#3656)
tkusano Apr 23, 2024
316fce6
Release 1.79 (#3661)
pfrazee Apr 23, 2024
76aef2d
use mp4 over webm (#3666)
haileyok Apr 23, 2024
9ebfa9a
Add border radius to GIF loading state (#3669)
mozzius Apr 23, 2024
0847e27
Add option to remove quoted post in composer (#3670)
mozzius Apr 23, 2024
24da3a8
Disable autoplay by default if prefers-reduced-motion (#3671)
gaearon Apr 24, 2024
05beb1b
Remove old old onboarding (#3674)
estrattonbailey Apr 24, 2024
b3df0b1
Remove unnecessary `.trimEnd()` and fix facet detection (#3672)
haileyok Apr 24, 2024
8ec3d8c
Rewrite the link detection (#3687)
gaearon Apr 24, 2024
e2a5944
Remove old Suggested Follows logic (#3689)
gaearon Apr 24, 2024
05212ca
Remove Moderation from sidebar (#3692)
gaearon Apr 24, 2024
15055cb
Persist PDS URL for session resumption (#3620)
mary-ext Apr 24, 2024
90c3ec8
Ignore image responses on non-200 status (#3693)
gaearon Apr 24, 2024
c3fcd48
Cleanup files after each iteration of compression and downloading (#3…
haileyok Apr 25, 2024
5b82b15
remove use of `pointerEvents` on iOS profile header (#3694)
haileyok Apr 25, 2024
6aded4f
[Session] Base (#3541)
estrattonbailey Apr 25, 2024
282ad4b
Irish translation back to 100% (#3683)
kscanne Apr 25, 2024
c7e2909
metro config temp
haileyok Apr 25, 2024
ec37696
[Session] Drill `getAgent` into feed APIs (#3701)
estrattonbailey Apr 25, 2024
a69e567
[Session] Drill into `getAgent` into `whenAppViewReady` (#3702)
estrattonbailey Apr 25, 2024
35005da
[Session] Drill `getAgent` into `notifications/utils` (#3703)
estrattonbailey Apr 25, 2024
e5fdbfe
[Session] Drill `getAgent` into `Onboarding/util` (#3704)
estrattonbailey Apr 25, 2024
d8c8e1e
[Session] Drill `getAgent` into notifications handlers (#3705)
estrattonbailey Apr 25, 2024
45d354c
[Session] Add `useAgent` hook and replace (#3706)
estrattonbailey Apr 25, 2024
f279721
Move Notifications up on desktop web (#3696)
gaearon Apr 25, 2024
d81a373
embedr: handle out-of-range maxwidth; change default (#3713)
bnewbold Apr 26, 2024
5f91364
Improve usability of search on web (#3663)
haileyok Apr 27, 2024
b10c96f
ver bump (#3731)
haileyok Apr 27, 2024
1af59ca
Special-case bsky.app/download to open share sheet or copy to clipboa…
mozzius Apr 27, 2024
ce85375
[Clipclops] New routes with placeholder screens (#3725)
mozzius Apr 27, 2024
7eb1444
remove precacheThreadPostProfiles (#3729)
haileyok Apr 27, 2024
61d7e60
ensure dialog is closed on unmount (#3650)
haileyok Apr 27, 2024
21e5a87
Patch lexicon for perf (#3733)
gaearon Apr 27, 2024
74cd1d4
YouTube Music as supported player (#3736)
mary-ext Apr 28, 2024
3b4848b
Reduce hovercard false positives, add them to display names and handl…
gaearon Apr 28, 2024
1dd3d66
Account for momentum when hiding minimal shell (#3740)
gaearon Apr 28, 2024
2a08931
Fix dropdown immediately closing on Enter (#3745)
gaearon Apr 28, 2024
256bb33
Remove test gating code (#3742)
gaearon Apr 28, 2024
361d255
Remove useEffect from TimeElapsed (#3741)
gaearon Apr 28, 2024
dfce190
[iOS] Fix selecting search input on focus (#3746)
gaearon Apr 28, 2024
388c4f7
Increase search `TextInput` hit area and improve the related UI (#3748)
haileyok Apr 29, 2024
0d85013
feat(dev): allow using @atproto packages from another directory
matthieusieben Apr 23, 2024
77afff2
Merge branch 'dx-atproto-modules' into hailey/oauth
haileyok Apr 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
57 changes: 57 additions & 0 deletions .github/workflows/build-and-push-embedr-aws.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: build-and-push-embedr-aws
on:
push:
branches:
- main
- bnewbold/embedr
- bnewbold/embedr-rebase

env:
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }}
USERNAME: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_USERNAME }}
PASSWORD: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_PASSWORD }}
IMAGE_NAME: embed

jobs:
embedr-container-aws:
if: github.repository == 'bluesky-social/social-app'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v1

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USERNAME}}
password: ${{ env.PASSWORD }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,enable=true,priority=100,prefix=,suffix=,format=long

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
file: ./Dockerfile.embedr
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,5 @@ CMD ["/usr/bin/bskyweb"]
LABEL org.opencontainers.image.source=https://github.com/bluesky-social/social-app
LABEL org.opencontainers.image.description="bsky.app Web App"
LABEL org.opencontainers.image.licenses=MIT

# NOOP
78 changes: 78 additions & 0 deletions Dockerfile.embedr
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
FROM golang:1.21-bullseye AS build-env

WORKDIR /usr/src/social-app

ENV DEBIAN_FRONTEND=noninteractive

# Node
ENV NODE_VERSION=18
ENV NVM_DIR=/usr/share/nvm

# Go
ENV GODEBUG="netdns=go"
ENV GOOS="linux"
ENV GOARCH="amd64"
ENV CGO_ENABLED=1
ENV GOEXPERIMENT="loopvar"

COPY . .

#
# Generate the JavaScript webpack. NOTE: this will change
#
RUN mkdir --parents $NVM_DIR && \
wget \
--output-document=/tmp/nvm-install.sh \
https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh && \
bash /tmp/nvm-install.sh

RUN \. "$NVM_DIR/nvm.sh" && \
nvm install $NODE_VERSION && \
nvm use $NODE_VERSION && \
npm install --global yarn && \
yarn && \
cd bskyembed && yarn install --frozen-lockfile && cd .. && \
yarn intl:build && \
yarn build-embed

# DEBUG
RUN find ./bskyweb/embedr-static && find ./bskyweb/embedr-templates && find ./bskyembed/dist

# hack around issue with empty directory and go:embed
RUN touch bskyweb/static/js/empty.txt

#
# Generate the embedr Go binary.
#
RUN cd bskyweb/ && \
go mod download && \
go mod verify

RUN cd bskyweb/ && \
go build \
-v \
-trimpath \
-tags timetzdata \
-o /embedr \
./cmd/embedr

FROM debian:bullseye-slim

ENV GODEBUG=netdns=go
ENV TZ=Etc/UTC
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install --yes \
dumb-init \
ca-certificates

ENTRYPOINT ["dumb-init", "--"]

WORKDIR /embedr
COPY --from=build-env /embedr /usr/bin/embedr

CMD ["/usr/bin/embedr"]

LABEL org.opencontainers.image.source=https://github.com/bluesky-social/social-app
LABEL org.opencontainers.image.description="embed.bsky.app Web App"
LABEL org.opencontainers.image.licenses=MIT
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ build-web: ## Compile web bundle, copy to bskyweb directory
yarn intl:build
yarn build-web

.PHONY: build-web-embed
build-web-embed: ## Compile web embed bundle, copy to bskyweb/embedr* directories
yarn intl:build
yarn build-embed

.PHONY: test
test: ## Run all tests
NODE_ENV=test EXPO_PUBLIC_ENV=test yarn test
Expand All @@ -28,6 +33,7 @@ lint: ## Run style checks and verify syntax
.PHONY: deps
deps: ## Installs dependent libs using 'yarn install'
yarn install --frozen-lockfile
cd bskyembed && yarn install --frozen-lockfile

.PHONY: nvm-setup
nvm-setup: ## Use NVM to install and activate node+yarn
Expand Down
8 changes: 3 additions & 5 deletions __e2e__/tests/composer.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-env detox/detox */

import {describe, beforeAll, it} from '@jest/globals'
import {beforeAll, describe, it} from '@jest/globals'
import {expect} from 'detox'
import {openApp, loginAsAlice, createServer, sleep} from '../util'

import {createServer, loginAsAlice, openApp, sleep} from '../util'

describe('Composer', () => {
beforeAll(async () => {
Expand Down Expand Up @@ -41,7 +42,6 @@ describe('Composer', () => {
await element(by.id('composerTextInput')).typeText(
'Post with a https://example.com link card',
)
await element(by.id('addLinkCardBtn')).tap()
await element(by.id('composerPublishBtn')).tap()
await expect(element(by.id('composeFAB'))).toBeVisible()
})
Expand Down Expand Up @@ -72,7 +72,6 @@ describe('Composer', () => {
await element(by.id('composerTextInput')).typeText(
'Reply with a https://example.com link card',
)
await element(by.id('addLinkCardBtn')).tap()
await element(by.id('composerPublishBtn')).tap()
await expect(element(by.id('composeFAB'))).toBeVisible()
})
Expand Down Expand Up @@ -104,7 +103,6 @@ describe('Composer', () => {
await element(by.id('composerTextInput')).typeText(
'QP with a https://example.com link card',
)
await element(by.id('addLinkCardBtn')).tap()
await element(by.id('composerPublishBtn')).tap()
await expect(element(by.id('composeFAB'))).toBeVisible()
})
Expand Down
4 changes: 2 additions & 2 deletions __e2e__/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {resolveConfig} from 'detox/internals'
import {execSync} from 'child_process'
import {resolveConfig} from 'detox/internals'
import http from 'http'

const platform = device.getPlatform()
Expand Down Expand Up @@ -52,7 +52,7 @@ export async function login(
if (await isVisible('chooseAccountForm')) {
await element(by.id('chooseNewAccountBtn')).tap()
}
await element(by.id('loginSelectServiceButton')).tap()
await element(by.id('selectServiceButton')).tap()
if (takeScreenshots) {
await device.takeScreenshot('2- opened service selector')
}
Expand Down
29 changes: 27 additions & 2 deletions __tests__/lib/images.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import ImageResizer from '@bam.tech/react-native-image-resizer'
import RNFetchBlob from 'rn-fetch-blob'

import {
downloadAndResize,
DownloadAndResizeOpts,
} from '../../src/lib/media/manip'
import ImageResizer from '@bam.tech/react-native-image-resizer'
import RNFetchBlob from 'rn-fetch-blob'

describe('downloadAndResize', () => {
const errorSpy = jest.spyOn(global.console, 'error')
Expand All @@ -30,6 +31,7 @@ describe('downloadAndResize', () => {
const mockedFetch = RNFetchBlob.fetch as jest.Mock
mockedFetch.mockResolvedValueOnce({
path: jest.fn().mockReturnValue('file://downloaded-image.jpg'),
info: jest.fn().mockReturnValue({status: 200}),
flush: jest.fn(),
})

Expand Down Expand Up @@ -84,6 +86,7 @@ describe('downloadAndResize', () => {
const mockedFetch = RNFetchBlob.fetch as jest.Mock
mockedFetch.mockResolvedValueOnce({
path: jest.fn().mockReturnValue('file://downloaded-image'),
info: jest.fn().mockReturnValue({status: 200}),
flush: jest.fn(),
})

Expand Down Expand Up @@ -118,4 +121,26 @@ describe('downloadAndResize', () => {
{mode: 'cover'},
)
})

it('should return undefined for non-200 response', async () => {
const mockedFetch = RNFetchBlob.fetch as jest.Mock
mockedFetch.mockResolvedValueOnce({
path: jest.fn().mockReturnValue('file://downloaded-image'),
info: jest.fn().mockReturnValue({status: 400}),
flush: jest.fn(),
})

const opts: DownloadAndResizeOpts = {
uri: 'https://example.com/image',
width: 100,
height: 100,
maxSize: 500000,
mode: 'cover',
timeout: 10000,
}

const result = await downloadAndResize(opts)
expect(errorSpy).not.toHaveBeenCalled()
expect(result).toBeUndefined()
})
})
Loading