Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
PauloASilva committed Jan 6, 2022
2 parents dc70fc3 + 88b1b66 commit 3dbddd6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0
0.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class AccountProvider : ContentProvider() {


companion object {
private val AUTHORITY = "com.cx.vulnerablekotlinapp.accounts"
private val AUTHORITY = "com.cx.goatlin.accounts"
private val ACCOUNTS_TABLE = "Accounts"
val CONTENT_URI : Uri = Uri.parse("content://" + AUTHORITY + "/" +
ACCOUNTS_TABLE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ import android.widget.ArrayAdapter
import android.widget.TextView
import java.util.ArrayList
import android.content.*
import android.content.pm.PackageManager
import android.support.annotation.RequiresApi
import android.support.v4.app.ActivityCompat
import android.support.v4.content.ContextCompat
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
Expand Down Expand Up @@ -60,6 +63,14 @@ class LoginActivity : AppCompatActivity(), LoaderCallbacks<Cursor> {
}
}

private fun checkAndPromptUserToGrantPermissions() {
if (ContextCompat.checkSelfPermission(
this,android.Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(
this, arrayOf(android.Manifest.permission.READ_CONTACTS), 1)
}
}

override fun onOptionsItemSelected(item: MenuItem?): Boolean {
val intent = Intent(this, ServerInfoActivity::class.java)
startActivity(intent)
Expand Down Expand Up @@ -164,6 +175,7 @@ class LoginActivity : AppCompatActivity(), LoaderCallbacks<Cursor> {

@RequiresApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
override fun onCreateLoader(i: Int, bundle: Bundle?): Loader<Cursor> {
checkAndPromptUserToGrantPermissions();
return CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class NotesProvider : ContentProvider() {


companion object {
private val AUTHORITY = "com.cx.vulnerablekotlinapp.notes"
private val AUTHORITY = "com.cx.goatlin.notes"
private val NOTES_TABLE = "Notes"
val CONTENT_URI : Uri = Uri.parse("content://" + AUTHORITY + "/" +
NOTES_TABLE)
Expand Down

0 comments on commit 3dbddd6

Please sign in to comment.