Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/Ekal_Sprint_34_Final' into Ekal_…
Browse files Browse the repository at this point in the history
…Sprint_34_Final
  • Loading branch information
nishitagoyal committed Nov 2, 2023
2 parents 6061bde + 2d6c4ed commit e34cf18
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import org.intelehealth.ekalarogya.utilities.NetworkConnection;
import org.intelehealth.ekalarogya.utilities.OfflineLogin;
import org.intelehealth.ekalarogya.utilities.SessionManager;
import org.intelehealth.ekalarogya.webrtc.activity.EkalCallLogActivity;
import org.intelehealth.ekalarogya.webrtc.activity.EkalChatActivity;
import org.intelehealth.ekalarogya.webrtc.activity.EkalVideoActivity;
import org.intelehealth.ekalarogya.widget.materialprogressbar.CustomProgressDialog;
Expand Down Expand Up @@ -333,7 +334,10 @@ public boolean onCreateOptionsMenu(Menu menu) {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
if (itemId == R.id.userProfileOption) {
if (itemId == R.id.actionCallLog) {
startActivity(new Intent(this, EkalCallLogActivity.class));
return true;
} else if (itemId == R.id.userProfileOption) {
Hw_Profile();
return true;
} else if (itemId == R.id.settingsOption) {
Expand Down Expand Up @@ -543,12 +547,14 @@ public void onNext(DownloadMindMapRes res) {
Toast.makeText(context, getResources().getString(R.string.no_protocols_found), Toast.LENGTH_SHORT).show();
}
}

@Override
public void onError(Throwable e) {
customProgressDialog.dismiss();
Toast.makeText(context, getResources().getString(R.string.unable_to_get_proper_response), Toast.LENGTH_SHORT).show();
Log.v(TAG, "jwt_response: " + e.toString());
}

@Override
public void onComplete() {
}
Expand Down Expand Up @@ -638,6 +644,7 @@ public void onClick(DialogInterface dialog, int which) {
}
}
}

@Override
public void onError(Throwable e) {
Log.e("Error", "" + e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,11 @@ public boolean updateOpemmrsId(String openmrsId, String synced, String uuid) thr
db.endTransaction();
}
try {
Intent intent = new Intent(IntelehealthApplication.getAppContext(), MyIntentService.class);
IntelehealthApplication.getAppContext().startService(intent);
Intent in = new Intent();
in.setAction("OpenmrsID");
IntelehealthApplication.getAppContext().sendBroadcast(in);
// Intent intent = new Intent(IntelehealthApplication.getAppContext(), MyIntentService.class);
// IntelehealthApplication.getAppContext().startService(intent);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class EkalCallLogActivity : CoreCallLogActivity(), BaseViewHolder.ViewHolderClic
layoutManager = LinearLayoutManager(context)
addItemDecoration(
DividerItemDecoration(
this@EkalCallLogActivity,
DividerItemDecoration.VERTICAL
this@EkalCallLogActivity, DividerItemDecoration.VERTICAL
)
)
this@EkalCallLogActivity.adapter.updateItems(logs.toMutableList())
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/menu/menu_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
android:orderInCategory="100"
android:title="@string/menu_option_hw_profile" />

<!--<item-->
<!--android:id="@+id/syncOption"-->
<!--android:title="@string/menu_option_sync"-->
<!--android:orderInCategory="50" />-->
<item
android:id="@+id/actionCallLog"
android:orderInCategory="100"
android:title="@string/menu_option_call_log" />

<item
android:id="@+id/settingsOption"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<string name="menu_option_end_of_day" translatable="false">End of Day</string>
<string name="menu_option_logout" translatable="false">Logout</string>
<string name="menu_option_hw_profile" translatable="false">User Profile</string>
<string name="menu_option_call_log" translatable="false">@string/call_logs</string>


//Identification Screen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package org.intelehealth.klivekit.call.ui.activity
import android.Manifest
import android.content.Intent
import android.media.MediaPlayer
import android.media.Ringtone
import android.media.RingtoneManager
import android.os.Build
import android.os.Bundle
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
Expand Down Expand Up @@ -81,21 +83,21 @@ abstract class CoreVideoCallActivity : AppCompatActivity() {


// initiate the incoming call ringtone
// private val ringtone: Ringtone by lazy {
// val notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE)
// RingtoneManager.getRingtone(applicationContext, notification)
// }
private val ringtone: Ringtone by lazy {
val notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE)
RingtoneManager.getRingtone(applicationContext, notification)
}

// private val audioManager: AudioManager by lazy {
// applicationContext.getSystemService(Context.AUDIO_SERVICE) as AudioManager
// }

private val mediaPlayer: MediaPlayer by lazy {
val notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE)
MediaPlayer.create(this, notification).apply {
isLooping = true
};
}
// private val mediaPlayer: MediaPlayer by lazy {
// val notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE)
// MediaPlayer.create(this, notification).apply {
// isLooping = true
// };
// }

override fun onCreate(savedInstanceState: Bundle?) {
window.addFlags(
Expand Down Expand Up @@ -304,12 +306,20 @@ abstract class CoreVideoCallActivity : AppCompatActivity() {

open fun playRingtone() {
// mediaPlayer.prepare()
mediaPlayer.start()
// mediaPlayer.start()
if (!ringtone.isPlaying) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
ringtone.isLooping = true
}
ringtone.play()
}
}

open fun stopRingtone() {
Timber.e { "stopRingtone ${mediaPlayer.isPlaying}" }
if (mediaPlayer.isPlaying) mediaPlayer.stop()
// Timber.e { "stopRingtone ${mediaPlayer.isPlaying}" }
// if (mediaPlayer.isPlaying) mediaPlayer.stop()
Timber.e { "stopRingtone ${ringtone.isPlaying}" }
if (ringtone.isPlaying) ringtone.stop()
}

override fun onResume() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ object CallNotificationHandler {

return NotificationCompat.Builder(context, getChannelId(context))
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setContentTitle(getApplicationName(context))
.setContentText("Incoming call from ${messageBody.doctorName ?: "unknown"}")
.setContentTitle(messageBody.doctorName ?: "unknown")
.setContentText("Incoming call")
.setColor(ContextCompat.getColor(context, R.color.blue_1))
.setSmallIcon(messageBody.notificationIcon)
// .setSound(getDefaultRingtoneUrl(), AudioManager.STREAM_RING)
Expand Down Expand Up @@ -176,8 +176,8 @@ object CallNotificationHandler {

return NotificationCompat.Builder(context, getChannelId(context))
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setContentTitle("Ongoing call with ${messageBody.doctorName ?: "unknown"}")
// .setContentText("Ongoing call with ${messageBody.doctorName ?: "unknown"}")
.setContentTitle(messageBody.doctorName ?: "unknown")
.setContentText("Ongoing call")
.setColor(ContextCompat.getColor(context, R.color.blue_1))
.setSmallIcon(messageBody.notificationIcon)
.setCategory(NotificationCompat.CATEGORY_CALL).setContentIntent(notificationIntent)
Expand Down Expand Up @@ -226,8 +226,8 @@ object CallNotificationHandler {
messageBody.callStatus = CallStatus.MISSED
return NotificationCompat.Builder(context, getChannelId(context))
.setPriority(NotificationCompat.PRIORITY_LOW)
// .setContentTitle(getApplicationName(context))
.setContentText("Missed call from ${messageBody.doctorName}")
.setContentTitle(messageBody.doctorName)
.setContentText("Missed call")
.setColor(ContextCompat.getColor(context, R.color.red))
.setSmallIcon(messageBody.notificationIcon)
.setCategory(NotificationCompat.CATEGORY_MISSED_CALL).setAutoCancel(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.List;

public class ChatListingAdapter extends DateHeaderAdapter {

// Medicine adapter <- Test <- Aid adapter <- Header adapter <- Recycler.Adapter
public interface AttachmentClickListener {
void onClick(String url);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.intelehealth.klivekit.socket

import android.app.ActivityManager
import androidx.lifecycle.ProcessLifecycleOwner
import androidx.lifecycle.lifecycleScope
import com.github.ajalt.timberkt.Timber
import com.google.gson.Gson
import io.socket.client.IO
Expand Down Expand Up @@ -107,6 +110,10 @@ open class SocketManager @Inject constructor() {
private fun invokeListeners(event: String, args: Any?) {
Timber.d { "No of listener => ${emitterListeners.size}" }
emitterListeners.forEach { it.invoke(event).call(args) }

// if (CallNotificationHandler.isAppInBackground() && event == EVENT_CALL_CANCEL_BY_DR) {
//
// }
}

private fun notifyIfNotActiveRoom(jsonArray: JSONArray, block: (ChatMessage) -> Unit) {
Expand Down

0 comments on commit e34cf18

Please sign in to comment.