Skip to content

Commit 9fb4350

Browse files
authored
fix: resolve issues in v1.0.0-alpha.2 (#11)
* fix: android tag editor * Fix: - Tags in Containers_NoteEditor_Base sort by createdAt asc - Containers_NoteEditor_new, Containers_NoteEditor_NewFromShare check for tag existence before creating * wip: scaffolding new from share loader * feat: show android splash while webview initializes * feat: support text editor loading in notes * fix: timeout query polling after 20s * - In NewHighlightFromShare, re-query in Android so that we display the final highlight text - In NewHighlightFromShare, only display a notification is a highlight was created - Refactor ShareHandler to use asyncronous GraphQL operations * chore: add unparsable image * feat: error handling for NewNoteFromShare * chore: make sure NewFromShare active is set
1 parent 64551e7 commit 9fb4350

File tree

43 files changed

+1005
-473
lines changed

Some content is hidden

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

43 files changed

+1005
-473
lines changed

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

+16-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
import androidx.appcompat.app.AppCompatActivity;
88

99
import android.content.Intent;
10+
import android.graphics.Color;
1011
import android.net.Uri;
1112
import android.os.Bundle;
13+
import android.view.View;
14+
import android.view.ViewGroup;
1215

1316
import io.literal.ui.view.WebView;
1417

@@ -23,9 +26,21 @@ protected void onCreate(Bundle savedInstanceState) {
2326
super.onCreate(savedInstanceState);
2427
setContentView(R.layout.activity_main);
2528

29+
this.webView = findViewById(R.id.webview);
30+
ViewGroup splash = findViewById(R.id.splash);
31+
ViewGroup layout = (ViewGroup) splash.getParent();
32+
33+
this.webView.setVisibility(View.INVISIBLE);
34+
this.webView.onPageFinished(new WebView.PageFinishedCallback() {
35+
@Override
36+
public void onPageFinished(android.webkit.WebView view, String Url) {
37+
view.setVisibility(View.VISIBLE);
38+
layout.removeView(splash);
39+
}
40+
});
41+
2642
AWSMobileClientFactory.initializeClient(this);
2743

28-
this.webView = findViewById(R.id.webview);
2944
this.webView.initialize(this);
3045
this.webView.requestFocus();
3146

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

+211-193
Large diffs are not rendered by default.

packages/android/app/src/main/java/io/literal/ui/view/WebView.java

+12
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
public class WebView extends android.webkit.WebView {
3838

3939
private WebEvent.Callback webEventCallback;
40+
private PageFinishedCallback pageFinishedCallback;
4041
private ArrayDeque<String> baseHistory;
4142

4243
public WebView(Context context) {
@@ -62,6 +63,9 @@ public void initialize(Activity activity) {
6263
@Override
6364
public void onPageFinished(android.webkit.WebView webview, String url) {
6465
initializeWebMessageChannel();
66+
if (WebView.this.pageFinishedCallback != null) {
67+
pageFinishedCallback.onPageFinished(webview, url);
68+
}
6569
}
6670
});
6771
}
@@ -83,6 +87,10 @@ public void onWebEvent(WebEvent.Callback cb) {
8387
this.webEventCallback = cb;
8488
}
8589

90+
public void onPageFinished(PageFinishedCallback cb) {
91+
this.pageFinishedCallback = cb;
92+
}
93+
8694
public void loadUrlWithHistory(String url, String[] history) {
8795
this.baseHistory = new ArrayDeque<>(Arrays.asList(history));
8896
this.loadUrl(url);
@@ -160,4 +168,8 @@ private class JavascriptInterface {
160168
@android.webkit.JavascriptInterface
161169
public boolean isWebview() { return true; }
162170
}
171+
172+
public interface PageFinishedCallback {
173+
public void onPageFinished(android.webkit.WebView view, String Url);
174+
}
163175
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<io.literal.ui.view.WebView xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:id="@+id/webview"
2+
<RelativeLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
44
android:layout_width="match_parent"
5-
android:layout_height="match_parent"
6-
android:focusable="true" />
5+
android:layout_height="match_parent">
6+
<io.literal.ui.view.WebView xmlns:android="http://schemas.android.com/apk/res/android"
7+
android:id="@+id/webview"
8+
android:layout_alignParentBottom="true"
9+
android:layout_alignParentTop="true"
10+
android:layout_alignParentRight="true"
11+
android:layout_alignParentLeft="true"
12+
android:layout_width="match_parent"
13+
android:layout_height="match_parent"
14+
android:focusable="true" />
15+
<RelativeLayout
16+
android:id="@+id/splash"
17+
android:layout_width="wrap_content"
18+
android:layout_height="wrap_content"
19+
android:layout_alignParentLeft="true"
20+
android:layout_alignParentRight="true"
21+
android:layout_alignParentBottom="true"
22+
android:layout_alignParentTop="true"
23+
android:background="@color/colorPrimaryDark">
24+
<ImageView
25+
android:layout_width="142dp"
26+
android:layout_height="142dp"
27+
android:layout_centerInParent="true"
28+
android:src="@drawable/ic_logo"/>
29+
</RelativeLayout>
30+
</RelativeLayout>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<io.literal.ui.view.WebView xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:id="@+id/webview"
2+
<RelativeLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
44
android:layout_width="match_parent"
5-
android:layout_height="match_parent"/>
5+
android:layout_height="match_parent">
6+
<io.literal.ui.view.WebView xmlns:android="http://schemas.android.com/apk/res/android"
7+
android:id="@+id/webview"
8+
android:layout_alignParentBottom="true"
9+
android:layout_alignParentTop="true"
10+
android:layout_alignParentRight="true"
11+
android:layout_alignParentLeft="true"
12+
android:layout_width="match_parent"
13+
android:layout_height="match_parent"
14+
android:focusable="true" />
15+
<RelativeLayout
16+
android:id="@+id/splash"
17+
android:layout_width="wrap_content"
18+
android:layout_height="wrap_content"
19+
android:layout_alignParentLeft="true"
20+
android:layout_alignParentRight="true"
21+
android:layout_alignParentBottom="true"
22+
android:layout_alignParentTop="true"
23+
android:background="@color/colorPrimaryDark">
24+
<ImageView
25+
android:layout_width="142dp"
26+
android:layout_height="142dp"
27+
android:layout_centerInParent="true"
28+
android:src="@drawable/ic_logo"/>
29+
</RelativeLayout>
30+
</RelativeLayout>

packages/backend/amplify/backend/function/CloudfrontOriginRequest/CloudfrontOriginRequest-cloudformation-template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"Timeout": "25",
5757
"Code": {
5858
"S3Bucket": "amplify-literal-production-114446-deployment",
59-
"S3Key": "amplify-builds/CloudfrontOriginRequest-443859414f546d7a4945-build.zip"
59+
"S3Key": "amplify-builds/CloudfrontOriginRequest-676c626f42616755514b-build.zip"
6060
}
6161
}
6262
},

packages/backend/amplify/backend/function/DynamoDBStream/DynamoDBStream-cloudformation-template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"Timeout": "25",
9292
"Code": {
9393
"S3Bucket": "amplify-literal-production-114446-deployment",
94-
"S3Key": "amplify-builds/DynamoDBStream-50396d766a4c57456742-build.zip"
94+
"S3Key": "amplify-builds/DynamoDBStream-54323035534d32743752-build.zip"
9595
}
9696
}
9797
},

packages/backend/amplify/backend/function/GraphQLResolver/GraphQLResolver-cloudformation-template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"Timeout": "25",
9494
"Code": {
9595
"S3Bucket": "amplify-literal-production-114446-deployment",
96-
"S3Key": "amplify-builds/GraphQLResolver-334a48777167514d3053-build.zip"
96+
"S3Key": "amplify-builds/GraphQLResolver-373669724b2f334b334d-build.zip"
9797
},
9898
"Layers": [
9999
{

packages/backend/amplify/backend/function/GraphQLResolver/src/graphql-schema.json

+17-17
Original file line numberDiff line numberDiff line change
@@ -5483,6 +5483,23 @@
54835483
"onOperation" : false,
54845484
"onFragment" : false,
54855485
"onField" : false
5486+
}, {
5487+
"name" : "deprecated",
5488+
"description" : null,
5489+
"locations" : [ "FIELD_DEFINITION", "ENUM_VALUE" ],
5490+
"args" : [ {
5491+
"name" : "reason",
5492+
"description" : null,
5493+
"type" : {
5494+
"kind" : "SCALAR",
5495+
"name" : "String",
5496+
"ofType" : null
5497+
},
5498+
"defaultValue" : "\"No longer supported\""
5499+
} ],
5500+
"onOperation" : false,
5501+
"onFragment" : false,
5502+
"onField" : false
54865503
}, {
54875504
"name" : "aws_subscribe",
54885505
"description" : "Tells the service which mutation triggers this subscription.",
@@ -5554,23 +5571,6 @@
55545571
"onOperation" : false,
55555572
"onFragment" : false,
55565573
"onField" : false
5557-
}, {
5558-
"name" : "deprecated",
5559-
"description" : null,
5560-
"locations" : [ "FIELD_DEFINITION", "ENUM_VALUE" ],
5561-
"args" : [ {
5562-
"name" : "reason",
5563-
"description" : null,
5564-
"type" : {
5565-
"kind" : "SCALAR",
5566-
"name" : "String",
5567-
"ofType" : null
5568-
},
5569-
"defaultValue" : "\"No longer supported\""
5570-
} ],
5571-
"onOperation" : false,
5572-
"onFragment" : false,
5573-
"onField" : false
55745574
}, {
55755575
"name" : "aws_auth",
55765576
"description" : "Directs the schema to enforce authorization on a field",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"typeName": "Mutation",
3+
"fieldName": "createHighlightFromScreenshot",
4+
"arguments": {
5+
"input": {
6+
"id": "1f908168-039b-41d6-99e3-1b3cd84c3a03",
7+
"screenshotId": "8598b434-c0c6-4e04-a50d-be89ee980861",
8+
"owner": "Google_106232639134000095801"
9+
}
10+
},
11+
"identity": {
12+
"claims": {
13+
"at_hash": "xZimWcmquekihw3RPPUv0Q",
14+
"sub": "829159d0-02b7-4968-adbb-11c6945cb891",
15+
"cognito:groups": ["us-east-1_EWCESLVzL_Google"],
16+
"email_verified": false,
17+
"iss": "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_EWCESLVzL",
18+
"cognito:username": "Google_106232639134000095801",
19+
"aud": "1geu7qgt6hdrs4a3e9tn4leg1",
20+
"identities": [
21+
{
22+
"dateCreated": "1589287884187",
23+
"userId": "106232639134000095801",
24+
"providerName": "Google",
25+
"providerType": "Google",
26+
"issuer": null,
27+
"primary": "true"
28+
}
29+
],
30+
"token_use": "id",
31+
"auth_time": 1593002594,
32+
"exp": 1593181034,
33+
"iat": 1593177434,
34+
"email": "[email protected]"
35+
},
36+
"defaultAuthStrategy": "ALLOW",
37+
"groups": ["us-east-1_EWCESLVzL_Google"],
38+
"issuer": "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_EWCESLVzL",
39+
"sourceIp": ["209.107.191.179"],
40+
"sub": "829159d0-02b7-4968-adbb-11c6945cb891",
41+
"username": "Google_106232639134000095801"
42+
},
43+
"source": null,
44+
"request": {
45+
"headers": {
46+
"x-forwarded-for": "209.107.191.179, 130.176.98.89",
47+
"accept-encoding": "gzip",
48+
"cloudfront-viewer-country": "US",
49+
"cloudfront-is-tablet-viewer": "false",
50+
"x-apollo-operation-id": "74d9da651cc99640c7e3690ebdf08e86f53755ee3d948eed203c39dce8cbf032",
51+
"via": "2.0 157ebd6865840045fc8b5ed1cce7e466.cloudfront.net (CloudFront)",
52+
"cloudfront-forwarded-proto": "https",
53+
"content-type": "application/json",
54+
"x-amzn-trace-id": "Root=1-5ef5f57c-46a05afe730e729286a980e3",
55+
"x-amz-cf-id": "2IdbU2ckJCnJJunqA1bw8iBlHah2a8FEhPfGyjmOHtazGa1-kRg5Eg==",
56+
"authorization": "eyJraWQiOiJkenFUd3NjTjZGckpPYjZWUCtqc2ZySDhvMWhDWXJkb3FDODVCTzg5aVZBPSIsImFsZyI6IlJTMjU2In0.eyJhdF9oYXNoIjoieFppbVdjbXF1ZWtpaHczUlBQVXYwUSIsInN1YiI6IjgyOTE1OWQwLTAyYjctNDk2OC1hZGJiLTExYzY5NDVjYjg5MSIsImNvZ25pdG86Z3JvdXBzIjpbInVzLWVhc3QtMV9FV0NFU0xWekxfR29vZ2xlIl0sImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfRVdDRVNMVnpMIiwiY29nbml0bzp1c2VybmFtZSI6Ikdvb2dsZV8xMDYyMzI2MzkxMzQwMDAwOTU4MDEiLCJhdWQiOiIxZ2V1N3FndDZoZHJzNGEzZTl0bjRsZWcxIiwiaWRlbnRpdGllcyI6W3sidXNlcklkIjoiMTA2MjMyNjM5MTM0MDAwMDk1ODAxIiwicHJvdmlkZXJOYW1lIjoiR29vZ2xlIiwicHJvdmlkZXJUeXBlIjoiR29vZ2xlIiwiaXNzdWVyIjpudWxsLCJwcmltYXJ5IjoidHJ1ZSIsImRhdGVDcmVhdGVkIjoiMTU4OTI4Nzg4NDE4NyJ9XSwidG9rZW5fdXNlIjoiaWQiLCJhdXRoX3RpbWUiOjE1OTMwMDI1OTQsImV4cCI6MTU5MzE4MTAzNCwiaWF0IjoxNTkzMTc3NDM0LCJlbWFpbCI6ImphdmFtb25uQGdtYWlsLmNvbSJ9.iZHCDmcaE28019R_BBn2SyZ68VpP0sErn0VjefnYVYtltFithz_XEmWg8T32ZUjA356nIKHJmOVbWcZzf8tVxxA-KwSRAKYMTDXcTUIK6ogKYrnQTcbyZAHoqpkWDGi1WnUABkQhW0ECbi7834IaF07L2AgSn0pysANA8m2hlBw1BIxYKLX-vvWuPrnx2gDdn_T2ePlbTXfZW-0fn9SYu-V3n3Lb7K3ibb5auXvwJFS4dfNG2qq82ltEyZpoidREFkUPAJZun_pa6z-ceTZ89FmuRpcYPi_SpgR1HiLF6SFjuz-NLpegorExhPJQxWHu7WTH2AYIFHUWXYSmmihvLg",
57+
"content-length": "485",
58+
"x-forwarded-proto": "https",
59+
"host": "2dxxqoarong2jd4ukbeugsg5t4.appsync-api.us-east-1.amazonaws.com",
60+
"content_type": "application/json",
61+
"user-agent": "aws-sdk-android/2.16.12 Linux/4.9.210-g28c696160049-ab6386370 Dalvik/2.1.0/0 en_US",
62+
"cloudfront-is-desktop-viewer": "false",
63+
"cloudfront-is-mobile-viewer": "true",
64+
"accept": "application/json",
65+
"x-forwarded-port": "443",
66+
"cloudfront-is-smarttv-viewer": "false"
67+
}
68+
},
69+
"prev": {
70+
"result": {}
71+
}
72+
}

packages/backend/amplify/backend/function/GraphQLResolver/src/src/QueryResolver/QueryResolver_CreateHighlightFromScreenshot.re

+7-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,11 @@ let parseTextFromScreenshot = screenshotId => {
165165
->Belt.Array.get(0)
166166
->Belt.Option.map(r =>
167167
Externals_GoogleCloud.Vision.(
168-
r->fullTextAnnotation->text->Js.Promise.resolve
168+
r
169+
->fullTextAnnotation
170+
->text
171+
->Js.String2.replaceByRe([%re "/\\n/g"], " ")
172+
->Js.Promise.resolve
169173
)
170174
)
171175
});
@@ -218,7 +222,7 @@ type argumentsInput = {
218222
[@bs.deriving accessors]
219223
type arguments = {input: argumentsInput};
220224

221-
let resolver = (ctx: Lib_Lambda.event) =>
225+
let resolver = (ctx: Lib_Lambda.event) => {
222226
switch (ctx.arguments->arguments_decode->Belt.Result.map(input)) {
223227
| Belt.Result.Ok(input) =>
224228
input.screenshotId
@@ -244,3 +248,4 @@ let resolver = (ctx: Lib_Lambda.event) =>
244248
Js.log2("Unable to decode arguments", e);
245249
Js.Promise.resolve(None);
246250
};
251+
};

packages/backend/amplify/backend/function/GraphQLResolver/src/src/Service/Service_HighlightBoundingBoxDetector.re

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type prediction = {
5050
let sizeX = 512;
5151
let sizeY = 512;
5252

53-
let request = r =>
53+
let request = r => {
5454
Fetch.(
5555
fetchWithInit(
5656
Lib_Constants.Env.highlightBoundingBoxDetectorAPI,
@@ -102,3 +102,4 @@ let request = r =>
102102
Js.Promise.resolve(None);
103103
}
104104
});
105+
};

packages/backend/amplify/backend/function/PostAuthentication/PostAuthentication-cloudformation-template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"Timeout": "25",
6464
"Code": {
6565
"S3Bucket": "amplify-literal-production-114446-deployment",
66-
"S3Key": "amplify-builds/PostAuthentication-587256476d6b4e457a38-build.zip"
66+
"S3Key": "amplify-builds/PostAuthentication-6939503933796b544131-build.zip"
6767
}
6868
}
6969
},

packages/backend/amplify/backend/function/PostAuthentication/src/graphql-schema.json

+17-17
Original file line numberDiff line numberDiff line change
@@ -5483,6 +5483,23 @@
54835483
"onOperation" : false,
54845484
"onFragment" : false,
54855485
"onField" : false
5486+
}, {
5487+
"name" : "deprecated",
5488+
"description" : null,
5489+
"locations" : [ "FIELD_DEFINITION", "ENUM_VALUE" ],
5490+
"args" : [ {
5491+
"name" : "reason",
5492+
"description" : null,
5493+
"type" : {
5494+
"kind" : "SCALAR",
5495+
"name" : "String",
5496+
"ofType" : null
5497+
},
5498+
"defaultValue" : "\"No longer supported\""
5499+
} ],
5500+
"onOperation" : false,
5501+
"onFragment" : false,
5502+
"onField" : false
54865503
}, {
54875504
"name" : "aws_subscribe",
54885505
"description" : "Tells the service which mutation triggers this subscription.",
@@ -5525,23 +5542,6 @@
55255542
"onOperation" : false,
55265543
"onFragment" : false,
55275544
"onField" : false
5528-
}, {
5529-
"name" : "deprecated",
5530-
"description" : null,
5531-
"locations" : [ "FIELD_DEFINITION", "ENUM_VALUE" ],
5532-
"args" : [ {
5533-
"name" : "reason",
5534-
"description" : null,
5535-
"type" : {
5536-
"kind" : "SCALAR",
5537-
"name" : "String",
5538-
"ofType" : null
5539-
},
5540-
"defaultValue" : "\"No longer supported\""
5541-
} ],
5542-
"onOperation" : false,
5543-
"onFragment" : false,
5544-
"onField" : false
55455545
}, {
55465546
"name" : "aws_publish",
55475547
"description" : "Tells the service which subscriptions will be published to when this mutation is called. This directive is deprecated use @aws_susbscribe directive instead.",

0 commit comments

Comments
 (0)