fix:修复分享的 url

This commit is contained in:
anfe 2024-06-04 15:48:39 +08:00
parent f44c86a512
commit 46caa46338
2 changed files with 10 additions and 4 deletions

View File

@ -14,6 +14,7 @@
@property(nonatomic,strong) FlutterMethodChannel* methodChannel;
@property (nonatomic, copy) NSString *textToShare;
@property (nonatomic, copy) NSString *urlToShare;
@end
@ -24,7 +25,8 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.textToShare = [[NSString alloc] init];
self.textToShare = [[NSString alloc] init];
[self methodChannelFunction];
}
- (void)methodChannelFunction {
@ -44,10 +46,12 @@
NSDictionary *paramDic = (NSDictionary *)params;
//
self.textToShare = paramDic[@"shareText"];
self.urlToShare = paramDic[@"urlToShare"];
}
//url
NSURL *urlToShare = [NSURL URLWithString:@"https://pre.lock.star-lock.cn:8093/login"];
NSURL *urlToShare = [NSURL URLWithString:self.urlToShare];
// NSURL *urlToShare = [NSURL URLWithString:@"https://pre.lock.star-lock.cn:8093/login"];
//
NSArray *activityItems = @[self.textToShare,urlToShare];

View File

@ -1,4 +1,5 @@
import 'package:flutter/services.dart';
import 'package:star_lock/flavors.dart';
import '../app_settings/app_settings.dart';
@ -19,8 +20,9 @@ class NativeInteractionTool {
///
void loadNativeShare({required String shareText}) {
final String urlToShare = '${F.apiPrefix}/apps';
sendChannel.invokeMethod(
'loadNativeShare', <String, String>{'shareText': shareText});
'loadNativeShare', <String, String>{'shareText': shareText,'urlToShare':urlToShare});
}
///