Skip to content

Commit 84eee4c

Browse files
authored
feat: android mvp cleanup (#33)
* chore: update android logo icon * WIP: analytics * WIP: add sentry, amplitude identification * feat: add error boundary * wip: refactoring tags input * WIP * wip: building after refactor * WIP: styling tag input * fix: patch annotation logic, style new tag input * WIP: tag editing * wip * wip: tag link and input * wip: style TagLinkAndInput * WIP: add tag editing * feat: integrate new tag input * fix: debug tag edge cases, scaffold file uploader * WIP: createAnnotationFromExternalTarget * wip: debugging error case * feat: debugging create from screenshot * feat: wire up create from share in js * fix: identity issues * feat: upload share target to private bucket * fix: createAgent * chore: update onboarding * deployment * chore: release metadata
1 parent 6cd7e89 commit 84eee4c

File tree

136 files changed

+5128
-2444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+5128
-2444
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,87 @@
11
{
2-
"auth": {
3-
"literalAuth": {
4-
"service": "Cognito",
5-
"providerPlugin": "awscloudformation",
6-
"dependsOn": [
7-
{
8-
"category": "function",
9-
"resourceName": "PostAuthentication",
10-
"triggerProvider": "Cognito",
11-
"attributes": [
12-
"Arn",
13-
"Name"
14-
]
15-
}
16-
]
17-
}
18-
},
19-
"api": {
20-
"literal": {
21-
"service": "AppSync",
22-
"providerPlugin": "awscloudformation",
23-
"output": {
24-
"authConfig": {
25-
"additionalAuthenticationProviders": [
26-
{
27-
"authenticationType": "AWS_IAM"
28-
}
29-
],
30-
"defaultAuthentication": {
31-
"authenticationType": "AMAZON_COGNITO_USER_POOLS",
32-
"userPoolConfig": {
33-
"userPoolId": "authliteralAuth"
34-
}
35-
}
36-
}
37-
},
38-
"dependsOn": []
39-
}
40-
},
41-
"function": {
42-
"GraphQLResolver": {
43-
"service": "Lambda",
44-
"providerPlugin": "awscloudformation",
45-
"build": true,
46-
"dependsOn": [
47-
{
48-
"category": "auth",
49-
"resourceName": "literalAuth",
50-
"attributes": [
51-
"UserPoolId"
52-
]
53-
},
54-
{
55-
"category": "api",
56-
"resourceName": "literal",
57-
"attributes": [
58-
"GraphQLAPIIdOutput",
59-
"GraphQLAPIEndpointOutput"
60-
]
61-
},
62-
{
63-
"category": "storage",
64-
"resourceName": "literalStorage",
65-
"attributes": [
66-
"BucketName"
67-
]
68-
}
69-
]
70-
},
71-
"CloudfrontOriginRequest": {
72-
"service": "Lambda",
73-
"providerPlugin": "awscloudformation",
74-
"build": true
75-
},
76-
"PostAuthentication": {
77-
"service": "Lambda",
78-
"providerPlugin": "awscloudformation",
79-
"build": true,
80-
"dependsOn": []
81-
}
82-
},
83-
"storage": {
84-
"literalStorage": {
85-
"service": "S3",
86-
"providerPlugin": "awscloudformation",
87-
"dependsOn": []
88-
}
89-
},
90-
"hosting": {
91-
"S3AndCloudFront": {
92-
"service": "S3AndCloudFront",
93-
"providerPlugin": "awscloudformation",
94-
"dependsOn": [
95-
{
96-
"category": "function",
97-
"resourceName": "CloudfrontOriginRequest",
98-
"attributes": [
99-
"VersionArn"
100-
]
101-
}
102-
]
103-
}
104-
}
105-
}
2+
"auth": {
3+
"literalAuth": {
4+
"service": "Cognito",
5+
"providerPlugin": "awscloudformation",
6+
"dependsOn": [
7+
{
8+
"category": "function",
9+
"resourceName": "PostAuthentication",
10+
"triggerProvider": "Cognito",
11+
"attributes": ["Arn", "Name"]
12+
}
13+
]
14+
}
15+
},
16+
"api": {
17+
"literal": {
18+
"service": "AppSync",
19+
"providerPlugin": "awscloudformation",
20+
"output": {
21+
"authConfig": {
22+
"additionalAuthenticationProviders": [
23+
{
24+
"authenticationType": "AWS_IAM"
25+
}
26+
],
27+
"defaultAuthentication": {
28+
"authenticationType": "AMAZON_COGNITO_USER_POOLS",
29+
"userPoolConfig": {
30+
"userPoolId": "authliteralAuth"
31+
}
32+
}
33+
}
34+
},
35+
"dependsOn": []
36+
}
37+
},
38+
"function": {
39+
"GraphQLResolver": {
40+
"service": "Lambda",
41+
"providerPlugin": "awscloudformation",
42+
"build": true,
43+
"dependsOn": [
44+
{
45+
"category": "auth",
46+
"resourceName": "literalAuth",
47+
"attributes": ["UserPoolId"]
48+
},
49+
{
50+
"category": "api",
51+
"resourceName": "literal",
52+
"attributes": ["GraphQLAPIIdOutput", "GraphQLAPIEndpointOutput"]
53+
},
54+
{
55+
"category": "storage",
56+
"resourceName": "literalStorage",
57+
"attributes": ["BucketName"]
58+
}
59+
]
60+
},
61+
"CloudfrontOriginRequest": {
62+
"service": "Lambda",
63+
"providerPlugin": "awscloudformation",
64+
"build": true
65+
},
66+
"PostAuthentication": {
67+
"service": "Lambda",
68+
"providerPlugin": "awscloudformation",
69+
"build": true,
70+
"dependsOn": []
71+
}
72+
},
73+
"storage": {
74+
"literalStorage": {
75+
"service": "S3",
76+
"providerPlugin": "awscloudformation",
77+
"dependsOn": []
78+
}
79+
},
80+
"hosting": {
81+
"S3AndCloudFront": {
82+
"service": "S3AndCloudFront",
83+
"providerPlugin": "awscloudformation",
84+
"dependsOn": []
85+
}
86+
}
87+
}

packages/android/amplify/team-provider-info.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
"literalAuth": {
1616
"hostedUIProviderCreds": "[{\"ProviderName\":\"Google\",\"client_id\":\"886430267359-qekh9bd4phv3hkp9h3pptdk8uvmjr0un.apps.googleusercontent.com\",\"client_secret\":\"PAHnTMcYshwJQjIj2fHnIYck\"}]"
1717
}
18+
},
19+
"function": {
20+
"GraphQLResolver": {},
21+
"CloudfrontOriginRequest": {},
22+
"PostAuthentication": {}
1823
}
1924
}
2025
},
@@ -42,4 +47,4 @@
4247
}
4348
}
4449
}
45-
}
50+
}

packages/android/app/build.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ dependencies {
3333
implementation fileTree(dir: 'libs', include: ['*.jar'])
3434

3535
implementation 'androidx.appcompat:appcompat:1.2.0'
36+
implementation "androidx.activity:activity:1.2.0-beta01"
37+
implementation "androidx.fragment:fragment:1.3.0-beta01"
3638
implementation "com.android.support:support-compat:28.0.0"
3739
implementation 'androidx.webkit:webkit:1.3.0'
3840

@@ -52,7 +54,7 @@ dependencies {
5254
implementation 'com.amazonaws:aws-android-sdk-appsync:3.1.0'
5355
// S3 SDK
5456
implementation 'com.amazonaws:aws-android-sdk-s3:2.18.0'
55-
implementation ('com.amazonaws:aws-android-sdk-auth-userpools:2.18.0@aar') { transitive = true }
57+
implementation('com.amazonaws:aws-android-sdk-auth-userpools:2.18.0@aar') { transitive = true }
5658
// Auth
5759
implementation 'com.amazonaws:aws-android-sdk-mobile-client:2.18.0'
5860
implementation 'com.amazonaws:aws-android-sdk-cognitoauth:2.18.0'

packages/android/app/src/main/AndroidManifest.xml

+4-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
android:icon="@mipmap/ic_launcher"
1515
android:label="@string/app_name"
1616
android:requestLegacyExternalStorage="true"
17-
android:roundIcon="@mipmap/ic_launcher_round"
1817
android:supportsRtl="true"
1918
android:theme="@style/AppTheme"
2019
android:usesCleartextTraffic="true">
@@ -31,18 +30,16 @@
3130
<activity
3231
android:name=".ui.activity.ShareTargetHandler"
3332
android:configChanges="orientation|screenSize">
34-
<intent-filter>
33+
<intent-filter
34+
android:label="Annotate">
3535
<action android:name="android.intent.action.SEND" />
36-
3736
<category android:name="android.intent.category.DEFAULT" />
38-
3937
<data android:mimeType="image/*" />
4038
</intent-filter>
41-
<intent-filter>
39+
<intent-filter
40+
android:label="Annotate">
4241
<action android:name="android.intent.action.SEND" />
43-
4442
<category android:name="android.intent.category.DEFAULT" />
45-
4643
<data android:mimeType="text/plain" />
4744
</intent-filter>
4845
</activity>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package io.literal.lib;
2+
3+
import android.net.Uri;
4+
import android.util.Log;
5+
import android.webkit.ValueCallback;
6+
7+
import androidx.activity.result.ActivityResultCallback;
8+
9+
import java.io.File;
10+
11+
public class FileActivityResultCallback implements ActivityResultCallback<Uri> {
12+
ValueCallback<Uri[]> callback;
13+
14+
@Override
15+
public void onActivityResult(Uri result) {
16+
if (callback != null) {
17+
callback.onReceiveValue(new Uri[]{result});
18+
} else {
19+
Log.i(Constants.LOG_TAG, "Received onActivityResult: " + result + ", but no callback set.");
20+
}
21+
}
22+
23+
public void setFilePathCallback(ValueCallback<Uri[]> callback) {
24+
this.callback = callback;
25+
}
26+
}

packages/android/app/src/main/java/io/literal/lib/WebEvent.java

+2
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ protected JSONObject doInBackground(Void... voids) {
164164
// FIXME: getUserAttributes is slow - separate network call?
165165
result.put("attributes", new JSONObject(/*awsMobileClient.getUserAttributes()*/));
166166
result.put("id", awsMobileClient.getIdentityId());
167+
168+
Log.i(Constants.LOG_TAG, "GetUserInfo: " + result.toString());
167169
return result;
168170

169171
} catch (Exception e) {

packages/android/app/src/main/java/io/literal/ui/activity/AuthenticationHandler.java

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import com.amazonaws.mobile.client.UserStateListener;
1313

1414
import io.literal.R;
15-
import io.literal.factory.AWSMobileClientFactory;
1615
import io.literal.lib.Constants;
1716

1817
public class AuthenticationHandler extends AppCompatActivity {

packages/android/app/src/main/java/io/literal/ui/activity/MainActivity.java

+33
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,42 @@
66
import android.util.Log;
77
import android.view.View;
88
import android.view.ViewGroup;
9+
import android.webkit.ValueCallback;
10+
import android.webkit.WebChromeClient;
911

12+
import androidx.activity.result.ActivityResultLauncher;
13+
import androidx.activity.result.contract.ActivityResultContracts;
1014
import androidx.appcompat.app.AppCompatActivity;
1115

1216
import com.amazonaws.mobile.client.AWSMobileClient;
1317
import com.amazonaws.mobile.client.Callback;
1418
import com.amazonaws.mobile.client.UserStateDetails;
1519

20+
import java.io.File;
21+
import java.util.UUID;
22+
1623
import io.literal.R;
1724
import io.literal.factory.AWSMobileClientFactory;
1825
import io.literal.lib.Constants;
26+
import io.literal.lib.ContentResolverLib;
27+
import io.literal.lib.FileActivityResultCallback;
1928
import io.literal.lib.WebRoutes;
2029
import io.literal.ui.view.WebView;
2130

2231
public class MainActivity extends AppCompatActivity {
2332

2433
private WebView webView;
34+
private ActivityResultLauncher<String> getFileContent;
35+
36+
private FileActivityResultCallback fileActivityResultCallback = new FileActivityResultCallback();
2537

2638
@Override
2739
protected void onCreate(Bundle savedInstanceState) {
2840
super.onCreate(savedInstanceState);
2941
setContentView(R.layout.activity_main);
3042

43+
getFileContent = registerForActivityResult(new ActivityResultContracts.GetContent(), fileActivityResultCallback);
44+
3145
this.webView = findViewById(R.id.webview);
3246
ViewGroup splash = findViewById(R.id.splash);
3347
ViewGroup layout = (ViewGroup) splash.getParent();
@@ -41,6 +55,25 @@ public void onPageFinished(android.webkit.WebView view, String Url) {
4155
}
4256
});
4357

58+
this.webView.setWebChromeClient(new WebChromeClient() {
59+
@Override
60+
public boolean onShowFileChooser(android.webkit.WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
61+
fileActivityResultCallback.setFilePathCallback(new ValueCallback<Uri[]>() {
62+
@Override
63+
public void onReceiveValue(Uri[] value) {
64+
Uri[] absoluteUrls = new Uri[value.length];
65+
for (int idx = 0; idx < value.length; idx++) {
66+
File file = ContentResolverLib.toFile(MainActivity.this, value[idx], UUID.randomUUID().toString());
67+
absoluteUrls[idx] = Uri.fromFile(file);
68+
}
69+
filePathCallback.onReceiveValue(absoluteUrls);
70+
}
71+
});
72+
getFileContent.launch("image/*");
73+
return true;
74+
}
75+
});
76+
4477
AWSMobileClientFactory.initializeClient(this, new Callback<UserStateDetails>() {
4578
@Override
4679
public void onResult(UserStateDetails result) {

0 commit comments

Comments
 (0)