Fixes and improvements (#1328)
Closes #1327 Closes #1308 Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1328 Co-authored-by: M M Arif <mmarif@swatian.com> Co-committed-by: M M Arif <mmarif@swatian.com>
This commit is contained in:
parent
95cab94b1c
commit
2cde78c2a3
|
@ -67,14 +67,14 @@ dependencies {
|
|||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.2'
|
||||
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.12'
|
||||
implementation 'com.google.code.gson:gson:2.10.1'
|
||||
implementation "com.squareup.picasso:picasso:2.71828"
|
||||
implementation 'com.github.ramseth001:TextDrawable:1.1.3'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.12'
|
||||
implementation 'org.ocpsoft.prettytime:prettytime:5.0.7.Final'
|
||||
implementation "com.github.skydoves:colorpickerview:2.3.0"
|
||||
implementation "io.noties.markwon:core:4.6.2"
|
||||
|
@ -96,9 +96,9 @@ dependencies {
|
|||
implementation 'commons-io:commons-io:2.5'
|
||||
implementation 'org.apache.commons:commons-lang3:3.13.0'
|
||||
implementation "com.github.chrisbanes:PhotoView:2.3.0"
|
||||
implementation 'ch.acra:acra-mail:5.11.2'
|
||||
implementation 'ch.acra:acra-limiter:5.11.2'
|
||||
implementation 'ch.acra:acra-notification:5.11.2'
|
||||
implementation 'ch.acra:acra-mail:5.11.3'
|
||||
implementation 'ch.acra:acra-limiter:5.11.3'
|
||||
implementation 'ch.acra:acra-notification:5.11.3'
|
||||
implementation 'androidx.room:room-runtime:2.6.1'
|
||||
annotationProcessor 'androidx.room:room-compiler:2.6.1'
|
||||
implementation "androidx.work:work-runtime:2.9.0"
|
||||
|
@ -113,7 +113,7 @@ dependencies {
|
|||
implementation('org.codeberg.gitnex:tea4j-autodeploy:4646f53557') {
|
||||
exclude module: 'org.apache.oltu.oauth2.common'
|
||||
}
|
||||
implementation 'io.github.amrdeveloper:codeview:1.3.8'
|
||||
implementation 'io.github.amrdeveloper:codeview:1.3.9'
|
||||
|
||||
constraints {
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0")
|
||||
|
|
|
@ -8,8 +8,6 @@ import android.os.Looper;
|
|||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import io.mikael.urlbuilder.UrlBuilder;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
@ -26,7 +24,6 @@ import org.mian.gitnex.database.api.UserAccountsApi;
|
|||
import org.mian.gitnex.database.models.UserAccount;
|
||||
import org.mian.gitnex.databinding.ActivityDeeplinksBinding;
|
||||
import org.mian.gitnex.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.UrlHelper;
|
||||
import org.mian.gitnex.helpers.contexts.IssueContext;
|
||||
import org.mian.gitnex.helpers.contexts.RepositoryContext;
|
||||
import retrofit2.Call;
|
||||
|
@ -40,12 +37,12 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
|
||||
private ActivityDeeplinksBinding viewBinding;
|
||||
private boolean accountFound = false;
|
||||
|
||||
private Intent mainIntent;
|
||||
private Intent issueIntent;
|
||||
private Intent repoIntent;
|
||||
private Intent orgIntent;
|
||||
private Intent userIntent;
|
||||
private Uri data;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -62,7 +59,7 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
userIntent = new Intent(ctx, ProfileActivity.class);
|
||||
|
||||
Intent intent = getIntent();
|
||||
Uri data = intent.getData();
|
||||
data = intent.getData();
|
||||
assert data != null;
|
||||
|
||||
// check for login
|
||||
|
@ -111,20 +108,21 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
// redirect to proper fragment/activity, if no action is there, show options where user
|
||||
// to want to go like repos, profile, notifications etc
|
||||
if (data.getPathSegments().size() == 1) {
|
||||
if (data.getLastPathSegment().equals("notifications")) { // notifications
|
||||
if (Objects.equals(data.getLastPathSegment(), "notifications")) { // notifications
|
||||
mainIntent.putExtra("launchFragmentByLinkHandler", "notification");
|
||||
ctx.startActivity(mainIntent);
|
||||
finish();
|
||||
} else if (data.getLastPathSegment().equals("explore")) { // explore
|
||||
} else if (Objects.equals(data.getLastPathSegment(), "explore")) { // explore
|
||||
mainIntent.putExtra("launchFragmentByLinkHandler", "explore");
|
||||
ctx.startActivity(mainIntent);
|
||||
finish();
|
||||
} else if (data.getLastPathSegment()
|
||||
.equals(getAccount().getAccount().getUserName())) { // your user profile
|
||||
} else if (Objects.equals(
|
||||
data.getLastPathSegment(),
|
||||
getAccount().getAccount().getUserName())) { // your user profile
|
||||
mainIntent.putExtra("launchFragmentByLinkHandler", "profile");
|
||||
ctx.startActivity(mainIntent);
|
||||
finish();
|
||||
} else if (data.getLastPathSegment().equals("admin")) {
|
||||
} else if (Objects.equals(data.getLastPathSegment(), "admin")) {
|
||||
mainIntent.putExtra("launchFragmentByLinkHandler", "admin");
|
||||
ctx.startActivity(mainIntent);
|
||||
finish();
|
||||
|
@ -152,9 +150,10 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
mainIntent.putExtra("giteaAdminAction", data.getLastPathSegment());
|
||||
ctx.startActivity(mainIntent);
|
||||
finish();
|
||||
} else if (!data.getPathSegments().get(0).equals("")
|
||||
& !data.getLastPathSegment().equals("")) { // go to repo
|
||||
} else if (!data.getPathSegments().get(0).isEmpty()
|
||||
& !Objects.equals(data.getLastPathSegment(), "")) { // go to repo
|
||||
String repo = data.getLastPathSegment();
|
||||
assert repo != null;
|
||||
if (repo.endsWith(".git")) { // Git clone URL
|
||||
repo = repo.substring(0, repo.length() - 4);
|
||||
}
|
||||
|
@ -300,7 +299,7 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
"commitsList"),
|
||||
500);
|
||||
} else if (data.getPathSegments().get(2).equals("milestones")
|
||||
&& data.getLastPathSegment().equals("new")) { // new milestone
|
||||
&& Objects.equals(data.getLastPathSegment(), "new")) { // new milestone
|
||||
new Handler(Looper.getMainLooper())
|
||||
.postDelayed(
|
||||
() ->
|
||||
|
@ -329,7 +328,7 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
"milestones"),
|
||||
500);
|
||||
} else if (data.getPathSegments().get(2).equals("releases")
|
||||
&& data.getLastPathSegment().equals("new")) { // new release
|
||||
&& Objects.equals(data.getLastPathSegment(), "new")) { // new release
|
||||
new Handler(Looper.getMainLooper())
|
||||
.postDelayed(
|
||||
() ->
|
||||
|
@ -371,7 +370,7 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
data.getPathSegments().get(1),
|
||||
"settings"),
|
||||
500);
|
||||
} else if (data.getLastPathSegment().equals("branches")) { // branches list
|
||||
} else if (Objects.equals(data.getLastPathSegment(), "branches")) { // branches list
|
||||
new Handler(Looper.getMainLooper())
|
||||
.postDelayed(
|
||||
() ->
|
||||
|
@ -414,7 +413,8 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
} else if (data.getPathSegments().get(2).equals("wiki")) { // wiki
|
||||
|
||||
if (data.getQueryParameter("action") != null
|
||||
&& data.getQueryParameter("action").equalsIgnoreCase("_new")) {
|
||||
&& Objects.requireNonNull(data.getQueryParameter("action"))
|
||||
.equalsIgnoreCase("_new")) {
|
||||
new Handler(Looper.getMainLooper())
|
||||
.postDelayed(
|
||||
() ->
|
||||
|
@ -461,14 +461,7 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
|
||||
viewBinding.openInBrowser.setOnClickListener(
|
||||
addNewAccount -> {
|
||||
Integer port = data.getPort() >= 0 ? data.getPort() : null;
|
||||
|
||||
URI host =
|
||||
UrlBuilder.fromString(UrlHelper.fixScheme(data.getHost(), "https"))
|
||||
.withPort(port)
|
||||
.toUri();
|
||||
|
||||
AppUtil.openUrlInBrowser(this, String.valueOf(host));
|
||||
AppUtil.openUrlInBrowser(this, String.valueOf(data));
|
||||
finish();
|
||||
});
|
||||
|
||||
|
@ -707,6 +700,12 @@ public class DeepLinksActivity extends BaseActivity {
|
|||
viewBinding.noActionFrame.setVisibility(View.VISIBLE);
|
||||
viewBinding.addNewAccountFrame.setVisibility(View.GONE);
|
||||
|
||||
viewBinding.openInBrowserNoActionFrame.setOnClickListener(
|
||||
noActionFrameOpenInBrowser -> {
|
||||
AppUtil.openUrlInBrowser(this, String.valueOf(data));
|
||||
finish();
|
||||
});
|
||||
|
||||
viewBinding.repository.setOnClickListener(
|
||||
repository -> {
|
||||
tinyDB.putInt("defaultScreenId", 1);
|
||||
|
|
|
@ -15,7 +15,7 @@ public class SnackBar {
|
|||
Snackbar snackBar = Snackbar.make(view, message, Snackbar.LENGTH_LONG);
|
||||
View sbView = snackBar.getView();
|
||||
TextView textView = sbView.findViewById(R.id.snackbar_text);
|
||||
snackBar.setBackgroundTint(context.getColor(R.color.material_dynamic_neutral10));
|
||||
snackBar.setBackgroundTint(context.getColor(R.color.cardBackground));
|
||||
textView.setTextColor(context.getColor(R.color.colorWhite));
|
||||
snackBar.show();
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class SnackBar {
|
|||
Snackbar snackBar = Snackbar.make(view, message, Snackbar.LENGTH_LONG);
|
||||
View sbView = snackBar.getView();
|
||||
TextView textView = sbView.findViewById(R.id.snackbar_text);
|
||||
snackBar.setBackgroundTint(context.getColor(R.color.material_dynamic_neutral10));
|
||||
snackBar.setBackgroundTint(context.getColor(R.color.cardBackground));
|
||||
textView.setTextColor(context.getColor(R.color.colorWhite));
|
||||
snackBar.show();
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class SnackBar {
|
|||
Snackbar snackBar = Snackbar.make(view, message, Snackbar.LENGTH_LONG);
|
||||
View sbView = snackBar.getView();
|
||||
TextView textView = sbView.findViewById(R.id.snackbar_text);
|
||||
snackBar.setBackgroundTint(context.getColor(R.color.material_dynamic_neutral10));
|
||||
snackBar.setBackgroundTint(context.getColor(R.color.cardBackground));
|
||||
textView.setTextColor(context.getColor(R.color.warningColor));
|
||||
snackBar.show();
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class SnackBar {
|
|||
Snackbar snackBar = Snackbar.make(view, message, Snackbar.LENGTH_LONG);
|
||||
View sbView = snackBar.getView();
|
||||
TextView textView = sbView.findViewById(R.id.snackbar_text);
|
||||
snackBar.setBackgroundTint(context.getColor(R.color.material_dynamic_neutral10));
|
||||
snackBar.setBackgroundTint(context.getColor(R.color.cardBackground));
|
||||
textView.setTextColor(context.getColor(R.color.darkRed));
|
||||
snackBar.show();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
app:indicatorColor="?attr/progressIndicatorColor"/>
|
||||
app:indicatorColor="?attr/progressIndicatorColor" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -41,7 +41,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/accountDoesNotExist"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="@dimen/dimen16sp"/>
|
||||
android:textSize="@dimen/dimen16sp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/addNewAccount"
|
||||
|
@ -51,7 +51,7 @@
|
|||
android:text="@string/addNewAccountText"
|
||||
android:textColor="?attr/materialCardBackgroundColor"
|
||||
android:textSize="@dimen/dimen16sp"
|
||||
android:textStyle="bold"/>
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/openInBrowser"
|
||||
|
@ -60,7 +60,8 @@
|
|||
android:layout_marginTop="@dimen/dimen8dp"
|
||||
android:text="@string/openWebRepo"
|
||||
android:textColor="?attr/materialCardBackgroundColor"
|
||||
android:textSize="@dimen/dimen16sp"/>
|
||||
android:textSize="@dimen/dimen16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/launchApp"
|
||||
|
@ -70,7 +71,7 @@
|
|||
android:text="@string/launchApp"
|
||||
android:textColor="?attr/materialCardBackgroundColor"
|
||||
android:textSize="@dimen/dimen16sp"
|
||||
android:textStyle="bold"/>
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -91,17 +92,27 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/noActionText"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="@dimen/dimen16sp"/>
|
||||
android:textSize="@dimen/dimen16sp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/openInBrowserNoActionFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dimen54dp"
|
||||
android:layout_marginTop="@dimen/dimen24dp"
|
||||
android:text="@string/openWebRepo"
|
||||
android:textColor="?attr/materialCardBackgroundColor"
|
||||
android:textSize="@dimen/dimen16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/repository"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dimen54dp"
|
||||
android:layout_marginTop="@dimen/dimen24dp"
|
||||
android:layout_marginTop="@dimen/dimen8dp"
|
||||
android:text="@string/navRepos"
|
||||
android:textColor="?attr/materialCardBackgroundColor"
|
||||
android:textSize="@dimen/dimen16sp"
|
||||
android:textStyle="bold"/>
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/organization"
|
||||
|
@ -111,7 +122,7 @@
|
|||
android:text="@string/navOrg"
|
||||
android:textColor="?attr/materialCardBackgroundColor"
|
||||
android:textSize="@dimen/dimen16sp"
|
||||
android:textStyle="bold"/>
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/notification"
|
||||
|
@ -121,7 +132,7 @@
|
|||
android:text="@string/pageTitleNotifications"
|
||||
android:textColor="?attr/materialCardBackgroundColor"
|
||||
android:textSize="@dimen/dimen16sp"
|
||||
android:textStyle="bold"/>
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/explore"
|
||||
|
@ -131,7 +142,7 @@
|
|||
android:text="@string/pageTitleExplore"
|
||||
android:textColor="?attr/materialCardBackgroundColor"
|
||||
android:textSize="@dimen/dimen16sp"
|
||||
android:textStyle="bold"/>
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/launchApp2"
|
||||
|
@ -141,7 +152,7 @@
|
|||
android:text="@string/launchApp"
|
||||
android:textColor="?attr/materialCardBackgroundColor"
|
||||
android:textSize="@dimen/dimen16sp"
|
||||
android:textStyle="bold"/>
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -742,9 +742,9 @@
|
|||
<string name="prReopened">Pull Request reopened</string>
|
||||
<string name="prMergeInfo">Pull Request Info</string>
|
||||
|
||||
<string name="accountDoesNotExist">It seems that account for URI %1$s does not exists in the app. You can add one by tapping on the Add New Account button.</string>
|
||||
<string name="accountDoesNotExist">It seems that the account for URI %1$s does not exist in the app. You can add one by tapping on the Add New Account button.</string>
|
||||
<string name="launchApp">Go to App</string>
|
||||
<string name="noActionText">GitNex cannot handle the requested resource, you can open an issue at the project repository as an improvement with providing details of the work. Just launch a default screen for now from the buttons below, it can be changed from settings.</string>
|
||||
<string name="noActionText">GitNex cannot handle the requested resource. You can open an issue at the project repository as an improvement, providing details of the work. Just launch a default screen for now from the buttons below; it can be changed from settings.</string>
|
||||
|
||||
<string name="biometricAuthTitle">Biometric Authentication</string>
|
||||
<string name="biometricAuthSubTitle">Unlock using your biometric credentials</string>
|
||||
|
|
Loading…
Reference in New Issue