Skip to content

Commit cfd3cb0

Browse files
committed
✨ feat: working on android
1 parent a03d751 commit cfd3cb0

File tree

6 files changed

+132
-9
lines changed

6 files changed

+132
-9
lines changed

android/src/main/java/com/margelo/nitro/multipleimagepicker/MultipleImagePickerImp.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import com.facebook.react.bridge.ReactMethod
1414
import com.luck.picture.lib.app.IApp
1515
import com.luck.picture.lib.app.PictureAppMaster
1616
import com.luck.picture.lib.basic.PictureSelector
17-
import com.luck.picture.lib.config.Crop
1817
import com.luck.picture.lib.config.PictureMimeType
1918
import com.luck.picture.lib.config.SelectMimeType
2019
import com.luck.picture.lib.config.SelectModeConfig

src/types/camera.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ColorValue } from 'react-native'
2-
import { CropRatio, Language, MediaType, Presentation } from './config'
3-
import { PickerCropConfig } from './crop'
4-
import { BaseResult, ResultType } from './result'
2+
import { Language, MediaType, Presentation } from './config'
3+
import { PickerCropConfig, CropRatio } from './crop'
4+
import { BaseResult } from './result'
55

66
export type CameraDevice = 'front' | 'back'
77

src/types/config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,3 @@ export type Language =
1818
| 'ar'
1919

2020
export type MediaType = 'video' | 'image' | 'all'
21-
22-
export type CropRatio = { title?: string; width: number; height: number }

src/types/crop.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { CropRatio, Language, Presentation } from './config'
1+
import { Language, Presentation } from './config'
2+
3+
export type CropRatio = { title?: string; width: number; height: number }
24

35
/**
46
* Configuration for image cropping

src/types/picker.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ColorValue } from 'react-native'
2-
import { CropRatio, Language, MediaType, Presentation, Theme } from './config'
2+
import { Language, MediaType, Presentation, Theme } from './config'
33
import { Result } from './result'
4-
import { PickerCropConfig } from './crop'
4+
import { PickerCropConfig, CropRatio } from './crop'
55
import { PickerCameraConfig } from './camera'
66

77
export type SelectBoxStyle = 'number' | 'tick'
@@ -217,6 +217,7 @@ export interface NitroConfig {
217217
camera?: PickerCameraConfig
218218
}
219219

220+
// CONFIG TYPE
220221
export interface Config
221222
extends Omit<
222223
NitroConfig,

src/types/result.ts

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,153 @@
1+
/**
2+
* Represents the type of media content
3+
* @example
4+
* const type: ResultType = 'image'
5+
* const type: ResultType = 'video'
6+
*/
17
export type ResultType = 'image' | 'video'
28

9+
/**
10+
* Base interface containing common properties for media results.
11+
* Used as a foundation for more specific result types.
12+
*
13+
* @example
14+
* const baseResult: BaseResult = {
15+
* path: '/path/to/media/file.jpg',
16+
* type: 'image',
17+
* width: 1920,
18+
* height: 1080,
19+
* fileName: 'file.jpg'
20+
* }
21+
*/
322
export interface BaseResult {
23+
/**
24+
* File path of the media asset
25+
* Can be relative or absolute depending on context
26+
*/
427
path: string
528

29+
/**
30+
* Type of media content
31+
* Used to determine how the asset should be handled
32+
*/
633
type: ResultType
734

35+
/**
36+
* Width of the media in pixels
37+
* Optional in base result as it may not be immediately available
38+
*/
839
width?: number
940

41+
/**
42+
* Height of the media in pixels
43+
* Optional in base result as it may not be immediately available
44+
*/
1045
height?: number
1146

47+
/**
48+
* Duration of the media in seconds
49+
* Only applicable for video content
50+
* @example 120.5 // 2 minutes and 30 seconds
51+
*/
1252
duration?: number
1353

54+
/**
55+
* Path to a thumbnail image representation
56+
* Useful for previews and grid displays
57+
* Can be a local path or URL depending on implementation
58+
*/
1459
thumbnail?: string
1560

61+
/**
62+
* Original filename of the media asset
63+
* Includes the file extension
64+
* @example "IMG_20240301_123456.jpg"
65+
*/
1666
fileName?: string
1767
}
1868

69+
/**
70+
* Extended result interface with complete metadata and file information.
71+
* Used for fully processed media assets where all properties are known.
72+
*
73+
* @extends BaseResult
74+
*
75+
* @example
76+
* const result: Result = {
77+
* path: '/path/to/media/file.jpg',
78+
* type: 'image',
79+
* width: 1920,
80+
* height: 1080,
81+
* fileName: 'file.jpg',
82+
* localIdentifier: 'unique-id-123',
83+
* mime: 'image/jpeg',
84+
* size: 1024000,
85+
* creationDate: 1709312436000
86+
* }
87+
*/
1988
export interface Result extends BaseResult {
89+
/**
90+
* Unique identifier for the media asset
91+
* Used for local database tracking and reference
92+
* Format may vary depending on platform/implementation
93+
*/
2094
localIdentifier: string
95+
96+
/**
97+
* Width of the media in pixels
98+
* Required in Result interface as it should be known after processing
99+
*/
21100
width: number
101+
102+
/**
103+
* Height of the media in pixels
104+
* Required in Result interface as it should be known after processing
105+
*/
22106
height: number
107+
108+
/**
109+
* MIME type of the media file
110+
* @example "image/jpeg", "video/mp4"
111+
*/
23112
mime: string
113+
114+
/**
115+
* File size in bytes
116+
* @example 1024000 // 1MB
117+
*/
24118
size: number
119+
120+
/**
121+
* Optional identifier for storage bucket
122+
* Used when assets are stored in cloud storage systems
123+
* @platform android
124+
*/
25125
bucketId?: number
126+
127+
/**
128+
* Actual file path on the system
129+
* May differ from the `path` property in cases where
130+
* the file is stored in a different location than referenced
131+
* @platform android
132+
*/
26133
realPath?: string
134+
135+
/**
136+
* Name of the containing folder
137+
* Useful for organization and grouping
138+
* @platform android
139+
*/
27140
parentFolderName?: string
141+
142+
/**
143+
* Unix timestamp in milliseconds of when the media was created
144+
* @example 1709312436000 // March 1, 2024 12:34:56 PM
145+
*/
28146
creationDate?: number
147+
148+
/**
149+
* Indicates if the media has been cropped from its original dimensions
150+
* Used to track image modifications
151+
*/
29152
crop?: boolean
30153
}

0 commit comments

Comments
 (0)