Merge pull request #160 from FineFindus/fix/sign-in-flow
fix: use BuilType defined REDIRECT_URI
This commit is contained in:
@@ -5,6 +5,7 @@ plugins {
|
||||
android {
|
||||
compileSdk 33
|
||||
defaultConfig {
|
||||
manifestPlaceholders = [oAuthScheme:"moshidon-android-auth"]
|
||||
archivesBaseName = "moshidon"
|
||||
applicationId "org.joinmastodon.android.moshinda"
|
||||
minSdk 23
|
||||
@@ -49,6 +50,7 @@ android {
|
||||
debuggable true
|
||||
versionNameSuffix '-debug'
|
||||
applicationIdSuffix '.debug'
|
||||
manifestPlaceholders = [oAuthScheme:"moshidon-android-debug-auth"]
|
||||
}
|
||||
githubRelease{
|
||||
initWith release
|
||||
@@ -64,6 +66,7 @@ android {
|
||||
}
|
||||
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");
|
||||
@@ -215,7 +226,7 @@ public class AccountSessionManager{
|
||||
.path("/oauth/authorize")
|
||||
.appendQueryParameter("response_type", "code")
|
||||
.appendQueryParameter("client_id", result.clientId)
|
||||
.appendQueryParameter("redirect_uri", "moshidon-android-auth://callback")
|
||||
.appendQueryParameter("redirect_uri", REDIRECT_URI)
|
||||
.appendQueryParameter("scope", SCOPE)
|
||||
.build();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user