linked: localization for github creation
This commit is contained in:
@@ -31,7 +31,6 @@ import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Random;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
@@ -41,6 +40,8 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Build.VERSION;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.NonNull;
|
||||
@@ -244,19 +245,18 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe
|
||||
}
|
||||
|
||||
if (result != null) {
|
||||
Notify.create(activity, "Authorization failed!", Style.ERROR).show();
|
||||
Notify.create(activity, R.string.linked_error_auth_failed, Style.ERROR).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (mException instanceof SocketTimeoutException) {
|
||||
Notify.create(activity, "Connection timeout!", Style.ERROR).show();
|
||||
Notify.create(activity, R.string.linked_error_timeout, Style.ERROR).show();
|
||||
} else if (mException instanceof HttpResultException) {
|
||||
// we have the error code here.. should we use it?
|
||||
Notify.create(activity,
|
||||
"Communication error: " + ((HttpResultException) mException).mResponse,
|
||||
Notify.create(activity, activity.getString(R.string.linked_error_http,
|
||||
((HttpResultException) mException).mResponse),
|
||||
Style.ERROR).show();
|
||||
} else if (mException instanceof IOException) {
|
||||
Notify.create(activity, "Network error!", Style.ERROR).show();
|
||||
Notify.create(activity, R.string.linked_error_network, Style.ERROR).show();
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -287,11 +287,11 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe
|
||||
file.put("content", gistText);
|
||||
|
||||
JSONObject files = new JSONObject();
|
||||
files.put("file1.txt", file);
|
||||
files.put("openpgp.txt", file);
|
||||
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("public", true);
|
||||
params.put("description", "OpenKeychain API Tests");
|
||||
params.put("description", getString(R.string.linked_gist_description));
|
||||
params.put("files", files);
|
||||
|
||||
JSONObject result = jsonHttpRequest("https://api.github.com/gists", params, accessToken);
|
||||
@@ -331,14 +331,13 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe
|
||||
}
|
||||
|
||||
if (mException instanceof SocketTimeoutException) {
|
||||
Notify.create(activity, "Connection timeout!", Style.ERROR).show();
|
||||
Notify.create(activity, R.string.linked_error_timeout, Style.ERROR).show();
|
||||
} else if (mException instanceof HttpResultException) {
|
||||
// we have the error code here.. should we use it?
|
||||
Notify.create(activity,
|
||||
"Communication error: " + ((HttpResultException) mException).mResponse,
|
||||
Notify.create(activity, activity.getString(R.string.linked_error_http,
|
||||
((HttpResultException) mException).mResponse),
|
||||
Style.ERROR).show();
|
||||
} else if (mException instanceof IOException) {
|
||||
Notify.create(activity, "Network error!", Style.ERROR).show();
|
||||
Notify.create(activity, R.string.linked_error_network, Style.ERROR).show();
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -359,7 +358,7 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe
|
||||
}
|
||||
|
||||
View linkedItem = mButtonContainer.getChildAt(2);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
|
||||
linkedItem.setTransitionName(resource.toUri().toString());
|
||||
}
|
||||
|
||||
@@ -533,7 +532,7 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe
|
||||
}
|
||||
|
||||
if (uri.getQueryParameter("error") != null) {
|
||||
Log.i(Constants.TAG, "ACCESS_DENIED_HERE");
|
||||
Log.i(Constants.TAG, "got oauth error: " + uri.getQueryParameter("error"));
|
||||
auth_dialog.dismiss();
|
||||
return true;
|
||||
}
|
||||
@@ -554,7 +553,7 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe
|
||||
|
||||
});
|
||||
|
||||
auth_dialog.setTitle("GitHub Authorization");
|
||||
auth_dialog.setTitle(R.string.linked_webview_title_github);
|
||||
auth_dialog.setCancelable(true);
|
||||
auth_dialog.setOnDismissListener(new OnDismissListener() {
|
||||
@Override
|
||||
@@ -616,8 +615,6 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static JSONObject jsonHttpRequest(String url, JSONObject params, String accessToken)
|
||||
throws IOException, HttpResultException {
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="This operation links your key to your GitHub account."
|
||||
android:text="@string/linked_github_text"
|
||||
style="?android:textAppearanceSmall"/>
|
||||
|
||||
<LinearLayout
|
||||
@@ -72,7 +72,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="Login at GitHub…"
|
||||
android:text="@string/linked_progress_auth_github"
|
||||
style="?android:textAppearanceMedium"
|
||||
/>
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="Post Gist…"
|
||||
android:text="@string/linked_progress_post_gist"
|
||||
style="?android:textAppearanceMedium"
|
||||
/>
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="Update Key…"
|
||||
android:text="@string/linked_progress_update_key"
|
||||
style="?android:textAppearanceMedium"
|
||||
/>
|
||||
</LinearLayout>
|
||||
@@ -139,7 +139,7 @@
|
||||
android:drawableLeft="@drawable/link_24dp"
|
||||
android:drawableStart="@drawable/link_24dp"
|
||||
android:drawablePadding="12dp"
|
||||
android:text="Link to Github Account"
|
||||
android:text="@string/linked_button_start"
|
||||
android:id="@+id/button_send"
|
||||
/>
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
android:drawableLeft="@drawable/ic_repeat_black_24dp"
|
||||
android:drawableStart="@drawable/ic_repeat_black_24dp"
|
||||
android:drawablePadding="12dp"
|
||||
android:text="Retry Last Step"
|
||||
android:text="@string/linked_button_retry"
|
||||
android:id="@+id/button_retry"
|
||||
/>
|
||||
|
||||
|
||||
@@ -1604,19 +1604,30 @@
|
||||
<string name="menu_linked_add_identity">"Link to Account"</string>
|
||||
<string name="section_linked_identities">"Linked Identities"</string>
|
||||
<string name="btn_finish">"Finish"</string>
|
||||
<string name="linked_title_https">Website (HTTPS)</string>
|
||||
<string name="linked_title_dns">Domain Name (DNS)</string>
|
||||
<string name="linked_title_github">GitHub</string>
|
||||
<string name="linked_title_twitter">Twitter</string>
|
||||
<string name="card_linked_identity">Linked Identity</string>
|
||||
<string name="linked_button_verify">Verify</string>
|
||||
<string name="linked_button_retry">Retry</string>
|
||||
<string name="linked_button_confirm">Confirm</string>
|
||||
<string name="linked_button_view">View</string>
|
||||
<string name="linked_text_verifying">Verifying…</string>
|
||||
<string name="linked_text_error">Error</string>
|
||||
<string name="linked_text_confirming">Confirming…</string>
|
||||
<string name="linked_ids_more_unknown">%d more unknown identity types</string>
|
||||
<string name="title_linked_id_create">Create Linked Identity</string>
|
||||
<string name="linked_title_https">"Website (HTTPS)"</string>
|
||||
<string name="linked_title_dns">"Domain Name (DNS)"</string>
|
||||
<string name="linked_title_github">"GitHub"</string>
|
||||
<string name="linked_title_twitter">"Twitter"</string>
|
||||
<string name="card_linked_identity">"Linked Identity"</string>
|
||||
<string name="linked_button_verify">"Verify"</string>
|
||||
<string name="linked_button_retry">"Retry last step"</string>
|
||||
<string name="linked_button_confirm">"Confirm"</string>
|
||||
<string name="linked_button_view">"View"</string>
|
||||
<string name="linked_text_verifying">"Verifying…"</string>
|
||||
<string name="linked_text_error">"Error"</string>
|
||||
<string name="linked_text_confirming">"Confirming…"</string>
|
||||
<string name="linked_ids_more_unknown">"%d more unknown identity types"</string>
|
||||
<string name="title_linked_id_create">"Create Linked Identity"</string>
|
||||
<string name="linked_github_text">"This operation links your key to your GitHub account.\nJust press the button to continue."</string>
|
||||
<string name="linked_progress_auth_github">"Authorize with GitHub…"</string>
|
||||
<string name="linked_progress_post_gist">"Post Gist…"</string>
|
||||
<string name="linked_progress_update_key">"Update Key…"</string>
|
||||
<string name="linked_button_start">"Link to Github Account"</string>
|
||||
<string name="linked_error_auth_failed">"Authorization failed!"</string>
|
||||
<string name="linked_error_timeout">"Connection timeout!"</string>
|
||||
<string name="linked_error_network">"Network error!"</string>
|
||||
<string name="linked_error_http">"Communication error: %s"</string>
|
||||
<string name="linked_webview_title_github">"GitHub Authorization"</string>
|
||||
<string name="linked_gist_description">"OpenKeychain API Tests"</string>
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user