Fix some applicationId issues

This commit is contained in:
Matthieu 2021-05-20 12:15:12 +02:00
parent 55251289d1
commit a7351b2cf1
3 changed files with 26 additions and 21 deletions

View File

@ -24,6 +24,7 @@ import org.junit.Rule
import org.junit.Test import org.junit.Test
import org.junit.rules.Timeout import org.junit.rules.Timeout
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.pixeldroid.app.testUtility.PACKAGE_ID
@RunWith(AndroidJUnit4::class) @RunWith(AndroidJUnit4::class)
class LoginActivityOnlineTest { class LoginActivityOnlineTest {
@ -39,7 +40,7 @@ class LoginActivityOnlineTest {
fun setup() { fun setup() {
context = ApplicationProvider.getApplicationContext() context = ApplicationProvider.getApplicationContext()
context = ApplicationProvider.getApplicationContext() context = ApplicationProvider.getApplicationContext()
pref = context.getSharedPreferences("org.pixeldroid.app.pref", Context.MODE_PRIVATE) pref = context.getSharedPreferences("${PACKAGE_ID}.pref", Context.MODE_PRIVATE)
pref.edit().clear().apply() pref.edit().clear().apply()
db = initDB(context) db = initDB(context)
db.clearAllTables() db.clearAllTables()
@ -76,7 +77,7 @@ class LoginActivityOnlineTest {
.putString("clientID", "iwndoiuqwnd") .putString("clientID", "iwndoiuqwnd")
.putString("clientSecret", "wlifowed") .putString("clientSecret", "wlifowed")
.apply() .apply()
val uri = Uri.parse("oauth2redirect://org.pixeldroid.app?code=sdfdqsf") val uri = Uri.parse("oauth2redirect://${PACKAGE_ID}?code=sdfdqsf")
val intent = Intent(ACTION_VIEW, uri, context, LoginActivity::class.java) val intent = Intent(ACTION_VIEW, uri, context, LoginActivity::class.java)
ActivityScenario.launch<LoginActivity>(intent) ActivityScenario.launch<LoginActivity>(intent)
onView(withId(R.id.editText)).check(matches( onView(withId(R.id.editText)).check(matches(
@ -86,7 +87,7 @@ class LoginActivityOnlineTest {
@Test @Test
fun incompleteIntentReturnInfoFailsTest() { fun incompleteIntentReturnInfoFailsTest() {
val uri = Uri.parse("oauth2redirect://org.pixeldroid.app?code=") val uri = Uri.parse("oauth2redirect://${PACKAGE_ID}?code=")
val intent = Intent(ACTION_VIEW, uri, context, LoginActivity::class.java) val intent = Intent(ACTION_VIEW, uri, context, LoginActivity::class.java)
ActivityScenario.launch<LoginActivity>(intent) ActivityScenario.launch<LoginActivity>(intent)
onView(withId(R.id.editText)).check(matches( onView(withId(R.id.editText)).check(matches(

View File

@ -4,6 +4,10 @@ import org.pixeldroid.app.BuildConfig.*
import org.pixeldroid.app.utils.db.entities.InstanceDatabaseEntity import org.pixeldroid.app.utils.db.entities.InstanceDatabaseEntity
import org.pixeldroid.app.utils.db.entities.UserDatabaseEntity import org.pixeldroid.app.utils.db.entities.UserDatabaseEntity
const val PACKAGE_ID = APPLICATION_ID
val testiTestoInstance = InstanceDatabaseEntity( val testiTestoInstance = InstanceDatabaseEntity(
uri = INSTANCE_URI, uri = INSTANCE_URI,
title = "PixelDroid CI instance", title = "PixelDroid CI instance",

View File

@ -15,7 +15,7 @@
<uses-feature android:name="android.hardware.location.gps" /> <uses-feature android:name="android.hardware.location.gps" />
<application <application
android:name="org.pixeldroid.app.utils.PixelDroidApplication" android:name=".utils.PixelDroidApplication"
android:allowBackup="false" android:allowBackup="false"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
@ -23,14 +23,14 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
tools:replace="android:allowBackup"> tools:replace="android:allowBackup">
<activity android:name="org.pixeldroid.app.postCreation.camera.CameraActivity" /> <activity android:name=".postCreation.camera.CameraActivity" />
<activity <activity
android:name="org.pixeldroid.app.posts.ReportActivity" android:name=".posts.ReportActivity"
android:screenOrientation="sensorPortrait" android:screenOrientation="sensorPortrait"
tools:ignore="LockedOrientationActivity" /> tools:ignore="LockedOrientationActivity" />
<activity android:name="org.pixeldroid.app.postCreation.photoEdit.PhotoEditActivity" /> <activity android:name=".postCreation.photoEdit.PhotoEditActivity" />
<activity <activity
android:name="org.pixeldroid.app.postCreation.PostCreationActivity" android:name=".postCreation.PostCreationActivity"
android:screenOrientation="sensorPortrait" android:screenOrientation="sensorPortrait"
android:theme="@style/AppTheme.NoActionBar" android:theme="@style/AppTheme.NoActionBar"
tools:ignore="LockedOrientationActivity" > tools:ignore="LockedOrientationActivity" >
@ -46,25 +46,25 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name="org.pixeldroid.app.profile.FollowsActivity" android:name=".profile.FollowsActivity"
android:screenOrientation="sensorPortrait" android:screenOrientation="sensorPortrait"
tools:ignore="LockedOrientationActivity" /> tools:ignore="LockedOrientationActivity" />
<activity <activity
android:name="org.pixeldroid.app.posts.PostActivity" android:name=".posts.PostActivity"
android:screenOrientation="sensorPortrait" android:screenOrientation="sensorPortrait"
tools:ignore="LockedOrientationActivity" /> tools:ignore="LockedOrientationActivity" />
<activity <activity
android:name="org.pixeldroid.app.profile.ProfileActivity" android:name=".profile.ProfileActivity"
android:screenOrientation="sensorPortrait" android:screenOrientation="sensorPortrait"
tools:ignore="LockedOrientationActivity" /> tools:ignore="LockedOrientationActivity" />
<activity <activity
android:name="org.pixeldroid.app.settings.SettingsActivity" android:name=".settings.SettingsActivity"
android:label="@string/title_activity_settings2" android:label="@string/title_activity_settings2"
android:parentActivityName="org.pixeldroid.app.MainActivity" android:parentActivityName=".MainActivity"
android:screenOrientation="sensorPortrait" android:screenOrientation="sensorPortrait"
tools:ignore="LockedOrientationActivity" /> tools:ignore="LockedOrientationActivity" />
<activity <activity
android:name="org.pixeldroid.app.MainActivity" android:name=".MainActivity"
android:screenOrientation="sensorPortrait" android:screenOrientation="sensorPortrait"
android:theme="@style/AppTheme.Launcher" android:theme="@style/AppTheme.Launcher"
android:windowSoftInputMode="adjustPan" android:windowSoftInputMode="adjustPan"
@ -77,10 +77,10 @@
<meta-data <meta-data
android:name="android.app.default_searchable" android:name="android.app.default_searchable"
android:value=".searchDiscover.SearchActivity" /> android:value="org.pixeldroid.app.searchDiscover.SearchActivity" />
</activity> </activity>
<activity <activity
android:name="org.pixeldroid.app.LoginActivity" android:name=".LoginActivity"
android:screenOrientation="sensorPortrait" android:screenOrientation="sensorPortrait"
android:theme="@style/AppTheme.NoActionBar" android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustResize" android:windowSoftInputMode="adjustResize"
@ -102,7 +102,7 @@
android:theme="@style/AppTheme.NoActionBar" android:theme="@style/AppTheme.NoActionBar"
tools:ignore="LockedOrientationActivity" /> tools:ignore="LockedOrientationActivity" />
<activity <activity
android:name="org.pixeldroid.app.searchDiscover.SearchActivity" android:name=".searchDiscover.SearchActivity"
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="sensorPortrait" android:screenOrientation="sensorPortrait"
tools:ignore="LockedOrientationActivity"> tools:ignore="LockedOrientationActivity">
@ -115,13 +115,13 @@
android:resource="@xml/searchable" /> android:resource="@xml/searchable" />
</activity> </activity>
<activity <activity
android:name="org.pixeldroid.app.settings.AboutActivity" android:name=".settings.AboutActivity"
android:parentActivityName="org.pixeldroid.app.settings.SettingsActivity" android:parentActivityName=".settings.SettingsActivity"
android:screenOrientation="sensorPortrait" android:screenOrientation="sensorPortrait"
tools:ignore="LockedOrientationActivity" /> tools:ignore="LockedOrientationActivity" />
<activity <activity
android:name="org.pixeldroid.app.settings.LicenseActivity" android:name=".settings.LicenseActivity"
android:parentActivityName="org.pixeldroid.app.settings.AboutActivity" android:parentActivityName=".settings.AboutActivity"
android:screenOrientation="sensorPortrait" android:screenOrientation="sensorPortrait"
tools:ignore="LockedOrientationActivity" /> tools:ignore="LockedOrientationActivity" />