Skip to content

Commit

Permalink
android 14 support testing and source update as per ida implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
mithunvaghela committed Apr 16, 2024
1 parent ed582ab commit 1927737
Show file tree
Hide file tree
Showing 28 changed files with 120 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@
import org.intelehealth.app.services.firebase_services.TokenRefreshUtils;
import org.intelehealth.app.utilities.Logger;
import org.intelehealth.app.utilities.SessionManager;
import org.intelehealth.fcm.utils.FcmTokenGenerator;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import kotlin.Unit;


public class SplashActivity extends AppCompatActivity {
private static final int GROUP_PERMISSION_REQUEST = 1000;
Expand All @@ -64,7 +67,10 @@ protected void onCreate(Bundle savedInstanceState) {
getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
}
// refresh the fcm token
TokenRefreshUtils.refreshToken(this);
FcmTokenGenerator.getDeviceToken(token -> {
IntelehealthApplication.getInstance().refreshedFCMTokenID = token;
return Unit.INSTANCE;
});
initFirebaseRemoteConfig();
}

Expand Down Expand Up @@ -226,6 +232,13 @@ private boolean checkAndRequestPermissions() {

List<String> listPermissionsNeeded = new ArrayList<>();

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
int fullScreenIntent = ContextCompat.checkSelfPermission(this, Manifest.permission.USE_FULL_SCREEN_INTENT);
if (fullScreenIntent != PackageManager.PERMISSION_GRANTED) {
listPermissionsNeeded.add(Manifest.permission.USE_FULL_SCREEN_INTENT);
}
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
writeExternalStoragePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_MEDIA_IMAGES);
int notificationPermission = ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS);
Expand Down
1 change: 0 additions & 1 deletion klivekit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ dependencies {
api 'com.android.volley:volley:1.2.1'
api 'com.github.bumptech.glide:glide:4.14.2'
api 'com.google.code.gson:gson:2.10'
api "com.squareup.okhttp3:logging-interceptor:4.10.0"

def room_version = "2.6.1"
api "androidx.room:room-ktx:$room_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import android.app.NotificationManager
import android.app.Service
import android.content.Context
import android.content.Intent
import android.content.pm.ServiceInfo
import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK
import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL
import android.hardware.Sensor
import android.hardware.SensorEvent
import android.hardware.SensorEventListener
Expand All @@ -18,17 +21,20 @@ import android.os.IBinder
import android.os.PowerManager
import android.os.VibrationEffect
import android.os.Vibrator
import android.os.VibratorManager
import androidx.annotation.RequiresApi
import androidx.core.content.IntentCompat
import com.github.ajalt.timberkt.Timber
import com.google.gson.Gson
import io.socket.emitter.Emitter
import org.intelehealth.klivekit.RtcEngine
import org.intelehealth.klivekit.call.utils.CallAction
import org.intelehealth.klivekit.call.utils.CallConstants
import org.intelehealth.klivekit.call.utils.CallHandlerUtils
import org.intelehealth.klivekit.call.utils.CallMode
import org.intelehealth.klivekit.call.utils.CallNotificationHandler
import org.intelehealth.klivekit.call.utils.CallStatus
import org.intelehealth.klivekit.call.utils.CallNotificationHandler
import org.intelehealth.klivekit.call.utils.IntentUtils
import org.intelehealth.klivekit.data.PreferenceHelper
import org.intelehealth.klivekit.model.RtcArgs
import org.intelehealth.klivekit.socket.SocketManager
Expand Down Expand Up @@ -74,7 +80,14 @@ class HeadsUpNotificationService : Service(), SensorEventListener {
}

private val vibratorService by lazy {
getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
val vibratorManager =
getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager
vibratorManager.defaultVibrator
} else {
@Suppress("DEPRECATION")
getSystemService(VIBRATOR_SERVICE) as Vibrator
}
}

private val powerManager by lazy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.intelehealth.klivekit.utils.extensions.viewModelByFactory
* Mob : +919727206702
**/
abstract class CoreCallLogActivity : AppCompatActivity() {
protected val callLogViewModel: CallLogViewModel by viewModelByFactory {
private val callLogViewModel: CallLogViewModel by viewModelByFactory {
CallLogViewModel(CallLogRepository(WebRtcDatabase.getInstance(this).rtcCallLogDao()))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.intelehealth.klivekit.call.ui.activity

import android.Manifest
import android.content.Context
import android.content.Intent
import android.media.MediaPlayer
import android.media.Ringtone
import android.media.RingtoneManager
import android.os.Build
Expand All @@ -13,9 +15,11 @@ import androidx.lifecycle.lifecycleScope
import com.github.ajalt.timberkt.Timber
import com.google.gson.Gson
import io.livekit.android.events.DisconnectReason
import io.livekit.android.renderer.SurfaceViewRenderer
import io.livekit.android.renderer.TextureViewRenderer
import io.livekit.android.room.participant.ConnectionQuality
import io.livekit.android.room.track.CameraPosition
import io.livekit.android.room.track.Track
import io.livekit.android.room.track.VideoTrack
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
Expand All @@ -28,6 +32,7 @@ import org.intelehealth.klivekit.call.ui.viewmodel.CallViewModel
import org.intelehealth.klivekit.call.ui.viewmodel.VideoCallViewModel
import org.intelehealth.klivekit.call.utils.CallAction
import org.intelehealth.klivekit.call.utils.CallHandlerUtils
import org.intelehealth.klivekit.call.utils.CallNotificationHandler
import org.intelehealth.klivekit.call.utils.CallStatus
import org.intelehealth.klivekit.data.PreferenceHelper
import org.intelehealth.klivekit.data.PreferenceHelper.Companion.RTC_DATA
Expand Down Expand Up @@ -111,9 +116,19 @@ abstract class CoreVideoCallActivity : AppCompatActivity() {
// }

override fun onCreate(savedInstanceState: Bundle?) {
window.addFlags(
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON or WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
setShowWhenLocked(true)
setTurnScreenOn(true)
} else {
this.window.addFlags(
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
)
}
this.window.addFlags(
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
)

super.onCreate(savedInstanceState)
videoCallViewModel.room.initVideoRenderer(getLocalVideoRender())
videoCallViewModel.room.initVideoRenderer(getRemoteVideoRender())
Expand Down Expand Up @@ -313,14 +328,14 @@ abstract class CoreVideoCallActivity : AppCompatActivity() {
onIncomingCall()
stopService(
Intent(
this@CoreVideoCallActivity,
HeadsUpNotificationService::class.java
this@CoreVideoCallActivity, HeadsUpNotificationService::class.java
)
)
} else onGoingCall()
}

private fun startConnecting() {
Timber.d { "permissions ${neededPermissions.size}" }
permissionRegistry.requestPermissions(neededPermissions).observe(this) {
if (it.allGranted()) {
startCallTimer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
Expand Down Expand Up @@ -42,6 +43,7 @@
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.amazonaws.HttpMethod;
import com.android.volley.Cache;
import com.android.volley.Network;
import com.android.volley.Request;
Expand All @@ -54,6 +56,7 @@
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.github.ajalt.timberkt.Timber;
import com.google.gson.Gson;
Expand Down Expand Up @@ -413,7 +416,9 @@ private void getAllMessages(boolean isAlreadySetReadStatus) {
mEmptyTextView.setText(getString(R.string.loading));
String url = Constants.GET_ALL_MESSAGE_URL + mFromUUId + "/" + mToUUId + "/" + mPatientUUid;
Log.v(TAG, "getAllMessages - " + url);
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(url, null, new Response.Listener<JSONObject>() {
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
Request.Method.GET,
url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.v(TAG, "getAllMessages -response - " + response.toString());
Expand Down Expand Up @@ -918,11 +923,13 @@ private void showImageOrPdf(String url) {
if (url.endsWith(".pdf")) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} else {
RequestBuilder<Drawable> requestBuilder = Glide.with(this)
.asDrawable().sizeMultiplier(0.1f);
Glide.with(this)
.load(url)
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.thumbnail(0.1f)
.thumbnail(requestBuilder)
.into((ImageView) findViewById(R.id.preview_img));
findViewById(R.id.image_preview_ll).setVisibility(View.VISIBLE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import android.webkit.MimeTypeMap;

import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.regions.Region;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.PutObjectRequest;
import com.amazonaws.services.s3.model.PutObjectResult;
Expand Down Expand Up @@ -102,7 +104,8 @@ public void run() {
Log.v("AwsS3Utils", "saveFileToS3Cloud - fileName : " + fileName);
//Log.v("AwsS3Utils", "saveFileToS3Cloud - mimeType : " + mimeType);
BasicAWSCredentials basicAWSCredentials = new BasicAWSCredentials(propertyReader.getAwsAccessID(), propertyReader.getAwsSecretKey());
AmazonS3Client amazonS3Client = new AmazonS3Client(basicAWSCredentials);

AmazonS3Client amazonS3Client = new AmazonS3Client(basicAWSCredentials, Region.getRegion(Regions.DEFAULT_REGION));

PutObjectRequest por = new PutObjectRequest(propertyReader.getAwsS3BucketName(), fileName, tempFile);
//new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath()+"/"+PICTURE_NAME));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ public static boolean fileCompressed(String filePath) {
options.inSampleSize = calculateInSampleSize(options, actualWidth, actualHeight);
options.inJustDecodeBounds = false;
options.inDither = false;
options.inPurgeable = true;
options.inInputShareable = true;
options.inTempStorage = new byte[16 * 1024];

try {
Expand Down
2 changes: 0 additions & 2 deletions klivekit/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
<string name="permission_denied">تم رفض الإذن\n</string>
<string name="incoming_voice_call">مكالمة صوتية واردة</string>
<string name="incoming_call">مكالمة واردة</string>
<string name="decline">رفض المكالمة</string>
<string name="accept">يقبل</string>
<string name="doctor_profile_picture">صورة الملف الشخصي للطبيب</string>
<string name="poor_connection">اتصال ضعيف</string>
<string name="remote_participant_mic_off_status">حالة إيقاف تشغيل ميكروفون المشارك عن بعد</string>
Expand Down
7 changes: 6 additions & 1 deletion klivekit/src/main/res/values-ar/webrtc_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<string name="call_unknown">مجهول</string>
<string name="call_incoming">مكالمة واردة</string>
<string name="calling">الاتصال</string>
<string name="call_logs">سجلات المكالمات</string>

<string name="an_hour_ago">منذ ساعة</string>
<string name="hours_ago">%1$s منذ ساعات</string>
Expand All @@ -32,5 +33,9 @@
<string name="today_at">اليوم في</string>
<string name="yesterday">أمس</string>
<string name="yesterday_at">البارحة عند</string>
<string name="now">Now</string>
<string name="now">الآن</string>

<string name="decline">رفض المكالمة</string>
<string name="accept">يقبل</string>
<string name="hang_up">يشنق</string>
</resources>
2 changes: 0 additions & 2 deletions klivekit/src/main/res/values-as/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@
<string name="permission_denied">অনুমতি অস্বীকাৰ কৰা হৈছে\n</string>
<string name="incoming_voice_call">ইনকামিং ভইচ(voice)কল</string>
<string name="incoming_call">ইনকামিং কল</string>
<string name="decline">অস্বীকাৰ কৰা</string>
<string name="accept">গ্ৰহণ কৰা</string>
<string name="doctor_profile_picture">ডাক্তৰৰ প্ৰফাইল ছবি(picture)</string>
<string name="poor_connection">দুৰ্বল সংযোগ</string>
<string name="remote_participant_mic_off_status">দূৰৱৰ্তী অংশগ্ৰহণকাৰীৰ মাইক অফ অৱস্থা</string>
Expand Down
7 changes: 6 additions & 1 deletion klivekit/src/main/res/values-as/webrtc_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
<string name="call_outgoing">আউটগোয়িং কল</string>
<string name="call_ongoing">আউটগোয়িং কল</string>
<string name="call_unknown">অজ্ঞাত</string>
<string name="call_incoming">Incoming Call</string>
<string name="call_incoming">ইনকামিং কল</string>
<string name="calling">ফোন কৰি আছে</string>
<string name="call_logs">কল লগসমূহ</string>

<string name="an_hour_ago">এঘণ্টা আগতে</string>
<string name="hours_ago">%1$s ঘন্টা আগতে</string>
Expand All @@ -33,4 +34,8 @@
<string name="yesterday">যোৱাকালি</string>
<string name="yesterday_at">কালি বজাত.</string>
<string name="now">এতিয়া</string>

<string name="decline">অস্বীকাৰ কৰা</string>
<string name="accept">গ্ৰহণ কৰা</string>
<string name="hang_up">ৰাখক</string>
</resources>
2 changes: 0 additions & 2 deletions klivekit/src/main/res/values-bn/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@
<string name="permission_denied">অনুমতি অস্বীকৃত\n</string>
<string name="incoming_voice_call">ইনকামিং ভয়েস কল</string>
<string name="incoming_call">ইনকামিং কল</string>
<string name="decline">প্রত্যাখ্যান</string>
<string name="accept">গ্রহণ করুন</string>
<string name="doctor_profile_picture">ডাক্তারের প্রোফাইল ছবি</string>
<string name="poor_connection">দুর্বল সংযোগ</string>
<string name="remote_participant_mic_off_status">দূরবর্তী অংশগ্রহণকারী মাইক বন্ধ অবস্থা</string>
Expand Down
7 changes: 6 additions & 1 deletion klivekit/src/main/res/values-bn/webrtc_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
<string name="call_outgoing">আউটগোয়িং কল</string>
<string name="call_ongoing">চলমান কল</string>
<string name="call_unknown">অজানা</string>
<string name="call_incoming">Incoming Call</string>
<string name="call_incoming">ইনকামিং কল</string>
<string name="call_logs">কল লগ</string>
<string name="calling">কলিং</string>

<string name="an_hour_ago">এক ঘণ্টা আগে</string>
Expand All @@ -33,4 +34,8 @@
<string name="yesterday">গতকাল</string>
<string name="yesterday_at">গতকাল এ</string>
<string name="now">এখন</string>

<string name="decline">প্রত্যাখ্যান</string>
<string name="accept">গ্রহণ করুন</string>
<string name="hang_up">লেগে থাকা</string>
</resources>
2 changes: 0 additions & 2 deletions klivekit/src/main/res/values-gu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
<string name="permission_denied">અનુમતિ અસ્વીકાર\n</string>
<string name="incoming_voice_call">ઇનકમિંગ વોઇઝ કોલ</string>
<string name="incoming_call">ઇનકમિંગ કોલ</string>
<string name="decline">ગિરાવટ</string>
<string name="accept">સ્વીકાર કરો</string>
<string name="doctor_profile_picture">ડોકટોર પ્રોફાઈલ ચિત્ર</string>
<string name="poor_connection">ખરાબ જોડાણ</string>
<string name="remote_participant_mic_off_status">દૂરના સહભાગીનું માઇક બંધ સ્તિથી</string>
Expand Down
7 changes: 6 additions & 1 deletion klivekit/src/main/res/values-gu/webrtc_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
<string name="call_outgoing">આઉટગોઇંગ કોલ</string>
<string name="call_ongoing">ચાલુ ફોન</string>
<string name="call_unknown">અજાણ્યા</string>
<string name="call_incoming">Incoming Call</string>
<string name="call_incoming">ઇનકમિંગ કોલ</string>
<string name="call_logs">કોલ લોગ</string>
<string name="calling">કોલિંગ</string>

<string name="an_hour_ago">કલાક પહેલા</string>
Expand All @@ -33,4 +34,8 @@
<string name="yesterday">ગઈકાલે</string>
<string name="yesterday_at">ગઈકાલે</string>
<string name="now">હવે</string>

<string name="decline">ગિરાવટ</string>
<string name="accept">સ્વીકાર કરો</string>
<string name="hang_up">અટકી દો</string>
</resources>
2 changes: 0 additions & 2 deletions klivekit/src/main/res/values-hi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@
<string name="sending">भेजा जा रहा है</string>
<string name="incoming_voice_call">इनकमिंग वॉयस कॉल</string>
<string name="incoming_call">इनकमिंग कॉल</string>
<string name="decline">गिरावट</string>
<string name="accept">स्वीकार करें</string>
<string name="doctor_profile_picture">डॉक्टर प्रोफ़ाइल चित्र</string>
<string name="poor_connection">ख़राब कनेक्शन</string>
<string name="remote_participant_mic_off_status">रिमोट प्रतिभागी माइक बंद स्थिति</string>
Expand Down
7 changes: 6 additions & 1 deletion klivekit/src/main/res/values-hi/webrtc_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
<string name="call_outgoing">आउटगोइंग कॉल</string>
<string name="call_ongoing">चालू कॉल</string>
<string name="call_unknown">अज्ञात</string>
<string name="call_incoming">Incoming Call</string>
<string name="call_incoming">इनकमिंग कॉल</string>
<string name="calling">कॉलिंग</string>
<string name="call_logs">कॉल लॉग्स</string>

<string name="an_hour_ago">एक घंटा पहले</string>
<string name="hours_ago">%1$s घंटे पहले</string>
Expand All @@ -33,4 +34,8 @@
<string name="yesterday">कल</string>
<string name="yesterday_at">कल पर</string>
<string name="now">अब</string>

<string name="decline">गिरावट</string>
<string name="accept">स्वीकार करें</string>
<string name="hang_up">रख दो</string>
</resources>
Loading

0 comments on commit 1927737

Please sign in to comment.