Initial commit
This commit is contained in:
70
sources/com/tencent/mm/opensdk/channel/MMessageActV2.java
Normal file
70
sources/com/tencent/mm/opensdk/channel/MMessageActV2.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package com.tencent.mm.opensdk.channel;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import com.tencent.mm.opensdk.channel.a.b;
|
||||
import com.tencent.mm.opensdk.constants.ConstantsAPI;
|
||||
import com.tencent.mm.opensdk.utils.Log;
|
||||
import com.tencent.mm.opensdk.utils.d;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MMessageActV2 {
|
||||
public static final String DEFAULT_ENTRY_CLASS_NAME = ".wxapi.WXEntryActivity";
|
||||
public static final String MM_ENTRY_PACKAGE_NAME = "com.tencent.mm";
|
||||
public static final String MM_MSG_ENTRY_CLASS_NAME = "com.tencent.mm.plugin.base.stub.WXEntryActivity";
|
||||
private static final String TAG = "MicroMsg.SDK.MMessageAct";
|
||||
|
||||
public static class Args {
|
||||
public static final int INVALID_FLAGS = -1;
|
||||
public Bundle bundle;
|
||||
public String content;
|
||||
public int flags = -1;
|
||||
public String targetClassName;
|
||||
public String targetPkgName;
|
||||
|
||||
public String toString() {
|
||||
return "targetPkgName:" + this.targetPkgName + ", targetClassName:" + this.targetClassName + ", content:" + this.content + ", flags:" + this.flags + ", bundle:" + this.bundle;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean send(Context context, Args args) {
|
||||
String str;
|
||||
if (context == null || args == null) {
|
||||
str = "send fail, invalid argument";
|
||||
} else if (d.h(args.targetPkgName)) {
|
||||
str = "send fail, invalid targetPkgName, targetPkgName = " + args.targetPkgName;
|
||||
} else {
|
||||
if (d.h(args.targetClassName)) {
|
||||
args.targetClassName = args.targetPkgName + DEFAULT_ENTRY_CLASS_NAME;
|
||||
}
|
||||
Log.d(TAG, "send, targetPkgName = " + args.targetPkgName + ", targetClassName = " + args.targetClassName);
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName(args.targetPkgName, args.targetClassName);
|
||||
Bundle bundle = args.bundle;
|
||||
if (bundle != null) {
|
||||
intent.putExtras(bundle);
|
||||
}
|
||||
String packageName = context.getPackageName();
|
||||
intent.putExtra(ConstantsAPI.SDK_VERSION, 620756998);
|
||||
intent.putExtra(ConstantsAPI.APP_PACKAGE, packageName);
|
||||
intent.putExtra(ConstantsAPI.CONTENT, args.content);
|
||||
intent.putExtra(ConstantsAPI.CHECK_SUM, b.a(args.content, 620756998, packageName));
|
||||
int i = args.flags;
|
||||
if (i == -1) {
|
||||
intent.addFlags(268435456).addFlags(134217728);
|
||||
} else {
|
||||
intent.setFlags(i);
|
||||
}
|
||||
try {
|
||||
context.startActivity(intent);
|
||||
Log.d(TAG, "send mm message, intent=" + intent);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
str = "send fail, ex = " + e.getMessage();
|
||||
}
|
||||
}
|
||||
Log.e(TAG, str);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user