fix(auth): use BuildType depended redirect uri
This commit is contained in:
parent
7615723d4f
commit
a59587eb62
|
@ -5,6 +5,7 @@ plugins {
|
|||
android {
|
||||
compileSdk 33
|
||||
defaultConfig {
|
||||
manifestPlaceholders = [oAuthScheme:"moshidon-android-auth"]
|
||||
archivesBaseName = "moshidon"
|
||||
applicationId "org.joinmastodon.android.moshinda"
|
||||
minSdk 23
|
||||
|
@ -34,6 +35,7 @@ android {
|
|||
debuggable true
|
||||
versionNameSuffix '-debug'
|
||||
applicationIdSuffix '.debug'
|
||||
manifestPlaceholders = [oAuthScheme:"moshidon-android-debug-auth"]
|
||||
}
|
||||
githubRelease{
|
||||
initWith release
|
||||
|
@ -43,6 +45,7 @@ android {
|
|||
versionNameSuffix '-nightly'
|
||||
applicationIdSuffix '.nightly'
|
||||
signingConfig signingConfigs.nightly
|
||||
manifestPlaceholders = [oAuthScheme:"moshidon-android-nightly-auth"]
|
||||
}
|
||||
playRelease{
|
||||
initWith release
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<action android:name="android.intent.action.VIEW"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<data android:scheme="moshidon-android-auth" android:host="callback"/>
|
||||
<data android:scheme="${oAuthScheme}" android:host="callback"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".ExternalShareActivity" android:exported="true" android:configChanges="orientation|screenSize" android:windowSoftInputMode="adjustResize"
|
||||
|
|
|
@ -65,7 +65,7 @@ import me.grishka.appkit.api.ErrorResponse;
|
|||
public class AccountSessionManager{
|
||||
private static final String TAG="AccountSessionManager";
|
||||
public static final String SCOPE="read write follow push";
|
||||
public static final String REDIRECT_URI="moshidon-android-auth://callback";
|
||||
public static final String REDIRECT_URI = getRedirectURI();
|
||||
|
||||
private static final AccountSessionManager instance=new AccountSessionManager();
|
||||
|
||||
|
@ -84,6 +84,17 @@ public class AccountSessionManager{
|
|||
return instance;
|
||||
}
|
||||
|
||||
public static String getRedirectURI() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("moshidon-android-");
|
||||
if (BuildConfig.BUILD_TYPE.equals("debug") || BuildConfig.BUILD_TYPE.equals("nightly")) {
|
||||
builder.append(BuildConfig.BUILD_TYPE);
|
||||
builder.append('-');
|
||||
}
|
||||
builder.append("auth://callback");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private AccountSessionManager(){
|
||||
prefs=MastodonApp.context.getSharedPreferences("account_manager", Context.MODE_PRIVATE);
|
||||
File file=new File(MastodonApp.context.getFilesDir(), "accounts.json");
|
||||
|
|
Loading…
Reference in New Issue