Skip to content

Commit

Permalink
Merge branch 'main' of github.com:microdotblog/microblog-react into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
vincentritter committed Jun 25, 2024
2 parents 91d0d81 + e3c6939 commit 0cc0e6f
Show file tree
Hide file tree
Showing 20 changed files with 599 additions and 144 deletions.
8 changes: 4 additions & 4 deletions ios/MicroBlog_RN.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -817,15 +817,15 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = MicroBlog_RN/MicroBlog_RN.entitlements;
CURRENT_PROJECT_VERSION = 312;
CURRENT_PROJECT_VERSION = 315;
DEVELOPMENT_TEAM = 3F9MDJ6K4E;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = MicroBlog_RN/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.2.6;
MARKETING_VERSION = 3.2.8;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand All @@ -852,14 +852,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = MicroBlog_RN/MicroBlog_RN.entitlements;
CURRENT_PROJECT_VERSION = 312;
CURRENT_PROJECT_VERSION = 315;
DEVELOPMENT_TEAM = 3F9MDJ6K4E;
INFOPLIST_FILE = MicroBlog_RN/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.2.6;
MARKETING_VERSION = 3.2.8;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
19 changes: 19 additions & 0 deletions src/api/MicroBlogApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,25 @@ class MicroBlogApi {
});
return search;
}

async search_uploads(query, destination = null) {
console.log('MicroBlogApi: search_uploads', query, destination);
const search = axios
.get(`/micropub/media?q=source&mp-destination=${destination}&filter=${query}`, {
headers: { Authorization: `Bearer ${Auth.selected_user?.token()}` },
})
.then(response => {
if(response.data != null){
return response.data
}
return API_ERROR;
})
.catch(error => {
console.log('MicroBlogApi: search_uploads', error);
return API_ERROR;
});
return search;
}

async bookmark_highlights() {
console.log('MicroBlogApi: bookmark_highlights');
Expand Down
19 changes: 19 additions & 0 deletions src/components/cells/upload_cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import FastImage from 'react-native-fast-image'
import { SvgXml } from 'react-native-svg';
import { SFSymbol } from "react-native-sfsymbols";
import { MenuView } from '@react-native-menu/menu';
import { SheetManager } from "react-native-actions-sheet";
import Auth from '../../stores/Auth'

@observer
Expand Down Expand Up @@ -101,6 +102,14 @@ export default class UploadCell extends React.Component {
}
}

get_info(upload) {
SheetManager.show("upload_info_sheet", {
payload: {
upload: upload
}
});
}

render() {
const { upload } = this.props
if (this.props.add_to_editor) {
Expand Down Expand Up @@ -134,6 +143,9 @@ export default class UploadCell extends React.Component {
else if (event_id === "copy_markdown") {
upload.copy_markdown_to_clipboard()
}
else if (event_id === "get_info") {
this.get_info(upload)
}
else if (event_id === "open_in_browser") {
App.open_url(upload.url)
}
Expand Down Expand Up @@ -167,6 +179,13 @@ export default class UploadCell extends React.Component {
ios: 'textformat'
})
}] : []),
{
title: "Get Info",
id: "get_info",
image: Platform.select({
ios: 'info.circle'
})
},
{
title: "Open in Browser",
id: "open_in_browser",
Expand Down
2 changes: 1 addition & 1 deletion src/components/discover/tagmoji_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default class TagmojiBar extends React.Component{
borderColor: App.theme_border_color(),
borderWidth: 1,
borderRadius: 15,
paddingHorizontal: 15,
paddingHorizontal: 10,
paddingVertical: 4,
minWidth: "89%",
color: App.theme_text_color()
Expand Down
77 changes: 77 additions & 0 deletions src/components/sheets/upload_info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import * as React from 'react';
import { useRef } from 'react';
import { observer } from 'mobx-react';
import { TouchableOpacity, Text, View } from 'react-native';
import ActionSheet, { SheetManager } from "react-native-actions-sheet";
import App from '../../stores/App'
import Clipboard from '@react-native-clipboard/clipboard'
import Toast from 'react-native-simple-toast';

@observer
export default class UploadInfoSheet extends React.Component {
constructor(props) {
super(props);
this.upload = this.props.payload.upload;
}

render() {
return (
<ActionSheet
ref={this.actionSheetRef}
id={this.props.sheetId}
snapPoints={[50]}
initialSnapIndex={[1]}
overdrawEnabled={true}
useBottomSafeAreaPadding={true}
gestureEnabled={true}
containerStyle={{
backgroundColor: App.theme_background_color_secondary()
}}
>
<View
style={{
padding: 15,
justifyContent: 'center',
borderRadius: 16,
paddingBottom: 10,
marginBottom: 30
}}
>
<TouchableOpacity onPress={() => {
console.log("press");
App.open_url(this.upload.url);
}}>
<Text style={{ color: App.theme_text_color(), paddingBottom: 20 }}>{this.upload.url}</Text>
</TouchableOpacity>

{ this.upload.alt.length > 0 &&
<View>
<Text style={{ color: App.theme_text_color(), paddingBottom: 20 }}>🤖 {this.upload.alt}</Text>
<View style={{ alignSelf: "flex-start" }}>
<TouchableOpacity
style={{
padding: 8,
paddingHorizontal: 15,
backgroundColor: App.theme_button_background_color(),
borderRadius: 20,
borderColor: App.theme_section_background_color(),
borderWidth: 1
}}
onPress={() => {
Clipboard.setString(this.upload.alt);
SheetManager.hide(this.props.sheetId);
setTimeout(function() {
Toast.showWithGravity("Text copied", Toast.SHORT, Toast.CENTER);
}, 200);
}}
>
<Text style={{ color: App.theme_button_text_color() }}>Copy Text</Text>
</TouchableOpacity>
</View>
</View>
}
</View>
</ActionSheet>
)
}
}
20 changes: 15 additions & 5 deletions src/screens/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,15 @@ import PostsDestinationMenu from "../components/sheets/posts_destination";
import TagsMenu from "../components/sheets/tags";
import AddTagsMenu from "../components/sheets/add_tags";
import NotificationsSheetsMenu from "../components/sheets/notifications";
import UploadInfoSheet from "../components/sheets/upload_info";
registerSheet("main_sheet", SheetMenu);
registerSheet("profile_more_menu", ProfileMoreMenu);
registerSheet("tagmoji_menu", TagmojiMenu);
registerSheet("posts_destination_menu", PostsDestinationMenu);
registerSheet("tags_menu", TagsMenu)
registerSheet("add_tags_sheet", AddTagsMenu)
registerSheet("notifications_sheet", NotificationsSheetsMenu)
registerSheet("upload_info_sheet", UploadInfoSheet)

import Push from "../stores/Push"
import { theme_options } from "../utils/navigation"
Expand Down Expand Up @@ -485,7 +487,7 @@ export const conversationScreen = (conversation_id, component_id) => {
}
}
};

return Navigation.push(component_id, options);
}
}
Expand Down Expand Up @@ -714,7 +716,7 @@ export const addBoomarkScreen = () => {
children: [ {
component: {
id: ADD_BOOKMARK_SCREEN,
name: ADD_BOOKMARK_SCREEN,
name: ADD_BOOKMARK_SCREEN,
options: {
topBar: {
title: {
Expand Down Expand Up @@ -772,6 +774,7 @@ export const helpScreen = () => {

export const imageOptionsScreen = (asset, index, component_id) => {
console.log("Screens:imageOptionsScreen", asset, index, component_id);

const options = {
component: {
id: IMAGE_OPTIONS_SCREEN,
Expand All @@ -785,6 +788,13 @@ export const imageOptionsScreen = (asset, index, component_id) => {
title: {
text: asset.is_video ? "Video options" : "Image options"
},
rightButtons: [
{
id: 'remove_image',
text: "Remove",
color: 'red',
}
]
}
}
}
Expand All @@ -795,9 +805,9 @@ export const imageOptionsScreen = (asset, index, component_id) => {

export const imageCropScreen = async (asset, component_id) => {
console.log("Screens:imageCropScreen");

const new_asset = await asset.save_to_temp()

const options = {
component: {
id: IMAGE_CROP_SCREEN,
Expand Down Expand Up @@ -1239,4 +1249,4 @@ export const shareScreen = () => {
}],
}
});
}
}
Loading

0 comments on commit 0cc0e6f

Please sign in to comment.