Change telegram channel to group

This commit is contained in:
emanuele-f 2021-01-21 22:53:42 +01:00
parent e1a6436489
commit ef09f36109
3 changed files with 8 additions and 8 deletions

View File

@ -67,7 +67,7 @@ public class MainActivity extends AppCompatActivity implements LoaderManager.Loa
private static final int MENU_ITEM_APP_SELECTOR_IDX = 0;
public static final int OPERATION_SEARCH_LOADER = 23;
public static final String TELEGRAM_CHANNEL_NAME = "PCAPdroid";
public static final String TELEGRAM_GROUP_NAME = "PCAPdroid";
public static final String GITHUB_PROJECT_URL = "https://github.com/emanuele-f/PCAPdroid";
public static final String GITHUB_DOCS_URL = "https://emanuele-f.github.io/PCAPdroid";
@ -219,17 +219,17 @@ public class MainActivity extends AppCompatActivity implements LoaderManager.Loa
return true;
}
private void openTelegramChannel() {
private void openTelegram() {
Intent intent = null;
try {
getPackageManager().getPackageInfo("org.telegram.messenger", 0);
// Open directly into the telegram app
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tg://resolve?domain=" + TELEGRAM_CHANNEL_NAME));
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tg://resolve?domain=" + TELEGRAM_GROUP_NAME));
} catch (Exception e) {
// Telegram not found, open in the browser
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://t.me/" + TELEGRAM_CHANNEL_NAME));
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://t.me/" + TELEGRAM_GROUP_NAME));
}
if(intent != null)
@ -261,7 +261,7 @@ public class MainActivity extends AppCompatActivity implements LoaderManager.Loa
startActivity(browserIntent);
return true;
} else if (id == R.id.action_open_telegram) {
openTelegramChannel();
openTelegram();
return true;
} else if (id == R.id.action_open_user_guide) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(GITHUB_DOCS_URL));

View File

@ -33,7 +33,7 @@
<item
android:id="@+id/action_open_telegram"
android:title="@string/open_telegram"
android:title="@string/open_telegram_group"
android:orderInCategory="130"
app:showAsAction="never"
/>
@ -45,4 +45,4 @@
app:showAsAction="never"
/>
</menu>
</menu>

View File

@ -62,7 +62,7 @@
<string name="tls_decryption">TLS Decryption</string>
<string name="user_guide">User Guide</string>
<string name="rate_app">Rate App</string>
<string name="open_telegram">Telegram Channel</string>
<string name="open_telegram_group">Telegram Group</string>
<string name="open_github">Github Project</string>
<string name="yes">YES</string>
<string name="no">NO</string>