Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into embed-7
Browse files Browse the repository at this point in the history
  • Loading branch information
haileyok committed Oct 7, 2024
2 parents bf00e09 + 509b37f commit 24eb8c2
Show file tree
Hide file tree
Showing 38 changed files with 13,760 additions and 5,405 deletions.
5 changes: 1 addition & 4 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ body:
- type: markdown
attributes:
value: |
Thanks for taking the time to report an issue you've found in the app! Before you submit this issue, please make
sure you've searched for similar issues that are already open and being tracked. If you find an open issue that
seems relevant to yours, it is best to leave a response there with your information instead of opening a new
issue, since it helps to consolidate the info in one place.
Thanks for taking the time to report an issue you've found in the app! Before you submit this issue, please make sure you've searched for similar issues that are already open and being tracked. If you find an open issue that seems relevant to yours, it is best to leave a response there with your information instead of opening a new issue, since it helps to consolidate the info in one place.
- type: textarea
attributes:
label: Steps to Reproduce
Expand Down
5 changes: 1 addition & 4 deletions .github/ISSUE_TEMPLATE/bug_report_fabric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ body:
- type: markdown
attributes:
value: |
Thanks for taking the time to report an issue you've found in the app! Before you submit this issue, please make
sure you've searched for similar issues that are already open and being tracked. If you find an open issue that
seems relevant to yours, it is best to leave a response there with your information instead of opening a new
issue, since it helps to consolidate the info in one place.
Thanks for taking the time to report an issue you've found in the app! Before you submit this issue, please make sure you've searched for similar issues that are already open and being tracked. If you find an open issue that seems relevant to yours, it is best to leave a response there with your information instead of opening a new issue, since it helps to consolidate the info in one place.
- type: textarea
attributes:
label: Steps to Reproduce
Expand Down
5 changes: 1 addition & 4 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ body:
- type: markdown
attributes:
value: |
Thanks for submitting a feature request! Before you submit this request, please make sure you've searched for
similar requests that are already open and being tracked. If you find an open request that seems relevant to
yours, it is best to leave a response there with your information instead of opening a new request, since it
helps to consolidate the info in one place.
Thanks for submitting a feature request! Before you submit this request, please make sure you've searched for similar requests that are already open and being tracked. If you find an open request that seems relevant to yours, it is best to leave a response there with your information instead of opening a new request, since it helps to consolidate the info in one place.
- type: textarea
attributes:
label: Describe the Feature
Expand Down
1 change: 1 addition & 0 deletions assets/icons/envelope_open_stroke2_corner0_rounded.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions lingui.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = {
'tr',
'uk',
'zh-CN',
'zh-HK',
'zh-TW',
],
catalogs: [
Expand Down
30 changes: 20 additions & 10 deletions modules/Share-with-Bluesky/ShareViewController.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import UIKit
import AVKit

let IMAGE_EXTENSIONS: [String] = ["png", "jpg", "jpeg", "gif", "heic"]
let MOVIE_EXTENSIONS: [String] = ["mov", "mp4", "m4v"]
Expand Down Expand Up @@ -119,16 +120,11 @@ class ShareViewController: UIViewController {
private func handleVideos(items: [NSItemProvider]) async {
let firstItem = items.first

if let dataUri = try? await firstItem?.loadItem(forTypeIdentifier: "public.movie") as? URL {
let ext = String(dataUri.lastPathComponent.split(separator: ".").last ?? "mp4")
if let tempUrl = getTempUrl(ext: ext) {
let data = try? Data(contentsOf: dataUri)
try? data?.write(to: tempUrl)

if let encoded = tempUrl.absoluteString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed),
let url = URL(string: "\(self.appScheme)://intent/compose?videoUri=\(encoded)") {
_ = self.openURL(url)
}
if let dataUrl = try? await firstItem?.loadItem(forTypeIdentifier: "public.movie") as? URL {
let ext = String(dataUrl.lastPathComponent.split(separator: ".").last ?? "mp4")
if let videoUriInfo = saveVideoWithInfo(dataUrl),
let url = URL(string: "\(self.appScheme)://intent/compose?videoUri=\(videoUriInfo)") {
_ = self.openURL(url)
}
}

Expand All @@ -152,6 +148,20 @@ class ShareViewController: UIViewController {
} catch {}
return nil
}

private func saveVideoWithInfo(_ dataUrl: URL) -> String? {
let ext = String(dataUrl.lastPathComponent.split(separator: ".").last ?? "mp4")
guard let tempUrl = getTempUrl(ext: ext),
let track = AVURLAsset(url: dataUrl).tracks(withMediaType: AVMediaType.video).first else {
return nil
}
let size = track.naturalSize.applying(track.preferredTransform)

let data = try? Data(contentsOf: dataUrl)
try? data?.write(to: tempUrl)

return "\(tempUrl.absoluteString)|\(size.width)||\(size.height)"
}

private func completeRequest() {
self.extensionContext?.completeRequest(returningItems: nil)
Expand Down
7 changes: 5 additions & 2 deletions modules/bottom-sheet/ios/SheetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
}
}
}
private var prevLayoutDetentIdentifier: UISheetPresentationController.Detent.Identifier?

// MARK: - Lifecycle

Expand Down Expand Up @@ -143,11 +144,13 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
}

func updateLayout() {
if let contentHeight = self.innerView?.subviews.first?.frame.size.height {
if self.prevLayoutDetentIdentifier == self.selectedDetentIdentifier,
let contentHeight = self.innerView?.subviews.first?.frame.size.height {
self.sheetVc?.updateDetents(contentHeight: self.clampHeight(contentHeight),
preventExpansion: self.preventExpansion)
preventExpansion: self.preventExpansion)
self.selectedDetentIdentifier = self.sheetVc?.getCurrentDetentIdentifier()
}
self.prevLayoutDetentIdentifier = self.selectedDetentIdentifier
}

func dismiss() {
Expand Down
2 changes: 1 addition & 1 deletion modules/bottom-sheet/ios/SheetViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class SheetViewController: UIViewController {
}
}
}

func getCurrentDetentIdentifier() -> UISheetPresentationController.Detent.Identifier? {
guard let sheet = self.sheetPresentationController else {
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package xyz.blueskyweb.app.exporeceiveandroidintents

import android.content.Intent
import android.graphics.Bitmap
import android.media.MediaMetadataRetriever
import android.net.Uri
import android.os.Build
import android.provider.MediaStore
Expand Down Expand Up @@ -143,7 +144,10 @@ class ExpoReceiveAndroidIntentsModule : Module() {
appContext.currentActivity?.contentResolver?.openInputStream(uri)?.use {
it.copyTo(out)
}
"bluesky://intent/compose?videoUri=${URLEncoder.encode(file.path, "UTF-8")}".toUri().let {

val info = getVideoInfo(uri) ?: return

"bluesky://intent/compose?videoUri=${URLEncoder.encode(file.path, "UTF-8")}|${info["width"]}|${info["height"]}".toUri().let {
val newIntent = Intent(Intent.ACTION_VIEW, it)
appContext.currentActivity?.startActivity(newIntent)
}
Expand All @@ -166,6 +170,24 @@ class ExpoReceiveAndroidIntentsModule : Module() {
)
}

private fun getVideoInfo(uri: Uri): Map<String, Any>? {
val retriever = MediaMetadataRetriever()
retriever.setDataSource(appContext.currentActivity, uri)

val width = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH)?.toIntOrNull()
val height = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT)?.toIntOrNull()

if (width == null || height == null) {
return null
}

return mapOf(
"width" to width,
"height" to height,
"path" to uri.path.toString(),
)
}

private fun createFile(extension: String): File = File.createTempFile(extension, "temp.$extension", appContext.currentActivity?.cacheDir)

// We will pas the width and height to the app here, since getting measurements
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"@fortawesome/free-regular-svg-icons": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
"@fortawesome/react-native-fontawesome": "^0.3.2",
"@haileyok/bluesky-video": "0.1.10",
"@haileyok/bluesky-video": "0.2.2",
"@lingui/react": "^4.5.0",
"@mattermost/react-native-paste-input": "^0.7.1",
"@miblanchard/react-native-slider": "^2.3.1",
Expand Down
2 changes: 2 additions & 0 deletions src/components/hooks/dates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
tr,
uk,
zhCN,
zhHK,
zhTW,
} from 'date-fns/locale'

Expand Down Expand Up @@ -52,6 +53,7 @@ const locales: Record<AppLanguage, Locale | undefined> = {
tr,
uk,
['zh-CN']: zhCN,
['zh-HK']: zhHK,
['zh-TW']: zhTW,
}

Expand Down
5 changes: 5 additions & 0 deletions src/components/icons/EnveopeOpen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {createSinglePathSVG} from './TEMPLATE'

export const Envelope_Open_Stroke2_Corner0_Rounded = createSinglePathSVG({
path: 'M4 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v6.386c1.064-.002 2 .86 2 2.001V19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-6.613c0-1.142.936-2.003 2-2.001V4Zm2 6.946 6 2 6-2V4H6v6.946ZM9 8a1 1 0 0 1 1-1h4a1 1 0 1 1 0 2h-4a1 1 0 0 1-1-1Zm2.367 6.843L4 12.387V19h16v-6.613l-7.367 2.456a2 2 0 0 1-1.265 0Z',
})
1 change: 1 addition & 0 deletions src/components/moderation/ModerationDetailsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ function ModerationDetailsDialogInner({
style={a.text_md}>
{desc.source || _(msg`an unknown labeler`)}
</InlineLinkText>
.
</Trans>
</Text>
</>
Expand Down
Loading

0 comments on commit 24eb8c2

Please sign in to comment.