add android public and public build flavors
This commit is contained in:
@@ -29,6 +29,22 @@ android {
|
||||
|
||||
buildFeatures {
|
||||
compose true
|
||||
buildConfig true
|
||||
}
|
||||
|
||||
flavorDimensions "distribution"
|
||||
productFlavors {
|
||||
create("public") {
|
||||
dimension "distribution"
|
||||
applicationId "ai.multica.app"
|
||||
resValue "string", "app_name", "Multica"
|
||||
manifestPlaceholders = [usesCleartextTraffic: "false", deepLinkScheme: "multica"]
|
||||
buildConfigField "String", "MULTICA_ENVIRONMENT", "\"public\""
|
||||
buildConfigField "String", "MULTICA_API_BASE_URL", "\"https://api.multica.ai\""
|
||||
buildConfigField "String", "MULTICA_WEB_BASE_URL", "\"https://app.multica.ai\""
|
||||
buildConfigField "String", "MULTICA_WS_BASE_URL", "\"wss://api.multica.ai\""
|
||||
buildConfigField "String", "MULTICA_AUTH_PREFS_NAME", "\"multica_auth\""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
android:allowBackup="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="false">
|
||||
android:usesCleartextTraffic="${usesCleartextTraffic}">
|
||||
<activity
|
||||
android:name=".ComposeVisualAuditActivity"
|
||||
android:theme="@style/ComposeAppTheme"
|
||||
@@ -24,7 +24,7 @@
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="multica" />
|
||||
<data android:scheme="${deepLinkScheme}" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
|
||||
@@ -21,7 +21,6 @@ final class ApiClient {
|
||||
T parse(JSONObject json) throws Exception;
|
||||
}
|
||||
|
||||
private static final String BASE = "https://api.multica.ai";
|
||||
private final AuthStore authStore;
|
||||
|
||||
ApiClient(AuthStore authStore) {
|
||||
@@ -1368,7 +1367,7 @@ final class ApiClient {
|
||||
private JSONObject requestMultipart(String path, JSONObject query, JSONObject fields, String fieldName, String filename,
|
||||
String contentType, byte[] data) throws Exception {
|
||||
String boundary = "Boundary-" + System.currentTimeMillis();
|
||||
URL url = new URL(BASE + path + queryString(query));
|
||||
URL url = new URL(BuildConfig.MULTICA_API_BASE_URL + path + queryString(query));
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setConnectTimeout(15000);
|
||||
@@ -1429,7 +1428,7 @@ final class ApiClient {
|
||||
|
||||
private JSONObject requestObject(String method, String path, JSONObject query, JSONObject body,
|
||||
Map<String, String> extraHeaders, int connectTimeoutMs, int readTimeoutMs) throws Exception {
|
||||
URL url = new URL(BASE + path + queryString(query));
|
||||
URL url = new URL(BuildConfig.MULTICA_API_BASE_URL + path + queryString(query));
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod(method);
|
||||
conn.setConnectTimeout(connectTimeoutMs);
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
final class AuthStore {
|
||||
private static final String PREFS = "multica_auth";
|
||||
private static final String TOKEN = "token";
|
||||
private static final String WORKSPACE_ID = "workspace_id";
|
||||
private static final String LANGUAGE = "language";
|
||||
@@ -18,7 +17,7 @@ final class AuthStore {
|
||||
private final SharedPreferences prefs;
|
||||
|
||||
AuthStore(Context context) {
|
||||
prefs = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE);
|
||||
prefs = context.getSharedPreferences(BuildConfig.MULTICA_AUTH_PREFS_NAME, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
String token() {
|
||||
|
||||
@@ -175,7 +175,7 @@ class ComposePilotActivity : ComponentActivity() {
|
||||
val authStore = AuthStore(this)
|
||||
val api = ApiClient(authStore)
|
||||
val initialSettingsPageName = intent.getStringExtra("initial_settings_page")
|
||||
?: getSharedPreferences("multica_auth", Context.MODE_PRIVATE).getString("initial_settings_page", null)
|
||||
?: getSharedPreferences(BuildConfig.MULTICA_AUTH_PREFS_NAME, Context.MODE_PRIVATE).getString("initial_settings_page", null)
|
||||
val initialIssueId = intent.getStringExtra("initial_issue_id")
|
||||
val initialTabName = intent.data?.host
|
||||
if (intent.getBooleanExtra("preview_agent_transcript", false)) {
|
||||
@@ -819,7 +819,7 @@ private fun PilotLoginScreen(
|
||||
MulticaPillButton(
|
||||
text = if (zh) "用浏览器打开 Web 登录" else "Open Web Sign In",
|
||||
onClick = {
|
||||
context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://app.multica.ai/login")))
|
||||
context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("${BuildConfig.MULTICA_WEB_BASE_URL}/login")))
|
||||
},
|
||||
tone = MulticaButtonTone.Ghost,
|
||||
contentDescription = "Login Open Web Sign In",
|
||||
@@ -9462,7 +9462,7 @@ private fun PilotIssueDetail(
|
||||
|
||||
fun copyIssueLink() {
|
||||
val slug = workspaceSlug.ifBlank { workspaceId }
|
||||
val url = "https://app.multica.ai/$slug/issues/${data.issue.id}"
|
||||
val url = "${BuildConfig.MULTICA_WEB_BASE_URL}/$slug/issues/${data.issue.id}"
|
||||
val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
clipboard.setPrimaryClip(ClipData.newPlainText("Multica issue link", url))
|
||||
copyLinkMessage = if (zh) "链接已复制" else "Link copied"
|
||||
@@ -21044,7 +21044,7 @@ private fun PilotRuntimeConnectRemotePage(
|
||||
)
|
||||
SettingsCompactCommandRow(
|
||||
title = if (zh) "配置服务" else "Configure service",
|
||||
command = "multica config set server_url https://api.multica.ai",
|
||||
command = "multica config set server_url ${BuildConfig.MULTICA_API_BASE_URL}",
|
||||
showDivider = true,
|
||||
)
|
||||
SettingsCompactCommandRow(
|
||||
|
||||
@@ -179,7 +179,7 @@ public final class MainActivity extends Activity {
|
||||
toast(t("sendCodeFailed"));
|
||||
});
|
||||
});
|
||||
google.setOnClickListener(v -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://app.multica.ai/login"))));
|
||||
google.setOnClickListener(v -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(BuildConfig.MULTICA_WEB_BASE_URL + "/login"))));
|
||||
setContentView(root);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user