-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66edda8
commit f21f6ea
Showing
19 changed files
with
462 additions
and
253 deletions.
There are no files selected for viewing
This file contains 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 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
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/bnyro/contacts/domain/model/CallerInfo.kt
This file contains 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,10 @@ | ||
package com.bnyro.contacts.domain.model | ||
|
||
import android.net.Uri | ||
|
||
data class CallerInfo( | ||
val rawPhoneNumber: String = "", | ||
val formattedPhoneNumber: String = "", | ||
val callerName: String? = null, | ||
val callerPhoto: Uri? = null | ||
) |
This file contains 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 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 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 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 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
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/bnyro/contacts/presentation/screens/calllog/model/CallModel.kt
This file contains 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,32 @@ | ||
package com.bnyro.contacts.presentation.screens.calllog.model | ||
|
||
import android.Manifest | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.telecom.TelecomManager | ||
import androidx.lifecycle.ViewModel | ||
|
||
class CallModel : ViewModel() { | ||
var initialPhoneNumber: String? = null | ||
|
||
fun requestDefaultDialerApp(context: Context) { | ||
val telecomManager = context.getSystemService(Context.TELECOM_SERVICE) as TelecomManager? | ||
val isAlreadyDefaultDialer = | ||
context.packageName.equals(telecomManager!!.defaultDialerPackage) | ||
if (!isAlreadyDefaultDialer) { | ||
val intent: Intent = Intent(TelecomManager.ACTION_CHANGE_DEFAULT_DIALER) | ||
.putExtra( | ||
TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME, | ||
context.packageName | ||
) | ||
context.startActivity(intent) | ||
} | ||
} | ||
|
||
companion object { | ||
val phonePerms = arrayOf( | ||
Manifest.permission.CALL_PHONE, | ||
Manifest.permission.READ_PHONE_STATE | ||
) | ||
} | ||
} |
Oops, something went wrong.