~singpolyma/cheogram-android

0fd2029689985dd4271ce110bc1720c01c1150a7 — Stephen Paul Weber 2 years ago 6cb8a44
Better permission notification
M build.gradle => build.gradle +2 -2
@@ 91,7 91,7 @@ dependencies {

    implementation 'com.google.guava:guava:30.1.1-android'
    implementation 'io.michaelrocks:libphonenumber-android:8.12.36'
    implementation 'io.github.nishkarsh:android-permissions:2.0.54'
    implementation 'io.github.nishkarsh:android-permissions:2.1.6'
    implementation urlFile('https://cloudflare-ipfs.com/ipfs/QmeqMiLxHi8AAjXobxr3QTfa1bSSLyAu86YviAqQnjxCjM/libwebrtc.aar', 'libwebrtc.aar')
    // INSERT
}


@@ 103,7 103,7 @@ ext {
}

android {
    compileSdkVersion 29
    compileSdkVersion 31

    defaultConfig {
        minSdkVersion 24

M src/cheogram/java/com/cheogram/android/ConnectionService.java => src/cheogram/java/com/cheogram/android/ConnectionService.java +8 -0
@@ 33,8 33,10 @@ import android.os.Parcel;
import android.util.Log;

import com.intentfilter.androidpermissions.PermissionManager;
import com.intentfilter.androidpermissions.NotificationSettings;
import com.intentfilter.androidpermissions.models.DeniedPermissions;

import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.services.AppRTCAudioManager;
import eu.siacs.conversations.services.AvatarService;


@@ 108,6 110,12 @@ public class ConnectionService extends android.telecom.ConnectionService {
		CheogramConnection connection = new CheogramConnection(account, with, postDial);

		PermissionManager permissionManager = PermissionManager.getInstance(this);
		permissionManager.setNotificationSettings(
			new NotificationSettings.Builder()
				.withMessage(R.string.microphone_permission_for_call)
				.withSmallIcon(R.drawable.ic_notification).build()
		);

		Set<String> permissions = new HashSet();
		permissions.add(Manifest.permission.RECORD_AUDIO);
		permissionManager.checkPermissions(permissions, new PermissionManager.PermissionRequestListener() {

M src/main/res/values/strings.xml => src/main/res/values/strings.xml +1 -0
@@ 985,5 985,6 @@
    <string name="plain_text_document">Plain text document</string>
    <string name="account_registrations_are_not_supported">Account registrations are not supported</string>
    <string name="no_xmpp_adddress_found">No Jabber ID found</string>
    <string name="microphone_permission_for_call">Microphone permission required to complete call</string>

</resources>