From ff26d3666e28c47d8764c621a29116054fdc4d2a Mon Sep 17 00:00:00 2001 From: Fynn Petersen-Frey <10599762+fyfrey@users.noreply.github.com> Date: Thu, 29 Jun 2023 21:35:29 +0200 Subject: [PATCH] fix(mobile): set scrolling state only if changed (#3034) * fix(mobile): set scrolling state only if changed * fix: generate api --------- Co-authored-by: Alex Tran --- .../ui/asset_grid/immich_asset_grid_view.dart | 8 +++++++- .../lib/model/admin_signup_response_dto.dart | Bin 3851 -> 3852 bytes .../openapi/lib/model/album_response_dto.dart | Bin 6572 -> 6575 bytes .../lib/model/api_key_response_dto.dart | Bin 3522 -> 3524 bytes .../openapi/lib/model/asset_response_dto.dart | Bin 9688 -> 9691 bytes .../openapi/lib/model/exif_response_dto.dart | Bin 9957 -> 9917 bytes .../openapi/lib/model/import_asset_dto.dart | Bin 7610 -> 7612 bytes .../lib/model/shared_link_create_dto.dart | Bin 5714 -> 5715 bytes .../lib/model/shared_link_edit_dto.dart | Bin 5823 -> 5824 bytes .../lib/model/shared_link_response_dto.dart | Bin 6261 -> 6263 bytes .../openapi/lib/model/user_response_dto.dart | Bin 6437 -> 6440 bytes .../native/native_class.mustache | 12 ++++++------ 12 files changed, 13 insertions(+), 7 deletions(-) diff --git a/mobile/lib/modules/home/ui/asset_grid/immich_asset_grid_view.dart b/mobile/lib/modules/home/ui/asset_grid/immich_asset_grid_view.dart index 30a7de6691..fb7c9ddc0f 100644 --- a/mobile/lib/modules/home/ui/asset_grid/immich_asset_grid_view.dart +++ b/mobile/lib/modules/home/ui/asset_grid/immich_asset_grid_view.dart @@ -311,7 +311,13 @@ class ImmichAssetGridViewState extends State { Widget _buildAssetGrid() { final useDragScrolling = widget.renderList.totalAssets >= 20; - void dragScrolling(bool active) => _scrolling = active; + void dragScrolling(bool active) { + if (active != _scrolling) { + setState(() { + _scrolling = active; + }); + } + } final listWidget = ScrollablePositionedList.builder( padding: const EdgeInsets.only( diff --git a/mobile/openapi/lib/model/admin_signup_response_dto.dart b/mobile/openapi/lib/model/admin_signup_response_dto.dart index 70162665a32a9d1415981f2954ddb0648e945cdd..6eabcd7c36ad4f09d23607640fc083e816aa280d 100644 GIT binary patch delta 14 VcmeB{>yg_qm4mTp^Hh#9HUK8|1mFMw delta 12 TcmeB?>z3Ovm1FZXjxsg?9|i<& diff --git a/mobile/openapi/lib/model/album_response_dto.dart b/mobile/openapi/lib/model/album_response_dto.dart index 3c2df247a4f9ce4b39f80e44bc7c59ea191378a5..dc76a6705454cd839b9db2e6222f2c2bddbb1867 100644 GIT binary patch delta 27 hcmZ2uyxw?&ydY!IWO+eL#-hy;f@>Lp6sz!ZHUN7c2sr=% delta 21 dcmZ2)yvBHgyx?R7LCeiif@>K!a|kbI0{~L%2Ic?& diff --git a/mobile/openapi/lib/model/api_key_response_dto.dart b/mobile/openapi/lib/model/api_key_response_dto.dart index 2125d92c23ba3f206d80e0ee0f035fdf26bdcbe0..5aa143414dffd8fdded93bb14ede586e314ea6cf 100644 GIT binary patch delta 20 bcmX>keMEXg7&~LpieMovk82jXKcFWBZ*^Su%HO2*a diff --git a/mobile/openapi/lib/model/asset_response_dto.dart b/mobile/openapi/lib/model/asset_response_dto.dart index c068b61ebe71031f939f7aa50b450a43c90a08ca..cd74d57214606951cd9d6b5141dc12dd44e7f72a 100644 GIT binary patch delta 26 gcmccNecOA(erd*{$@`_9fh3cRC1cTMYni#60F%`TcK`qY delta 20 ccmccZeZzahe(A{vq@5?T$XIT+lbOp20AxrABme*a diff --git a/mobile/openapi/lib/model/exif_response_dto.dart b/mobile/openapi/lib/model/exif_response_dto.dart index 201c13d6e62a7016cca339779289625020a05e4b..8af6e8f09b835b446f9fdba62f6d79d5e5f6c8a9 100644 GIT binary patch delta 168 zcmaFryVrNaJZWZimFmg<0^&@y>XQ#hXMnl7f)XIEw@f=@(d0`qRzQ+R_L?YAWma*1 zUUZRqnqO&dQfiTUEKt>7*#xjA1yK=@rW&~bL4?B0;(V~8$8z(<5TZGWC7C6qDXCzo UdGayhNK*NE>2SHt;tJ>30Fc-@b^rhX delta 203 zcmdn%`_y;CJn6{`rNz1RO7eqCiZb)kH8dyhlFpc{D=2{?W-rq|`M8YLWG2~b(pkm% zdC^7cX?~@-NvTEZvB-Mg$|g)!5EVhunN^Ay6 delta 16 XcmdmEy~}!otk`5ZG3U)mVo~e>H5LVC diff --git a/mobile/openapi/lib/model/shared_link_create_dto.dart b/mobile/openapi/lib/model/shared_link_create_dto.dart index cdd481c84b3591ddc8b03fe0525a6358f562b81c..8c699424dda551c5efb5c2610d15eb78a4ef5600 100644 GIT binary patch delta 14 Vcmcblb6ICY96w{x<~aT@Yyd6!1*iZ3 delta 12 Tcmcbtb4h1I9RKEc{x56*B^CuX diff --git a/mobile/openapi/lib/model/shared_link_edit_dto.dart b/mobile/openapi/lib/model/shared_link_edit_dto.dart index a427b60ef02b34d8b8150e700b485610593f79e5..d5693058c6198272a4a4f457a6c24ed9491eecc9 100644 GIT binary patch delta 14 Vcmdn5dq8&sivVNMW)^|nYyc-J1epK; delta 12 TcmX@0yI*$$i@;`9f!%BXA3+2s diff --git a/mobile/openapi/lib/model/shared_link_response_dto.dart b/mobile/openapi/lib/model/shared_link_response_dto.dart index fad2b4383df7f16297e7423f8c463f438e5f35aa..9e40fd29a6d7c93c3caefb8ae8969a10248bcb77 100644 GIT binary patch delta 20 bcmexr@ZDg8kpN@SWFrAf#-h#H0$dybQcwnS delta 16 Xcmexv@YP_0k-%hQ0n5#~0$dybJ2VB5 diff --git a/mobile/openapi/lib/model/user_response_dto.dart b/mobile/openapi/lib/model/user_response_dto.dart index dcf7e928b53c831995d58cd031e568909e9d1ac6..29fd788f53c08b5fa8ccbec564fd8b68048b19e5 100644 GIT binary patch delta 26 gcmZ2#w8Ch^8bQXQ$!i2Hf#g#`3&x_&vO*l}0EagSvj6}9 delta 20 ccmZ2swA5(B8o|kH1uZ8(7qr-{AjH8A09w`uU;qFB diff --git a/server/openapi-generator/templates/mobile/serialization/native/native_class.mustache b/server/openapi-generator/templates/mobile/serialization/native/native_class.mustache index c6a96f29e0..c66528c3f5 100644 --- a/server/openapi-generator/templates/mobile/serialization/native/native_class.mustache +++ b/server/openapi-generator/templates/mobile/serialization/native/native_class.mustache @@ -66,7 +66,7 @@ class {{{classname}}} { {{/isNullable}} {{#isDateTime}} {{#pattern}} - json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}' + json[r'{{{baseName}}}'] = _isEpochMarker(r'{{{pattern}}}') ? this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch : this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String(); {{/pattern}} @@ -76,7 +76,7 @@ class {{{classname}}} { {{/isDateTime}} {{#isDate}} {{#pattern}} - json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}' + json[r'{{{baseName}}}'] = _isEpochMarker(r'{{{pattern}}}') ? this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch : _dateFormatter.format(this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc()); {{/pattern}} @@ -117,10 +117,10 @@ class {{{classname}}} { return {{{classname}}}( {{#vars}} {{#isDateTime}} - {{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, + {{{name}}}: mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{/isDateTime}} {{#isDate}} - {{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, + {{{name}}}: mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, {{/isDate}} {{^isDateTime}} {{^isDate}} @@ -200,9 +200,9 @@ class {{{classname}}} { {{/isMap}} {{^isMap}} {{#isNumber}} - {{{name}}}: json[r'{{{baseName}}}'] == null + {{{name}}}: {{#isNullable}}json[r'{{{baseName}}}'] == null ? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} - : {{{datatypeWithEnum}}}.parse(json[r'{{{baseName}}}'].toString()), + : {{/isNullable}}{{{datatypeWithEnum}}}.parse('${json[r'{{{baseName}}}']}'), {{/isNumber}} {{^isNumber}} {{^isEnum}}