-
-
Notifications
You must be signed in to change notification settings - Fork 173
improve the videocalls: open in internal webview #3785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
adbenitez
wants to merge
18
commits into
main
Choose a base branch
from
adb/integrated-videocalls
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+361
−6
Draft
Changes from 3 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
dd93de3
improve the videocalls: open in internal webview
adbenitez 5fb61b0
set name when joining call
adbenitez 677c059
Merge branch 'main' into adb/integrated-videocalls
adbenitez e877617
Merge branch 'main' into adb/integrated-videocalls
adbenitez fa86807
test integrated webxdc
adbenitez eee218a
add call api
r10s 3086c72
undo temporary test
adbenitez 27f6627
fix VideochatUtil
adbenitez 100bb06
Merge remote-tracking branch 'origin/r10s/call-api' into adb/integrat…
adbenitez 365f1db
basic call
adbenitez 571f49a
revert meeting change
adbenitez 8ab9b92
update core
adbenitez ca27be2
Merge branch 'main' into adb/integrated-videocalls
adbenitez 7cc9d7e
update core
adbenitez fbb33c7
Merge branch 'adb/integrated-videocalls' of https://github.com/deltac…
adbenitez e14bf24
Merge branch 'main' into adb/integrated-videocalls
adbenitez c9ac421
update call.html
adbenitez 1c7c3f0
prototype with TelecomManager and ConnectionService APIs
adbenitez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/main/java/org/thoughtcrime/securesms/videochat/VideochatActivity.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package org.thoughtcrime.securesms.videochat; | ||
|
||
import android.os.Bundle; | ||
import android.view.Menu; | ||
import android.webkit.PermissionRequest; | ||
import android.webkit.WebChromeClient; | ||
import android.webkit.WebSettings; | ||
|
||
import com.b44t.messenger.DcChat; | ||
import com.b44t.messenger.DcContext; | ||
|
||
import org.thoughtcrime.securesms.WebViewActivity; | ||
import org.thoughtcrime.securesms.connect.DcHelper; | ||
import org.thoughtcrime.securesms.util.Util; | ||
|
||
public class VideochatActivity extends WebViewActivity { | ||
private static final String TAG = VideochatActivity.class.getSimpleName(); | ||
|
||
public static final String EXTRA_CHAT_ID = "chat_id"; | ||
public static final String EXTRA_URL = "url"; | ||
|
||
private DcContext dcContext; | ||
private String url = ""; | ||
|
||
@Override | ||
protected void onCreate(Bundle state, boolean ready) { | ||
super.onCreate(state, ready); | ||
this.dcContext = DcHelper.getContext(getApplicationContext()); | ||
|
||
Bundle b = getIntent().getExtras(); | ||
url = b.getString(EXTRA_URL, ""); | ||
int chatId = b.getInt(EXTRA_CHAT_ID, 0); | ||
|
||
WebSettings webSettings = webView.getSettings(); | ||
webSettings.setJavaScriptEnabled(true); | ||
webSettings.setUserAgentString("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"); | ||
|
||
webView.setWebChromeClient(new WebChromeClient() { | ||
@Override | ||
public void onPermissionRequest(PermissionRequest request) { | ||
Util.runOnMain(() -> { | ||
request.grant(request.getResources()); | ||
}); | ||
} | ||
}); | ||
|
||
Util.runOnAnyBackgroundThread(() -> { | ||
final DcChat chat = dcContext.getChat(chatId); | ||
Util.runOnMain(() -> { | ||
getSupportActionBar().setTitle(chat.getName()); | ||
}); | ||
}); | ||
|
||
webView.loadUrl(url); | ||
} | ||
|
||
@Override | ||
public boolean onPrepareOptionsMenu(Menu menu) { | ||
// do not call super.onPrepareOptionsMenu() as the default "Search" menu is not needed | ||
return true; | ||
} | ||
|
||
@Override | ||
protected boolean openOnlineUrl(String url) { | ||
finish(); | ||
return true; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.