Skip to content

Commit

Permalink
feat(mobile): share to mechanism (immich-app#15229)
Browse files Browse the repository at this point in the history
* setup ios

* chore: succesfully sent media to the app

* share from Android

* wip: navigate to share screen

* wip: UI for displaying upload candidate

* wip: logic

* wip: upload logic

* wip: up up up we got it up

* wip

* wip

* wip

* upload state

* feat: i18n

* fix: release build ios'

* feat: clear file cache

* pr feedback

* using const for checking download status

---------

Co-authored-by: Alex <[email protected]>
  • Loading branch information
2 people authored and vladd11 committed Jan 25, 2025
1 parent 35b44c6 commit 2adf41f
Show file tree
Hide file tree
Showing 33 changed files with 1,368 additions and 55 deletions.
32 changes: 30 additions & 2 deletions mobile/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/notification_icon" />

<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop"
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTask"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
Expand All @@ -61,6 +61,34 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>


<!--TODO:
Add this filter if you want to handle shared images-->
<intent-filter android:label="Upload to Immich">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>

<intent-filter android:label="Upload to Immich">
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>

<!--TODO:
Add this filter if you want to handle shared videos-->
<intent-filter android:label="Upload to Immich">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="video/*" />
</intent-filter>
<intent-filter android:label="Upload to Immich">
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="video/*" />
</intent-filter>

</activity>


Expand Down Expand Up @@ -96,4 +124,4 @@
<data android:scheme="geo" />
</intent>
</queries>
</manifest>
</manifest>
12 changes: 11 additions & 1 deletion mobile/assets/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -657,5 +657,15 @@
"viewer_stack_use_as_main_asset": "Use as Main Asset",
"viewer_unstack": "Un-Stack",
"wifi_name": "WiFi Name",
"your_wifi_name": "Your WiFi name"
"your_wifi_name": "Your WiFi name",
"upload": "Upload",
"uploading": "Uploading",
"shared_intent_upload_button_progress_text": "{} / {} Uploaded",
"enqueued": "Enqueued",
"not_selected": "Not selected",
"completed": "Completed",
"failed": "Failed",
"paused": "Paused",
"canceled": "Canceled",
"upload_to_immich": "Upload to Immich ({})"
}
7 changes: 7 additions & 0 deletions mobile/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ target 'Runner' do
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

# share_handler addition start
target 'ShareExtension' do
inherit! :search_paths
pod "share_handler_ios_models", :path => ".symlinks/plugins/share_handler_ios/ios/Models"
end
# share_handler addition end
end

post_install do |installer|
Expand Down
30 changes: 23 additions & 7 deletions mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,17 @@ PODS:
- Flutter
- FlutterMacOS
- SAMKeychain (1.5.3)
- SDWebImage (5.19.4):
- SDWebImage/Core (= 5.19.4)
- SDWebImage/Core (5.19.4)
- SDWebImage (5.20.0):
- SDWebImage/Core (= 5.20.0)
- SDWebImage/Core (5.20.0)
- share_handler_ios (0.0.14):
- Flutter
- share_handler_ios/share_handler_ios_models (= 0.0.14)
- share_handler_ios_models
- share_handler_ios/share_handler_ios_models (0.0.14):
- Flutter
- share_handler_ios_models
- share_handler_ios_models (0.0.9)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
Expand All @@ -94,7 +102,7 @@ PODS:
- Flutter
- FlutterMacOS
- SwiftyGif (5.4.5)
- Toast (4.0.0)
- Toast (4.1.1)
- url_launcher_ios (0.0.1):
- Flutter
- wakelock_plus (0.0.1):
Expand Down Expand Up @@ -123,6 +131,8 @@ DEPENDENCIES:
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- photo_manager (from `.symlinks/plugins/photo_manager/ios`)
- share_handler_ios (from `.symlinks/plugins/share_handler_ios/ios`)
- share_handler_ios_models (from `.symlinks/plugins/share_handler_ios/ios/Models`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
Expand Down Expand Up @@ -184,6 +194,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/permission_handler_apple/ios"
photo_manager:
:path: ".symlinks/plugins/photo_manager/ios"
share_handler_ios:
:path: ".symlinks/plugins/share_handler_ios/ios"
share_handler_ios_models:
:path: ".symlinks/plugins/share_handler_ios/ios/Models"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
Expand Down Expand Up @@ -222,15 +236,17 @@ SPEC CHECKSUMS:
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
photo_manager: ff695c7a1dd5bc379974953a2b5c0a293f7c4c8a
SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c
SDWebImage: 066c47b573f408f18caa467d71deace7c0f8280d
SDWebImage: 73c6079366fea25fa4bb9640d5fb58f0893facd8
share_handler_ios: 6dd3a4ac5ca0d955274aec712ba0ecdcaf583e7c
share_handler_ios_models: fc638c9b4330dc7f082586c92aee9dfa0b87b871
share_plus: 8b6f8b3447e494cca5317c8c3073de39b3600d1f
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1

PODFILE CHECKSUM: 2282844f7aed70427ae663932332dad1225156c8
PODFILE CHECKSUM: 03b7eead4ee77b9e778179eeb0f3b5513617451c

COCOAPODS: 1.15.2
Loading

0 comments on commit 2adf41f

Please sign in to comment.