Merge pull request #6266 from sahilyeole/feat/mobile_uni_link
Feat: mobile uni link support (android + ios)
This commit is contained in:
commit
6a281fb7ba
@ -61,6 +61,14 @@
|
|||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
|
<!-- Intent for deep linking-->
|
||||||
|
<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="rustdesk" />
|
||||||
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@ -81,4 +89,4 @@
|
|||||||
android:value="2" />
|
android:value="2" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -24,6 +24,21 @@
|
|||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||||
|
<key>CFBundleURLTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Editor</string>
|
||||||
|
<key>CFBundleURLIconFile</key>
|
||||||
|
<string></string>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>com.carriez.rustdesk</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>rustdesk</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||||
|
@ -1955,6 +1955,7 @@ bool handleUriLink({List<String>? cmdArgs, Uri? uri, String? uriString}) {
|
|||||||
List<String>? urlLinkToCmdArgs(Uri uri) {
|
List<String>? urlLinkToCmdArgs(Uri uri) {
|
||||||
String? command;
|
String? command;
|
||||||
String? id;
|
String? id;
|
||||||
|
final options = ["connect", "play", "file-transfer", "port-forward", "rdp"];
|
||||||
if (uri.authority.isEmpty &&
|
if (uri.authority.isEmpty &&
|
||||||
uri.path.split('').every((char) => char == '/')) {
|
uri.path.split('').every((char) => char == '/')) {
|
||||||
return [];
|
return [];
|
||||||
@ -1962,18 +1963,33 @@ List<String>? urlLinkToCmdArgs(Uri uri) {
|
|||||||
// For compatibility
|
// For compatibility
|
||||||
command = '--connect';
|
command = '--connect';
|
||||||
id = uri.path.substring("/new/".length);
|
id = uri.path.substring("/new/".length);
|
||||||
} else if (['connect', "play", 'file-transfer', 'port-forward', 'rdp']
|
} else if (options.contains(uri.authority)) {
|
||||||
.contains(uri.authority)) {
|
final optionIndex = options.indexOf(uri.authority);
|
||||||
command = '--${uri.authority}';
|
command = '--${uri.authority}';
|
||||||
if (uri.path.length > 1) {
|
if (uri.path.length > 1) {
|
||||||
id = uri.path.substring(1);
|
id = uri.path.substring(1);
|
||||||
}
|
}
|
||||||
|
if (isMobile && id != null) {
|
||||||
|
if (optionIndex == 0 || optionIndex == 1) {
|
||||||
|
connect(Get.context!, id);
|
||||||
|
} else if (optionIndex == 2) {
|
||||||
|
connect(Get.context!, id, isFileTransfer: true);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
} else if (uri.authority.length > 2 && uri.path.length <= 1) {
|
} else if (uri.authority.length > 2 && uri.path.length <= 1) {
|
||||||
// rustdesk://<connect-id>
|
// rustdesk://<connect-id>
|
||||||
command = '--connect';
|
command = '--connect';
|
||||||
id = uri.authority;
|
id = uri.authority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isMobile){
|
||||||
|
if (id != null){
|
||||||
|
connect(Get.context!, id);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<String> args = List.empty(growable: true);
|
List<String> args = List.empty(growable: true);
|
||||||
if (command != null && id != null) {
|
if (command != null && id != null) {
|
||||||
args.add(command);
|
args.add(command);
|
||||||
|
@ -156,6 +156,7 @@ void runMobileApp() async {
|
|||||||
await Future.wait([gFFI.abModel.loadCache(), gFFI.groupModel.loadCache()]);
|
await Future.wait([gFFI.abModel.loadCache(), gFFI.groupModel.loadCache()]);
|
||||||
gFFI.userModel.refreshCurrentUser();
|
gFFI.userModel.refreshCurrentUser();
|
||||||
runApp(App());
|
runApp(App());
|
||||||
|
await initUniLinks();
|
||||||
}
|
}
|
||||||
|
|
||||||
void runMultiWindow(
|
void runMultiWindow(
|
||||||
|
@ -54,10 +54,12 @@ class _ConnectionPageState extends State<ConnectionPage> {
|
|||||||
}
|
}
|
||||||
bool isPeersLoading = false;
|
bool isPeersLoading = false;
|
||||||
bool isPeersLoaded = false;
|
bool isPeersLoaded = false;
|
||||||
|
StreamSubscription? _uniLinksSubscription;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
_uniLinksSubscription = listenUniLinks();
|
||||||
if (_idController.text.isEmpty) {
|
if (_idController.text.isEmpty) {
|
||||||
() async {
|
() async {
|
||||||
final lastRemoteId = await bind.mainGetLastRemoteId();
|
final lastRemoteId = await bind.mainGetLastRemoteId();
|
||||||
@ -312,6 +314,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
_uniLinksSubscription?.cancel();
|
||||||
_idController.dispose();
|
_idController.dispose();
|
||||||
if (Get.isRegistered<IDTextEditingController>()) {
|
if (Get.isRegistered<IDTextEditingController>()) {
|
||||||
Get.delete<IDTextEditingController>();
|
Get.delete<IDTextEditingController>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user