shareEveryThing method
Implementation
Future shareEveryThing(String url) {
String urlnya = url;
// if(sellonConfig.Config.shareButton == null || !sellonConfig.Config.shareButton) {
// sellonConfig.Config.shareButton = true;
var completer = new Completer();
if (url.contains(".net/")) {
Preferences.getProfile().then((value) {
if (value!.kodeReferral != '') {
// urlnya = "${urlnya}&sln=${value.kodeReferral}";
if (url.contains("community_detail")) {
urlnya = url.replaceAll(".net/community_detail/",
".net/community_detail/sln${value.kodeReferral}/");
// urlnya = url.replaceAll(".net/community_detail/", ".net/app/link/?community_detail/sln${value.kodeReferral}/");
}
if (url.contains("product_detail")) {
urlnya = url.replaceAll(".net/product_detail/",
".net/product_detail/sln${value.kodeReferral}/");
// urlnya = url.replaceAll(".net/product_detail/", ".net/app/link/?product_detail/sln${value.kodeReferral}/");
}
if (url.contains("shop")) {
urlnya = url.replaceAll(
".net/shop/", ".net/shop/sln${value.kodeReferral}/");
// urlnya = url.replaceAll(".net/shop/", ".net/app/link/?shop/sln${value.kodeReferral}/");
}
if (url.contains("share")) {
urlnya = url.replaceAll(
".net/share/", ".net/share/sln${value.kodeReferral}/");
// urlnya = url.replaceAll(".net/share/", ".net/app/link/?share/sln${value.kodeReferral}/");
}
// urlnya = url.replaceAll(".net/", ".net/sln${value.kodeReferral}/");
Share.share(url).then((value) {
completer.complete();
});
// Share.shareWithResult(urlnya).then((value) {
// sellonConfig.Config.shareButton = false;
// completer.complete();
// });
}else{
}
});
} else if (url.contains(".store/")) {
Preferences.getProfile().then((value) {
if (value != null && value.kodeReferral != '') {
// urlnya = "${urlnya}&sln=${value.kodeReferral}";
if (url.contains("community_detail")) {
urlnya = url.replaceAll(".store/community_detail/",
".store/community_detail/sln${value.kodeReferral}/");
// urlnya = url.replaceAll(".net/community_detail/", ".net/app/link/?community_detail/sln${value.kodeReferral}/");
}
if (url.contains("product_detail")) {
urlnya = url.replaceAll(".store/product_detail/",
".store/product_detail/sln${value.kodeReferral}/");
// urlnya = url.replaceAll(".net/product_detail/", ".net/app/link/?product_detail/sln${value.kodeReferral}/");
}
if (url.contains("shop")) {
urlnya = url.replaceAll(
".store/shop/", ".store/shop/sln${value.kodeReferral}/");
// urlnya = url.replaceAll(".net/shop/", ".net/app/link/?shop/sln${value.kodeReferral}/");
}
if (url.contains("share")) {
urlnya = url.replaceAll(
".store/share/", ".store/share/sln${value.kodeReferral}/");
// urlnya = url.replaceAll(".net/share/", ".net/app/link/?share/sln${value.kodeReferral}/");
}
// urlnya = url.replaceAll(".net/", ".net/sln${value.kodeReferral}/");
Share.share(urlnya).then((value) {
// sellonConfig.Config.shareButton = false;
completer.complete();
});
}
});
}
return completer.future;
// }
}