From 09ad917e5d83446072c33e37024b3101e3d9d17b Mon Sep 17 00:00:00 2001 From: LittleSheep <littlesheep.code@hotmail.com> Date: Sun, 15 Dec 2024 12:10:45 +0800 Subject: [PATCH] :heavy_plus_sign: Add share intent --- android/app/src/main/AndroidManifest.xml | 56 +++- ios/Podfile | 4 + ios/Podfile.lock | 8 +- ios/Runner.xcodeproj/project.pbxproj | 251 +++++++++++++++++- ios/Runner/Info.plist | 13 + ios/Runner/Runner.entitlements | 5 + .../Base.lproj/MainInterface.storyboard | 24 ++ ios/SolarShare/Info.plist | 36 +++ ios/SolarShare/ShareViewController.swift | 18 ++ ios/SolarShare/SolarShare.entitlements | 10 + lib/main.dart | 12 + lib/screens/home.dart | 2 +- pubspec.lock | 8 + pubspec.yaml | 1 + 14 files changed, 441 insertions(+), 7 deletions(-) create mode 100644 ios/SolarShare/Base.lproj/MainInterface.storyboard create mode 100644 ios/SolarShare/Info.plist create mode 100644 ios/SolarShare/ShareViewController.swift create mode 100644 ios/SolarShare/SolarShare.entitlements diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index aede704..2c92c16 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -11,6 +11,7 @@ <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29" /> <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <application android:label="Solian" @@ -20,12 +21,65 @@ <activity android:name=".MainActivity" android:exported="true" - android:launchMode="singleTop" + android:launchMode="singleTask" android:taskAffinity="" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"> + <!-- Sharing Intents --> + <intent-filter> + <action android:name="android.intent.action.VIEW" /> + <category android:name="android.intent.category.DEFAULT" /> + <category android:name="android.intent.category.BROWSABLE" /> + <data + android:scheme="https" + android:host="sn.solsynth.dev" + android:pathPrefix="/invite"/> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.VIEW" /> + <category android:name="android.intent.category.DEFAULT" /> + <data + android:mimeType="*/*" + android:scheme="content" /> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.SEND" /> + <category android:name="android.intent.category.DEFAULT" /> + <data android:mimeType="text/*" /> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.SEND" /> + <category android:name="android.intent.category.DEFAULT" /> + <data android:mimeType="image/*" /> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.SEND_MULTIPLE" /> + <category android:name="android.intent.category.DEFAULT" /> + <data android:mimeType="image/*" /> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.SEND" /> + <category android:name="android.intent.category.DEFAULT" /> + <data android:mimeType="video/*" /> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.SEND_MULTIPLE" /> + <category android:name="android.intent.category.DEFAULT" /> + <data android:mimeType="video/*" /> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.SEND" /> + <category android:name="android.intent.category.DEFAULT" /> + <data android:mimeType="*/*" /> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.SEND_MULTIPLE" /> + <category android:name="android.intent.category.DEFAULT" /> + <data android:mimeType="*/*" /> + </intent-filter> + <!-- Specifies an Android theme to apply to this Activity as soon as the Android process has started. This theme is visible to the user while the Flutter UI initializes. After that, this theme continues diff --git a/ios/Podfile b/ios/Podfile index ba9304f..f922a47 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -35,6 +35,10 @@ target 'Runner' do target 'RunnerTests' do inherit! :search_paths end + + target 'SolarShare' do + inherit! :search_paths + end end post_install do |installer| diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2a41fb5..389a36b 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -192,6 +192,8 @@ PODS: - permission_handler_apple (9.3.0): - Flutter - PromisesObjC (2.4.0) + - receive_sharing_intent (1.8.1): + - Flutter - SAMKeychain (1.5.3) - screen_brightness_ios (0.1.0): - Flutter @@ -239,6 +241,7 @@ DEPENDENCIES: - pasteboard (from `.symlinks/plugins/pasteboard/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) + - receive_sharing_intent (from `.symlinks/plugins/receive_sharing_intent/ios`) - screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`) - share_plus (from `.symlinks/plugins/share_plus/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) @@ -314,6 +317,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/path_provider_foundation/darwin" permission_handler_apple: :path: ".symlinks/plugins/permission_handler_apple/ios" + receive_sharing_intent: + :path: ".symlinks/plugins/receive_sharing_intent/ios" screen_brightness_ios: :path: ".symlinks/plugins/screen_brightness_ios/ios" share_plus: @@ -366,6 +371,7 @@ SPEC CHECKSUMS: path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 + receive_sharing_intent: 79c848f5b045674ad60b9fea3bafea59962ad2c1 SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625 SDWebImage: 73c6079366fea25fa4bb9640d5fb58f0893facd8 @@ -378,6 +384,6 @@ SPEC CHECKSUMS: wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1 WebRTC-SDK: 79942c006ea64f6fb48d7da8a4786dfc820bc1db -PODFILE CHECKSUM: d2bdaa1cc7915e14cf47235c34a21fcb07b00390 +PODFILE CHECKSUM: 23d35ad686cacf9103d1e85035ee4f3e9750630d COCOAPODS: 1.16.2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 939bde1..2197bc3 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 738C1EAC2D0D76A400A215F3 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 731B7B6B2D0D6CE000CEB9B7 /* WidgetKit.framework */; }; 738C1EAD2D0D76A400A215F3 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 731B7B6D2D0D6CE000CEB9B7 /* SwiftUI.framework */; }; 738C1EB82D0D76A500A215F3 /* SolarWidgetExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 738C1EAB2D0D76A400A215F3 /* SolarWidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 73B7746E2D0E869200A789CE /* SolarShare.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 73B774642D0E869200A789CE /* SolarShare.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 73DA8A012D05C7620024A03E /* SolarNotifyService.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 73DA89FA2D05C7620024A03E /* SolarNotifyService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 8CD0929C27BC410DD5056EAB /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = A2C24C5238FAC44EA2CCF738 /* GoogleService-Info.plist */; }; @@ -21,6 +22,7 @@ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; CED170BFB6A72CDDAC285637 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDF483E994343CDFBF9BA347 /* Pods_Runner.framework */; }; + F51C4E3C8FA95426C91FC0A4 /* Pods_SolarShare.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 16F41E029731EA30268EDE2A /* Pods_SolarShare.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -38,6 +40,13 @@ remoteGlobalIDString = 738C1EAA2D0D76A400A215F3; remoteInfo = SolarWidgetExtension; }; + 73B7746C2D0E869200A789CE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 73B774632D0E869200A789CE; + remoteInfo = SolarShare; + }; 73DA89FF2D05C7620024A03E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 97C146E61CF9000F007C117D /* Project object */; @@ -55,6 +64,7 @@ dstSubfolderSpec = 13; files = ( 738C1EB82D0D76A500A215F3 /* SolarWidgetExtension.appex in Embed Foundation Extensions */, + 73B7746E2D0E869200A789CE /* SolarShare.appex in Embed Foundation Extensions */, 73DA8A012D05C7620024A03E /* SolarNotifyService.appex in Embed Foundation Extensions */, ); name = "Embed Foundation Extensions"; @@ -75,13 +85,16 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; + 16F41E029731EA30268EDE2A /* Pods_SolarShare.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SolarShare.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 26CC8DE2338798EAB472B62D /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2DA1B873D39B9FD33298BBCE /* Pods-SolarShare.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SolarShare.profile.xcconfig"; path = "Target Support Files/Pods-SolarShare/Pods-SolarShare.profile.xcconfig"; sourceTree = "<group>"; }; 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; }; 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; 40B53769EB464E54DACA7CE4 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; }; 48AE73F9950AF4FB02B5E9F4 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; }; 4A2F84B6033057E3BD2C7CB8 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; }; + 5922A50B1231B06B92E31F20 /* Pods-SolarShare.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SolarShare.debug.xcconfig"; path = "Target Support Files/Pods-SolarShare/Pods-SolarShare.debug.xcconfig"; sourceTree = "<group>"; }; 64FBE78F9C282712818D6D95 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; }; 72E9279EFA6DAC00BBAC493C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; }; 73111C212CEE3D5E004CF4B3 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; }; @@ -89,6 +102,7 @@ 731B7B6D2D0D6CE000CEB9B7 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; }; 738C1EAB2D0D76A400A215F3 /* SolarWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = SolarWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 738C1F132D0D7DDC00A215F3 /* SolarWidgetExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SolarWidgetExtension.entitlements; sourceTree = "<group>"; }; + 73B774642D0E869200A789CE /* SolarShare.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = SolarShare.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 73DA89FA2D05C7620024A03E /* SolarNotifyService.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = SolarNotifyService.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; @@ -102,6 +116,7 @@ 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; A2C24C5238FAC44EA2CCF738 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; }; + B1763F1D7318A2745CA7EDFE /* Pods-SolarShare.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SolarShare.release.xcconfig"; path = "Target Support Files/Pods-SolarShare/Pods-SolarShare.release.xcconfig"; sourceTree = "<group>"; }; EDF483E994343CDFBF9BA347 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -121,6 +136,13 @@ ); target = 738C1EAA2D0D76A400A215F3 /* SolarWidgetExtension */; }; + 73B774722D0E869200A789CE /* Exceptions for "SolarShare" folder in "SolarShare" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + Info.plist, + ); + target = 73B774632D0E869200A789CE /* SolarShare */; + }; 73BC73712D0DDF6300956BE0 /* Exceptions for "Service" folder in "SolarNotifyService" target */ = { isa = PBXFileSystemSynchronizedBuildFileExceptionSet; membershipExceptions = ( @@ -161,6 +183,14 @@ path = Data; sourceTree = "<group>"; }; + 73B774652D0E869200A789CE /* SolarShare */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + 73B774722D0E869200A789CE /* Exceptions for "SolarShare" folder in "SolarShare" target */, + ); + path = SolarShare; + sourceTree = "<group>"; + }; 73BC736C2D0DDF5600956BE0 /* Service */ = { isa = PBXFileSystemSynchronizedRootGroup; exceptions = ( @@ -190,6 +220,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 73B774612D0E869200A789CE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F51C4E3C8FA95426C91FC0A4 /* Pods_SolarShare.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 73DA89F72D05C7620024A03E /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -223,6 +261,7 @@ 26CC8DE2338798EAB472B62D /* Pods_RunnerTests.framework */, 731B7B6B2D0D6CE000CEB9B7 /* WidgetKit.framework */, 731B7B6D2D0D6CE000CEB9B7 /* SwiftUI.framework */, + 16F41E029731EA30268EDE2A /* Pods_SolarShare.framework */, ); name = Frameworks; sourceTree = "<group>"; @@ -254,6 +293,7 @@ 97C146F01CF9000F007C117D /* Runner */, 73DA89FB2D05C7620024A03E /* SolarNotifyService */, 738C1EAE2D0D76A400A215F3 /* SolarWidget */, + 73B774652D0E869200A789CE /* SolarShare */, 97C146EF1CF9000F007C117D /* Products */, 331C8082294A63A400263BE5 /* RunnerTests */, F5165E3BD1F2519F85CD4BE2 /* Pods */, @@ -269,6 +309,7 @@ 331C8081294A63A400263BE5 /* RunnerTests.xctest */, 73DA89FA2D05C7620024A03E /* SolarNotifyService.appex */, 738C1EAB2D0D76A400A215F3 /* SolarWidgetExtension.appex */, + 73B774642D0E869200A789CE /* SolarShare.appex */, ); name = Products; sourceTree = "<group>"; @@ -300,6 +341,9 @@ 40B53769EB464E54DACA7CE4 /* Pods-RunnerTests.debug.xcconfig */, 64FBE78F9C282712818D6D95 /* Pods-RunnerTests.release.xcconfig */, 96081771773FA019A97CCC3F /* Pods-RunnerTests.profile.xcconfig */, + 5922A50B1231B06B92E31F20 /* Pods-SolarShare.debug.xcconfig */, + B1763F1D7318A2745CA7EDFE /* Pods-SolarShare.release.xcconfig */, + 2DA1B873D39B9FD33298BBCE /* Pods-SolarShare.profile.xcconfig */, ); path = Pods; sourceTree = "<group>"; @@ -343,12 +387,31 @@ 738C1EAE2D0D76A400A215F3 /* SolarWidget */, ); name = SolarWidgetExtension; - packageProductDependencies = ( - ); productName = SolarWidgetExtension; productReference = 738C1EAB2D0D76A400A215F3 /* SolarWidgetExtension.appex */; productType = "com.apple.product-type.app-extension"; }; + 73B774632D0E869200A789CE /* SolarShare */ = { + isa = PBXNativeTarget; + buildConfigurationList = 73B774732D0E869200A789CE /* Build configuration list for PBXNativeTarget "SolarShare" */; + buildPhases = ( + 9E6442609CE65E253572BC79 /* [CP] Check Pods Manifest.lock */, + 73B774602D0E869200A789CE /* Sources */, + 73B774612D0E869200A789CE /* Frameworks */, + 73B774622D0E869200A789CE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 73B774652D0E869200A789CE /* SolarShare */, + ); + name = SolarShare; + productName = SolarShare; + productReference = 73B774642D0E869200A789CE /* SolarShare.appex */; + productType = "com.apple.product-type.app-extension"; + }; 73DA89F92D05C7620024A03E /* SolarNotifyService */ = { isa = PBXNativeTarget; buildConfigurationList = 73DA8A072D05C7620024A03E /* Build configuration list for PBXNativeTarget "SolarNotifyService" */; @@ -365,8 +428,6 @@ 73DA89FB2D05C7620024A03E /* SolarNotifyService */, ); name = SolarNotifyService; - packageProductDependencies = ( - ); productName = SolarNotifyService; productReference = 73DA89FA2D05C7620024A03E /* SolarNotifyService.appex */; productType = "com.apple.product-type.app-extension"; @@ -392,6 +453,7 @@ dependencies = ( 73DA8A002D05C7620024A03E /* PBXTargetDependency */, 738C1EB72D0D76A500A215F3 /* PBXTargetDependency */, + 73B7746D2D0E869200A789CE /* PBXTargetDependency */, ); fileSystemSynchronizedGroups = ( 738C1F4F2D0D91CC00A215F3 /* Data */, @@ -420,6 +482,9 @@ 738C1EAA2D0D76A400A215F3 = { CreatedOnToolsVersion = 16.2; }; + 73B774632D0E869200A789CE = { + CreatedOnToolsVersion = 16.2; + }; 73DA89F92D05C7620024A03E = { CreatedOnToolsVersion = 16.1; }; @@ -446,6 +511,7 @@ 331C8080294A63A400263BE5 /* RunnerTests */, 73DA89F92D05C7620024A03E /* SolarNotifyService */, 738C1EAA2D0D76A400A215F3 /* SolarWidgetExtension */, + 73B774632D0E869200A789CE /* SolarShare */, ); }; /* End PBXProject section */ @@ -465,6 +531,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 73B774622D0E869200A789CE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 73DA89F82D05C7620024A03E /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -571,6 +644,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + 9E6442609CE65E253572BC79 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-SolarShare-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; C431F2F1BD10FD03D14DDAE1 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -650,6 +745,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 73B774602D0E869200A789CE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 73DA89F62D05C7620024A03E /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -679,6 +781,11 @@ target = 738C1EAA2D0D76A400A215F3 /* SolarWidgetExtension */; targetProxy = 738C1EB62D0D76A500A215F3 /* PBXContainerItemProxy */; }; + 73B7746D2D0E869200A789CE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 73B774632D0E869200A789CE /* SolarShare */; + targetProxy = 73B7746C2D0E869200A789CE /* PBXContainerItemProxy */; + }; 73DA8A002D05C7620024A03E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 73DA89F92D05C7620024A03E /* SolarNotifyService */; @@ -766,6 +873,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + CUSTOM_GROUP_ID = group.solsynth.solian; DEVELOPMENT_TEAM = W7HPZ53V6B; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -960,6 +1068,129 @@ }; name = Profile; }; + 73B7746F2D0E869200A789CE /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 5922A50B1231B06B92E31F20 /* Pods-SolarShare.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = SolarShare/SolarShare.entitlements; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + CUSTOM_GROUP_ID = group.solsynth.solian; + DEVELOPMENT_TEAM = W7HPZ53V6B; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = SolarShare/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = SolarShare; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = dev.solsynth.solian.SolarShare; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 73B774702D0E869200A789CE /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = B1763F1D7318A2745CA7EDFE /* Pods-SolarShare.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = SolarShare/SolarShare.entitlements; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + CUSTOM_GROUP_ID = group.solsynth.solian; + DEVELOPMENT_TEAM = W7HPZ53V6B; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = SolarShare/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = SolarShare; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = dev.solsynth.solian.SolarShare; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 73B774712D0E869200A789CE /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 2DA1B873D39B9FD33298BBCE /* Pods-SolarShare.profile.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = SolarShare/SolarShare.entitlements; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + CUSTOM_GROUP_ID = group.solsynth.solian; + DEVELOPMENT_TEAM = W7HPZ53V6B; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = SolarShare/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = SolarShare; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = dev.solsynth.solian.SolarShare; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Profile; + }; 73DA8A032D05C7620024A03E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1196,6 +1427,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + CUSTOM_GROUP_ID = group.solsynth.solian; DEVELOPMENT_TEAM = W7HPZ53V6B; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -1223,6 +1455,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + CUSTOM_GROUP_ID = group.solsynth.solian; DEVELOPMENT_TEAM = W7HPZ53V6B; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -1264,6 +1497,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 73B774732D0E869200A789CE /* Build configuration list for PBXNativeTarget "SolarShare" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 73B7746F2D0E869200A789CE /* Debug */, + 73B774702D0E869200A789CE /* Release */, + 73B774712D0E869200A789CE /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 73DA8A072D05C7620024A03E /* Build configuration list for PBXNativeTarget "SolarNotifyService" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 2ac502b..1e77265 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -66,6 +66,8 @@ <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> + <key>AppGroupId</key> + <string>group.solsynth.solian</string> <key>UISupportedInterfaceOrientations~ipad</key> <array> <string>UIInterfaceOrientationPortrait</string> @@ -73,5 +75,16 @@ <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> + <key>CFBundleURLTypes</key> + <array> + <dict> + <key>CFBundleTypeRole</key> + <string>Editor</string> + <key>CFBundleURLSchemes</key> + <array> + <string>ShareMedia-$(PRODUCT_BUNDLE_IDENTIFIER)</string> + </array> + </dict> + </array> </dict> </plist> diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements index f7add75..a3b945d 100644 --- a/ios/Runner/Runner.entitlements +++ b/ios/Runner/Runner.entitlements @@ -4,6 +4,11 @@ <dict> <key>aps-environment</key> <string>development</string> + <key>com.apple.developer.associated-domains</key> + <array> + <string>webcredentials:sn.solsynth.dev</string> + <string>applinks:sn.solsynth.dev</string> + </array> <key>com.apple.developer.usernotifications.communication</key> <true/> <key>com.apple.security.application-groups</key> diff --git a/ios/SolarShare/Base.lproj/MainInterface.storyboard b/ios/SolarShare/Base.lproj/MainInterface.storyboard new file mode 100644 index 0000000..286a508 --- /dev/null +++ b/ios/SolarShare/Base.lproj/MainInterface.storyboard @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="j1y-V4-xli"> + <dependencies> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/> + <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--Share View Controller--> + <scene sceneID="ceB-am-kn3"> + <objects> + <viewController id="j1y-V4-xli" customClass="ShareViewController" customModuleProvider="target" sceneMemberID="viewController"> + <view key="view" opaque="NO" contentMode="scaleToFill" id="wbc-yd-nQP"> + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/> + <viewLayoutGuide key="safeArea" id="1Xd-am-t49"/> + </view> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="CEy-Cv-SGf" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + </scene> + </scenes> +</document> diff --git a/ios/SolarShare/Info.plist b/ios/SolarShare/Info.plist new file mode 100644 index 0000000..b256dc6 --- /dev/null +++ b/ios/SolarShare/Info.plist @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>PHSupportedMediaTypes</key> + <array> + <string>Video</string> + <string>Image</string> + </array> + <key>NSExtensionActivationRule</key> + <dict> + <key>NSExtensionActivationSupportsText</key> + <true/> + <key>NSExtensionActivationSupportsWebURLWithMaxCount</key> + <integer>1</integer> + <key>NSExtensionActivationSupportsImageWithMaxCount</key> + <integer>100</integer> + <key>NSExtensionActivationSupportsMovieWithMaxCount</key> + <integer>100</integer> + <key>NSExtensionActivationSupportsFileWithMaxCount</key> + <integer>100</integer> + </dict> + <key>NSExtension</key> + <dict> + <key>NSExtensionAttributes</key> + <dict> + <key>NSExtensionActivationRule</key> + <string>TRUEPREDICATE</string> + </dict> + <key>NSExtensionMainStoryboard</key> + <string>MainInterface</string> + <key>NSExtensionPointIdentifier</key> + <string>com.apple.share-services</string> + </dict> +</dict> +</plist> diff --git a/ios/SolarShare/ShareViewController.swift b/ios/SolarShare/ShareViewController.swift new file mode 100644 index 0000000..6390bbe --- /dev/null +++ b/ios/SolarShare/ShareViewController.swift @@ -0,0 +1,18 @@ +// +// ShareViewController.swift +// SolarShare +// +// Created by LittleSheep on 2024/12/15. +// + +import receive_sharing_intent + +class ShareViewController: RSIShareViewController { + + // Use this method to return false if you don't want to redirect to host app automatically. + // Default is true + override func shouldAutoRedirect() -> Bool { + return true + } + +} diff --git a/ios/SolarShare/SolarShare.entitlements b/ios/SolarShare/SolarShare.entitlements new file mode 100644 index 0000000..7121c32 --- /dev/null +++ b/ios/SolarShare/SolarShare.entitlements @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>com.apple.security.application-groups</key> + <array> + <string>group.solsynth.solian</string> + </array> +</dict> +</plist> diff --git a/lib/main.dart b/lib/main.dart index 7a4f99a..f4d8184 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,5 @@ +import 'dart:async'; +import 'dart:developer'; import 'dart:io'; import 'package:bitsdojo_window/bitsdojo_window.dart'; @@ -12,6 +14,7 @@ import 'package:go_router/go_router.dart'; import 'package:hive_flutter/hive_flutter.dart'; import 'package:home_widget/home_widget.dart'; import 'package:provider/provider.dart'; +import 'package:receive_sharing_intent/receive_sharing_intent.dart'; import 'package:relative_time/relative_time.dart'; import 'package:responsive_framework/responsive_framework.dart'; import 'package:styled_widget/styled_widget.dart'; @@ -162,6 +165,8 @@ class _AppSplashScreen extends StatefulWidget { class _AppSplashScreenState extends State<_AppSplashScreen> { bool _isReady = false; + late StreamSubscription _shareIntentSubscription; + Future<void> _initialize() async { try { final home = context.read<HomeWidgetProvider>(); @@ -186,10 +191,17 @@ class _AppSplashScreenState extends State<_AppSplashScreen> { } } + void _listenShareIntent() async { + _shareIntentSubscription = ReceiveSharingIntent.instance.getMediaStream().listen((value) {}, onError: (err) { + log("[ShareIntent] Unable to subscribe: $err"); + }); + } + @override void initState() { super.initState(); _initialize(); + _listenShareIntent(); } @override diff --git a/lib/screens/home.dart b/lib/screens/home.dart index c4a99f0..b07b621 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -177,7 +177,7 @@ class _HomeDashCheckInWidgetState extends State<_HomeDashCheckInWidget> { Text( prefix.tr(args: ['$prefix$pos'.tr()]), style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.bold), - ).tr(), + ), Text( '$prefix${pos}Description', style: Theme.of(context).textTheme.bodyMedium, diff --git a/pubspec.lock b/pubspec.lock index 818cbbb..0da67ed 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1474,6 +1474,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.0" + receive_sharing_intent: + dependency: "direct main" + description: + name: receive_sharing_intent + sha256: ec76056e4d258ad708e76d85591d933678625318e411564dcb9059048ca3a593 + url: "https://pub.dev" + source: hosted + version: "1.8.1" relative_time: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index d7e1b17..2903e95 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -105,6 +105,7 @@ dependencies: marquee: ^2.3.0 flutter_svg: ^2.0.16 home_widget: ^0.7.0 + receive_sharing_intent: ^1.8.1 dev_dependencies: flutter_test: