diff --git a/VERSION b/VERSION index 341cf11f..9325c3cc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.0 \ No newline at end of file +0.3.0 \ No newline at end of file diff --git a/packages/clients/android/app/src/main/java/com/cx/goatlin/AccountProvider.kt b/packages/clients/android/app/src/main/java/com/cx/goatlin/AccountProvider.kt index cbda52bb..c5352846 100644 --- a/packages/clients/android/app/src/main/java/com/cx/goatlin/AccountProvider.kt +++ b/packages/clients/android/app/src/main/java/com/cx/goatlin/AccountProvider.kt @@ -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) diff --git a/packages/clients/android/app/src/main/java/com/cx/goatlin/LoginActivity.kt b/packages/clients/android/app/src/main/java/com/cx/goatlin/LoginActivity.kt index 8f17aef4..69492fd8 100644 --- a/packages/clients/android/app/src/main/java/com/cx/goatlin/LoginActivity.kt +++ b/packages/clients/android/app/src/main/java/com/cx/goatlin/LoginActivity.kt @@ -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 @@ -60,6 +63,14 @@ class LoginActivity : AppCompatActivity(), LoaderCallbacks { } } + 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) @@ -164,6 +175,7 @@ class LoginActivity : AppCompatActivity(), LoaderCallbacks { @RequiresApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) override fun onCreateLoader(i: Int, bundle: Bundle?): Loader { + checkAndPromptUserToGrantPermissions(); return CursorLoader(this, // Retrieve data rows for the device user's 'profile' contact. Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI, diff --git a/packages/clients/android/app/src/main/java/com/cx/goatlin/NotesProvider.kt b/packages/clients/android/app/src/main/java/com/cx/goatlin/NotesProvider.kt index 0e7531a6..937349f4 100644 --- a/packages/clients/android/app/src/main/java/com/cx/goatlin/NotesProvider.kt +++ b/packages/clients/android/app/src/main/java/com/cx/goatlin/NotesProvider.kt @@ -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)