正在查看: Weicon v2.1.4 应用的 ExternalUtils.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Weicon v2.1.4 应用的 ExternalUtils.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package de.weicon.app.shared.utils;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.util.Log;
import android.webkit.MimeTypeMap;
import androidx.core.content.FileProvider;
import de.weicon.app.shared.models.Document;
import de.weicon.app.shared.models.FavoriteFolder;
import de.weicon.app.shared.models.FavoriteItem;
import de.weicon.app.shared.models.FavoriteItemShareObject;
import de.weicon.app.shared.models.FavoriteListShareObject;
import de.weicon.app.shared.services.CustomChromeTabOpener;
import de.weicon.app.shared.services.JsonParsingService;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.LazyThreadSafetyMode;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.io.FilesKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlin.random.Random;
import kotlin.ranges.CharRange;
import kotlin.text.Regex;
import kotlin.text.StringsKt;
import okhttp3.HttpUrl;
import org.joda.time.DateTime;
import org.koin.android.R;
import org.koin.core.Koin;
import org.koin.core.component.KoinComponent;
import org.koin.core.component.KoinScopeComponent;
import org.koin.core.parameter.ParametersHolder;
import org.koin.core.qualifier.Qualifier;
import org.koin.core.scope.Scope;
import org.koin.mp.KoinPlatformTools;
@Metadata(d1 = {"\u0000h\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0006\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\b\n\u0002\b\u000b\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\f\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\bÆ\u0002\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003J\u001a\u0010\n\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\b\u0010\u000e\u001a\u0004\u0018\u00010\u000fJ$\u0010\u0010\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\b\u0010\u0011\u001a\u0004\u0018\u00010\u000f2\b\b\u0002\u0010\u0012\u001a\u00020\u000fJ@\u0010\u0013\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\n\b\u0002\u0010\u0014\u001a\u0004\u0018\u00010\u000f2\n\b\u0002\u0010\u0015\u001a\u0004\u0018\u00010\u000f2\n\b\u0002\u0010\u0016\u001a\u0004\u0018\u00010\u000f2\n\b\u0002\u0010\u0017\u001a\u0004\u0018\u00010\u0018J\u001a\u0010\u0019\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\b\u0010\u001a\u001a\u0004\u0018\u00010\u000fJ:\u0010\u001b\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\b\b\u0002\u0010\u0012\u001a\u00020\u000f2\b\b\u0002\u0010\u001c\u001a\u00020\u001d2\b\b\u0002\u0010\u001e\u001a\u00020\u001d2\n\b\u0002\u0010\u001f\u001a\u0004\u0018\u00010\u000fJ)\u0010 \u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\b\u0010\u001c\u001a\u0004\u0018\u00010\u001d2\b\u0010\u001e\u001a\u0004\u0018\u00010\u001d¢\u0006\u0002\u0010!J\u001c\u0010\"\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\n\b\u0002\u0010\u0016\u001a\u0004\u0018\u00010\u000fJ\u001c\u0010#\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\n\b\u0002\u0010\u0017\u001a\u0004\u0018\u00010\u0018J\"\u0010$\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\u0010\b\u0002\u0010%\u001a\n\u0012\u0004\u0012\u00020\u0018\u0018\u00010&J\u001c\u0010'\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\n\b\u0002\u0010(\u001a\u0004\u0018\u00010\u0018J\u001c\u0010)\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\n\b\u0002\u0010*\u001a\u0004\u0018\u00010\u000fJ8\u0010+\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\b\b\u0001\u0010,\u001a\u00020-2\b\b\u0001\u0010.\u001a\u00020-2\b\b\u0001\u0010/\u001a\u00020-2\b\b\u0001\u00100\u001a\u00020-J\u0010\u00101\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\rJ\u0018\u00102\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\u0006\u00103\u001a\u00020\u000fJ\u0018\u00104\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\u0006\u00105\u001a\u00020\u000fJ\u0012\u00106\u001a\u0004\u0018\u00010\u000f2\u0006\u0010\u001a\u001a\u00020\u000fH\u0002J$\u00107\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\r2\u0006\u00108\u001a\u0002092\f\u0010:\u001a\b\u0012\u0004\u0012\u00020<0;J\b\u0010A\u001a\u00020\u000fH\u0002J\u001e\u0010B\u001a\u00020\u000f2\u0006\u0010\f\u001a\u00020\r2\f\u0010:\u001a\b\u0012\u0004\u0012\u00020<0;H\u0002J\u001e\u0010C\u001a\u00020D2\u0006\u00108\u001a\u0002092\f\u0010:\u001a\b\u0012\u0004\u0012\u00020<0;H\u0002J \u0010E\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\r2\b\u0010F\u001a\u0004\u0018\u00010\u000f2\u0006\u0010G\u001a\u00020\u000fR\u001b\u0010\u0004\u001a\u00020\u00058BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\b\u0010\t\u001a\u0004\b\u0006\u0010\u0007R\u0017\u0010=\u001a\b\u0012\u0004\u0012\u00020>0;¢\u0006\b\n\u0000\u001a\u0004\b?\u0010@¨\u0006H"}, d2 = {"Lde/weicon/app/shared/utils/ExternalUtils;", "Lorg/koin/core/component/KoinComponent;", "<init>", "()V", "jsonParsingService", "Lde/weicon/app/shared/services/JsonParsingService;", "getJsonParsingService", "()Lde/weicon/app/shared/services/JsonParsingService;", "jsonParsingService$delegate", "Lkotlin/Lazy;", "callPhone", HttpUrl.FRAGMENT_ENCODE_SET, "context", "Landroid/content/Context;", "number", HttpUrl.FRAGMENT_ENCODE_SET, "addToClipboard", "content", "label", "sendMail", "email", "subject", "message", "image", "Landroid/net/Uri;", "openBrowser", "url", "openMaps", "latitude", HttpUrl.FRAGMENT_ENCODE_SET, "longitude", "address", "openGoogleMapsNavigation", "(Landroid/content/Context;Ljava/lang/Double;Ljava/lang/Double;)V", "shareText", "shareImage", "shareImages", "images", "Ljava/util/ArrayList;", "sharePdf", "pdf", "openPdf", "pdfUrl", "shareApp", "titlesRes", HttpUrl.FRAGMENT_ENCODE_SET, "messageRes", "linkRes", "shareChooserTextRes", "openAppSettings", "openDocument", "documentUrl", "openFile", "filePath", "getMimeType", "createJsonFileAndShare", "favoriteFolder", "Lde/weicon/app/shared/models/FavoriteFolder;", "favoriteItems", HttpUrl.FRAGMENT_ENCODE_SET, "Lde/weicon/app/shared/models/FavoriteItem;", "chars", HttpUrl.FRAGMENT_ENCODE_SET, "getChars", "()Ljava/util/List;", "randomID", "getLinksForProductsAndDocuments", "createJsonObjectFromFavoriteItems", "Lde/weicon/app/shared/models/FavoriteListShareObject;", "shareProduct", "title", "body", "app_productionRelease"}, k = 1, mv = {2, 1, 0}, xi = R.styleable.AppCompatTheme_checkboxStyle)
public final class ExternalUtils implements KoinComponent {
public static final ExternalUtils INSTANCE;
private static final List<Character> chars;
private static final Lazy jsonParsingService;
private ExternalUtils() {
}
@Override
public Koin getKoin() {
return KoinComponent.DefaultImpls.getKoin(this);
}
static {
ExternalUtils externalUtils = new ExternalUtils();
INSTANCE = externalUtils;
final ExternalUtils externalUtils2 = externalUtils;
LazyThreadSafetyMode defaultLazyMode = KoinPlatformTools.INSTANCE.defaultLazyMode();
final Qualifier qualifier = null;
final Object[] objArr = 0 == true ? 1 : 0;
jsonParsingService = LazyKt.lazy(defaultLazyMode, (Function0) new Function0<JsonParsingService>() {
{
super(0);
}
@Override
public final JsonParsingService invoke() {
Scope rootScope;
KoinComponent koinComponent = KoinComponent.this;
Qualifier qualifier2 = qualifier;
Function0<? extends ParametersHolder> function0 = objArr;
if (koinComponent instanceof KoinScopeComponent) {
rootScope = ((KoinScopeComponent) koinComponent).getScope();
} else {
rootScope = koinComponent.getKoin().getScopeRegistry().getRootScope();
}
return rootScope.get(Reflection.getOrCreateKotlinClass(JsonParsingService.class), qualifier2, function0);
}
});
chars = CollectionsKt.plus((Collection) CollectionsKt.plus((Iterable) new CharRange('a', 'Z'), (Iterable) new CharRange('A', 'Z')), (Iterable) new CharRange('0', '9'));
}
private final JsonParsingService getJsonParsingService() {
return (JsonParsingService) jsonParsingService.getValue();
}
public final void callPhone(Context context, String number) {
if (context == null) {
return;
}
Intent intent = new Intent("android.intent.action.DIAL");
PackageManager packageManager = context.getPackageManager();
List<ResolveInfo> queryIntentActivities = packageManager != null ? packageManager.queryIntentActivities(intent, 65536) : null;
if (queryIntentActivities == null || queryIntentActivities.isEmpty()) {
addToClipboard$default(this, context, number, null, 4, null);
}
intent.setData(Uri.parse("tel:" + number));
context.startActivity(Intent.createChooser(intent, null));
}
public static void addToClipboard$default(ExternalUtils externalUtils, Context context, String str, String str2, int i, Object obj) {
if ((i & 4) != 0) {
str2 = "copy";
}
externalUtils.addToClipboard(context, str, str2);
}
public final void addToClipboard(Context context, String content, String label) {
Intrinsics.checkNotNullParameter(label, "label");
if (context == null) {
return;
}
Object systemService = context.getSystemService("clipboard");
ClipboardManager clipboardManager = systemService instanceof ClipboardManager ? (ClipboardManager) systemService : null;
if (clipboardManager == null) {
return;
}
clipboardManager.setPrimaryClip(ClipData.newPlainText(label, content));
}
public final void sendMail(Context context, String email, String subject, String message, Uri image) {
if (context == null) {
return;
}
Intent intent = new Intent("android.intent.action.SENDTO");
intent.setData(Uri.parse("mailto:" + email));
String str = subject;
if (str != null && str.length() != 0) {
intent.putExtra("android.intent.extra.SUBJECT", subject);
}
String str2 = message;
if (str2 != null && str2.length() != 0) {
intent.putExtra("android.intent.extra.TEXT", message);
}
if (image != null) {
intent.putExtra("android.intent.extra.STREAM", image);
intent.setType("application/image");
}
context.startActivity(Intent.createChooser(intent, null));
}
public final void openBrowser(Context context, String url) {
String str;
if (context == null || (str = url) == null || str.length() == 0) {
return;
}
String lowerCase = url.toLowerCase(Locale.ROOT);
Intrinsics.checkNotNullExpressionValue(lowerCase, "toLowerCase(...)");
if (!StringsKt.contains$default((CharSequence) lowerCase, (CharSequence) "http://", false, 2, (Object) null)) {
String lowerCase2 = url.toLowerCase(Locale.ROOT);
Intrinsics.checkNotNullExpressionValue(lowerCase2, "toLowerCase(...)");
if (!StringsKt.contains$default((CharSequence) lowerCase2, (CharSequence) "https://", false, 2, (Object) null)) {
url = "http://" + url;
}
}
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(url).normalizeScheme());
intent.addFlags(268435456);
context.startActivity(Intent.createChooser(intent, null));
}
public final void openMaps(Context context, String label, double latitude, double longitude, String address) {
Intrinsics.checkNotNullParameter(label, "label");
if (context == null) {
return;
}
String str = "geo:" + latitude + ',' + longitude;
String encode = Uri.encode(latitude + ',' + longitude + " (" + label + ')');
String str2 = address;
if (str2 != null && str2.length() != 0) {
encode = Uri.encode(String.valueOf(address));
}
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str + "?q=" + encode + "&z016"));
intent.setPackage("com.google.android.apps.maps");
context.startActivity(intent);
}
public final void openGoogleMapsNavigation(Context context, Double latitude, Double longitude) {
if (context == null || latitude == null || longitude == null) {
return;
}
context.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("http://maps.google.com/maps?daddr=" + latitude + ',' + longitude)));
}
public static void shareText$default(ExternalUtils externalUtils, Context context, String str, int i, Object obj) {
if ((i & 2) != 0) {
str = null;
}
externalUtils.shareText(context, str);
}
public final void shareText(Context context, String message) {
if (context == null || message == null) {
return;
}
Intent intent = new Intent("android.intent.action.SEND");
intent.putExtra("android.intent.extra.TEXT", message);
intent.setType("text/plain");
context.startActivity(Intent.createChooser(intent, null));
}
public static void shareImage$default(ExternalUtils externalUtils, Context context, Uri uri, int i, Object obj) {
if ((i & 2) != 0) {
uri = null;
}
externalUtils.shareImage(context, uri);
}
public final void shareImage(Context context, Uri image) {
if (context == null || image == null) {
return;
}
Intent intent = new Intent("android.intent.action.SEND");
intent.putExtra("android.intent.extra.STREAM", image);
intent.setType("image/*");
context.startActivity(Intent.createChooser(intent, null));
}
public static void shareImages$default(ExternalUtils externalUtils, Context context, ArrayList arrayList, int i, Object obj) {
if ((i & 2) != 0) {
arrayList = null;
}
externalUtils.shareImages(context, arrayList);
}
public final void shareImages(Context context, ArrayList<Uri> images) {
if (context == null || images == null || images.isEmpty()) {
return;
}
Intent intent = new Intent("android.intent.action.SEND_MULTIPLE");
intent.putParcelableArrayListExtra("android.intent.extra.STREAM", images);
intent.setType("image/*");
context.startActivity(Intent.createChooser(intent, null));
}
public static void sharePdf$default(ExternalUtils externalUtils, Context context, Uri uri, int i, Object obj) {
if ((i & 2) != 0) {
uri = null;
}
externalUtils.sharePdf(context, uri);
}
public final void sharePdf(Context context, Uri pdf) {
if (context == null || pdf == null) {
return;
}
Intent intent = new Intent("android.intent.action.SEND");
intent.putExtra("android.intent.extra.STREAM", pdf);
intent.setType("application/pdf");
context.startActivity(Intent.createChooser(intent, null));
}
public static void openPdf$default(ExternalUtils externalUtils, Context context, String str, int i, Object obj) {
if ((i & 2) != 0) {
str = null;
}
externalUtils.openPdf(context, str);
}
public final void openPdf(Context context, String pdfUrl) {
if (context == null || pdfUrl == null) {
return;
}
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(pdfUrl));
intent.addFlags(268435456);
context.startActivity(intent);
}
public final void shareApp(Context context, int titlesRes, int messageRes, int linkRes, int shareChooserTextRes) {
if (context == null) {
return;
}
try {
Intent intent = new Intent("android.intent.action.SEND");
intent.setType("text/plain");
intent.putExtra("android.intent.extra.SUBJECT", context.getString(titlesRes));
String string = context.getString(messageRes);
Intrinsics.checkNotNullExpressionValue(string, "getString(...)");
intent.putExtra("android.intent.extra.TEXT", string + '\n' + context.getString(linkRes));
context.startActivity(Intent.createChooser(intent, context.getString(shareChooserTextRes)));
} catch (Exception e) {
Log.e("ContexExt", "shareApp Error - " + e.getLocalizedMessage());
}
}
public final void openAppSettings(Context context) {
if (context == null) {
return;
}
Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.addFlags(268435456);
intent.setData(Uri.fromParts("package", context.getPackageName(), null));
context.startActivity(intent);
}
public final void openDocument(Context context, String documentUrl) {
Intrinsics.checkNotNullParameter(documentUrl, "documentUrl");
if (context == null) {
return;
}
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
String lowerCase = documentUrl.toLowerCase(Locale.ROOT);
Intrinsics.checkNotNullExpressionValue(lowerCase, "toLowerCase(...)");
if (StringsKt.contains$default((CharSequence) lowerCase, (CharSequence) ".jpg", false, 2, (Object) null)) {
return;
}
String str = documentUrl;
if (StringsKt.contains$default((CharSequence) str, (CharSequence) ".mp4", false, 2, (Object) null)) {
intent.setDataAndType(Uri.parse(documentUrl), "video/mp4");
context.startActivity(intent);
} else if (StringsKt.contains$default((CharSequence) str, (CharSequence) ".pdf", false, 2, (Object) null)) {
intent.setDataAndType(Uri.parse(documentUrl), "application/pdf");
context.startActivity(intent);
} else {
CustomChromeTabOpener.INSTANCE.setupCustomChromeTab(context, documentUrl);
}
}
public final void openFile(Context context, String filePath) {
Intrinsics.checkNotNullParameter(filePath, "filePath");
if (context == null) {
return;
}
try {
File file = new File(filePath);
Uri uriForFile = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", file);
String absolutePath = file.getAbsolutePath();
Intrinsics.checkNotNullExpressionValue(absolutePath, "getAbsolutePath(...)");
String mimeType = getMimeType(absolutePath);
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setDataAndType(uriForFile, mimeType);
intent.addFlags(1);
context.startActivity(intent);
} catch (Throwable th) {
th.getMessage();
}
}
private final String getMimeType(String url) {
String str = ((String[]) new Regex("\\.").split(url, 0).toArray(new String[0]))[r3.length - 1];
if (str != null) {
return MimeTypeMap.getSingleton().getMimeTypeFromExtension(str);
}
return null;
}
public final void createJsonFileAndShare(Context context, FavoriteFolder favoriteFolder, List<FavoriteItem> favoriteItems) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(favoriteFolder, "favoriteFolder");
Intrinsics.checkNotNullParameter(favoriteItems, "favoriteItems");
FavoriteListShareObject createJsonObjectFromFavoriteItems = createJsonObjectFromFavoriteItems(favoriteFolder, favoriteItems);
String json = getJsonParsingService().getMoshi().adapter(FavoriteListShareObject.class).toJson(createJsonObjectFromFavoriteItems);
Intrinsics.checkNotNullExpressionValue(json, "toJson(...)");
File file = new File(context.getFilesDir() + '/' + createJsonObjectFromFavoriteItems.getName() + ".weifav");
FilesKt.writeText$default(file, json, null, 2, null);
Uri uriForFile = FileProvider.getUriForFile(context, "de.weicon.app.provider", file);
Intent intent = new Intent("android.intent.action.SEND");
intent.setType("text/plain");
intent.putExtra("android.intent.extra.STREAM", uriForFile);
intent.putExtra("android.intent.extra.TEXT", getLinksForProductsAndDocuments(context, favoriteItems));
context.startActivity(Intent.createChooser(intent, favoriteFolder.getName()));
}
public final List<Character> getChars() {
return chars;
}
private final String randomID() {
ArrayList arrayList = new ArrayList(16);
for (int i = 0; i < 16; i++) {
Character ch = (Character) CollectionsKt.random(chars, Random.INSTANCE);
ch.charValue();
arrayList.add(ch);
}
return CollectionsKt.joinToString$default(arrayList, HttpUrl.FRAGMENT_ENCODE_SET, null, null, 0, null, null, 62, null);
}
private final String getLinksForProductsAndDocuments(Context context, List<FavoriteItem> favoriteItems) {
String str;
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
for (FavoriteItem favoriteItem : favoriteItems) {
if (favoriteItem.getFavoriteProduct() != null) {
arrayList.add(context.getString(2131886503) + StringsKt.replace$default(favoriteItem.getFavoriteProduct().getId(), "MA", HttpUrl.FRAGMENT_ENCODE_SET, false, 4, (Object) null));
} else {
Document favoriteDocument = favoriteItem.getFavoriteDocument();
if (favoriteDocument == null || (str = favoriteDocument.getDocumentUrl()) == null) {
str = HttpUrl.FRAGMENT_ENCODE_SET;
}
arrayList2.add(str);
}
}
StringBuilder sb = new StringBuilder();
sb.append(context.getString(2131886227));
Iterator it = arrayList.iterator();
while (it.hasNext()) {
sb.append(((String) it.next()) + "\n\n");
}
Iterator it2 = arrayList2.iterator();
while (it2.hasNext()) {
sb.append(((String) it2.next()) + "\n\n");
}
String sb2 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb2, "toString(...)");
return sb2;
}
private final FavoriteListShareObject createJsonObjectFromFavoriteItems(FavoriteFolder favoriteFolder, List<FavoriteItem> favoriteItems) {
ArrayList arrayList = new ArrayList();
for (FavoriteItem favoriteItem : favoriteItems) {
if (favoriteItem.getFavoriteProduct() != null) {
arrayList.add(new FavoriteItemShareObject(INSTANCE.randomID(), DateTime.now().getMillis(), null, favoriteItem.getFavoriteProduct().getId()));
} else {
String randomID = INSTANCE.randomID();
long millis = DateTime.now().getMillis();
Document favoriteDocument = favoriteItem.getFavoriteDocument();
arrayList.add(new FavoriteItemShareObject(randomID, millis, favoriteDocument != null ? favoriteDocument.getId() : null, null));
}
}
return new FavoriteListShareObject(randomID(), arrayList, DateTime.now().getMillis(), favoriteFolder.getName(), DateTime.now().getMillis());
}
public final void shareProduct(Context context, String title, String body) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(body, "body");
String str = title + '\n' + body;
Intent intent = new Intent("android.intent.action.SEND");
intent.setType("text/plain");
intent.putExtra("android.intent.extra.TEXT", str);
context.startActivity(Intent.createChooser(intent, str));
}
}