diff --git a/.gitignore b/.gitignore index 0418c9d7f..35282800f 100644 --- a/.gitignore +++ b/.gitignore @@ -96,3 +96,25 @@ pubspec.yaml /windows/runner/main.cpp /windows/CMakeLists.txt /windows/runner/resources/app_icon.ico + +# FVM Version Cache +.fvm/ + +android/app/src/main/jniLibs/arm64-v8a/libwownero_wallet2_api_c.so +android/app/src/main/jniLibs/arm64-v8a/libmonero_wallet2_api_c.so +android/app/src/main/jniLibs/armeabi-v7a/libmonero_wallet2_api_c.so +android/app/src/main/jniLibs/armeabi-v7a/libwownero_wallet2_api_c.so +android/app/src/main/jniLibs/x86_64/libmonero_wallet2_api_c.so +android/app/src/main/jniLibs/x86_64/libwownero_wallet2_api_c.so +macos/monero_wallet2_api_c.dylib +macos/wownero_wallet2_api_c.dylib +/macos/monero_libwallet2_api_c.dylib +/macos/wownero_libwallet2_api_c.dylib +/ios/monero_libwallet2_api_c.dylib +/ios/wownero_libwallet2_api_c.dylib +/android/app/src/main/jniLibs/arm64-v8a/libmonero_libwallet2_api_c.so +/android/app/src/main/jniLibs/armeabi-v7a/libmonero_libwallet2_api_c.so +/android/app/src/main/jniLibs/x86_64/libmonero_libwallet2_api_c.so +/android/app/src/main/jniLibs/arm64-v8a/libwownero_libwallet2_api_c.so +/android/app/src/main/jniLibs/armeabi-v7a/libwownero_libwallet2_api_c.so +/android/app/src/main/jniLibs/x86_64/libwownero_libwallet2_api_c.so diff --git a/android/app/src/main/jniLibs/arm64-v8a/.gitkeep b/android/app/src/main/jniLibs/arm64-v8a/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/android/app/src/main/jniLibs/armeabi-v7a/.gitkeep b/android/app/src/main/jniLibs/armeabi-v7a/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/android/app/src/main/jniLibs/x86_64/.gitkeep b/android/app/src/main/jniLibs/x86_64/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/asset_sources/bundled_themes/stack_duo/light.zip b/asset_sources/default_themes/campfire/light.zip similarity index 100% rename from asset_sources/bundled_themes/stack_duo/light.zip rename to asset_sources/default_themes/campfire/light.zip diff --git a/asset_sources/bundled_themes/stack_duo/dark.zip b/asset_sources/default_themes/stack_duo/dark.zip similarity index 100% rename from asset_sources/bundled_themes/stack_duo/dark.zip rename to asset_sources/default_themes/stack_duo/dark.zip diff --git a/asset_sources/bundled_themes/stack_wallet/light.zip b/asset_sources/default_themes/stack_duo/light.zip similarity index 100% rename from asset_sources/bundled_themes/stack_wallet/light.zip rename to asset_sources/default_themes/stack_duo/light.zip diff --git a/asset_sources/bundled_themes/stack_wallet/dark.zip b/asset_sources/default_themes/stack_wallet/dark.zip similarity index 100% rename from asset_sources/bundled_themes/stack_wallet/dark.zip rename to asset_sources/default_themes/stack_wallet/dark.zip diff --git a/asset_sources/default_themes/stack_wallet/light.zip b/asset_sources/default_themes/stack_wallet/light.zip new file mode 100644 index 000000000..d94ce2ac8 Binary files /dev/null and b/asset_sources/default_themes/stack_wallet/light.zip differ diff --git a/asset_sources/icon/campfire/app_icon_alpha.png b/asset_sources/icon/campfire/app_icon_alpha.png new file mode 100644 index 000000000..ac2c7afeb Binary files /dev/null and b/asset_sources/icon/campfire/app_icon_alpha.png differ diff --git a/asset_sources/icon/campfire/icon.png b/asset_sources/icon/campfire/icon.png new file mode 100644 index 000000000..bea9f072e Binary files /dev/null and b/asset_sources/icon/campfire/icon.png differ diff --git a/asset_sources/icon/campfire/macos-icon.png b/asset_sources/icon/campfire/macos-icon.png new file mode 100644 index 000000000..ac2c7afeb Binary files /dev/null and b/asset_sources/icon/campfire/macos-icon.png differ diff --git a/asset_sources/icon/campfire/splash.png b/asset_sources/icon/campfire/splash.png new file mode 100644 index 000000000..72b1c4a0a Binary files /dev/null and b/asset_sources/icon/campfire/splash.png differ diff --git a/asset_sources/in_app_logo_icons/campfire/campfire-icon_dark.svg b/asset_sources/in_app_logo_icons/campfire/campfire-icon_dark.svg new file mode 100644 index 000000000..e5c58d8ec --- /dev/null +++ b/asset_sources/in_app_logo_icons/campfire/campfire-icon_dark.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/asset_sources/in_app_logo_icons/campfire/campfire-icon_light.svg b/asset_sources/in_app_logo_icons/campfire/campfire-icon_light.svg new file mode 100644 index 000000000..e5c58d8ec --- /dev/null +++ b/asset_sources/in_app_logo_icons/campfire/campfire-icon_light.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/asset_sources/lottie/campfire/arrow_rotate.json b/asset_sources/lottie/campfire/arrow_rotate.json new file mode 100644 index 000000000..c729d2e7a --- /dev/null +++ b/asset_sources/lottie/campfire/arrow_rotate.json @@ -0,0 +1 @@ +{"v":"5.10.2","fr":30,"ip":0,"op":60,"w":30,"h":30,"nm":"arrow-rotate","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"arrow-rotate","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":44,"s":[200]},{"t":60,"s":[360]}],"ix":10},"p":{"a":0,"k":[15,15,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-0.828],[0,0],[3.389,0],[1.441,-4.074],[-0.781,-0.277],[-0.276,0.778],[-3.22,0],[-1.369,-1.823],[0,0],[0,-0.83],[-0.83,0],[0,0],[-0.023,0],[0,0],[0,0.83],[0,0],[0.83,0]],"o":[[0,0],[-1.964,-2.437],[-4.533,0],[-0.276,0.741],[0.781,0.277],[1.031,-2.916],[2.494,0],[0,0],[-0.83,0],[0,0.83],[0,0],[0.023,0],[0,0],[0.83,0],[0,0],[0,-0.828],[-0.83,0]],"v":[[8.25,-8.25],[8.25,-6.497],[-0.042,-10.5],[-9.902,-3.502],[-8.988,-1.584],[-7.073,-2.498],[-0.042,-7.5],[6,-4.5],[4.5,-4.5],[3,-3],[4.5,-1.5],[8.452,-1.5],[8.522,-1.5],[9.75,-1.5],[11.25,-3],[11.25,-8.25],[9.75,-9.75]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[0,0],[-0.828,0],[0,0.83],[0,0],[-3.347,0],[-1.439,4.073],[0.783,0.277],[0.277,-0.778],[3.262,0],[1.411,1.823],[0,0],[0,0.83],[0.83,0],[0,0],[0,-0.83]],"o":[[0,0.83],[0.828,0],[0,0],[1.922,2.438],[4.575,0],[0.277,-0.783],[-0.778,-0.277],[-1.031,2.916],[-2.452,0],[0,0],[0.83,0],[0,-0.83],[0,0],[-0.828,0],[0,0]],"v":[[-11.25,8.25],[-9.75,9.75],[-8.25,8.25],[-8.25,6.497],[0,10.5],[9.9,3.502],[8.986,1.584],[7.073,2.498],[0,7.5],[-6.042,4.5],[-4.5,4.5],[-3,3],[-4.5,1.5],[-9.75,1.5],[-11.25,3]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0.137254908681,0.137254908681,0.137254908681,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Vector","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":60,"st":0,"ct":1,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/asset_sources/lottie/campfire/icon_send.json b/asset_sources/lottie/campfire/icon_send.json new file mode 100644 index 000000000..7dc1f7c2d --- /dev/null +++ b/asset_sources/lottie/campfire/icon_send.json @@ -0,0 +1 @@ +{"v":"5.10.2","fr":30,"ip":0,"op":100,"w":24,"h":24,"nm":"icon-send","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"MASK","td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[12,12,0],"ix":2,"l":2},"a":{"a":0,"k":[0.125,0.125,0],"ix":1,"l":2},"s":{"a":0,"k":[87.368,87.368,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[23.75,23.75],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0.125,0.125],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":100,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Arrow","tt":1,"tp":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":0,"s":[-1.009,25.009,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":33,"s":[11.695,12.306,0],"to":[0,0,0],"ti":[0,0,0]},{"t":53,"s":[24.398,-0.397,0]}],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,-0.69],[-0.69,0],[0,0],[0,0],[-0.488,-0.488],[-0.488,0.488],[0,0],[0,0],[-0.69,0],[0,0.69],[0,0],[0.234,0.234],[0.332,0]],"o":[[-0.69,0],[0,0.69],[0,0],[0,0],[-0.488,0.488],[0.488,0.488],[0,0],[0,0],[0,0.69],[0.69,0],[0,0],[0,-0.332],[-0.234,-0.234],[0,0]],"v":[[-2,-5.25],[-3.25,-4],[-2,-2.75],[0.982,-2.75],[-4.884,3.116],[-4.884,4.884],[-3.116,4.884],[2.75,-0.982],[2.75,2],[4,3.25],[5.25,2],[5.25,-4],[4.884,-4.884],[4,-5.25]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.137254908681,0.137254908681,0.137254908681,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Vector (Stroke)","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":100,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Outline","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[12,12,0],"ix":2,"l":2},"a":{"a":0,"k":[12,0.063,0],"ix":1,"l":2},"s":{"a":0,"k":[90.104,90.104,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[24,24],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.137254901961,0.137254901961,0.137254901961,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2.5,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[12,0.063],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":58,"s":[0]},{"t":97,"s":[100]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":58,"s":[100]},{"t":97,"s":[100]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":100,"st":0,"ct":1,"bm":0}],"markers":[{"tm":0,"cm":"{\r\n\"name\":\"SEGMENT 1\"\r\n}","dr":0},{"tm":53,"cm":"{\r\n\"name\":\"SEGMENT 2\"\r\n}","dr":0},{"tm":97,"cm":"{\r\n\"name\":\"SEGMENT 3\"\r\n}","dr":0}]} \ No newline at end of file diff --git a/asset_sources/lottie/campfire/loader.json b/asset_sources/lottie/campfire/loader.json new file mode 100644 index 000000000..dae536282 --- /dev/null +++ b/asset_sources/lottie/campfire/loader.json @@ -0,0 +1 @@ +{"v":"5.10.2","fr":30,"ip":0,"op":93,"w":700,"h":700,"nm":"Stack-duo-animation","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":3,"nm":"Null 1","sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":42,"s":[0]},{"t":55,"s":[180]}],"ix":10},"p":{"a":0,"k":[350,350,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"ip":0,"op":101,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"gray ring Outlines","parent":1,"sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":1,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":7,"s":[70]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":79,"s":[70]},{"t":85,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":1,"s":[199,0,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":0.667},"o":{"x":0.333,"y":0.333},"t":27,"s":[-63.24,0,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":0.667},"o":{"x":0.333,"y":0.333},"t":42,"s":[-63.24,0,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":0.667},"o":{"x":0.333,"y":0.333},"t":55,"s":[-63.24,0,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0.333},"t":61,"s":[-63.24,0,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"t":65,"s":[-63.24,0,0],"to":[0,0,0],"ti":[0,0,0]},{"t":85,"s":[-198.24,0,0]}],"ix":2,"l":2},"a":{"a":0,"k":[128,128,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[0.119,0.119,5.929]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":1,"s":[70,70,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0.233,0.233,-2.61]},"t":18,"s":[80,80,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":27,"s":[100,100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":42,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[1,1,-2.367]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":55,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,7.852]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":56,"s":[100,100,100]},{"t":85,"s":[70,70,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[27.84,-7.24],[5.65,0],[0,35.77],[-35.77,0],[-5.22,-1.37],[0,-30.12]],"o":[[-5.22,1.37],[-35.77,0],[0,-35.77],[5.65,0],[27.84,7.24],[0,30.12]],"v":[[16.36,62.67],[0,64.76],[-64.77,0],[0,-64.76],[16.36,-62.67],[64.76,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[38.26,22.13],[23.31,0],[0,-70.69],[-70.7,0],[-18.83,10.89],[0,47.38]],"o":[[-18.83,-10.89],[-70.7,0],[0,70.69],[23.31,0],[38.26,-22.13],[0,-47.38]],"v":[[63.99,-110.88],[0,-128],[-128,0],[0,128],[63.99,110.88],[128,0]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0.576470588235,0.576470588235,0.576470588235,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[128,128],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":6,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":93,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"black ball Outlines","parent":1,"sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":1,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":7,"s":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":79,"s":[100]},{"t":85,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":1,"s":[-199.4,0,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":0.667},"o":{"x":0.333,"y":0.333},"t":27,"s":[64.76,0,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":0.667},"o":{"x":0.333,"y":0.333},"t":42,"s":[64.76,0,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":0.667},"o":{"x":0.333,"y":0.333},"t":55,"s":[64.76,0,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0.333},"t":61,"s":[64.76,0,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"t":65,"s":[64.76,0,0],"to":[0,0,0],"ti":[0,0,0]},{"t":85,"s":[196.76,0,0]}],"ix":2,"l":2},"a":{"a":0,"k":[128.25,128.25,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":1,"s":[70,70,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":18,"s":[80,80,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":27,"s":[100,100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":42,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[1,1,-2.367]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":55,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,7.852]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":56,"s":[100,100,100]},{"t":85,"s":[70,70,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-70.69],[70.69,0],[18.83,10.89],[11.26,20.03],[0,22.77],[-10.43,18.52],[-19.87,11.49],[-23.31,0]],"o":[[0,70.69],[-23.31,0],[-19.87,-11.49],[-10.43,-18.52],[0,-22.77],[11.26,-20.03],[18.83,-10.89],[70.69,0]],"v":[[128,0],[0,128],[-63.99,110.88],[-111.62,62.67],[-128,0],[-111.62,-62.67],[-63.99,-110.88],[0,-128]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[128.25,128.25],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":93,"st":0,"ct":1,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/asset_sources/lottie/campfire/loader_and_checkmark.json b/asset_sources/lottie/campfire/loader_and_checkmark.json new file mode 100644 index 000000000..406f52030 --- /dev/null +++ b/asset_sources/lottie/campfire/loader_and_checkmark.json @@ -0,0 +1 @@ +{"v":"5.10.2","fr":30,"ip":0,"op":130,"w":24,"h":24,"nm":"Loader","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Arrow","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":115,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":117,"s":[80]},{"t":122,"s":[100]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[12,12,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":117,"s":[30,30,100]},{"t":122,"s":[100,100,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[4.75,-3],[-1.25,3],[-4.75,-0.5]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2.5,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Vector","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":0,"k":100,"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":117,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":119,"s":[30]},{"t":122,"s":[0]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":130,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Fill","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":115,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":117,"s":[30]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":119,"s":[70]},{"t":122,"s":[100]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[12,12,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":117,"s":[241.821,241.821,100]},{"t":122,"s":[1511.821,1511.821,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[24,24],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.647058823529,0.470588235294,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[6.243,6.243],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":130,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Сircle green","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":73,"s":[0]},{"t":74,"s":[100]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[12,12,0],"ix":2,"l":2},"a":{"a":0,"k":[0,-0.063,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.754]},"t":0,"s":[113.562,113.562,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":111,"s":[113.562,113.562,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":115,"s":[90,90,100]},{"t":122,"s":[113.562,113.562,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[19.125,19.125],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0,0.647058823529,0.470588235294,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,-0.063],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":74,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":87,"s":[0]},{"t":111,"s":[0]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":74,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":87,"s":[55]},{"t":111,"s":[100]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[0,0.647058823529,0.470588235294,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false}],"ip":0,"op":130,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Сircle black 2 turn","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":36,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":37,"s":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":74,"s":[100]},{"t":75,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[12,12,0],"ix":2,"l":2},"a":{"a":0,"k":[0,-0.063,0],"ix":1,"l":2},"s":{"a":0,"k":[113.562,113.562,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[19.125,19.125],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.137254901961,0.137254901961,0.137254901961,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,-0.063],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":37,"s":[0.2]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":50,"s":[0.2]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":57,"s":[27.5]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":72,"s":[99]},{"t":74,"s":[100]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":37,"s":[0.1]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":50,"s":[55]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":57,"s":[73]},{"t":74,"s":[100]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[0.137254908681,0.137254908681,0.137254908681,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false}],"ip":0,"op":130,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"Сircle black 1 turn","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":37,"s":[100]},{"t":38,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[12,12,0],"ix":2,"l":2},"a":{"a":0,"k":[0,-0.063,0],"ix":1,"l":2},"s":{"a":0,"k":[113.562,113.562,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[19.125,19.125],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.137254901961,0.137254901961,0.137254901961,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,-0.063],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":13,"s":[0.2]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":20,"s":[27.5]},{"t":37,"s":[100]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":13,"s":[55]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":20,"s":[73]},{"t":37,"s":[99]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[0.137254908681,0.137254908681,0.137254908681,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false}],"ip":0,"op":130,"st":0,"ct":1,"bm":0}],"markers":[{"tm":0,"cm":"{\r\n\"name\":\"marker 1\"\r\n}","dr":0},{"tm":74,"cm":"{\r\n\"name\":\"marker 2\"\r\n}","dr":0},{"tm":130,"cm":"{\r\n\"name\":\"marker 3\"\r\n}","dr":0}]} \ No newline at end of file diff --git a/asset_sources/lottie/campfire/onion_animation.json b/asset_sources/lottie/campfire/onion_animation.json new file mode 100644 index 000000000..9988b5a7c --- /dev/null +++ b/asset_sources/lottie/campfire/onion_animation.json @@ -0,0 +1 @@ +{"v":"5.10.2","fr":25,"ip":0,"op":436,"w":180,"h":180,"nm":"onion-character-animation","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"failed","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[150.3,44.3,0],"ix":2,"l":2},"a":{"a":0,"k":[17.188,17.188,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":393,"s":[0,0,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":408,"s":[100,100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":414,"s":[108,108,100]},{"t":429,"s":[100,100,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-6.919,6.919],[6.919,-6.919]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.878431432387,0.415686304429,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[17.188,17.187],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-6.919,-6.919],[6.919,6.919]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.878431432387,0.415686304429,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[17.188,17.188],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":3,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-8.388,0],[0,-8.388],[8.388,0],[0,8.387]],"o":[[8.388,0],[0,8.387],[-8.388,0],[0,-8.388]],"v":[[0,-15.188],[15.188,0.001],[0,15.188],[-15.188,0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.513725490196,0.513725490196,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[17.188,17.188],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 3","np":3,"cix":2,"bm":0,"ix":3,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"globe","sr":1,"ks":{"o":{"a":1,"k":[{"t":195,"s":[100],"h":1},{"t":213,"s":[0],"h":1},{"t":378,"s":[100],"h":1},{"t":427,"s":[0],"h":1}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[150.25,44.25,0],"ix":2,"l":2},"a":{"a":0,"k":[17.188,17.188,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":32,"s":[0,0,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":47,"s":[100,100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":53,"s":[108,108,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0,0,0]},"t":68,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":328,"s":[100,100,100]},{"t":341,"s":[0,0,100],"h":1},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":378,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":390,"s":[100,100,100]},{"t":427,"s":[0,0,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[2.001,17.795],[32.376,17.795]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[17.33,2],[17.33,32.375]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[-4.233,0],[-1.818,-2.345]],"o":[[1.817,-2.345],[4.233,0],[0,0]],"v":[[-9.721,1.975],[-0.001,-1.975],[9.721,1.975]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[17.188,27.059],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 3","np":2,"cix":2,"bm":0,"ix":3,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[-4.589,0],[-1.622,2.672]],"o":[[1.622,2.672],[4.589,0],[0,0]],"v":[[-10.14,-2.278],[0,2.278],[10.14,-2.278]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[17.188,8.227],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 4","np":2,"cix":2,"bm":0,"ix":4,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-4.026,0],[0,-8.388],[4.026,0],[0,8.387]],"o":[[4.026,0],[0,8.387],[-4.026,0],[0,-8.388]],"v":[[0,-15.188],[7.29,0.001],[0,15.188],[-7.29,0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[17.188,17.188],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 5","np":2,"cix":2,"bm":0,"ix":5,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-8.388,0],[0,-8.388],[8.388,0],[0,8.387]],"o":[[8.388,0],[0,8.387],[-8.388,0],[0,-8.388]],"v":[[0,-15.188],[15.188,0.001],[0,15.188],[-15.188,0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.878431432387,0.415686304429,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[17.188,17.188],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 6","np":3,"cix":2,"bm":0,"ix":6,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"globe 2","sr":1,"ks":{"o":{"a":1,"k":[{"t":195,"s":[0],"h":1},{"t":213,"s":[100],"h":1}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[150.25,44.25,0],"ix":2,"l":2},"a":{"a":0,"k":[17.188,17.188,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":32,"s":[0,0,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":47,"s":[100,100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":53,"s":[108,108,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0,0,0]},"t":68,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":328,"s":[100,100,100]},{"t":341,"s":[0,0,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[2.001,17.795],[32.376,17.795]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[17.33,2],[17.33,32.375]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[-4.233,0],[-1.818,-2.345]],"o":[[1.817,-2.345],[4.233,0],[0,0]],"v":[[-9.721,1.975],[-0.001,-1.975],[9.721,1.975]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[17.188,27.059],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 3","np":2,"cix":2,"bm":0,"ix":3,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[-4.589,0],[-1.622,2.672]],"o":[[1.622,2.672],[4.589,0],[0,0]],"v":[[-10.14,-2.278],[0,2.278],[10.14,-2.278]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[17.188,8.227],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 4","np":2,"cix":2,"bm":0,"ix":4,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-4.026,0],[0,-8.388],[4.026,0],[0,8.387]],"o":[[4.026,0],[0,8.387],[-4.026,0],[0,-8.388]],"v":[[0,-15.188],[7.29,0.001],[0,15.188],[-7.29,0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[17.188,17.188],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 5","np":2,"cix":2,"bm":0,"ix":5,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-8.388,0],[0,-8.388],[8.388,0],[0,8.387]],"o":[[8.388,0],[0,8.387],[-8.388,0],[0,-8.388]],"v":[[0,-15.188],[15.188,0.001],[0,15.188],[-15.188,0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.549019607843,0.901960784314,0.803921568627,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[17.188,17.188],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 6","np":3,"cix":2,"bm":0,"ix":6,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":4,"ty":3,"nm":"null-indicator","sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":38,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":75,"s":[153.988]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":165,"s":[514]},{"t":211,"s":[720],"h":1},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":378,"s":[514]},{"t":424,"s":[720]}],"ix":10},"p":{"a":0,"k":[150.125,44.219,0],"ix":2,"l":2},"a":{"a":0,"k":[60.125,-45.781,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"ip":0,"op":600,"st":0,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"indicator-left ","parent":4,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[50.969,-46.99,0],"ix":2,"l":2},"a":{"a":0,"k":[12.968,22.698,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":40,"s":[0,0,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":45,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":51,"s":[108,108,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":66,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":191,"s":[100,100,100]},{"t":218,"s":[0,0,100],"h":1},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":378,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":385,"s":[100,100,100]},{"t":402,"s":[0,0,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.932,0],[0,-0.931],[0.932,0],[0,0.932]],"o":[[0.932,0],[0,0.932],[-0.932,0],[0,-0.931]],"v":[[0,-1.688],[1.687,-0.001],[0,1.688],[-1.687,-0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.878431432387,0.415686304429,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[22.249,3.688],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,-10.616],[-8.447,-2.437]],"o":[[-10.394,0.857],[0,9.232],[0,0]],"v":[[9.281,-19.82],[-9.281,0.361],[5.343,19.82]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[11.281,23.576],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":6,"ty":4,"nm":"indicator-right ","parent":4,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[69.531,-44.51,0],"ix":2,"l":2},"a":{"a":0,"k":[12.968,22.698,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":40,"s":[0,0,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":45,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":51,"s":[108,108,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":66,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":191,"s":[100,100,100]},{"t":218,"s":[0,0,100],"h":1},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":378,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":385,"s":[100,100,100]},{"t":402,"s":[0,0,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.932,0],[0,-0.931],[0.932,0],[0,0.932]],"o":[[0.932,0],[0,0.932],[-0.932,0],[0,-0.931]],"v":[[0,-1.688],[1.687,-0.001],[0,1.688],[-1.687,-0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.878431432387,0.415686304429,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[3.687,41.708],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,-9.232],[10.395,-0.857]],"o":[[8.447,2.438],[0,10.615],[0,0]],"v":[[-5.344,-19.82],[9.281,-0.361],[-9.281,19.82]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[14.655,21.819],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":7,"ty":4,"nm":"network-small","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":235,"s":[100]},{"t":243,"s":[0],"h":1},{"t":265,"s":[100],"h":1},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":319,"s":[100]},{"t":327,"s":[0],"h":1}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[168.65,44.817,0],"ix":2,"l":2},"a":{"a":0,"k":[3.912,13.78,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":211,"s":[0,0,100]},{"t":222,"s":[100,100,100],"h":1},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":265,"s":[0,0,100]},{"t":276,"s":[100,100,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,-4.365],[2.407,-3.331]],"o":[[2.348,3.306],[0,4.424],[0,0]],"v":[[-1.816,-11.78],[1.913,-0.067],[-1.913,11.78]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[3.913,13.78],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":8,"ty":4,"nm":"network-small","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":235,"s":[100]},{"t":243,"s":[0],"h":1},{"t":265,"s":[100],"h":1},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":319,"s":[100]},{"t":327,"s":[0],"h":1}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[131.975,44.817,0],"ix":2,"l":2},"a":{"a":0,"k":[3.912,13.78,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":211,"s":[0,0,100]},{"t":222,"s":[100,100,100],"h":1},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":265,"s":[0,0,100]},{"t":276,"s":[100,100,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,-4.365],[-2.407,-3.331]],"o":[[-2.348,3.306],[0,4.424],[0,0]],"v":[[1.816,-11.78],[-1.913,-0.067],[1.913,11.78]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[3.912,13.78],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":9,"ty":4,"nm":"network-large","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":246,"s":[100]},{"t":254,"s":[0],"h":1},{"t":276,"s":[100],"h":1},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":308,"s":[100]},{"t":316,"s":[0],"h":1}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[172.999,44.817,0],"ix":2,"l":2},"a":{"a":0,"k":[4.625,17.738,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":222,"s":[0,0,100]},{"t":233,"s":[100,100,100],"h":1},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":276,"s":[0,0,100]},{"t":287,"s":[100,100,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,-5.868],[3.298,-4.406]],"o":[[3.238,4.383],[0,5.927],[0,0]],"v":[[-2.527,-15.738],[2.626,-0.066],[-2.626,15.738]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[4.625,17.737],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":10,"ty":4,"nm":"network-large","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":246,"s":[100]},{"t":254,"s":[0],"h":1},{"t":276,"s":[100],"h":1},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":308,"s":[100]},{"t":316,"s":[0],"h":1}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[127.626,44.817,0],"ix":2,"l":2},"a":{"a":0,"k":[4.625,17.738,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":222,"s":[0,0,100]},{"t":233,"s":[100,100,100],"h":1},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":276,"s":[0,0,100]},{"t":287,"s":[100,100,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,-5.868],[-3.298,-4.406]],"o":[[-3.238,4.383],[0,5.927],[0,0]],"v":[[2.527,-15.738],[-2.626,-0.066],[2.626,15.738]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[4.625,17.737],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":11,"ty":3,"nm":"null-body ","sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":216,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":225,"s":[-10]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":243,"s":[10]},{"t":252,"s":[0]}],"ix":10},"p":{"a":0,"k":[90,101,0],"ix":2,"l":2},"a":{"a":0,"k":[0,11,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"ip":0,"op":600,"st":0,"bm":0},{"ddd":0,"ind":12,"ty":4,"nm":"hand-right ","parent":11,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":15,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":23,"s":[26]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":308,"s":[26]},{"t":317,"s":[0],"h":1},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":378,"s":[26]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":414,"s":[26]},{"t":423,"s":[0]}],"ix":10},"p":{"a":0,"k":[31.615,10.647,0],"ix":2,"l":2},"a":{"a":0,"k":[7.62,2.379,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[-0.469,-0.257],[14.905,-11.105],[-2.867,9.613],[-4.387,7.038]],"o":[[-0.146,-0.515],[4.244,2.323],[0,0],[0,0],[0,0]],"v":[[-6.294,-13.745],[-5.426,-14.434],[-3.238,7.488],[-8.799,5.079],[-3.74,-4.723]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.572549019608,0.478431402468,0.839215746113,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[13.667,16.691],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":13,"ty":4,"nm":"hand-left ","parent":11,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":15,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":23,"s":[-26]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":308,"s":[-26]},{"t":317,"s":[0],"h":1},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":378,"s":[-26]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":414,"s":[-26]},{"t":423,"s":[0]}],"ix":10},"p":{"a":0,"k":[-31.366,10.897,0],"ix":2,"l":2},"a":{"a":0,"k":[19.478,2.629,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0.471,-0.258],[-14.903,-11.103],[2.867,9.613],[4.387,7.037]],"o":[[0.146,-0.516],[-4.246,2.325],[0,0],[0,0],[0,0]],"v":[[6.292,-13.742],[5.421,-14.433],[3.238,7.488],[8.798,5.078],[3.738,-4.722]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.572549019608,0.478431402468,0.839215746113,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[13.665,16.691],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":14,"ty":4,"nm":"eyes ","parent":11,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":0,"s":[0.213,-2.898,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":6,"s":[0.463,3,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":51,"s":[0.463,3,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":58,"s":[0.2,-2.898,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":79,"s":[0.2,-2.9,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":82,"s":[-6.787,-2.898,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":96,"s":[-6.8,-2.899,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":100,"s":[0.2,-2.9,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":133,"s":[0.2,-2.9,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":136,"s":[5,-9.9,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":151,"s":[5,-9.9,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":155,"s":[0.2,-2.9,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":297,"s":[0.213,-2.898,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":303,"s":[0.463,3,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":322,"s":[0.463,3,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":329,"s":[0.2,-2.898,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":408,"s":[0.213,-2.898,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":414,"s":[0.463,3,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":422,"s":[0.463,3,0],"to":[0,0,0],"ti":[0,0,0]},{"t":429,"s":[0.2,-2.898,0]}],"ix":2,"l":2},"a":{"a":0,"k":[17.045,9.606,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[1,0.833,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":19,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":23,"s":[100,7.967,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":37,"s":[100,8,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":40,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":112,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":114,"s":[100,8,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":118,"s":[100,8,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":120,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":169,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":171,"s":[100,8,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":175,"s":[100,8,100]},{"t":178,"s":[100,100,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-4.201],[1.872,0],[0,4.201],[-1.873,0]],"o":[[0,4.201],[-1.873,0],[0,-4.201],[1.872,0]],"v":[[3.391,0],[-0.001,7.606],[-3.391,0],[-0.001,-7.606]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[28.7,9.606],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-4.201],[1.873,0],[0,4.201],[-1.872,0]],"o":[[0,4.201],[-1.872,0],[0,-4.201],[1.873,0]],"v":[[3.391,0],[-0.001,7.606],[-3.391,0],[-0.001,-7.606]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[5.391,9.606],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":3,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":15,"ty":4,"nm":"socket ","parent":11,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":15,"s":[31.022,33.297,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":23,"s":[23,33.297,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":1},"o":{"x":0.167,"y":0.167},"t":308,"s":[23,33.297,0],"to":[0,0,0],"ti":[0,0,0]},{"t":318,"s":[31.022,33.297,0],"h":1},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":378,"s":[23,33.297,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":1},"o":{"x":0.167,"y":0.167},"t":414,"s":[23,33.297,0],"to":[0,0,0],"ti":[0,0,0]},{"t":424,"s":[31.022,33.297,0]}],"ix":2,"l":2},"a":{"a":0,"k":[24.058,14.693,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[-1.1,0],[0,0],[0,-1.1],[0,0],[1.1,0],[0,0],[0,1.1]],"o":[[0,-1.1],[0,0],[1.1,0],[0,0],[0,1.1],[0,0],[-1.1,0],[0,0]],"v":[[-2.435,-7.07],[-0.435,-9.07],[0.435,-9.07],[2.435,-7.07],[2.435,7.07],[0.435,9.07],[-0.435,9.07],[-2.435,7.07]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.964705942191,0.901960844152,0.658823529412,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[4.435,11.07],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,-3.981],[3.98,0],[0,0]],"o":[[0,0],[3.98,0],[0,3.981],[0,0],[0,0]],"v":[[-6.771,-7.208],[-0.438,-7.208],[6.771,0.001],[-0.438,7.208],[-6.771,7.208]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.878431432387,0.415686304429,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[10.534,11.07],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":3,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.696,0.681],[4.036,0.072],[0,0],[-17.923,-16.81],[0.72,-0.711]],"o":[[-13.443,-13.126],[0,0],[0,0],[0.739,0.693],[-0.693,0.685]],"v":[[12.516,9.362],[-15.743,-4.76],[-15.743,-7.963],[15.001,6.767],[15.023,9.345]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.768627510819,0.768627510819,0.768627510819,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[30.373,17.343],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 3","np":3,"cix":2,"bm":0,"ix":3,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":16,"ty":4,"nm":"plug ","parent":11,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":15,"s":[-26.789,33.296,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":23,"s":[-18,33.296,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":1},"o":{"x":0.167,"y":0.167},"t":308,"s":[-18,33.296,0],"to":[0,0,0],"ti":[0,0,0]},{"t":317,"s":[-26.789,33.296,0],"h":1},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":378,"s":[-18,33.296,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":1},"o":{"x":0.167,"y":0.167},"t":414,"s":[-18,33.296,0],"to":[0,0,0],"ti":[0,0,0]},{"t":423,"s":[-26.789,33.296,0]}],"ix":2,"l":2},"a":{"a":0,"k":[27.268,14.693,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[1.1,0],[0,0],[0,1.101],[0,0],[-1.1,0],[0,0],[0,-1.099]],"o":[[0,1.101],[0,0],[-1.1,0],[0,0],[0,-1.099],[0,0],[1.1,0],[0,0]],"v":[[2.435,7.07],[0.435,9.07],[-0.435,9.07],[-2.435,7.07],[-2.435,-7.07],[-0.435,-9.07],[0.435,-9.07],[2.435,-7.07]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.964705942191,0.901960844152,0.658823529412,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[43.486,11.07],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.82,0],[0,0],[0,0],[0,0],[0,-0.821]],"o":[[0,0],[0,0],[0,0],[0.82,0],[0,0.819]],"v":[[3.933,1.484],[-5.417,1.484],[-5.417,-1.484],[3.933,-1.484],[5.417,0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.768627510819,0.768627510819,0.768627510819,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[47.119,14.778],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":3,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.82,0],[0,0],[0,0],[0,0],[0,-0.82]],"o":[[0,0],[0,0],[0,0],[0.82,0],[0,0.819]],"v":[[3.933,1.484],[-5.417,1.484],[-5.417,-1.484],[3.933,-1.484],[5.417,0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.768627510819,0.768627510819,0.768627510819,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[47.119,7.363],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 3","np":3,"cix":2,"bm":0,"ix":3,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,3.981],[-3.981,0],[0,0]],"o":[[0,0],[-3.981,0],[0,-3.981],[0,0],[0,0]],"v":[[6.771,7.208],[0.438,7.208],[-6.771,0.001],[0.438,-7.208],[6.771,-7.208]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.878431432387,0.415686304429,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[37.387,11.07],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 4","np":3,"cix":2,"bm":0,"ix":4,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.696,0.681],[-4.036,0.072],[0,0],[17.924,-16.81],[-0.72,-0.711]],"o":[[13.443,-13.126],[0,0],[0,0],[-0.738,0.693],[0.693,0.685]],"v":[[-12.515,9.362],[15.742,-4.76],[15.742,-7.963],[-15.001,6.767],[-15.022,9.345]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.768627510819,0.768627510819,0.768627510819,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[17.742,17.343],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 5","np":3,"cix":2,"bm":0,"ix":5,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":17,"ty":4,"nm":"body ","parent":11,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[-0.017,-4.078,0],"ix":2,"l":2},"a":{"a":0,"k":[37.53,43.53,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.61,-3.511],[0.08,-0.38],[0.069,-0.28],[0.03,-0.1],[2.54,-3.51],[2.45,-1.981],[0.639,-0.45],[1.029,-0.591],[0.66,-0.32],[0.68,-0.28],[0.861,-0.28],[0.77,-0.189],[0.281,-0.069],[2.509,0],[0,0],[5.781,12],[-2.75,7.73],[-4.95,4.051],[-2.63,2.12],[-1.01,1.029],[-0.29,0.381],[0.06,1.44],[0.179,1.27],[-1,0.109],[-0.39,-0.201],[0,0],[0,0],[0,0],[0,0],[0,0],[-0.13,-0.131],[-0.069,-0.11],[0,-0.411],[0,0],[-0.029,-0.409],[-0.02,-0.199],[-0.02,-0.159],[-0.09,-0.29],[-0.05,-0.14],[-0.04,-0.091],[-0.071,-0.109],[-0.09,-0.111],[-0.031,-0.04],[-0.55,-0.549],[-0.139,-0.141],[-2.41,-1.94],[-4.18,-5.951],[-0.83,-2.4],[-0.071,-0.241],[-0.05,-0.21],[-0.17,-0.9]],"o":[[-0.06,0.38],[-0.059,0.28],[-0.021,0.09],[-1.061,4.23],[-1.861,2.55],[-0.611,0.49],[-0.971,0.68],[-0.641,0.359],[-0.66,0.321],[-0.84,0.34],[-0.759,0.241],[-0.28,0.07],[-2.45,0.531],[0,0],[-13.32,0],[-3.54,-7.34],[2.18,-6.091],[2.62,-2.139],[2.72,-2.19],[0.551,-0.56],[1.03,-1.369],[-0.121,-2.79],[-0.161,-1.17],[0.361,-0.06],[0,0],[0,0],[0,0],[0,0],[0,0],[0.15,0.091],[0.091,0.09],[0.221,0.33],[0,0],[0,0.38],[0.011,0.201],[0.02,0.15],[0.04,0.301],[0.049,0.149],[0.04,0.09],[0.05,0.119],[0.059,0.12],[0.021,0.04],[0.279,0.37],[0.12,0.13],[1.02,0.98],[5.571,4.48],[1.461,2.089],[0.08,0.23],[0.069,0.21],[0.26,0.88],[0.679,3.5]],"v":[[34.92,12.91],[34.7,14.051],[34.511,14.889],[34.441,15.18],[28.941,26.88],[22.441,33.721],[20.561,35.139],[17.561,37.04],[15.62,38.059],[13.62,38.96],[11.07,39.889],[8.78,40.529],[7.95,40.729],[0.481,41.529],[0.45,41.529],[-31.09,21.699],[-32.78,-1.6],[-21.46,-16.561],[-13.44,-22.771],[-8.11,-27.41],[-6.9,-28.79],[-5.809,-33.45],[-6.269,-39.26],[-4.65,-41.469],[-3.51,-41.26],[0.45,-39.191],[0.481,-39.18],[0.481,-39.171],[5,-36.611],[5.71,-36.21],[6.13,-35.889],[6.38,-35.59],[6.721,-34.469],[6.721,-33.43],[6.75,-32.251],[6.8,-31.65],[6.86,-31.191],[7.061,-30.299],[7.21,-29.861],[7.33,-29.579],[7.521,-29.23],[7.74,-28.889],[7.811,-28.771],[9,-27.421],[9.4,-27.01],[14.36,-22.751],[30.3,-8.51],[33.74,-1.73],[33.971,-1.029],[34.16,-0.4],[34.811,2.27]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.572549019608,0.478431402468,0.839215746113,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[37.53,43.53],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":18,"ty":3,"nm":"null-foot-leg-right ","sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":216,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":225,"s":[-16]},{"t":234,"s":[0]}],"ix":10},"p":{"a":0,"k":[104.625,119.5,0],"ix":2,"l":2},"a":{"a":0,"k":[14.625,29.5,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"ip":0,"op":600,"st":0,"bm":0},{"ddd":0,"ind":19,"ty":4,"nm":"foot-right ","parent":18,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":100,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":106,"s":[-16.958]},{"t":112,"s":[0]}],"ix":10},"p":{"a":0,"k":[12.563,62.71,0],"ix":2,"l":2},"a":{"a":0,"k":[3.168,10.693,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-4.229],[0,4.229],[5.063,0]],"o":[[0,4.229],[0,-4.229],[-5.064,0]],"v":[[-9.168,1.714],[9.168,1.714],[0,-5.943]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.572549019608,0.478431402468,0.839215746113,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[11.168,7.944],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":20,"ty":4,"nm":"leg-right ","parent":18,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[14.726,61.506,0],"ix":2,"l":2},"a":{"a":0,"k":[4.042,31.23,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-2.628,14.816],[2.628,14.816],[2.628,-14.816],[-2.628,-14.816]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.572549019608,0.478431402468,0.839215746113,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[4.042,16.23],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":21,"ty":3,"nm":"null-foot-leg-left","sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":234,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":243,"s":[16]},{"t":252,"s":[0]}],"ix":10},"p":{"a":0,"k":[76.125,119.75,0],"ix":2,"l":2},"a":{"a":0,"k":[-13.706,29.818,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"ip":0,"op":600,"st":0,"bm":0},{"ddd":0,"ind":22,"ty":4,"nm":"foot-left ","parent":21,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":115,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":122,"s":[14]},{"t":128,"s":[0]}],"ix":10},"p":{"a":0,"k":[-11.138,62.21,0],"ix":2,"l":2},"a":{"a":0,"k":[19.667,10.193,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-4.229],[0,4.229],[-5.064,0]],"o":[[0,4.229],[0,-4.229],[5.063,0]],"v":[[9.167,1.714],[-9.167,1.714],[0,-5.943]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.572549019608,0.478431402468,0.839215746113,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[11.167,7.944],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":23,"ty":4,"nm":"leg-left ","parent":21,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[-13.8,46.604,0],"ix":2,"l":2},"a":{"a":0,"k":[4.041,16.327,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[2.627,14.913],[-2.627,14.913],[-2.627,-14.913],[2.627,-14.913]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.572549019608,0.478431402468,0.839215746113,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[4.041,16.327],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":24,"ty":4,"nm":"feather-right ","parent":11,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[2.257,-40.214,0],"ix":2,"l":2},"a":{"a":0,"k":[4.979,16.819,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-1.92,-1.305],[-0.994,2.399],[-2.288,2.372],[4.027,-4.656],[0.654,-1.84]],"o":[[0.396,-1.953],[2.156,-5.198],[-2.176,0.596],[-2.233,2.583],[1.92,1.304]],"v":[[-1.844,8.944],[0.169,2.347],[7.605,-8.944],[-3.521,-2.013],[-7.605,5.031]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.549019607843,0.901960844152,0.803921628466,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[9.604,10.944],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":25,"ty":4,"nm":"feather-left ","parent":11,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[-2.563,-41.523,0],"ix":2,"l":2},"a":{"a":0,"k":[9.913,18.048,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[1.773,0.237],[1.134,3.207],[1.239,1.692],[-2.752,-3.696],[0.074,-1.377]],"o":[[-0.114,-2.056],[-1.171,-3.316],[1.418,0.498],[3.356,4.509],[-1.773,-0.236]],"v":[[0.059,7.463],[-1.565,-0.649],[-5.538,-8.173],[2.182,-2.518],[5.378,8.173]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.549019607843,0.901960844152,0.803921628466,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[7.538,10.173],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":26,"ty":4,"nm":"feather-center ","parent":11,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[1.25,-36.84,0],"ix":2,"l":2},"a":{"a":0,"k":[4.789,33.995,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[1.865,0.364],[-0.623,5.891],[-1.236,4.546],[-0.391,-6.65],[0.616,-4.418]],"o":[[-0.218,-4.542],[0.653,-6.176],[1.225,4.483],[0.367,6.262],[-1.865,-0.364]],"v":[[-3.197,15.403],[-2.745,-0.342],[0.286,-16.495],[3.048,0.332],[2.4,16.495]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.294117647059,0.290196078431,0.560784313725,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.549019607843,0.901960844152,0.803921628466,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[5.414,18.495],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":27,"ty":4,"nm":"floor ","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[89.799,153.743,0],"ix":2,"l":2},"a":{"a":0,"k":[48.548,6.287,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-3.334],[26.675,0],[0,3.334],[-26.674,0]],"o":[[0,3.334],[-26.674,0],[0,-3.334],[26.675,0]],"v":[[48.298,0],[0,6.037],[-48.298,0],[0,-6.037]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.921568687289,0.921568687289,0.921568687289,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[48.548,6.287],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":0,"ct":1,"bm":0}],"markers":[{"tm":75,"cm":"connecting-start","dr":0},{"tm":165,"cm":"connecting-end","dr":0},{"tm":255,"cm":"connected-start","dr":0},{"tm":290,"cm":"connected-end","dr":0},{"tm":297,"cm":"disconnection-start","dr":0},{"tm":341,"cm":"disconnection-end","dr":0},{"tm":378,"cm":"failed-start","dr":0},{"tm":433,"cm":"failed-end","dr":0}]} \ No newline at end of file diff --git a/asset_sources/other/playstore_icon/campfire/app_icon-playstore.png b/asset_sources/other/playstore_icon/campfire/app_icon-playstore.png new file mode 100644 index 000000000..bea9f072e Binary files /dev/null and b/asset_sources/other/playstore_icon/campfire/app_icon-playstore.png differ diff --git a/crypto_plugins/flutter_libmonero b/crypto_plugins/flutter_libmonero index 6e71b956c..4b87151d4 160000 --- a/crypto_plugins/flutter_libmonero +++ b/crypto_plugins/flutter_libmonero @@ -1 +1 @@ -Subproject commit 6e71b956c3801f65a662c7f140e871c246166db3 +Subproject commit 4b87151d4914606b911f738a8236a6e54a6d8ecb diff --git a/docs/building.md b/docs/building.md index 0a736bad6..acda23499 100644 --- a/docs/building.md +++ b/docs/building.md @@ -53,7 +53,7 @@ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2- ### Build dependencies Install basic dependencies ``` -sudo apt-get install libssl-dev curl unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake libgit2-dev clang libncurses5-dev libncursesw5-dev zlib1g-dev llvm python3-distutils +sudo apt-get install libssl-dev curl unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake libgit2-dev clang libncurses5-dev libncursesw5-dev zlib1g-dev llvm python3-distutils g++ gcc gperf ``` Install [Rust](https://www.rust-lang.org/tools/install) with command: @@ -180,7 +180,7 @@ Download and install [Homebrew](https://brew.sh/). The following command can in After installing Homebrew, install the following packages: ``` -brew install autoconf automake boost berkeley-db ca-certificates cbindgen cmake cmake cocoapods curl git libssh2 make openssl@1.1 openssl@3 perl pkg-config rustup-init sodium unbound unzip xz zmq +brew install autoconf automake boost berkeley-db ca-certificates cbindgen cmake cocoapods curl git libssh2 libsodium make openssl@1.1 openssl@3 perl pkg-config rustup-init unbound unzip xz zmq ``` The following brew formula *may* be needed: diff --git a/ios/Podfile.lock b/ios/Podfile.lock index fd6ae37e5..cff46cb7b 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -9,63 +9,6 @@ PODS: - connectivity_plus (0.0.1): - Flutter - ReachabilitySwift - - cw_monero (0.0.2): - - cw_monero/Boost (= 0.0.2) - - cw_monero/Monero (= 0.0.2) - - cw_monero/OpenSSL (= 0.0.2) - - cw_monero/Sodium (= 0.0.2) - - cw_monero/Unbound (= 0.0.2) - - cw_shared_external - - Flutter - - cw_monero/Boost (0.0.2): - - cw_shared_external - - Flutter - - cw_monero/Monero (0.0.2): - - cw_shared_external - - Flutter - - cw_monero/OpenSSL (0.0.2): - - cw_shared_external - - Flutter - - cw_monero/Sodium (0.0.2): - - cw_shared_external - - Flutter - - cw_monero/Unbound (0.0.2): - - cw_shared_external - - Flutter - - cw_shared_external (0.0.1): - - cw_shared_external/Boost (= 0.0.1) - - cw_shared_external/OpenSSL (= 0.0.1) - - cw_shared_external/Sodium (= 0.0.1) - - Flutter - - cw_shared_external/Boost (0.0.1): - - Flutter - - cw_shared_external/OpenSSL (0.0.1): - - Flutter - - cw_shared_external/Sodium (0.0.1): - - Flutter - - cw_wownero (0.0.2): - - cw_shared_external - - cw_wownero/Boost (= 0.0.2) - - cw_wownero/OpenSSL (= 0.0.2) - - cw_wownero/Sodium (= 0.0.2) - - cw_wownero/Unbound (= 0.0.2) - - cw_wownero/Wownero (= 0.0.2) - - Flutter - - cw_wownero/Boost (0.0.2): - - cw_shared_external - - Flutter - - cw_wownero/OpenSSL (0.0.2): - - cw_shared_external - - Flutter - - cw_wownero/Sodium (0.0.2): - - cw_shared_external - - Flutter - - cw_wownero/Unbound (0.0.2): - - cw_shared_external - - Flutter - - cw_wownero/Wownero (0.0.2): - - cw_shared_external - - Flutter - device_info_plus (0.0.1): - Flutter - devicelocale (0.0.1): @@ -140,6 +83,21 @@ PODS: - SDWebImage/Core (5.13.2) - share_plus (0.0.1): - Flutter + - sqlite3 (3.46.0): + - sqlite3/common (= 3.46.0) + - sqlite3/common (3.46.0) + - sqlite3/fts5 (3.46.0): + - sqlite3/common + - sqlite3/perf-threadsafe (3.46.0): + - sqlite3/common + - sqlite3/rtree (3.46.0): + - sqlite3/common + - sqlite3_flutter_libs (0.0.1): + - Flutter + - sqlite3 (~> 3.46.0) + - sqlite3/fts5 + - sqlite3/perf-threadsafe + - sqlite3/rtree - stack_wallet_backup (0.0.1): - Flutter - SwiftProtobuf (1.19.0) @@ -155,9 +113,6 @@ DEPENDENCIES: - barcode_scan2 (from `.symlinks/plugins/barcode_scan2/ios`) - coinlib_flutter (from `.symlinks/plugins/coinlib_flutter/darwin`) - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) - - cw_monero (from `.symlinks/plugins/cw_monero/ios`) - - cw_shared_external (from `.symlinks/plugins/cw_shared_external/ios`) - - cw_wownero (from `.symlinks/plugins/cw_wownero/ios`) - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) - devicelocale (from `.symlinks/plugins/devicelocale/ios`) - file_picker (from `.symlinks/plugins/file_picker/ios`) @@ -177,6 +132,7 @@ DEPENDENCIES: - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - share_plus (from `.symlinks/plugins/share_plus/ios`) + - sqlite3_flutter_libs (from `.symlinks/plugins/sqlite3_flutter_libs/ios`) - stack_wallet_backup (from `.symlinks/plugins/stack_wallet_backup/ios`) - tor_ffi_plugin (from `.symlinks/plugins/tor_ffi_plugin/ios`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) @@ -189,6 +145,7 @@ SPEC REPOS: - MTBBarcodeScanner - ReachabilitySwift - SDWebImage + - sqlite3 - SwiftProtobuf - SwiftyGif @@ -199,12 +156,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/coinlib_flutter/darwin" connectivity_plus: :path: ".symlinks/plugins/connectivity_plus/ios" - cw_monero: - :path: ".symlinks/plugins/cw_monero/ios" - cw_shared_external: - :path: ".symlinks/plugins/cw_shared_external/ios" - cw_wownero: - :path: ".symlinks/plugins/cw_wownero/ios" device_info_plus: :path: ".symlinks/plugins/device_info_plus/ios" devicelocale: @@ -243,6 +194,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/permission_handler_apple/ios" share_plus: :path: ".symlinks/plugins/share_plus/ios" + sqlite3_flutter_libs: + :path: ".symlinks/plugins/sqlite3_flutter_libs/ios" stack_wallet_backup: :path: ".symlinks/plugins/stack_wallet_backup/ios" tor_ffi_plugin: @@ -256,9 +209,6 @@ SPEC CHECKSUMS: barcode_scan2: 0af2bb63c81b4565aab6cd78278e4c0fa136dbb0 coinlib_flutter: 6abec900d67762a6e7ccfd567a3cd3ae00bbee35 connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a - cw_monero: 9816991daff0e3ad0a8be140e31933b5526babd4 - cw_shared_external: 2972d872b8917603478117c9957dfca611845a92 - cw_wownero: ac53899fa5c6ff46b3fb490aa3b7ca36301fa832 device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea devicelocale: b22617f40038496deffba44747101255cee005b0 DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac @@ -283,6 +233,8 @@ SPEC CHECKSUMS: ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866 share_plus: 599aa54e4ea31d4b4c0e9c911bcc26c55e791028 + sqlite3: 154b084339ede06960a5b3c8160066adc9176b7d + sqlite3_flutter_libs: 0d611efdf6d1c9297d5ab03dab21b75aeebdae31 stack_wallet_backup: 5b8563aba5d8ffbf2ce1944331ff7294a0ec7c03 SwiftProtobuf: 6ef3f0e422ef90d6605ca20b21a94f6c1324d6b3 SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780 diff --git a/lib/app_config.dart b/lib/app_config.dart index 4b7003177..a9ea781c7 100644 --- a/lib/app_config.dart +++ b/lib/app_config.dart @@ -3,6 +3,12 @@ import 'wallets/crypto_currency/intermediate/frost_currency.dart'; part 'app_config.g.dart'; +enum AppFeature { + themeSelection, + buy, + swap; +} + abstract class AppConfig { static const appName = _prefix + _separator + suffix; @@ -12,6 +18,8 @@ abstract class AppConfig { static String get appDefaultDataDirName => _appDataDirName; static String get commitHash => _commitHash; + static bool hasFeature(AppFeature feature) => _features.contains(feature); + static ({String light, String dark})? get appIconAsset => _appIconAsset; static List get coins => _supportedCoins; diff --git a/lib/db/db_version_migration.dart b/lib/db/db_version_migration.dart index fe563f5ea..b5da9f505 100644 --- a/lib/db/db_version_migration.dart +++ b/lib/db/db_version_migration.dart @@ -422,6 +422,20 @@ class DbVersionMigrator with WalletDB { // try to continue migrating return await migrate(12, secureStore: secureStore); + case 12: + // migrate + await _v12(secureStore); + + // update version + await DB.instance.put( + boxName: DB.boxNameDBInfo, + key: "hive_data_version", + value: 13, + ); + + // try to continue migrating + return await migrate(13, secureStore: secureStore); + default: // finally return return; @@ -701,4 +715,15 @@ class DbVersionMigrator with WalletDB { Future _v11(SecureStorageInterface secureStore) async { await migrateWalletsToIsar(secureStore: secureStore); } + + Future _v12(SecureStorageInterface secureStore) async { + for (final identifier in ["firo", "firoTestNet"]) { + await DB.instance.deleteBoxFromDisk( + boxName: "${identifier}_anonymitySetSparkCache", + ); + await DB.instance.deleteBoxFromDisk( + boxName: "${identifier}_sparkUsedCoinsTagsCache", + ); + } + } } diff --git a/lib/db/hive/db.dart b/lib/db/hive/db.dart index 3f1c86cb7..2e9b5435b 100644 --- a/lib/db/hive/db.dart +++ b/lib/db/hive/db.dart @@ -13,6 +13,7 @@ import 'dart:isolate'; import 'package:cw_core/wallet_info.dart' as xmr; import 'package:hive/hive.dart'; import 'package:mutex/mutex.dart'; + import '../../app_config.dart'; import '../../models/exchange/response_objects/trade.dart'; import '../../models/node_model.dart'; @@ -55,12 +56,8 @@ class DB { // firo only String _boxNameSetCache({required CryptoCurrency currency}) => "${currency.identifier}_anonymitySetCache"; - String _boxNameSetSparkCache({required CryptoCurrency currency}) => - "${currency.identifier}_anonymitySetSparkCache"; String _boxNameUsedSerialsCache({required CryptoCurrency currency}) => "${currency.identifier}_usedSerialsCache"; - String _boxNameSparkUsedCoinsTagsCache({required CryptoCurrency currency}) => - "${currency.identifier}_sparkUsedCoinsTagsCache"; Box? _boxNodeModels; Box? _boxPrimaryNodes; @@ -81,7 +78,6 @@ class DB { final Map> _txCacheBoxes = {}; final Map> _setCacheBoxes = {}; - final Map> _setSparkCacheBoxes = {}; final Map> _usedSerialsCacheBoxes = {}; final Map> _getSparkUsedCoinsTagsCacheBoxes = {}; @@ -213,16 +209,6 @@ class DB { await Hive.openBox(_boxNameSetCache(currency: currency)); } - Future> getSparkAnonymitySetCacheBox({ - required CryptoCurrency currency, - }) async { - if (_setSparkCacheBoxes[currency.identifier]?.isOpen != true) { - _setSparkCacheBoxes.remove(currency.identifier); - } - return _setSparkCacheBoxes[currency.identifier] ??= - await Hive.openBox(_boxNameSetSparkCache(currency: currency)); - } - Future closeAnonymitySetCacheBox({ required CryptoCurrency currency, }) async { @@ -241,18 +227,6 @@ class DB { ); } - Future> getSparkUsedCoinsTagsCacheBox({ - required CryptoCurrency currency, - }) async { - if (_getSparkUsedCoinsTagsCacheBoxes[currency.identifier]?.isOpen != true) { - _getSparkUsedCoinsTagsCacheBoxes.remove(currency.identifier); - } - return _getSparkUsedCoinsTagsCacheBoxes[currency.identifier] ??= - await Hive.openBox( - _boxNameSparkUsedCoinsTagsCache(currency: currency), - ); - } - Future closeUsedSerialsCacheBox({ required CryptoCurrency currency, }) async { @@ -266,15 +240,9 @@ class DB { await deleteAll(boxName: _boxNameTxCache(currency: currency)); if (currency is Firo) { await deleteAll(boxName: _boxNameSetCache(currency: currency)); - await deleteAll( - boxName: _boxNameSetSparkCache(currency: currency), - ); await deleteAll( boxName: _boxNameUsedSerialsCache(currency: currency), ); - await deleteAll( - boxName: _boxNameSparkUsedCoinsTagsCache(currency: currency), - ); } } diff --git a/lib/db/isar/main_db.dart b/lib/db/isar/main_db.dart index 931f18263..1ea6830c5 100644 --- a/lib/db/isar/main_db.dart +++ b/lib/db/isar/main_db.dart @@ -11,6 +11,8 @@ import 'package:decimal/decimal.dart'; import 'package:flutter_native_splash/cli_commands.dart'; import 'package:isar/isar.dart'; +import 'package:tuple/tuple.dart'; + import '../../exceptions/main_db/main_db_exception.dart'; import '../../models/isar/models/block_explorer.dart'; import '../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; @@ -26,7 +28,6 @@ import '../../wallets/isar/models/spark_coin.dart'; import '../../wallets/isar/models/token_wallet_info.dart'; import '../../wallets/isar/models/wallet_info.dart'; import '../../wallets/isar/models/wallet_info_meta.dart'; -import 'package:tuple/tuple.dart'; part '../queries/queries.dart'; @@ -149,8 +150,9 @@ class MainDB { } // tx block explorers - TransactionBlockExplorer? getTransactionBlockExplorer( - {required CryptoCurrency cryptoCurrency}) { + TransactionBlockExplorer? getTransactionBlockExplorer({ + required CryptoCurrency cryptoCurrency, + }) { return isar.transactionBlockExplorers .where() .tickerEqualTo(cryptoCurrency.ticker) diff --git a/lib/db/migrate_wallets_to_isar.dart b/lib/db/migrate_wallets_to_isar.dart index f957ff6e9..474924997 100644 --- a/lib/db/migrate_wallets_to_isar.dart +++ b/lib/db/migrate_wallets_to_isar.dart @@ -207,7 +207,8 @@ Future migrateWalletsToIsar({ } await _cleanupOnSuccess( - walletIds: newInfo.map((e) => e.$1.walletId).toList()); + walletIds: newInfo.map((e) => e.$1.walletId).toList(), + ); } Future _cleanupOnSuccess({required List walletIds}) async { diff --git a/lib/db/sqlite/firo_cache.dart b/lib/db/sqlite/firo_cache.dart new file mode 100644 index 000000000..543b63557 --- /dev/null +++ b/lib/db/sqlite/firo_cache.dart @@ -0,0 +1,164 @@ +import 'dart:async'; +import 'dart:io'; +import 'dart:isolate'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter_libsparkmobile/flutter_libsparkmobile.dart'; +import 'package:mutex/mutex.dart'; +import 'package:sqlite3/sqlite3.dart'; +import 'package:uuid/uuid.dart'; + +import '../../electrumx_rpc/electrumx_client.dart'; +import '../../utilities/extensions/extensions.dart'; +import '../../utilities/logger.dart'; +import '../../utilities/stack_file_system.dart'; + +part 'firo_cache_coordinator.dart'; +part 'firo_cache_reader.dart'; +part 'firo_cache_worker.dart'; +part 'firo_cache_writer.dart'; + +/// Temporary debugging log function for this file +void _debugLog(Object? object) { + if (kDebugMode) { + Logging.instance.log( + object, + level: LogLevel.Debug, + ); + } +} + +abstract class _FiroCache { + static const int _setCacheVersion = 1; + static const int _tagsCacheVersion = 1; + static const String sparkSetCacheFileName = + "spark_set_v$_setCacheVersion.sqlite3"; + static const String sparkUsedTagsCacheFileName = + "spark_tags_v$_tagsCacheVersion.sqlite3"; + + static Database? _setCacheDB; + static Database? _usedTagsCacheDB; + static Database get setCacheDB { + if (_setCacheDB == null) { + throw Exception( + "FiroCache.init() must be called before accessing FiroCache.db!", + ); + } + return _setCacheDB!; + } + + static Database get usedTagsCacheDB { + if (_usedTagsCacheDB == null) { + throw Exception( + "FiroCache.init() must be called before accessing FiroCache.db!", + ); + } + return _usedTagsCacheDB!; + } + + static Future? _initFuture; + static Future init() => _initFuture ??= _init(); + + static Future _init() async { + final sqliteDir = + await StackFileSystem.applicationFiroCacheSQLiteDirectory(); + + final sparkSetCacheFile = File("${sqliteDir.path}/$sparkSetCacheFileName"); + final sparkUsedTagsCacheFile = + File("${sqliteDir.path}/$sparkUsedTagsCacheFileName"); + + if (!(await sparkSetCacheFile.exists())) { + await _createSparkSetCacheDb(sparkSetCacheFile.path); + } + if (!(await sparkUsedTagsCacheFile.exists())) { + await _createSparkUsedTagsCacheDb(sparkUsedTagsCacheFile.path); + } + + _setCacheDB = sqlite3.open( + sparkSetCacheFile.path, + mode: OpenMode.readWrite, + ); + _usedTagsCacheDB = sqlite3.open( + sparkUsedTagsCacheFile.path, + mode: OpenMode.readWrite, + ); + } + + static Future _deleteAllCache() async { + final start = DateTime.now(); + setCacheDB.execute( + """ + DELETE FROM SparkSet; + DELETE FROM SparkCoin; + DELETE FROM SparkSetCoins; + VACUUM; + """, + ); + usedTagsCacheDB.execute( + """ + DELETE FROM SparkUsedCoinTags; + VACUUM; + """, + ); + _debugLog( + "_deleteAllCache() " + "duration = ${DateTime.now().difference(start)}", + ); + } + + static Future _createSparkSetCacheDb(String file) async { + final db = sqlite3.open( + file, + mode: OpenMode.readWriteCreate, + ); + + db.execute( + """ + CREATE TABLE SparkSet ( + id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, + blockHash TEXT NOT NULL, + setHash TEXT NOT NULL, + groupId INTEGER NOT NULL, + timestampUTC INTEGER NOT NULL, + UNIQUE (blockHash, setHash, groupId) + ); + + CREATE TABLE SparkCoin ( + id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, + serialized TEXT NOT NULL, + txHash TEXT NOT NULL, + context TEXT NOT NULL, + UNIQUE(serialized, txHash, context) + ); + + CREATE TABLE SparkSetCoins ( + id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, + setId INTEGER NOT NULL, + coinId INTEGER NOT NULL, + FOREIGN KEY (setId) REFERENCES SparkSet(id), + FOREIGN KEY (coinId) REFERENCES SparkCoin(id) + ); + """, + ); + + db.dispose(); + } + + static Future _createSparkUsedTagsCacheDb(String file) async { + final db = sqlite3.open( + file, + mode: OpenMode.readWriteCreate, + ); + + db.execute( + """ + CREATE TABLE SparkUsedCoinTags ( + id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, + tag TEXT NOT NULL UNIQUE + ); + """, + ); + + db.dispose(); + } +} diff --git a/lib/db/sqlite/firo_cache_coordinator.dart b/lib/db/sqlite/firo_cache_coordinator.dart new file mode 100644 index 000000000..610504d5f --- /dev/null +++ b/lib/db/sqlite/firo_cache_coordinator.dart @@ -0,0 +1,166 @@ +part of 'firo_cache.dart'; + +/// Wrapper class for [_FiroCache] as [_FiroCache] should eventually be handled in a +/// background isolate and [FiroCacheCoordinator] should manage that isolate +abstract class FiroCacheCoordinator { + static _FiroCacheWorker? _worker; + + static bool _init = false; + static Future init() async { + if (_init) { + return; + } + _init = true; + await _FiroCache.init(); + _worker = await _FiroCacheWorker.spawn(); + } + + static Future clearSharedCache() async { + return await _FiroCache._deleteAllCache(); + } + + static Future getSparkCacheSize() async { + final dir = await StackFileSystem.applicationFiroCacheSQLiteDirectory(); + final setCacheFile = File( + "${dir.path}/${_FiroCache.sparkSetCacheFileName}", + ); + final usedTagsCacheFile = File( + "${dir.path}/${_FiroCache.sparkUsedTagsCacheFileName}", + ); + final int bytes = + ((await setCacheFile.exists()) ? await setCacheFile.length() : 0) + + ((await usedTagsCacheFile.exists()) + ? await usedTagsCacheFile.length() + : 0); + + if (bytes < 1024) { + return '$bytes B'; + } else if (bytes < 1048576) { + final double kbSize = bytes / 1024; + return '${kbSize.toStringAsFixed(2)} KB'; + } else if (bytes < 1073741824) { + final double mbSize = bytes / 1048576; + return '${mbSize.toStringAsFixed(2)} MB'; + } else { + final double gbSize = bytes / 1073741824; + return '${gbSize.toStringAsFixed(2)} GB'; + } + } + + static Future runFetchAndUpdateSparkUsedCoinTags( + ElectrumXClient client, + ) async { + final count = await FiroCacheCoordinator.getUsedCoinTagsLastAddedRowId(); + final unhashedTags = await client.getSparkUnhashedUsedCoinsTags( + startNumber: count, + ); + if (unhashedTags.isNotEmpty) { + await _worker!.runTask( + FCTask( + func: FCFuncName._updateSparkUsedTagsWith, + data: unhashedTags, + ), + ); + } + } + + static Future runFetchAndUpdateSparkAnonSetCacheForGroupId( + int groupId, + ElectrumXClient client, + ) async { + final blockhashResult = + await FiroCacheCoordinator.getLatestSetInfoForGroupId( + groupId, + ); + final blockHash = blockhashResult?.blockHash ?? ""; + + final json = await client.getSparkAnonymitySet( + coinGroupId: groupId.toString(), + startBlockHash: blockHash.toHexReversedFromBase64, + ); + + await _worker!.runTask( + FCTask( + func: FCFuncName._updateSparkAnonSetCoinsWith, + data: (groupId, json), + ), + ); + } + + // =========================================================================== + + static Future> getUsedCoinTags(int startNumber) async { + final result = await _Reader._getSparkUsedCoinTags( + startNumber, + db: _FiroCache.usedTagsCacheDB, + ); + return result.map((e) => e["tag"] as String).toSet(); + } + + /// This should be the equivalent of counting the number of tags in the db. + /// Assuming the integrity of the data. Faster than actually calling count on + /// a table where no records have been deleted. None should be deleted from + /// this table in practice. + static Future getUsedCoinTagsLastAddedRowId() async { + final result = await _Reader._getUsedCoinTagsLastAddedRowId( + db: _FiroCache.usedTagsCacheDB, + ); + if (result.isEmpty) { + return 0; + } + return result.first["highestId"] as int? ?? 0; + } + + static Future checkTagIsUsed( + String tag, + ) async { + return await _Reader._checkTagIsUsed( + tag, + db: _FiroCache.usedTagsCacheDB, + ); + } + + static Future getSetCoinsForGroupId( + int groupId, { + int? newerThanTimeStamp, + }) async { + return await _Reader._getSetCoinsForGroupId( + groupId, + db: _FiroCache.setCacheDB, + newerThanTimeStamp: newerThanTimeStamp, + ); + } + + static Future< + ({ + String blockHash, + String setHash, + int timestampUTC, + })?> getLatestSetInfoForGroupId( + int groupId, + ) async { + final result = await _Reader._getLatestSetInfoForGroupId( + groupId, + db: _FiroCache.setCacheDB, + ); + + if (result.isEmpty) { + return null; + } + + return ( + blockHash: result.first["blockHash"] as String, + setHash: result.first["setHash"] as String, + timestampUTC: result.first["timestampUTC"] as int, + ); + } + + static Future checkSetInfoForGroupIdExists( + int groupId, + ) async { + return await _Reader._checkSetInfoForGroupIdExists( + groupId, + db: _FiroCache.setCacheDB, + ); + } +} diff --git a/lib/db/sqlite/firo_cache_reader.dart b/lib/db/sqlite/firo_cache_reader.dart new file mode 100644 index 000000000..10af03922 --- /dev/null +++ b/lib/db/sqlite/firo_cache_reader.dart @@ -0,0 +1,103 @@ +part of 'firo_cache.dart'; + +/// Keep all fetch queries in this separate file +abstract class _Reader { + // =========================================================================== + // =============== Spark anonymity set queries =============================== + + static Future _getSetCoinsForGroupId( + int groupId, { + required Database db, + int? newerThanTimeStamp, + }) async { + String query = """ + SELECT sc.serialized, sc.txHash, sc.context + FROM SparkSet AS ss + JOIN SparkSetCoins AS ssc ON ss.id = ssc.setId + JOIN SparkCoin AS sc ON ssc.coinId = sc.id + WHERE ss.groupId = $groupId + """; + + if (newerThanTimeStamp != null) { + query += " AND ss.timestampUTC" + " > $newerThanTimeStamp"; + } + + return db.select("$query;"); + } + + static Future _getLatestSetInfoForGroupId( + int groupId, { + required Database db, + }) async { + final query = """ + SELECT ss.blockHash, ss.setHash, ss.timestampUTC + FROM SparkSet ss + WHERE ss.groupId = $groupId + ORDER BY ss.timestampUTC DESC + LIMIT 1; + """; + + return db.select("$query;"); + } + + static Future _checkSetInfoForGroupIdExists( + int groupId, { + required Database db, + }) async { + final query = """ + SELECT EXISTS ( + SELECT 1 + FROM SparkSet + WHERE groupId = $groupId + ) AS setExists; + """; + + return db.select("$query;").first["setExists"] == 1; + } + + // =========================================================================== + // =============== Spark used coin tags queries ============================== + + static Future _getSparkUsedCoinTags( + int startNumber, { + required Database db, + }) async { + String query = """ + SELECT tag + FROM SparkUsedCoinTags + """; + + if (startNumber > 0) { + query += " WHERE id >= $startNumber"; + } + + return db.select("$query;"); + } + + static Future _getUsedCoinTagsLastAddedRowId({ + required Database db, + }) async { + const query = """ + SELECT MAX(id) AS highestId + FROM SparkUsedCoinTags; + """; + + return db.select("$query;"); + } + + static Future _checkTagIsUsed( + String tag, { + required Database db, + }) async { + final query = """ + SELECT EXISTS ( + SELECT 1 + FROM SparkUsedCoinTags + WHERE tag = '$tag' + ) AS tagExists; + """; + + return db.select("$query;").first["tagExists"] == 1; + } +} diff --git a/lib/db/sqlite/firo_cache_worker.dart b/lib/db/sqlite/firo_cache_worker.dart new file mode 100644 index 000000000..a611c54b9 --- /dev/null +++ b/lib/db/sqlite/firo_cache_worker.dart @@ -0,0 +1,140 @@ +part of 'firo_cache.dart'; + +enum FCFuncName { + _updateSparkAnonSetCoinsWith, + _updateSparkUsedTagsWith, +} + +class FCTask { + final id = const Uuid().v4(); + final FCFuncName func; + final dynamic data; + + FCTask({required this.func, required this.data}); +} + +class _FiroCacheWorker { + final SendPort _commands; + final ReceivePort _responses; + final Map> _activeRequests = {}; + + Future runTask(FCTask task) async { + final completer = Completer.sync(); + _activeRequests[task.id] = completer; + _commands.send(task); + return await completer.future; + } + + static Future<_FiroCacheWorker> spawn() async { + final dir = await StackFileSystem.applicationFiroCacheSQLiteDirectory(); + final setCacheFilePath = "${dir.path}/${_FiroCache.sparkSetCacheFileName}"; + final usedTagsCacheFilePath = + "${dir.path}/${_FiroCache.sparkUsedTagsCacheFileName}"; + + final initPort = RawReceivePort(); + final connection = Completer<(ReceivePort, SendPort)>.sync(); + + initPort.handler = (dynamic initialMessage) { + final commandPort = initialMessage as SendPort; + connection.complete( + ( + ReceivePort.fromRawReceivePort(initPort), + commandPort, + ), + ); + }; + + try { + await Isolate.spawn( + _startWorkerIsolate, + (initPort.sendPort, setCacheFilePath, usedTagsCacheFilePath), + ); + } catch (_) { + initPort.close(); + rethrow; + } + + final (receivePort, sendPort) = await connection.future; + + return _FiroCacheWorker._(receivePort, sendPort); + } + + _FiroCacheWorker._(this._responses, this._commands) { + _responses.listen(_handleResponsesFromIsolate); + } + + void _handleResponsesFromIsolate(dynamic message) { + final (id, error) = message as (String, Object?); + final completer = _activeRequests.remove(id)!; + + if (error != null) { + completer.completeError(error); + } else { + completer.complete(id); + } + } + + static void _handleCommandsToIsolate( + ReceivePort receivePort, + SendPort sendPort, + Database setCacheDb, + Database usedTagsCacheDb, + Mutex mutex, + ) { + receivePort.listen((message) { + final task = message as FCTask; + + mutex.protect(() async { + try { + final FCResult result; + switch (task.func) { + case FCFuncName._updateSparkAnonSetCoinsWith: + final data = task.data as (int, Map); + result = _updateSparkAnonSetCoinsWith( + setCacheDb, + data.$2, + data.$1, + ); + break; + + case FCFuncName._updateSparkUsedTagsWith: + result = _updateSparkUsedTagsWith( + usedTagsCacheDb, + task.data as List, + ); + break; + } + + if (result.success) { + sendPort.send((task.id, null)); + } else { + sendPort.send((task.id, result.error!)); + } + } catch (e) { + sendPort.send((task.id, e)); + } + }); + }); + } + + static void _startWorkerIsolate((SendPort, String, String) args) { + final receivePort = ReceivePort(); + args.$1.send(receivePort.sendPort); + final mutex = Mutex(); + final setCacheDb = sqlite3.open( + args.$2, + mode: OpenMode.readWrite, + ); + final usedTagsCacheDb = sqlite3.open( + args.$3, + mode: OpenMode.readWrite, + ); + _handleCommandsToIsolate( + receivePort, + args.$1, + setCacheDb, + usedTagsCacheDb, + mutex, + ); + } +} diff --git a/lib/db/sqlite/firo_cache_writer.dart b/lib/db/sqlite/firo_cache_writer.dart new file mode 100644 index 000000000..0bf1d938b --- /dev/null +++ b/lib/db/sqlite/firo_cache_writer.dart @@ -0,0 +1,169 @@ +part of 'firo_cache.dart'; + +class FCResult { + final bool success; + final Object? error; + + FCResult({required this.success, this.error}); +} + +// =========================================================================== +// ================== write to spark used tags cache ========================= + +/// update the sqlite cache +/// Expected json format: +/// returns true if successful, otherwise some exception +FCResult _updateSparkUsedTagsWith( + Database db, + List tags, +) { + // hash the tags here since this function is called in a background isolate + final hashedTags = LibSpark.hashTags(base64Tags: tags); + + if (hashedTags.isEmpty) { + // nothing to add, return early + return FCResult(success: true); + } + + db.execute("BEGIN;"); + try { + for (final tag in hashedTags) { + db.execute( + """ + INSERT OR IGNORE INTO SparkUsedCoinTags (tag) + VALUES (?); + """, + [tag], + ); + } + + db.execute("COMMIT;"); + + return FCResult(success: true); + } catch (e) { + db.execute("ROLLBACK;"); + return FCResult(success: false, error: e); + } +} + +// =========================================================================== +// ================== write to spark anon set cache ========================== + +/// update the sqlite cache +/// Expected json format: +/// { +/// "blockHash": "someBlockHash", +/// "setHash": "someSetHash", +/// "coins": [ +/// ["serliazed1", "hash1", "context1"], +/// ["serliazed2", "hash2", "context2"], +/// ... +/// ["serliazed3", "hash3", "context3"], +/// ["serliazed4", "hash4", "context4"], +/// ], +/// } +/// +/// returns true if successful, otherwise false +FCResult _updateSparkAnonSetCoinsWith( + Database db, + Map json, + int groupId, +) { + final blockHash = json["blockHash"] as String; + final setHash = json["setHash"] as String; + final coinsRaw = json["coins"] as List; + + if (coinsRaw.isEmpty) { + // no coins to actually insert + return FCResult(success: true); + } + + final checkResult = db.select( + """ + SELECT * + FROM SparkSet + WHERE blockHash = ? AND setHash = ? AND groupId = ?; + """, + [ + blockHash, + setHash, + groupId, + ], + ); + + if (checkResult.isNotEmpty) { + // already up to date + return FCResult(success: true); + } + + final coins = coinsRaw + .map( + (e) => [ + e[0] as String, + e[1] as String, + e[2] as String, + ], + ) + .toList(); + + final timestamp = DateTime.now().toUtc().millisecondsSinceEpoch ~/ 1000; + + db.execute("BEGIN;"); + try { + db.execute( + """ + INSERT INTO SparkSet (blockHash, setHash, groupId, timestampUTC) + VALUES (?, ?, ?, ?); + """, + [blockHash, setHash, groupId, timestamp], + ); + final setId = db.lastInsertRowId; + + for (final coin in coins) { + int coinId; + try { + // try to insert and get row id + db.execute( + """ + INSERT INTO SparkCoin (serialized, txHash, context) + VALUES (?, ?, ?); + """, + coin, + ); + coinId = db.lastInsertRowId; + } on SqliteException catch (e) { + // if there already is a matching coin in the db + // just grab its row id + if (e.extendedResultCode == 2067) { + final result = db.select( + """ + SELECT id + FROM SparkCoin + WHERE serialized = ? AND txHash = ? AND context = ?; + """, + coin, + ); + coinId = result.first["id"] as int; + } else { + rethrow; + } + } + + // finally add the row id to the newly added set + db.execute( + """ + INSERT INTO SparkSetCoins (setId, coinId) + VALUES (?, ?); + """, + [setId, coinId], + ); + } + + db.execute("COMMIT;"); + + return FCResult(success: true); + } catch (e) { + db.execute("ROLLBACK;"); + return FCResult(success: false, error: e); + } +} diff --git a/lib/dto/ethereum/eth_token_tx_extra_dto.dart b/lib/dto/ethereum/eth_token_tx_extra_dto.dart index c902d2bba..401ea7122 100644 --- a/lib/dto/ethereum/eth_token_tx_extra_dto.dart +++ b/lib/dto/ethereum/eth_token_tx_extra_dto.dart @@ -11,7 +11,6 @@ import 'dart:convert'; import '../../utilities/amount/amount.dart'; -import '../../wallets/crypto_currency/coins/ethereum.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; class EthTokenTxExtraDTO { diff --git a/lib/dto/ethereum/eth_tx_dto.dart b/lib/dto/ethereum/eth_tx_dto.dart index 2f60e9792..10a46d740 100644 --- a/lib/dto/ethereum/eth_tx_dto.dart +++ b/lib/dto/ethereum/eth_tx_dto.dart @@ -11,7 +11,6 @@ import 'dart:convert'; import '../../utilities/amount/amount.dart'; -import '../../wallets/crypto_currency/coins/ethereum.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; class EthTxDTO { diff --git a/lib/dto/ordinals/address_inscription_response.dart b/lib/dto/ordinals/address_inscription_response.dart index fa3144b57..ba9ce0747 100644 --- a/lib/dto/ordinals/address_inscription_response.dart +++ b/lib/dto/ordinals/address_inscription_response.dart @@ -1,7 +1,8 @@ -import 'litescribe_response.dart'; import 'inscription_data.dart'; +import 'litescribe_response.dart'; -class AddressInscriptionResponse extends LitescribeResponse { +class AddressInscriptionResponse + extends LitescribeResponse { final int status; final String message; final AddressInscriptionResult result; @@ -16,7 +17,8 @@ class AddressInscriptionResponse extends LitescribeResponse), + result: AddressInscriptionResult.fromJson( + json['result'] as Map), ); } } @@ -32,7 +34,9 @@ class AddressInscriptionResult { factory AddressInscriptionResult.fromJson(Map json) { return AddressInscriptionResult( - list: (json['list'] as List).map((item) => InscriptionData.fromJson(item as Map)).toList(), + list: (json['list'] as List) + .map((item) => InscriptionData.fromJson(item as Map)) + .toList(), total: json['total'] as int, ); } diff --git a/lib/electrumx_rpc/cached_electrumx_client.dart b/lib/electrumx_rpc/cached_electrumx_client.dart index 569c092fa..8b1ff10c8 100644 --- a/lib/electrumx_rpc/cached_electrumx_client.dart +++ b/lib/electrumx_rpc/cached_electrumx_client.dart @@ -11,11 +11,12 @@ import 'dart:convert'; import 'dart:math'; +import 'package:string_validator/string_validator.dart'; + import '../db/hive/db.dart'; -import 'electrumx_client.dart'; import '../utilities/logger.dart'; import '../wallets/crypto_currency/crypto_currency.dart'; -import 'package:string_validator/string_validator.dart'; +import 'electrumx_client.dart'; class CachedElectrumXClient { final ElectrumXClient electrumXClient; @@ -115,70 +116,6 @@ class CachedElectrumXClient { } } - Future> getSparkAnonymitySet({ - required String groupId, - String blockhash = "", - required CryptoCurrency cryptoCurrency, - required bool useOnlyCacheIfNotEmpty, - }) async { - try { - final box = await DB.instance.getSparkAnonymitySetCacheBox( - currency: cryptoCurrency, - ); - final cachedSet = box.get(groupId) as Map?; - - Map set; - - // null check to see if there is a cached set - if (cachedSet == null) { - set = { - "coinGroupID": int.parse(groupId), - "blockHash": blockhash, - "setHash": "", - "coins": [], - }; - } else { - set = Map.from(cachedSet); - if (useOnlyCacheIfNotEmpty) { - return set; - } - } - - final newSet = await electrumXClient.getSparkAnonymitySet( - coinGroupId: groupId, - startBlockHash: set["blockHash"] as String, - ); - - // update set with new data - if (newSet["setHash"] != "" && set["setHash"] != newSet["setHash"]) { - set["setHash"] = newSet["setHash"]; - set["blockHash"] = newSet["blockHash"]; - for (int i = (newSet["coins"] as List).length - 1; i >= 0; i--) { - // TODO verify this is correct (or append?) - if ((set["coins"] as List) - .where((e) => e[0] == newSet["coins"][i][0]) - .isEmpty) { - set["coins"].insert(0, newSet["coins"][i]); - } - } - // save set to db - await box.put(groupId, set); - Logging.instance.log( - "Updated current anonymity set for ${cryptoCurrency.identifier} with group ID $groupId", - level: LogLevel.Info, - ); - } - - return set; - } catch (e, s) { - Logging.instance.log( - "Failed to process CachedElectrumX.getSparkAnonymitySet(): $e\n$s", - level: LogLevel.Error, - ); - rethrow; - } - } - String base64ToHex(String source) => base64Decode(LineSplitter.split(source).join()) .map((e) => e.toRadixString(16).padLeft(2, '0')) @@ -283,56 +220,10 @@ class CachedElectrumXClient { } } - Future> getSparkUsedCoinsTags({ + /// Clear all cached transactions for the specified coin + Future clearSharedTransactionCache({ required CryptoCurrency cryptoCurrency, }) async { - try { - final box = await DB.instance.getSparkUsedCoinsTagsCacheBox( - currency: cryptoCurrency, - ); - - final _list = box.get("tags") as List?; - - final Set cachedTags = - _list == null ? {} : List.from(_list).toSet(); - - final startNumber = max( - 0, - cachedTags.length - 100, // 100 being some arbitrary buffer - ); - - final newTags = await electrumXClient.getSparkUsedCoinsTags( - startNumber: startNumber, - ); - - // ensure we are getting some overlap so we know we are not missing any - if (cachedTags.isNotEmpty && newTags.isNotEmpty) { - assert(cachedTags.intersection(newTags).isNotEmpty); - } - - // Make newTags an Iterable. - final Iterable iterableTags = newTags.map((e) => e.toString()); - - cachedTags.addAll(iterableTags); - - await box.put( - "tags", - cachedTags.toList(), - ); - - return cachedTags; - } catch (e, s) { - Logging.instance.log( - "Failed to process CachedElectrumX.getSparkUsedCoinsTags(): $e\n$s", - level: LogLevel.Error, - ); - rethrow; - } - } - - /// Clear all cached transactions for the specified coin - Future clearSharedTransactionCache( - {required CryptoCurrency cryptoCurrency}) async { await DB.instance.clearSharedTransactionCache(currency: cryptoCurrency); await DB.instance.closeAnonymitySetCacheBox(currency: cryptoCurrency); } diff --git a/lib/electrumx_rpc/electrumx_client.dart b/lib/electrumx_rpc/electrumx_client.dart index c37547f92..594e73fe3 100644 --- a/lib/electrumx_rpc/electrumx_client.dart +++ b/lib/electrumx_rpc/electrumx_client.dart @@ -17,10 +17,9 @@ import 'package:electrum_adapter/electrum_adapter.dart' as electrum_adapter; import 'package:electrum_adapter/electrum_adapter.dart'; import 'package:electrum_adapter/methods/specific/firo.dart'; import 'package:event_bus/event_bus.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter_libsparkmobile/flutter_libsparkmobile.dart'; import 'package:mutex/mutex.dart'; -import 'client_manager.dart'; +import 'package:stream_channel/stream_channel.dart'; + import '../exceptions/electrumx/no_such_transaction.dart'; import '../services/event_bus/events/global/tor_connection_status_changed_event.dart'; import '../services/event_bus/events/global/tor_status_changed_event.dart'; @@ -28,10 +27,8 @@ import '../services/event_bus/global_event_bus.dart'; import '../services/tor_service.dart'; import '../utilities/logger.dart'; import '../utilities/prefs.dart'; -import '../wallets/crypto_currency/coins/dogecoin.dart'; -import '../wallets/crypto_currency/coins/firo.dart'; import '../wallets/crypto_currency/crypto_currency.dart'; -import 'package:stream_channel/stream_channel.dart'; +import 'client_manager.dart'; class WifiOnlyException implements Exception {} @@ -912,10 +909,7 @@ class ElectrumXClient { String? requestID, }) async { try { - Logging.instance.log( - "attempting to fetch spark.getsparkanonymityset...", - level: LogLevel.Info, - ); + final start = DateTime.now(); await _checkElectrumAdapter(); final Map response = await (getElectrumAdapter() as FiroElectrumClient) @@ -924,7 +918,10 @@ class ElectrumXClient { startBlockHash: startBlockHash, ); Logging.instance.log( - "Fetching spark.getsparkanonymityset finished", + "Finished ElectrumXClient.getSparkAnonymitySet(coinGroupId" + "=$coinGroupId, startBlockHash=$startBlockHash). " + "coins.length: ${(response["coins"] as List?)?.length}" + "Duration=${DateTime.now().difference(start)}", level: LogLevel.Info, ); return response; @@ -933,18 +930,15 @@ class ElectrumXClient { } } + // TODO: update when we get new call to include tx hashes in response /// Takes [startNumber], if it is 0, we get the full set, /// otherwise the used tags after that number - Future> getSparkUsedCoinsTags({ + Future> getSparkUnhashedUsedCoinsTags({ String? requestID, required int startNumber, }) async { try { - // Use electrum_adapter package's getSparkUsedCoinsTags method. - Logging.instance.log( - "attempting to fetch spark.getusedcoinstags...", - level: LogLevel.Info, - ); + final start = DateTime.now(); await _checkElectrumAdapter(); final Map response = await (getElectrumAdapter() as FiroElectrumClient) @@ -956,8 +950,16 @@ class ElectrumXClient { level: LogLevel.Info, ); final map = Map.from(response); - final set = Set.from(map["tags"] as List); - return await compute(_ffiHashTagsComputeWrapper, set); + final tags = List.from(map["tags"] as List); + + Logging.instance.log( + "Finished ElectrumXClient.getSparkUnhashedUsedCoinsTags(startNumber" + "=$startNumber). " + "Duration=${DateTime.now().difference(start)}", + level: LogLevel.Info, + ); + + return tags; } catch (e) { Logging.instance.log(e, level: LogLevel.Error); rethrow; @@ -1023,6 +1025,64 @@ class ElectrumXClient { } } + /// Returns the txids of the current transactions found in the mempool + Future> getMempoolTxids({ + String? requestID, + }) async { + try { + final start = DateTime.now(); + final response = await request( + requestID: requestID, + command: "spark.getmempooltxids", + ); + + // TODO verify once server is live + final txids = List.from(response as List).toSet(); + // final map = Map.from(response as Map); + // final txids = List.from(map["tags"] as List).toSet(); + + Logging.instance.log( + "Finished ElectrumXClient.getMempoolTxids(). " + "Duration=${DateTime.now().difference(start)}", + level: LogLevel.Info, + ); + + return txids; + } catch (e) { + Logging.instance.log(e, level: LogLevel.Error); + rethrow; + } + } + + /// Returns the txids of the current transactions found in the mempool + Future> getMempoolSparkData({ + String? requestID, + required List txids, + }) async { + try { + final start = DateTime.now(); + final response = await request( + requestID: requestID, + command: "spark.getmempooltxs", + args: txids, + ); + + // TODO verify once server is live + final map = Map.from(response as Map); + + Logging.instance.log( + "Finished ElectrumXClient.getMempoolSparkData(txids: $txids). " + "Duration=${DateTime.now().difference(start)}", + level: LogLevel.Info, + ); + + return map; + } catch (e) { + Logging.instance.log(e, level: LogLevel.Error); + rethrow; + } + } + // =========================================================================== /// Get the current fee rate. @@ -1094,7 +1154,3 @@ class ElectrumXClient { } } } - -Set _ffiHashTagsComputeWrapper(Set base64Tags) { - return LibSpark.hashTags(base64Tags: base64Tags); -} diff --git a/lib/main.dart b/lib/main.dart index a714447ab..ae7d26466 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -35,6 +35,7 @@ import 'app_config.dart'; import 'db/db_version_migration.dart'; import 'db/hive/db.dart'; import 'db/isar/main_db.dart'; +import 'db/sqlite/firo_cache.dart'; import 'models/exchange/change_now/exchange_transaction.dart'; import 'models/exchange/change_now/exchange_transaction_status.dart'; import 'models/exchange/response_objects/trade.dart'; @@ -180,7 +181,8 @@ void main(List args) async { Hive.registerAdapter(UnspentCoinsInfoAdapter()); await Hive.initFlutter( - (await StackFileSystem.applicationHiveDirectory()).path); + (await StackFileSystem.applicationHiveDirectory()).path, + ); await Hive.openBox(DB.boxNameDBInfo); await Hive.openBox(DB.boxNamePrefs); @@ -199,11 +201,14 @@ void main(List args) async { } await StackFileSystem.initThemesDir(); + await FiroCacheCoordinator.init(); // Desktop migrate handled elsewhere (currently desktop_login_view.dart) if (!Util.isDesktop) { - int dbVersion = DB.instance.get( - boxName: DB.boxNameDBInfo, key: "hive_data_version") as int? ?? + final int dbVersion = DB.instance.get( + boxName: DB.boxNameDBInfo, + key: "hive_data_version", + ) as int? ?? 0; if (dbVersion < Constants.currentDataVersion) { try { @@ -215,18 +220,17 @@ void main(List args) async { ), ); } catch (e, s) { - Logging.instance.log("Cannot migrate mobile database\n$e $s", - level: LogLevel.Error, printFullLength: true); + Logging.instance.log( + "Cannot migrate mobile database\n$e $s", + level: LogLevel.Error, + printFullLength: true, + ); } } } - if (!Platform.isWindows) { - monero.onStartup(); - } - if (!Platform.isLinux && !Platform.isWindows) { - wownero.onStartup(); - } + monero.onStartup(); + wownero.onStartup(); // SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, // overlays: [SystemUiOverlay.bottom]); @@ -266,7 +270,7 @@ void main(List args) async { /// MyApp initialises relevant services with a MultiProvider class MyApp extends StatelessWidget { - const MyApp({Key? key}) : super(key: key); + const MyApp({super.key}); @override Widget build(BuildContext context) { @@ -283,8 +287,8 @@ class MyApp extends StatelessWidget { class MaterialAppWithTheme extends ConsumerStatefulWidget { const MaterialAppWithTheme({ - Key? key, - }) : super(key: key); + super.key, + }); @override ConsumerState createState() => @@ -386,7 +390,8 @@ class _MaterialAppWithThemeState extends ConsumerState switch (ref.read(prefsChangeNotifierProvider).backupFrequencyType) { case BackupFrequencyType.everyTenMinutes: ref.read(autoSWBServiceProvider).startPeriodicBackupTimer( - duration: const Duration(minutes: 10)); + duration: const Duration(minutes: 10), + ); break; case BackupFrequencyType.everyAppStart: unawaited(ref.read(autoSWBServiceProvider).doBackup()); @@ -452,7 +457,8 @@ class _MaterialAppWithThemeState extends ConsumerState await loadingCompleter.future; await goToRestoreSWB( - ref.read(openedFromSWBFileStringStateProvider.state).state!); + ref.read(openedFromSWBFileStringStateProvider.state).state!, + ); ref.read(openedFromSWBFileStringStateProvider.state).state = null; } // ref.read(shouldShowLockscreenOnResumeStateProvider.state).state = false; @@ -515,7 +521,8 @@ class _MaterialAppWithThemeState extends ConsumerState if (ref.read(openedFromSWBFileStringStateProvider.state).state != null) { await goToRestoreSWB( - ref.read(openedFromSWBFileStringStateProvider.state).state!); + ref.read(openedFromSWBFileStringStateProvider.state).state!, + ); ref.read(openedFromSWBFileStringStateProvider.state).state = null; } } @@ -563,8 +570,9 @@ class _MaterialAppWithThemeState extends ConsumerState await resetOpenPath(); Logging.instance.log( - "This is the .swb content from intent: ${ref.read(openedFromSWBFileStringStateProvider.state).state}", - level: LogLevel.Info); + "This is the .swb content from intent: ${ref.read(openedFromSWBFileStringStateProvider.state).state}", + level: LogLevel.Info, + ); } /// should only be called on android currently @@ -579,27 +587,31 @@ class _MaterialAppWithThemeState extends ConsumerState .then((value) { if (value is! bool || value == false) { Navigator.of(navigatorKey.currentContext!).pushNamed( - RestoreFromEncryptedStringView.routeName, - arguments: encrypted); + RestoreFromEncryptedStringView.routeName, + arguments: encrypted, + ); } }); } else { - unawaited(Navigator.push( - navigatorKey.currentContext!, - RouteGenerator.getRoute( - shouldUseMaterialRoute: RouteGenerator.useMaterialPageRoute, - builder: (_) => LockscreenView( - showBackButton: true, - routeOnSuccess: RestoreFromEncryptedStringView.routeName, - routeOnSuccessArguments: encrypted, - biometricsCancelButtonString: "CANCEL", - biometricsLocalizedReason: - "Authenticate to restore ${AppConfig.appName} backup", - biometricsAuthenticationTitle: "Restore ${AppConfig.prefix} backup", + unawaited( + Navigator.push( + navigatorKey.currentContext!, + RouteGenerator.getRoute( + shouldUseMaterialRoute: RouteGenerator.useMaterialPageRoute, + builder: (_) => LockscreenView( + showBackButton: true, + routeOnSuccess: RestoreFromEncryptedStringView.routeName, + routeOnSuccessArguments: encrypted, + biometricsCancelButtonString: "CANCEL", + biometricsLocalizedReason: + "Authenticate to restore ${AppConfig.appName} backup", + biometricsAuthenticationTitle: + "Restore ${AppConfig.prefix} backup", + ), + settings: const RouteSettings(name: "/swbrestorelockscreen"), ), - settings: const RouteSettings(name: "/swbrestorelockscreen"), ), - )); + ); } } @@ -659,7 +671,8 @@ class _MaterialAppWithThemeState extends ConsumerState foregroundColor: MaterialStateProperty.all(colorScheme.buttonTextSecondary), backgroundColor: MaterialStateProperty.all( - colorScheme.buttonBackSecondary), + colorScheme.buttonBackSecondary, + ), shape: MaterialStateProperty.all( RoundedRectangleBorder( // 1000 to be relatively sure it keeps its pill shape diff --git a/lib/models/add_wallet_list_entity/sub_classes/eth_token_entity.dart b/lib/models/add_wallet_list_entity/sub_classes/eth_token_entity.dart index 5980b6503..ef0074dd4 100644 --- a/lib/models/add_wallet_list_entity/sub_classes/eth_token_entity.dart +++ b/lib/models/add_wallet_list_entity/sub_classes/eth_token_entity.dart @@ -10,7 +10,6 @@ import '../add_wallet_list_entity.dart'; import '../../isar/models/ethereum/eth_contract.dart'; -import '../../../wallets/crypto_currency/coins/ethereum.dart'; import '../../../wallets/crypto_currency/crypto_currency.dart'; class EthTokenEntity extends AddWalletListEntity { diff --git a/lib/models/balance.dart b/lib/models/balance.dart index 66eb6ab92..968041254 100644 --- a/lib/models/balance.dart +++ b/lib/models/balance.dart @@ -72,7 +72,8 @@ class Balance { ), pendingSpendable: decoded["pendingSpendable"] is String ? Amount.fromSerializedJsonString( - decoded["pendingSpendable"] as String) + decoded["pendingSpendable"] as String, + ) : Amount( rawValue: BigInt.from(decoded["pendingSpendable"] as int), fractionDigits: deprecatedValue, diff --git a/lib/models/buy/response_objects/fiat.dart b/lib/models/buy/response_objects/fiat.dart index f8a425836..3b8579ffa 100644 --- a/lib/models/buy/response_objects/fiat.dart +++ b/lib/models/buy/response_objects/fiat.dart @@ -23,11 +23,12 @@ class Fiat { /// Fiat name final Decimal maxAmount; - Fiat( - {required this.ticker, - required this.name, - required this.minAmount, - required this.maxAmount}); + Fiat({ + required this.ticker, + required this.name, + required this.minAmount, + required this.maxAmount, + }); factory Fiat.fromJson(Map json) { try { diff --git a/lib/models/buy/simplex/simplex.dart b/lib/models/buy/simplex/simplex.dart index 15d71eeb6..a787d2747 100644 --- a/lib/models/buy/simplex/simplex.dart +++ b/lib/models/buy/simplex/simplex.dart @@ -9,6 +9,7 @@ */ import 'package:decimal/decimal.dart'; + import '../response_objects/crypto.dart'; import '../response_objects/fiat.dart'; import '../response_objects/order.dart'; @@ -20,7 +21,8 @@ class Simplex { SimplexQuote quote = SimplexQuote( crypto: Crypto.fromJson({'ticker': 'BTC', 'name': 'Bitcoin', 'image': ''}), fiat: Fiat.fromJson( - {'ticker': 'USD', 'name': 'United States Dollar', 'image': ''}), + {'ticker': 'USD', 'name': 'United States Dollar', 'image': ''}, + ), youPayFiatPrice: Decimal.parse("100"), youReceiveCryptoAmount: Decimal.parse("1.0238917"), id: "someID", @@ -28,20 +30,22 @@ class Simplex { buyWithFiat: true, ); SimplexOrder order = SimplexOrder( - quote: SimplexQuote( - crypto: - Crypto.fromJson({'ticker': 'BTC', 'name': 'Bitcoin', 'image': ''}), - fiat: Fiat.fromJson( - {'ticker': 'USD', 'name': 'United States Dollar', 'image': ''}), - youPayFiatPrice: Decimal.parse("100"), - youReceiveCryptoAmount: Decimal.parse("1.0238917"), - id: "someID", - receivingAddress: '', - buyWithFiat: true, + quote: SimplexQuote( + crypto: + Crypto.fromJson({'ticker': 'BTC', 'name': 'Bitcoin', 'image': ''}), + fiat: Fiat.fromJson( + {'ticker': 'USD', 'name': 'United States Dollar', 'image': ''}, ), - orderId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee', - paymentId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee', - userId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee'); + youPayFiatPrice: Decimal.parse("100"), + youReceiveCryptoAmount: Decimal.parse("1.0238917"), + id: "someID", + receivingAddress: '', + buyWithFiat: true, + ), + orderId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee', + paymentId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee', + userId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee', + ); void updateSupportedCryptos(List newCryptos) { supportedCryptos = newCryptos; diff --git a/lib/models/contact.dart b/lib/models/contact.dart index 46cea2a76..91ac1be5e 100644 --- a/lib/models/contact.dart +++ b/lib/models/contact.dart @@ -44,13 +44,13 @@ class Contact { List? addresses, bool? isFavorite, }) { - List _addresses = []; + final List _addresses = []; if (addresses == null) { - for (var e in this.addresses) { + for (final e in this.addresses) { _addresses.add(e.copyWith()); } } else { - for (var e in addresses) { + for (final e in addresses) { _addresses.add(e.copyWith()); } } diff --git a/lib/models/epicbox_config_model.dart b/lib/models/epicbox_config_model.dart index 55650f11e..4d22dadd7 100644 --- a/lib/models/epicbox_config_model.dart +++ b/lib/models/epicbox_config_model.dart @@ -11,6 +11,7 @@ import 'dart:convert'; import 'package:hive/hive.dart'; + import 'epicbox_server_model.dart'; part 'type_adaptors/epicbox_config_model.g.dart'; @@ -57,7 +58,7 @@ class EpicBoxConfigModel { } Map toMap() { - Map map = {}; + final Map map = {}; map['epicbox_domain'] = host; map['epicbox_port'] = port; map['epicbox_protocol_insecure'] = protocolInsecure; @@ -84,7 +85,7 @@ class EpicBoxConfigModel { } static EpicBoxConfigModel fromString(String epicBoxConfigString) { - dynamic _epicBox = json.decode(epicBoxConfigString); + final dynamic _epicBox = json.decode(epicBoxConfigString); // handle old epicbox config formats final oldDomain = _epicBox["domain"] ?? "empty"; @@ -117,8 +118,11 @@ class EpicBoxConfigModel { ); } - static EpicBoxConfigModel fromServer(EpicBoxServerModel server, - {bool? protocolInsecure, int? addressIndex}) { + static EpicBoxConfigModel fromServer( + EpicBoxServerModel server, { + bool? protocolInsecure, + int? addressIndex, + }) { return EpicBoxConfigModel( host: server.host, port: server.port ?? 443, diff --git a/lib/models/epicbox_server_model.dart b/lib/models/epicbox_server_model.dart index ec8f6cd8e..810168943 100644 --- a/lib/models/epicbox_server_model.dart +++ b/lib/models/epicbox_server_model.dart @@ -64,7 +64,7 @@ class EpicBoxServerModel { } Map toMap() { - Map map = {}; + final Map map = {}; map['id'] = id; map['host'] = host; map['port'] = port; diff --git a/lib/models/exchange/change_now/estimated_exchange_amount.dart b/lib/models/exchange/change_now/estimated_exchange_amount.dart index 8313e686b..550b39489 100644 --- a/lib/models/exchange/change_now/estimated_exchange_amount.dart +++ b/lib/models/exchange/change_now/estimated_exchange_amount.dart @@ -9,6 +9,7 @@ */ import 'package:decimal/decimal.dart'; + import '../../../utilities/logger.dart'; class EstimatedExchangeAmount { @@ -45,8 +46,10 @@ class EstimatedExchangeAmount { factory EstimatedExchangeAmount.fromJson(Map json) { try { return EstimatedExchangeAmount( - estimatedAmount: Decimal.parse(json["estimatedAmount"]?.toString() ?? - json["estimatedDeposit"].toString()), + estimatedAmount: Decimal.parse( + json["estimatedAmount"]?.toString() ?? + json["estimatedDeposit"].toString(), + ), transactionSpeedForecast: json["transactionSpeedForecast"] as String? ?? "", warningMessage: json["warningMessage"] as String?, diff --git a/lib/models/exchange/change_now/exchange_transaction.dart b/lib/models/exchange/change_now/exchange_transaction.dart index e19d1c9c8..6bd514546 100644 --- a/lib/models/exchange/change_now/exchange_transaction.dart +++ b/lib/models/exchange/change_now/exchange_transaction.dart @@ -10,13 +10,15 @@ import 'package:decimal/decimal.dart'; import 'package:hive/hive.dart'; -import 'exchange_transaction_status.dart'; import 'package:uuid/uuid.dart'; +import 'exchange_transaction_status.dart'; + part '../../type_adaptors/exchange_transaction.g.dart'; @Deprecated( - "Do not use. Migrated to Trade in db_version_migration to hive_data_version 2") + "Do not use. Migrated to Trade in db_version_migration to hive_data_version 2", +) // @HiveType(typeId: 13) class ExchangeTransaction { /// You can use it to get transaction status at the Transaction status API endpoint @@ -114,7 +116,8 @@ class ExchangeTransaction { statusString: json["statusString"] as String? ?? "", statusObject: json["statusObject"] is Map ? ExchangeTransactionStatus.fromJson( - json["statusObject"] as Map) + json["statusObject"] as Map, + ) : null, ); } catch (e) { diff --git a/lib/models/exchange/change_now/exchange_transaction_status.dart b/lib/models/exchange/change_now/exchange_transaction_status.dart index 679d1af13..3c3aebb7f 100644 --- a/lib/models/exchange/change_now/exchange_transaction_status.dart +++ b/lib/models/exchange/change_now/exchange_transaction_status.dart @@ -9,6 +9,7 @@ */ import 'package:hive/hive.dart'; + import '../../../utilities/logger.dart'; part '../../type_adaptors/exchange_transaction_status.g.dart'; @@ -38,7 +39,8 @@ ChangeNowTransactionStatus changeNowTransactionStatusFromStringIgnoreCase( } } throw ArgumentError( - "String value does not match any known ChangeNowTransactionStatus"); + "String value does not match any known ChangeNowTransactionStatus", + ); } @HiveType(typeId: 16) @@ -189,7 +191,8 @@ class ExchangeTransactionStatus { try { return ExchangeTransactionStatus( status: changeNowTransactionStatusFromStringIgnoreCase( - json["status"] as String), + json["status"] as String, + ), payinAddress: json["payinAddress"] as String? ?? "", payoutAddress: json["payoutAddress"] as String? ?? "", fromCurrency: json["fromCurrency"] as String? ?? "", diff --git a/lib/models/exchange/majestic_bank/mb_rate.dart b/lib/models/exchange/majestic_bank/mb_rate.dart index c4b5d2b8a..7602a1725 100644 --- a/lib/models/exchange/majestic_bank/mb_rate.dart +++ b/lib/models/exchange/majestic_bank/mb_rate.dart @@ -9,10 +9,15 @@ */ import 'package:decimal/decimal.dart'; + import 'mb_object.dart'; class MBRate extends MBObject { - MBRate({required this.fromCurrency, required this.toCurrency, required this.rate,}); + MBRate({ + required this.fromCurrency, + required this.toCurrency, + required this.rate, + }); final String fromCurrency; final String toCurrency; diff --git a/lib/models/exchange/response_objects/trade.dart b/lib/models/exchange/response_objects/trade.dart index 86adb0bee..03685a0ab 100644 --- a/lib/models/exchange/response_objects/trade.dart +++ b/lib/models/exchange/response_objects/trade.dart @@ -9,8 +9,9 @@ */ import 'package:hive/hive.dart'; -import '../change_now/exchange_transaction.dart'; + import '../../../services/exchange/change_now/change_now_exchange.dart'; +import '../change_now/exchange_transaction.dart'; part 'trade.g.dart'; @@ -213,7 +214,9 @@ class Trade { } factory Trade.fromExchangeTransaction( - ExchangeTransaction exTx, bool reversed) { + ExchangeTransaction exTx, + bool reversed, + ) { return Trade( uuid: exTx.uuid, tradeId: exTx.id, diff --git a/lib/models/exchange/simpleswap/sp_currency.dart b/lib/models/exchange/simpleswap/sp_currency.dart index 04a77de67..96905f44c 100644 --- a/lib/models/exchange/simpleswap/sp_currency.dart +++ b/lib/models/exchange/simpleswap/sp_currency.dart @@ -59,8 +59,10 @@ class SPCurrency { warningsTo: json["warnings_to"] as List, ); } catch (e, s) { - Logging.instance.log("SPCurrency.fromJson failed to parse: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "SPCurrency.fromJson failed to parse: $e\n$s", + level: LogLevel.Error, + ); rethrow; } } diff --git a/lib/models/isar/exchange_cache/currency.dart b/lib/models/isar/exchange_cache/currency.dart index 71c7890ce..29fed140d 100644 --- a/lib/models/isar/exchange_cache/currency.dart +++ b/lib/models/isar/exchange_cache/currency.dart @@ -23,10 +23,12 @@ class Currency { final String exchangeName; /// Currency ticker - @Index(composite: [ - CompositeIndex("exchangeName"), - CompositeIndex("name"), - ]) + @Index( + composite: [ + CompositeIndex("exchangeName"), + CompositeIndex("name"), + ], + ) final String ticker; /// Currency name diff --git a/lib/models/isar/exchange_cache/pair.dart b/lib/models/isar/exchange_cache/pair.dart index 4630a192e..923aeb26e 100644 --- a/lib/models/isar/exchange_cache/pair.dart +++ b/lib/models/isar/exchange_cache/pair.dart @@ -29,10 +29,12 @@ class Pair { @Index() final String exchangeName; - @Index(composite: [ - CompositeIndex("exchangeName"), - CompositeIndex("to"), - ]) + @Index( + composite: [ + CompositeIndex("exchangeName"), + CompositeIndex("to"), + ], + ) final String from; final String to; diff --git a/lib/models/isar/models/blockchain_data/transaction.dart b/lib/models/isar/models/blockchain_data/transaction.dart index 73d935681..d5b3572fe 100644 --- a/lib/models/isar/models/blockchain_data/transaction.dart +++ b/lib/models/isar/models/blockchain_data/transaction.dart @@ -12,11 +12,12 @@ import 'dart:convert'; import 'dart:math'; import 'package:isar/isar.dart'; +import 'package:tuple/tuple.dart'; + +import '../../../../utilities/amount/amount.dart'; import 'address.dart'; import 'input.dart'; import 'output.dart'; -import '../../../../utilities/amount/amount.dart'; -import 'package:tuple/tuple.dart'; part 'transaction.g.dart'; @@ -65,24 +66,24 @@ class Transaction { }) { return Tuple2( Transaction( - walletId: walletId ?? this.walletId, - txid: txid ?? this.txid, - timestamp: timestamp ?? this.timestamp, - type: type ?? this.type, - subType: subType ?? this.subType, - amount: amount ?? this.amount, - amountString: amountString ?? this.amountString, - fee: fee ?? this.fee, - height: height ?? this.height, - isCancelled: isCancelled ?? this.isCancelled, - isLelantus: isLelantus ?? this.isLelantus, - slateId: slateId ?? this.slateId, - otherData: otherData ?? this.otherData, - nonce: nonce ?? this.nonce, - inputs: inputs ?? this.inputs, - outputs: outputs ?? this.outputs, - numberOfMessages: numberOfMessages ?? this.numberOfMessages) - ..id = id ?? this.id, + walletId: walletId ?? this.walletId, + txid: txid ?? this.txid, + timestamp: timestamp ?? this.timestamp, + type: type ?? this.type, + subType: subType ?? this.subType, + amount: amount ?? this.amount, + amountString: amountString ?? this.amountString, + fee: fee ?? this.fee, + height: height ?? this.height, + isCancelled: isCancelled ?? this.isCancelled, + isLelantus: isLelantus ?? this.isLelantus, + slateId: slateId ?? this.slateId, + otherData: otherData ?? this.otherData, + nonce: nonce ?? this.nonce, + inputs: inputs ?? this.inputs, + outputs: outputs ?? this.outputs, + numberOfMessages: numberOfMessages ?? this.numberOfMessages, + )..id = id ?? this.id, address ?? this.address.value, ); } diff --git a/lib/models/isar/models/blockchain_data/utxo.dart b/lib/models/isar/models/blockchain_data/utxo.dart index 3a87957f0..7bbf50896 100644 --- a/lib/models/isar/models/blockchain_data/utxo.dart +++ b/lib/models/isar/models/blockchain_data/utxo.dart @@ -38,10 +38,14 @@ class UTXO { @Index() late final String walletId; - @Index(unique: true, replace: true, composite: [ - CompositeIndex("walletId"), - CompositeIndex("vout"), - ]) + @Index( + unique: true, + replace: true, + composite: [ + CompositeIndex("walletId"), + CompositeIndex("vout"), + ], + ) late final String txid; late final int vout; diff --git a/lib/models/isar/models/blockchain_data/v2/output_v2.dart b/lib/models/isar/models/blockchain_data/v2/output_v2.dart index 45a8b1329..01bfcfb0e 100644 --- a/lib/models/isar/models/blockchain_data/v2/output_v2.dart +++ b/lib/models/isar/models/blockchain_data/v2/output_v2.dart @@ -54,7 +54,7 @@ class OutputV2 { bool isFullAmountNotSats = false, }) { try { - List addresses = []; + final List addresses = []; if (json["scriptPubKey"]?["addresses"] is List) { for (final e in json["scriptPubKey"]["addresses"] as List) { @@ -68,7 +68,7 @@ class OutputV2 { scriptPubKeyHex: json["scriptPubKey"]["hex"] as String, scriptPubKeyAsm: json["scriptPubKey"]["asm"] as String?, valueStringSats: parseOutputAmountString( - json["value"] != null ? json["value"].toString(): "0", + json["value"] != null ? json["value"].toString() : "0", decimalPlaces: decimalPlaces, isFullAmountNotSats: isFullAmountNotSats, ), diff --git a/lib/models/isar/models/log.g.dart b/lib/models/isar/models/log.g.dart index 332e91d3c..8a4cf22b1 100644 --- a/lib/models/isar/models/log.g.dart +++ b/lib/models/isar/models/log.g.dart @@ -124,12 +124,14 @@ const _LoglogLevelEnumValueMap = { r'Warning': r'Warning', r'Error': r'Error', r'Fatal': r'Fatal', + r'Debug': r'Debug', }; const _LoglogLevelValueEnumMap = { r'Info': LogLevel.Info, r'Warning': LogLevel.Warning, r'Error': LogLevel.Error, r'Fatal': LogLevel.Fatal, + r'Debug': LogLevel.Debug, }; Id _logGetId(Log object) { diff --git a/lib/models/isar/ordinal.dart b/lib/models/isar/ordinal.dart index c5c3a23da..6ac3a2dad 100644 --- a/lib/models/isar/ordinal.dart +++ b/lib/models/isar/ordinal.dart @@ -1,4 +1,5 @@ import 'package:isar/isar.dart'; + import '../../db/isar/main_db.dart'; import '../../dto/ordinals/inscription_data.dart'; import 'models/isar_models.dart'; @@ -11,10 +12,14 @@ class Ordinal { final String walletId; - @Index(unique: true, replace: true, composite: [ - CompositeIndex("utxoTXID"), - CompositeIndex("utxoVOUT"), - ]) + @Index( + unique: true, + replace: true, + composite: [ + CompositeIndex("utxoTXID"), + CompositeIndex("utxoVOUT"), + ], + ) final String inscriptionId; final int inscriptionNumber; diff --git a/lib/models/lelantus_coin.dart b/lib/models/lelantus_coin.dart index 56557c1cd..6dbce0b4a 100644 --- a/lib/models/lelantus_coin.dart +++ b/lib/models/lelantus_coin.dart @@ -40,7 +40,7 @@ class LelantusCoin { @override String toString() { - String coin = + final String coin = "{index: $index, value: $value, publicCoin: $publicCoin, txId: $txId, anonymitySetId: $anonymitySetId, isUsed: $isUsed}"; return coin; } diff --git a/lib/models/node_model.dart b/lib/models/node_model.dart index 636be9aac..a07c9a2dd 100644 --- a/lib/models/node_model.dart +++ b/lib/models/node_model.dart @@ -86,7 +86,7 @@ class NodeModel { } Map toMap() { - Map map = {}; + final Map map = {}; map['host'] = host; map['port'] = port; map['name'] = name; diff --git a/lib/models/paymint/transactions_model.dart b/lib/models/paymint/transactions_model.dart index c00f31565..6cea6f1ce 100644 --- a/lib/models/paymint/transactions_model.dart +++ b/lib/models/paymint/transactions_model.dart @@ -34,29 +34,32 @@ class TransactionData { TransactionData({this.txChunks = const []}); factory TransactionData.fromJson(Map json) { - var dateTimeChunks = json['dateTimeChunks'] as List; - List chunksList = dateTimeChunks - .map((txChunk) => - TransactionChunk.fromJson(txChunk as Map)) + final dateTimeChunks = json['dateTimeChunks'] as List; + final List chunksList = dateTimeChunks + .map( + (txChunk) => + TransactionChunk.fromJson(txChunk as Map), + ) .toList(); return TransactionData(txChunks: chunksList); } factory TransactionData.fromMap(Map transactions) { - Map> chunks = {}; + final Map> chunks = {}; transactions.forEach((key, value) { - String date = extractDateFromTimestamp(value.timestamp); + final String date = extractDateFromTimestamp(value.timestamp); if (!chunks.containsKey(date)) { chunks[date] = []; } chunks[date]!.add(value); }); - List chunksList = []; + final List chunksList = []; chunks.forEach((key, value) { value.sort((a, b) => b.timestamp.compareTo(a.timestamp)); chunksList.add( - TransactionChunk(timestamp: value[0].timestamp, transactions: value)); + TransactionChunk(timestamp: value[0].timestamp, transactions: value), + ); }); chunksList.sort((a, b) => b.timestamp.compareTo(a.timestamp)); return TransactionData(txChunks: chunksList); @@ -64,9 +67,9 @@ class TransactionData { Transaction? findTransaction(String txid) { for (var i = 0; i < txChunks.length; i++) { - var txChunk = txChunks[i].transactions; + final txChunk = txChunks[i].transactions; for (var j = 0; j < txChunk.length; j++) { - var tx = txChunk[j]; + final tx = txChunk[j]; if (tx.txid == txid) { return tx; } @@ -76,11 +79,11 @@ class TransactionData { } Map getAllTransactions() { - Map transactions = {}; + final Map transactions = {}; for (var i = 0; i < txChunks.length; i++) { - var txChunk = txChunks[i].transactions; + final txChunk = txChunks[i].transactions; for (var j = 0; j < txChunk.length; j++) { - var tx = txChunk[j]; + final tx = txChunk[j]; transactions[tx.txid] = tx; } } @@ -98,14 +101,15 @@ class TransactionChunk { TransactionChunk({required this.timestamp, required this.transactions}); factory TransactionChunk.fromJson(Map json) { - var txArray = json['transactions'] as List; - List txList = txArray + final txArray = json['transactions'] as List; + final List txList = txArray .map((tx) => Transaction.fromJson(tx as Map)) .toList(); return TransactionChunk( - timestamp: int.parse(json['timestamp'].toString()), - transactions: txList); + timestamp: int.parse(json['timestamp'].toString()), + transactions: txList, + ); } @override @@ -191,15 +195,16 @@ class Transaction { }); factory Transaction.fromJson(Map json) { - var inputArray = json['inputs'] as List; - var outputArray = json['outputs'] as List; + final inputArray = json['inputs'] as List; + final outputArray = json['outputs'] as List; - List inputList = inputArray + final List inputList = inputArray .map((input) => Input.fromJson(Map.from(input as Map))) .toList(); - List outputList = outputArray - .map((output) => - Output.fromJson(Map.from(output as Map))) + final List outputList = outputArray + .map( + (output) => Output.fromJson(Map.from(output as Map)), + ) .toList(); return Transaction( @@ -304,7 +309,7 @@ class Transaction { @override String toString() { - String transaction = + final String transaction = "{txid: $txid, type: $txType, subType: $subType, value: $amount, fee: $fees, height: $height, confirm: $confirmedStatus, confirmations: $confirmations, address: $address, timestamp: $timestamp, worthNow: $worthNow, inputs: $inputs, slateid: $slateId, numberOfMessages: $numberOfMessages }"; return transaction; } @@ -344,7 +349,7 @@ class Input { }); factory Input.fromJson(Map json) { - bool iscoinBase = json['coinbase'] != null; + final bool iscoinBase = json['coinbase'] != null; return Input( txid: json['txid'] as String? ?? "", vout: json['vout'] as int? ?? -1, @@ -361,7 +366,7 @@ class Input { @override String toString() { - String transaction = "{txid: $txid}"; + final String transaction = "{txid: $txid}"; return transaction; } } @@ -383,12 +388,13 @@ class Output { // @HiveField(4) final int value; - Output( - {this.scriptpubkey, - this.scriptpubkeyAsm, - this.scriptpubkeyType, - required this.scriptpubkeyAddress, - required this.value}); + Output({ + this.scriptpubkey, + this.scriptpubkeyAsm, + this.scriptpubkeyType, + required this.scriptpubkeyAddress, + required this.value, + }); factory Output.fromJson(Map json) { // TODO determine if any of this code is needed. @@ -405,12 +411,13 @@ class Output { ); } catch (s, e) { return Output( - // Return output object with null values; allows wallet history to be built - scriptpubkey: "", - scriptpubkeyAsm: "", - scriptpubkeyType: "", - scriptpubkeyAddress: "", - value: _parse(0.toString())); + // Return output object with null values; allows wallet history to be built + scriptpubkey: "", + scriptpubkeyAsm: "", + scriptpubkeyType: "", + scriptpubkeyAddress: "", + value: _parse(0.toString()), + ); } } } diff --git a/lib/models/paymint/utxo_model.dart b/lib/models/paymint/utxo_model.dart index 07f2c0e69..5a8ccffaa 100644 --- a/lib/models/paymint/utxo_model.dart +++ b/lib/models/paymint/utxo_model.dart @@ -35,8 +35,8 @@ class UtxoData { }); factory UtxoData.fromJson(Map json) { - var outputList = json['outputArray'] as List; - List utxoList = outputList + final outputList = json['outputArray'] as List; + final List utxoList = outputList .map((output) => UtxoObject.fromJson(output as Map)) .toList(); final String totalUserCurr = json['total_user_currency'] as String? ?? ""; @@ -104,7 +104,7 @@ class UtxoObject { @override String toString() { - String utxo = + final String utxo = "{txid: $txid, vout: $vout, value: $value, fiat: $fiatWorth, blocked: $blocked, status: $status, is_coinbase: $isCoinbase}"; return utxo; diff --git a/lib/models/paynym/paynym_account.dart b/lib/models/paynym/paynym_account.dart index 184f8c8aa..4d44d43fc 100644 --- a/lib/models/paynym/paynym_account.dart +++ b/lib/models/paynym/paynym_account.dart @@ -44,12 +44,16 @@ class PaynymAccount { .map((e) => PaynymCode.fromMap(Map.from(e as Map))) .toList(), followers = (map["followers"] as List) - .map((e) => - PaynymAccountLite.fromMap(Map.from(e as Map))) + .map( + (e) => PaynymAccountLite.fromMap( + Map.from(e as Map)), + ) .toList(), following = (map["following"] as List) - .map((e) => - PaynymAccountLite.fromMap(Map.from(e as Map))) + .map( + (e) => PaynymAccountLite.fromMap( + Map.from(e as Map)), + ) .toList(); PaynymAccount copyWith({ diff --git a/lib/models/paynym/paynym_follow.dart b/lib/models/paynym/paynym_follow.dart index 73fbdb2e8..76c903bee 100644 --- a/lib/models/paynym/paynym_follow.dart +++ b/lib/models/paynym/paynym_follow.dart @@ -21,13 +21,13 @@ class PaynymFollow { token = map["token"] as String; Map toMap() => { - "follower": follower, - "following": following, - "token": token, - }; + "follower": follower, + "following": following, + "token": token, + }; @override String toString() { return toMap().toString(); } -} \ No newline at end of file +} diff --git a/lib/models/stack_restoring_ui_state.dart b/lib/models/stack_restoring_ui_state.dart index 6ee4e9e1b..39a8f4f4b 100644 --- a/lib/models/stack_restoring_ui_state.dart +++ b/lib/models/stack_restoring_ui_state.dart @@ -10,9 +10,10 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'wallet_restore_state.dart'; + import '../utilities/enums/stack_restoring_status.dart'; import '../wallets/wallet/wallet.dart'; +import 'wallet_restore_state.dart'; class StackRestoringUIState extends ChangeNotifier { bool _walletsWasSet = false; @@ -94,7 +95,7 @@ class StackRestoringUIState extends ChangeNotifier { } List get wallets { - List _wallets = []; + final List _wallets = []; for (final item in _walletStates.values) { if (item.wallet != null) { _wallets.add(item.wallet!); @@ -125,7 +126,8 @@ class StackRestoringUIState extends ChangeNotifier { } ChangeNotifierProvider getWalletRestoreStateProvider( - String walletId) { + String walletId, + ) { return _walletStateProviders[walletId]!; } diff --git a/lib/notifications/notification_card.dart b/lib/notifications/notification_card.dart index feb81ce54..217608225 100644 --- a/lib/notifications/notification_card.dart +++ b/lib/notifications/notification_card.dart @@ -13,6 +13,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../app_config.dart'; import '../models/isar/stack_theme.dart'; import '../models/notification_model.dart'; @@ -28,9 +29,9 @@ import '../widgets/rounded_white_container.dart'; class NotificationCard extends ConsumerWidget { const NotificationCard({ - Key? key, + super.key, required this.notification, - }) : super(key: key); + }); final NotificationModel notification; @@ -71,10 +72,11 @@ class NotificationCard extends ConsumerWidget { ? SvgPicture.file( File( coinIconPath( - ref.watch( - themeAssetsProvider, - ), - ref), + ref.watch( + themeAssetsProvider, + ), + ref, + ), ), width: isDesktop ? desktopIconSize : mobileIconSize, height: isDesktop ? desktopIconSize : mobileIconSize, @@ -89,10 +91,11 @@ class NotificationCard extends ConsumerWidget { child: SvgPicture.file( File( coinIconPath( - ref.watch( - themeAssetsProvider, - ), - ref), + ref.watch( + themeAssetsProvider, + ), + ref, + ), ), color: Theme.of(context) .extension()! @@ -123,7 +126,7 @@ class NotificationCard extends ConsumerWidget { .extension()! .accentColorGreen, ), - ) + ), ], ), child: Text( diff --git a/lib/pages/TermsOfServiceView.dart b/lib/pages/TermsOfServiceView.dart index 64258b24f..0cea952f7 100644 --- a/lib/pages/TermsOfServiceView.dart +++ b/lib/pages/TermsOfServiceView.dart @@ -11,7 +11,7 @@ import 'package:flutter/material.dart'; class TermsOfServiceView extends StatelessWidget { - const TermsOfServiceView({Key? key}) : super(key: key); + const TermsOfServiceView({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/pages/add_wallet_views/add_token_view/add_custom_token_view.dart b/lib/pages/add_wallet_views/add_token_view/add_custom_token_view.dart index 155d741b7..210fc954f 100644 --- a/lib/pages/add_wallet_views/add_token_view/add_custom_token_view.dart +++ b/lib/pages/add_wallet_views/add_token_view/add_custom_token_view.dart @@ -13,6 +13,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../models/isar/models/ethereum/eth_contract.dart'; import '../../../services/ethereum/ethereum_api.dart'; import '../../../themes/stack_colors.dart'; @@ -29,8 +30,8 @@ import '../../../widgets/stack_dialog.dart'; class AddCustomTokenView extends ConsumerStatefulWidget { const AddCustomTokenView({ - Key? key, - }) : super(key: key); + super.key, + }); static const routeName = "/addCustomToken"; @@ -138,7 +139,8 @@ class _AddCustomTokenViewState extends ConsumerState { onPressed: () async { final response = await showLoading( whileFuture: EthereumAPI.getTokenContractInfoByAddress( - contractController.text), + contractController.text, + ), context: context, message: "Looking up contract", ); @@ -212,10 +214,12 @@ class _AddCustomTokenViewState extends ConsumerState { controller: decimalsController, style: STextStyles.field(context), inputFormatters: [ - TextInputFormatter.withFunction((oldValue, newValue) => - RegExp(r'^([0-9]*)$').hasMatch(newValue.text) - ? newValue - : oldValue), + TextInputFormatter.withFunction( + (oldValue, newValue) => + RegExp(r'^([0-9]*)$').hasMatch(newValue.text) + ? newValue + : oldValue, + ), ], keyboardType: const TextInputType.numberWithOptions( signed: false, @@ -253,10 +257,12 @@ class _AddCustomTokenViewState extends ConsumerState { controller: decimalsController, style: STextStyles.field(context), inputFormatters: [ - TextInputFormatter.withFunction((oldValue, newValue) => - RegExp(r'^([0-9]*)$').hasMatch(newValue.text) - ? newValue - : oldValue), + TextInputFormatter.withFunction( + (oldValue, newValue) => + RegExp(r'^([0-9]*)$').hasMatch(newValue.text) + ? newValue + : oldValue, + ), ], keyboardType: const TextInputType.numberWithOptions( signed: false, diff --git a/lib/pages/add_wallet_views/add_token_view/edit_wallet_tokens_view.dart b/lib/pages/add_wallet_views/add_token_view/edit_wallet_tokens_view.dart index 4a54b9b3d..46fa6f333 100644 --- a/lib/pages/add_wallet_views/add_token_view/edit_wallet_tokens_view.dart +++ b/lib/pages/add_wallet_views/add_token_view/edit_wallet_tokens_view.dart @@ -14,14 +14,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; + import '../../../db/isar/main_db.dart'; import '../../../models/isar/models/ethereum/eth_contract.dart'; import '../../../notifications/show_flush_bar.dart'; -import 'add_custom_token_view.dart'; -import 'sub_widgets/add_token_list.dart'; -import 'sub_widgets/add_token_list_element.dart'; -import 'sub_widgets/add_token_text.dart'; -import '../../home_view/home_view.dart'; import '../../../pages_desktop_specific/desktop_home_view.dart'; import '../../../providers/global/price_provider.dart'; import '../../../providers/global/wallets_provider.dart'; @@ -46,14 +42,19 @@ import '../../../widgets/icon_widgets/x_icon.dart'; import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/stack_text_field.dart'; import '../../../widgets/textfield_icon_button.dart'; +import '../../home_view/home_view.dart'; +import 'add_custom_token_view.dart'; +import 'sub_widgets/add_token_list.dart'; +import 'sub_widgets/add_token_list_element.dart'; +import 'sub_widgets/add_token_text.dart'; class EditWalletTokensView extends ConsumerStatefulWidget { const EditWalletTokensView({ - Key? key, + super.key, required this.walletId, this.contractsToMarkSelected, this.isDesktopPopup = false, - }) : super(key: key); + }); final String walletId; final List? contractsToMarkSelected; @@ -178,7 +179,8 @@ class _EditWalletTokensViewState extends ConsumerState { if (contracts.isEmpty) { contracts.addAll(DefaultTokens.list); MainDB.instance.putEthContracts(contracts).then( - (_) => ref.read(priceAnd24hChangeNotifierProvider).updatePrice()); + (_) => ref.read(priceAnd24hChangeNotifierProvider).updatePrice(), + ); } tokenEntities.addAll(contracts.map((e) => AddTokenListElementData(e))); @@ -241,7 +243,8 @@ class _EditWalletTokensViewState extends ConsumerState { "Add custom token", style: STextStyles.desktopButtonSmallSecondaryEnabled( - context), + context, + ), ), ), ), diff --git a/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_custom_token_selector.dart b/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_custom_token_selector.dart index 0274a99f3..cf1b48e4f 100644 --- a/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_custom_token_selector.dart +++ b/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_custom_token_selector.dart @@ -18,9 +18,9 @@ import '../../../../utilities/util.dart'; class AddCustomTokenSelector extends StatelessWidget { const AddCustomTokenSelector({ - Key? key, + super.key, required this.addFunction, - }) : super(key: key); + }); final VoidCallback addFunction; diff --git a/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_list.dart b/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_list.dart index 19e4e833a..23bfb36c2 100644 --- a/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_list.dart +++ b/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_list.dart @@ -15,11 +15,11 @@ import '../../../../widgets/conditional_parent.dart'; class AddTokenList extends StatelessWidget { const AddTokenList({ - Key? key, + super.key, required this.walletId, required this.items, required this.addFunction, - }) : super(key: key); + }); final String walletId; final List items; diff --git a/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_text.dart b/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_text.dart index d92e210f1..481c052cc 100644 --- a/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_text.dart +++ b/lib/pages/add_wallet_views/add_token_view/sub_widgets/add_token_text.dart @@ -13,10 +13,10 @@ import '../../../../utilities/text_styles.dart'; class AddTokenText extends StatelessWidget { const AddTokenText({ - Key? key, + super.key, required this.isDesktop, this.walletName, - }) : super(key: key); + }); final String? walletName; final bool isDesktop; diff --git a/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart b/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart index 86c45d807..57f707700 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart @@ -9,7 +9,6 @@ */ import 'dart:async'; -import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -132,11 +131,6 @@ class _AddWalletViewState extends ConsumerState { _searchFieldController = TextEditingController(); _searchFocusNode = FocusNode(); // _coinsTestnet.remove(Coin.firoTestNet); - if (Platform.isWindows) { - _coins.removeWhere((e) => e is Monero || e is Wownero); - } else if (Platform.isLinux) { - _coins.removeWhere((e) => e is Wownero); - } if (Util.isDesktop && !kDebugMode) { _coins.removeWhere((e) => e is BitcoinFrost); @@ -154,8 +148,10 @@ class _AddWalletViewState extends ConsumerState { if (contracts.isEmpty) { contracts.addAll(DefaultTokens.list); - MainDB.instance.putEthContracts(contracts).then((value) => - ref.read(priceAnd24hChangeNotifierProvider).updatePrice()); + MainDB.instance.putEthContracts(contracts).then( + (value) => + ref.read(priceAnd24hChangeNotifierProvider).updatePrice(), + ); } tokenEntities.addAll(contracts.map((e) => EthTokenEntity(e))); @@ -354,63 +350,63 @@ class _AddWalletViewState extends ConsumerState { height: 16, ), ClipRRect( - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - child: Semantics( - label: - "Search Text Field. Inputs Text To Search In Wallets.", - excludeSemantics: true, - child: TextField( - autofocus: isDesktop, - autocorrect: !isDesktop, - enableSuggestions: !isDesktop, - controller: _searchFieldController, - focusNode: _searchFocusNode, - onChanged: (value) => - setState(() => _searchTerm = value), - style: STextStyles.field(context), - decoration: standardInputDecoration( - "Search", - _searchFocusNode, - context, - desktopMed: isDesktop, - ).copyWith( - prefixIcon: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 16, - ), - child: SvgPicture.asset( - Assets.svg.search, - width: 16, - height: 16, - ), + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + child: Semantics( + label: + "Search Text Field. Inputs Text To Search In Wallets.", + excludeSemantics: true, + child: TextField( + autofocus: isDesktop, + autocorrect: !isDesktop, + enableSuggestions: !isDesktop, + controller: _searchFieldController, + focusNode: _searchFocusNode, + onChanged: (value) => + setState(() => _searchTerm = value), + style: STextStyles.field(context), + decoration: standardInputDecoration( + "Search", + _searchFocusNode, + context, + desktopMed: isDesktop, + ).copyWith( + prefixIcon: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 16, + ), + child: SvgPicture.asset( + Assets.svg.search, + width: 16, + height: 16, ), - suffixIcon: _searchFieldController.text.isNotEmpty - ? Padding( - padding: const EdgeInsets.only(right: 0), - child: UnconstrainedBox( - child: Row( - children: [ - TextFieldIconButton( - child: const XIcon(), - onTap: () async { - setState(() { - _searchFieldController.text = - ""; - _searchTerm = ""; - }); - }, - ), - ], - ), - ), - ) - : null, ), + suffixIcon: _searchFieldController.text.isNotEmpty + ? Padding( + padding: const EdgeInsets.only(right: 0), + child: UnconstrainedBox( + child: Row( + children: [ + TextFieldIconButton( + child: const XIcon(), + onTap: () async { + setState(() { + _searchFieldController.text = ""; + _searchTerm = ""; + }); + }, + ), + ], + ), + ), + ) + : null, ), - )), + ), + ), + ), const SizedBox( height: 10, ), diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_entity_list.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_entity_list.dart index 2be9e6e7f..5ec69997d 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_entity_list.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_entity_list.dart @@ -14,10 +14,10 @@ import 'coin_select_item.dart'; class AddWalletEntityList extends StatelessWidget { const AddWalletEntityList({ - Key? key, + super.key, required this.entities, this.trailing, - }) : super(key: key); + }); final List entities; final Widget? trailing; diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/expanding_sub_list_item.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/expanding_sub_list_item.dart index 1affe8787..d934526b8 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/expanding_sub_list_item.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/expanding_sub_list_item.dart @@ -10,27 +10,27 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../../models/add_wallet_list_entity/add_wallet_list_entity.dart'; -import 'add_wallet_entity_list.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; import '../../../../utilities/text_styles.dart'; import '../../../../utilities/util.dart'; import '../../../../widgets/animated_widgets/rotate_icon.dart'; import '../../../../widgets/expandable.dart'; +import 'add_wallet_entity_list.dart'; class ExpandingSubListItem extends StatefulWidget { const ExpandingSubListItem({ - Key? key, + super.key, required this.title, required this.entities, this.trailing, required this.initialState, double? animationDurationMultiplier, this.curve = Curves.easeInOutCubicEmphasized, - }) : animationDurationMultiplier = - animationDurationMultiplier ?? entities.length * 0.11, - super(key: key); + }) : animationDurationMultiplier = + animationDurationMultiplier ?? entities.length * 0.11; final String title; final List entities; diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart index 56b5fa258..4447cc7a9 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart @@ -19,9 +19,9 @@ import '../../../../utilities/text_styles.dart'; class AddWalletNextButton extends ConsumerWidget { const AddWalletNextButton({ - Key? key, + super.key, required this.isDesktop, - }) : super(key: key); + }); final bool isDesktop; diff --git a/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_subtitle.dart b/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_subtitle.dart index d66ded246..ddd106a50 100644 --- a/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_subtitle.dart +++ b/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_subtitle.dart @@ -13,9 +13,9 @@ import '../../../../utilities/text_styles.dart'; class CreateRestoreWalletSubTitle extends StatelessWidget { const CreateRestoreWalletSubTitle({ - Key? key, + super.key, required this.isDesktop, - }) : super(key: key); + }); final bool isDesktop; diff --git a/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_wallet_button_group.dart b/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_wallet_button_group.dart index 1dabb24d3..e042ddcdb 100644 --- a/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_wallet_button_group.dart +++ b/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_wallet_button_group.dart @@ -8,16 +8,14 @@ * */ -import 'dart:io'; - import 'package:flutter/material.dart'; -import '../../name_your_wallet_view/name_your_wallet_view.dart'; +import 'package:tuple/tuple.dart'; + import '../../../../themes/stack_colors.dart'; import '../../../../utilities/enums/add_wallet_type_enum.dart'; import '../../../../utilities/text_styles.dart'; -import '../../../../wallets/crypto_currency/coins/wownero.dart'; import '../../../../wallets/crypto_currency/crypto_currency.dart'; -import 'package:tuple/tuple.dart'; +import '../../name_your_wallet_view/name_your_wallet_view.dart'; class CreateWalletButtonGroup extends StatelessWidget { const CreateWalletButtonGroup({ @@ -35,37 +33,35 @@ class CreateWalletButtonGroup extends StatelessWidget { crossAxisAlignment: isDesktop ? CrossAxisAlignment.center : CrossAxisAlignment.stretch, children: [ - if (Platform.isAndroid || coin is! Wownero) - ConstrainedBox( - constraints: BoxConstraints( - minHeight: isDesktop ? 70 : 0, - minWidth: isDesktop ? 480 : 0, - ), - child: TextButton( - style: Theme.of(context) - .extension()! - .getPrimaryEnabledButtonStyle(context), - onPressed: () { - Navigator.of(context).pushNamed( - NameYourWalletView.routeName, - arguments: Tuple2( - AddWalletType.New, - coin, - ), - ); - }, - child: Text( - "Create new wallet", - style: isDesktop - ? STextStyles.desktopButtonEnabled(context) - : STextStyles.button(context), - ), + ConstrainedBox( + constraints: BoxConstraints( + minHeight: isDesktop ? 70 : 0, + minWidth: isDesktop ? 480 : 0, + ), + child: TextButton( + style: Theme.of(context) + .extension()! + .getPrimaryEnabledButtonStyle(context), + onPressed: () { + Navigator.of(context).pushNamed( + NameYourWalletView.routeName, + arguments: Tuple2( + AddWalletType.New, + coin, + ), + ); + }, + child: Text( + "Create new wallet", + style: isDesktop + ? STextStyles.desktopButtonEnabled(context) + : STextStyles.button(context), ), ), - if (Platform.isAndroid || coin is! Wownero) - SizedBox( - height: isDesktop ? 16 : 12, - ), + ), + SizedBox( + height: isDesktop ? 16 : 12, + ), ConstrainedBox( constraints: BoxConstraints( minHeight: isDesktop ? 70 : 0, @@ -91,7 +87,8 @@ class CreateWalletButtonGroup extends StatelessWidget { : STextStyles.button(context).copyWith( color: Theme.of(context) .extension()! - .accentColorDark), + .accentColorDark, + ), ), ), ), diff --git a/lib/pages/add_wallet_views/frost_ms/new/select_new_frost_import_type_view.dart b/lib/pages/add_wallet_views/frost_ms/new/select_new_frost_import_type_view.dart index 3546dd964..d377eff72 100644 --- a/lib/pages/add_wallet_views/frost_ms/new/select_new_frost_import_type_view.dart +++ b/lib/pages/add_wallet_views/frost_ms/new/select_new_frost_import_type_view.dart @@ -167,7 +167,7 @@ class _SelectNewFrostImportTypeViewState FrostStepScaffold.routeName, ); }, - ) + ), ], ), ), diff --git a/lib/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_1b.dart b/lib/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_1b.dart index f38d05234..59597c659 100644 --- a/lib/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_1b.dart +++ b/lib/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_1b.dart @@ -176,7 +176,7 @@ class _FrostCreateStep1bState extends ConsumerState { .routeName, ); }, - ) + ), ], ), ); diff --git a/lib/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_4.dart b/lib/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_4.dart index b8f7aee88..0a4615280 100644 --- a/lib/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_4.dart +++ b/lib/pages/add_wallet_views/frost_ms/new/steps/frost_create_step_4.dart @@ -70,7 +70,7 @@ class _FrostCreateStep4State extends ConsumerState { .routeName, ); }, - ) + ), ], ), ); diff --git a/lib/pages/add_wallet_views/frost_ms/reshare/frost_reshare_step_1c.dart b/lib/pages/add_wallet_views/frost_ms/reshare/frost_reshare_step_1c.dart index 3514cc20d..962e207bf 100644 --- a/lib/pages/add_wallet_views/frost_ms/reshare/frost_reshare_step_1c.dart +++ b/lib/pages/add_wallet_views/frost_ms/reshare/frost_reshare_step_1c.dart @@ -222,7 +222,7 @@ class _FrostReshareStep1cState extends ConsumerState { _buttonLock = false; } }, - ) + ), ], ), ); diff --git a/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart b/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart index eb2797da6..f75328e6a 100644 --- a/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart +++ b/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart @@ -341,7 +341,7 @@ class _NameYourWalletViewState extends ConsumerState { }); } }, - ) + ), ], ), ), diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart index 510abe67d..ee80421dc 100644 --- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart +++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart @@ -40,11 +40,11 @@ import 'sub_widgets/mnemonic_table.dart'; class NewWalletRecoveryPhraseView extends ConsumerStatefulWidget { const NewWalletRecoveryPhraseView({ - Key? key, + super.key, required this.wallet, required this.mnemonic, this.clipboardInterface = const ClipboardWrapper(), - }) : super(key: key); + }); static const routeName = "/newWalletRecoveryPhrase"; @@ -91,12 +91,14 @@ class _NewWalletRecoveryPhraseViewState Future _copy() async { final words = _mnemonic; await _clipboardInterface.setData(ClipboardData(text: words.join(" "))); - unawaited(showFloatingFlushBar( - type: FlushBarType.info, - message: "Copied to clipboard", - iconAsset: Assets.svg.copy, - context: context, - )); + unawaited( + showFloatingFlushBar( + type: FlushBarType.info, + message: "Copied to clipboard", + iconAsset: Assets.svg.copy, + context: context, + ), + ); } @override @@ -238,7 +240,8 @@ class _NewWalletRecoveryPhraseViewState .background : Theme.of(context).extension()!.popupBG, borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius), + Constants.size.circularBorderRadius, + ), ), child: Padding( padding: isDesktop @@ -252,7 +255,8 @@ class _NewWalletRecoveryPhraseViewState : STextStyles.label(context).copyWith( color: Theme.of(context) .extension()! - .accentColorDark), + .accentColorDark, + ), ), ), ), @@ -300,8 +304,9 @@ class _NewWalletRecoveryPhraseViewState Text( "Copy to clipboard", style: STextStyles.desktopButtonSecondaryEnabled( - context), - ) + context, + ), + ), ], ), ), @@ -325,10 +330,12 @@ class _NewWalletRecoveryPhraseViewState .read(verifyMnemonicCorrectWordStateProvider.state) .update((state) => _mnemonic[next]); - unawaited(Navigator.of(context).pushNamed( - VerifyRecoveryPhraseView.routeName, - arguments: Tuple2(_wallet, _mnemonic), - )); + unawaited( + Navigator.of(context).pushNamed( + VerifyRecoveryPhraseView.routeName, + arguments: Tuple2(_wallet, _mnemonic), + ), + ); }, style: Theme.of(context) .extension()! diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart index 4f26fcffa..f3ccdc097 100644 --- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart +++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart @@ -13,11 +13,11 @@ import 'mnemonic_table_item.dart'; class MnemonicTable extends StatelessWidget { const MnemonicTable({ - Key? key, + super.key, required this.words, required this.isDesktop, this.itemBorderColor, - }) : super(key: key); + }); final List words; final bool isDesktop; diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table_item.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table_item.dart index c39c496d7..bb1806fad 100644 --- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table_item.dart +++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table_item.dart @@ -15,12 +15,12 @@ import '../../../../widgets/rounded_white_container.dart'; class MnemonicTableItem extends StatelessWidget { const MnemonicTableItem({ - Key? key, + super.key, required this.number, required this.word, required this.isDesktop, this.borderColor, - }) : super(key: key); + }); final int number; final String word; diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/recovery_phrase_explanation_dialog.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/recovery_phrase_explanation_dialog.dart index bb9626c67..22c2edb8e 100644 --- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/recovery_phrase_explanation_dialog.dart +++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/recovery_phrase_explanation_dialog.dart @@ -14,7 +14,7 @@ import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/stack_dialog.dart'; class RecoveryPhraseExplanationDialog extends StatelessWidget { - const RecoveryPhraseExplanationDialog({Key? key}) : super(key: key); + const RecoveryPhraseExplanationDialog({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/pages/add_wallet_views/restore_wallet_view/confirm_recovery_dialog.dart b/lib/pages/add_wallet_views/restore_wallet_view/confirm_recovery_dialog.dart index 70a519fad..fe11d3502 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/confirm_recovery_dialog.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/confirm_recovery_dialog.dart @@ -21,8 +21,7 @@ import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/stack_dialog.dart'; class ConfirmRecoveryDialog extends StatelessWidget { - const ConfirmRecoveryDialog({Key? key, required this.onConfirm}) - : super(key: key); + const ConfirmRecoveryDialog({super.key, required this.onConfirm}); final VoidCallback onConfirm; @@ -85,10 +84,10 @@ class ConfirmRecoveryDialog extends StatelessWidget { onConfirm.call(); }, ), - ) + ), ], ), - ) + ), ], ), ); diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart index 424596f1d..1ba3cef79 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart @@ -12,13 +12,8 @@ import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import '../../create_or_restore_wallet_view/sub_widgets/coin_image.dart'; -import 'sub_widgets/mobile_mnemonic_length_selector.dart'; -import 'sub_widgets/restore_from_date_picker.dart'; -import 'sub_widgets/restore_options_next_button.dart'; -import 'sub_widgets/restore_options_platform_layout.dart'; -import '../restore_wallet_view.dart'; -import '../sub_widgets/mnemonic_word_count_select_sheet.dart'; +import 'package:tuple/tuple.dart'; + import '../../../../pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart'; import '../../../../providers/ui/verify_recovery_phrase/mnemonic_word_count_state_provider.dart'; import '../../../../themes/stack_colors.dart'; @@ -27,19 +22,23 @@ import '../../../../utilities/constants.dart'; import '../../../../utilities/format.dart'; import '../../../../utilities/text_styles.dart'; import '../../../../utilities/util.dart'; -import '../../../../wallets/crypto_currency/coins/epiccash.dart'; -import '../../../../wallets/crypto_currency/coins/monero.dart'; -import '../../../../wallets/crypto_currency/coins/wownero.dart'; import '../../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../../widgets/conditional_parent.dart'; import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; +import '../../../../widgets/custom_buttons/checkbox_text_button.dart'; import '../../../../widgets/date_picker/date_picker.dart'; import '../../../../widgets/desktop/desktop_app_bar.dart'; import '../../../../widgets/desktop/desktop_scaffold.dart'; import '../../../../widgets/expandable.dart'; import '../../../../widgets/rounded_white_container.dart'; import '../../../../widgets/stack_text_field.dart'; -import 'package:tuple/tuple.dart'; +import '../../create_or_restore_wallet_view/sub_widgets/coin_image.dart'; +import '../restore_wallet_view.dart'; +import '../sub_widgets/mnemonic_word_count_select_sheet.dart'; +import 'sub_widgets/mobile_mnemonic_length_selector.dart'; +import 'sub_widgets/restore_from_date_picker.dart'; +import 'sub_widgets/restore_options_next_button.dart'; +import 'sub_widgets/restore_options_platform_layout.dart'; class RestoreOptionsView extends ConsumerStatefulWidget { const RestoreOptionsView({ @@ -74,6 +73,9 @@ class _RestoreOptionsViewState extends ConsumerState { bool get supportsMnemonicPassphrase => coin.hasMnemonicPassphraseSupport; + bool enableLelantusScanning = false; + bool get supportsLelantus => coin is Firo; + @override void initState() { walletName = widget.walletName; @@ -109,12 +111,13 @@ class _RestoreOptionsViewState extends ConsumerState { if (mounted) { await Navigator.of(context).pushNamed( RestoreWalletView.routeName, - arguments: Tuple5( + arguments: Tuple6( walletName, coin, ref.read(mnemonicWordCountStateProvider.state).state, _restoreFromDate, passwordController.text, + enableLelantusScanning, ), ); } @@ -219,7 +222,9 @@ class _RestoreOptionsViewState extends ConsumerState { SizedBox( height: isDesktop ? 40 : 24, ), - if (coin is Monero || + if ((coin is Monero && + ref.watch(mnemonicWordCountStateProvider.state).state == + 25) || coin is Epiccash || (coin is Wownero && ref.watch(mnemonicWordCountStateProvider.state).state == @@ -235,7 +240,9 @@ class _RestoreOptionsViewState extends ConsumerState { : STextStyles.smallMed12(context), textAlign: TextAlign.left, ), - if (coin is Monero || + if ((coin is Monero && + ref.watch(mnemonicWordCountStateProvider.state).state == + 25) || coin is Epiccash || (coin is Wownero && ref.watch(mnemonicWordCountStateProvider.state).state == @@ -243,7 +250,9 @@ class _RestoreOptionsViewState extends ConsumerState { SizedBox( height: isDesktop ? 16 : 8, ), - if (coin is Monero || + if ((coin is Monero && + ref.watch(mnemonicWordCountStateProvider.state).state == + 25) || coin is Epiccash || (coin is Wownero && ref.watch(mnemonicWordCountStateProvider.state).state == @@ -253,7 +262,9 @@ class _RestoreOptionsViewState extends ConsumerState { onTap: chooseDate, controller: _dateController, ), - if (coin is Monero || + if ((coin is Monero && + ref.watch(mnemonicWordCountStateProvider.state).state == + 25) || coin is Epiccash || (coin is Wownero && ref.watch(mnemonicWordCountStateProvider.state).state == @@ -264,7 +275,9 @@ class _RestoreOptionsViewState extends ConsumerState { onTap: chooseDesktopDate, controller: _dateController, ), - if (coin is Monero || + if ((coin is Monero && + ref.watch(mnemonicWordCountStateProvider.state).state == + 25) || coin is Epiccash || (coin is Wownero && ref.watch(mnemonicWordCountStateProvider.state).state == @@ -272,7 +285,9 @@ class _RestoreOptionsViewState extends ConsumerState { const SizedBox( height: 8, ), - if (coin is Monero || + if ((coin is Monero && + ref.watch(mnemonicWordCountStateProvider.state).state == + 25) || coin is Epiccash || (coin is Wownero && ref.watch(mnemonicWordCountStateProvider.state).state == @@ -293,7 +308,9 @@ class _RestoreOptionsViewState extends ConsumerState { ), ), ), - if (coin is Monero || + if ((coin is Monero && + ref.watch(mnemonicWordCountStateProvider.state).state == + 25) || coin is Epiccash || (coin is Wownero && ref.watch(mnemonicWordCountStateProvider.state).state == @@ -398,8 +415,8 @@ class _RestoreOptionsViewState extends ConsumerState { "Advanced", style: isDesktop ? STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark3, @@ -425,6 +442,17 @@ class _RestoreOptionsViewState extends ConsumerState { color: Colors.transparent, child: Column( children: [ + CheckboxTextButton( + label: "Scan for Lelantus transactions", + onChanged: (newValue) { + setState(() { + enableLelantusScanning = newValue ?? true; + }); + }, + ), + const SizedBox( + height: 8, + ), ClipRRect( borderRadius: BorderRadius.circular( Constants.size.circularBorderRadius, @@ -461,7 +489,8 @@ class _RestoreOptionsViewState extends ConsumerState { ), GestureDetector( key: const Key( - "mnemonicPassphraseFieldShowPasswordButtonKey"), + "mnemonicPassphraseFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/mobile_mnemonic_length_selector.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/mobile_mnemonic_length_selector.dart index 7299ca476..af86c3261 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/mobile_mnemonic_length_selector.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/mobile_mnemonic_length_selector.dart @@ -20,9 +20,9 @@ import '../../../../../utilities/util.dart'; class MobileMnemonicLengthSelector extends ConsumerWidget { const MobileMnemonicLengthSelector({ - Key? key, + super.key, required this.chooseMnemonicLength, - }) : super(key: key); + }); final VoidCallback chooseMnemonicLength; @@ -66,7 +66,7 @@ class MobileMnemonicLengthSelector extends ConsumerWidget { ], ), ), - ) + ), ], ); } diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_from_date_picker.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_from_date_picker.dart index 58869bdf4..55aa6ff63 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_from_date_picker.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_from_date_picker.dart @@ -17,10 +17,10 @@ import '../../../../../utilities/util.dart'; class RestoreFromDatePicker extends StatefulWidget { const RestoreFromDatePicker({ - Key? key, + super.key, required this.onTap, required this.controller, - }) : super(key: key); + }); final VoidCallback onTap; final TextEditingController controller; diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_next_button.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_next_button.dart index 8ac5ed213..2ca2aeedd 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_next_button.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_next_button.dart @@ -14,10 +14,10 @@ import '../../../../../utilities/text_styles.dart'; class RestoreOptionsNextButton extends StatelessWidget { const RestoreOptionsNextButton({ - Key? key, + super.key, required this.isDesktop, this.onPressed, - }) : super(key: key); + }); final bool isDesktop; final VoidCallback? onPressed; diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_platform_layout.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_platform_layout.dart index 9f606eb66..14a7a204c 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_platform_layout.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_platform_layout.dart @@ -13,10 +13,10 @@ import '../../../../../themes/stack_colors.dart'; class RestoreOptionsPlatformLayout extends StatelessWidget { const RestoreOptionsPlatformLayout({ - Key? key, + super.key, required this.isDesktop, required this.child, - }) : super(key: key); + }); final bool isDesktop; final Widget child; diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart index 41eddad6d..a7768b061 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart @@ -22,15 +22,9 @@ import 'package:flutter_libmonero/monero/monero.dart' as libxmr; import 'package:flutter_libmonero/wownero/wownero.dart' as libwow; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:wakelock/wakelock.dart'; + import '../../../notifications/show_flush_bar.dart'; -import '../add_token_view/edit_wallet_tokens_view.dart'; -import 'confirm_recovery_dialog.dart'; -import 'sub_widgets/restore_failed_dialog.dart'; -import 'sub_widgets/restore_succeeded_dialog.dart'; -import 'sub_widgets/restoring_dialog.dart'; -import '../select_wallet_for_token_view.dart'; -import '../verify_recovery_phrase_view/verify_recovery_phrase_view.dart'; -import '../../home_view/home_view.dart'; import '../../../pages_desktop_specific/desktop_home_view.dart'; import '../../../pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart'; import '../../../providers/db/main_db_provider.dart'; @@ -48,11 +42,6 @@ import '../../../utilities/enums/form_input_status_enum.dart'; import '../../../utilities/logger.dart'; import '../../../utilities/text_styles.dart'; import '../../../utilities/util.dart'; -import '../../../wallets/crypto_currency/coins/epiccash.dart'; -import '../../../wallets/crypto_currency/coins/ethereum.dart'; -import '../../../wallets/crypto_currency/coins/firo.dart'; -import '../../../wallets/crypto_currency/coins/monero.dart'; -import '../../../wallets/crypto_currency/coins/wownero.dart'; import '../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../wallets/isar/models/wallet_info.dart'; import '../../../wallets/wallet/impl/epiccash_wallet.dart'; @@ -69,7 +58,14 @@ import '../../../widgets/icon_widgets/qrcode_icon.dart'; import '../../../widgets/table_view/table_view.dart'; import '../../../widgets/table_view/table_view_cell.dart'; import '../../../widgets/table_view/table_view_row.dart'; -import 'package:wakelock/wakelock.dart'; +import '../../home_view/home_view.dart'; +import '../add_token_view/edit_wallet_tokens_view.dart'; +import '../select_wallet_for_token_view.dart'; +import '../verify_recovery_phrase_view/verify_recovery_phrase_view.dart'; +import 'confirm_recovery_dialog.dart'; +import 'sub_widgets/restore_failed_dialog.dart'; +import 'sub_widgets/restore_succeeded_dialog.dart'; +import 'sub_widgets/restoring_dialog.dart'; class RestoreWalletView extends ConsumerStatefulWidget { const RestoreWalletView({ @@ -79,6 +75,7 @@ class RestoreWalletView extends ConsumerStatefulWidget { required this.seedWordsLength, required this.mnemonicPassphrase, required this.restoreFromDate, + this.enableLelantusScanning = false, this.barcodeScanner = const BarcodeScannerWrapper(), this.clipboard = const ClipboardWrapper(), }); @@ -90,6 +87,7 @@ class RestoreWalletView extends ConsumerStatefulWidget { final String mnemonicPassphrase; final int seedWordsLength; final DateTime restoreFromDate; + final bool enableLelantusScanning; final BarcodeScannerInterface barcodeScanner; final ClipboardInterface clipboard; @@ -261,6 +259,8 @@ class _RestoreWalletViewState extends ConsumerState { otherDataJsonString = jsonEncode( { WalletInfoKeys.lelantusCoinIsarRescanRequired: false, + WalletInfoKeys.enableLelantusScanning: + widget.enableLelantusScanning, }, ); } diff --git a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/mnemonic_word_count_select_sheet.dart b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/mnemonic_word_count_select_sheet.dart index c1533bad4..933b72ba5 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/mnemonic_word_count_select_sheet.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/mnemonic_word_count_select_sheet.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../../providers/ui/verify_recovery_phrase/mnemonic_word_count_state_provider.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/constants.dart'; @@ -17,9 +18,9 @@ import '../../../../utilities/text_styles.dart'; class MnemonicWordCountSelectSheet extends ConsumerWidget { const MnemonicWordCountSelectSheet({ - Key? key, + super.key, required this.lengthOptions, - }) : super(key: key); + }); final List lengthOptions; @@ -113,13 +114,16 @@ class MnemonicWordCountSelectSheet extends ConsumerWidget { .radioButtonIconEnabled, value: lengthOptions[i], groupValue: ref - .watch(mnemonicWordCountStateProvider - .state) + .watch( + mnemonicWordCountStateProvider.state, + ) .state, onChanged: (x) { ref - .read(mnemonicWordCountStateProvider - .state) + .read( + mnemonicWordCountStateProvider + .state, + ) .state = lengthOptions[i]; Navigator.of(context).pop(); }, diff --git a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_failed_dialog.dart b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_failed_dialog.dart index fc45b372a..1ae4a5efd 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_failed_dialog.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_failed_dialog.dart @@ -20,11 +20,11 @@ import '../../../../widgets/stack_dialog.dart'; class RestoreFailedDialog extends ConsumerStatefulWidget { const RestoreFailedDialog({ - Key? key, + super.key, required this.errorMessage, required this.walletName, required this.walletId, - }) : super(key: key); + }); final String errorMessage; final String walletName; diff --git a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_succeeded_dialog.dart b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_succeeded_dialog.dart index 4c5364e44..f290c6751 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_succeeded_dialog.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_succeeded_dialog.dart @@ -20,7 +20,7 @@ import '../../../../widgets/desktop/primary_button.dart'; import '../../../../widgets/stack_dialog.dart'; class RestoreSucceededDialog extends StatelessWidget { - const RestoreSucceededDialog({Key? key}) : super(key: key); + const RestoreSucceededDialog({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restoring_dialog.dart b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restoring_dialog.dart index 29a4dcf40..38004caad 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restoring_dialog.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restoring_dialog.dart @@ -20,9 +20,9 @@ import '../../../../widgets/stack_dialog.dart'; class RestoringDialog extends StatefulWidget { const RestoringDialog({ - Key? key, + super.key, required this.onCancel, - }) : super(key: key); + }); final Future Function() onCancel; diff --git a/lib/pages/add_wallet_views/select_wallet_for_token_view.dart b/lib/pages/add_wallet_views/select_wallet_for_token_view.dart index 648f6a0de..debe8731c 100644 --- a/lib/pages/add_wallet_views/select_wallet_for_token_view.dart +++ b/lib/pages/add_wallet_views/select_wallet_for_token_view.dart @@ -37,9 +37,9 @@ final newEthWalletTriggerTempUntilHiveCompletelyDeleted = class SelectWalletForTokenView extends ConsumerStatefulWidget { const SelectWalletForTokenView({ - Key? key, + super.key, required this.entity, - }) : super(key: key); + }); static const String routeName = "/selectWalletForTokenView"; diff --git a/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table.dart b/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table.dart index 8674f6b07..63c305a3b 100644 --- a/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table.dart +++ b/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table.dart @@ -14,10 +14,10 @@ import 'word_table_item.dart'; class WordTable extends ConsumerWidget { const WordTable({ - Key? key, + super.key, required this.words, required this.isDesktop, - }) : super(key: key); + }); final List words; final bool isDesktop; diff --git a/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table_item.dart b/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table_item.dart index 64135fe95..993f825dc 100644 --- a/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table_item.dart +++ b/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table_item.dart @@ -17,11 +17,11 @@ import '../../../../utilities/text_styles.dart'; class WordTableItem extends ConsumerWidget { const WordTableItem({ - Key? key, + super.key, required this.number, required this.word, required this.isDesktop, - }) : super(key: key); + }); final int number; final String word; diff --git a/lib/pages/add_wallet_views/verify_recovery_phrase_view/verify_mnemonic_passphrase_dialog.dart b/lib/pages/add_wallet_views/verify_recovery_phrase_view/verify_mnemonic_passphrase_dialog.dart index 77b650c81..d21c71706 100644 --- a/lib/pages/add_wallet_views/verify_recovery_phrase_view/verify_mnemonic_passphrase_dialog.dart +++ b/lib/pages/add_wallet_views/verify_recovery_phrase_view/verify_mnemonic_passphrase_dialog.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../../../notifications/show_flush_bar.dart'; -import '../new_wallet_options/new_wallet_options_view.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/assets.dart'; import '../../../utilities/constants.dart'; @@ -15,6 +15,7 @@ import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/stack_dialog.dart'; import '../../../widgets/stack_text_field.dart'; +import '../new_wallet_options/new_wallet_options_view.dart'; class VerifyMnemonicPassphraseDialog extends ConsumerStatefulWidget { const VerifyMnemonicPassphraseDialog({super.key}); @@ -154,7 +155,8 @@ class _VerifyMnemonicPassphraseDialogState ), GestureDetector( key: const Key( - "mnemonicPassphraseFieldShowPasswordButtonKey"), + "mnemonicPassphraseFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; diff --git a/lib/pages/address_book_views/address_book_view.dart b/lib/pages/address_book_views/address_book_view.dart index b9ed9560f..dc5cc6f99 100644 --- a/lib/pages/address_book_views/address_book_view.dart +++ b/lib/pages/address_book_views/address_book_view.dart @@ -20,7 +20,6 @@ import '../../providers/db/main_db_provider.dart'; import '../../providers/global/address_book_service_provider.dart'; import '../../providers/providers.dart'; import '../../providers/ui/address_book_providers/address_book_filter_provider.dart'; -import '../../app_config.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/assets.dart'; import '../../utilities/constants.dart'; diff --git a/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart b/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart index bf1ee6b39..66b4b1aa9 100644 --- a/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart +++ b/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart @@ -12,8 +12,9 @@ import 'package:emojis/emoji.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:uuid/uuid.dart'; + import '../../../models/isar/models/contact_entry.dart'; -import 'new_contact_address_entry_form.dart'; import '../../../providers/global/address_book_service_provider.dart'; import '../../../providers/ui/address_book_providers/address_entry_data_provider.dart'; import '../../../providers/ui/address_book_providers/contact_name_is_not_empty_state_provider.dart'; @@ -37,14 +38,14 @@ import '../../../widgets/emoji_select_sheet.dart'; import '../../../widgets/icon_widgets/x_icon.dart'; import '../../../widgets/stack_text_field.dart'; import '../../../widgets/textfield_icon_button.dart'; -import 'package:uuid/uuid.dart'; +import 'new_contact_address_entry_form.dart'; class AddAddressBookEntryView extends ConsumerStatefulWidget { const AddAddressBookEntryView({ - Key? key, + super.key, this.barcodeScanner = const BarcodeScannerWrapper(), this.clipboard = const ClipboardWrapper(), - }) : super(key: key); + }); static const String routeName = "/addAddressBookEntry"; @@ -129,64 +130,66 @@ class _AddAddressBookEntryViewState builder: (child) { return Background( child: Scaffold( - backgroundColor: - Theme.of(context).extension()!.background, - appBar: AppBar( - leading: AppBarBackButton( - onPressed: () async { - if (FocusScope.of(context).hasFocus) { - FocusScope.of(context).unfocus(); - await Future.delayed( - const Duration(milliseconds: 75)); - } - if (mounted) { - Navigator.of(context).pop(); - } - }, - ), - title: Text( - "New contact", - style: STextStyles.navBarTitle(context), - ), - actions: [ - Padding( - padding: const EdgeInsets.only( - top: 10, - bottom: 10, - right: 10, - ), - child: AspectRatio( - aspectRatio: 1, - child: AppBarIconButton( - key: const Key("addAddressBookEntryFavoriteButtonKey"), - size: 36, - shadows: const [], - color: Theme.of(context) - .extension()! - .background, - icon: SvgPicture.asset( - Assets.svg.star, - color: _isFavorite - ? Theme.of(context) - .extension()! - .favoriteStarActive - : Theme.of(context) - .extension()! - .favoriteStarInactive, - width: 20, - height: 20, - ), - onPressed: () { - setState(() { - _isFavorite = !_isFavorite; - }); - }, + backgroundColor: + Theme.of(context).extension()!.background, + appBar: AppBar( + leading: AppBarBackButton( + onPressed: () async { + if (FocusScope.of(context).hasFocus) { + FocusScope.of(context).unfocus(); + await Future.delayed( + const Duration(milliseconds: 75), + ); + } + if (mounted) { + Navigator.of(context).pop(); + } + }, + ), + title: Text( + "New contact", + style: STextStyles.navBarTitle(context), + ), + actions: [ + Padding( + padding: const EdgeInsets.only( + top: 10, + bottom: 10, + right: 10, + ), + child: AspectRatio( + aspectRatio: 1, + child: AppBarIconButton( + key: const Key("addAddressBookEntryFavoriteButtonKey"), + size: 36, + shadows: const [], + color: Theme.of(context) + .extension()! + .background, + icon: SvgPicture.asset( + Assets.svg.star, + color: _isFavorite + ? Theme.of(context) + .extension()! + .favoriteStarActive + : Theme.of(context) + .extension()! + .favoriteStarInactive, + width: 20, + height: 20, ), + onPressed: () { + setState(() { + _isFavorite = !_isFavorite; + }); + }, ), ), - ], - ), - body: child), + ), + ], + ), + body: child, + ), ); }, child: ConditionalParent( @@ -267,22 +270,23 @@ class _AddAddressBookEntryViewState } showDialog( - context: context, - builder: (context) { - return const DesktopDialog( - maxHeight: 700, - maxWidth: 600, - child: Padding( - padding: EdgeInsets.only( - left: 32, - right: 20, - top: 32, - bottom: 32, - ), - child: EmojiSelectSheet(), + context: context, + builder: (context) { + return const DesktopDialog( + maxHeight: 700, + maxWidth: 600, + child: Padding( + padding: EdgeInsets.only( + left: 32, + right: 20, + top: 32, + bottom: 32, ), - ); - }).then((value) { + child: EmojiSelectSheet(), + ), + ); + }, + ).then((value) { if (value is Emoji) { setState(() { _selectedEmoji = value; @@ -313,7 +317,8 @@ class _AddAddressBookEntryViewState _selectedEmoji!.char, style: STextStyles .pageTitleH1( - context), + context, + ), ), ), ), @@ -323,19 +328,21 @@ class _AddAddressBookEntryViewState height: 14, width: 14, decoration: BoxDecoration( - borderRadius: - BorderRadius.circular( - 14), - color: Theme.of(context) - .extension< - StackColors>()! - .accentColorDark), + borderRadius: + BorderRadius.circular( + 14, + ), + color: Theme.of(context) + .extension()! + .accentColorDark, + ), child: Center( child: _selectedEmoji == null ? SvgPicture.asset( Assets.svg.plus, color: Theme.of( - context) + context, + ) .extension< StackColors>()! .textWhite, @@ -345,7 +352,8 @@ class _AddAddressBookEntryViewState : SvgPicture.asset( Assets.svg.thickX, color: Theme.of( - context) + context, + ) .extension< StackColors>()! .textWhite, @@ -354,7 +362,7 @@ class _AddAddressBookEntryViewState ), ), ), - ) + ), ], ), ), @@ -384,13 +392,15 @@ class _AddAddressBookEntryViewState STextStyles.fieldLabel(context), suffixIcon: ref .read( - contactNameIsNotEmptyStateProvider - .state) + contactNameIsNotEmptyStateProvider + .state, + ) .state ? Padding( padding: const EdgeInsets.only( - right: 0), + right: 0, + ), child: UnconstrainedBox( child: Row( children: [ @@ -412,8 +422,9 @@ class _AddAddressBookEntryViewState onChanged: (newValue) { ref .read( - contactNameIsNotEmptyStateProvider - .state) + contactNameIsNotEmptyStateProvider + .state, + ) .state = newValue.isNotEmpty; }, ), @@ -485,11 +496,12 @@ class _AddAddressBookEntryViewState height: 14, width: 14, decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(14), - color: Theme.of(context) - .extension()! - .accentColorDark), + borderRadius: + BorderRadius.circular(14), + color: Theme.of(context) + .extension()! + .accentColorDark, + ), child: Center( child: _selectedEmoji == null ? SvgPicture.asset( @@ -512,7 +524,7 @@ class _AddAddressBookEntryViewState ), ), ), - ) + ), ], ), ), @@ -537,12 +549,14 @@ class _AddAddressBookEntryViewState ).copyWith( suffixIcon: ref .read( - contactNameIsNotEmptyStateProvider - .state) + contactNameIsNotEmptyStateProvider + .state, + ) .state ? Padding( padding: const EdgeInsets.only( - right: 0), + right: 0, + ), child: UnconstrainedBox( child: Row( children: [ @@ -564,8 +578,9 @@ class _AddAddressBookEntryViewState onChanged: (newValue) { ref .read( - contactNameIsNotEmptyStateProvider - .state) + contactNameIsNotEmptyStateProvider + .state, + ) .state = newValue.isNotEmpty; }, ), @@ -659,17 +674,22 @@ class _AddAddressBookEntryViewState Expanded( child: Builder( builder: (context) { - bool nameExists = ref - .watch(contactNameIsNotEmptyStateProvider - .state) + final bool nameExists = ref + .watch( + contactNameIsNotEmptyStateProvider + .state, + ) .state; - bool validForms = ref.watch( - validContactStateProvider(forms + final bool validForms = ref.watch( + validContactStateProvider( + forms .map((e) => e.id) - .toList(growable: false))); + .toList(growable: false), + ), + ); - bool shouldEnableSave = + final bool shouldEnableSave = validForms && nameExists; return PrimaryButton( @@ -684,31 +704,38 @@ class _AddAddressBookEntryViewState FocusScope.of(context).unfocus(); await Future.delayed( const Duration( - milliseconds: 75), + milliseconds: 75, + ), ); } - List entries = - []; + final List + entries = []; for (int i = 0; i < forms.length; i++) { - entries.add(ref - .read( + entries.add( + ref + .read( addressEntryDataProvider( - forms[i].id)) - .buildAddressEntry()); + forms[i].id, + ), + ) + .buildAddressEntry(), + ); } - ContactEntry contact = ContactEntry( + final ContactEntry contact = + ContactEntry( emojiChar: _selectedEmoji?.char, name: nameController.text, addresses: entries, isFavorite: _isFavorite, - customId: const Uuid().v1(), + customId: const Uuid().v1(), ); if (await ref .read( - addressBookServiceProvider) + addressBookServiceProvider, + ) .addContact(contact)) { if (mounted) { Navigator.of(context).pop(); diff --git a/lib/pages/address_book_views/subviews/add_new_contact_address_view.dart b/lib/pages/address_book_views/subviews/add_new_contact_address_view.dart index 4a2c3c497..fc59eca68 100644 --- a/lib/pages/address_book_views/subviews/add_new_contact_address_view.dart +++ b/lib/pages/address_book_views/subviews/add_new_contact_address_view.dart @@ -11,8 +11,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../models/isar/models/contact_entry.dart'; -import 'new_contact_address_entry_form.dart'; import '../../../providers/global/address_book_service_provider.dart'; import '../../../providers/ui/address_book_providers/address_entry_data_provider.dart'; import '../../../providers/ui/address_book_providers/valid_contact_state_provider.dart'; @@ -27,14 +27,15 @@ import '../../../widgets/conditional_parent.dart'; import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/desktop/secondary_button.dart'; +import 'new_contact_address_entry_form.dart'; class AddNewContactAddressView extends ConsumerStatefulWidget { const AddNewContactAddressView({ - Key? key, + super.key, required this.contactId, this.barcodeScanner = const BarcodeScannerWrapper(), this.clipboard = const ClipboardWrapper(), - }) : super(key: key); + }); static const String routeName = "/addNewContactAddress"; @@ -66,8 +67,10 @@ class _AddNewContactAddressViewState @override Widget build(BuildContext context) { - final contact = ref.watch(addressBookServiceProvider - .select((value) => value.getContactById(contactId))); + final contact = ref.watch( + addressBookServiceProvider + .select((value) => value.getContactById(contactId)), + ); final isDesktop = Util.isDesktop; @@ -188,7 +191,8 @@ class _AddNewContactAddressViewState if (!isDesktop && FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( - const Duration(milliseconds: 75)); + const Duration(milliseconds: 75), + ); } if (mounted) { Navigator.of(context).pop(); @@ -211,14 +215,14 @@ class _AddNewContactAddressViewState const Duration(milliseconds: 75), ); } - List entries = + final List entries = contact.addresses.toList(); - entries.add(ref - .read(addressEntryDataProvider(0)) - .buildAddressEntry()); + entries.add( + ref.read(addressEntryDataProvider(0)).buildAddressEntry(), + ); - ContactEntry editedContact = + final ContactEntry editedContact = contact.copyWith(addresses: entries); if (await ref @@ -235,7 +239,7 @@ class _AddNewContactAddressViewState ), ), ], - ) + ), ], ), ); diff --git a/lib/pages/address_book_views/subviews/address_book_filter_view.dart b/lib/pages/address_book_views/subviews/address_book_filter_view.dart index 035628c80..124cf142f 100644 --- a/lib/pages/address_book_views/subviews/address_book_filter_view.dart +++ b/lib/pages/address_book_views/subviews/address_book_filter_view.dart @@ -10,9 +10,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../../../app_config.dart'; import '../../../providers/global/prefs_provider.dart'; import '../../../providers/ui/address_book_providers/address_book_filter_provider.dart'; -import '../../../app_config.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/text_styles.dart'; import '../../../utilities/util.dart'; @@ -82,42 +83,44 @@ class _AddressBookFilterViewState extends ConsumerState { ), body: Padding( padding: const EdgeInsets.all(12), - child: LayoutBuilder(builder: (builderContext, constraints) { - return SingleChildScrollView( - child: ConstrainedBox( - constraints: BoxConstraints( - minHeight: constraints.maxHeight, - ), - child: IntrinsicHeight( - child: Padding( - padding: const EdgeInsets.all(4), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - RoundedWhiteContainer( - child: Text( - "Only selected cryptocurrency addresses will be displayed.", - style: STextStyles.itemSubtitle(context), + child: LayoutBuilder( + builder: (builderContext, constraints) { + return SingleChildScrollView( + child: ConstrainedBox( + constraints: BoxConstraints( + minHeight: constraints.maxHeight, + ), + child: IntrinsicHeight( + child: Padding( + padding: const EdgeInsets.all(4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + RoundedWhiteContainer( + child: Text( + "Only selected cryptocurrency addresses will be displayed.", + style: STextStyles.itemSubtitle(context), + ), ), - ), - const SizedBox( - height: 12, - ), - Text( - "Select cryptocurrency", - style: STextStyles.smallMed12(context), - ), - const SizedBox( - height: 12, - ), - child, - ], + const SizedBox( + height: 12, + ), + Text( + "Select cryptocurrency", + style: STextStyles.smallMed12(context), + ), + const SizedBox( + height: 12, + ), + child, + ], + ), ), ), ), - ), - ); - }), + ); + }, + ), ), ), ); @@ -230,8 +233,10 @@ class _AddressBookFilterViewState extends ConsumerState { width: 20, child: Checkbox( value: ref - .watch(addressBookFilterProvider - .select((value) => value.coins)) + .watch( + addressBookFilterProvider + .select((value) => value.coins), + ) .contains(coin), onChanged: (value) { if (value is bool) { @@ -267,7 +272,7 @@ class _AddressBookFilterViewState extends ConsumerState { style: STextStyles.itemSubtitle(context), ), ], - ) + ), ], ), ), diff --git a/lib/pages/address_book_views/subviews/coin_select_sheet.dart b/lib/pages/address_book_views/subviews/coin_select_sheet.dart index d39f7b08c..7e2cd0710 100644 --- a/lib/pages/address_book_views/subviews/coin_select_sheet.dart +++ b/lib/pages/address_book_views/subviews/coin_select_sheet.dart @@ -79,7 +79,7 @@ class CoinSelectSheet extends StatelessWidget { Flexible( child: Consumer( builder: (_, ref, __) { - bool showTestNet = ref.watch( + final bool showTestNet = ref.watch( prefsChangeNotifierProvider .select((value) => value.showTestNetCoins), ); diff --git a/lib/pages/address_book_views/subviews/contact_details_view.dart b/lib/pages/address_book_views/subviews/contact_details_view.dart index 2d12334f0..b343c3092 100644 --- a/lib/pages/address_book_views/subviews/contact_details_view.dart +++ b/lib/pages/address_book_views/subviews/contact_details_view.dart @@ -15,11 +15,10 @@ import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; +import 'package:tuple/tuple.dart'; + import '../../../models/isar/models/isar_models.dart'; import '../../../notifications/show_flush_bar.dart'; -import 'add_new_contact_address_view.dart'; -import 'edit_contact_address_view.dart'; -import 'edit_contact_name_emoji_view.dart'; import '../../../providers/db/main_db_provider.dart'; import '../../../providers/global/address_book_service_provider.dart'; import '../../../providers/ui/address_book_providers/address_entry_data_provider.dart'; @@ -36,7 +35,9 @@ import '../../../widgets/rounded_container.dart'; import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/stack_dialog.dart'; import '../../../widgets/transaction_card.dart'; -import 'package:tuple/tuple.dart'; +import 'add_new_contact_address_view.dart'; +import 'edit_contact_address_view.dart'; +import 'edit_contact_name_emoji_view.dart'; class ContactDetailsView extends ConsumerStatefulWidget { const ContactDetailsView({ @@ -73,8 +74,10 @@ class _ContactDetailsViewState extends ConsumerState { .transactions .where() .filter() - .anyOf(contact.addresses.map((e) => e.address), - (q, String e) => q.address((q) => q.valueEqualTo(e))) + .anyOf( + contact.addresses.map((e) => e.address), + (q, String e) => q.address((q) => q.valueEqualTo(e)), + ) .sortByTimestampDesc() .findAll(); @@ -107,8 +110,10 @@ class _ContactDetailsViewState extends ConsumerState { Widget build(BuildContext context) { debugPrint("BUILD: $runtimeType"); - final _contact = ref.watch(addressBookServiceProvider - .select((value) => value.getContactById(_contactId))); + final _contact = ref.watch( + addressBookServiceProvider + .select((value) => value.getContactById(_contactId)), + ); return Background( child: Scaffold( @@ -153,7 +158,8 @@ class _ContactDetailsViewState extends ConsumerState { final bool isFavorite = _contact.isFavorite; ref.read(addressBookServiceProvider).editContact( - _contact.copyWith(isFavorite: !isFavorite)); + _contact.copyWith(isFavorite: !isFavorite), + ); }, ), ), @@ -289,18 +295,21 @@ class _ContactDetailsViewState extends ConsumerState { .getSecondaryEnabledButtonStyle(context)! .copyWith( minimumSize: MaterialStateProperty.all( - const Size(46, 32)), + const Size(46, 32), + ), ), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 12), child: Row( children: [ - SvgPicture.asset(Assets.svg.pencil, - width: 10, - height: 10, - color: Theme.of(context) - .extension()! - .accentColorDark), + SvgPicture.asset( + Assets.svg.pencil, + width: 10, + height: 10, + color: Theme.of(context) + .extension()! + .accentColorDark, + ), const SizedBox( width: 4, ), @@ -463,9 +472,10 @@ class _ContactDetailsViewState extends ConsumerState { ), FutureBuilder( future: _filteredTransactionsByContact(), - builder: (_, - AsyncSnapshot>> - snapshot) { + builder: ( + _, + AsyncSnapshot>> snapshot, + ) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { _cachedTransactions = snapshot.data!; @@ -478,7 +488,8 @@ class _ContactDetailsViewState extends ConsumerState { ..._cachedTransactions.map( (e) => TransactionCard( key: Key( - "contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey"), + "contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey", + ), transaction: e.item2, walletId: e.item1, ), @@ -508,7 +519,8 @@ class _ContactDetailsViewState extends ConsumerState { ..._cachedTransactions.map( (e) => TransactionCard( key: Key( - "contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey"), + "contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey", + ), transaction: e.item2, walletId: e.item1, ), diff --git a/lib/pages/address_book_views/subviews/contact_popup.dart b/lib/pages/address_book_views/subviews/contact_popup.dart index 5411736e0..80d814323 100644 --- a/lib/pages/address_book_views/subviews/contact_popup.dart +++ b/lib/pages/address_book_views/subviews/contact_popup.dart @@ -51,8 +51,10 @@ class ContactPopUp extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final maxHeight = MediaQuery.of(context).size.height * 0.6; - final contact = ref.watch(addressBookServiceProvider - .select((value) => value.getContactById(contactId))); + final contact = ref.watch( + addressBookServiceProvider + .select((value) => value.getContactById(contactId)), + ); final active = ref.read(currentWalletIdProvider); @@ -157,7 +159,8 @@ class ContactPopUp extends ConsumerWidget { style: Theme.of(context) .extension()! .getSecondaryEnabledButtonStyle( - context)! + context, + )! .copyWith( minimumSize: MaterialStateProperty.all< @@ -165,10 +168,14 @@ class ContactPopUp extends ConsumerWidget { ), child: Padding( padding: const EdgeInsets.symmetric( - horizontal: 18), - child: Text("Details", - style: STextStyles.buttonSmall( - context)), + horizontal: 18, + ), + child: Text( + "Details", + style: STextStyles.buttonSmall( + context, + ), + ), ), ), ], @@ -186,7 +193,8 @@ class ContactPopUp extends ConsumerWidget { if (addresses.isEmpty) Padding( padding: const EdgeInsets.symmetric( - horizontal: 20), + horizontal: 20, + ), child: RoundedWhiteContainer( child: Center( child: Text( @@ -237,14 +245,16 @@ class ContactPopUp extends ConsumerWidget { e.other!, style: STextStyles.itemSubtitle12( - context), + context, + ), ), if (contact.customId != "default") Text( "${e.label} (${e.coin.ticker})", style: STextStyles.itemSubtitle12( - context), + context, + ), ), const SizedBox( height: 2, @@ -252,8 +262,8 @@ class ContactPopUp extends ConsumerWidget { Text( e.address, style: STextStyles.itemSubtitle( - context) - .copyWith( + context, + ).copyWith( fontSize: 8, ), ), @@ -286,12 +296,13 @@ class ContactPopUp extends ConsumerWidget { .textFieldDefaultBG, padding: const EdgeInsets.all(6), child: SvgPicture.asset( - Assets.svg.copy, - width: 16, - height: 16, - color: Theme.of(context) - .extension()! - .accentColorDark), + Assets.svg.copy, + width: 16, + height: 16, + color: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ), ], @@ -310,12 +321,15 @@ class ContactPopUp extends ConsumerWidget { onTap: () { ref .read( - exchangeFromAddressBookAddressStateProvider - .state) + exchangeFromAddressBookAddressStateProvider + .state, + ) .state = e.address; Navigator.of(context).popUntil( - ModalRoute.withName( - Step2View.routeName)); + ModalRoute.withName( + Step2View.routeName, + ), + ); }, child: RoundedContainer( color: Theme.of(context) @@ -324,13 +338,13 @@ class ContactPopUp extends ConsumerWidget { padding: const EdgeInsets.all(6), child: SvgPicture.asset( - Assets.svg.chevronRight, - width: 16, - height: 16, - color: Theme.of(context) - .extension< - StackColors>()! - .accentColorDark), + Assets.svg.chevronRight, + width: 16, + height: 16, + color: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ), ], @@ -363,7 +377,8 @@ class ContactPopUp extends ConsumerWidget { arguments: Tuple3( active, ref.read( - pWalletCoin(active)), + pWalletCoin(active), + ), SendViewAutoFillData( address: address, contactLabel: @@ -381,18 +396,15 @@ class ContactPopUp extends ConsumerWidget { Util.isDesktop ? 4 : 6, ), child: SvgPicture.asset( - Assets - .svg.circleArrowUpRight, - width: Util.isDesktop - ? 12 - : 16, - height: Util.isDesktop - ? 12 - : 16, - color: Theme.of(context) - .extension< - StackColors>()! - .accentColorDark), + Assets.svg.circleArrowUpRight, + width: + Util.isDesktop ? 12 : 16, + height: + Util.isDesktop ? 12 : 16, + color: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ), ], diff --git a/lib/pages/address_book_views/subviews/edit_contact_address_view.dart b/lib/pages/address_book_views/subviews/edit_contact_address_view.dart index d9c6e584f..1d5ebd21c 100644 --- a/lib/pages/address_book_views/subviews/edit_contact_address_view.dart +++ b/lib/pages/address_book_views/subviews/edit_contact_address_view.dart @@ -8,13 +8,11 @@ * */ -import 'dart:convert'; - import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../models/isar/models/contact_entry.dart'; -import 'new_contact_address_entry_form.dart'; import '../../../providers/global/address_book_service_provider.dart'; import '../../../providers/ui/address_book_providers/address_entry_data_provider.dart'; import '../../../providers/ui/address_book_providers/valid_contact_state_provider.dart'; @@ -29,15 +27,16 @@ import '../../../widgets/conditional_parent.dart'; import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/desktop/secondary_button.dart'; +import 'new_contact_address_entry_form.dart'; class EditContactAddressView extends ConsumerStatefulWidget { const EditContactAddressView({ - Key? key, + super.key, required this.contactId, required this.addressEntry, this.barcodeScanner = const BarcodeScannerWrapper(), this.clipboard = const ClipboardWrapper(), - }) : super(key: key); + }); static const String routeName = "/editContactAddress"; @@ -67,7 +66,7 @@ class _EditContactAddressViewState const Duration(milliseconds: 75), ); } - List entries = contact.addresses.toList(); + final List entries = contact.addresses.toList(); final entry = entries.firstWhere( (e) => @@ -79,12 +78,12 @@ class _EditContactAddressViewState final index = entries.indexOf(entry); entries.remove(entry); - ContactAddressEntry editedEntry = + final ContactAddressEntry editedEntry = ref.read(addressEntryDataProvider(0)).buildAddressEntry(); entries.insert(index, editedEntry); - ContactEntry editedContact = contact.copyWith(addresses: entries); + final ContactEntry editedContact = contact.copyWith(addresses: entries); if (await ref.read(addressBookServiceProvider).editContact(editedContact)) { if (mounted) { @@ -108,8 +107,10 @@ class _EditContactAddressViewState @override Widget build(BuildContext context) { - final contact = ref.watch(addressBookServiceProvider - .select((value) => value.getContactById(contactId))); + final contact = ref.watch( + addressBookServiceProvider + .select((value) => value.getContactById(contactId)), + ); final bool isDesktop = Util.isDesktop; @@ -239,9 +240,10 @@ class _EditContactAddressViewState //Deleting an entry directly from _addresses gives error // "Cannot remove from a fixed-length list", so we remove the // entry from a copy - var tempAddresses = List.from(_addresses); + final tempAddresses = + List.from(_addresses); tempAddresses.remove(entry); - ContactEntry editedContact = + final ContactEntry editedContact = contact.copyWith(addresses: tempAddresses); if (await ref .read(addressBookServiceProvider) @@ -272,7 +274,8 @@ class _EditContactAddressViewState if (!isDesktop && FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( - const Duration(milliseconds: 75)); + const Duration(milliseconds: 75), + ); } if (mounted) { Navigator.of(context).pop(); diff --git a/lib/pages/address_book_views/subviews/edit_contact_name_emoji_view.dart b/lib/pages/address_book_views/subviews/edit_contact_name_emoji_view.dart index c1d8c139e..a552aca29 100644 --- a/lib/pages/address_book_views/subviews/edit_contact_name_emoji_view.dart +++ b/lib/pages/address_book_views/subviews/edit_contact_name_emoji_view.dart @@ -14,6 +14,7 @@ import 'package:emojis/emoji.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../providers/global/address_book_service_provider.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/assets.dart'; @@ -33,9 +34,9 @@ import '../../../widgets/textfield_icon_button.dart'; class EditContactNameEmojiView extends ConsumerStatefulWidget { const EditContactNameEmojiView({ - Key? key, + super.key, required this.contactId, - }) : super(key: key); + }); static const String routeName = "/editContactNameEmoji"; @@ -82,8 +83,10 @@ class _EditContactNameEmojiViewState @override Widget build(BuildContext context) { - final contact = ref.watch(addressBookServiceProvider - .select((value) => value.getContactById(contactId))); + final contact = ref.watch( + addressBookServiceProvider + .select((value) => value.getContactById(contactId)), + ); final isDesktop = Util.isDesktop; final double emojiSize = isDesktop ? 56 : 48; @@ -152,23 +155,24 @@ class _EditContactNameEmojiViewState } if (isDesktop) { showDialog( - barrierColor: Colors.transparent, - context: context, - builder: (context) { - return const DesktopDialog( - maxHeight: 700, - maxWidth: 600, - child: Padding( - padding: EdgeInsets.only( - left: 32, - right: 20, - top: 32, - bottom: 32, - ), - child: EmojiSelectSheet(), + barrierColor: Colors.transparent, + context: context, + builder: (context) { + return const DesktopDialog( + maxHeight: 700, + maxWidth: 600, + child: Padding( + padding: EdgeInsets.only( + left: 32, + right: 20, + top: 32, + bottom: 32, ), - ); - }).then((value) { + child: EmojiSelectSheet(), + ), + ); + }, + ).then((value) { if (value is Emoji) { setState(() { _selectedEmoji = value; @@ -229,10 +233,11 @@ class _EditContactNameEmojiViewState height: 14, width: 14, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(14), - color: Theme.of(context) - .extension()! - .accentColorDark), + borderRadius: BorderRadius.circular(14), + color: Theme.of(context) + .extension()! + .accentColorDark, + ), child: Center( child: _selectedEmoji == null ? SvgPicture.asset( @@ -253,7 +258,7 @@ class _EditContactNameEmojiViewState ), ), ), - ) + ), ], ), ), @@ -362,7 +367,8 @@ class _EditContactNameEmojiViewState if (!isDesktop && FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( - const Duration(milliseconds: 75)); + const Duration(milliseconds: 75), + ); } if (mounted) { Navigator.of(context).pop(); @@ -403,7 +409,7 @@ class _EditContactNameEmojiViewState ), ), ], - ) + ), ], ), ); diff --git a/lib/pages/buy_view/buy_form.dart b/lib/pages/buy_view/buy_form.dart index 1baf97db3..1b1239a27 100644 --- a/lib/pages/buy_view/buy_form.dart +++ b/lib/pages/buy_view/buy_form.dart @@ -439,7 +439,7 @@ class _BuyFormState extends ConsumerState { buyWithFiat: buyWithFiat, ); - BuyResponse quoteResponse = await _loadQuote(quote); + final BuyResponse quoteResponse = await _loadQuote(quote); shouldPop = true; if (mounted) { Navigator.of(context, rootNavigator: isDesktop).pop(); @@ -767,8 +767,8 @@ class _BuyFormState extends ConsumerState { Widget build(BuildContext context) { debugPrint("BUILD: $runtimeType"); - Locale locale = Localizations.localeOf(context); - var format = NumberFormat.simpleCurrency(locale: locale.toString()); + final Locale locale = Localizations.localeOf(context); + final format = NumberFormat.simpleCurrency(locale: locale.toString()); // See https://stackoverflow.com/a/67055685 return ConditionalParent( diff --git a/lib/pages/buy_view/buy_order_details.dart b/lib/pages/buy_view/buy_order_details.dart index 9c44f01db..4144a85ab 100644 --- a/lib/pages/buy_view/buy_order_details.dart +++ b/lib/pages/buy_view/buy_order_details.dart @@ -11,6 +11,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../models/buy/response_objects/order.dart'; import '../../themes/stack_colors.dart'; import '../../themes/theme_providers.dart'; @@ -25,9 +26,9 @@ import '../../widgets/rounded_white_container.dart'; class BuyOrderDetailsView extends ConsumerStatefulWidget { const BuyOrderDetailsView({ - Key? key, + super.key, required this.order, - }) : super(key: key); + }); final SimplexOrder order; @@ -259,22 +260,25 @@ class _BuyOrderDetailsViewState extends ConsumerState { const SizedBox( height: 24, ), - Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( - "This information is not saved,\nscreenshot it now for your records", - style: STextStyles.label(context).copyWith( - color: Theme.of(context).extension()!.textDark, + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "This information is not saved,\nscreenshot it now for your records", + style: STextStyles.label(context).copyWith( + color: Theme.of(context).extension()!.textDark, + ), + textAlign: TextAlign.center, ), - textAlign: TextAlign.center, - ), - ]), + ], + ), const Spacer(), PrimaryButton( label: "Dismiss", onPressed: () { Navigator.of(context, rootNavigator: isDesktop).pop(); }, - ) + ), ], ), ); diff --git a/lib/pages/buy_view/buy_quote_preview.dart b/lib/pages/buy_view/buy_quote_preview.dart index ec65de1f5..7d736e3a6 100644 --- a/lib/pages/buy_view/buy_quote_preview.dart +++ b/lib/pages/buy_view/buy_quote_preview.dart @@ -29,9 +29,9 @@ import '../../widgets/rounded_white_container.dart'; class BuyQuotePreviewView extends ConsumerStatefulWidget { const BuyQuotePreviewView({ - Key? key, + super.key, required this.quote, - }) : super(key: key); + }); final SimplexQuote quote; @@ -56,8 +56,8 @@ class _BuyQuotePreviewViewState extends ConsumerState { @override Widget build(BuildContext context) { - Locale locale = Localizations.localeOf(context); - var format = NumberFormat.simpleCurrency(locale: locale.toString()); + final Locale locale = Localizations.localeOf(context); + final format = NumberFormat.simpleCurrency(locale: locale.toString()); // See https://stackoverflow.com/a/67055685 return ConditionalParent( @@ -240,7 +240,7 @@ class _BuyQuotePreviewViewState extends ConsumerState { PrimaryButton( label: "Buy", onPressed: _buyWarning, - ) + ), ], ), ); diff --git a/lib/pages/buy_view/sub_widgets/buy_warning_popup.dart b/lib/pages/buy_view/sub_widgets/buy_warning_popup.dart index c3e1dc4e9..7bab11198 100644 --- a/lib/pages/buy_view/sub_widgets/buy_warning_popup.dart +++ b/lib/pages/buy_view/sub_widgets/buy_warning_popup.dart @@ -13,9 +13,9 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../models/buy/response_objects/order.dart'; import '../../../models/buy/response_objects/quote.dart'; -import '../buy_order_details.dart'; import '../../../services/buy/buy_response.dart'; import '../../../services/buy/simplex/simplex_api.dart'; import '../../../themes/stack_colors.dart'; @@ -29,13 +29,14 @@ import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/stack_dialog.dart'; +import '../buy_order_details.dart'; class BuyWarningPopup extends ConsumerStatefulWidget { const BuyWarningPopup({ - Key? key, + super.key, required this.quote, this.order, - }) : super(key: key); + }); final SimplexQuote quote; final SimplexOrder? order; @override @@ -123,7 +124,8 @@ class _BuyWarningPopupState extends ConsumerState { } Future onContinue() async { - BuyResponse orderResponse = await newOrder(widget.quote); + final BuyResponse orderResponse = + await newOrder(widget.quote); if (orderResponse.exception == null) { await redirect(orderResponse.value as SimplexOrder) .then((_response) async { @@ -175,7 +177,7 @@ class _BuyWarningPopupState extends ConsumerState { ), ), ], - ) + ), ], ), ), @@ -192,9 +194,10 @@ class _BuyWarningPopupState extends ConsumerState { child: Text( "Ok", style: STextStyles.button(context).copyWith( - color: Theme.of(context) - .extension()! - .accentColorDark), + color: Theme.of(context) + .extension()! + .accentColorDark, + ), ), onPressed: () { Navigator.of(context).pop(); @@ -274,7 +277,7 @@ class _BuyWarningPopupState extends ConsumerState { ), ), ], - ) + ), ], ), ), diff --git a/lib/pages/buy_view/sub_widgets/fiat_selection_view.dart b/lib/pages/buy_view/sub_widgets/fiat_selection_view.dart index 87671494e..4fee72444 100644 --- a/lib/pages/buy_view/sub_widgets/fiat_selection_view.dart +++ b/lib/pages/buy_view/sub_widgets/fiat_selection_view.dart @@ -11,6 +11,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:intl/intl.dart'; + import '../../../models/buy/response_objects/fiat.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/assets.dart'; @@ -28,9 +29,9 @@ import '../../../widgets/textfield_icon_button.dart'; class FiatSelectionView extends StatefulWidget { const FiatSelectionView({ - Key? key, + super.key, required this.fiats, - }) : super(key: key); + }); final List fiats; @@ -48,9 +49,11 @@ class _FiatSelectionViewState extends State { void filter(String text) { setState(() { _fiats = [ - ...fiats.where((e) => - e.name.toLowerCase().contains(text.toLowerCase()) || - e.ticker.toLowerCase().contains(text.toLowerCase())) + ...fiats.where( + (e) => + e.name.toLowerCase().contains(text.toLowerCase()) || + e.ticker.toLowerCase().contains(text.toLowerCase()), + ), ]; }); } @@ -61,10 +64,12 @@ class _FiatSelectionViewState extends State { fiats = [...widget.fiats]; fiats.sort( - (a, b) => a.ticker.toLowerCase().compareTo(b.ticker.toLowerCase())); - for (Fiats fiat in Fiats.values.reversed) { - int index = fiats.indexWhere((element) => - element.ticker.toLowerCase() == fiat.ticker.toLowerCase()); + (a, b) => a.ticker.toLowerCase().compareTo(b.ticker.toLowerCase()), + ); + for (final Fiats fiat in Fiats.values.reversed) { + final int index = fiats.indexWhere( + (element) => element.ticker.toLowerCase() == fiat.ticker.toLowerCase(), + ); if (index > 0) { final currency = fiats.removeAt(index); fiats.insert(0, currency); @@ -85,7 +90,7 @@ class _FiatSelectionViewState extends State { @override Widget build(BuildContext context) { - Locale locale = Localizations.localeOf(context); + final Locale locale = Localizations.localeOf(context); final format = NumberFormat.simpleCurrency(locale: locale.toString()); // See https://stackoverflow.com/a/67055685 @@ -104,7 +109,8 @@ class _FiatSelectionViewState extends State { if (FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( - const Duration(milliseconds: 50)); + const Duration(milliseconds: 50), + ); } if (mounted) { Navigator.of(context).pop(); @@ -235,17 +241,20 @@ class _FiatSelectionViewState extends State { ), child: Text( format.simpleCurrencySymbol( - e.ticker.toUpperCase()), + e.ticker.toUpperCase(), + ), style: STextStyles.subtitle(context) .apply( fontSizeFactor: (1 / format .simpleCurrencySymbol( - e.ticker.toUpperCase()) + e.ticker.toUpperCase(), + ) .length * // Couldn't get pow() working here format .simpleCurrencySymbol( - e.ticker.toUpperCase()) + e.ticker.toUpperCase(), + ) .length), ), textAlign: TextAlign.center, diff --git a/lib/pages/cashfusion/cashfusion_view.dart b/lib/pages/cashfusion/cashfusion_view.dart index e8cfaff4d..46d8a2451 100644 --- a/lib/pages/cashfusion/cashfusion_view.dart +++ b/lib/pages/cashfusion/cashfusion_view.dart @@ -15,8 +15,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_native_splash/cli_commands.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'fusion_progress_view.dart'; -import 'fusion_rounds_selection_sheet.dart'; + import '../../providers/cash_fusion/fusion_progress_ui_state_provider.dart'; import '../../providers/global/prefs_provider.dart'; import '../../providers/global/wallets_provider.dart'; @@ -34,6 +33,8 @@ import '../../widgets/desktop/primary_button.dart'; import '../../widgets/rounded_container.dart'; import '../../widgets/rounded_white_container.dart'; import '../../widgets/stack_text_field.dart'; +import 'fusion_progress_view.dart'; +import 'fusion_rounds_selection_sheet.dart'; class CashFusionView extends ConsumerStatefulWidget { const CashFusionView({ @@ -73,7 +74,8 @@ class _CashFusionViewState extends ConsumerState { ); } catch (e) { if (!e.toString().contains( - "FusionProgressUIState was already set for ${widget.walletId}")) { + "FusionProgressUIState was already set for ${widget.walletId}", + )) { rethrow; } } @@ -273,7 +275,7 @@ class _CashFusionViewState extends ConsumerState { controller: portController, focusNode: portFocusNode, inputFormatters: [ - FilteringTextInputFormatter.digitsOnly + FilteringTextInputFormatter.digitsOnly, ], keyboardType: TextInputType.number, onChanged: (value) { @@ -408,7 +410,7 @@ class _CashFusionViewState extends ConsumerState { controller: fusionRoundController, focusNode: fusionRoundFocusNode, inputFormatters: [ - FilteringTextInputFormatter.digitsOnly + FilteringTextInputFormatter.digitsOnly, ], keyboardType: TextInputType.number, onChanged: (value) { @@ -424,7 +426,8 @@ class _CashFusionViewState extends ConsumerState { fusionRoundFocusNode, context, ).copyWith( - labelText: "Enter number of fusions.."), + labelText: "Enter number of fusions..", + ), ), ), const SizedBox( diff --git a/lib/pages/cashfusion/fusion_progress_view.dart b/lib/pages/cashfusion/fusion_progress_view.dart index 6f41f07b7..fd2921c7f 100644 --- a/lib/pages/cashfusion/fusion_progress_view.dart +++ b/lib/pages/cashfusion/fusion_progress_view.dart @@ -12,6 +12,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../pages_desktop_specific/cashfusion/sub_widgets/fusion_progress.dart'; import '../../providers/cash_fusion/fusion_progress_ui_state_provider.dart'; import '../../providers/global/prefs_provider.dart'; @@ -244,7 +245,8 @@ class _FusionProgressViewState extends ConsumerState { ); } catch (e) { if (!e.toString().contains( - "FusionProgressUIState was already set for ${widget.walletId}")) { + "FusionProgressUIState was already set for ${widget.walletId}", + )) { rethrow; } } diff --git a/lib/pages/cashfusion/fusion_rounds_selection_sheet.dart b/lib/pages/cashfusion/fusion_rounds_selection_sheet.dart index 1294c0096..3994efaa9 100644 --- a/lib/pages/cashfusion/fusion_rounds_selection_sheet.dart +++ b/lib/pages/cashfusion/fusion_rounds_selection_sheet.dart @@ -22,9 +22,9 @@ enum FusionOption { class FusionRoundCountSelectSheet extends HookWidget { const FusionRoundCountSelectSheet({ - Key? key, + super.key, required this.currentOption, - }) : super(key: key); + }); final FusionOption currentOption; diff --git a/lib/pages/coin_control/coin_control_view.dart b/lib/pages/coin_control/coin_control_view.dart index 4540b6d3f..f4347a586 100644 --- a/lib/pages/coin_control/coin_control_view.dart +++ b/lib/pages/coin_control/coin_control_view.dart @@ -14,10 +14,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:isar/isar.dart'; +import 'package:tuple/tuple.dart'; + import '../../db/isar/main_db.dart'; import '../../models/isar/models/isar_models.dart'; -import 'utxo_card.dart'; -import 'utxo_details_view.dart'; import '../../providers/global/wallets_provider.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/amount/amount.dart'; @@ -39,7 +39,8 @@ import '../../widgets/icon_widgets/x_icon.dart'; import '../../widgets/rounded_container.dart'; import '../../widgets/rounded_white_container.dart'; import '../../widgets/toggle.dart'; -import 'package:tuple/tuple.dart'; +import 'utxo_card.dart'; +import 'utxo_details_view.dart'; enum CoinControlViewType { manage, @@ -148,7 +149,8 @@ class _CoinControlViewState extends ConsumerState { onWillPop: () async { unawaited(_refreshBalance()); Navigator.of(context).pop( - widget.type == CoinControlViewType.use ? _selectedAvailable : null); + widget.type == CoinControlViewType.use ? _selectedAvailable : null, + ); return false; }, child: Background( @@ -179,9 +181,10 @@ class _CoinControlViewState extends ConsumerState { onPressed: () { unawaited(_refreshBalance()); Navigator.of(context).pop( - widget.type == CoinControlViewType.use - ? _selectedAvailable - : null); + widget.type == CoinControlViewType.use + ? _selectedAvailable + : null, + ); }, ), title: _isSearching @@ -336,7 +339,8 @@ class _CoinControlViewState extends ConsumerState { return UtxoCard( key: Key( - "${utxo.walletId}_${utxo.id}_$isSelected"), + "${utxo.walletId}_${utxo.id}_$isSelected", + ), walletId: widget.walletId, utxo: utxo, canSelect: widget.type == @@ -398,7 +402,8 @@ class _CoinControlViewState extends ConsumerState { return UtxoCard( key: Key( - "${utxo.walletId}_${utxo.id}_$isSelected"), + "${utxo.walletId}_${utxo.id}_$isSelected", + ), walletId: widget.walletId, utxo: utxo, canSelect: widget.type == @@ -486,7 +491,8 @@ class _CoinControlViewState extends ConsumerState { entry.key, style: STextStyles.w600_14( - context), + context, + ), ), const SizedBox( height: 2, @@ -496,8 +502,8 @@ class _CoinControlViewState extends ConsumerState { "output${entry.value.length > 1 ? "s" : ""}", style: STextStyles.w500_12( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension< StackColors>()! @@ -538,7 +544,8 @@ class _CoinControlViewState extends ConsumerState { return UtxoCard( key: Key( - "${utxo.walletId}_${utxo.id}_$isSelected"), + "${utxo.walletId}_${utxo.id}_$isSelected", + ), walletId: widget.walletId, utxo: utxo, canSelect: widget.type == @@ -615,22 +622,26 @@ class _CoinControlViewState extends ConsumerState { label: _showBlocked ? "Unfreeze" : "Freeze", onPressed: () async { if (_showBlocked) { - await MainDB.instance.putUTXOs(_selectedBlocked - .map( - (e) => e.copyWith( - isBlocked: false, - ), - ) - .toList()); + await MainDB.instance.putUTXOs( + _selectedBlocked + .map( + (e) => e.copyWith( + isBlocked: false, + ), + ) + .toList(), + ); _selectedBlocked.clear(); } else { - await MainDB.instance.putUTXOs(_selectedAvailable - .map( - (e) => e.copyWith( - isBlocked: true, - ), - ) - .toList()); + await MainDB.instance.putUTXOs( + _selectedAvailable + .map( + (e) => e.copyWith( + isBlocked: true, + ), + ) + .toList(), + ); _selectedAvailable.clear(); } setState(() {}); @@ -689,7 +700,8 @@ class _CoinControlViewState extends ConsumerState { .format(selectedSum), style: widget.requestedTotal == null ? STextStyles.w600_14(context) - : STextStyles.w600_14(context).copyWith( + : STextStyles.w600_14(context) + .copyWith( color: selectedSum >= widget .requestedTotal! @@ -700,7 +712,8 @@ class _CoinControlViewState extends ConsumerState { : Theme.of(context) .extension< StackColors>()! - .accentColorRed), + .accentColorRed, + ), ); }, ), diff --git a/lib/pages/coin_control/utxo_card.dart b/lib/pages/coin_control/utxo_card.dart index 9dc2bd900..c0a8395aa 100644 --- a/lib/pages/coin_control/utxo_card.dart +++ b/lib/pages/coin_control/utxo_card.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../db/isar/main_db.dart'; import '../../models/isar/models/isar_models.dart'; import '../../providers/global/wallets_provider.dart'; @@ -90,83 +91,84 @@ class _UtxoCardState extends ConsumerState { ? Theme.of(context).extension()!.popupBG : Colors.transparent, child: StreamBuilder( - stream: stream, - builder: (context, snapshot) { - if (snapshot.hasData) { - utxo = snapshot.data!; - } - return Row( - children: [ - ConditionalParent( - condition: widget.canSelect, - builder: (child) => GestureDetector( - onTap: () { - _selected = !_selected; - widget.onSelectedChanged(_selected); - setState(() {}); - }, - child: child, - ), - child: UTXOStatusIcon( - blocked: utxo.isBlocked, - status: utxo.isConfirmed( - currentHeight, - ref - .watch(pWallets) - .getWallet(widget.walletId) - .cryptoCurrency - .minConfirms, - ) - ? UTXOStatusIconStatus.confirmed - : UTXOStatusIconStatus.unconfirmed, - background: - Theme.of(context).extension()!.popupBG, - selected: _selected, - width: 32, - height: 32, - ), + stream: stream, + builder: (context, snapshot) { + if (snapshot.hasData) { + utxo = snapshot.data!; + } + return Row( + children: [ + ConditionalParent( + condition: widget.canSelect, + builder: (child) => GestureDetector( + onTap: () { + _selected = !_selected; + widget.onSelectedChanged(_selected); + setState(() {}); + }, + child: child, ), - const SizedBox( - width: 10, + child: UTXOStatusIcon( + blocked: utxo.isBlocked, + status: utxo.isConfirmed( + currentHeight, + ref + .watch(pWallets) + .getWallet(widget.walletId) + .cryptoCurrency + .minConfirms, + ) + ? UTXOStatusIconStatus.confirmed + : UTXOStatusIconStatus.unconfirmed, + background: + Theme.of(context).extension()!.popupBG, + selected: _selected, + width: 32, + height: 32, ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - ref.watch(pAmountFormatter(coin)).format( - utxo.value.toAmountAsRaw( - fractionDigits: coin.fractionDigits, - ), - ), - style: STextStyles.w600_14(context), - ), - const SizedBox( - height: 2, - ), - Row( - children: [ - Flexible( - child: Text( - utxo.name.isNotEmpty - ? utxo.name - : utxo.address ?? utxo.txid, - style: STextStyles.w500_12(context).copyWith( - color: Theme.of(context) - .extension()! - .textSubtitle1, - ), + ), + const SizedBox( + width: 10, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + ref.watch(pAmountFormatter(coin)).format( + utxo.value.toAmountAsRaw( + fractionDigits: coin.fractionDigits, ), ), - ], - ), - ], - ), + style: STextStyles.w600_14(context), + ), + const SizedBox( + height: 2, + ), + Row( + children: [ + Flexible( + child: Text( + utxo.name.isNotEmpty + ? utxo.name + : utxo.address ?? utxo.txid, + style: STextStyles.w500_12(context).copyWith( + color: Theme.of(context) + .extension()! + .textSubtitle1, + ), + ), + ), + ], + ), + ], ), - ], - ); - }), + ), + ], + ); + }, + ), ), ); } diff --git a/lib/pages/coin_control/utxo_details_view.dart b/lib/pages/coin_control/utxo_details_view.dart index f27db669e..54a6f6e5a 100644 --- a/lib/pages/coin_control/utxo_details_view.dart +++ b/lib/pages/coin_control/utxo_details_view.dart @@ -550,7 +550,7 @@ class _UtxoDetailsViewState extends ConsumerState { } class _Div extends StatelessWidget { - const _Div({Key? key}) : super(key: key); + const _Div({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/pages/exchange_view/choose_from_stack_view.dart b/lib/pages/exchange_view/choose_from_stack_view.dart index 0e6cc8627..73d79f647 100644 --- a/lib/pages/exchange_view/choose_from_stack_view.dart +++ b/lib/pages/exchange_view/choose_from_stack_view.dart @@ -131,7 +131,7 @@ class _ChooseFromStackViewState extends ConsumerState { ), ], ), - ) + ), ], ), ), diff --git a/lib/pages/exchange_view/confirm_change_now_send.dart b/lib/pages/exchange_view/confirm_change_now_send.dart index 4e99f9bcf..09aac4df9 100644 --- a/lib/pages/exchange_view/confirm_change_now_send.dart +++ b/lib/pages/exchange_view/confirm_change_now_send.dart @@ -12,12 +12,11 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:uuid/uuid.dart'; + import '../../models/exchange/response_objects/trade.dart'; import '../../models/isar/models/isar_models.dart'; import '../../models/trade_wallet_lookup.dart'; -import '../pinpad_views/lock_screen_view.dart'; -import '../send_view/sub_widgets/sending_transaction_dialog.dart'; -import '../wallet_view/wallet_view.dart'; import '../../pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_auth_send.dart'; import '../../providers/db/main_db_provider.dart'; import '../../providers/providers.dart'; @@ -42,7 +41,9 @@ import '../../widgets/desktop/secondary_button.dart'; import '../../widgets/rounded_container.dart'; import '../../widgets/rounded_white_container.dart'; import '../../widgets/stack_dialog.dart'; -import 'package:uuid/uuid.dart'; +import '../pinpad_views/lock_screen_view.dart'; +import '../send_view/sub_widgets/sending_transaction_dialog.dart'; +import '../wallet_view/wallet_view.dart'; class ConfirmChangeNowSendView extends ConsumerStatefulWidget { const ConfirmChangeNowSendView({ @@ -342,7 +343,7 @@ class _ConfirmChangeNowSendViewState Text( "Confirm ${ref.watch(pWalletCoin(walletId)).ticker} transaction", style: STextStyles.desktopH3(context), - ) + ), ], ), Padding( @@ -384,8 +385,11 @@ class _ConfirmChangeNowSendViewState children: [ Text( ref - .watch(pAmountFormatter( - ref.watch(pWalletCoin(walletId)))) + .watch( + pAmountFormatter( + ref.watch(pWalletCoin(walletId)), + ), + ) .format(widget.txData.fee!), style: STextStyles.desktopTextExtraExtraSmall(context) @@ -461,7 +465,7 @@ class _ConfirmChangeNowSendViewState ), ), ], - ) + ), ], ), ), @@ -574,41 +578,49 @@ class _ConfirmChangeNowSendViewState builder: (child) => Row( children: [ child, - Builder(builder: (context) { - final coin = ref.watch(pWalletCoin(walletId)); - final price = ref.watch( + Builder( + builder: (context) { + final coin = ref.watch(pWalletCoin(walletId)); + final price = ref.watch( priceAnd24hChangeNotifierProvider - .select((value) => value.getPrice(coin))); - final amountWithoutChange = - widget.txData.amountWithoutChange!; - final value = - (price.item1 * amountWithoutChange.decimal) - .toAmount(fractionDigits: 2); - final currency = ref.watch(prefsChangeNotifierProvider - .select((value) => value.currency)); - final locale = ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ); + .select((value) => value.getPrice(coin)), + ); + final amountWithoutChange = + widget.txData.amountWithoutChange!; + final value = + (price.item1 * amountWithoutChange.decimal) + .toAmount(fractionDigits: 2); + final currency = ref.watch( + prefsChangeNotifierProvider + .select((value) => value.currency), + ); + final locale = ref.watch( + localeServiceChangeNotifierProvider.select( + (value) => value.locale, + ), + ); - return Text( - " | ${value.fiatString(locale: locale)} $currency", - style: - STextStyles.desktopTextExtraExtraSmall(context) - .copyWith( - color: Theme.of(context) - .extension()! - .textSubtitle2, - ), - ); - }) + return Text( + " | ${value.fiatString(locale: locale)} $currency", + style: STextStyles.desktopTextExtraExtraSmall( + context) + .copyWith( + color: Theme.of(context) + .extension()! + .textSubtitle2, + ), + ); + }, + ), ], ), child: Text( ref - .watch(pAmountFormatter( - ref.watch(pWalletCoin(walletId)))) + .watch( + pAmountFormatter( + ref.watch(pWalletCoin(walletId)), + ), + ) .format((widget.txData.amountWithoutChange!)), style: STextStyles.itemSubtitle12(context), textAlign: TextAlign.right, @@ -637,7 +649,8 @@ class _ConfirmChangeNowSendViewState Text( ref .watch( - pAmountFormatter(ref.read(pWalletCoin(walletId)))) + pAmountFormatter(ref.read(pWalletCoin(walletId))), + ) .format( widget.txData.fee!, ), diff --git a/lib/pages/exchange_view/edit_trade_note_view.dart b/lib/pages/exchange_view/edit_trade_note_view.dart index 9f6c795ec..db918be65 100644 --- a/lib/pages/exchange_view/edit_trade_note_view.dart +++ b/lib/pages/exchange_view/edit_trade_note_view.dart @@ -23,10 +23,10 @@ import '../../widgets/textfield_icon_button.dart'; class EditTradeNoteView extends ConsumerStatefulWidget { const EditTradeNoteView({ - Key? key, + super.key, required this.tradeId, required this.note, - }) : super(key: key); + }); static const String routeName = "/editTradeNote"; @@ -151,7 +151,7 @@ class _EditNoteViewState extends ConsumerState { "Save", style: STextStyles.button(context), ), - ) + ), ], ), ), diff --git a/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart b/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart index ad13cebf4..109bee3ba 100644 --- a/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart +++ b/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart @@ -110,7 +110,7 @@ class _ExchangeCurrencySelectionViewState return await _getCurrencies(); } await ExchangeDataLoadingService.instance.initDB(); - List currencies = await ExchangeDataLoadingService + final List currencies = await ExchangeDataLoadingService .instance.isar.currencies .where() .filter() diff --git a/lib/pages/exchange_view/exchange_form.dart b/lib/pages/exchange_view/exchange_form.dart index 2783e9371..9d227f231 100644 --- a/lib/pages/exchange_view/exchange_form.dart +++ b/lib/pages/exchange_view/exchange_form.dart @@ -16,6 +16,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; +import 'package:tuple/tuple.dart'; +import 'package:uuid/uuid.dart'; + import '../../models/exchange/aggregate_currency.dart'; import '../../models/exchange/incomplete_exchange.dart'; import '../../models/exchange/response_objects/estimate.dart'; @@ -23,11 +26,6 @@ import '../../models/exchange/response_objects/range.dart'; import '../../models/isar/exchange_cache/currency.dart'; import '../../models/isar/exchange_cache/pair.dart'; import '../../models/isar/models/ethereum/eth_contract.dart'; -import 'exchange_coin_selection/exchange_currency_selection_view.dart'; -import 'exchange_step_views/step_1_view.dart'; -import 'exchange_step_views/step_2_view.dart'; -import 'sub_widgets/exchange_provider_options.dart'; -import 'sub_widgets/rate_type_toggle.dart'; import '../../pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart'; import '../../providers/providers.dart'; import '../../services/exchange/change_now/change_now_exchange.dart'; @@ -43,7 +41,6 @@ import '../../utilities/constants.dart'; import '../../utilities/enums/exchange_rate_type_enum.dart'; import '../../utilities/text_styles.dart'; import '../../utilities/util.dart'; -import '../../wallets/crypto_currency/coins/bitcoin.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../widgets/conditional_parent.dart'; import '../../widgets/custom_loading_overlay.dart'; @@ -55,8 +52,11 @@ import '../../widgets/rounded_container.dart'; import '../../widgets/rounded_white_container.dart'; import '../../widgets/stack_dialog.dart'; import '../../widgets/textfields/exchange_textfield.dart'; -import 'package:tuple/tuple.dart'; -import 'package:uuid/uuid.dart'; +import 'exchange_coin_selection/exchange_currency_selection_view.dart'; +import 'exchange_step_views/step_1_view.dart'; +import 'exchange_step_views/step_2_view.dart'; +import 'sub_widgets/exchange_provider_options.dart'; +import 'sub_widgets/rate_type_toggle.dart'; class ExchangeForm extends ConsumerStatefulWidget { const ExchangeForm({ @@ -173,8 +173,9 @@ class _ExchangeFormState extends ConsumerState { .tryParse( value, locale: ref.read(localeServiceChangeNotifierProvider).locale, - coin: Bitcoin(CryptoCurrencyNetwork - .main), // dummy value (not used due to override) + coin: Bitcoin( + CryptoCurrencyNetwork.main, + ), // dummy value (not used due to override) overrideWithDecimalPlacesFromString: true, ) ?.decimal; @@ -184,15 +185,17 @@ class _ExchangeFormState extends ConsumerState { final rateType = ref.read(efRateTypeProvider); final currencies = await ExchangeDataLoadingService.instance.isar.currencies .filter() - .group((q) => rateType == ExchangeRateType.fixed - ? q - .rateTypeEqualTo(SupportedRateType.both) - .or() - .rateTypeEqualTo(SupportedRateType.fixed) - : q - .rateTypeEqualTo(SupportedRateType.both) - .or() - .rateTypeEqualTo(SupportedRateType.estimated)) + .group( + (q) => rateType == ExchangeRateType.fixed + ? q + .rateTypeEqualTo(SupportedRateType.both) + .or() + .rateTypeEqualTo(SupportedRateType.fixed) + : q + .rateTypeEqualTo(SupportedRateType.both) + .or() + .rateTypeEqualTo(SupportedRateType.estimated), + ) .and() .tickerEqualTo( currency.ticker, @@ -364,7 +367,8 @@ class _ExchangeFormState extends ConsumerState { ], ), ); - }) + }, + ) : await Navigator.of(context).push( MaterialPageRoute( builder: (_) => ExchangeCurrencySelectionView( @@ -489,7 +493,7 @@ class _ExchangeFormState extends ConsumerState { ), ), ], - ) + ), ], ), ); @@ -949,7 +953,8 @@ class _ExchangeFormState extends ConsumerState { ), ExchangeTextField( key: Key( - "exchangeTextFieldKeyFor1_${Theme.of(context).extension()!.themeId}"), + "exchangeTextFieldKeyFor1_${Theme.of(context).extension()!.themeId}", + ), focusNode: _receiveFocusNode, controller: _receiveController, textStyle: STextStyles.smallMed14(context).copyWith( @@ -1011,7 +1016,7 @@ class _ExchangeFormState extends ConsumerState { enabled: ref.watch(efCanExchangeProvider), onPressed: onExchangePressed, label: "Swap", - ) + ), ], ); } diff --git a/lib/pages/exchange_view/exchange_loading_overlay.dart b/lib/pages/exchange_view/exchange_loading_overlay.dart index b73d22527..5ccf12cf4 100644 --- a/lib/pages/exchange_view/exchange_loading_overlay.dart +++ b/lib/pages/exchange_view/exchange_loading_overlay.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../providers/exchange/changenow_initial_load_status.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/text_styles.dart'; @@ -18,9 +19,9 @@ import '../../widgets/stack_dialog.dart'; class ExchangeLoadingOverlayView extends ConsumerStatefulWidget { const ExchangeLoadingOverlayView({ - Key? key, + super.key, required this.unawaitedLoad, - }) : super(key: key); + }); final VoidCallback unawaitedLoad; @@ -80,7 +81,9 @@ class _ExchangeLoadingOverlayViewState .overlay .withOpacity(0.7), child: const CustomLoadingOverlay( - message: "Loading Exchange data", eventBus: null), + message: "Loading Exchange data", + eventBus: null, + ), ), if ((_statusEst == ChangeNowLoadStatus.failed || _statusFixed == ChangeNowLoadStatus.failed) && diff --git a/lib/pages/exchange_view/exchange_step_views/step_1_view.dart b/lib/pages/exchange_view/exchange_step_views/step_1_view.dart index c02647f6e..8e582dab9 100644 --- a/lib/pages/exchange_view/exchange_step_views/step_1_view.dart +++ b/lib/pages/exchange_view/exchange_step_views/step_1_view.dart @@ -9,9 +9,8 @@ */ import 'package:flutter/material.dart'; + import '../../../models/exchange/incomplete_exchange.dart'; -import 'step_2_view.dart'; -import '../sub_widgets/step_row.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/clipboard_interface.dart'; import '../../../utilities/enums/exchange_rate_type_enum.dart'; @@ -19,13 +18,15 @@ import '../../../utilities/text_styles.dart'; import '../../../widgets/background.dart'; import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../widgets/rounded_white_container.dart'; +import '../sub_widgets/step_row.dart'; +import 'step_2_view.dart'; class Step1View extends StatefulWidget { const Step1View({ - Key? key, + super.key, required this.model, this.clipboard = const ClipboardWrapper(), - }) : super(key: key); + }); static const String routeName = "/exchangeStep1"; @@ -116,17 +117,19 @@ class _Step1ViewState extends State { "You send", style: STextStyles.itemSubtitle(context) .copyWith( - color: Theme.of(context) - .extension()! - .infoItemText), + color: Theme.of(context) + .extension()! + .infoItemText, + ), ), Text( "${model.sendAmount.toStringAsFixed(8)} ${model.sendTicker.toUpperCase()}", style: STextStyles.itemSubtitle12(context) .copyWith( - color: Theme.of(context) - .extension()! - .infoItemText), + color: Theme.of(context) + .extension()! + .infoItemText, + ), ), ], ), @@ -142,17 +145,19 @@ class _Step1ViewState extends State { "You receive", style: STextStyles.itemSubtitle(context) .copyWith( - color: Theme.of(context) - .extension()! - .infoItemText), + color: Theme.of(context) + .extension()! + .infoItemText, + ), ), Text( "~${model.receiveAmount.toStringAsFixed(8)} ${model.receiveTicker.toUpperCase()}", style: STextStyles.itemSubtitle12(context) .copyWith( - color: Theme.of(context) - .extension()! - .infoItemText), + color: Theme.of(context) + .extension()! + .infoItemText, + ), ), ], ), @@ -179,9 +184,10 @@ class _Step1ViewState extends State { model.rateInfo, style: STextStyles.itemSubtitle12(context) .copyWith( - color: Theme.of(context) - .extension()! - .infoItemText), + color: Theme.of(context) + .extension()! + .infoItemText, + ), ), ], ), @@ -193,8 +199,9 @@ class _Step1ViewState extends State { TextButton( onPressed: () { Navigator.of(context).pushNamed( - Step2View.routeName, - arguments: model); + Step2View.routeName, + arguments: model, + ); }, style: Theme.of(context) .extension()! diff --git a/lib/pages/exchange_view/exchange_step_views/step_2_view.dart b/lib/pages/exchange_view/exchange_step_views/step_2_view.dart index 6071c4556..433984627 100644 --- a/lib/pages/exchange_view/exchange_step_views/step_2_view.dart +++ b/lib/pages/exchange_view/exchange_step_views/step_2_view.dart @@ -42,11 +42,11 @@ import 'step_3_view.dart'; class Step2View extends ConsumerStatefulWidget { const Step2View({ - Key? key, + super.key, required this.model, this.clipboard = const ClipboardWrapper(), this.barcodeScanner = const BarcodeScannerWrapper(), - }) : super(key: key); + }); static const String routeName = "/exchangeStep2"; diff --git a/lib/pages/exchange_view/exchange_step_views/step_3_view.dart b/lib/pages/exchange_view/exchange_step_views/step_3_view.dart index 2e6b2b237..93856486e 100644 --- a/lib/pages/exchange_view/exchange_step_views/step_3_view.dart +++ b/lib/pages/exchange_view/exchange_step_views/step_3_view.dart @@ -12,10 +12,9 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../models/exchange/incomplete_exchange.dart'; import '../../../models/exchange/response_objects/trade.dart'; -import 'step_4_view.dart'; -import '../sub_widgets/step_row.dart'; import '../../../providers/global/trades_service_provider.dart'; import '../../../providers/providers.dart'; import '../../../services/exchange/exchange_response.dart'; @@ -31,13 +30,15 @@ import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../widgets/custom_loading_overlay.dart'; import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/stack_dialog.dart'; +import '../sub_widgets/step_row.dart'; +import 'step_4_view.dart'; class Step3View extends ConsumerStatefulWidget { const Step3View({ - Key? key, + super.key, required this.model, this.clipboard = const ClipboardWrapper(), - }) : super(key: key); + }); static const String routeName = "/exchangeStep3"; @@ -127,7 +128,7 @@ class _Step3ViewState extends ConsumerState { Text( "${model.sendAmount.toString()} ${model.sendTicker.toUpperCase()}", style: STextStyles.itemSubtitle12(context), - ) + ), ], ), ), @@ -145,7 +146,7 @@ class _Step3ViewState extends ConsumerState { Text( "${model.receiveAmount.toString()} ${model.receiveTicker.toUpperCase()}", style: STextStyles.itemSubtitle12(context), - ) + ), ], ), ), @@ -163,7 +164,7 @@ class _Step3ViewState extends ConsumerState { Text( model.rateInfo, style: STextStyles.itemSubtitle12(context), - ) + ), ], ), ), @@ -184,7 +185,7 @@ class _Step3ViewState extends ConsumerState { Text( model.recipientAddress!, style: STextStyles.itemSubtitle12(context), - ) + ), ], ), ), @@ -207,7 +208,7 @@ class _Step3ViewState extends ConsumerState { Text( model.refundAddress!, style: STextStyles.itemSubtitle12(context), - ) + ), ], ), ), @@ -321,22 +322,27 @@ class _Step3ViewState extends ConsumerState { Navigator.of(context).pop(); } - unawaited(NotificationApi.showNotification( - changeNowId: model.trade!.tradeId, - title: status, - body: "Trade ID ${model.trade!.tradeId}", - walletId: "", - iconAssetName: Assets.svg.arrowRotate, - date: model.trade!.timestamp, - shouldWatchForUpdates: true, - coinName: "coinName", - )); + unawaited( + NotificationApi.showNotification( + changeNowId: model.trade!.tradeId, + title: status, + body: + "Trade ID ${model.trade!.tradeId}", + walletId: "", + iconAssetName: Assets.svg.arrowRotate, + date: model.trade!.timestamp, + shouldWatchForUpdates: true, + coinName: "coinName", + ), + ); if (mounted) { - unawaited(Navigator.of(context).pushNamed( - Step4View.routeName, - arguments: model, - )); + unawaited( + Navigator.of(context).pushNamed( + Step4View.routeName, + arguments: model, + ), + ); } }, style: Theme.of(context) diff --git a/lib/pages/exchange_view/exchange_step_views/step_4_view.dart b/lib/pages/exchange_view/exchange_step_views/step_4_view.dart index 3d0730ee4..d992451a7 100644 --- a/lib/pages/exchange_view/exchange_step_views/step_4_view.dart +++ b/lib/pages/exchange_view/exchange_step_views/step_4_view.dart @@ -15,15 +15,11 @@ import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:qr_flutter/qr_flutter.dart'; +import 'package:tuple/tuple.dart'; + import '../../../app_config.dart'; import '../../../models/exchange/incomplete_exchange.dart'; import '../../../notifications/show_flush_bar.dart'; -import '../confirm_change_now_send.dart'; -import '../send_from_view.dart'; -import '../sub_widgets/step_row.dart'; -import '../../home_view/home_view.dart'; -import '../../send_view/sub_widgets/building_transaction_dialog.dart'; -import '../../wallet_view/wallet_view.dart'; import '../../../providers/providers.dart'; import '../../../route_generator.dart'; import '../../../themes/stack_colors.dart'; @@ -44,14 +40,19 @@ import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/rounded_container.dart'; import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/stack_dialog.dart'; -import 'package:tuple/tuple.dart'; +import '../../home_view/home_view.dart'; +import '../../send_view/sub_widgets/building_transaction_dialog.dart'; +import '../../wallet_view/wallet_view.dart'; +import '../confirm_change_now_send.dart'; +import '../send_from_view.dart'; +import '../sub_widgets/step_row.dart'; class Step4View extends ConsumerStatefulWidget { const Step4View({ - Key? key, + super.key, required this.model, this.clipboard = const ClipboardWrapper(), - }) : super(key: key); + }); static const String routeName = "/exchangeStep4"; @@ -816,7 +817,7 @@ class _Step4ViewState extends ConsumerState { Builder( builder: (context) { String buttonTitle = - "Send from {$AppConfig.appName}"; + "Send from ${AppConfig.appName}"; final tuple = ref .read( diff --git a/lib/pages/exchange_view/exchange_view.dart b/lib/pages/exchange_view/exchange_view.dart index b5fe193bd..1c70a64d0 100644 --- a/lib/pages/exchange_view/exchange_view.dart +++ b/lib/pages/exchange_view/exchange_view.dart @@ -13,10 +13,10 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; +import 'package:tuple/tuple.dart'; + import '../../db/isar/main_db.dart'; import '../../models/isar/models/blockchain_data/transaction.dart'; -import 'exchange_form.dart'; -import 'trade_details_view.dart'; import '../../providers/global/trades_service_provider.dart'; import '../../providers/providers.dart'; import '../../services/exchange/exchange_data_loading_service.dart'; @@ -26,10 +26,11 @@ import '../../utilities/text_styles.dart'; import '../../widgets/conditional_parent.dart'; import '../../widgets/custom_loading_overlay.dart'; import '../../widgets/trade_card.dart'; -import 'package:tuple/tuple.dart'; +import 'exchange_form.dart'; +import 'trade_details_view.dart'; class ExchangeView extends ConsumerStatefulWidget { - const ExchangeView({Key? key}) : super(key: key); + const ExchangeView({super.key}); @override ConsumerState createState() => _ExchangeViewState(); @@ -102,7 +103,7 @@ class _ExchangeViewState extends ConsumerState { subMessage: "This could take a few minutes", eventBus: null, ), - ) + ), ], ); }, @@ -124,7 +125,7 @@ class _ExchangeViewState extends ConsumerState { child: ExchangeForm(), ), ), - ) + ), ]; }, body: Builder( @@ -169,63 +170,78 @@ class _ExchangeViewState extends ConsumerState { ), if (hasHistory) SliverList( - delegate: SliverChildBuilderDelegate((context, index) { - return Padding( - padding: const EdgeInsets.all(4), - child: TradeCard( - key: Key("tradeCard_${trades[index].uuid}"), - trade: trades[index], - onTap: () async { - final String tradeId = trades[index].tradeId; + delegate: SliverChildBuilderDelegate( + (context, index) { + return Padding( + padding: const EdgeInsets.all(4), + child: TradeCard( + key: Key("tradeCard_${trades[index].uuid}"), + trade: trades[index], + onTap: () async { + final String tradeId = trades[index].tradeId; - final lookup = ref - .read(tradeSentFromStackLookupProvider) - .all; - - //todo: check if print needed - // debugPrint("ALL: $lookup"); - - final String? txid = ref - .read(tradeSentFromStackLookupProvider) - .getTxidForTradeId(tradeId); - final List? walletIds = ref - .read(tradeSentFromStackLookupProvider) - .getWalletIdsForTradeId(tradeId); - - if (txid != null && - walletIds != null && - walletIds.isNotEmpty) { - final wallet = ref - .read(pWallets) - .getWallet(walletIds.first); + final lookup = ref + .read(tradeSentFromStackLookupProvider) + .all; //todo: check if print needed - // debugPrint("name: ${manager.walletName}"); + // debugPrint("ALL: $lookup"); - final tx = await MainDB.instance - .getTransactions(walletIds.first) - .filter() - .txidEqualTo(txid) - .findFirst(); + final String? txid = ref + .read(tradeSentFromStackLookupProvider) + .getTxidForTradeId(tradeId); + final List? walletIds = ref + .read(tradeSentFromStackLookupProvider) + .getWalletIdsForTradeId(tradeId); - if (mounted) { - unawaited(Navigator.of(context).pushNamed( - TradeDetailsView.routeName, - arguments: Tuple4(tradeId, tx, - walletIds.first, wallet.info.name), - )); + if (txid != null && + walletIds != null && + walletIds.isNotEmpty) { + final wallet = ref + .read(pWallets) + .getWallet(walletIds.first); + + //todo: check if print needed + // debugPrint("name: ${manager.walletName}"); + + final tx = await MainDB.instance + .getTransactions(walletIds.first) + .filter() + .txidEqualTo(txid) + .findFirst(); + + if (mounted) { + unawaited( + Navigator.of(context).pushNamed( + TradeDetailsView.routeName, + arguments: Tuple4( + tradeId, + tx, + walletIds.first, + wallet.info.name, + ), + ), + ); + } + } else { + unawaited( + Navigator.of(context).pushNamed( + TradeDetailsView.routeName, + arguments: Tuple4( + tradeId, + null, + walletIds?.first, + null, + ), + ), + ); } - } else { - unawaited(Navigator.of(context).pushNamed( - TradeDetailsView.routeName, - arguments: Tuple4( - tradeId, null, walletIds?.first, null), - )); - } - }, - ), - ); - }, childCount: tradeCount), + }, + ), + ); + }, + childCount: tradeCount, + ), ), if (!hasHistory) SliverToBoxAdapter( diff --git a/lib/pages/exchange_view/send_from_view.dart b/lib/pages/exchange_view/send_from_view.dart index bf7e18df2..680330753 100644 --- a/lib/pages/exchange_view/send_from_view.dart +++ b/lib/pages/exchange_view/send_from_view.dart @@ -31,8 +31,6 @@ import '../../utilities/constants.dart'; import '../../utilities/enums/fee_rate_type_enum.dart'; import '../../utilities/text_styles.dart'; import '../../utilities/util.dart'; -import '../../wallets/crypto_currency/coins/firo.dart'; -import '../../wallets/crypto_currency/coins/stellar.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../wallets/isar/providers/wallet_info_provider.dart'; import '../../wallets/models/tx_data.dart'; @@ -48,14 +46,14 @@ import '../../widgets/stack_dialog.dart'; class SendFromView extends ConsumerStatefulWidget { const SendFromView({ - Key? key, + super.key, required this.coin, required this.trade, required this.amount, required this.address, this.shouldPopRoot = false, this.fromDesktopStep4 = false, - }) : super(key: key); + }); static const String routeName = "/sendFrom"; diff --git a/lib/pages/exchange_view/sub_widgets/exchange_provider_option.dart b/lib/pages/exchange_view/sub_widgets/exchange_provider_option.dart index 29cbd7f7f..7ba126659 100644 --- a/lib/pages/exchange_view/sub_widgets/exchange_provider_option.dart +++ b/lib/pages/exchange_view/sub_widgets/exchange_provider_option.dart @@ -132,8 +132,9 @@ class _ExchangeOptionState extends ConsumerState { localeServiceChangeNotifierProvider .select((value) => value.locale), ), - coin: Bitcoin(CryptoCurrencyNetwork - .main), // some sane default + coin: Bitcoin( + CryptoCurrencyNetwork.main, + ), // some sane default maxDecimals: 8, // some sane default ); rateString = "1 ${sendCurrency.ticker.toUpperCase()} " @@ -222,14 +223,14 @@ class _ExchangeOptionState extends ConsumerState { class _ProviderOption extends ConsumerStatefulWidget { const _ProviderOption({ - Key? key, + super.key, required this.exchange, required this.estimate, required this.rateString, this.kycRating, this.loadingString = false, this.rateColor, - }) : super(key: key); + }); final Exchange exchange; final Estimate? estimate; diff --git a/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart b/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart index dd6afa8ed..436e724ea 100644 --- a/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart +++ b/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart @@ -24,10 +24,10 @@ import '../../../widgets/rounded_white_container.dart'; class ExchangeProviderOptions extends ConsumerStatefulWidget { const ExchangeProviderOptions({ - Key? key, + super.key, required this.fixedRate, required this.reversed, - }) : super(key: key); + }); final bool fixedRate; final bool reversed; diff --git a/lib/pages/exchange_view/sub_widgets/rate_type_toggle.dart b/lib/pages/exchange_view/sub_widgets/rate_type_toggle.dart index 6840fa139..3450c7ddd 100644 --- a/lib/pages/exchange_view/sub_widgets/rate_type_toggle.dart +++ b/lib/pages/exchange_view/sub_widgets/rate_type_toggle.dart @@ -20,9 +20,9 @@ import '../../../widgets/toggle.dart'; class RateTypeToggle extends ConsumerWidget { const RateTypeToggle({ - Key? key, + super.key, this.onChanged, - }) : super(key: key); + }); final void Function(ExchangeRateType)? onChanged; diff --git a/lib/pages/exchange_view/sub_widgets/step_indicator.dart b/lib/pages/exchange_view/sub_widgets/step_indicator.dart index d1d440190..e45609035 100644 --- a/lib/pages/exchange_view/sub_widgets/step_indicator.dart +++ b/lib/pages/exchange_view/sub_widgets/step_indicator.dart @@ -18,11 +18,11 @@ enum StepIndicatorStatus { current, completed, incomplete } class StepIndicator extends StatelessWidget { const StepIndicator({ - Key? key, + super.key, required this.step, required this.status, this.size = 16, - }) : super(key: key); + }); final int step; final StepIndicatorStatus status; diff --git a/lib/pages/exchange_view/sub_widgets/step_row.dart b/lib/pages/exchange_view/sub_widgets/step_row.dart index 95a8f4a17..d555438cb 100644 --- a/lib/pages/exchange_view/sub_widgets/step_row.dart +++ b/lib/pages/exchange_view/sub_widgets/step_row.dart @@ -9,18 +9,19 @@ */ import 'package:flutter/material.dart'; -import 'step_indicator.dart'; + import '../../../themes/stack_colors.dart'; +import 'step_indicator.dart'; class StepRow extends StatelessWidget { const StepRow({ - Key? key, + super.key, required this.count, required this.current, required this.width, this.indicatorSize = 16, this.minSpacing = 4, - }) : super(key: key); + }); final int count; final int current; @@ -53,23 +54,29 @@ class StepRow extends StatelessWidget { } List _buildList(double spacerWidth, BuildContext context) { - List list = []; + final List list = []; for (int i = 0; i < count - 1; i++) { - list.add(StepIndicator( - step: i + 1, - status: getStatus(i), - )); - list.add(_SpacerRow( - width: spacerWidth, - dotSize: 1.5, - spacing: 4, - color: getColor(i, context), - )); + list.add( + StepIndicator( + step: i + 1, + status: getStatus(i), + ), + ); + list.add( + _SpacerRow( + width: spacerWidth, + dotSize: 1.5, + spacing: 4, + color: getColor(i, context), + ), + ); } - list.add(StepIndicator( - step: count, - status: getStatus(count - 1), - )); + list.add( + StepIndicator( + step: count, + status: getStatus(count - 1), + ), + ); return list; } @@ -88,12 +95,12 @@ class StepRow extends StatelessWidget { class _SpacerRow extends StatelessWidget { const _SpacerRow({ - Key? key, + super.key, required this.width, required this.dotSize, required this.spacing, required this.color, - }) : super(key: key); + }); final Color color; final double width; @@ -128,10 +135,10 @@ class _SpacerRow extends StatelessWidget { class _SpacerDot extends StatelessWidget { const _SpacerDot({ - Key? key, + super.key, required this.color, this.size = 1.5, - }) : super(key: key); + }); final double size; final Color color; diff --git a/lib/pages/exchange_view/wallet_initiated_exchange_view.dart b/lib/pages/exchange_view/wallet_initiated_exchange_view.dart index ac81190bf..bfdb0e647 100644 --- a/lib/pages/exchange_view/wallet_initiated_exchange_view.dart +++ b/lib/pages/exchange_view/wallet_initiated_exchange_view.dart @@ -119,7 +119,7 @@ class _WalletInitiatedExchangeViewState subMessage: "This could take a few minutes", eventBus: null, ), - ) + ), ], ); }, diff --git a/lib/pages/generic/single_field_edit_view.dart b/lib/pages/generic/single_field_edit_view.dart index d78f6f599..b02490db4 100644 --- a/lib/pages/generic/single_field_edit_view.dart +++ b/lib/pages/generic/single_field_edit_view.dart @@ -26,10 +26,10 @@ import '../../widgets/textfield_icon_button.dart'; class SingleFieldEditView extends StatefulWidget { const SingleFieldEditView({ - Key? key, + super.key, required this.initialValue, required this.label, - }) : super(key: key); + }); static const String routeName = "/singleFieldEdit"; diff --git a/lib/pages/home_view/home_view.dart b/lib/pages/home_view/home_view.dart index 0173064c2..f5e43eac2 100644 --- a/lib/pages/home_view/home_view.dart +++ b/lib/pages/home_view/home_view.dart @@ -200,7 +200,7 @@ class _HomeViewState extends ConsumerState { Text( "My ${AppConfig.prefix}", style: STextStyles.navBarTitle(context), - ) + ), ], ), actions: [ @@ -232,8 +232,10 @@ class _HomeViewState extends ConsumerState { color: Theme.of(context) .extension()! .backgroundAppBar, - icon: ref.watch(notificationsProvider - .select((value) => value.hasUnreadNotifications)) + icon: ref.watch( + notificationsProvider + .select((value) => value.hasUnreadNotifications), + ) ? SvgPicture.file( File( ref.watch( @@ -244,8 +246,11 @@ class _HomeViewState extends ConsumerState { ), width: 20, height: 20, - color: ref.watch(notificationsProvider.select( - (value) => value.hasUnreadNotifications)) + color: ref.watch( + notificationsProvider.select( + (value) => value.hasUnreadNotifications, + ), + ) ? null : Theme.of(context) .extension()! @@ -255,8 +260,11 @@ class _HomeViewState extends ConsumerState { Assets.svg.bell, width: 20, height: 20, - color: ref.watch(notificationsProvider.select( - (value) => value.hasUnreadNotifications)) + color: ref.watch( + notificationsProvider.select( + (value) => value.hasUnreadNotifications, + ), + ) ? null : Theme.of(context) .extension()! @@ -274,14 +282,16 @@ class _HomeViewState extends ConsumerState { .state; if (unreadNotificationIds.isEmpty) return; - List> futures = []; + final List> futures = []; for (int i = 0; i < unreadNotificationIds.length - 1; i++) { - futures.add(ref - .read(notificationsProvider) - .markAsRead( - unreadNotificationIds.elementAt(i), false)); + futures.add( + ref.read(notificationsProvider).markAsRead( + unreadNotificationIds.elementAt(i), + false, + ), + ); } // wait for multiple to update if any diff --git a/lib/pages/home_view/sub_widgets/home_view_button_bar.dart b/lib/pages/home_view/sub_widgets/home_view_button_bar.dart index e51ecacb7..8744e1980 100644 --- a/lib/pages/home_view/sub_widgets/home_view_button_bar.dart +++ b/lib/pages/home_view/sub_widgets/home_view_button_bar.dart @@ -15,7 +15,7 @@ import '../../../themes/stack_colors.dart'; import '../../../utilities/text_styles.dart'; class HomeViewButtonBar extends ConsumerStatefulWidget { - const HomeViewButtonBar({Key? key}) : super(key: key); + const HomeViewButtonBar({super.key}); @override ConsumerState createState() => _HomeViewButtonBarState(); diff --git a/lib/pages/intro_view.dart b/lib/pages/intro_view.dart index 0f99aabae..b1666cd04 100644 --- a/lib/pages/intro_view.dart +++ b/lib/pages/intro_view.dart @@ -187,7 +187,7 @@ class _IntroViewState extends ConsumerState { } class AppNameText extends StatelessWidget { - const AppNameText({Key? key, required this.isDesktop}) : super(key: key); + const AppNameText({super.key, required this.isDesktop}); final bool isDesktop; @@ -209,7 +209,7 @@ class AppNameText extends StatelessWidget { } class IntroAboutText extends StatelessWidget { - const IntroAboutText({Key? key, required this.isDesktop}) : super(key: key); + const IntroAboutText({super.key, required this.isDesktop}); final bool isDesktop; @@ -228,8 +228,7 @@ class IntroAboutText extends StatelessWidget { } class PrivacyAndTOSText extends StatelessWidget { - const PrivacyAndTOSText({Key? key, required this.isDesktop}) - : super(key: key); + const PrivacyAndTOSText({super.key, required this.isDesktop}); final bool isDesktop; @@ -241,7 +240,8 @@ class PrivacyAndTOSText extends StatelessWidget { text: TextSpan( style: STextStyles.label(context).copyWith(fontSize: fontSize), children: [ - TextSpan(text: "By using ${AppConfig.appName}, you agree to the "), + const TextSpan( + text: "By using ${AppConfig.appName}, you agree to the "), TextSpan( text: "Terms of service", style: STextStyles.richLink(context).copyWith(fontSize: fontSize), @@ -272,7 +272,7 @@ class PrivacyAndTOSText extends StatelessWidget { } class GetStartedButton extends StatelessWidget { - const GetStartedButton({Key? key, required this.isDesktop}) : super(key: key); + const GetStartedButton({super.key, required this.isDesktop}); final bool isDesktop; diff --git a/lib/pages/loading_view.dart b/lib/pages/loading_view.dart index 67598d894..e347860ec 100644 --- a/lib/pages/loading_view.dart +++ b/lib/pages/loading_view.dart @@ -22,7 +22,7 @@ import '../widgets/conditional_parent.dart'; import '../widgets/rounded_container.dart'; class LoadingView extends ConsumerWidget { - const LoadingView({Key? key}) : super(key: key); + const LoadingView({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { diff --git a/lib/pages/manage_favorites_view/manage_favorites_view.dart b/lib/pages/manage_favorites_view/manage_favorites_view.dart index a6fe24401..a3673e95a 100644 --- a/lib/pages/manage_favorites_view/manage_favorites_view.dart +++ b/lib/pages/manage_favorites_view/manage_favorites_view.dart @@ -22,7 +22,7 @@ import '../../widgets/desktop/desktop_scaffold.dart'; import '../../widgets/managed_favorite.dart'; class ManageFavoritesView extends StatelessWidget { - const ManageFavoritesView({Key? key}) : super(key: key); + const ManageFavoritesView({super.key}); static const routeName = "/manageFavorites"; @@ -219,7 +219,7 @@ class ManageFavoritesView extends StatelessWidget { ), ); }, - ) + ), ], ), ), diff --git a/lib/pages/monkey/monkey_view.dart b/lib/pages/monkey/monkey_view.dart index d2da7026a..f8f9d3f4d 100644 --- a/lib/pages/monkey/monkey_view.dart +++ b/lib/pages/monkey/monkey_view.dart @@ -6,6 +6,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:path_provider/path_provider.dart'; import 'package:permission_handler/permission_handler.dart'; + import '../../notifications/show_flush_bar.dart'; import '../../providers/global/wallets_provider.dart'; import '../../services/monkey_service.dart'; @@ -30,9 +31,9 @@ import '../../widgets/stack_dialog.dart'; class MonkeyView extends ConsumerStatefulWidget { const MonkeyView({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); static const String routeName = "/monkey"; static const double navBarHeight = 65.0; @@ -89,7 +90,7 @@ class _MonkeyViewState extends ConsumerState { filePath += isPNG ? ".png" : ".svg"; - File imgFile = File(filePath); + final File imgFile = File(filePath); if (imgFile.existsSync() && !overwrite) { throw Exception("File already exists"); @@ -249,7 +250,7 @@ class _MonkeyViewState extends ConsumerState { .extension()! .customTextButtonEnabledText, ), - ) + ), ], ), ), @@ -341,8 +342,9 @@ class _MonkeyViewState extends ConsumerState { whileFuture: Future.wait([ _saveMonKeyToFile( bytes: Uint8List.fromList( - (wallet as BananoWallet) - .getMonkeyImageBytes()!), + (wallet as BananoWallet) + .getMonkeyImageBytes()!, + ), ), Future.delayed( const Duration(seconds: 2), @@ -399,7 +401,8 @@ class _MonkeyViewState extends ConsumerState { ), ), Future.delayed( - const Duration(seconds: 2)), + const Duration(seconds: 2), + ), ]), context: context, rootNavigator: Util.isDesktop, diff --git a/lib/pages/monkey/sub_widgets/fetch_monkey_dialog.dart b/lib/pages/monkey/sub_widgets/fetch_monkey_dialog.dart index ba691645c..b3b5d7e6d 100644 --- a/lib/pages/monkey/sub_widgets/fetch_monkey_dialog.dart +++ b/lib/pages/monkey/sub_widgets/fetch_monkey_dialog.dart @@ -20,9 +20,9 @@ import '../../../widgets/stack_dialog.dart'; class FetchMonkeyDialog extends StatefulWidget { const FetchMonkeyDialog({ - Key? key, + super.key, required this.onCancel, - }) : super(key: key); + }); final Future Function() onCancel; diff --git a/lib/pages/notification_views/notifications_view.dart b/lib/pages/notification_views/notifications_view.dart index 03fbeb784..7a20efffd 100644 --- a/lib/pages/notification_views/notifications_view.dart +++ b/lib/pages/notification_views/notifications_view.dart @@ -21,9 +21,9 @@ import '../../widgets/rounded_white_container.dart'; class NotificationsView extends ConsumerStatefulWidget { const NotificationsView({ - Key? key, + super.key, this.walletId, - }) : super(key: key); + }); final String? walletId; @@ -112,7 +112,7 @@ class _NotificationsViewState extends ConsumerState { ), ), ), - ) + ), ], ), ), diff --git a/lib/pages/ordinals/ordinal_details_view.dart b/lib/pages/ordinals/ordinal_details_view.dart index 5fa7cfd25..02e0ee074 100644 --- a/lib/pages/ordinals/ordinal_details_view.dart +++ b/lib/pages/ordinals/ordinal_details_view.dart @@ -7,6 +7,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:path_provider/path_provider.dart'; import 'package:permission_handler/permission_handler.dart'; + import '../../models/isar/models/blockchain_data/utxo.dart'; import '../../models/isar/ordinal.dart'; import '../../networking/http.dart'; @@ -145,10 +146,10 @@ class _OrdinalDetailsViewState extends ConsumerState { class _DetailsItemWCopy extends StatelessWidget { const _DetailsItemWCopy({ - Key? key, + super.key, required this.title, required this.data, - }) : super(key: key); + }); final String title; final String data; @@ -219,10 +220,10 @@ class _DetailsItemWCopy extends StatelessWidget { class _OrdinalImageGroup extends ConsumerWidget { const _OrdinalImageGroup({ - Key? key, + super.key, required this.walletId, required this.ordinal, - }) : super(key: key); + }); final String walletId; final Ordinal ordinal; @@ -230,7 +231,7 @@ class _OrdinalImageGroup extends ConsumerWidget { static const _spacing = 12.0; Future _savePngToFile(WidgetRef ref) async { - HTTP client = HTTP(); + final HTTP client = HTTP(); final response = await client.get( url: Uri.parse(ordinal.content), @@ -241,7 +242,8 @@ class _OrdinalImageGroup extends ConsumerWidget { if (response.code != 200) { throw Exception( - "OrdinalDetailsView _savePngToFile statusCode=${response.code} body=${response.bodyBytes}"); + "OrdinalDetailsView _savePngToFile statusCode=${response.code} body=${response.bodyBytes}", + ); } final bytes = response.bodyBytes; @@ -257,7 +259,7 @@ class _OrdinalImageGroup extends ConsumerWidget { final docPath = dir.path; final filePath = "$docPath/ordinal_${ordinal.inscriptionNumber}.png"; - File imgFile = File(filePath); + final File imgFile = File(filePath); if (imgFile.existsSync()) { throw Exception("File already exists"); diff --git a/lib/pages/ordinals/ordinals_filter_view.dart b/lib/pages/ordinals/ordinals_filter_view.dart index 5f598708f..4c7d0b398 100644 --- a/lib/pages/ordinals/ordinals_filter_view.dart +++ b/lib/pages/ordinals/ordinals_filter_view.dart @@ -11,6 +11,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../themes/stack_colors.dart'; import '../../themes/theme_providers.dart'; import '../../utilities/assets.dart'; @@ -126,9 +127,10 @@ class _OrdinalsFilterViewState extends ConsumerState { return Text( isDateSelected ? "From..." : _fromDateString, style: STextStyles.fieldLabel(context).copyWith( - color: isDateSelected - ? Theme.of(context).extension()!.textSubtitle2 - : Theme.of(context).extension()!.accentColorDark), + color: isDateSelected + ? Theme.of(context).extension()!.textSubtitle2 + : Theme.of(context).extension()!.accentColorDark, + ), ); } @@ -137,9 +139,10 @@ class _OrdinalsFilterViewState extends ConsumerState { return Text( isDateSelected ? "To..." : _toDateString, style: STextStyles.fieldLabel(context).copyWith( - color: isDateSelected - ? Theme.of(context).extension()!.textSubtitle2 - : Theme.of(context).extension()!.accentColorDark), + color: isDateSelected + ? Theme.of(context).extension()!.textSubtitle2 + : Theme.of(context).extension()!.accentColorDark, + ), ); } @@ -182,7 +185,8 @@ class _OrdinalsFilterViewState extends ConsumerState { !_selectedFromDate!.isBefore(_selectedToDate!); if (flag) { _selectedToDate = DateTime.fromMillisecondsSinceEpoch( - _selectedFromDate!.millisecondsSinceEpoch); + _selectedFromDate!.millisecondsSinceEpoch, + ); } setState(() { @@ -236,7 +240,7 @@ class _OrdinalsFilterViewState extends ConsumerState { child: FittedBox( child: _dateFromText, ), - ) + ), ], ), ), @@ -272,7 +276,8 @@ class _OrdinalsFilterViewState extends ConsumerState { !_selectedToDate!.isAfter(_selectedFromDate!); if (flag) { _selectedFromDate = DateTime.fromMillisecondsSinceEpoch( - _selectedToDate!.millisecondsSinceEpoch); + _selectedToDate!.millisecondsSinceEpoch, + ); } setState(() { @@ -326,7 +331,7 @@ class _OrdinalsFilterViewState extends ConsumerState { child: FittedBox( child: _dateToText, ), - ) + ), ], ), ), diff --git a/lib/pages/ordinals/ordinals_view.dart b/lib/pages/ordinals/ordinals_view.dart index 844523110..17aaffb86 100644 --- a/lib/pages/ordinals/ordinals_view.dart +++ b/lib/pages/ordinals/ordinals_view.dart @@ -39,7 +39,7 @@ class _OrdinalsViewState extends ConsumerState { late final TextEditingController searchController; late final FocusNode searchFocus; - String _searchTerm = ""; + final String _searchTerm = ""; @override void initState() { @@ -91,7 +91,7 @@ class _OrdinalsViewState extends ConsumerState { Future.delayed(const Duration(seconds: 2)), (ref.read(pWallets).getWallet(widget.walletId) as OrdinalsInterface) - .refreshInscriptions() + .refreshInscriptions(), ]), context: context, message: "Refreshing...", diff --git a/lib/pages/ordinals/widgets/ordinal_card.dart b/lib/pages/ordinals/widgets/ordinal_card.dart index b5a561f48..31eeb5733 100644 --- a/lib/pages/ordinals/widgets/ordinal_card.dart +++ b/lib/pages/ordinals/widgets/ordinal_card.dart @@ -9,10 +9,10 @@ import '../../../widgets/rounded_white_container.dart'; class OrdinalCard extends StatelessWidget { const OrdinalCard({ - Key? key, + super.key, required this.walletId, required this.ordinal, - }) : super(key: key); + }); final String walletId; final Ordinal ordinal; diff --git a/lib/pages/ordinals/widgets/ordinals_list.dart b/lib/pages/ordinals/widgets/ordinals_list.dart index 0e9516127..ec67d7ef8 100644 --- a/lib/pages/ordinals/widgets/ordinals_list.dart +++ b/lib/pages/ordinals/widgets/ordinals_list.dart @@ -3,19 +3,20 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; + import '../../../models/isar/ordinal.dart'; -import 'ordinal_card.dart'; import '../../../providers/db/main_db_provider.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/text_styles.dart'; import '../../../utilities/util.dart'; import '../../../widgets/rounded_white_container.dart'; +import 'ordinal_card.dart'; class OrdinalsList extends ConsumerStatefulWidget { const OrdinalsList({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; @@ -74,7 +75,8 @@ class _OrdinalsListState extends ConsumerState { ? STextStyles.w500_14(context).copyWith( color: Theme.of(context) .extension()! - .textSubtitle1) + .textSubtitle1, + ) : STextStyles.label(context), ), ), @@ -88,13 +90,16 @@ class _OrdinalsListState extends ConsumerState { spacing: _spacing, runSpacing: _spacing, children: _data - .map((e) => SizedBox( + .map( + (e) => SizedBox( width: 220, height: 270, child: OrdinalCard( walletId: widget.walletId, ordinal: e, - ))) + ), + ), + ) .toList(), ); } else { diff --git a/lib/pages/paynym/add_new_paynym_follow_view.dart b/lib/pages/paynym/add_new_paynym_follow_view.dart index f02089c05..5f9e7bb71 100644 --- a/lib/pages/paynym/add_new_paynym_follow_view.dart +++ b/lib/pages/paynym/add_new_paynym_follow_view.dart @@ -13,9 +13,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../models/paynym/paynym_account.dart'; -import 'subwidgets/featured_paynyms_widget.dart'; -import 'subwidgets/paynym_card.dart'; import '../../providers/global/paynym_api_provider.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/barcode_scanner_interface.dart'; @@ -37,12 +36,14 @@ import '../../widgets/rounded_container.dart'; import '../../widgets/rounded_white_container.dart'; import '../../widgets/stack_text_field.dart'; import '../../widgets/textfield_icon_button.dart'; +import 'subwidgets/featured_paynyms_widget.dart'; +import 'subwidgets/paynym_card.dart'; class AddNewPaynymFollowView extends ConsumerStatefulWidget { const AddNewPaynymFollowView({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; @@ -283,8 +284,8 @@ class _AddNewPaynymFollowViewState }); }, style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textFieldActiveText, @@ -324,7 +325,8 @@ class _AddNewPaynymFollowViewState ) : TextFieldIconButton( key: const Key( - "paynymPasteAddressFieldButtonKey"), + "paynymPasteAddressFieldButtonKey", + ), onTap: _paste, child: RoundedContainer( padding: @@ -337,7 +339,8 @@ class _AddNewPaynymFollowViewState ), TextFieldIconButton( key: const Key( - "paynymScanQrButtonKey"), + "paynymScanQrButtonKey", + ), onTap: _scanQr, child: RoundedContainer( padding: const EdgeInsets.all(8), @@ -346,7 +349,7 @@ class _AddNewPaynymFollowViewState .buttonBackSecondary, child: const QrCodeIcon(), ), - ) + ), ], ), ), @@ -398,7 +401,8 @@ class _AddNewPaynymFollowViewState ) : TextFieldIconButton( key: const Key( - "paynymPasteAddressFieldButtonKey"), + "paynymPasteAddressFieldButtonKey", + ), onTap: _paste, child: const ClipboardIcon(), ), @@ -406,7 +410,7 @@ class _AddNewPaynymFollowViewState key: const Key("paynymScanQrButtonKey"), onTap: _scanQr, child: const QrCodeIcon(), - ) + ), ], ), ), diff --git a/lib/pages/paynym/dialogs/claiming_paynym_dialog.dart b/lib/pages/paynym/dialogs/claiming_paynym_dialog.dart index 2adad5a69..d10ad52fd 100644 --- a/lib/pages/paynym/dialogs/claiming_paynym_dialog.dart +++ b/lib/pages/paynym/dialogs/claiming_paynym_dialog.dart @@ -20,8 +20,8 @@ import '../../../widgets/stack_dialog.dart'; class ClaimingPaynymDialog extends StatefulWidget { const ClaimingPaynymDialog({ - Key? key, - }) : super(key: key); + super.key, + }); @override State createState() => _RestoringDialogState(); diff --git a/lib/pages/paynym/dialogs/confirm_paynym_connect_dialog.dart b/lib/pages/paynym/dialogs/confirm_paynym_connect_dialog.dart index ee2504d35..5024775eb 100644 --- a/lib/pages/paynym/dialogs/confirm_paynym_connect_dialog.dart +++ b/lib/pages/paynym/dialogs/confirm_paynym_connect_dialog.dart @@ -122,7 +122,7 @@ class ConfirmPaynymConnectDialog extends ConsumerWidget { ), ], ), - ) + ), ], ), ); diff --git a/lib/pages/paynym/dialogs/paynym_details_popup.dart b/lib/pages/paynym/dialogs/paynym_details_popup.dart index aa4774646..832f97422 100644 --- a/lib/pages/paynym/dialogs/paynym_details_popup.dart +++ b/lib/pages/paynym/dialogs/paynym_details_popup.dart @@ -227,7 +227,7 @@ class _PaynymDetailsPopupState extends ConsumerState { .extension()! .accentColorGreen, ), - ) + ), ], ); } else { diff --git a/lib/pages/paynym/dialogs/paynym_qr_popup.dart b/lib/pages/paynym/dialogs/paynym_qr_popup.dart index 757761396..b3cb3a1d0 100644 --- a/lib/pages/paynym/dialogs/paynym_qr_popup.dart +++ b/lib/pages/paynym/dialogs/paynym_qr_popup.dart @@ -26,9 +26,9 @@ import '../../../widgets/desktop/desktop_dialog_close_button.dart'; class PaynymQrPopup extends StatelessWidget { const PaynymQrPopup({ - Key? key, + super.key, required this.paynymAccount, - }) : super(key: key); + }); final PaynymAccount paynymAccount; @@ -166,7 +166,7 @@ class PaynymQrPopup extends StatelessWidget { ), ], ), - ) + ), ], ), ); diff --git a/lib/pages/paynym/paynym_claim_view.dart b/lib/pages/paynym/paynym_claim_view.dart index 457179655..9bf9cb3cd 100644 --- a/lib/pages/paynym/paynym_claim_view.dart +++ b/lib/pages/paynym/paynym_claim_view.dart @@ -33,9 +33,9 @@ import '../../widgets/desktop/primary_button.dart'; class PaynymClaimView extends ConsumerStatefulWidget { const PaynymClaimView({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; @@ -113,7 +113,7 @@ class _PaynymClaimViewState extends ConsumerState { Text( "PayNym", style: STextStyles.desktopH3(context), - ) + ), ], ), ) diff --git a/lib/pages/paynym/paynym_home_view.dart b/lib/pages/paynym/paynym_home_view.dart index be8e9db4c..8c3c6419d 100644 --- a/lib/pages/paynym/paynym_home_view.dart +++ b/lib/pages/paynym/paynym_home_view.dart @@ -15,13 +15,8 @@ import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:share_plus/share_plus.dart'; + import '../../notifications/show_flush_bar.dart'; -import 'add_new_paynym_follow_view.dart'; -import 'dialogs/paynym_qr_popup.dart'; -import 'subwidgets/desktop_paynym_details.dart'; -import 'subwidgets/paynym_bot.dart'; -import 'subwidgets/paynym_followers_list.dart'; -import 'subwidgets/paynym_following_list.dart'; import '../../providers/ui/selected_paynym_details_item_Provider.dart'; import '../../providers/wallet/my_paynym_account_state_provider.dart'; import '../../themes/stack_colors.dart'; @@ -41,12 +36,18 @@ import '../../widgets/icon_widgets/share_icon.dart'; import '../../widgets/rounded_container.dart'; import '../../widgets/rounded_white_container.dart'; import '../../widgets/toggle.dart'; +import 'add_new_paynym_follow_view.dart'; +import 'dialogs/paynym_qr_popup.dart'; +import 'subwidgets/desktop_paynym_details.dart'; +import 'subwidgets/paynym_bot.dart'; +import 'subwidgets/paynym_followers_list.dart'; +import 'subwidgets/paynym_following_list.dart'; class PaynymHomeView extends ConsumerStatefulWidget { const PaynymHomeView({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; @@ -117,7 +118,7 @@ class _PaynymHomeViewState extends ConsumerState { Text( "PayNym", style: STextStyles.desktopH3(context), - ) + ), ], ), trailing: Padding( @@ -169,8 +170,8 @@ class _PaynymHomeViewState extends ConsumerState { "Follow", style: STextStyles.desktopButtonSecondaryEnabled( - context) - .copyWith( + context, + ).copyWith( fontSize: 16, ), ), @@ -267,9 +268,11 @@ class _PaynymHomeViewState extends ConsumerState { secretCount++; if (secretCount > 5) { debugPrint( - "My Account: ${ref.read(myPaynymAccountStateProvider.state).state}"); + "My Account: ${ref.read(myPaynymAccountStateProvider.state).state}", + ); debugPrint( - "My Account: ${ref.read(myPaynymAccountStateProvider.state).state!.following}"); + "My Account: ${ref.read(myPaynymAccountStateProvider.state).state!.following}", + ); secretCount = 0; } @@ -304,13 +307,14 @@ class _PaynymHomeViewState extends ConsumerState { ), Text( Format.shorten( - ref - .watch(myPaynymAccountStateProvider.state) - .state! - .nonSegwitPaymentCode - .code, - 12, - 5), + ref + .watch(myPaynymAccountStateProvider.state) + .state! + .nonSegwitPaymentCode + .code, + 12, + 5, + ), style: STextStyles.label(context).copyWith( fontSize: 14, ), @@ -380,12 +384,13 @@ class _PaynymHomeViewState extends ConsumerState { } await Share.share( - ref - .read(myPaynymAccountStateProvider.state) - .state! - .nonSegwitPaymentCode - .code, - sharePositionOrigin: sharePositionOrigin); + ref + .read(myPaynymAccountStateProvider.state) + .state! + .nonSegwitPaymentCode + .code, + sharePositionOrigin: sharePositionOrigin, + ); }, ), ), @@ -435,9 +440,11 @@ class _PaynymHomeViewState extends ConsumerState { secretCount++; if (secretCount > 5) { debugPrint( - "My Account: ${ref.read(myPaynymAccountStateProvider.state).state}"); + "My Account: ${ref.read(myPaynymAccountStateProvider.state).state}", + ); debugPrint( - "My Account: ${ref.read(myPaynymAccountStateProvider.state).state!.following}"); + "My Account: ${ref.read(myPaynymAccountStateProvider.state).state!.following}", + ); secretCount = 0; } @@ -475,13 +482,14 @@ class _PaynymHomeViewState extends ConsumerState { ), Text( Format.shorten( - ref - .watch(myPaynymAccountStateProvider.state) - .state! - .nonSegwitPaymentCode - .code, - 12, - 5), + ref + .watch(myPaynymAccountStateProvider.state) + .state! + .nonSegwitPaymentCode + .code, + 12, + 5, + ), style: STextStyles.desktopTextExtraExtraSmall(context), ), @@ -619,8 +627,9 @@ class _PaynymHomeViewState extends ConsumerState { child: DesktopPaynymDetails( walletId: widget.walletId, accountLite: ref - .watch(selectedPaynymDetailsItemProvider - .state) + .watch( + selectedPaynymDetailsItemProvider.state, + ) .state!, ), ), diff --git a/lib/pages/paynym/subwidgets/desktop_paynym_details.dart b/lib/pages/paynym/subwidgets/desktop_paynym_details.dart index bc2fef85f..c33d5ed24 100644 --- a/lib/pages/paynym/subwidgets/desktop_paynym_details.dart +++ b/lib/pages/paynym/subwidgets/desktop_paynym_details.dart @@ -41,10 +41,10 @@ import '../../../widgets/rounded_white_container.dart'; class DesktopPaynymDetails extends ConsumerStatefulWidget { const DesktopPaynymDetails({ - Key? key, + super.key, required this.walletId, required this.accountLite, - }) : super(key: key); + }); final String walletId; final PaynymAccountLite accountLite; @@ -216,7 +216,7 @@ class _PaynymDetailsPopupState extends ConsumerState { .extension()! .accentColorGreen, ), - ) + ), ], ); } else { diff --git a/lib/pages/paynym/subwidgets/featured_paynyms_widget.dart b/lib/pages/paynym/subwidgets/featured_paynyms_widget.dart index 645d8cf60..e67f312c9 100644 --- a/lib/pages/paynym/subwidgets/featured_paynyms_widget.dart +++ b/lib/pages/paynym/subwidgets/featured_paynyms_widget.dart @@ -18,9 +18,9 @@ import '../../../widgets/rounded_white_container.dart'; class FeaturedPaynymsWidget extends StatelessWidget { const FeaturedPaynymsWidget({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; diff --git a/lib/pages/paynym/subwidgets/paynym_bot.dart b/lib/pages/paynym/subwidgets/paynym_bot.dart index ab72dce24..1a6d6e469 100644 --- a/lib/pages/paynym/subwidgets/paynym_bot.dart +++ b/lib/pages/paynym/subwidgets/paynym_bot.dart @@ -17,10 +17,10 @@ import '../../../utilities/prefs.dart'; class PayNymBot extends StatelessWidget { const PayNymBot({ - Key? key, + super.key, required this.paymentCodeString, this.size = 60.0, - }) : super(key: key); + }); final String paymentCodeString; final double size; diff --git a/lib/pages/paynym/subwidgets/paynym_card.dart b/lib/pages/paynym/subwidgets/paynym_card.dart index 1a81202a6..32422a740 100644 --- a/lib/pages/paynym/subwidgets/paynym_card.dart +++ b/lib/pages/paynym/subwidgets/paynym_card.dart @@ -18,11 +18,11 @@ import '../../../widgets/custom_buttons/paynym_follow_toggle_button.dart'; class PaynymCard extends StatefulWidget { const PaynymCard({ - Key? key, + super.key, required this.walletId, required this.label, required this.paymentCodeString, - }) : super(key: key); + }); final String walletId; final String label; diff --git a/lib/pages/paynym/subwidgets/paynym_card_button.dart b/lib/pages/paynym/subwidgets/paynym_card_button.dart index 869d6244d..8f7026be3 100644 --- a/lib/pages/paynym/subwidgets/paynym_card_button.dart +++ b/lib/pages/paynym/subwidgets/paynym_card_button.dart @@ -23,10 +23,10 @@ import '../../../widgets/rounded_container.dart'; class PaynymCardButton extends ConsumerStatefulWidget { const PaynymCardButton({ - Key? key, + super.key, required this.walletId, required this.accountLite, - }) : super(key: key); + }); final String walletId; final PaynymAccountLite accountLite; diff --git a/lib/pages/paynym/subwidgets/paynym_followers_list.dart b/lib/pages/paynym/subwidgets/paynym_followers_list.dart index 55ac272f7..43fdf0223 100644 --- a/lib/pages/paynym/subwidgets/paynym_followers_list.dart +++ b/lib/pages/paynym/subwidgets/paynym_followers_list.dart @@ -27,9 +27,9 @@ import '../../../widgets/rounded_white_container.dart'; class PaynymFollowersList extends ConsumerStatefulWidget { const PaynymFollowersList({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; diff --git a/lib/pages/paynym/subwidgets/paynym_following_list.dart b/lib/pages/paynym/subwidgets/paynym_following_list.dart index 3536f5760..486e138e2 100644 --- a/lib/pages/paynym/subwidgets/paynym_following_list.dart +++ b/lib/pages/paynym/subwidgets/paynym_following_list.dart @@ -27,9 +27,9 @@ import '../../../widgets/rounded_white_container.dart'; class PaynymFollowingList extends ConsumerStatefulWidget { const PaynymFollowingList({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; diff --git a/lib/pages/pinpad_views/create_pin_view.dart b/lib/pages/pinpad_views/create_pin_view.dart index 05231181d..586e6c9fd 100644 --- a/lib/pages/pinpad_views/create_pin_view.dart +++ b/lib/pages/pinpad_views/create_pin_view.dart @@ -13,8 +13,8 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../notifications/show_flush_bar.dart'; -import '../home_view/home_view.dart'; import '../../providers/global/prefs_provider.dart'; import '../../providers/global/secure_store_provider.dart'; import '../../themes/stack_colors.dart'; @@ -25,13 +25,14 @@ import '../../utilities/text_styles.dart'; import '../../widgets/background.dart'; import '../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../widgets/custom_pin_put/custom_pin_put.dart'; +import '../home_view/home_view.dart'; class CreatePinView extends ConsumerStatefulWidget { const CreatePinView({ - Key? key, + super.key, this.popOnSuccess = false, this.biometrics = const Biometrics(), - }) : super(key: key); + }); static const String routeName = "/createPin"; @@ -265,8 +266,9 @@ class _CreatePinViewState extends ConsumerState { // if (!Platform.isLinux) // assert((await _secureStore.read(key: "stack_pin")) == // null); - assert(ref.read(prefsChangeNotifierProvider).hasPin == - false); + assert( + ref.read(prefsChangeNotifierProvider).hasPin == false, + ); await _secureStore.write(key: "stack_pin", value: pin); @@ -275,7 +277,8 @@ class _CreatePinViewState extends ConsumerState { ref.read(prefsChangeNotifierProvider).hasPin = true; await Future.delayed( - const Duration(milliseconds: 200)); + const Duration(milliseconds: 200), + ); if (mounted) { if (!widget.popOnSuccess) { diff --git a/lib/pages/pinpad_views/lock_screen_view.dart b/lib/pages/pinpad_views/lock_screen_view.dart index ec4f7af76..afb7c7a1d 100644 --- a/lib/pages/pinpad_views/lock_screen_view.dart +++ b/lib/pages/pinpad_views/lock_screen_view.dart @@ -12,9 +12,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../notifications/show_flush_bar.dart'; -import '../home_view/home_view.dart'; -import '../wallet_view/wallet_view.dart'; // import 'package:stackwallet/providers/global/has_authenticated_start_state_provider.dart'; import '../../providers/global/prefs_provider.dart'; import '../../providers/global/secure_store_provider.dart'; @@ -23,7 +22,6 @@ import '../../themes/stack_colors.dart'; // import 'package:stackwallet/providers/global/should_show_lockscreen_on_resume_state_provider.dart'; import '../../utilities/assets.dart'; import '../../utilities/biometrics.dart'; - import '../../utilities/flutter_secure_storage_interface.dart'; import '../../utilities/show_loading.dart'; import '../../utilities/text_styles.dart'; @@ -33,10 +31,12 @@ import '../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../widgets/custom_buttons/blue_text_button.dart'; import '../../widgets/custom_pin_put/custom_pin_put.dart'; import '../../widgets/shake/shake.dart'; +import '../home_view/home_view.dart'; +import '../wallet_view/wallet_view.dart'; class LockscreenView extends ConsumerStatefulWidget { const LockscreenView({ - Key? key, + super.key, required this.routeOnSuccess, required this.biometricsAuthenticationTitle, required this.biometricsLocalizedReason, @@ -48,7 +48,7 @@ class LockscreenView extends ConsumerStatefulWidget { this.biometrics = const Biometrics(), this.onSuccess, this.customKeyLabel = "Button", - }) : super(key: key); + }); static const String routeName = "/lockscreen"; @@ -151,9 +151,10 @@ class _LockscreenViewState extends ConsumerState { if (useBiometrics) { if (await biometrics.authenticate( - title: title, - localizedReason: localizedReason, - cancelButtonText: cancelButtonText)) { + title: title, + localizedReason: localizedReason, + cancelButtonText: cancelButtonText, + )) { // check if initial log in // if (widget.routeOnSuccess == "/mainview") { // await logIn(await walletsService.networkName, currentWalletName, @@ -227,7 +228,8 @@ class _LockscreenViewState extends ConsumerState { if (FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( - const Duration(milliseconds: 70)); + const Duration(milliseconds: 70), + ); } if (mounted) { Navigator.of(context).pop(); @@ -360,16 +362,19 @@ class _LockscreenViewState extends ConsumerState { prettyTime += "${_timeout.inSeconds} seconds"; } - unawaited(showFloatingFlushBar( - type: FlushBarType.warning, - message: - "Incorrect PIN entered too many times. Please wait $prettyTime", - context: context, - iconAsset: Assets.svg.alertCircle, - )); + unawaited( + showFloatingFlushBar( + type: FlushBarType.warning, + message: + "Incorrect PIN entered too many times. Please wait $prettyTime", + context: context, + iconAsset: Assets.svg.alertCircle, + ), + ); await Future.delayed( - const Duration(milliseconds: 100)); + const Duration(milliseconds: 100), + ); _pinTextController.text = ''; @@ -381,19 +386,23 @@ class _LockscreenViewState extends ConsumerState { if (storedPin == pin) { await Future.delayed( - const Duration(milliseconds: 200)); + const Duration(milliseconds: 200), + ); unawaited(_onUnlock()); } else { unawaited(_shakeController.shake()); - unawaited(showFloatingFlushBar( - type: FlushBarType.warning, - message: "Incorrect PIN. Please try again", - context: context, - iconAsset: Assets.svg.alertCircle, - )); + unawaited( + showFloatingFlushBar( + type: FlushBarType.warning, + message: "Incorrect PIN. Please try again", + context: context, + iconAsset: Assets.svg.alertCircle, + ), + ); await Future.delayed( - const Duration(milliseconds: 100)); + const Duration(milliseconds: 100), + ); _pinTextController.text = ''; } diff --git a/lib/pages/receive_view/addresses/address_card.dart b/lib/pages/receive_view/addresses/address_card.dart index 9cd6fbb2f..a13ec17a7 100644 --- a/lib/pages/receive_view/addresses/address_card.dart +++ b/lib/pages/receive_view/addresses/address_card.dart @@ -22,6 +22,7 @@ import 'package:isar/isar.dart'; import 'package:path_provider/path_provider.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:share_plus/share_plus.dart'; + import '../../../db/isar/main_db.dart'; import '../../../models/isar/models/isar_models.dart'; import '../../../notifications/show_flush_bar.dart'; @@ -84,7 +85,8 @@ class _AddressCardState extends ConsumerState { final dir = Directory("${Platform.environment['HOME']}"); if (!dir.existsSync()) { throw Exception( - "Home dir not found while trying to open filepicker on QR image save"); + "Home dir not found while trying to open filepicker on QR image save", + ); } final path = await FilePicker.platform.saveFile( fileName: "qrcode.png", @@ -127,8 +129,10 @@ class _AddressCardState extends ConsumerState { final file = await File("${tempDir.path}/qrcode.png").create(); await file.writeAsBytes(pngBytes); - await Share.shareFiles(["${tempDir.path}/qrcode.png"], - text: "Receive URI QR Code"); + await Share.shareFiles( + ["${tempDir.path}/qrcode.png"], + text: "Receive URI QR Code", + ); } } catch (e) { //todo: comeback to this @@ -362,7 +366,7 @@ class _AddressCardState extends ConsumerState { ), ), ], - ) + ), ], ), ); diff --git a/lib/pages/receive_view/addresses/address_details_view.dart b/lib/pages/receive_view/addresses/address_details_view.dart index 268a9bca7..120bfa48b 100644 --- a/lib/pages/receive_view/addresses/address_details_view.dart +++ b/lib/pages/receive_view/addresses/address_details_view.dart @@ -12,13 +12,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; import 'package:qr_flutter/qr_flutter.dart'; + import '../../../db/isar/main_db.dart'; import '../../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; import '../../../models/isar/models/isar_models.dart'; -import 'address_tag.dart'; -import '../../wallet_view/sub_widgets/no_transactions_found.dart'; -import '../../wallet_view/transaction_views/transaction_details_view.dart'; -import '../../wallet_view/transaction_views/tx_v2/transaction_v2_card.dart'; import '../../../providers/db/main_db_provider.dart'; import '../../../providers/global/wallets_provider.dart'; import '../../../themes/stack_colors.dart'; @@ -36,6 +33,10 @@ import '../../../widgets/desktop/desktop_dialog.dart'; import '../../../widgets/desktop/desktop_dialog_close_button.dart'; import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/transaction_card.dart'; +import '../../wallet_view/sub_widgets/no_transactions_found.dart'; +import '../../wallet_view/transaction_views/transaction_details_view.dart'; +import '../../wallet_view/transaction_views/tx_v2/transaction_v2_card.dart'; +import 'address_tag.dart'; class AddressDetailsView extends ConsumerStatefulWidget { const AddressDetailsView({ @@ -212,8 +213,8 @@ class _AddressDetailsViewState extends ConsumerState { Text( "Address details", style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textSubtitle1, @@ -244,8 +245,8 @@ class _AddressDetailsViewState extends ConsumerState { Text( "Transaction history", style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textSubtitle1, @@ -476,10 +477,10 @@ class _AddressDetailsTxList extends StatelessWidget { class _AddressDetailsTxV2List extends ConsumerWidget { const _AddressDetailsTxV2List({ - Key? key, + super.key, required this.walletId, required this.address, - }) : super(key: key); + }); final String walletId; final Address address; @@ -491,37 +492,38 @@ class _AddressDetailsTxV2List extends ConsumerWidget { final query = ref.watch(mainDBProvider).isar.transactionV2s.buildQuery( - whereClauses: [ - IndexWhereClause.equalTo( - indexName: 'walletId', - value: [walletId], - ) - ], - filter: FilterGroup.and([ - if (walletTxFilter != null) walletTxFilter, - FilterGroup.or([ - ObjectFilter( - property: 'inputs', - filter: FilterCondition.contains( - property: "addresses", - value: address.value, - ), + whereClauses: [ + IndexWhereClause.equalTo( + indexName: 'walletId', + value: [walletId], ), - ObjectFilter( - property: 'outputs', - filter: FilterCondition.contains( - property: "addresses", - value: address.value, + ], + filter: FilterGroup.and([ + if (walletTxFilter != null) walletTxFilter, + FilterGroup.or([ + ObjectFilter( + property: 'inputs', + filter: FilterCondition.contains( + property: "addresses", + value: address.value, + ), ), - ) + ObjectFilter( + property: 'outputs', + filter: FilterCondition.contains( + property: "addresses", + value: address.value, + ), + ), + ]), ]), - ]), - sortBy: [ - const SortProperty( - property: "timestamp", - sort: Sort.desc, - ), - ]); + sortBy: [ + const SortProperty( + property: "timestamp", + sort: Sort.desc, + ), + ], + ); final count = query.countSync(); @@ -561,9 +563,9 @@ class _AddressDetailsTxV2List extends ConsumerWidget { class _Div extends StatelessWidget { const _Div({ - Key? key, + super.key, required this.height, - }) : super(key: key); + }); final double height; @@ -585,9 +587,9 @@ class _Div extends StatelessWidget { class _Tags extends StatelessWidget { const _Tags({ - Key? key, + super.key, required this.tags, - }) : super(key: key); + }); final List? tags; @@ -643,11 +645,11 @@ class _Tags extends StatelessWidget { class _Item extends StatelessWidget { const _Item({ - Key? key, + super.key, required this.title, required this.data, required this.button, - }) : super(key: key); + }); final String title; final String data; diff --git a/lib/pages/receive_view/addresses/address_qr_popup.dart b/lib/pages/receive_view/addresses/address_qr_popup.dart index 202876e26..7b25003b2 100644 --- a/lib/pages/receive_view/addresses/address_qr_popup.dart +++ b/lib/pages/receive_view/addresses/address_qr_popup.dart @@ -20,6 +20,7 @@ import 'package:flutter_svg/svg.dart'; import 'package:path_provider/path_provider.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:share_plus/share_plus.dart'; + import '../../../notifications/show_flush_bar.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/address_utils.dart'; @@ -66,7 +67,8 @@ class _AddressQrPopupState extends State { final dir = Directory("${Platform.environment['HOME']}"); if (!dir.existsSync()) { throw Exception( - "Home dir not found while trying to open filepicker on QR image save"); + "Home dir not found while trying to open filepicker on QR image save", + ); } final path = await FilePicker.platform.saveFile( fileName: "qrcode.png", @@ -105,8 +107,10 @@ class _AddressQrPopupState extends State { final file = await File("${tempDir.path}/qrcode.png").create(); await file.writeAsBytes(pngBytes); - await Share.shareFiles(["${tempDir.path}/qrcode.png"], - text: "Receive URI QR Code"); + await Share.shareFiles( + ["${tempDir.path}/qrcode.png"], + text: "Receive URI QR Code", + ); } } catch (e) { //todo: comeback to this @@ -194,7 +198,7 @@ class _AddressQrPopupState extends State { ), ), ], - ) + ), ], ), ); diff --git a/lib/pages/receive_view/addresses/address_tag.dart b/lib/pages/receive_view/addresses/address_tag.dart index c2258adda..1d7ebaf5b 100644 --- a/lib/pages/receive_view/addresses/address_tag.dart +++ b/lib/pages/receive_view/addresses/address_tag.dart @@ -15,7 +15,7 @@ import '../../../utilities/text_styles.dart'; import '../../../widgets/rounded_container.dart'; class AddressTag extends StatelessWidget { - const AddressTag({Key? key, required this.tag}) : super(key: key); + const AddressTag({super.key, required this.tag}); final String tag; diff --git a/lib/pages/receive_view/addresses/edit_address_label_view.dart b/lib/pages/receive_view/addresses/edit_address_label_view.dart index 61c639877..2e6052690 100644 --- a/lib/pages/receive_view/addresses/edit_address_label_view.dart +++ b/lib/pages/receive_view/addresses/edit_address_label_view.dart @@ -11,6 +11,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; + import '../../../db/isar/main_db.dart'; import '../../../models/isar/models/address_label.dart'; import '../../../themes/stack_colors.dart'; @@ -28,9 +29,9 @@ import '../../../widgets/textfield_icon_button.dart'; class EditAddressLabelView extends ConsumerStatefulWidget { const EditAddressLabelView({ - Key? key, + super.key, required this.addressLabelId, - }) : super(key: key); + }); static const String routeName = "/editAddressLabel"; @@ -89,7 +90,8 @@ class _EditAddressLabelViewState extends ConsumerState { if (FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( - const Duration(milliseconds: 75)); + const Duration(milliseconds: 75), + ); } if (mounted) { Navigator.of(context).pop(); @@ -241,7 +243,7 @@ class _EditAddressLabelViewState extends ConsumerState { "Save", style: STextStyles.button(context), ), - ) + ), ], ), ), diff --git a/lib/pages/receive_view/addresses/wallet_addresses_view.dart b/lib/pages/receive_view/addresses/wallet_addresses_view.dart index b0970395b..620bfe244 100644 --- a/lib/pages/receive_view/addresses/wallet_addresses_view.dart +++ b/lib/pages/receive_view/addresses/wallet_addresses_view.dart @@ -11,10 +11,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; +import 'package:tuple/tuple.dart'; + import '../../../db/isar/main_db.dart'; import '../../../models/isar/models/isar_models.dart'; -import 'address_card.dart'; -import 'address_details_view.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/text_styles.dart'; import '../../../utilities/util.dart'; @@ -23,13 +23,14 @@ import '../../../widgets/background.dart'; import '../../../widgets/conditional_parent.dart'; import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../widgets/loading_indicator.dart'; -import 'package:tuple/tuple.dart'; +import 'address_card.dart'; +import 'address_details_view.dart'; class WalletAddressesView extends ConsumerStatefulWidget { const WalletAddressesView({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); static const String routeName = "/walletAddressesView"; @@ -53,14 +54,16 @@ class _WalletAddressesViewState extends ConsumerState { return MainDB.instance .getAddresses(widget.walletId) .filter() - .group((q) => q - .subTypeEqualTo(AddressSubType.change) - .or() - .subTypeEqualTo(AddressSubType.receiving) - .or() - .subTypeEqualTo(AddressSubType.paynymReceive) - .or() - .subTypeEqualTo(AddressSubType.paynymNotification)) + .group( + (q) => q + .subTypeEqualTo(AddressSubType.change) + .or() + .subTypeEqualTo(AddressSubType.receiving) + .or() + .subTypeEqualTo(AddressSubType.paynymReceive) + .or() + .subTypeEqualTo(AddressSubType.paynymNotification), + ) .and() .not() .typeEqualTo(AddressType.nonWallet) @@ -95,15 +98,19 @@ class _WalletAddressesViewState extends ConsumerState { .getAddresses(widget.walletId) .filter() .anyOf( - labels, (q, e) => q.valueEqualTo(e.addressString)) - .group((q) => q - .subTypeEqualTo(AddressSubType.change) - .or() - .subTypeEqualTo(AddressSubType.receiving) - .or() - .subTypeEqualTo(AddressSubType.paynymReceive) - .or() - .subTypeEqualTo(AddressSubType.paynymNotification)) + labels, + (q, e) => q.valueEqualTo(e.addressString), + ) + .group( + (q) => q + .subTypeEqualTo(AddressSubType.change) + .or() + .subTypeEqualTo(AddressSubType.receiving) + .or() + .subTypeEqualTo(AddressSubType.paynymReceive) + .or() + .subTypeEqualTo(AddressSubType.paynymNotification), + ) .and() .not() .typeEqualTo(AddressType.nonWallet) diff --git a/lib/pages/receive_view/generate_receiving_uri_qr_code_view.dart b/lib/pages/receive_view/generate_receiving_uri_qr_code_view.dart index 25c338b96..e7d6d7e5f 100644 --- a/lib/pages/receive_view/generate_receiving_uri_qr_code_view.dart +++ b/lib/pages/receive_view/generate_receiving_uri_qr_code_view.dart @@ -22,6 +22,7 @@ import 'package:flutter_svg/svg.dart'; import 'package:path_provider/path_provider.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:share_plus/share_plus.dart'; + import '../../notifications/show_flush_bar.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/address_utils.dart'; @@ -31,8 +32,6 @@ import '../../utilities/constants.dart'; import '../../utilities/logger.dart'; import '../../utilities/text_styles.dart'; import '../../utilities/util.dart'; -import '../../wallets/crypto_currency/coins/bitcoincash.dart'; -import '../../wallets/crypto_currency/coins/ecash.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../widgets/background.dart'; import '../../widgets/conditional_parent.dart'; @@ -90,7 +89,8 @@ class _GenerateUriQrCodeViewState extends State { final dir = Directory("${Platform.environment['HOME']}"); if (!dir.existsSync()) { throw Exception( - "Home dir not found while trying to open filepicker on QR image save"); + "Home dir not found while trying to open filepicker on QR image save", + ); } final path = await FilePicker.platform.saveFile( fileName: "qrcode.png", @@ -129,8 +129,10 @@ class _GenerateUriQrCodeViewState extends State { final file = await File("${tempDir.path}/qrcode.png").create(); await file.writeAsBytes(pngBytes); - await Share.shareFiles(["${tempDir.path}/qrcode.png"], - text: "Receive URI QR Code"); + await Share.shareFiles( + ["${tempDir.path}/qrcode.png"], + text: "Receive URI QR Code", + ); } } catch (e) { //todo: comeback to this @@ -173,8 +175,10 @@ class _GenerateUriQrCodeViewState extends State { queryParams, ); - Logging.instance.log("Generated receiving QR code for: $uriString", - level: LogLevel.Info); + Logging.instance.log( + "Generated receiving QR code for: $uriString", + level: LogLevel.Info, + ); return uriString; } @@ -212,13 +216,14 @@ class _GenerateUriQrCodeViewState extends State { width: width + 20, height: width + 20, child: QrImageView( - data: uriString, - size: width, - backgroundColor: - Theme.of(context).extension()!.popupBG, - foregroundColor: Theme.of(context) - .extension()! - .accentColorDark), + data: uriString, + size: width, + backgroundColor: + Theme.of(context).extension()!.popupBG, + foregroundColor: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ), ), @@ -552,14 +557,15 @@ class _GenerateUriQrCodeViewState extends State { width: 234, height: 234, child: QrImageView( - data: _uriString, - size: 220, - backgroundColor: Theme.of(context) - .extension()! - .popupBG, - foregroundColor: Theme.of(context) - .extension()! - .accentColorDark), + data: _uriString, + size: 220, + backgroundColor: Theme.of(context) + .extension()! + .popupBG, + foregroundColor: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ), ), @@ -613,7 +619,7 @@ class _GenerateUriQrCodeViewState extends State { ), ), ], - ) + ), ], ), ), diff --git a/lib/pages/receive_view/receive_view.dart b/lib/pages/receive_view/receive_view.dart index e9e85e8d1..844950949 100644 --- a/lib/pages/receive_view/receive_view.dart +++ b/lib/pages/receive_view/receive_view.dart @@ -17,10 +17,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:isar/isar.dart'; import 'package:qr_flutter/qr_flutter.dart'; + import '../../models/isar/models/isar_models.dart'; import '../../notifications/show_flush_bar.dart'; -import 'addresses/wallet_addresses_view.dart'; -import 'generate_receiving_uri_qr_code_view.dart'; import '../../providers/db/main_db_provider.dart'; import '../../providers/providers.dart'; import '../../route_generator.dart'; @@ -46,6 +45,8 @@ import '../../widgets/custom_loading_overlay.dart'; import '../../widgets/desktop/primary_button.dart'; import '../../widgets/desktop/secondary_button.dart'; import '../../widgets/rounded_white_container.dart'; +import 'addresses/wallet_addresses_view.dart'; +import 'generate_receiving_uri_qr_code_view.dart'; class ReceiveView extends ConsumerStatefulWidget { const ReceiveView({ @@ -193,9 +194,11 @@ class _ReceiveViewState extends ConsumerState { if (_supportsSpark) { _walletAddressTypes.insert(0, AddressType.spark); } else { - _walletAddressTypes.addAll((wallet as Bip39HDWallet) - .supportedAddressTypes - .where((e) => e != coin.primaryAddressType)); + _walletAddressTypes.addAll( + (wallet as Bip39HDWallet) + .supportedAddressTypes + .where((e) => e != coin.primaryAddressType), + ); } } @@ -544,16 +547,16 @@ class _ReceiveViewState extends ConsumerState { ); }, ), - if (ref.watch(pWallets - .select((value) => value.getWallet(walletId))) - is MultiAddressInterface || + if (ref.watch( + pWallets.select((value) => value.getWallet(walletId)), + ) is MultiAddressInterface || _supportsSpark) const SizedBox( height: 12, ), - if (ref.watch(pWallets - .select((value) => value.getWallet(walletId))) - is MultiAddressInterface || + if (ref.watch( + pWallets.select((value) => value.getWallet(walletId)), + ) is MultiAddressInterface || _supportsSpark) SecondaryButton( label: "Generate new address", @@ -573,34 +576,37 @@ class _ReceiveViewState extends ConsumerState { child: Column( children: [ QrImageView( - data: AddressUtils.buildUriString( - coin, - address, - {}, - ), - size: MediaQuery.of(context).size.width / 2, - foregroundColor: Theme.of(context) - .extension()! - .accentColorDark), + data: AddressUtils.buildUriString( + coin, + address, + {}, + ), + size: MediaQuery.of(context).size.width / 2, + foregroundColor: Theme.of(context) + .extension()! + .accentColorDark, + ), const SizedBox( height: 20, ), CustomTextButton( text: "Advanced options", onTap: () async { - unawaited(Navigator.of(context).push( - RouteGenerator.getRoute( - shouldUseMaterialRoute: - RouteGenerator.useMaterialPageRoute, - builder: (_) => GenerateUriQrCodeView( - coin: coin, - receivingAddress: address, - ), - settings: const RouteSettings( - name: GenerateUriQrCodeView.routeName, + unawaited( + Navigator.of(context).push( + RouteGenerator.getRoute( + shouldUseMaterialRoute: + RouteGenerator.useMaterialPageRoute, + builder: (_) => GenerateUriQrCodeView( + coin: coin, + receivingAddress: address, + ), + settings: const RouteSettings( + name: GenerateUriQrCodeView.routeName, + ), ), ), - )); + ); }, ), ], diff --git a/lib/pages/send_view/frost_ms/frost_send_view.dart b/lib/pages/send_view/frost_ms/frost_send_view.dart index 260cf866c..a150ac726 100644 --- a/lib/pages/send_view/frost_ms/frost_send_view.dart +++ b/lib/pages/send_view/frost_ms/frost_send_view.dart @@ -14,12 +14,13 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:tuple/tuple.dart'; + import '../../../frost_route_generator.dart'; import '../../../models/isar/models/isar_models.dart'; -import '../../coin_control/coin_control_view.dart'; -import 'recipient.dart'; import '../../../providers/frost_wallet/frost_wallet_providers.dart'; import '../../../providers/providers.dart'; +import '../../../providers/wallet/public_private_balance_state_provider.dart'; import '../../../themes/coin_icon_provider.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/amount/amount.dart'; @@ -46,7 +47,8 @@ import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/stack_dialog.dart'; import '../../../widgets/stack_text_field.dart'; import '../../../widgets/textfield_icon_button.dart'; -import 'package:tuple/tuple.dart'; +import '../../coin_control/coin_control_view.dart'; +import 'recipient.dart'; class FrostSendView extends ConsumerStatefulWidget { const FrostSendView({ @@ -164,9 +166,10 @@ class _FrostSendViewState extends ConsumerState { child: Text( "Ok", style: STextStyles.button(context).copyWith( - color: Theme.of(context) - .extension()! - .accentColorDark), + color: Theme.of(context) + .extension()! + .accentColorDark, + ), ), onPressed: () { Navigator.of(context).pop(); @@ -232,7 +235,10 @@ class _FrostSendViewState extends ConsumerState { prefsChangeNotifierProvider.select( (value) => value.enableCoinControl, ), - ); + ) && + (coin is Firo + ? ref.watch(publicPrivateBalanceStateProvider) == FiroType.public + : true); return ConditionalParent( condition: !Util.isDesktop, @@ -346,9 +352,11 @@ class _FrostSendViewState extends ConsumerState { crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - ref.watch(pAmountFormatter(coin)).format(ref - .watch(pWalletBalance(walletId)) - .spendable), + ref.watch(pAmountFormatter(coin)).format( + ref + .watch(pWalletBalance(walletId)) + .spendable, + ), style: STextStyles.titleBold12(context).copyWith( fontSize: 10, @@ -358,7 +366,7 @@ class _FrostSendViewState extends ConsumerState { ], ), ), - ) + ), ], ), ), @@ -389,8 +397,10 @@ class _FrostSendViewState extends ConsumerState { ? null : () { ref - .read(pRecipient(recipientWidgetIndexes[i]) - .notifier) + .read( + pRecipient(recipientWidgetIndexes[i]) + .notifier, + ) .state = null; recipientWidgetIndexes.removeAt(i); setState(() {}); diff --git a/lib/pages/send_view/frost_ms/recipient.dart b/lib/pages/send_view/frost_ms/recipient.dart index 8bb6cbd12..6d9d9b7c4 100644 --- a/lib/pages/send_view/frost_ms/recipient.dart +++ b/lib/pages/send_view/frost_ms/recipient.dart @@ -2,6 +2,7 @@ import 'package:decimal/decimal.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../providers/global/locale_provider.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/address_utils.dart'; @@ -39,7 +40,8 @@ final pBarcodeScanner = final pRecipient = StateProvider.family<({String address, Amount? amount})?, int>( - (ref, index) => null); + (ref, index) => null, +); class Recipient extends ConsumerStatefulWidget { const Recipient({ @@ -233,7 +235,8 @@ class _RecipientState extends ConsumerState { semanticsLabel: "Clear Button. Clears The Address Field Input.", key: const Key( - "sendViewClearAddressFieldButtonKey"), + "sendViewClearAddressFieldButtonKey", + ), onTap: () { addressController.text = ""; @@ -249,7 +252,8 @@ class _RecipientState extends ConsumerState { semanticsLabel: "Paste Button. Pastes From Clipboard To Address Field Input.", key: const Key( - "sendViewPasteAddressFieldButtonKey"), + "sendViewPasteAddressFieldButtonKey", + ), onTap: () async { final ClipboardData? data = await ref .read(pClipboard) @@ -259,7 +263,9 @@ class _RecipientState extends ConsumerState { String content = data.text!.trim(); if (content.contains("\n")) { content = content.substring( - 0, content.indexOf("\n")); + 0, + content.indexOf("\n"), + ); } addressController.text = content.trim(); @@ -433,9 +439,10 @@ class _RecipientState extends ConsumerState { .watch(pAmountUnit(widget.coin)) .unitForCoin(widget.coin), style: STextStyles.smallMed14(context).copyWith( - color: Theme.of(context) - .extension()! - .accentColorDark), + color: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ), ), diff --git a/lib/pages/send_view/frost_ms/send_steps/frost_send_step_1b.dart b/lib/pages/send_view/frost_ms/send_steps/frost_send_step_1b.dart index 9cac2cabc..058b980c5 100644 --- a/lib/pages/send_view/frost_ms/send_steps/frost_send_step_1b.dart +++ b/lib/pages/send_view/frost_ms/send_steps/frost_send_step_1b.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; + import '../../../../frost_route_generator.dart'; import '../../../../models/isar/models/isar_models.dart'; import '../../../../providers/db/main_db_provider.dart'; @@ -73,13 +74,14 @@ class _FrostSendStep1bState extends ConsumerState { .getUTXOs(wallet.walletId) .filter() .anyOf( - data.inputs, - (q, e) => q - .txidEqualTo(Format.uint8listToString(e.hash)) - .and() - .valueEqualTo(e.value) - .and() - .voutEqualTo(e.vout)) + data.inputs, + (q, e) => q + .txidEqualTo(Format.uint8listToString(e.hash)) + .and() + .valueEqualTo(e.value) + .and() + .voutEqualTo(e.vout), + ) .findAll(); // TODO add more data from 'data' and display to user ? diff --git a/lib/pages/send_view/frost_ms/send_steps/frost_send_step_2.dart b/lib/pages/send_view/frost_ms/send_steps/frost_send_step_2.dart index db198831f..724e62092 100644 --- a/lib/pages/send_view/frost_ms/send_steps/frost_send_step_2.dart +++ b/lib/pages/send_view/frost_ms/send_steps/frost_send_step_2.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../../frost_route_generator.dart'; -import '../../../wallet_view/transaction_views/transaction_details_view.dart'; import '../../../../providers/frost_wallet/frost_wallet_providers.dart'; import '../../../../providers/global/wallets_provider.dart'; import '../../../../services/frost.dart'; @@ -17,6 +17,7 @@ import '../../../../widgets/detail_item.dart'; import '../../../../widgets/dialogs/frost/frost_error_dialog.dart'; import '../../../../widgets/rounded_white_container.dart'; import '../../../../widgets/textfields/frost_step_field.dart'; +import '../../../wallet_view/transaction_views/transaction_details_view.dart'; class FrostSendStep2 extends ConsumerStatefulWidget { const FrostSendStep2({super.key}); @@ -209,18 +210,20 @@ class _FrostSendStep2State extends ConsumerState { const SizedBox( height: 12, ), - Builder(builder: (context) { - final count = countPreprocesses(); - final colors = Theme.of(context).extension()!; - return DetailItem( - title: "Required preprocesses", - detail: "$count of $threshold", - horizontal: true, - overrideDetailTextColor: count >= threshold - ? colors.accentColorGreen - : colors.accentColorRed, - ); - }), + Builder( + builder: (context) { + final count = countPreprocesses(); + final colors = Theme.of(context).extension()!; + return DetailItem( + title: "Required preprocesses", + detail: "$count of $threshold", + horizontal: true, + overrideDetailTextColor: count >= threshold + ? colors.accentColorGreen + : colors.accentColorRed, + ); + }, + ), const SizedBox( height: 12, ), diff --git a/lib/pages/send_view/frost_ms/send_steps/frost_send_step_3.dart b/lib/pages/send_view/frost_ms/send_steps/frost_send_step_3.dart index 6b3c40362..de0ade7df 100644 --- a/lib/pages/send_view/frost_ms/send_steps/frost_send_step_3.dart +++ b/lib/pages/send_view/frost_ms/send_steps/frost_send_step_3.dart @@ -1,8 +1,8 @@ import 'package:coinlib_flutter/coinlib_flutter.dart' as cl; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../../frost_route_generator.dart'; -import '../../../wallet_view/transaction_views/transaction_details_view.dart'; import '../../../../providers/frost_wallet/frost_wallet_providers.dart'; import '../../../../providers/global/wallets_provider.dart'; import '../../../../services/frost.dart'; @@ -18,6 +18,7 @@ import '../../../../widgets/detail_item.dart'; import '../../../../widgets/dialogs/frost/frost_error_dialog.dart'; import '../../../../widgets/frost_step_user_steps.dart'; import '../../../../widgets/textfields/frost_step_field.dart'; +import '../../../wallet_view/transaction_views/transaction_details_view.dart'; class FrostSendStep3 extends ConsumerStatefulWidget { const FrostSendStep3({super.key}); @@ -64,7 +65,8 @@ class _FrostSendStep3State extends ConsumerState { participantsWithoutMe = frostInfo.participants .toSet() .intersection( - ref.read(pFrostSelectParticipantsUnordered.state).state!.toSet()) + ref.read(pFrostSelectParticipantsUnordered.state).state!.toSet(), + ) .toList(); participantsWithoutMe.remove(myName); @@ -181,8 +183,9 @@ class _FrostSendStep3State extends ConsumerState { final List shares = []; for (final participant in participantsAll) { if (participantsWithoutMe.contains(participant)) { - shares.add(sharesCollected[ - participantsWithoutMe.indexOf(participant)]); + shares.add( + sharesCollected[participantsWithoutMe.indexOf(participant)], + ); } else { shares.add(""); } diff --git a/lib/pages/send_view/frost_ms/send_steps/frost_send_step_4.dart b/lib/pages/send_view/frost_ms/send_steps/frost_send_step_4.dart index 59596e846..a560d7151 100644 --- a/lib/pages/send_view/frost_ms/send_steps/frost_send_step_4.dart +++ b/lib/pages/send_view/frost_ms/send_steps/frost_send_step_4.dart @@ -2,9 +2,8 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../../../../frost_route_generator.dart'; -import '../../../wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart'; -import '../../../wallet_view/wallet_view.dart'; import '../../../../pages_desktop_specific/my_stack_view/my_stack_view.dart'; import '../../../../providers/frost_wallet/frost_wallet_providers.dart'; import '../../../../providers/global/wallets_provider.dart'; @@ -22,6 +21,8 @@ import '../../../../widgets/desktop/primary_button.dart'; import '../../../../widgets/detail_item.dart'; import '../../../../widgets/expandable.dart'; import '../../../../widgets/stack_dialog.dart'; +import '../../../wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart'; +import '../../../wallet_view/wallet_view.dart'; class FrostSendStep4 extends ConsumerStatefulWidget { const FrostSendStep4({super.key}); @@ -165,8 +166,9 @@ class _FrostSendStep4State extends ConsumerState { DetailItem( title: "Total", detail: ref.watch(pAmountFormatter(cryptoCurrency)).format( - ref.watch(pFrostTxData)!.fee! + - recipients.map((e) => e.amount).reduce((v, e) => v += e)), + ref.watch(pFrostTxData)!.fee! + + recipients.map((e) => e.amount).reduce((v, e) => v += e), + ), horizontal: true, ), const SizedBox( diff --git a/lib/pages/send_view/send_view.dart b/lib/pages/send_view/send_view.dart index da10718c9..8d1f12c5d 100644 --- a/lib/pages/send_view/send_view.dart +++ b/lib/pages/send_view/send_view.dart @@ -18,15 +18,11 @@ import 'package:flutter/services.dart'; import 'package:flutter_native_splash/cli_commands.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:tuple/tuple.dart'; + import '../../models/isar/models/isar_models.dart'; import '../../models/paynym/paynym_account_lite.dart'; import '../../models/send_view_auto_fill_data.dart'; -import '../address_book_views/address_book_view.dart'; -import '../coin_control/coin_control_view.dart'; -import 'confirm_transaction_view.dart'; -import 'sub_widgets/building_transaction_dialog.dart'; -import 'sub_widgets/firo_balance_selection_sheet.dart'; -import 'sub_widgets/transaction_fee_selection_sheet.dart'; import '../../providers/providers.dart'; import '../../providers/ui/fee_rate_type_state_provider.dart'; import '../../providers/ui/preview_tx_button_state_provider.dart'; @@ -48,12 +44,6 @@ import '../../utilities/logger.dart'; import '../../utilities/prefs.dart'; import '../../utilities/text_styles.dart'; import '../../utilities/util.dart'; -import '../../wallets/crypto_currency/coins/epiccash.dart'; -import '../../wallets/crypto_currency/coins/ethereum.dart'; -import '../../wallets/crypto_currency/coins/firo.dart'; -import '../../wallets/crypto_currency/coins/monero.dart'; -import '../../wallets/crypto_currency/coins/stellar.dart'; -import '../../wallets/crypto_currency/coins/tezos.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../wallets/crypto_currency/intermediate/nano_currency.dart'; import '../../wallets/isar/providers/wallet_info_provider.dart'; @@ -75,7 +65,12 @@ import '../../widgets/rounded_white_container.dart'; import '../../widgets/stack_dialog.dart'; import '../../widgets/stack_text_field.dart'; import '../../widgets/textfield_icon_button.dart'; -import 'package:tuple/tuple.dart'; +import '../address_book_views/address_book_view.dart'; +import '../coin_control/coin_control_view.dart'; +import 'confirm_transaction_view.dart'; +import 'sub_widgets/building_transaction_dialog.dart'; +import 'sub_widgets/firo_balance_selection_sheet.dart'; +import 'sub_widgets/transaction_fee_selection_sheet.dart'; class SendView extends ConsumerStatefulWidget { const SendView({ @@ -1003,14 +998,20 @@ class _SendViewState extends ConsumerState { prefsChangeNotifierProvider.select( (value) => value.enableCoinControl, ), - ); + ) && + (coin is Firo + ? ref.watch(publicPrivateBalanceStateProvider) == FiroType.public + : true); if (isFiro) { ref.listen(publicPrivateBalanceStateProvider, (previous, next) { + selectedUTXOs = {}; + if (ref.read(pSendAmount) == null) { setState(() { _calculateFeesFuture = calculateFees( - 0.toAmountAsRaw(fractionDigits: coin.fractionDigits)); + 0.toAmountAsRaw(fractionDigits: coin.fractionDigits), + ); }); } else { setState(() { diff --git a/lib/pages/send_view/sub_widgets/firo_balance_selection_sheet.dart b/lib/pages/send_view/sub_widgets/firo_balance_selection_sheet.dart index 3a890718b..912fad545 100644 --- a/lib/pages/send_view/sub_widgets/firo_balance_selection_sheet.dart +++ b/lib/pages/send_view/sub_widgets/firo_balance_selection_sheet.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../providers/providers.dart'; import '../../../providers/wallet/public_private_balance_state_provider.dart'; import '../../../themes/stack_colors.dart'; @@ -20,9 +21,9 @@ import '../../../wallets/wallet/impl/firo_wallet.dart'; class FiroBalanceSelectionSheet extends ConsumerStatefulWidget { const FiroBalanceSelectionSheet({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; @@ -125,12 +126,14 @@ class _FiroBalanceSelectionSheetState value: FiroType.spark, groupValue: ref .watch( - publicPrivateBalanceStateProvider.state) + publicPrivateBalanceStateProvider.state, + ) .state, onChanged: (x) { ref - .read(publicPrivateBalanceStateProvider - .state) + .read( + publicPrivateBalanceStateProvider.state, + ) .state = FiroType.spark; Navigator.of(context).pop(); @@ -168,7 +171,7 @@ class _FiroBalanceSelectionSheetState ), // ], // ), - ) + ), ], ), ), @@ -209,13 +212,16 @@ class _FiroBalanceSelectionSheetState .radioButtonIconEnabled, value: FiroType.lelantus, groupValue: ref - .watch(publicPrivateBalanceStateProvider - .state) + .watch( + publicPrivateBalanceStateProvider.state, + ) .state, onChanged: (x) { ref - .read(publicPrivateBalanceStateProvider - .state) + .read( + publicPrivateBalanceStateProvider + .state, + ) .state = FiroType.lelantus; Navigator.of(context).pop(); @@ -253,7 +259,7 @@ class _FiroBalanceSelectionSheetState ), // ], // ), - ) + ), ], ), ), @@ -288,12 +294,14 @@ class _FiroBalanceSelectionSheetState value: FiroType.public, groupValue: ref .watch( - publicPrivateBalanceStateProvider.state) + publicPrivateBalanceStateProvider.state, + ) .state, onChanged: (x) { ref - .read(publicPrivateBalanceStateProvider - .state) + .read( + publicPrivateBalanceStateProvider.state, + ) .state = FiroType.public; Navigator.of(context).pop(); }, diff --git a/lib/pages/send_view/sub_widgets/sending_transaction_dialog.dart b/lib/pages/send_view/sub_widgets/sending_transaction_dialog.dart index bd55b42b1..710cbfa1c 100644 --- a/lib/pages/send_view/sub_widgets/sending_transaction_dialog.dart +++ b/lib/pages/send_view/sub_widgets/sending_transaction_dialog.dart @@ -129,11 +129,11 @@ class ProgressAndSuccessController { class ProgressAndSuccess extends StatefulWidget { const ProgressAndSuccess({ - Key? key, + super.key, this.height = 24, this.width = 24, required this.controller, - }) : super(key: key); + }); final double height; final double width; diff --git a/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart b/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart index 1202138dd..a70098c03 100644 --- a/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart +++ b/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart @@ -22,10 +22,6 @@ import '../../../utilities/constants.dart'; import '../../../utilities/enums/fee_rate_type_enum.dart'; import '../../../utilities/logger.dart'; import '../../../utilities/text_styles.dart'; -import '../../../wallets/crypto_currency/coins/ethereum.dart'; -import '../../../wallets/crypto_currency/coins/firo.dart'; -import '../../../wallets/crypto_currency/coins/monero.dart'; -import '../../../wallets/crypto_currency/coins/wownero.dart'; import '../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../wallets/isar/providers/eth/current_token_wallet_provider.dart'; import '../../../wallets/isar/providers/wallet_info_provider.dart'; diff --git a/lib/pages/send_view/token_send_view.dart b/lib/pages/send_view/token_send_view.dart index 40d73c917..61ae1d1a9 100644 --- a/lib/pages/send_view/token_send_view.dart +++ b/lib/pages/send_view/token_send_view.dart @@ -39,7 +39,6 @@ import '../../utilities/logger.dart'; import '../../utilities/prefs.dart'; import '../../utilities/text_styles.dart'; import '../../utilities/util.dart'; -import '../../wallets/crypto_currency/coins/epiccash.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../wallets/isar/providers/eth/current_token_wallet_provider.dart'; import '../../wallets/isar/providers/eth/token_balance_provider.dart'; diff --git a/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart b/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart index 7de750ae3..3d5413798 100644 --- a/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart +++ b/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart @@ -10,10 +10,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'debug_view.dart'; -import 'manage_coin_units/manage_coin_units_view.dart'; -import 'manage_explorer_view.dart'; -import '../../../stack_privacy_calls.dart'; +import 'package:tuple/tuple.dart'; + import '../../../../providers/global/prefs_provider.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/constants.dart'; @@ -23,12 +21,15 @@ import '../../../../widgets/choose_coin_view.dart'; import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../widgets/custom_buttons/draggable_switch_button.dart'; import '../../../../widgets/rounded_white_container.dart'; -import 'package:tuple/tuple.dart'; +import '../../../stack_privacy_calls.dart'; +import 'debug_view.dart'; +import 'manage_coin_units/manage_coin_units_view.dart'; +import 'manage_explorer_view.dart'; class AdvancedSettingsView extends StatelessWidget { const AdvancedSettingsView({ - Key? key, - }) : super(key: key); + super.key, + }); static const String routeName = "/advancedSettings"; @@ -116,7 +117,8 @@ class AdvancedSettingsView extends StatelessWidget { child: DraggableSwitchButton( isOn: ref.watch( prefsChangeNotifierProvider.select( - (value) => value.showTestNetCoins), + (value) => value.showTestNetCoins, + ), ), onValueChanged: (newValue) { ref @@ -163,7 +165,8 @@ class AdvancedSettingsView extends StatelessWidget { child: DraggableSwitchButton( isOn: ref.watch( prefsChangeNotifierProvider.select( - (value) => value.enableCoinControl), + (value) => value.enableCoinControl, + ), ), onValueChanged: (newValue) { ref @@ -224,7 +227,7 @@ class AdvancedSettingsView extends StatelessWidget { : "\nIncognito", style: STextStyles.label(context) .copyWith(fontSize: 15.0), - ) + ), ], ), ), @@ -249,11 +252,14 @@ class AdvancedSettingsView extends StatelessWidget { ), ), onPressed: () { - Navigator.of(context).pushNamed(ChooseCoinView.routeName, - arguments: const Tuple3( - "Manage block explorers", - "block explorer", - ManageExplorerView.routeName)); + Navigator.of(context).pushNamed( + ChooseCoinView.routeName, + arguments: const Tuple3( + "Manage block explorers", + "block explorer", + ManageExplorerView.routeName, + ), + ); }, child: Padding( padding: const EdgeInsets.symmetric( diff --git a/lib/pages/settings_views/global_settings_view/advanced_views/debug_view.dart b/lib/pages/settings_views/global_settings_view/advanced_views/debug_view.dart index 8bbaf9afd..518cf32da 100644 --- a/lib/pages/settings_views/global_settings_view/advanced_views/debug_view.dart +++ b/lib/pages/settings_views/global_settings_view/advanced_views/debug_view.dart @@ -23,9 +23,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:lelantus/git_versions.dart' as FIRO_VERSIONS; import 'package:package_info_plus/package_info_plus.dart'; + import '../../../../models/isar/models/log.dart'; import '../../../../notifications/show_flush_bar.dart'; -import '../stack_backup_views/helpers/swb_file_system.dart'; import '../../../../providers/global/debug_service_provider.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; @@ -44,9 +44,10 @@ import '../../../../widgets/rounded_container.dart'; import '../../../../widgets/stack_dialog.dart'; import '../../../../widgets/stack_text_field.dart'; import '../../../../widgets/textfield_icon_button.dart'; +import '../stack_backup_views/helpers/swb_file_system.dart'; class DebugView extends ConsumerStatefulWidget { - const DebugView({Key? key}) : super(key: key); + const DebugView({super.key}); static const String routeName = "/debug"; @@ -68,7 +69,8 @@ class _DebugViewState extends ConsumerState { } return unfiltered .where( - (e) => (e.toString().toLowerCase().contains(filter.toLowerCase()))) + (e) => (e.toString().toLowerCase().contains(filter.toLowerCase())), + ) .toList(); } @@ -174,19 +176,21 @@ class _DebugViewState extends ConsumerState { Navigator.of(context).pop(); bool shouldPop = false; - unawaited(showDialog( - barrierDismissible: false, - context: context, - builder: (_) => WillPopScope( - onWillPop: () async { - return shouldPop; - }, - child: const CustomLoadingOverlay( - message: "Deleting logs...", - eventBus: null, + unawaited( + showDialog( + barrierDismissible: false, + context: context, + builder: (_) => WillPopScope( + onWillPop: () async { + return shouldPop; + }, + child: const CustomLoadingOverlay( + message: "Deleting logs...", + eventBus: null, + ), ), ), - )); + ); await ref .read(debugServiceProvider) @@ -196,10 +200,13 @@ class _DebugViewState extends ConsumerState { if (mounted) { Navigator.pop(context); - unawaited(showFloatingFlushBar( + unawaited( + showFloatingFlushBar( type: FlushBarType.info, context: context, - message: 'Logs cleared!')); + message: 'Logs cleared!', + ), + ); setState(() {}); } @@ -301,32 +308,34 @@ class _DebugViewState extends ConsumerState { final signature = packageInfo.buildSignature; final appName = packageInfo.appName; - String firoCommit = + final String firoCommit = FIRO_VERSIONS.getPluginVersion(); - String epicCashCommit = + final String epicCashCommit = EPIC_VERSIONS.getPluginVersion(); - String moneroCommit = + final String moneroCommit = MONERO_VERSIONS.getPluginVersion(); - DeviceInfoPlugin deviceInfoPlugin = + final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin(); final deviceInfo = await deviceInfoPlugin.deviceInfo; - var deviceInfoMap = deviceInfo.toMap(); + final deviceInfoMap = deviceInfo.toMap(); deviceInfoMap.remove("systemFeatures"); final logs = filtered( - ref.watch(debugServiceProvider - .select((value) => - value.recentLogs)), - _searchTerm) - .reversed - .toList(growable: false); - List errorLogs = []; - for (var log in logs) { + ref.watch( + debugServiceProvider.select( + (value) => value.recentLogs, + ), + ), + _searchTerm, + ).reversed.toList(growable: false); + final List errorLogs = []; + for (final log in logs) { if (log.logLevel == LogLevel.Error || log.logLevel == LogLevel.Fatal) { errorLogs.add( - "${log.logLevel}: ${log.message}"); + "${log.logLevel}: ${log.message}", + ); } } @@ -342,14 +351,16 @@ class _DebugViewState extends ConsumerState { "errorLogs": errorLogs, }; Logging.instance.log( - json.encode(finalDebugMap), - level: LogLevel.Info, - printFullLength: true); + json.encode(finalDebugMap), + level: LogLevel.Info, + printFullLength: true, + ); const ClipboardInterface clipboard = ClipboardWrapper(); await clipboard.setData( ClipboardData( - text: json.encode(finalDebugMap)), + text: json.encode(finalDebugMap), + ), ); } catch (e, s) { Logging.instance @@ -400,19 +411,22 @@ class _DebugViewState extends ConsumerState { if (path != null) { final eventBus = EventBus(); bool shouldPop = false; - unawaited(showDialog( - barrierDismissible: false, - context: context, - builder: (_) => WillPopScope( - onWillPop: () async { - return shouldPop; - }, - child: CustomLoadingOverlay( - message: "Generating Stack logs file", - eventBus: eventBus, + unawaited( + showDialog( + barrierDismissible: false, + context: context, + builder: (_) => WillPopScope( + onWillPop: () async { + return shouldPop; + }, + child: CustomLoadingOverlay( + message: + "Generating Stack logs file", + eventBus: eventBus, + ), ), ), - )); + ); bool logsSaved = true; String? filename; @@ -459,7 +473,7 @@ class _DebugViewState extends ConsumerState { }, ), ], - ) + ), ], ), ), @@ -470,11 +484,11 @@ class _DebugViewState extends ConsumerState { body: Builder( builder: (context) { final logs = filtered( - ref.watch(debugServiceProvider - .select((value) => value.recentLogs)), - _searchTerm) - .reversed - .toList(growable: false); + ref.watch( + debugServiceProvider.select((value) => value.recentLogs), + ), + _searchTerm, + ).reversed.toList(growable: false); return CustomScrollView( reverse: true, @@ -493,7 +507,8 @@ class _DebugViewState extends ConsumerState { return Container( key: Key( - "log_${log.id}_${log.timestampInMillisUTC}"), + "log_${log.id}_${log.timestampInMillisUTC}", + ), decoration: BoxDecoration( color: Theme.of(context) .extension()! diff --git a/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart b/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart index 65cf6cbd6..08d801cc4 100644 --- a/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart +++ b/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart @@ -257,7 +257,7 @@ class _EditCoinUnitsViewState extends ConsumerState { ), ), ), - ) + ), ], ), SizedBox( diff --git a/lib/pages/settings_views/global_settings_view/advanced_views/manage_explorer_view.dart b/lib/pages/settings_views/global_settings_view/advanced_views/manage_explorer_view.dart index b688a1f6d..a50568e52 100644 --- a/lib/pages/settings_views/global_settings_view/advanced_views/manage_explorer_view.dart +++ b/lib/pages/settings_views/global_settings_view/advanced_views/manage_explorer_view.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../../themes/stack_colors.dart'; import '../../../../utilities/block_explorers.dart'; import '../../../../utilities/text_styles.dart'; @@ -39,10 +40,10 @@ class _ManageExplorerViewState extends ConsumerState { void initState() { super.initState(); textEditingController = TextEditingController( - text: - getBlockExplorerTransactionUrlFor(coin: widget.coin, txid: "[TXID]") - .toString() - .replaceAll("%5BTXID%5D", "[TXID]")); + text: getBlockExplorerTransactionUrlFor(coin: widget.coin, txid: "[TXID]") + .toString() + .replaceAll("%5BTXID%5D", "[TXID]"), + ); } @override @@ -72,32 +73,33 @@ class _ManageExplorerViewState extends ConsumerState { child: Column( children: [ Expanded( - child: Column( - children: [ - TextField( - controller: textEditingController, - decoration: const InputDecoration( - border: OutlineInputBorder(), - ), - ), - const SizedBox( - height: 8, - ), - RoundedWhiteContainer( - child: Center( - child: Text( - "Edit your block explorer above. Keep in mind that " - "every block explorer has a slightly different URL " - "scheme.\n\nPaste in your block explorer of choice," - " then edit in [TXID] where the transaction ID " - "should go, and Stack Wallet will auto fill the " - "transaction ID in that place of URL.", - style: STextStyles.itemSubtitle(context), + child: Column( + children: [ + TextField( + controller: textEditingController, + decoration: const InputDecoration( + border: OutlineInputBorder(), ), ), - ), - ], - )), + const SizedBox( + height: 8, + ), + RoundedWhiteContainer( + child: Center( + child: Text( + "Edit your block explorer above. Keep in mind that " + "every block explorer has a slightly different URL " + "scheme.\n\nPaste in your block explorer of choice," + " then edit in [TXID] where the transaction ID " + "should go, and Stack Wallet will auto fill the " + "transaction ID in that place of URL.", + style: STextStyles.itemSubtitle(context), + ), + ), + ), + ], + ), + ), Align( alignment: Alignment.bottomCenter, child: ConstrainedBox( @@ -129,7 +131,7 @@ class _ManageExplorerViewState extends ConsumerState { ), ), ), - ) + ), ], ), ), diff --git a/lib/pages/settings_views/global_settings_view/appearance_settings/appearance_settings_view.dart b/lib/pages/settings_views/global_settings_view/appearance_settings/appearance_settings_view.dart index 6981508e6..fe17f8ffc 100644 --- a/lib/pages/settings_views/global_settings_view/appearance_settings/appearance_settings_view.dart +++ b/lib/pages/settings_views/global_settings_view/appearance_settings/appearance_settings_view.dart @@ -10,8 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'manage_themes.dart'; -import 'sub_widgets/theme_options_widget.dart'; + import '../../../../providers/providers.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/constants.dart'; @@ -21,9 +20,11 @@ import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../widgets/custom_buttons/draggable_switch_button.dart'; import '../../../../widgets/desktop/secondary_button.dart'; import '../../../../widgets/rounded_white_container.dart'; +import 'manage_themes.dart'; +import 'sub_widgets/theme_options_widget.dart'; class AppearanceSettingsView extends ConsumerWidget { - const AppearanceSettingsView({Key? key}) : super(key: key); + const AppearanceSettingsView({super.key}); static const String routeName = "/appearanceSettings"; @@ -89,17 +90,19 @@ class AppearanceSettingsView extends ConsumerWidget { child: DraggableSwitchButton( isOn: ref.watch( prefsChangeNotifierProvider.select( - (value) => - value.showFavoriteWallets), + (value) => + value.showFavoriteWallets, + ), ), onValueChanged: (newValue) { ref .read( - prefsChangeNotifierProvider) + prefsChangeNotifierProvider, + ) .showFavoriteWallets = newValue; }, ), - ) + ), ], ), ), @@ -145,7 +148,7 @@ class AppearanceSettingsView extends ConsumerWidget { ManageThemesView.routeName, ); }, - ) + ), ], ), ), diff --git a/lib/pages/settings_views/global_settings_view/appearance_settings/manage_themes.dart b/lib/pages/settings_views/global_settings_view/appearance_settings/manage_themes.dart index bea81abba..4744d857f 100644 --- a/lib/pages/settings_views/global_settings_view/appearance_settings/manage_themes.dart +++ b/lib/pages/settings_views/global_settings_view/appearance_settings/manage_themes.dart @@ -33,7 +33,7 @@ import '../../../../widgets/rounded_white_container.dart'; import 'package:tuple/tuple.dart'; class ManageThemesView extends ConsumerStatefulWidget { - const ManageThemesView({Key? key}) : super(key: key); + const ManageThemesView({super.key}); static const String routeName = "/manageThemes"; @@ -220,9 +220,9 @@ class _ManageThemesViewState extends ConsumerState { class IncognitoInstalledThemes extends ConsumerStatefulWidget { const IncognitoInstalledThemes({ - Key? key, + super.key, required this.cardWidth, - }) : super(key: key); + }); final double cardWidth; diff --git a/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/install_theme_from_file_dialog.dart b/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/install_theme_from_file_dialog.dart index 1574c3cfe..b95384ba1 100644 --- a/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/install_theme_from_file_dialog.dart +++ b/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/install_theme_from_file_dialog.dart @@ -27,7 +27,7 @@ import '../../../../../widgets/desktop/secondary_button.dart'; import '../../../../../widgets/stack_dialog.dart'; class InstallThemeFromFileDialog extends ConsumerStatefulWidget { - const InstallThemeFromFileDialog({Key? key}) : super(key: key); + const InstallThemeFromFileDialog({super.key}); @override ConsumerState createState() => @@ -189,7 +189,7 @@ class _InstallThemeFromFileDialogState ), ), ], - ) + ), ], ), ); diff --git a/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/stack_theme_card.dart b/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/stack_theme_card.dart index 5b9c2fe90..3ab865653 100644 --- a/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/stack_theme_card.dart +++ b/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/stack_theme_card.dart @@ -15,6 +15,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; + import '../../../../../models/isar/stack_theme.dart'; import '../../../../../notifications/show_flush_bar.dart'; import '../../../../../providers/db/main_db_provider.dart'; @@ -34,9 +35,9 @@ import '../../../../../widgets/stack_dialog.dart'; class StackThemeCard extends ConsumerStatefulWidget { const StackThemeCard({ - Key? key, + super.key, required this.data, - }) : super(key: key); + }); final StackThemeMetaData data; @@ -130,7 +131,8 @@ class _StackThemeCardState extends ConsumerState { final themeDir = Directory("${themesDir.path}/${widget.data.id}"); int bytes = 0; if (await themeDir.exists()) { - await for (FileSystemEntity entity in themeDir.list(recursive: true)) { + await for (final FileSystemEntity entity + in themeDir.list(recursive: true)) { if (entity is File) { bytes += await entity.length(); } @@ -142,13 +144,13 @@ class _StackThemeCardState extends ConsumerState { if (bytes < 1024) { return '$bytes B'; } else if (bytes < 1048576) { - double kbSize = bytes / 1024; + final double kbSize = bytes / 1024; return '${kbSize.toStringAsFixed(2)} KB'; } else if (bytes < 1073741824) { - double mbSize = bytes / 1048576; + final double mbSize = bytes / 1048576; return '${mbSize.toStringAsFixed(2)} MB'; } else { - double gbSize = bytes / 1073741824; + final double gbSize = bytes / 1073741824; return '${gbSize.toStringAsFixed(2)} GB'; } } diff --git a/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/theme_option.dart b/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/theme_option.dart index 57cf428d5..185163996 100644 --- a/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/theme_option.dart +++ b/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/theme_option.dart @@ -15,13 +15,13 @@ import '../../../../../utilities/text_styles.dart'; class ThemeOption extends StatelessWidget { const ThemeOption({ - Key? key, + super.key, required this.onPressed, required this.onChanged, required this.label, required this.value, required this.groupValue, - }) : super(key: key); + }); final VoidCallback onPressed; final void Function(Object?) onChanged; diff --git a/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/theme_options_widget.dart b/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/theme_options_widget.dart index 8f3a78678..9435385fc 100644 --- a/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/theme_options_widget.dart +++ b/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/theme_options_widget.dart @@ -27,7 +27,7 @@ import '../../../../../widgets/custom_buttons/blue_text_button.dart'; import 'package:tuple/tuple.dart'; class ThemeOptionsWidget extends ConsumerStatefulWidget { - const ThemeOptionsWidget({Key? key}) : super(key: key); + const ThemeOptionsWidget({super.key}); @override ConsumerState createState() => _ThemeOptionsWidgetState(); diff --git a/lib/pages/settings_views/global_settings_view/appearance_settings/system_brightness_theme_selection_view.dart b/lib/pages/settings_views/global_settings_view/appearance_settings/system_brightness_theme_selection_view.dart index 85154430e..becef5fb6 100644 --- a/lib/pages/settings_views/global_settings_view/appearance_settings/system_brightness_theme_selection_view.dart +++ b/lib/pages/settings_views/global_settings_view/appearance_settings/system_brightness_theme_selection_view.dart @@ -10,7 +10,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'sub_widgets/theme_option.dart'; +import 'package:tuple/tuple.dart'; + import '../../../../providers/global/prefs_provider.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../themes/theme_providers.dart'; @@ -19,10 +20,10 @@ import '../../../../utilities/text_styles.dart'; import '../../../../widgets/background.dart'; import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../widgets/rounded_white_container.dart'; -import 'package:tuple/tuple.dart'; +import 'sub_widgets/theme_option.dart'; class SystemBrightnessThemeSelectionView extends ConsumerStatefulWidget { - const SystemBrightnessThemeSelectionView({Key? key}) : super(key: key); + const SystemBrightnessThemeSelectionView({super.key}); static const String routeName = "/chooseSystemTheme"; @@ -153,7 +154,8 @@ class _SystemBrightnessThemeSelectionViewState if (newValue == value && ref .read( - prefsChangeNotifierProvider) + prefsChangeNotifierProvider, + ) .systemBrightnessLightThemeId != value) { _setTheme( @@ -167,9 +169,11 @@ class _SystemBrightnessThemeSelectionViewState value: installedThemeIdNames[i ~/ 2].item1, groupValue: ref.watch( - prefsChangeNotifierProvider.select( - (value) => value - .systemBrightnessLightThemeId)), + prefsChangeNotifierProvider.select( + (value) => value + .systemBrightnessLightThemeId, + ), + ), ), ], ), @@ -215,7 +219,8 @@ class _SystemBrightnessThemeSelectionViewState if (newValue == value && ref .read( - prefsChangeNotifierProvider) + prefsChangeNotifierProvider, + ) .systemBrightnessDarkThemeId != value) { _setTheme( @@ -229,9 +234,11 @@ class _SystemBrightnessThemeSelectionViewState value: installedThemeIdNames[i ~/ 2].item1, groupValue: ref.watch( - prefsChangeNotifierProvider.select( - (value) => value - .systemBrightnessDarkThemeId)), + prefsChangeNotifierProvider.select( + (value) => value + .systemBrightnessDarkThemeId, + ), + ), ), ], ), diff --git a/lib/pages/settings_views/global_settings_view/currency_view.dart b/lib/pages/settings_views/global_settings_view/currency_view.dart index c9b618b1e..18c8a6a12 100644 --- a/lib/pages/settings_views/global_settings_view/currency_view.dart +++ b/lib/pages/settings_views/global_settings_view/currency_view.dart @@ -11,6 +11,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../providers/global/base_currencies_provider.dart'; import '../../../providers/providers.dart'; import '../../../themes/stack_colors.dart'; @@ -30,7 +31,7 @@ import '../../../widgets/stack_text_field.dart'; import '../../../widgets/textfield_icon_button.dart'; class BaseCurrencySettingsView extends ConsumerStatefulWidget { - const BaseCurrencySettingsView({Key? key}) : super(key: key); + const BaseCurrencySettingsView({super.key}); static const String routeName = "/baseCurrencySettings"; @@ -155,7 +156,8 @@ class _CurrencyViewState extends ConsumerState { if (FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( - const Duration(milliseconds: 75)); + const Duration(milliseconds: 75), + ); } if (mounted) { Navigator.of(context).pop(); @@ -329,7 +331,8 @@ class _CurrencyViewState extends ConsumerState { child: Padding( padding: const EdgeInsets.all(4), key: Key( - "currencySelect_${currenciesWithoutSelected[index]}"), + "currencySelect_${currenciesWithoutSelected[index]}", + ), child: RoundedContainer( padding: const EdgeInsets.all(0), color: currenciesWithoutSelected[index] == current @@ -385,29 +388,34 @@ class _CurrencyViewState extends ConsumerState { index] == current) ? const Key( - "selectedCurrencySettingsCurrencyText") + "selectedCurrencySettingsCurrencyText", + ) : null, style: STextStyles.largeMedium14( - context), + context, + ), ), const SizedBox( height: 2, ), Text( - ref.watch(baseCurrenciesProvider - .select((value) => - value.map))[ - currenciesWithoutSelected[ - index]] ?? + ref.watch( + baseCurrenciesProvider.select( + (value) => value.map, + ), + )[currenciesWithoutSelected[ + index]] ?? "", key: (currenciesWithoutSelected[ index] == current) ? const Key( - "selectedCurrencySettingsCurrencyTextDescription") + "selectedCurrencySettingsCurrencyTextDescription", + ) : null, style: STextStyles.itemSubtitle( - context), + context, + ), ), ], ), diff --git a/lib/pages/settings_views/global_settings_view/delete_account_view.dart b/lib/pages/settings_views/global_settings_view/delete_account_view.dart index 4294592a3..743488d4c 100644 --- a/lib/pages/settings_views/global_settings_view/delete_account_view.dart +++ b/lib/pages/settings_views/global_settings_view/delete_account_view.dart @@ -9,8 +9,8 @@ */ import 'package:flutter/material.dart'; + import '../../../db/hive/db.dart'; -import '../../intro_view.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/text_styles.dart'; import '../../../utilities/util.dart'; @@ -20,9 +20,10 @@ import '../../../widgets/desktop/desktop_scaffold.dart'; import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/stack_dialog.dart'; +import '../../intro_view.dart'; class DeleteAccountView extends StatefulWidget { - const DeleteAccountView({Key? key}) : super(key: key); + const DeleteAccountView({super.key}); static const String routeName = "/deleteAccountView"; @@ -51,9 +52,9 @@ class _DeleteAccountViewState extends State { child: Text( "Cancel", style: STextStyles.button(context).copyWith( - color: Theme.of(context) - .extension()! - .accentColorDark), + color: + Theme.of(context).extension()!.accentColorDark, + ), ), ), rightButton: TextButton( @@ -91,7 +92,8 @@ class _DeleteAccountViewState extends State { if (FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( - const Duration(milliseconds: 75)); + const Duration(milliseconds: 75), + ); } if (mounted) { Navigator.of(context).pop(); @@ -117,7 +119,7 @@ class _DeleteAccountViewState extends State { PrimaryButton( label: "Confirm", onPressed: onConfirmDeleteAccount, - ) + ), ], ), ), diff --git a/lib/pages/settings_views/global_settings_view/global_settings_view.dart b/lib/pages/settings_views/global_settings_view/global_settings_view.dart index c15d0f8d9..400bff87d 100644 --- a/lib/pages/settings_views/global_settings_view/global_settings_view.dart +++ b/lib/pages/settings_views/global_settings_view/global_settings_view.dart @@ -11,8 +11,17 @@ import 'dart:io'; import 'package:flutter/material.dart'; + +import '../../../route_generator.dart'; +import '../../../themes/stack_colors.dart'; +import '../../../utilities/assets.dart'; +import '../../../utilities/text_styles.dart'; +import '../../../widgets/background.dart'; +import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; +import '../../../widgets/rounded_white_container.dart'; import '../../address_book_views/address_book_view.dart'; import '../../pinpad_views/lock_screen_view.dart'; +import '../sub_widgets/settings_list_button.dart'; import 'about_view.dart'; import 'advanced_views/advanced_settings_view.dart'; import 'appearance_settings/appearance_settings_view.dart'; @@ -26,19 +35,11 @@ import 'startup_preferences/startup_preferences_view.dart'; import 'support_view.dart'; import 'syncing_preferences_views/syncing_preferences_view.dart'; import 'tor_settings/tor_settings_view.dart'; -import '../sub_widgets/settings_list_button.dart'; -import '../../../route_generator.dart'; -import '../../../themes/stack_colors.dart'; -import '../../../utilities/assets.dart'; -import '../../../utilities/text_styles.dart'; -import '../../../widgets/background.dart'; -import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; -import '../../../widgets/rounded_white_container.dart'; class GlobalSettingsView extends StatelessWidget { const GlobalSettingsView({ - Key? key, - }) : super(key: key); + super.key, + }); static const String routeName = "/globalSettings"; @@ -116,7 +117,8 @@ class GlobalSettingsView extends StatelessWidget { "Stack backup", ), settings: const RouteSettings( - name: "/swblockscreen"), + name: "/swblockscreen", + ), ), ); }, @@ -142,7 +144,8 @@ class GlobalSettingsView extends StatelessWidget { title: "Currency", onPressed: () { Navigator.of(context).pushNamed( - BaseCurrencySettingsView.routeName); + BaseCurrencySettingsView.routeName, + ); }, ), const SizedBox( @@ -154,7 +157,8 @@ class GlobalSettingsView extends StatelessWidget { title: "Language", onPressed: () { Navigator.of(context).pushNamed( - LanguageSettingsView.routeName); + LanguageSettingsView.routeName, + ); }, ), const SizedBox( @@ -190,7 +194,8 @@ class GlobalSettingsView extends StatelessWidget { title: "Syncing preferences", onPressed: () { Navigator.of(context).pushNamed( - SyncingPreferencesView.routeName); + SyncingPreferencesView.routeName, + ); }, ), const SizedBox( @@ -202,7 +207,8 @@ class GlobalSettingsView extends StatelessWidget { title: "Startup", onPressed: () { Navigator.of(context).pushNamed( - StartupPreferencesView.routeName); + StartupPreferencesView.routeName, + ); }, ), const SizedBox( @@ -229,7 +235,8 @@ class GlobalSettingsView extends StatelessWidget { title: "Delete account", onPressed: () async { await Navigator.of(context).pushNamed( - DeleteAccountView.routeName); + DeleteAccountView.routeName, + ); }, ), const SizedBox( @@ -253,7 +260,8 @@ class GlobalSettingsView extends StatelessWidget { title: "Advanced", onPressed: () { Navigator.of(context).pushNamed( - AdvancedSettingsView.routeName); + AdvancedSettingsView.routeName, + ); }, ), const SizedBox( diff --git a/lib/pages/settings_views/global_settings_view/hidden_settings.dart b/lib/pages/settings_views/global_settings_view/hidden_settings.dart index c1370624e..b389f31a3 100644 --- a/lib/pages/settings_views/global_settings_view/hidden_settings.dart +++ b/lib/pages/settings_views/global_settings_view/hidden_settings.dart @@ -13,6 +13,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../../../notifications/show_flush_bar.dart'; import '../../../providers/global/debug_service_provider.dart'; import '../../../providers/providers.dart'; @@ -20,7 +21,6 @@ import '../../../themes/stack_colors.dart'; import '../../../utilities/assets.dart'; import '../../../utilities/constants.dart'; import '../../../utilities/text_styles.dart'; -import '../../../wallets/crypto_currency/coins/stellar.dart'; import '../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../widgets/background.dart'; import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; @@ -285,28 +285,33 @@ class HiddenSettings extends StatelessWidget { ); }, ), - const SizedBox( - height: 12, - ), - Consumer( - builder: (_, ref, __) { - return GestureDetector( - onTap: () async { - // - }, - child: RoundedWhiteContainer( - child: Text( - "Do nothing", - style: STextStyles.button(context).copyWith( - color: Theme.of(context) - .extension()! - .accentColorDark, - ), - ), - ), - ); - }, - ), + // const SizedBox( + // height: 12, + // ), + // Consumer( + // builder: (_, ref, __) { + // return GestureDetector( + // onTap: () async { + // await showLoading( + // whileFuture: FiroCache.init(), + // context: context, + // rootNavigator: true, + // message: "initializing firo cache", + // ); + // }, + // child: RoundedWhiteContainer( + // child: Text( + // "init firo_cache", + // style: STextStyles.button(context).copyWith( + // color: Theme.of(context) + // .extension()! + // .accentColorDark, + // ), + // ), + // ), + // ); + // }, + // ), ], ), ), diff --git a/lib/pages/settings_views/global_settings_view/language_view.dart b/lib/pages/settings_views/global_settings_view/language_view.dart index 685736409..8f1ca3012 100644 --- a/lib/pages/settings_views/global_settings_view/language_view.dart +++ b/lib/pages/settings_views/global_settings_view/language_view.dart @@ -11,6 +11,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../providers/providers.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/assets.dart'; @@ -26,7 +27,7 @@ import '../../../widgets/stack_text_field.dart'; import '../../../widgets/textfield_icon_button.dart'; class LanguageSettingsView extends ConsumerStatefulWidget { - const LanguageSettingsView({Key? key}) : super(key: key); + const LanguageSettingsView({super.key}); static const String routeName = "/languageSettings"; @@ -82,7 +83,8 @@ class _LanguageViewState extends ConsumerState { List _filtered() { return listWithoutSelected .where( - (element) => element.toLowerCase().contains(filter.toLowerCase())) + (element) => element.toLowerCase().contains(filter.toLowerCase()), + ) .toList(); } @@ -225,7 +227,8 @@ class _LanguageViewState extends ConsumerState { child: Padding( padding: const EdgeInsets.all(4), key: Key( - "languageSelect_${listWithoutSelected[index]}"), + "languageSelect_${listWithoutSelected[index]}", + ), child: RoundedContainer( padding: const EdgeInsets.all(0), color: index == 0 @@ -275,10 +278,12 @@ class _LanguageViewState extends ConsumerState { listWithoutSelected[index], key: (index == 0) ? const Key( - "selectedLanguageSettingsLanguageText") + "selectedLanguageSettingsLanguageText", + ) : null, style: STextStyles.largeMedium14( - context), + context, + ), ), const SizedBox( height: 2, @@ -287,10 +292,12 @@ class _LanguageViewState extends ConsumerState { listWithoutSelected[index], key: (index == 0) ? const Key( - "selectedLanguageSettingsLanguageTextDescription") + "selectedLanguageSettingsLanguageTextDescription", + ) : null, style: STextStyles.itemSubtitle( - context), + context, + ), ), ], ), diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart index e5a1ad049..478440c99 100644 --- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart +++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart @@ -14,6 +14,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:uuid/uuid.dart'; + import '../../../../models/node_model.dart'; import '../../../../notifications/show_flush_bar.dart'; import '../../../../providers/global/secure_store_provider.dart'; @@ -25,12 +27,9 @@ import '../../../../utilities/flutter_secure_storage_interface.dart'; import '../../../../utilities/test_node_connection.dart'; import '../../../../utilities/text_styles.dart'; import '../../../../utilities/util.dart'; -import '../../../../wallets/crypto_currency/coins/epiccash.dart'; -import '../../../../wallets/crypto_currency/coins/ethereum.dart'; -import '../../../../wallets/crypto_currency/coins/monero.dart'; -import '../../../../wallets/crypto_currency/coins/wownero.dart'; import '../../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../../wallets/crypto_currency/intermediate/cryptonote_currency.dart'; +import '../../../../wallets/wallet/wallet_mixin_interfaces/cw_based_interface.dart'; import '../../../../widgets/background.dart'; import '../../../../widgets/conditional_parent.dart'; import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; @@ -41,7 +40,6 @@ import '../../../../widgets/icon_widgets/x_icon.dart'; import '../../../../widgets/stack_dialog.dart'; import '../../../../widgets/stack_text_field.dart'; import '../../../../widgets/textfield_icon_button.dart'; -import 'package:uuid/uuid.dart'; // import 'package:web3dart/web3dart.dart'; enum AddEditNodeViewType { add, edit } @@ -187,9 +185,10 @@ class _AddEditNodeViewState extends ConsumerState { child: Text( "Cancel", style: STextStyles.button(context).copyWith( - color: Theme.of(context) - .extension()! - .accentColorDark), + color: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ), rightButton: TextButton( @@ -223,7 +222,7 @@ class _AddEditNodeViewState extends ConsumerState { // strip unused path String address = formData.host!; - if (coin is Monero || coin is Wownero) { + if (coin is CwBasedInterface) { if (address.startsWith("http")) { final uri = Uri.parse(address); address = "${uri.scheme}://${uri.host}"; @@ -232,7 +231,7 @@ class _AddEditNodeViewState extends ConsumerState { switch (viewType) { case AddEditNodeViewType.add: - NodeModel node = NodeModel( + final NodeModel node = NodeModel( host: address, port: formData.port!, name: formData.name!, @@ -257,7 +256,7 @@ class _AddEditNodeViewState extends ConsumerState { } break; case AddEditNodeViewType.edit: - NodeModel node = NodeModel( + final NodeModel node = NodeModel( host: address, port: formData.port!, name: formData.name!, @@ -315,8 +314,10 @@ class _AddEditNodeViewState extends ConsumerState { Widget build(BuildContext context) { final NodeModel? node = viewType == AddEditNodeViewType.edit && nodeId != null - ? ref.watch(nodeServiceChangeNotifierProvider - .select((value) => value.getNodeById(id: nodeId!))) + ? ref.watch( + nodeServiceChangeNotifierProvider + .select((value) => value.getNodeById(id: nodeId!)), + ) : null; return ConditionalParent( @@ -332,7 +333,7 @@ class _AddEditNodeViewState extends ConsumerState { FocusScope.of(context).unfocus(); await Future.delayed(const Duration(milliseconds: 75)); } - if (mounted) { + if (context.mounted) { Navigator.of(context).pop(); } }, @@ -344,8 +345,10 @@ class _AddEditNodeViewState extends ConsumerState { actions: [ if (viewType == AddEditNodeViewType.edit && ref - .watch(nodeServiceChangeNotifierProvider - .select((value) => value.getNodesFor(coin))) + .watch( + nodeServiceChangeNotifierProvider + .select((value) => value.getNodesFor(coin)), + ) .length > 1) Padding( @@ -372,8 +375,10 @@ class _AddEditNodeViewState extends ConsumerState { height: 20, ), onPressed: () async { - Navigator.popUntil(context, - ModalRoute.withName(widget.routeOnSuccessOrDelete)); + Navigator.popUntil( + context, + ModalRoute.withName(widget.routeOnSuccessOrDelete), + ); await ref .read(nodeServiceChangeNotifierProvider) @@ -433,7 +438,7 @@ class _AddEditNodeViewState extends ConsumerState { Text( "Add new node", style: STextStyles.desktopH3(context), - ) + ), ], ), Padding( @@ -574,13 +579,13 @@ final nodeFormDataProvider = Provider((_) => NodeFormData()); class NodeForm extends ConsumerStatefulWidget { const NodeForm({ - Key? key, + super.key, this.node, required this.secureStore, required this.readOnly, required this.coin, this.onChanged, - }) : super(key: key); + }); final NodeModel? node; final SecureStorageInterface secureStore; @@ -832,6 +837,14 @@ class _NodeFormState extends ConsumerState { } else { enableSSLCheckbox = true; } + } else if (widget.coin is CwBasedInterface) { + if (newValue.startsWith("https://")) { + _useSSL = true; + } else if (newValue.startsWith("http://")) { + _useSSL = false; + } else { + _useSSL = true; + } } _updateState(); setState(() {}); @@ -1008,9 +1021,11 @@ class _NodeFormState extends ConsumerState { child: Checkbox( fillColor: !shouldBeReadOnly && enableSSLCheckbox ? null - : MaterialStateProperty.all(Theme.of(context) - .extension()! - .checkboxBGDisabled), + : MaterialStateProperty.all( + Theme.of(context) + .extension()! + .checkboxBGDisabled, + ), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, value: _useSSL, @@ -1030,14 +1045,14 @@ class _NodeFormState extends ConsumerState { Text( "Use SSL", style: STextStyles.itemSubtitle12(context), - ) + ), ], ), ), ), ], ), - if (widget.coin is Monero || widget.coin is Wownero) + if (widget.coin is CwBasedInterface) Row( children: [ GestureDetector( @@ -1059,9 +1074,11 @@ class _NodeFormState extends ConsumerState { child: Checkbox( fillColor: !widget.readOnly ? null - : MaterialStateProperty.all(Theme.of(context) - .extension()! - .checkboxBGDisabled), + : MaterialStateProperty.all( + Theme.of(context) + .extension()! + .checkboxBGDisabled, + ), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, value: _trusted, @@ -1081,7 +1098,7 @@ class _NodeFormState extends ConsumerState { Text( "Trusted", style: STextStyles.itemSubtitle12(context), - ) + ), ], ), ), @@ -1144,7 +1161,7 @@ class _NodeFormState extends ConsumerState { Text( "Use as failover", style: STextStyles.itemSubtitle12(context), - ) + ), ], ), ), diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/manage_nodes_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/manage_nodes_view.dart index dd6eed5ee..34b37b621 100644 --- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/manage_nodes_view.dart +++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/manage_nodes_view.dart @@ -13,9 +13,9 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'coin_nodes_view.dart'; -import '../../../../providers/providers.dart'; + import '../../../../app_config.dart'; +import '../../../../providers/providers.dart'; import '../../../../themes/coin_icon_provider.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/constants.dart'; @@ -24,6 +24,7 @@ import '../../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../../widgets/background.dart'; import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../widgets/rounded_white_container.dart'; +import 'coin_nodes_view.dart'; class ManageNodesView extends ConsumerStatefulWidget { const ManageNodesView({ @@ -90,8 +91,10 @@ class _ManageNodesViewState extends ConsumerState { ...coins.map( (coin) { final count = ref - .watch(nodeServiceChangeNotifierProvider - .select((value) => value.getNodesFor(coin))) + .watch( + nodeServiceChangeNotifierProvider + .select((value) => value.getNodesFor(coin)), + ) .length; return Padding( @@ -141,7 +144,7 @@ class _ManageNodesViewState extends ConsumerState { style: STextStyles.label(context), ), ], - ) + ), ], ), ), diff --git a/lib/pages/settings_views/global_settings_view/security_views/change_pin_view/change_pin_view.dart b/lib/pages/settings_views/global_settings_view/security_views/change_pin_view/change_pin_view.dart index 8d442f17f..57fa710ad 100644 --- a/lib/pages/settings_views/global_settings_view/security_views/change_pin_view/change_pin_view.dart +++ b/lib/pages/settings_views/global_settings_view/security_views/change_pin_view/change_pin_view.dart @@ -10,8 +10,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../../../notifications/show_flush_bar.dart'; -import '../security_view.dart'; import '../../../../../providers/global/prefs_provider.dart'; import '../../../../../providers/global/secure_store_provider.dart'; import '../../../../../themes/stack_colors.dart'; @@ -21,11 +21,12 @@ import '../../../../../utilities/text_styles.dart'; import '../../../../../widgets/background.dart'; import '../../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../../widgets/custom_pin_put/custom_pin_put.dart'; +import '../security_view.dart'; class ChangePinView extends ConsumerStatefulWidget { const ChangePinView({ - Key? key, - }) : super(key: key); + super.key, + }); static const String routeName = "/changePin"; @@ -207,8 +208,9 @@ class _ChangePinViewState extends ConsumerState { onSubmit: (String pin) async { if (_pinPutController1.text == _pinPutController2.text) { // This should never fail as we are overwriting the existing pin - assert((await _secureStore.read(key: "stack_pin")) != - null); + assert( + (await _secureStore.read(key: "stack_pin")) != null, + ); await _secureStore.write(key: "stack_pin", value: pin); showFloatingFlushBar( @@ -219,7 +221,8 @@ class _ChangePinViewState extends ConsumerState { ); await Future.delayed( - const Duration(milliseconds: 1200)); + const Duration(milliseconds: 1200), + ); if (mounted) { Navigator.of(context).popUntil( diff --git a/lib/pages/settings_views/global_settings_view/security_views/security_view.dart b/lib/pages/settings_views/global_settings_view/security_views/security_view.dart index ef911d4a0..ff35130fe 100644 --- a/lib/pages/settings_views/global_settings_view/security_views/security_view.dart +++ b/lib/pages/settings_views/global_settings_view/security_views/security_view.dart @@ -24,8 +24,8 @@ import '../../../../widgets/rounded_white_container.dart'; class SecurityView extends StatelessWidget { const SecurityView({ - Key? key, - }) : super(key: key); + super.key, + }); static const String routeName = "/security"; diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/auto_backup_view.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/auto_backup_view.dart index 4a6218d2f..fdfda272c 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/auto_backup_view.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/auto_backup_view.dart @@ -12,8 +12,8 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:intl/intl.dart'; -import 'create_auto_backup_view.dart'; -import 'edit_auto_backup_view.dart'; +import 'package:url_launcher/url_launcher.dart'; + import '../../../../providers/global/auto_swb_service_provider.dart'; import '../../../../providers/providers.dart'; import '../../../../themes/stack_colors.dart'; @@ -29,10 +29,11 @@ import '../../../../widgets/custom_buttons/draggable_switch_button.dart'; import '../../../../widgets/rounded_white_container.dart'; import '../../../../widgets/stack_dialog.dart'; import '../../../../widgets/stack_text_field.dart'; -import 'package:url_launcher/url_launcher.dart'; +import 'create_auto_backup_view.dart'; +import 'edit_auto_backup_view.dart'; class AutoBackupView extends ConsumerStatefulWidget { - const AutoBackupView({Key? key}) : super(key: key); + const AutoBackupView({super.key}); static const String routeName = "/stackAutoBackup"; @@ -72,8 +73,8 @@ class _AutoBackupViewState extends ConsumerState { } else { // if greater than a week return the actual date return DateFormat.yMMMMd( - ref.read(localeServiceChangeNotifierProvider).locale) - .format(time); + ref.read(localeServiceChangeNotifierProvider).locale, + ).format(time); } if (value == 1) { @@ -200,7 +201,8 @@ class _AutoBackupViewState extends ConsumerState { fileLocationController.text = ref.read(prefsChangeNotifierProvider).autoBackupLocation ?? " "; frequencyController.text = Format.prettyFrequencyType( - ref.read(prefsChangeNotifierProvider).backupFrequencyType); + ref.read(prefsChangeNotifierProvider).backupFrequencyType, + ); fileLocationFocusNode = FocusNode(); passwordFocusNode = FocusNode(); @@ -225,8 +227,9 @@ class _AutoBackupViewState extends ConsumerState { Widget build(BuildContext context) { debugPrint("BUILD: $runtimeType"); - bool isEnabledAutoBackup = ref.watch(prefsChangeNotifierProvider - .select((value) => value.isAutoBackupEnabled)); + final bool isEnabledAutoBackup = ref.watch( + prefsChangeNotifierProvider.select((value) => value.isAutoBackupEnabled), + ); ref.listen( prefsChangeNotifierProvider @@ -312,8 +315,9 @@ class _AutoBackupViewState extends ConsumerState { style: STextStyles.label(context), children: [ const TextSpan( - text: - "Auto Backup is a custom Stack Wallet feature that offers a convenient backup of your data.\n\nTo ensure maximum security, we recommend using a unique password that you haven't used anywhere else on the internet before. Your password is not stored.\n\nFor more information, please see our website "), + text: + "Auto Backup is a custom Stack Wallet feature that offers a convenient backup of your data.\n\nTo ensure maximum security, we recommend using a unique password that you haven't used anywhere else on the internet before. Your password is not stored.\n\nFor more information, please see our website ", + ), TextSpan( text: "stackwallet.com.", style: STextStyles.richLink(context), @@ -346,7 +350,7 @@ class _AutoBackupViewState extends ConsumerState { Text( "Backed up ${prettySinceLastBackupString(ref.watch(prefsChangeNotifierProvider.select((value) => value.lastAutoBackup)))}", style: STextStyles.itemSubtitle(context), - ) + ), ], ), ), @@ -465,7 +469,7 @@ class _AutoBackupViewState extends ConsumerState { .pushNamed(EditAutoBackupView.routeName); }, ), - ) + ), ], ), ], diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/create_auto_backup_view.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/create_auto_backup_view.dart index f7a36bcba..1583950c5 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/create_auto_backup_view.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/create_auto_backup_view.dart @@ -16,11 +16,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stack_wallet_backup/stack_wallet_backup.dart'; +import 'package:zxcvbn/zxcvbn.dart'; + import '../../../../notifications/show_flush_bar.dart'; -import 'auto_backup_view.dart'; -import 'helpers/restore_create_backup.dart'; -import 'helpers/swb_file_system.dart'; -import 'sub_views/backup_frequency_type_select_sheet.dart'; import '../../../../providers/global/prefs_provider.dart'; import '../../../../providers/global/secure_store_provider.dart'; import '../../../../themes/stack_colors.dart'; @@ -36,12 +34,15 @@ import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../widgets/progress_bar.dart'; import '../../../../widgets/stack_dialog.dart'; import '../../../../widgets/stack_text_field.dart'; -import 'package:zxcvbn/zxcvbn.dart'; +import 'auto_backup_view.dart'; +import 'helpers/restore_create_backup.dart'; +import 'helpers/swb_file_system.dart'; +import 'sub_views/backup_frequency_type_select_sheet.dart'; class CreateAutoBackupView extends ConsumerStatefulWidget { const CreateAutoBackupView({ - Key? key, - }) : super(key: key); + super.key, + }); static const String routeName = "/createAutoBackup"; @@ -134,542 +135,563 @@ class _EnableAutoBackupViewState extends ConsumerState { ), body: Padding( padding: const EdgeInsets.all(16), - child: LayoutBuilder(builder: (context, constraints) { - return SingleChildScrollView( - child: ConstrainedBox( - constraints: BoxConstraints( - minHeight: constraints.maxHeight, - ), - child: IntrinsicHeight( - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Text( - "Create your backup file", - style: STextStyles.smallMed12(context), - ), - const SizedBox( - height: 10, - ), - if (!Platform.isAndroid && !Platform.isIOS) - TextField( - autocorrect: Util.isDesktop ? false : true, - enableSuggestions: Util.isDesktop ? false : true, - onTap: Platform.isAndroid || Platform.isIOS - ? null - : () async { - try { - await stackFileSystem.prepareStorage(); - - if (mounted) { - await stackFileSystem.pickDir(context); - } - - if (mounted) { - setState(() { - fileLocationController.text = - stackFileSystem.dirPath ?? ""; - }); - } - } catch (e, s) { - Logging.instance - .log("$e\n$s", level: LogLevel.Error); - } - }, - controller: fileLocationController, - style: STextStyles.field(context), - decoration: InputDecoration( - hintText: "Save to...", - hintStyle: STextStyles.fieldLabel(context), - suffixIcon: UnconstrainedBox( - child: Row( - children: [ - const SizedBox( - width: 16, - ), - SvgPicture.asset( - Assets.svg.folder, - color: Theme.of(context) - .extension()! - .textDark3, - width: 16, - height: 16, - ), - const SizedBox( - width: 12, - ), - ], - ), - ), - ), - key: const Key( - "createBackupSaveToFileLocationTextFieldKey"), - readOnly: true, - toolbarOptions: const ToolbarOptions( - copy: true, - cut: false, - paste: false, - selectAll: false, - ), - onChanged: (newValue) {}, + child: LayoutBuilder( + builder: (context, constraints) { + return SingleChildScrollView( + child: ConstrainedBox( + constraints: BoxConstraints( + minHeight: constraints.maxHeight, + ), + child: IntrinsicHeight( + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text( + "Create your backup file", + style: STextStyles.smallMed12(context), ), - if (!Platform.isAndroid && !Platform.isIOS) const SizedBox( height: 10, ), - ClipRRect( - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - child: TextField( - key: const Key("createBackupPasswordFieldKey1"), - focusNode: passwordFocusNode, - controller: passwordController, - style: STextStyles.field(context), - obscureText: hidePassword, - enableSuggestions: false, - autocorrect: false, - decoration: standardInputDecoration( - "Create passphrase", - passwordFocusNode, - context, - ).copyWith( - suffixIcon: UnconstrainedBox( - child: Row( - children: [ - const SizedBox( - width: 16, - ), - GestureDetector( - key: const Key( - "createBackupPasswordFieldShowPasswordButtonKey"), - onTap: () async { - setState(() { - hidePassword = !hidePassword; - }); - }, - child: SvgPicture.asset( - hidePassword - ? Assets.svg.eye - : Assets.svg.eyeSlash, - color: Theme.of(context) - .extension()! - .textDark3, - width: 16, - height: 16, - ), - ), - const SizedBox( - width: 12, - ), - ], - ), - ), - ), - onChanged: (newValue) { - if (newValue.isEmpty) { - setState(() { - passwordFeedback = ""; - }); - return; - } - final result = zxcvbn.evaluate(newValue); - String suggestionsAndTips = ""; - for (var sug - in result.feedback.suggestions!.toSet()) { - suggestionsAndTips += "$sug\n"; - } - suggestionsAndTips += result.feedback.warning!; - String feedback = - // "Password Strength: ${((result.score! / 4.0) * 100).toInt()}%\n" - suggestionsAndTips; - - passwordStrength = result.score! / 4; - - // hack fix to format back string returned from zxcvbn - if (feedback.contains("phrasesNo need")) { - feedback = feedback.replaceFirst( - "phrasesNo need", "phrases\nNo need"); - } - - if (feedback.endsWith("\n")) { - feedback = - feedback.substring(0, feedback.length - 2); - } - - setState(() { - passwordFeedback = feedback; - }); - }, - ), - ), - if (passwordFocusNode.hasFocus || - passwordRepeatFocusNode.hasFocus || - passwordController.text.isNotEmpty) - Padding( - padding: EdgeInsets.only( - left: 12, - right: 12, - top: passwordFeedback.isNotEmpty ? 4 : 0, - ), - child: passwordFeedback.isNotEmpty - ? Text( - passwordFeedback, - style: STextStyles.infoSmall(context), - ) - : null, - ), - if (passwordFocusNode.hasFocus || - passwordRepeatFocusNode.hasFocus || - passwordController.text.isNotEmpty) - Padding( - padding: const EdgeInsets.only( - left: 12, - right: 12, - top: 10, - ), - child: ProgressBar( - key: const Key("createStackBackUpProgressBar"), - width: MediaQuery.of(context).size.width - 32 - 24, - height: 5, - fillColor: passwordStrength < 0.51 - ? Theme.of(context) - .extension()! - .accentColorRed - : passwordStrength < 1 - ? Theme.of(context) - .extension()! - .accentColorYellow - : Theme.of(context) - .extension()! - .accentColorGreen, - backgroundColor: Theme.of(context) - .extension()! - .buttonBackSecondary, - percent: passwordStrength < 0.25 - ? 0.03 - : passwordStrength, - ), - ), - const SizedBox( - height: 10, - ), - ClipRRect( - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - child: TextField( - key: const Key("createBackupPasswordFieldKey2"), - focusNode: passwordRepeatFocusNode, - controller: passwordRepeatController, - style: STextStyles.field(context), - obscureText: hidePassword, - enableSuggestions: false, - autocorrect: false, - decoration: standardInputDecoration( - "Confirm passphrase", - passwordRepeatFocusNode, - context, - ).copyWith( - suffixIcon: UnconstrainedBox( - child: Row( - children: [ - const SizedBox( - width: 16, - ), - GestureDetector( - key: const Key( - "createBackupPasswordFieldShowPasswordButtonKey"), - onTap: () async { - setState(() { - hidePassword = !hidePassword; - }); - }, - child: SvgPicture.asset( - hidePassword - ? Assets.svg.eye - : Assets.svg.eyeSlash, - color: Theme.of(context) - .extension()! - .textDark3, - width: 16, - height: 16, - ), - ), - const SizedBox( - width: 12, - ), - ], - ), - ), - ), - onChanged: (newValue) { - setState(() {}); - // TODO: ? check if passwords match? - }, - ), - ), - const SizedBox( - height: 32, - ), - Text( - "Auto Backup frequency", - style: STextStyles.smallMed12(context), - ), - const SizedBox( - height: 10, - ), - Stack( - children: [ + if (!Platform.isAndroid && !Platform.isIOS) TextField( autocorrect: Util.isDesktop ? false : true, enableSuggestions: Util.isDesktop ? false : true, - readOnly: true, - textInputAction: TextInputAction.none, - ), - Positioned.fill( - child: RawMaterialButton( - splashColor: Theme.of(context) - .extension()! - .highlight, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - ), - onPressed: () { - showModalBottomSheet( - backgroundColor: Colors.transparent, - context: context, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.vertical( - top: Radius.circular(20), - ), - ), - builder: (_) => - const BackupFrequencyTypeSelectSheet(), - ); - }, - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 12.0), + onTap: Platform.isAndroid || Platform.isIOS + ? null + : () async { + try { + await stackFileSystem.prepareStorage(); + + if (mounted) { + await stackFileSystem.pickDir(context); + } + + if (mounted) { + setState(() { + fileLocationController.text = + stackFileSystem.dirPath ?? ""; + }); + } + } catch (e, s) { + Logging.instance + .log("$e\n$s", level: LogLevel.Error); + } + }, + controller: fileLocationController, + style: STextStyles.field(context), + decoration: InputDecoration( + hintText: "Save to...", + hintStyle: STextStyles.fieldLabel(context), + suffixIcon: UnconstrainedBox( child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, children: [ - Text( - Format.prettyFrequencyType(ref.watch( - prefsChangeNotifierProvider.select( - (value) => - value.backupFrequencyType))), - style: - STextStyles.itemSubtitle12(context), + const SizedBox( + width: 16, ), - Padding( - padding: - const EdgeInsets.only(right: 4.0), - child: SvgPicture.asset( - Assets.svg.chevronDown, - color: Theme.of(context) - .extension()! - .textSubtitle2, - width: 12, - height: 6, - ), + SvgPicture.asset( + Assets.svg.folder, + color: Theme.of(context) + .extension()! + .textDark3, + width: 16, + height: 16, + ), + const SizedBox( + width: 12, ), ], ), ), ), - ) - ], - ), - const Spacer(), - const SizedBox( - height: 10, - ), - TextButton( - style: shouldEnableCreate - ? Theme.of(context) - .extension()! - .getPrimaryEnabledButtonStyle(context) - : Theme.of(context) - .extension()! - .getPrimaryDisabledButtonStyle(context), - onPressed: !shouldEnableCreate - ? null - : () async { - final String pathToSave = - fileLocationController.text; - final String passphrase = - passwordController.text; - final String repeatPassphrase = - passwordRepeatController.text; + key: const Key( + "createBackupSaveToFileLocationTextFieldKey", + ), + readOnly: true, + toolbarOptions: const ToolbarOptions( + copy: true, + cut: false, + paste: false, + selectAll: false, + ), + onChanged: (newValue) {}, + ), + if (!Platform.isAndroid && !Platform.isIOS) + const SizedBox( + height: 10, + ), + ClipRRect( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + child: TextField( + key: const Key("createBackupPasswordFieldKey1"), + focusNode: passwordFocusNode, + controller: passwordController, + style: STextStyles.field(context), + obscureText: hidePassword, + enableSuggestions: false, + autocorrect: false, + decoration: standardInputDecoration( + "Create passphrase", + passwordFocusNode, + context, + ).copyWith( + suffixIcon: UnconstrainedBox( + child: Row( + children: [ + const SizedBox( + width: 16, + ), + GestureDetector( + key: const Key( + "createBackupPasswordFieldShowPasswordButtonKey", + ), + onTap: () async { + setState(() { + hidePassword = !hidePassword; + }); + }, + child: SvgPicture.asset( + hidePassword + ? Assets.svg.eye + : Assets.svg.eyeSlash, + color: Theme.of(context) + .extension()! + .textDark3, + width: 16, + height: 16, + ), + ), + const SizedBox( + width: 12, + ), + ], + ), + ), + ), + onChanged: (newValue) { + if (newValue.isEmpty) { + setState(() { + passwordFeedback = ""; + }); + return; + } + final result = zxcvbn.evaluate(newValue); + String suggestionsAndTips = ""; + for (final sug + in result.feedback.suggestions!.toSet()) { + suggestionsAndTips += "$sug\n"; + } + suggestionsAndTips += result.feedback.warning!; + String feedback = + // "Password Strength: ${((result.score! / 4.0) * 100).toInt()}%\n" + suggestionsAndTips; - if (pathToSave.isEmpty) { - showFloatingFlushBar( - type: FlushBarType.warning, - message: "Directory not chosen", - context: context, - ); - return; - } - if (!(await Directory(pathToSave).exists())) { - showFloatingFlushBar( - type: FlushBarType.warning, - message: "Directory does not exist", - context: context, - ); - return; - } - if (passphrase.isEmpty) { - showFloatingFlushBar( - type: FlushBarType.warning, - message: "A passphrase is required", - context: context, - ); - return; - } - if (passphrase != repeatPassphrase) { - showFloatingFlushBar( - type: FlushBarType.warning, - message: "Passphrase does not match", - context: context, - ); - return; - } + passwordStrength = result.score! / 4; - showDialog( - context: context, - barrierDismissible: false, - builder: (_) => const StackDialog( - title: "Encrypting initial backup", - message: "This shouldn't take long", - ), + // hack fix to format back string returned from zxcvbn + if (feedback.contains("phrasesNo need")) { + feedback = feedback.replaceFirst( + "phrasesNo need", + "phrases\nNo need", ); + } - // make sure the dialog is able to be displayed for at least some time - final fut = Future.delayed( - const Duration(milliseconds: 300)); + if (feedback.endsWith("\n")) { + feedback = + feedback.substring(0, feedback.length - 2); + } - String adkString; - int adkVersion; - try { - final adk = - await compute(generateAdk, passphrase); - adkString = - Format.uint8listToString(adk.item2); - adkVersion = adk.item1; - } on Exception catch (e, s) { - String err = - getErrorMessageFromSWBException(e); - Logging.instance - .log("$err\n$s", level: LogLevel.Error); - // pop encryption progress dialog - Navigator.of(context).pop(); - showFloatingFlushBar( - type: FlushBarType.warning, - message: err, - context: context, - ); - return; - } catch (e, s) { - Logging.instance - .log("$e\n$s", level: LogLevel.Error); - // pop encryption progress dialog - Navigator.of(context).pop(); - showFloatingFlushBar( - type: FlushBarType.warning, - message: "$e", - context: context, - ); - return; - } - - await secureStore.write( - key: "auto_adk_string", value: adkString); - await secureStore.write( - key: "auto_adk_version_string", - value: adkVersion.toString()); - - final DateTime now = DateTime.now(); - final String fileToSave = - createAutoBackupFilename(pathToSave, now); - - final backup = await SWB.createStackWalletJSON( - secureStorage: secureStore, - ); - - bool result = - await SWB.encryptStackWalletWithADK( - fileToSave, - adkString, - jsonEncode(backup), - adkVersion, - ); - - // this future should already be complete unless there was an error encrypting - await Future.wait([fut]); - - if (mounted) { - // pop encryption progress dialog - Navigator.of(context).pop(); - - if (result) { - ref - .read(prefsChangeNotifierProvider) - .autoBackupLocation = pathToSave; - ref - .read(prefsChangeNotifierProvider) - .lastAutoBackup = now; - - ref - .read(prefsChangeNotifierProvider) - .isAutoBackupEnabled = true; - - await showDialog( - context: context, - barrierDismissible: false, - builder: (_) => Platform.isAndroid - ? StackOkDialog( - title: - "Stack Auto Backup enabled and saved to:", - message: fileToSave, - ) - : const StackOkDialog( - title: - "Stack Auto Backup enabled!"), - ); - if (mounted) { - passwordController.text = ""; - passwordRepeatController.text = ""; - - Navigator.of(context).popUntil( - ModalRoute.withName( - AutoBackupView.routeName)); - } - } else { - await showDialog( - context: context, - barrierDismissible: false, - builder: (_) => const StackOkDialog( - title: - "Failed to enable Auto Backup"), - ); - } - } - }, - child: Text( - "Enable Auto Backup", - style: STextStyles.button(context), + setState(() { + passwordFeedback = feedback; + }); + }, + ), ), - ), - ], + if (passwordFocusNode.hasFocus || + passwordRepeatFocusNode.hasFocus || + passwordController.text.isNotEmpty) + Padding( + padding: EdgeInsets.only( + left: 12, + right: 12, + top: passwordFeedback.isNotEmpty ? 4 : 0, + ), + child: passwordFeedback.isNotEmpty + ? Text( + passwordFeedback, + style: STextStyles.infoSmall(context), + ) + : null, + ), + if (passwordFocusNode.hasFocus || + passwordRepeatFocusNode.hasFocus || + passwordController.text.isNotEmpty) + Padding( + padding: const EdgeInsets.only( + left: 12, + right: 12, + top: 10, + ), + child: ProgressBar( + key: const Key("createStackBackUpProgressBar"), + width: + MediaQuery.of(context).size.width - 32 - 24, + height: 5, + fillColor: passwordStrength < 0.51 + ? Theme.of(context) + .extension()! + .accentColorRed + : passwordStrength < 1 + ? Theme.of(context) + .extension()! + .accentColorYellow + : Theme.of(context) + .extension()! + .accentColorGreen, + backgroundColor: Theme.of(context) + .extension()! + .buttonBackSecondary, + percent: passwordStrength < 0.25 + ? 0.03 + : passwordStrength, + ), + ), + const SizedBox( + height: 10, + ), + ClipRRect( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + child: TextField( + key: const Key("createBackupPasswordFieldKey2"), + focusNode: passwordRepeatFocusNode, + controller: passwordRepeatController, + style: STextStyles.field(context), + obscureText: hidePassword, + enableSuggestions: false, + autocorrect: false, + decoration: standardInputDecoration( + "Confirm passphrase", + passwordRepeatFocusNode, + context, + ).copyWith( + suffixIcon: UnconstrainedBox( + child: Row( + children: [ + const SizedBox( + width: 16, + ), + GestureDetector( + key: const Key( + "createBackupPasswordFieldShowPasswordButtonKey", + ), + onTap: () async { + setState(() { + hidePassword = !hidePassword; + }); + }, + child: SvgPicture.asset( + hidePassword + ? Assets.svg.eye + : Assets.svg.eyeSlash, + color: Theme.of(context) + .extension()! + .textDark3, + width: 16, + height: 16, + ), + ), + const SizedBox( + width: 12, + ), + ], + ), + ), + ), + onChanged: (newValue) { + setState(() {}); + // TODO: ? check if passwords match? + }, + ), + ), + const SizedBox( + height: 32, + ), + Text( + "Auto Backup frequency", + style: STextStyles.smallMed12(context), + ), + const SizedBox( + height: 10, + ), + Stack( + children: [ + TextField( + autocorrect: Util.isDesktop ? false : true, + enableSuggestions: Util.isDesktop ? false : true, + readOnly: true, + textInputAction: TextInputAction.none, + ), + Positioned.fill( + child: RawMaterialButton( + splashColor: Theme.of(context) + .extension()! + .highlight, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + onPressed: () { + showModalBottomSheet( + backgroundColor: Colors.transparent, + context: context, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.vertical( + top: Radius.circular(20), + ), + ), + builder: (_) => + const BackupFrequencyTypeSelectSheet(), + ); + }, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 12.0, + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + Format.prettyFrequencyType( + ref.watch( + prefsChangeNotifierProvider.select( + (value) => + value.backupFrequencyType, + ), + ), + ), + style: + STextStyles.itemSubtitle12(context), + ), + Padding( + padding: + const EdgeInsets.only(right: 4.0), + child: SvgPicture.asset( + Assets.svg.chevronDown, + color: Theme.of(context) + .extension()! + .textSubtitle2, + width: 12, + height: 6, + ), + ), + ], + ), + ), + ), + ), + ], + ), + const Spacer(), + const SizedBox( + height: 10, + ), + TextButton( + style: shouldEnableCreate + ? Theme.of(context) + .extension()! + .getPrimaryEnabledButtonStyle(context) + : Theme.of(context) + .extension()! + .getPrimaryDisabledButtonStyle(context), + onPressed: !shouldEnableCreate + ? null + : () async { + final String pathToSave = + fileLocationController.text; + final String passphrase = + passwordController.text; + final String repeatPassphrase = + passwordRepeatController.text; + + if (pathToSave.isEmpty) { + showFloatingFlushBar( + type: FlushBarType.warning, + message: "Directory not chosen", + context: context, + ); + return; + } + if (!(await Directory(pathToSave).exists())) { + showFloatingFlushBar( + type: FlushBarType.warning, + message: "Directory does not exist", + context: context, + ); + return; + } + if (passphrase.isEmpty) { + showFloatingFlushBar( + type: FlushBarType.warning, + message: "A passphrase is required", + context: context, + ); + return; + } + if (passphrase != repeatPassphrase) { + showFloatingFlushBar( + type: FlushBarType.warning, + message: "Passphrase does not match", + context: context, + ); + return; + } + + showDialog( + context: context, + barrierDismissible: false, + builder: (_) => const StackDialog( + title: "Encrypting initial backup", + message: "This shouldn't take long", + ), + ); + + // make sure the dialog is able to be displayed for at least some time + final fut = Future.delayed( + const Duration(milliseconds: 300), + ); + + String adkString; + int adkVersion; + try { + final adk = + await compute(generateAdk, passphrase); + adkString = + Format.uint8listToString(adk.item2); + adkVersion = adk.item1; + } on Exception catch (e, s) { + final String err = + getErrorMessageFromSWBException(e); + Logging.instance + .log("$err\n$s", level: LogLevel.Error); + // pop encryption progress dialog + Navigator.of(context).pop(); + showFloatingFlushBar( + type: FlushBarType.warning, + message: err, + context: context, + ); + return; + } catch (e, s) { + Logging.instance + .log("$e\n$s", level: LogLevel.Error); + // pop encryption progress dialog + Navigator.of(context).pop(); + showFloatingFlushBar( + type: FlushBarType.warning, + message: "$e", + context: context, + ); + return; + } + + await secureStore.write( + key: "auto_adk_string", + value: adkString, + ); + await secureStore.write( + key: "auto_adk_version_string", + value: adkVersion.toString(), + ); + + final DateTime now = DateTime.now(); + final String fileToSave = + createAutoBackupFilename(pathToSave, now); + + final backup = + await SWB.createStackWalletJSON( + secureStorage: secureStore, + ); + + final bool result = + await SWB.encryptStackWalletWithADK( + fileToSave, + adkString, + jsonEncode(backup), + adkVersion, + ); + + // this future should already be complete unless there was an error encrypting + await Future.wait([fut]); + + if (mounted) { + // pop encryption progress dialog + Navigator.of(context).pop(); + + if (result) { + ref + .read(prefsChangeNotifierProvider) + .autoBackupLocation = pathToSave; + ref + .read(prefsChangeNotifierProvider) + .lastAutoBackup = now; + + ref + .read(prefsChangeNotifierProvider) + .isAutoBackupEnabled = true; + + await showDialog( + context: context, + barrierDismissible: false, + builder: (_) => Platform.isAndroid + ? StackOkDialog( + title: + "Stack Auto Backup enabled and saved to:", + message: fileToSave, + ) + : const StackOkDialog( + title: + "Stack Auto Backup enabled!", + ), + ); + if (mounted) { + passwordController.text = ""; + passwordRepeatController.text = ""; + + Navigator.of(context).popUntil( + ModalRoute.withName( + AutoBackupView.routeName, + ), + ); + } + } else { + await showDialog( + context: context, + barrierDismissible: false, + builder: (_) => const StackOkDialog( + title: "Failed to enable Auto Backup", + ), + ); + } + } + }, + child: Text( + "Enable Auto Backup", + style: STextStyles.button(context), + ), + ), + ], + ), ), ), - ), - ); - }), + ); + }, + ), ), ), ); diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/create_backup_information_view.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/create_backup_information_view.dart index ebdf2cac3..8b1c72ebd 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/create_backup_information_view.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/create_backup_information_view.dart @@ -17,7 +17,7 @@ import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../widgets/rounded_white_container.dart'; class CreateBackupInfoView extends StatelessWidget { - const CreateBackupInfoView({Key? key}) : super(key: key); + const CreateBackupInfoView({super.key}); static const String routeName = "/createBackupInfo"; diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/create_backup_view.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/create_backup_view.dart index 118e128e8..e762d9f5b 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/create_backup_view.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/create_backup_view.dart @@ -15,9 +15,9 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:zxcvbn/zxcvbn.dart'; + import '../../../../notifications/show_flush_bar.dart'; -import 'helpers/restore_create_backup.dart'; -import 'helpers/swb_file_system.dart'; import '../../../../providers/global/secure_store_provider.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; @@ -34,10 +34,11 @@ import '../../../../widgets/desktop/secondary_button.dart'; import '../../../../widgets/progress_bar.dart'; import '../../../../widgets/stack_dialog.dart'; import '../../../../widgets/stack_text_field.dart'; -import 'package:zxcvbn/zxcvbn.dart'; +import 'helpers/restore_create_backup.dart'; +import 'helpers/swb_file_system.dart'; class CreateBackupView extends StatefulWidget { - const CreateBackupView({Key? key}) : super(key: key); + const CreateBackupView({super.key}); static const String routeName = "/createBackup"; @@ -123,7 +124,8 @@ class _RestoreFromFileViewState extends State { if (FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( - const Duration(milliseconds: 75)); + const Duration(milliseconds: 75), + ); } if (mounted) { Navigator.of(context).pop(); @@ -165,11 +167,11 @@ class _RestoreFromFileViewState extends State { padding: const EdgeInsets.only(bottom: 10), child: Text( "Choose file location", - style: STextStyles.desktopTextExtraExtraSmall(context) - .copyWith( - color: Theme.of(context) - .extension()! - .textDark3), + style: + STextStyles.desktopTextExtraExtraSmall(context).copyWith( + color: + Theme.of(context).extension()!.textDark3, + ), ), ), child, @@ -180,74 +182,76 @@ class _RestoreFromFileViewState extends State { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ if (!Platform.isAndroid && !Platform.isIOS) - Consumer(builder: (context, ref, __) { - return Container( - color: Colors.transparent, - child: TextField( - autocorrect: Util.isDesktop ? false : true, - enableSuggestions: Util.isDesktop ? false : true, - onTap: Platform.isAndroid || Platform.isIOS - ? null - : () async { - try { - await stackFileSystem.prepareStorage(); + Consumer( + builder: (context, ref, __) { + return Container( + color: Colors.transparent, + child: TextField( + autocorrect: Util.isDesktop ? false : true, + enableSuggestions: Util.isDesktop ? false : true, + onTap: Platform.isAndroid || Platform.isIOS + ? null + : () async { + try { + await stackFileSystem.prepareStorage(); - if (mounted) { - await stackFileSystem.pickDir(context); - } + if (mounted) { + await stackFileSystem.pickDir(context); + } - if (mounted) { - setState(() { - fileLocationController.text = - stackFileSystem.dirPath ?? ""; - }); + if (mounted) { + setState(() { + fileLocationController.text = + stackFileSystem.dirPath ?? ""; + }); + } + } catch (e, s) { + Logging.instance + .log("$e\n$s", level: LogLevel.Error); } - } catch (e, s) { - Logging.instance - .log("$e\n$s", level: LogLevel.Error); - } - }, - controller: fileLocationController, - style: STextStyles.field(context), - decoration: InputDecoration( - hintText: "Save to...", - hintStyle: STextStyles.fieldLabel(context), - suffixIcon: UnconstrainedBox( - child: Row( - children: [ - const SizedBox( - width: 16, - ), - SvgPicture.asset( - Assets.svg.folder, - color: Theme.of(context) - .extension()! - .textDark3, - width: 16, - height: 16, - ), - const SizedBox( - width: 12, - ), - ], + }, + controller: fileLocationController, + style: STextStyles.field(context), + decoration: InputDecoration( + hintText: "Save to...", + hintStyle: STextStyles.fieldLabel(context), + suffixIcon: UnconstrainedBox( + child: Row( + children: [ + const SizedBox( + width: 16, + ), + SvgPicture.asset( + Assets.svg.folder, + color: Theme.of(context) + .extension()! + .textDark3, + width: 16, + height: 16, + ), + const SizedBox( + width: 12, + ), + ], + ), ), ), + key: const Key( + "createBackupSaveToFileLocationTextFieldKey"), + readOnly: true, + toolbarOptions: const ToolbarOptions( + copy: true, + cut: false, + paste: false, + selectAll: false, + ), + onChanged: (newValue) { + // ref.read(addressEntryDataProvider(widget.id)).address = newValue; + }, ), - key: - const Key("createBackupSaveToFileLocationTextFieldKey"), - readOnly: true, - toolbarOptions: const ToolbarOptions( - copy: true, - cut: false, - paste: false, - selectAll: false, - ), - onChanged: (newValue) { - // ref.read(addressEntryDataProvider(widget.id)).address = newValue; - }, - ), - ); - }), + ); + }, + ), if (!Platform.isAndroid && !Platform.isIOS) SizedBox( height: !isDesktop ? 8 : 24, @@ -257,11 +261,11 @@ class _RestoreFromFileViewState extends State { padding: const EdgeInsets.only(bottom: 10.0), child: Text( "Create a passphrase", - style: STextStyles.desktopTextExtraExtraSmall(context) - .copyWith( - color: Theme.of(context) - .extension()! - .textDark3), + style: + STextStyles.desktopTextExtraExtraSmall(context).copyWith( + color: + Theme.of(context).extension()!.textDark3, + ), textAlign: TextAlign.left, ), ), @@ -292,7 +296,8 @@ class _RestoreFromFileViewState extends State { ), GestureDetector( key: const Key( - "createBackupPasswordFieldShowPasswordButtonKey"), + "createBackupPasswordFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; @@ -323,7 +328,7 @@ class _RestoreFromFileViewState extends State { } final result = zxcvbn.evaluate(newValue); String suggestionsAndTips = ""; - for (var sug in result.feedback.suggestions!.toSet()) { + for (final sug in result.feedback.suggestions!.toSet()) { suggestionsAndTips += "$sug\n"; } suggestionsAndTips += result.feedback.warning!; @@ -336,7 +341,9 @@ class _RestoreFromFileViewState extends State { // hack fix to format back string returned from zxcvbn if (feedback.contains("phrasesNo need")) { feedback = feedback.replaceFirst( - "phrasesNo need", "phrases\nNo need"); + "phrasesNo need", + "phrases\nNo need", + ); } if (feedback.endsWith("\n")) { @@ -425,7 +432,8 @@ class _RestoreFromFileViewState extends State { ), GestureDetector( key: const Key( - "createBackupPasswordFieldShowPasswordButtonKey"), + "createBackupPasswordFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; @@ -458,247 +466,284 @@ class _RestoreFromFileViewState extends State { ), if (!isDesktop) const Spacer(), !isDesktop - ? Consumer(builder: (context, ref, __) { - return TextButton( - style: shouldEnableCreate - ? Theme.of(context) - .extension()! - .getPrimaryEnabledButtonStyle(context) - : Theme.of(context) - .extension()! - .getPrimaryDisabledButtonStyle(context), - onPressed: !shouldEnableCreate - ? null - : () async { - final String pathToSave = - fileLocationController.text; - final String passphrase = passwordController.text; - final String repeatPassphrase = - passwordRepeatController.text; + ? Consumer( + builder: (context, ref, __) { + return TextButton( + style: shouldEnableCreate + ? Theme.of(context) + .extension()! + .getPrimaryEnabledButtonStyle(context) + : Theme.of(context) + .extension()! + .getPrimaryDisabledButtonStyle(context), + onPressed: !shouldEnableCreate + ? null + : () async { + final String pathToSave = + fileLocationController.text; + final String passphrase = + passwordController.text; + final String repeatPassphrase = + passwordRepeatController.text; - if (pathToSave.isEmpty) { - unawaited(showFloatingFlushBar( - type: FlushBarType.warning, - message: "Directory not chosen", - context: context, - )); - return; - } - if (!(await Directory(pathToSave).exists())) { - unawaited(showFloatingFlushBar( - type: FlushBarType.warning, - message: "Directory does not exist", - context: context, - )); - return; - } - if (passphrase.isEmpty) { - unawaited(showFloatingFlushBar( - type: FlushBarType.warning, - message: "A passphrase is required", - context: context, - )); - return; - } - if (passphrase != repeatPassphrase) { - unawaited(showFloatingFlushBar( - type: FlushBarType.warning, - message: "Passphrase does not match", - context: context, - )); - return; - } - - unawaited(showDialog( - context: context, - barrierDismissible: false, - builder: (_) => const StackDialog( - title: "Encrypting backup", - message: "This shouldn't take long", - ), - )); - // make sure the dialog is able to be displayed for at least 1 second - await Future.delayed( - const Duration(seconds: 1)); - - final DateTime now = DateTime.now(); - final String fileToSave = - "$pathToSave/stackbackup_${now.year}_${now.month}_${now.day}_${now.hour}_${now.minute}_${now.second}.swb"; - - final backup = await SWB.createStackWalletJSON( - secureStorage: ref.read(secureStoreProvider)); - - bool result = - await SWB.encryptStackWalletWithPassphrase( - fileToSave, - passphrase, - jsonEncode(backup), - ); - - if (mounted) { - // pop encryption progress dialog - if (!isDesktop) Navigator.of(context).pop(); - - if (result) { - await showDialog( - context: context, - barrierDismissible: false, - builder: (_) => Platform.isAndroid - ? StackOkDialog( - title: "Backup saved to:", - message: fileToSave, - ) - : const StackOkDialog( - title: "Backup creation succeeded"), - ); - passwordController.text = ""; - passwordRepeatController.text = ""; - setState(() {}); - } else { - await showDialog( - context: context, - barrierDismissible: false, - builder: (_) => const StackOkDialog( - title: "Backup creation failed"), - ); - } - } - }, - child: Text( - "Create backup", - style: STextStyles.button(context), - ), - ); - }) - : Row( - children: [ - Consumer(builder: (context, ref, __) { - return PrimaryButton( - width: 183, - buttonHeight: ButtonHeight.m, - label: "Create backup", - enabled: shouldEnableCreate, - onPressed: !shouldEnableCreate - ? null - : () async { - final String pathToSave = - fileLocationController.text; - final String passphrase = - passwordController.text; - final String repeatPassphrase = - passwordRepeatController.text; - - if (pathToSave.isEmpty) { - unawaited(showFloatingFlushBar( + if (pathToSave.isEmpty) { + unawaited( + showFloatingFlushBar( type: FlushBarType.warning, message: "Directory not chosen", context: context, - )); - return; - } - if (!(await Directory(pathToSave).exists())) { - unawaited(showFloatingFlushBar( + ), + ); + return; + } + if (!(await Directory(pathToSave).exists())) { + unawaited( + showFloatingFlushBar( type: FlushBarType.warning, message: "Directory does not exist", context: context, - )); - return; - } - if (passphrase.isEmpty) { - unawaited(showFloatingFlushBar( + ), + ); + return; + } + if (passphrase.isEmpty) { + unawaited( + showFloatingFlushBar( type: FlushBarType.warning, message: "A passphrase is required", context: context, - )); - return; - } - if (passphrase != repeatPassphrase) { - unawaited(showFloatingFlushBar( + ), + ); + return; + } + if (passphrase != repeatPassphrase) { + unawaited( + showFloatingFlushBar( type: FlushBarType.warning, message: "Passphrase does not match", context: context, - )); - return; - } - - unawaited( - showDialog( - context: context, - barrierDismissible: false, - builder: (_) { - if (Util.isDesktop) { - return DesktopDialog( - maxHeight: double.infinity, - maxWidth: 450, - child: Padding( - padding: const EdgeInsets.all( - 32, - ), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - "Encrypting initial backup", - style: - STextStyles.desktopH3( - context), - ), - const SizedBox( - height: 40, - ), - Text( - "This shouldn't take long", - style: STextStyles - .desktopTextExtraExtraSmall( - context), - ), - ], - ), - ), - ); - } else { - return const StackDialog( - title: "Encrypting initial backup", - message: "This shouldn't take long", - ); - } - }, ), ); + return; + } - await Future.delayed( - const Duration(seconds: 1)); + unawaited( + showDialog( + context: context, + barrierDismissible: false, + builder: (_) => const StackDialog( + title: "Encrypting backup", + message: "This shouldn't take long", + ), + ), + ); + // make sure the dialog is able to be displayed for at least 1 second + await Future.delayed( + const Duration(seconds: 1), + ); - // make sure the dialog is able to be displayed for at least 1 second - final fut = Future.delayed( - const Duration(seconds: 1)); + final DateTime now = DateTime.now(); + final String fileToSave = + "$pathToSave/stackbackup_${now.year}_${now.month}_${now.day}_${now.hour}_${now.minute}_${now.second}.swb"; - final DateTime now = DateTime.now(); - final String fileToSave = - "$pathToSave/stackbackup_${now.year}_${now.month}_${now.day}_${now.hour}_${now.minute}_${now.second}.swb"; + final backup = await SWB.createStackWalletJSON( + secureStorage: ref.read(secureStoreProvider), + ); - final backup = - await SWB.createStackWalletJSON( - secureStorage: - ref.read(secureStoreProvider)); + final bool result = + await SWB.encryptStackWalletWithPassphrase( + fileToSave, + passphrase, + jsonEncode(backup), + ); - bool result = await SWB - .encryptStackWalletWithPassphrase( - fileToSave, - passphrase, - jsonEncode(backup), - ); + if (mounted) { + // pop encryption progress dialog + if (!isDesktop) Navigator.of(context).pop(); - await Future.wait([fut]); + if (result) { + await showDialog( + context: context, + barrierDismissible: false, + builder: (_) => Platform.isAndroid + ? StackOkDialog( + title: "Backup saved to:", + message: fileToSave, + ) + : const StackOkDialog( + title: + "Backup creation succeeded", + ), + ); + passwordController.text = ""; + passwordRepeatController.text = ""; + setState(() {}); + } else { + await showDialog( + context: context, + barrierDismissible: false, + builder: (_) => const StackOkDialog( + title: "Backup creation failed", + ), + ); + } + } + }, + child: Text( + "Create backup", + style: STextStyles.button(context), + ), + ); + }, + ) + : Row( + children: [ + Consumer( + builder: (context, ref, __) { + return PrimaryButton( + width: 183, + buttonHeight: ButtonHeight.m, + label: "Create backup", + enabled: shouldEnableCreate, + onPressed: !shouldEnableCreate + ? null + : () async { + final String pathToSave = + fileLocationController.text; + final String passphrase = + passwordController.text; + final String repeatPassphrase = + passwordRepeatController.text; - if (mounted) { - // pop encryption progress dialog - if (!isDesktop) Navigator.of(context).pop(); + if (pathToSave.isEmpty) { + unawaited( + showFloatingFlushBar( + type: FlushBarType.warning, + message: "Directory not chosen", + context: context, + ), + ); + return; + } + if (!(await Directory(pathToSave) + .exists())) { + unawaited( + showFloatingFlushBar( + type: FlushBarType.warning, + message: "Directory does not exist", + context: context, + ), + ); + return; + } + if (passphrase.isEmpty) { + unawaited( + showFloatingFlushBar( + type: FlushBarType.warning, + message: "A passphrase is required", + context: context, + ), + ); + return; + } + if (passphrase != repeatPassphrase) { + unawaited( + showFloatingFlushBar( + type: FlushBarType.warning, + message: "Passphrase does not match", + context: context, + ), + ); + return; + } - if (result) { - await showDialog( + unawaited( + showDialog( + context: context, + barrierDismissible: false, + builder: (_) { + if (Util.isDesktop) { + return DesktopDialog( + maxHeight: double.infinity, + maxWidth: 450, + child: Padding( + padding: const EdgeInsets.all( + 32, + ), + child: Column( + mainAxisSize: + MainAxisSize.min, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + "Encrypting initial backup", + style: + STextStyles.desktopH3( + context, + ), + ), + const SizedBox( + height: 40, + ), + Text( + "This shouldn't take long", + style: STextStyles + .desktopTextExtraExtraSmall( + context, + ), + ), + ], + ), + ), + ); + } else { + return const StackDialog( + title: + "Encrypting initial backup", + message: + "This shouldn't take long", + ); + } + }, + ), + ); + + await Future.delayed( + const Duration(seconds: 1), + ); + + // make sure the dialog is able to be displayed for at least 1 second + final fut = Future.delayed( + const Duration(seconds: 1), + ); + + final DateTime now = DateTime.now(); + final String fileToSave = + "$pathToSave/stackbackup_${now.year}_${now.month}_${now.day}_${now.hour}_${now.minute}_${now.second}.swb"; + + final backup = + await SWB.createStackWalletJSON( + secureStorage: + ref.read(secureStoreProvider), + ); + + final bool result = await SWB + .encryptStackWalletWithPassphrase( + fileToSave, + passphrase, + jsonEncode(backup), + ); + + await Future.wait([fut]); + + if (mounted) { + // pop encryption progress dialog + if (!isDesktop) + Navigator.of(context).pop(); + + if (result) { + await showDialog( context: context, barrierDismissible: false, builder: (context) { @@ -726,7 +771,8 @@ class _RestoreFromFileViewState extends State { .start, children: [ const SizedBox( - height: 26), + height: 26, + ), Text( "Stack backup saved to: \n", style: STextStyles @@ -736,7 +782,8 @@ class _RestoreFromFileViewState extends State { fileToSave, style: STextStyles .desktopTextExtraExtraSmall( - context), + context, + ), ), const SizedBox( height: 40, @@ -754,40 +801,46 @@ class _RestoreFromFileViewState extends State { onPressed: () { int count = 0; Navigator.of( - context) - .popUntil((_) => - count++ >= - 2); + context, + ).popUntil( + (_) => + count++ >= + 2, + ); }, ), ), ], - ) + ), ], ), ), ); } else { return const StackOkDialog( - title: - "Backup creation succeeded"); + title: + "Backup creation succeeded", + ); } - }); - passwordController.text = ""; - passwordRepeatController.text = ""; - setState(() {}); - } else { - await showDialog( - context: context, - barrierDismissible: false, - builder: (_) => const StackOkDialog( - title: "Backup creation failed"), - ); + }, + ); + passwordController.text = ""; + passwordRepeatController.text = ""; + setState(() {}); + } else { + await showDialog( + context: context, + barrierDismissible: false, + builder: (_) => const StackOkDialog( + title: "Backup creation failed", + ), + ); + } } - } - }, - ); - }), + }, + ); + }, + ), const SizedBox( width: 16, ), diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/dialogs/cancel_stack_restore_dialog.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/dialogs/cancel_stack_restore_dialog.dart index 17c24aed0..f48c0017c 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/dialogs/cancel_stack_restore_dialog.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/dialogs/cancel_stack_restore_dialog.dart @@ -9,6 +9,7 @@ */ import 'package:flutter/material.dart'; + import '../../../../../themes/stack_colors.dart'; import '../../../../../utilities/text_styles.dart'; import '../../../../../utilities/util.dart'; @@ -20,8 +21,8 @@ import '../../../../../widgets/stack_dialog.dart'; class CancelStackRestoreDialog extends StatelessWidget { const CancelStackRestoreDialog({ - Key? key, - }) : super(key: key); + super.key, + }); @override Widget build(BuildContext context) { @@ -68,7 +69,11 @@ class CancelStackRestoreDialog extends StatelessWidget { maxWidth: 600, child: Padding( padding: const EdgeInsets.only( - top: 20, left: 32, right: 32, bottom: 20), + top: 20, + left: 32, + right: 32, + bottom: 20, + ), child: Column( children: [ Text( @@ -111,7 +116,7 @@ class CancelStackRestoreDialog extends StatelessWidget { onPressed: () { Navigator.of(context).pop(true); }, - ) + ), ], ), ], diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/edit_auto_backup_view.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/edit_auto_backup_view.dart index 107cefb70..5d495b3d9 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/edit_auto_backup_view.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/edit_auto_backup_view.dart @@ -18,11 +18,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stack_wallet_backup/stack_wallet_backup.dart'; +import 'package:zxcvbn/zxcvbn.dart'; + import '../../../../notifications/show_flush_bar.dart'; -import 'auto_backup_view.dart'; -import 'helpers/restore_create_backup.dart'; -import 'helpers/swb_file_system.dart'; -import 'sub_views/backup_frequency_type_select_sheet.dart'; import '../../../../providers/global/prefs_provider.dart'; import '../../../../providers/global/secure_store_provider.dart'; import '../../../../themes/stack_colors.dart'; @@ -42,12 +40,15 @@ import '../../../../widgets/desktop/secondary_button.dart'; import '../../../../widgets/progress_bar.dart'; import '../../../../widgets/stack_dialog.dart'; import '../../../../widgets/stack_text_field.dart'; -import 'package:zxcvbn/zxcvbn.dart'; +import 'auto_backup_view.dart'; +import 'helpers/restore_create_backup.dart'; +import 'helpers/swb_file_system.dart'; +import 'sub_views/backup_frequency_type_select_sheet.dart'; class EditAutoBackupView extends ConsumerStatefulWidget { const EditAutoBackupView({ - Key? key, - }) : super(key: key); + super.key, + }); static const String routeName = "/editAutoBackup"; @@ -156,7 +157,7 @@ class _EditAutoBackupViewState extends ConsumerState { adkString = Format.uint8listToString(adk.item2); adkVersion = adk.item1; } on Exception catch (e, s) { - String err = getErrorMessageFromSWBException(e); + final String err = getErrorMessageFromSWBException(e); Logging.instance.log("$err\n$s", level: LogLevel.Error); // pop encryption progress dialog Navigator.of(context).pop(); @@ -184,7 +185,9 @@ class _EditAutoBackupViewState extends ConsumerState { await secureStore.write(key: "auto_adk_string", value: adkString); await secureStore.write( - key: "auto_adk_version_string", value: adkVersion.toString()); + key: "auto_adk_version_string", + value: adkVersion.toString(), + ); final DateTime now = DateTime.now(); final String fileToSave = createAutoBackupFilename(pathToSave, now); @@ -193,7 +196,7 @@ class _EditAutoBackupViewState extends ConsumerState { secureStorage: ref.read(secureStoreProvider), ); - bool result = await SWB.encryptStackWalletWithADK( + final bool result = await SWB.encryptStackWalletWithADK( fileToSave, adkString, jsonEncode(backup), @@ -311,18 +314,20 @@ class _EditAutoBackupViewState extends ConsumerState { ), body: Padding( padding: const EdgeInsets.all(16), - child: LayoutBuilder(builder: (context, constraints) { - return SingleChildScrollView( - child: ConstrainedBox( - constraints: BoxConstraints( - minHeight: constraints.maxHeight, + child: LayoutBuilder( + builder: (context, constraints) { + return SingleChildScrollView( + child: ConstrainedBox( + constraints: BoxConstraints( + minHeight: constraints.maxHeight, + ), + child: IntrinsicHeight( + child: child, + ), ), - child: IntrinsicHeight( - child: child, - ), - ), - ); - }), + ); + }, + ), ), ), ), @@ -448,7 +453,8 @@ class _EditAutoBackupViewState extends ConsumerState { ), GestureDetector( key: const Key( - "createBackupPasswordFieldShowPasswordButtonKey"), + "createBackupPasswordFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; @@ -479,7 +485,7 @@ class _EditAutoBackupViewState extends ConsumerState { } final result = zxcvbn.evaluate(newValue); String suggestionsAndTips = ""; - for (var sug in result.feedback.suggestions!.toSet()) { + for (final sug in result.feedback.suggestions!.toSet()) { suggestionsAndTips += "$sug\n"; } suggestionsAndTips += result.feedback.warning!; @@ -492,7 +498,9 @@ class _EditAutoBackupViewState extends ConsumerState { // hack fix to format back string returned from zxcvbn if (feedback.contains("phrasesNo need")) { feedback = feedback.replaceFirst( - "phrasesNo need", "phrases\nNo need"); + "phrasesNo need", + "phrases\nNo need", + ); } if (feedback.endsWith("\n")) { @@ -580,7 +588,8 @@ class _EditAutoBackupViewState extends ConsumerState { ), GestureDetector( key: const Key( - "createBackupPasswordFieldShowPasswordButtonKey"), + "createBackupPasswordFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; @@ -735,9 +744,13 @@ class _EditAutoBackupViewState extends ConsumerState { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - Format.prettyFrequencyType(ref.watch( + Format.prettyFrequencyType( + ref.watch( prefsChangeNotifierProvider.select( - (value) => value.backupFrequencyType))), + (value) => value.backupFrequencyType, + ), + ), + ), style: STextStyles.itemSubtitle12(context), ), Padding( @@ -755,7 +768,7 @@ class _EditAutoBackupViewState extends ConsumerState { ), ), ), - ) + ), ], ), if (!isDesktop) const Spacer(), @@ -799,7 +812,7 @@ class _EditAutoBackupViewState extends ConsumerState { "Save", style: STextStyles.button(context), ), - ) + ), ], ), ); diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/restore_from_encrypted_string_view.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/restore_from_encrypted_string_view.dart index 3bbb3cd5e..881319202 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/restore_from_encrypted_string_view.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/restore_from_encrypted_string_view.dart @@ -12,10 +12,9 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:tuple/tuple.dart'; + import '../../../../notifications/show_flush_bar.dart'; -import '../../../home_view/home_view.dart'; -import 'helpers/restore_create_backup.dart'; -import 'sub_views/stack_restore_progress_view.dart'; import '../../../../route_generator.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; @@ -25,13 +24,15 @@ import '../../../../widgets/background.dart'; import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../widgets/loading_indicator.dart'; import '../../../../widgets/stack_text_field.dart'; -import 'package:tuple/tuple.dart'; +import '../../../home_view/home_view.dart'; +import 'helpers/restore_create_backup.dart'; +import 'sub_views/stack_restore_progress_view.dart'; class RestoreFromEncryptedStringView extends ConsumerStatefulWidget { const RestoreFromEncryptedStringView({ - Key? key, + super.key, required this.encrypted, - }) : super(key: key); + }); static const String routeName = "/restoreFromEncryptedString"; @@ -131,7 +132,8 @@ class _RestoreFromEncryptedStringViewState ), GestureDetector( key: const Key( - "restoreFromFilePasswordFieldShowPasswordButtonKey"), + "restoreFromFilePasswordFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; @@ -181,7 +183,8 @@ class _RestoreFromEncryptedStringViewState if (FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( - const Duration(milliseconds: 75)); + const Duration(milliseconds: 75), + ); } bool shouldPop = false; @@ -205,8 +208,8 @@ class _RestoreFromEncryptedStringViewState "Decrypting Stack backup file", style: STextStyles.pageTitleH2( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension< StackColors>()! diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/restore_from_file_view.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/restore_from_file_view.dart index 5a609acb4..0f9cc5b39 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/restore_from_file_view.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/restore_from_file_view.dart @@ -15,11 +15,10 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:tuple/tuple.dart'; + import '../../../../app_config.dart'; import '../../../../notifications/show_flush_bar.dart'; -import 'helpers/restore_create_backup.dart'; -import 'helpers/swb_file_system.dart'; -import 'sub_views/stack_restore_progress_view.dart'; import '../../../../route_generator.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; @@ -36,10 +35,12 @@ import '../../../../widgets/desktop/primary_button.dart'; import '../../../../widgets/desktop/secondary_button.dart'; import '../../../../widgets/loading_indicator.dart'; import '../../../../widgets/stack_text_field.dart'; -import 'package:tuple/tuple.dart'; +import 'helpers/restore_create_backup.dart'; +import 'helpers/swb_file_system.dart'; +import 'sub_views/stack_restore_progress_view.dart'; class RestoreFromFileView extends ConsumerStatefulWidget { - const RestoreFromFileView({Key? key}) : super(key: key); + const RestoreFromFileView({super.key}); static const String routeName = "/restoreFromFile"; @@ -84,113 +85,190 @@ class _RestoreFromFileViewState extends ConsumerState { final isDesktop = Util.isDesktop; return ConditionalParent( - condition: !isDesktop, - builder: (child) { - return Background( - child: Scaffold( - backgroundColor: - Theme.of(context).extension()!.background, - appBar: AppBar( - leading: AppBarBackButton( - onPressed: () async { - if (FocusScope.of(context).hasFocus) { - FocusScope.of(context).unfocus(); - await Future.delayed( - const Duration(milliseconds: 75)); - } - if (mounted) { - Navigator.of(context).pop(); - } - }, - ), - title: Text( - "Restore from file", - style: STextStyles.navBarTitle(context), - ), - ), - body: Padding( - padding: const EdgeInsets.all(16), - child: LayoutBuilder( - builder: (context, constraints) { - return SingleChildScrollView( - child: ConstrainedBox( - constraints: BoxConstraints( - minHeight: constraints.maxHeight, - ), - child: IntrinsicHeight( - child: child, - ), - ), + condition: !isDesktop, + builder: (child) { + return Background( + child: Scaffold( + backgroundColor: + Theme.of(context).extension()!.background, + appBar: AppBar( + leading: AppBarBackButton( + onPressed: () async { + if (FocusScope.of(context).hasFocus) { + FocusScope.of(context).unfocus(); + await Future.delayed( + const Duration(milliseconds: 75), ); - }, - ), - ), - ), - ); - }, - child: ConditionalParent( - condition: isDesktop, - builder: (child) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.only(bottom: 10.0), - child: Text( - "Choose file location", - style: STextStyles.desktopTextExtraExtraSmall(context) - .copyWith( - color: Theme.of(context) - .extension()! - .textDark3), - textAlign: TextAlign.left, - ), - ), - child, - ], - ); - }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - TextField( - autocorrect: Util.isDesktop ? false : true, - enableSuggestions: Util.isDesktop ? false : true, - onTap: () async { - try { - await stackFileSystem.prepareStorage(); - if (mounted) { - await stackFileSystem.openFile(context); - } - - if (mounted) { - setState(() { - fileLocationController.text = - stackFileSystem.filePath ?? ""; - }); - } - } catch (e, s) { - Logging.instance.log("$e\n$s", level: LogLevel.Error); + } + if (mounted) { + Navigator.of(context).pop(); } }, - controller: fileLocationController, + ), + title: Text( + "Restore from file", + style: STextStyles.navBarTitle(context), + ), + ), + body: Padding( + padding: const EdgeInsets.all(16), + child: LayoutBuilder( + builder: (context, constraints) { + return SingleChildScrollView( + child: ConstrainedBox( + constraints: BoxConstraints( + minHeight: constraints.maxHeight, + ), + child: IntrinsicHeight( + child: child, + ), + ), + ); + }, + ), + ), + ), + ); + }, + child: ConditionalParent( + condition: isDesktop, + builder: (child) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 10.0), + child: Text( + "Choose file location", + style: + STextStyles.desktopTextExtraExtraSmall(context).copyWith( + color: + Theme.of(context).extension()!.textDark3, + ), + textAlign: TextAlign.left, + ), + ), + child, + ], + ); + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + TextField( + autocorrect: Util.isDesktop ? false : true, + enableSuggestions: Util.isDesktop ? false : true, + onTap: () async { + try { + await stackFileSystem.prepareStorage(); + if (mounted) { + await stackFileSystem.openFile(context); + } + + if (mounted) { + setState(() { + fileLocationController.text = + stackFileSystem.filePath ?? ""; + }); + } + } catch (e, s) { + Logging.instance.log("$e\n$s", level: LogLevel.Error); + } + }, + controller: fileLocationController, + style: STextStyles.field(context), + decoration: InputDecoration( + hintText: "Choose file...", + hintStyle: STextStyles.fieldLabel(context), + suffixIcon: UnconstrainedBox( + child: Row( + children: [ + const SizedBox( + width: 16, + ), + SvgPicture.asset( + Assets.svg.folder, + color: Theme.of(context) + .extension()! + .textDark3, + width: 16, + height: 16, + ), + const SizedBox( + width: 12, + ), + ], + ), + ), + ), + key: const Key("restoreFromFileLocationTextFieldKey"), + readOnly: true, + toolbarOptions: const ToolbarOptions( + copy: true, + cut: false, + paste: false, + selectAll: false, + ), + onChanged: (newValue) {}, + ), + SizedBox( + height: !isDesktop ? 8 : 24, + ), + if (isDesktop) + Padding( + padding: const EdgeInsets.only(bottom: 10.0), + child: Text( + "Enter passphrase", + style: + STextStyles.desktopTextExtraExtraSmall(context).copyWith( + color: + Theme.of(context).extension()!.textDark3, + ), + textAlign: TextAlign.left, + ), + ), + ClipRRect( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + child: TextField( + key: const Key("restoreFromFilePasswordFieldKey"), + focusNode: passwordFocusNode, + controller: passwordController, style: STextStyles.field(context), - decoration: InputDecoration( - hintText: "Choose file...", - hintStyle: STextStyles.fieldLabel(context), + obscureText: hidePassword, + enableSuggestions: false, + autocorrect: false, + decoration: standardInputDecoration( + "Enter passphrase", + passwordFocusNode, + context, + ).copyWith( + labelStyle: + isDesktop ? STextStyles.fieldLabel(context) : null, suffixIcon: UnconstrainedBox( child: Row( children: [ const SizedBox( width: 16, ), - SvgPicture.asset( - Assets.svg.folder, - color: Theme.of(context) - .extension()! - .textDark3, - width: 16, - height: 16, + GestureDetector( + key: const Key( + "restoreFromFilePasswordFieldShowPasswordButtonKey", + ), + onTap: () async { + setState(() { + hidePassword = !hidePassword; + }); + }, + child: SvgPicture.asset( + hidePassword ? Assets.svg.eye : Assets.svg.eyeSlash, + color: Theme.of(context) + .extension()! + .textDark3, + width: 16, + height: 16, + ), ), const SizedBox( width: 12, @@ -199,396 +277,319 @@ class _RestoreFromFileViewState extends ConsumerState { ), ), ), - key: const Key("restoreFromFileLocationTextFieldKey"), - readOnly: true, - toolbarOptions: const ToolbarOptions( - copy: true, - cut: false, - paste: false, - selectAll: false, - ), - onChanged: (newValue) {}, + onChanged: (newValue) { + setState(() {}); + }, ), - SizedBox( - height: !isDesktop ? 8 : 24, - ), - if (isDesktop) - Padding( - padding: const EdgeInsets.only(bottom: 10.0), - child: Text( - "Enter passphrase", - style: STextStyles.desktopTextExtraExtraSmall(context) - .copyWith( - color: Theme.of(context) - .extension()! - .textDark3), - textAlign: TextAlign.left, - ), - ), - ClipRRect( - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - child: TextField( - key: const Key("restoreFromFilePasswordFieldKey"), - focusNode: passwordFocusNode, - controller: passwordController, - style: STextStyles.field(context), - obscureText: hidePassword, - enableSuggestions: false, - autocorrect: false, - decoration: standardInputDecoration( - "Enter passphrase", - passwordFocusNode, - context, - ).copyWith( - labelStyle: - isDesktop ? STextStyles.fieldLabel(context) : null, - suffixIcon: UnconstrainedBox( - child: Row( - children: [ - const SizedBox( - width: 16, - ), - GestureDetector( - key: const Key( - "restoreFromFilePasswordFieldShowPasswordButtonKey"), - onTap: () async { - setState(() { - hidePassword = !hidePassword; - }); - }, - child: SvgPicture.asset( - hidePassword - ? Assets.svg.eye - : Assets.svg.eyeSlash, - color: Theme.of(context) - .extension()! - .textDark3, - width: 16, - height: 16, - ), - ), - const SizedBox( - width: 12, - ), - ], - ), - ), - ), - onChanged: (newValue) { - setState(() {}); - }, - ), - ), - const SizedBox( - height: 16, - ), - if (!isDesktop) const Spacer(), - !isDesktop - ? TextButton( - style: passwordController.text.isEmpty || - fileLocationController.text.isEmpty - ? Theme.of(context) - .extension()! - .getPrimaryDisabledButtonStyle(context) - : Theme.of(context) - .extension()! - .getPrimaryEnabledButtonStyle(context), - onPressed: passwordController.text.isEmpty || - fileLocationController.text.isEmpty - ? null - : () async { - final String fileToRestore = - fileLocationController.text; - final String passphrase = passwordController.text; + ), + const SizedBox( + height: 16, + ), + if (!isDesktop) const Spacer(), + !isDesktop + ? TextButton( + style: passwordController.text.isEmpty || + fileLocationController.text.isEmpty + ? Theme.of(context) + .extension()! + .getPrimaryDisabledButtonStyle(context) + : Theme.of(context) + .extension()! + .getPrimaryEnabledButtonStyle(context), + onPressed: passwordController.text.isEmpty || + fileLocationController.text.isEmpty + ? null + : () async { + final String fileToRestore = + fileLocationController.text; + final String passphrase = passwordController.text; - if (FocusScope.of(context).hasFocus) { - FocusScope.of(context).unfocus(); - await Future.delayed( - const Duration(milliseconds: 75)); - } + if (FocusScope.of(context).hasFocus) { + FocusScope.of(context).unfocus(); + await Future.delayed( + const Duration(milliseconds: 75), + ); + } - if (!(await File(fileToRestore).exists())) { + if (!(await File(fileToRestore).exists())) { + await showFloatingFlushBar( + type: FlushBarType.warning, + message: "Backup file does not exist", + context: context, + ); + return; + } + + bool shouldPop = false; + unawaited( + showDialog( + barrierDismissible: false, + context: context, + builder: (_) => WillPopScope( + onWillPop: () async { + return shouldPop; + }, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.stretch, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Material( + color: Colors.transparent, + child: Center( + child: Text( + "Decrypting Stack backup file", + style: STextStyles.pageTitleH2( + context, + ).copyWith( + color: Theme.of(context) + .extension()! + .textWhite, + ), + ), + ), + ), + const SizedBox( + height: 64, + ), + const Center( + child: LoadingIndicator( + width: 100, + ), + ), + ], + ), + ), + ), + ); + + final String? jsonString = await compute( + SWB.decryptStackWalletWithPassphrase, + Tuple2(fileToRestore, passphrase), + debugLabel: "stack wallet decryption compute", + ); + + if (mounted) { + // pop LoadingIndicator + shouldPop = true; + Navigator.of(context).pop(); + + passwordController.text = ""; + + if (jsonString == null) { await showFloatingFlushBar( type: FlushBarType.warning, - message: "Backup file does not exist", + message: "Failed to decrypt backup file", context: context, ); return; } - bool shouldPop = false; - unawaited( - showDialog( - barrierDismissible: false, - context: context, - builder: (_) => WillPopScope( - onWillPop: () async { - return shouldPop; - }, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.stretch, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Material( - color: Colors.transparent, - child: Center( - child: Text( - "Decrypting Stack backup file", - style: STextStyles.pageTitleH2( - context) - .copyWith( - color: Theme.of(context) - .extension()! - .textWhite, - ), - ), - ), - ), - const SizedBox( - height: 64, - ), - const Center( - child: LoadingIndicator( - width: 100, - ), - ), - ], - ), + await Navigator.of(context).push( + RouteGenerator.getRoute( + builder: (_) => StackRestoreProgressView( + jsonString: jsonString, + shouldPushToHome: true, ), ), ); + } + }, + child: Text( + "Restore", + style: STextStyles.button(context), + ), + ) + : Row( + children: [ + PrimaryButton( + width: 183, + buttonHeight: ButtonHeight.m, + label: "Restore", + enabled: !(passwordController.text.isEmpty || + fileLocationController.text.isEmpty), + onPressed: passwordController.text.isEmpty || + fileLocationController.text.isEmpty + ? null + : () async { + final String fileToRestore = + fileLocationController.text; + final String passphrase = + passwordController.text; - final String? jsonString = await compute( - SWB.decryptStackWalletWithPassphrase, - Tuple2(fileToRestore, passphrase), - debugLabel: "stack wallet decryption compute", - ); + if (FocusScope.of(context).hasFocus) { + FocusScope.of(context).unfocus(); + await Future.delayed( + const Duration(milliseconds: 75), + ); + } - if (mounted) { - // pop LoadingIndicator - shouldPop = true; - Navigator.of(context).pop(); - - passwordController.text = ""; - - if (jsonString == null) { + if (!(await File(fileToRestore).exists())) { await showFloatingFlushBar( type: FlushBarType.warning, - message: "Failed to decrypt backup file", + message: "Backup file does not exist", context: context, ); return; } - await Navigator.of(context).push( - RouteGenerator.getRoute( - builder: (_) => StackRestoreProgressView( - jsonString: jsonString, - shouldPushToHome: true, + bool shouldPop = false; + unawaited( + showDialog( + barrierDismissible: false, + context: context, + builder: (_) => WillPopScope( + onWillPop: () async { + return shouldPop; + }, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.stretch, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Material( + color: Colors.transparent, + child: Center( + child: Text( + "Decrypting Stack backup file", + style: STextStyles.pageTitleH2( + context, + ).copyWith( + color: Theme.of(context) + .extension()! + .textWhite, + ), + ), + ), + ), + const SizedBox( + height: 64, + ), + const Center( + child: LoadingIndicator( + width: 100, + ), + ), + ], + ), ), ), ); - } - }, - child: Text( - "Restore", - style: STextStyles.button(context), - ), - ) - : Row( - children: [ - PrimaryButton( - width: 183, - buttonHeight: ButtonHeight.m, - label: "Restore", - enabled: !(passwordController.text.isEmpty || - fileLocationController.text.isEmpty), - onPressed: passwordController.text.isEmpty || - fileLocationController.text.isEmpty - ? null - : () async { - final String fileToRestore = - fileLocationController.text; - final String passphrase = - passwordController.text; - if (FocusScope.of(context).hasFocus) { - FocusScope.of(context).unfocus(); - await Future.delayed( - const Duration(milliseconds: 75)); - } + final String? jsonString = await compute( + SWB.decryptStackWalletWithPassphrase, + Tuple2(fileToRestore, passphrase), + debugLabel: "stack wallet decryption compute", + ); - if (!(await File(fileToRestore).exists())) { + if (mounted) { + // pop LoadingIndicator + shouldPop = true; + Navigator.of( + context, + rootNavigator: true, + ).pop(); + + passwordController.text = ""; + + if (jsonString == null) { await showFloatingFlushBar( type: FlushBarType.warning, - message: "Backup file does not exist", + message: "Failed to decrypt backup file", context: context, ); return; } - bool shouldPop = false; - unawaited( - showDialog( - barrierDismissible: false, - context: context, - builder: (_) => WillPopScope( - onWillPop: () async { - return shouldPop; - }, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.stretch, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Material( - color: Colors.transparent, - child: Center( - child: Text( - "Decrypting Stack backup file", - style: - STextStyles.pageTitleH2( - context) - .copyWith( - color: Theme.of(context) - .extension< - StackColors>()! - .textWhite, - ), + await showDialog( + context: context, + useSafeArea: false, + barrierDismissible: false, + builder: (context) { + return DesktopDialog( + maxHeight: 750, + maxWidth: 600, + child: LayoutBuilder( + builder: (context, constraints) { + return SingleChildScrollView( + child: ConstrainedBox( + constraints: BoxConstraints( + minHeight: + constraints.maxHeight, ), - ), - ), - const SizedBox( - height: 64, - ), - const Center( - child: LoadingIndicator( - width: 100, - ), - ), - ], - ), - ), - ), - ); - - final String? jsonString = await compute( - SWB.decryptStackWalletWithPassphrase, - Tuple2(fileToRestore, passphrase), - debugLabel: - "stack wallet decryption compute", - ); - - if (mounted) { - // pop LoadingIndicator - shouldPop = true; - Navigator.of( - context, - rootNavigator: true, - ).pop(); - - passwordController.text = ""; - - if (jsonString == null) { - await showFloatingFlushBar( - type: FlushBarType.warning, - message: - "Failed to decrypt backup file", - context: context, - ); - return; - } - - await showDialog( - context: context, - useSafeArea: false, - barrierDismissible: false, - builder: (context) { - return DesktopDialog( - maxHeight: 750, - maxWidth: 600, - child: LayoutBuilder( - builder: (context, constraints) { - return SingleChildScrollView( - child: ConstrainedBox( - constraints: BoxConstraints( - minHeight: - constraints.maxHeight, - ), - child: IntrinsicHeight( - child: Column( + child: IntrinsicHeight( + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Row( mainAxisAlignment: MainAxisAlignment - .start, + .spaceBetween, children: [ - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Padding( - padding: - const EdgeInsets - .all( - 32), - child: Text( - "Restore {$AppConfig.appName}", - style: STextStyles - .desktopH3( - context), - textAlign: - TextAlign - .center, - ), - ), - const DesktopDialogCloseButton(), - ], - ), Padding( padding: const EdgeInsets - .symmetric( - horizontal: - 32), - child: - StackRestoreProgressView( - jsonString: - jsonString, + .all( + 32, + ), + child: Text( + "Restore ${AppConfig.appName}", + style: STextStyles + .desktopH3( + context, + ), + textAlign: + TextAlign + .center, ), ), - const SizedBox( - height: 32, - ), + const DesktopDialogCloseButton(), ], ), - ), + Padding( + padding: + const EdgeInsets + .symmetric( + horizontal: 32, + ), + child: + StackRestoreProgressView( + jsonString: + jsonString, + ), + ), + const SizedBox( + height: 32, + ), + ], ), - ); - }, - ), - ); - }); - } - }, - ), - const SizedBox( - width: 16, - ), - SecondaryButton( - width: 183, - buttonHeight: ButtonHeight.m, - label: "Cancel", - onPressed: () {}, - ), - ], - ), - ], - ), - )); + ), + ), + ); + }, + ), + ); + }, + ); + } + }, + ), + const SizedBox( + width: 16, + ), + SecondaryButton( + width: 183, + buttonHeight: ButtonHeight.m, + label: "Cancel", + onPressed: () {}, + ), + ], + ), + ], + ), + ), + ); } } diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/stack_backup_view.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/stack_backup_view.dart index 2db8cbc9d..ac90e486a 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/stack_backup_view.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/stack_backup_view.dart @@ -23,8 +23,8 @@ import '../../../../widgets/rounded_white_container.dart'; class StackBackupView extends StatelessWidget { const StackBackupView({ - Key? key, - }) : super(key: key); + super.key, + }); static const String routeName = "/stackBackup"; diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/backup_frequency_type_select_sheet.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/backup_frequency_type_select_sheet.dart index 01203c0ae..d61c93c62 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/backup_frequency_type_select_sheet.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/backup_frequency_type_select_sheet.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../../../providers/global/prefs_provider.dart'; import '../../../../../themes/stack_colors.dart'; import '../../../../../utilities/constants.dart'; @@ -18,8 +19,8 @@ import '../../../../../utilities/text_styles.dart'; class BackupFrequencyTypeSelectSheet extends ConsumerWidget { const BackupFrequencyTypeSelectSheet({ - Key? key, - }) : super(key: key); + super.key, + }); String prettyFrequencyType(BackupFrequencyType type) { switch (type) { @@ -117,9 +118,10 @@ class BackupFrequencyTypeSelectSheet extends ConsumerWidget { .radioButtonIconEnabled, value: BackupFrequencyType.values[i], groupValue: ref.watch( - prefsChangeNotifierProvider.select( - (value) => - value.backupFrequencyType)), + prefsChangeNotifierProvider.select( + (value) => value.backupFrequencyType, + ), + ), onChanged: (x) { ref .read(prefsChangeNotifierProvider) @@ -137,7 +139,8 @@ class BackupFrequencyTypeSelectSheet extends ConsumerWidget { children: [ Text( prettyFrequencyType( - BackupFrequencyType.values[i]), + BackupFrequencyType.values[i], + ), style: STextStyles.titleBold12(context), textAlign: TextAlign.left, ), diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/recovery_phrase_view.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/recovery_phrase_view.dart index af533c9c4..dd1478b4a 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/recovery_phrase_view.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/recovery_phrase_view.dart @@ -21,11 +21,11 @@ import '../../../../../widgets/custom_buttons/app_bar_icon_button.dart'; class RecoverPhraseView extends StatelessWidget { const RecoverPhraseView({ - Key? key, + super.key, required this.walletName, required this.mnemonic, this.clipboardInterface = const ClipboardWrapper(), - }) : super(key: key); + }); static const String routeName = "/recoverPhrase"; diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/stack_restore_progress_view.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/stack_restore_progress_view.dart index 0cd60b29c..b160eb2e1 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/stack_restore_progress_view.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_views/stack_restore_progress_view.dart @@ -13,14 +13,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../../../app_config.dart'; -import '../../../../home_view/home_view.dart'; -import '../dialogs/cancel_stack_restore_dialog.dart'; -import '../helpers/restore_create_backup.dart'; -import '../restore_from_encrypted_string_view.dart'; -import '../stack_backup_view.dart'; -import '../sub_widgets/restoring_item_card.dart'; -import '../sub_widgets/restoring_wallet_card.dart'; import '../../../../../pages_desktop_specific/desktop_home_view.dart'; import '../../../../../pages_desktop_specific/desktop_menu.dart'; import '../../../../../providers/desktop/current_desktop_menu_item.dart'; @@ -40,14 +34,21 @@ import '../../../../../widgets/desktop/secondary_button.dart'; import '../../../../../widgets/icon_widgets/addressbook_icon.dart'; import '../../../../../widgets/loading_indicator.dart'; import '../../../../../widgets/rounded_container.dart'; +import '../../../../home_view/home_view.dart'; +import '../dialogs/cancel_stack_restore_dialog.dart'; +import '../helpers/restore_create_backup.dart'; +import '../restore_from_encrypted_string_view.dart'; +import '../stack_backup_view.dart'; +import '../sub_widgets/restoring_item_card.dart'; +import '../sub_widgets/restoring_wallet_card.dart'; class StackRestoreProgressView extends ConsumerStatefulWidget { const StackRestoreProgressView({ - Key? key, + super.key, required this.jsonString, this.fromFile = false, this.shouldPushToHome = false, - }) : super(key: key); + }); final String jsonString; final bool fromFile; @@ -64,41 +65,43 @@ class _StackRestoreProgressViewState Future _cancel() async { bool shouldPop = false; - unawaited(showDialog( - barrierDismissible: false, - context: context, - builder: (_) => WillPopScope( - onWillPop: () async { - return shouldPop; - }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Material( - color: Colors.transparent, - child: Center( - child: Text( - "Cancelling restore. Please wait.", - style: STextStyles.pageTitleH2(context).copyWith( - color: - Theme.of(context).extension()!.textWhite, + unawaited( + showDialog( + barrierDismissible: false, + context: context, + builder: (_) => WillPopScope( + onWillPop: () async { + return shouldPop; + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Material( + color: Colors.transparent, + child: Center( + child: Text( + "Cancelling restore. Please wait.", + style: STextStyles.pageTitleH2(context).copyWith( + color: + Theme.of(context).extension()!.textWhite, + ), ), ), ), - ), - const SizedBox( - height: 64, - ), - const Center( - child: LoadingIndicator( - width: 100, + const SizedBox( + height: 64, ), - ), - ], + const Center( + child: LoadingIndicator( + width: 100, + ), + ), + ], + ), ), ), - )); + ); await SWB.cancelRestore(); shouldPop = true; @@ -107,9 +110,13 @@ class _StackRestoreProgressViewState if (mounted) { !isDesktop - ? Navigator.of(context).popUntil(ModalRoute.withName(widget.fromFile - ? RestoreFromEncryptedStringView.routeName - : StackBackupView.routeName)) + ? Navigator.of(context).popUntil( + ModalRoute.withName( + widget.fromFile + ? RestoreFromEncryptedStringView.routeName + : StackBackupView.routeName, + ), + ) : Navigator.of(context).popUntil((_) => count++ >= 2); } } @@ -218,9 +225,10 @@ class _StackRestoreProgressViewState void _addWalletsToHomeView() { ref.read(pWallets).loadAfterStackRestore( - ref.read(prefsChangeNotifierProvider), - ref.read(stackRestoringUIStateProvider).wallets, - Util.isDesktop); + ref.read(prefsChangeNotifierProvider), + ref.read(stackRestoringUIStateProvider).wallets, + Util.isDesktop, + ); } @override @@ -233,7 +241,7 @@ class _StackRestoreProgressViewState @override Widget build(BuildContext context) { - bool isDesktop = Util.isDesktop; + final bool isDesktop = Util.isDesktop; return ConditionalParent( condition: !isDesktop, @@ -249,7 +257,8 @@ class _StackRestoreProgressViewState if (FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( - const Duration(milliseconds: 75)); + const Duration(milliseconds: 75), + ); } if (_success) { _addWalletsToHomeView(); @@ -264,7 +273,7 @@ class _StackRestoreProgressViewState }, ), title: Text( - "Restoring {$AppConfig.appName}", + "Restoring ${AppConfig.appName}", style: STextStyles.navBarTitle(context), ), ), @@ -299,8 +308,10 @@ class _StackRestoreProgressViewState ), Consumer( builder: (_, ref, __) { - final state = ref.watch(stackRestoringUIStateProvider - .select((value) => value.preferences)); + final state = ref.watch( + stackRestoringUIStateProvider + .select((value) => value.preferences), + ); return !isDesktop ? RestoringItemCard( left: SizedBox( @@ -386,8 +397,10 @@ class _StackRestoreProgressViewState ), Consumer( builder: (_, ref, __) { - final state = ref.watch(stackRestoringUIStateProvider - .select((value) => value.addressBook)); + final state = ref.watch( + stackRestoringUIStateProvider + .select((value) => value.addressBook), + ); return !isDesktop ? RestoringItemCard( left: SizedBox( @@ -471,8 +484,10 @@ class _StackRestoreProgressViewState ), Consumer( builder: (_, ref, __) { - final state = ref.watch(stackRestoringUIStateProvider - .select((value) => value.nodes)); + final state = ref.watch( + stackRestoringUIStateProvider + .select((value) => value.nodes), + ); return !isDesktop ? RestoringItemCard( left: SizedBox( @@ -549,7 +564,8 @@ class _StackRestoreProgressViewState style: STextStyles.errorSmall(context), ) : null, - )); + ), + ); }, ), const SizedBox( @@ -557,8 +573,10 @@ class _StackRestoreProgressViewState ), Consumer( builder: (_, ref, __) { - final state = ref.watch(stackRestoringUIStateProvider - .select((value) => value.trades)); + final state = ref.watch( + stackRestoringUIStateProvider + .select((value) => value.trades), + ); return !isDesktop ? RestoringItemCard( left: SizedBox( @@ -650,8 +668,10 @@ class _StackRestoreProgressViewState height: 8, ), ...ref - .watch(stackRestoringUIStateProvider - .select((value) => value.walletStateProviders)) + .watch( + stackRestoringUIStateProvider + .select((value) => value.walletStateProviders), + ) .values .map( (provider) => Padding( @@ -707,12 +727,13 @@ class _StackRestoreProgressViewState enabled: true, label: "Done", onPressed: () async { - DesktopMenuItemId keyID = + final DesktopMenuItemId keyID = DesktopMenuItemId.myStack; ref - .read(currentDesktopMenuItemProvider - .state) + .read( + currentDesktopMenuItemProvider.state, + ) .state = keyID; if (widget.shouldPushToHome) { @@ -727,7 +748,8 @@ class _StackRestoreProgressViewState Navigator.of(context, rootNavigator: true) .popUntil( ModalRoute.withName( - DesktopHomeView.routeName), + DesktopHomeView.routeName, + ), ); } }, diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_item_card.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_item_card.dart index 6e00445ff..0d4f66c70 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_item_card.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_item_card.dart @@ -15,7 +15,7 @@ import '../../../../../widgets/rounded_white_container.dart'; class RestoringItemCard extends StatelessWidget { const RestoringItemCard({ - Key? key, + super.key, required this.left, required this.right, required this.title, @@ -23,7 +23,7 @@ class RestoringItemCard extends StatelessWidget { this.leftSize = 32.0, this.button, this.onRightTapped, - }) : super(key: key); + }); final Widget left; final Widget right; diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_wallet_card.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_wallet_card.dart index 29bebd5f1..f38104ccd 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_wallet_card.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_wallet_card.dart @@ -13,9 +13,8 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../../../models/wallet_restore_state.dart'; -import '../sub_views/recovery_phrase_view.dart'; -import 'restoring_item_card.dart'; import '../../../../../providers/stack_restore/stack_restoring_ui_state_provider.dart'; import '../../../../../route_generator.dart'; import '../../../../../themes/coin_icon_provider.dart'; @@ -27,12 +26,14 @@ import '../../../../../utilities/text_styles.dart'; import '../../../../../utilities/util.dart'; import '../../../../../widgets/loading_indicator.dart'; import '../../../../../widgets/rounded_container.dart'; +import '../sub_views/recovery_phrase_view.dart'; +import 'restoring_item_card.dart'; class RestoringWalletCard extends ConsumerStatefulWidget { const RestoringWalletCard({ - Key? key, + super.key, required this.provider, - }) : super(key: key); + }); final ChangeNotifierProvider provider; @@ -106,8 +107,9 @@ class _RestoringWalletCardState extends ConsumerState { final wallet = ref.read(provider).wallet!; ref.read(stackRestoringUIStateProvider).update( - walletId: wallet.walletId, - restoringStatus: StackRestoringStatus.restoring); + walletId: wallet.walletId, + restoringStatus: StackRestoringStatus.restoring, + ); try { await wallet.recover(isRescan: true); @@ -191,9 +193,10 @@ class _RestoringWalletCardState extends ConsumerState { child: Text( "Show recovery phrase", style: STextStyles.infoSmall(context).copyWith( - color: Theme.of(context) - .extension()! - .accentColorDark), + color: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ), ), @@ -229,8 +232,9 @@ class _RestoringWalletCardState extends ConsumerState { final wallet = ref.read(provider).wallet!; ref.read(stackRestoringUIStateProvider).update( - walletId: wallet.walletId, - restoringStatus: StackRestoringStatus.restoring); + walletId: wallet.walletId, + restoringStatus: StackRestoringStatus.restoring, + ); try { // final mnemonicList = await manager.mnemonic; @@ -339,9 +343,10 @@ class _RestoringWalletCardState extends ConsumerState { child: Text( "Show recovery phrase", style: STextStyles.infoSmall(context).copyWith( - color: Theme.of(context) - .extension()! - .accentColorDark), + color: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ), ), diff --git a/lib/pages/settings_views/global_settings_view/startup_preferences/startup_preferences_view.dart b/lib/pages/settings_views/global_settings_view/startup_preferences/startup_preferences_view.dart index dad06ecb1..3970ff9c8 100644 --- a/lib/pages/settings_views/global_settings_view/startup_preferences/startup_preferences_view.dart +++ b/lib/pages/settings_views/global_settings_view/startup_preferences/startup_preferences_view.dart @@ -13,8 +13,8 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../../../../app_config.dart'; -import 'startup_wallet_selection_view.dart'; import '../../../../providers/providers.dart'; import '../../../../themes/coin_icon_provider.dart'; import '../../../../themes/stack_colors.dart'; @@ -24,9 +24,10 @@ import '../../../../wallets/isar/providers/wallet_info_provider.dart'; import '../../../../widgets/background.dart'; import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../widgets/rounded_white_container.dart'; +import 'startup_wallet_selection_view.dart'; class StartupPreferencesView extends ConsumerStatefulWidget { - const StartupPreferencesView({Key? key}) : super(key: key); + const StartupPreferencesView({super.key}); static const String routeName = "/startupPreferences"; @@ -130,15 +131,19 @@ class _StartupPreferencesViewState value: false, groupValue: ref.watch( prefsChangeNotifierProvider - .select((value) => value - .gotoWalletOnStartup), + .select( + (value) => + value.gotoWalletOnStartup, + ), ), onChanged: (value) { if (value is bool) { ref - .read( - prefsChangeNotifierProvider) - .gotoWalletOnStartup = value; + .read( + prefsChangeNotifierProvider, + ) + .gotoWalletOnStartup = + value; } }, ), @@ -155,14 +160,16 @@ class _StartupPreferencesViewState "Home screen", style: STextStyles.titleBold12( - context), + context, + ), textAlign: TextAlign.left, ), Text( "${AppConfig.appName} home screen", style: STextStyles.itemSubtitle( - context), + context, + ), textAlign: TextAlign.left, ), ], @@ -208,15 +215,19 @@ class _StartupPreferencesViewState value: true, groupValue: ref.watch( prefsChangeNotifierProvider - .select((value) => value - .gotoWalletOnStartup), + .select( + (value) => + value.gotoWalletOnStartup, + ), ), onChanged: (value) { if (value is bool) { ref - .read( - prefsChangeNotifierProvider) - .gotoWalletOnStartup = value; + .read( + prefsChangeNotifierProvider, + ) + .gotoWalletOnStartup = + value; } }, ), @@ -233,15 +244,17 @@ class _StartupPreferencesViewState "Specific wallet", style: STextStyles.titleBold12( - context), + context, + ), textAlign: TextAlign.left, ), (safe && ref.watch( prefsChangeNotifierProvider - .select((value) => - value - .startupWalletId), + .select( + (value) => value + .startupWalletId, + ), ) != null) ? Padding( @@ -257,8 +270,11 @@ class _StartupPreferencesViewState ref.watch( pWalletCoin( ref.watch( - prefsChangeNotifierProvider.select((value) => - value.startupWalletId!), + prefsChangeNotifierProvider + .select( + (value) => + value.startupWalletId!, + ), ), ), ), @@ -273,15 +289,19 @@ class _StartupPreferencesViewState ref.watch( pWalletName( ref.watch( - prefsChangeNotifierProvider.select( - (value) => - value.startupWalletId!), + prefsChangeNotifierProvider + .select( + (value) => + value + .startupWalletId!, + ), ), ), ), style: STextStyles .itemSubtitle( - context), + context, + ), ), ], ), @@ -290,7 +310,8 @@ class _StartupPreferencesViewState "Select a specific wallet to load into on startup", style: STextStyles .itemSubtitle( - context), + context, + ), textAlign: TextAlign.left, ), @@ -303,13 +324,19 @@ class _StartupPreferencesViewState ), ), ), - if (!ref.watch(prefsChangeNotifierProvider.select( - (value) => value.gotoWalletOnStartup))) + if (!ref.watch( + prefsChangeNotifierProvider.select( + (value) => value.gotoWalletOnStartup, + ), + )) const SizedBox( height: 12, ), - if (ref.watch(prefsChangeNotifierProvider.select( - (value) => value.gotoWalletOnStartup))) + if (ref.watch( + prefsChangeNotifierProvider.select( + (value) => value.gotoWalletOnStartup, + ), + )) Container( color: Colors.transparent, child: Padding( @@ -341,8 +368,9 @@ class _StartupPreferencesViewState ), onPressed: () { Navigator.of(context).pushNamed( - StartupWalletSelectionView - .routeName); + StartupWalletSelectionView + .routeName, + ); }, child: Column( crossAxisAlignment: @@ -351,7 +379,8 @@ class _StartupPreferencesViewState Text( "Select wallet...", style: STextStyles.link2( - context), + context, + ), textAlign: TextAlign.left, ), ], diff --git a/lib/pages/settings_views/global_settings_view/startup_preferences/startup_wallet_selection_view.dart b/lib/pages/settings_views/global_settings_view/startup_preferences/startup_wallet_selection_view.dart index 0be056535..7c073c5ce 100644 --- a/lib/pages/settings_views/global_settings_view/startup_preferences/startup_wallet_selection_view.dart +++ b/lib/pages/settings_views/global_settings_view/startup_preferences/startup_wallet_selection_view.dart @@ -26,7 +26,7 @@ import '../../../../widgets/custom_buttons/draggable_switch_button.dart'; import '../../../../widgets/rounded_white_container.dart'; class StartupWalletSelectionView extends ConsumerStatefulWidget { - const StartupWalletSelectionView({Key? key}) : super(key: key); + const StartupWalletSelectionView({super.key}); static const String routeName = "/startupWalletSelection"; @override diff --git a/lib/pages/settings_views/global_settings_view/support_view.dart b/lib/pages/settings_views/global_settings_view/support_view.dart index 8c3d14f32..8c348d99a 100644 --- a/lib/pages/settings_views/global_settings_view/support_view.dart +++ b/lib/pages/settings_views/global_settings_view/support_view.dart @@ -24,8 +24,8 @@ import 'package:url_launcher/url_launcher.dart'; class SupportView extends StatelessWidget { const SupportView({ - Key? key, - }) : super(key: key); + super.key, + }); static const String routeName = "/support"; @@ -131,13 +131,13 @@ class SupportView extends StatelessWidget { class AboutItem extends StatelessWidget { const AboutItem({ - Key? key, + super.key, required this.linkUrl, required this.label, required this.buttonText, required this.iconAsset, required this.isDesktop, - }) : super(key: key); + }); final String linkUrl; final String label; @@ -218,7 +218,7 @@ class AboutItem extends StatelessWidget { Text( buttonText, style: STextStyles.desktopTextExtraExtraSmall(context), - ) + ), // BlueTextButton( // text: buttonText, // onTap: () { diff --git a/lib/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_options_view.dart b/lib/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_options_view.dart index d20e9dcbc..b036f89f8 100644 --- a/lib/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_options_view.dart +++ b/lib/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_options_view.dart @@ -10,7 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'wallet_syncing_options_view.dart'; + import '../../../../providers/providers.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/constants.dart'; @@ -23,9 +23,10 @@ import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../widgets/desktop/desktop_dialog.dart'; import '../../../../widgets/desktop/desktop_dialog_close_button.dart'; import '../../../../widgets/rounded_white_container.dart'; +import 'wallet_syncing_options_view.dart'; class SyncingOptionsView extends ConsumerWidget { - const SyncingOptionsView({Key? key}) : super(key: key); + const SyncingOptionsView({super.key}); static const String routeName = "/syncingOptions"; @@ -314,14 +315,18 @@ class SyncingOptionsView extends ConsumerWidget { ), ), ), - if (ref.watch(prefsChangeNotifierProvider - .select((value) => value.syncType)) != + if (ref.watch( + prefsChangeNotifierProvider + .select((value) => value.syncType), + ) != SyncingType.selectedWalletsAtStartup) const SizedBox( height: 12, ), - if (ref.watch(prefsChangeNotifierProvider - .select((value) => value.syncType)) == + if (ref.watch( + prefsChangeNotifierProvider + .select((value) => value.syncType), + ) == SyncingType.selectedWalletsAtStartup) Container( color: Colors.transparent, @@ -351,7 +356,8 @@ class SyncingOptionsView extends ConsumerWidget { onPressed: () { !isDesktop ? Navigator.of(context).pushNamed( - WalletSyncingOptionsView.routeName) + WalletSyncingOptionsView.routeName, + ) : showDialog( context: context, useSafeArea: false, @@ -370,7 +376,8 @@ class SyncingOptionsView extends ConsumerWidget { Padding( padding: const EdgeInsets.all( - 32), + 32, + ), child: Text( "Select wallets to sync", style: STextStyles @@ -389,7 +396,8 @@ class SyncingOptionsView extends ConsumerWidget { ], ), ); - }); + }, + ); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_preferences_view.dart b/lib/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_preferences_view.dart index 58a768a70..988d951f1 100644 --- a/lib/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_preferences_view.dart +++ b/lib/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_preferences_view.dart @@ -10,7 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'syncing_options_view.dart'; + import '../../../../providers/providers.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/constants.dart'; @@ -20,9 +20,10 @@ import '../../../../widgets/background.dart'; import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../widgets/custom_buttons/draggable_switch_button.dart'; import '../../../../widgets/rounded_white_container.dart'; +import 'syncing_options_view.dart'; class SyncingPreferencesView extends ConsumerWidget { - const SyncingPreferencesView({Key? key}) : super(key: key); + const SyncingPreferencesView({super.key}); static const String routeName = "/syncingPreferences"; @@ -96,13 +97,17 @@ class SyncingPreferencesView extends ConsumerWidget { textAlign: TextAlign.left, ), Text( - _currentTypeDescription(ref.watch( + _currentTypeDescription( + ref.watch( prefsChangeNotifierProvider.select( - (value) => value.syncType))), + (value) => value.syncType, + ), + ), + ), style: STextStyles.itemSubtitle(context), textAlign: TextAlign.left, - ) + ), ], ), const Spacer(), @@ -145,12 +150,14 @@ class SyncingPreferencesView extends ConsumerWidget { child: DraggableSwitchButton( isOn: ref.watch( prefsChangeNotifierProvider.select( - (value) => value.wifiOnly), + (value) => value.wifiOnly, + ), ), onValueChanged: (newValue) { ref .read( - prefsChangeNotifierProvider) + prefsChangeNotifierProvider, + ) .wifiOnly = newValue; }, ), diff --git a/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart b/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart index 9b22c13ae..f974226b6 100644 --- a/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart +++ b/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart @@ -13,6 +13,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../../providers/providers.dart'; import '../../../../themes/coin_icon_provider.dart'; import '../../../../themes/stack_colors.dart'; @@ -29,7 +30,7 @@ import '../../../../widgets/custom_buttons/draggable_switch_button.dart'; import '../../../../widgets/rounded_white_container.dart'; class WalletSyncingOptionsView extends ConsumerWidget { - const WalletSyncingOptionsView({Key? key}) : super(key: key); + const WalletSyncingOptionsView({super.key}); static const String routeName = "/walletSyncingOptions"; @@ -78,160 +79,175 @@ class WalletSyncingOptionsView extends ConsumerWidget { child: child, ); }, - child: LayoutBuilder(builder: (context, constraints) { - return SingleChildScrollView( - child: ConstrainedBox( - constraints: BoxConstraints( - minHeight: constraints.maxHeight - 24, - ), - child: IntrinsicHeight( - child: Padding( - padding: const EdgeInsets.all(4), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SizedBox( - height: 4, - ), - Text( - "Choose the wallets to sync automatically at startup", - style: STextStyles.smallMed12(context), - ), - const SizedBox( - height: 12, - ), - RoundedWhiteContainer( - padding: const EdgeInsets.all(0), - borderColor: !isDesktop - ? Colors.transparent - : Theme.of(context) - .extension()! - .background, - child: Column( - children: [ - ...walletInfos.map( - (info) => Padding( - padding: const EdgeInsets.all(12), - child: Row( - key: Key( - "syncingPrefsSelectedWalletIdGroupKey_${info.walletId}"), - children: [ - Container( - decoration: BoxDecoration( - color: ref - .watch(pCoinColor(info.coin)) - .withOpacity(0.5), - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - ), - child: Padding( - padding: const EdgeInsets.all(4), - child: SvgPicture.file( - File( - ref.watch( - coinIconProvider(info.coin), - ), + child: LayoutBuilder( + builder: (context, constraints) { + return SingleChildScrollView( + child: ConstrainedBox( + constraints: BoxConstraints( + minHeight: constraints.maxHeight - 24, + ), + child: IntrinsicHeight( + child: Padding( + padding: const EdgeInsets.all(4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox( + height: 4, + ), + Text( + "Choose the wallets to sync automatically at startup", + style: STextStyles.smallMed12(context), + ), + const SizedBox( + height: 12, + ), + RoundedWhiteContainer( + padding: const EdgeInsets.all(0), + borderColor: !isDesktop + ? Colors.transparent + : Theme.of(context) + .extension()! + .background, + child: Column( + children: [ + ...walletInfos.map( + (info) => Padding( + padding: const EdgeInsets.all(12), + child: Row( + key: Key( + "syncingPrefsSelectedWalletIdGroupKey_${info.walletId}", + ), + children: [ + Container( + decoration: BoxDecoration( + color: ref + .watch(pCoinColor(info.coin)) + .withOpacity(0.5), + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + child: Padding( + padding: const EdgeInsets.all(4), + child: SvgPicture.file( + File( + ref.watch( + coinIconProvider(info.coin), + ), + ), + width: 20, + height: 20, ), - width: 20, - height: 20, ), ), - ), - const SizedBox( - width: 12, - ), - Column( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - info.name, - style: - STextStyles.titleBold12(context), - ), - const SizedBox( - height: 2, - ), - Text( - ref + const SizedBox( + width: 12, + ), + Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + info.name, + style: STextStyles.titleBold12( + context), + ), + const SizedBox( + height: 2, + ), + Text( + ref + .watch( + pAmountFormatter(info.coin), + ) + .format( + ref + .watch( + pWalletBalance( + info.walletId, + ), + ) + .total, + ), + style: STextStyles.itemSubtitle( + context), + ), + ], + ), + const Spacer(), + SizedBox( + height: 20, + width: 40, + child: DraggableSwitchButton( + isOn: ref .watch( - pAmountFormatter(info.coin)) - .format(ref - .watch(pWalletBalance( - info.walletId)) - .total), - style: - STextStyles.itemSubtitle(context), - ) - ], - ), - const Spacer(), - SizedBox( - height: 20, - width: 40, - child: DraggableSwitchButton( - isOn: ref - .watch(prefsChangeNotifierProvider - .select((value) => value - .walletIdsSyncOnStartup)) - .contains(info.walletId), - onValueChanged: (value) { - // final syncType = ref - // .read(prefsChangeNotifierProvider) - // .syncType; - final ids = ref - .read(prefsChangeNotifierProvider) - .walletIdsSyncOnStartup - .toList(); - if (value) { - ids.add(info.walletId); - } else { - ids.remove(info.walletId); - } + prefsChangeNotifierProvider + .select( + (value) => value + .walletIdsSyncOnStartup, + ), + ) + .contains(info.walletId), + onValueChanged: (value) { + // final syncType = ref + // .read(prefsChangeNotifierProvider) + // .syncType; + final ids = ref + .read( + prefsChangeNotifierProvider) + .walletIdsSyncOnStartup + .toList(); + if (value) { + ids.add(info.walletId); + } else { + ids.remove(info.walletId); + } - // final wallet = ref - // .read(pWallets) - // .getWallet(info.walletId); - // - // switch (syncType) { - // case SyncingType.currentWalletOnly: - // if (info.walletId == - // ref.read( - // currentWalletIdProvider)) { - // wallet.shouldAutoSync = value; - // } - // break; - // case SyncingType - // .selectedWalletsAtStartup: - // case SyncingType - // .allWalletsOnStartup: - // wallet.shouldAutoSync = value; - // break; - // } + // final wallet = ref + // .read(pWallets) + // .getWallet(info.walletId); + // + // switch (syncType) { + // case SyncingType.currentWalletOnly: + // if (info.walletId == + // ref.read( + // currentWalletIdProvider)) { + // wallet.shouldAutoSync = value; + // } + // break; + // case SyncingType + // .selectedWalletsAtStartup: + // case SyncingType + // .allWalletsOnStartup: + // wallet.shouldAutoSync = value; + // break; + // } - ref - .read(prefsChangeNotifierProvider) - .walletIdsSyncOnStartup = ids; - }, + ref + .read( + prefsChangeNotifierProvider) + .walletIdsSyncOnStartup = ids; + }, + ), ), - ), - ], + ], + ), ), ), - ), - ], + ], + ), ), - ), - ], + ], + ), ), ), ), - ), - ); - }), + ); + }, + ), ), ); } diff --git a/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart b/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart index 0d6acf41d..425a7accc 100644 --- a/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart +++ b/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart @@ -14,6 +14,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:lottie/lottie.dart'; + import '../../../../providers/global/prefs_provider.dart'; import '../../../../services/event_bus/events/global/tor_connection_status_changed_event.dart'; import '../../../../services/tor_service.dart'; @@ -34,8 +35,8 @@ import '../../../../widgets/tor_subscription.dart'; class TorSettingsView extends ConsumerStatefulWidget { const TorSettingsView({ - Key? key, - }) : super(key: key); + super.key, + }); static const String routeName = "/torSettings"; @@ -563,24 +564,25 @@ class _UpperCaseTorTextState extends ConsumerState { @override Widget build(BuildContext context) { return TorSubscription( - onTorStatusChanged: (status) { - setState(() { - _status = status; - }); - }, - child: Text( - _label( + onTorStatusChanged: (status) { + setState(() { + _status = status; + }); + }, + child: Text( + _label( + _status, + ), + style: STextStyles.pageTitleH2( + context, + ).copyWith( + color: _color( _status, + Theme.of(context).extension()!, ), - style: STextStyles.pageTitleH2( - context, - ).copyWith( - color: _color( - _status, - Theme.of(context).extension()!, - ), - ), - )); + ), + ), + ); } } diff --git a/lib/pages/settings_views/wallet_settings_view/frost_ms/frost_ms_options_view.dart b/lib/pages/settings_views/wallet_settings_view/frost_ms/frost_ms_options_view.dart index a9bea43be..3404b395e 100644 --- a/lib/pages/settings_views/wallet_settings_view/frost_ms/frost_ms_options_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/frost_ms/frost_ms_options_view.dart @@ -10,10 +10,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../../frost_route_generator.dart'; -import '../../sub_widgets/settings_list_button.dart'; -import 'frost_participants_view.dart'; -import 'initiate_resharing/initiate_resharing_view.dart'; import '../../../../pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart'; import '../../../../providers/db/main_db_provider.dart'; import '../../../../providers/frost_wallet/frost_wallet_providers.dart'; @@ -31,6 +29,9 @@ import '../../../../widgets/desktop/desktop_app_bar.dart'; import '../../../../widgets/desktop/desktop_scaffold.dart'; import '../../../../widgets/frost_scaffold.dart'; import '../../../../widgets/rounded_white_container.dart'; +import '../../sub_widgets/settings_list_button.dart'; +import 'frost_participants_view.dart'; +import 'initiate_resharing/initiate_resharing_view.dart'; class FrostMSWalletOptionsView extends ConsumerWidget { const FrostMSWalletOptionsView({ @@ -64,20 +65,21 @@ class FrostMSWalletOptionsView extends ConsumerWidget { condition: !Util.isDesktop, builder: (child) => Background( child: Scaffold( - backgroundColor: - Theme.of(context).extension()!.background, - appBar: AppBar( - leading: AppBarBackButton( - onPressed: () { - Navigator.of(context).pop(); - }, - ), - title: Text( - "FROST Multisig options", - style: STextStyles.navBarTitle(context), - ), + backgroundColor: + Theme.of(context).extension()!.background, + appBar: AppBar( + leading: AppBarBackButton( + onPressed: () { + Navigator.of(context).pop(); + }, ), - body: child), + title: Text( + "FROST Multisig options", + style: STextStyles.navBarTitle(context), + ), + ), + body: child, + ), ), child: Padding( padding: const EdgeInsets.only( diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart index 102de03f1..e2b861db1 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart @@ -15,10 +15,9 @@ import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:qr_flutter/qr_flutter.dart'; + import '../../../../app_config.dart'; import '../../../../notifications/show_flush_bar.dart'; -import '../../../add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart'; -import '../../../wallet_view/transaction_views/transaction_details_view.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/address_utils.dart'; import '../../../../utilities/assets.dart'; @@ -33,6 +32,8 @@ import '../../../../widgets/custom_buttons/simple_copy_button.dart'; import '../../../../widgets/detail_item.dart'; import '../../../../widgets/rounded_white_container.dart'; import '../../../../widgets/stack_dialog.dart'; +import '../../../add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart'; +import '../../../wallet_view/transaction_views/transaction_details_view.dart'; class WalletBackupView extends ConsumerWidget { const WalletBackupView({ @@ -94,12 +95,14 @@ class WalletBackupView extends ConsumerWidget { onPressed: () async { await clipboardInterface .setData(ClipboardData(text: mnemonic.join(" "))); - unawaited(showFloatingFlushBar( - type: FlushBarType.info, - message: "Copied to clipboard", - iconAsset: Assets.svg.copy, - context: context, - )); + unawaited( + showFloatingFlushBar( + type: FlushBarType.info, + message: "Copied to clipboard", + iconAsset: Assets.svg.copy, + context: context, + ), + ); }, ), ), @@ -256,7 +259,8 @@ class WalletBackupView extends ConsumerWidget { color: Theme.of(context).extension()!.popupBG, borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius), + Constants.size.circularBorderRadius, + ), ), child: Padding( padding: const EdgeInsets.all(12), @@ -285,7 +289,8 @@ class WalletBackupView extends ConsumerWidget { .extension()! .getPrimaryEnabledButtonStyle(context), onPressed: () { - String data = AddressUtils.encodeQRSeedData(mnemonic); + final String data = + AddressUtils.encodeQRSeedData(mnemonic); showDialog( context: context, @@ -313,14 +318,15 @@ class WalletBackupView extends ConsumerWidget { width: width + 20, height: width + 20, child: QrImageView( - data: data, - size: width, - backgroundColor: Theme.of(context) - .extension()! - .popupBG, - foregroundColor: Theme.of(context) - .extension()! - .accentColorDark), + data: data, + size: width, + backgroundColor: Theme.of(context) + .extension()! + .popupBG, + foregroundColor: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ), ), @@ -338,14 +344,16 @@ class WalletBackupView extends ConsumerWidget { style: Theme.of(context) .extension()! .getSecondaryEnabledButtonStyle( - context), + context, + ), child: Text( "Cancel", style: STextStyles.button(context) .copyWith( - color: Theme.of(context) - .extension()! - .accentColorDark), + color: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ), ), diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/sub_widgets/confirm_full_rescan.dart b/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/sub_widgets/confirm_full_rescan.dart index f5281435b..530233ec4 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/sub_widgets/confirm_full_rescan.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/sub_widgets/confirm_full_rescan.dart @@ -19,8 +19,7 @@ import '../../../../../widgets/desktop/secondary_button.dart'; import '../../../../../widgets/stack_dialog.dart'; class ConfirmFullRescanDialog extends StatelessWidget { - const ConfirmFullRescanDialog({Key? key, required this.onConfirm}) - : super(key: key); + const ConfirmFullRescanDialog({super.key, required this.onConfirm}); final VoidCallback onConfirm; @@ -87,10 +86,10 @@ class ConfirmFullRescanDialog extends StatelessWidget { ), ), ], - ) + ), ], ), - ) + ), ], ), ); diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/sub_widgets/rescanning_dialog.dart b/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/sub_widgets/rescanning_dialog.dart index f243b977f..647eb2e33 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/sub_widgets/rescanning_dialog.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/sub_widgets/rescanning_dialog.dart @@ -17,9 +17,9 @@ import '../../../../../widgets/stack_dialog.dart'; class RescanningDialog extends StatefulWidget { const RescanningDialog({ - Key? key, + super.key, // required this.onCancel, - }) : super(key: key); + }); // final VoidCallback onCancel; diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart index ff80ff3c4..da50b6208 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart @@ -216,7 +216,7 @@ class _WalletNetworkSettingsViewState } String _percentString(double value) { - double realPercent = (value * 10000).ceil().clamp(0, 10000) / 100.0; + final double realPercent = (value * 10000).ceil().clamp(0, 10000) / 100.0; if (realPercent > 99.99 && _currentSyncStatus == WalletSyncStatus.syncing) { return "99.99%"; } diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart index a0cb79f9d..004bd57df 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart @@ -13,9 +13,34 @@ import 'dart:async'; import 'package:event_bus/event_bus.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:tuple/tuple.dart'; + import '../../../db/hive/db.dart'; +import '../../../db/sqlite/firo_cache.dart'; import '../../../models/epicbox_config_model.dart'; import '../../../notifications/show_flush_bar.dart'; +import '../../../providers/global/wallets_provider.dart'; +import '../../../providers/ui/transaction_filter_provider.dart'; +import '../../../route_generator.dart'; +import '../../../services/event_bus/events/global/node_connection_status_changed_event.dart'; +import '../../../services/event_bus/events/global/wallet_sync_status_changed_event.dart'; +import '../../../services/event_bus/global_event_bus.dart'; +import '../../../themes/stack_colors.dart'; +import '../../../utilities/assets.dart'; +import '../../../utilities/show_loading.dart'; +import '../../../utilities/text_styles.dart'; +import '../../../utilities/util.dart'; +import '../../../wallets/crypto_currency/crypto_currency.dart'; +import '../../../wallets/crypto_currency/intermediate/frost_currency.dart'; +import '../../../wallets/crypto_currency/intermediate/nano_currency.dart'; +import '../../../wallets/wallet/impl/bitcoin_frost_wallet.dart'; +import '../../../wallets/wallet/impl/epiccash_wallet.dart'; +import '../../../wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart'; +import '../../../widgets/background.dart'; +import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; +import '../../../widgets/desktop/secondary_button.dart'; +import '../../../widgets/rounded_white_container.dart'; +import '../../../widgets/stack_dialog.dart'; import '../../address_book_views/address_book_view.dart'; import '../../home_view/home_view.dart'; import '../../pinpad_views/lock_screen_view.dart'; @@ -28,30 +53,6 @@ import 'wallet_network_settings_view/wallet_network_settings_view.dart'; import 'wallet_settings_wallet_settings/change_representative_view.dart'; import 'wallet_settings_wallet_settings/wallet_settings_wallet_settings_view.dart'; import 'wallet_settings_wallet_settings/xpub_view.dart'; -import '../../../providers/global/wallets_provider.dart'; -import '../../../providers/ui/transaction_filter_provider.dart'; -import '../../../route_generator.dart'; -import '../../../services/event_bus/events/global/node_connection_status_changed_event.dart'; -import '../../../services/event_bus/events/global/wallet_sync_status_changed_event.dart'; -import '../../../services/event_bus/global_event_bus.dart'; -import '../../../themes/stack_colors.dart'; -import '../../../utilities/assets.dart'; -import '../../../utilities/show_loading.dart'; -import '../../../utilities/text_styles.dart'; -import '../../../utilities/util.dart'; -import '../../../wallets/crypto_currency/coins/firo.dart'; -import '../../../wallets/crypto_currency/crypto_currency.dart'; -import '../../../wallets/crypto_currency/intermediate/frost_currency.dart'; -import '../../../wallets/crypto_currency/intermediate/nano_currency.dart'; -import '../../../wallets/wallet/impl/bitcoin_frost_wallet.dart'; -import '../../../wallets/wallet/impl/epiccash_wallet.dart'; -import '../../../wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart'; -import '../../../widgets/background.dart'; -import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; -import '../../../widgets/desktop/secondary_button.dart'; -import '../../../widgets/rounded_white_container.dart'; -import '../../../widgets/stack_dialog.dart'; -import 'package:tuple/tuple.dart'; /// [eventBus] should only be set during testing class WalletSettingsView extends ConsumerStatefulWidget { @@ -325,8 +326,9 @@ class _WalletSettingsViewState extends ConsumerState { "View recovery phrase", ), settings: const RouteSettings( - name: - "/viewRecoverPhraseLockscreen"), + name: + "/viewRecoverPhraseLockscreen", + ), ), ); } @@ -357,7 +359,8 @@ class _WalletSettingsViewState extends ConsumerState { title: "Syncing preferences", onPressed: () { Navigator.of(context).pushNamed( - SyncingPreferencesView.routeName); + SyncingPreferencesView.routeName, + ); }, ), if (xPubEnabled) @@ -411,7 +414,8 @@ class _WalletSettingsViewState extends ConsumerState { ), ); - if (result == "OK" && mounted) { + if (result == "OK" && + context.mounted) { await showLoading( whileFuture: Future.wait( [ @@ -424,6 +428,9 @@ class _WalletSettingsViewState extends ConsumerState { .clearSharedTransactionCache( currency: coin, ), + if (coin is Firo) + FiroCacheCoordinator + .clearSharedCache(), ], ), context: context, @@ -494,9 +501,10 @@ class _WalletSettingsViewState extends ConsumerState { child: Text( "Log out", style: STextStyles.button(context).copyWith( - color: Theme.of(context) - .extension()! - .accentColorDark), + color: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ); }, @@ -517,9 +525,9 @@ class _WalletSettingsViewState extends ConsumerState { class EpicBoxInfoForm extends ConsumerStatefulWidget { const EpicBoxInfoForm({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; @@ -603,9 +611,9 @@ class _EpiBoxInfoFormState extends ConsumerState { child: Text( "Save", style: STextStyles.button(context).copyWith( - color: Theme.of(context) - .extension()! - .accentColorDark), + color: + Theme.of(context).extension()!.accentColorDark, + ), ), ), ], diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/change_representative_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/change_representative_view.dart index 23a8c6cd8..cfca56bf2 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/change_representative_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/change_representative_view.dart @@ -14,6 +14,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../../notifications/show_flush_bar.dart'; import '../../../../providers/global/wallets_provider.dart'; import '../../../../themes/stack_colors.dart'; @@ -38,10 +39,10 @@ import '../../../../widgets/textfield_icon_button.dart'; class ChangeRepresentativeView extends ConsumerStatefulWidget { const ChangeRepresentativeView({ - Key? key, + super.key, required this.walletId, this.clipboardInterface = const ClipboardWrapper(), - }) : super(key: key); + }); final String walletId; final ClipboardInterface clipboardInterface; @@ -80,21 +81,22 @@ class _ChangeRepresentativeViewState final changeFuture = wallet.changeRepresentative; final result = await showLoading( - whileFuture: changeFuture(_textController.text), - context: context, - message: "Updating representative...", - rootNavigator: Util.isDesktop, - onException: (ex) { - String msg = ex.toString(); - while (msg.isNotEmpty && msg.startsWith("Exception:")) { - msg = msg.substring(10).trim(); - } - showFloatingFlushBar( - type: FlushBarType.warning, - message: msg, - context: context, - ); - }); + whileFuture: changeFuture(_textController.text), + context: context, + message: "Updating representative...", + rootNavigator: Util.isDesktop, + onException: (ex) { + String msg = ex.toString(); + while (msg.isNotEmpty && msg.startsWith("Exception:")) { + msg = msg.substring(10).trim(); + } + showFloatingFlushBar( + type: FlushBarType.warning, + message: msg, + context: context, + ); + }, + ); if (mounted) { if (result != null && result) { @@ -129,12 +131,14 @@ class _ChangeRepresentativeViewState await _clipboardInterface .setData(ClipboardData(text: representative ?? "")); if (mounted) { - unawaited(showFloatingFlushBar( - type: FlushBarType.info, - message: "Copied to clipboard", - iconAsset: Assets.svg.copy, - context: context, - )); + unawaited( + showFloatingFlushBar( + type: FlushBarType.info, + message: "Copied to clipboard", + iconAsset: Assets.svg.copy, + context: context, + ), + ); } } @@ -284,7 +288,8 @@ class _ChangeRepresentativeViewState Text( "Current representative", style: STextStyles.desktopTextExtraExtraSmall( - context), + context, + ), ), const SizedBox( height: 4, @@ -300,8 +305,8 @@ class _ChangeRepresentativeViewState representative!, style: isDesktop ? STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_warning_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_warning_view.dart index d03cfe534..b33c44c9c 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_warning_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_warning_view.dart @@ -10,7 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'delete_wallet_recovery_phrase_view.dart'; + import '../../../../providers/providers.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/text_styles.dart'; @@ -19,6 +19,7 @@ import '../../../../wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.da import '../../../../widgets/background.dart'; import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../widgets/rounded_container.dart'; +import 'delete_wallet_recovery_phrase_view.dart'; class DeleteWalletWarningView extends ConsumerWidget { const DeleteWalletWarningView({ @@ -87,9 +88,10 @@ class DeleteWalletWarningView extends ConsumerWidget { child: Text( "Cancel", style: STextStyles.button(context).copyWith( - color: Theme.of(context) - .extension()! - .accentColorDark), + color: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ), const SizedBox( diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/lelantus_settings_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/lelantus_settings_view.dart new file mode 100644 index 000000000..56e726731 --- /dev/null +++ b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/lelantus_settings_view.dart @@ -0,0 +1,118 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../../../../providers/db/main_db_provider.dart'; +import '../../../../themes/stack_colors.dart'; +import '../../../../utilities/text_styles.dart'; +import '../../../../wallets/isar/models/wallet_info.dart'; +import '../../../../wallets/isar/providers/wallet_info_provider.dart'; +import '../../../../widgets/background.dart'; +import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; +import '../../../../widgets/custom_buttons/draggable_switch_button.dart'; + +class LelantusSettingsView extends ConsumerStatefulWidget { + const LelantusSettingsView({ + super.key, + required this.walletId, + }); + + static const String routeName = "/lelantusSettings"; + + final String walletId; + + @override + ConsumerState createState() => + _LelantusSettingsViewState(); +} + +class _LelantusSettingsViewState extends ConsumerState { + bool _isUpdatingLelantusScanning = false; + + Future _switchToggled(bool newValue) async { + if (_isUpdatingLelantusScanning) return; + _isUpdatingLelantusScanning = true; // Lock mutex. + + try { + // Toggle enableLelantusScanning in wallet info. + await ref.read(pWalletInfo(widget.walletId)).updateOtherData( + newEntries: { + WalletInfoKeys.enableLelantusScanning: newValue, + }, + isar: ref.read(mainDBProvider).isar, + ); + } finally { + // ensure _isUpdatingLelantusScanning is set to false no matter what + _isUpdatingLelantusScanning = false; + } + } + + @override + Widget build(BuildContext context) { + return Background( + child: Scaffold( + backgroundColor: Theme.of(context).extension()!.background, + appBar: AppBar( + leading: AppBarBackButton( + onPressed: () { + Navigator.of(context).pop(); + }, + ), + title: Text( + "Lelantus settings", + style: STextStyles.navBarTitle(context), + ), + ), + body: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row( + children: [ + SizedBox( + height: 20, + width: 40, + child: DraggableSwitchButton( + isOn: ref.watch( + pWalletInfo(widget.walletId) + .select((value) => value.otherData), + )[WalletInfoKeys.enableLelantusScanning] as bool? ?? + false, + onValueChanged: _switchToggled, + ), + ), + const SizedBox( + width: 16, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Scan for Lelantus transactions", + style: STextStyles.smallMed12(context), + ), + // Text( + // detail, + // style: STextStyles.desktopTextExtraExtraSmall(context), + // ), + ], + ), + ], + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/rename_wallet_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/rename_wallet_view.dart index a0fb54eed..319cc067f 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/rename_wallet_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/rename_wallet_view.dart @@ -27,9 +27,9 @@ import '../../../../widgets/textfield_icon_button.dart'; class RenameWalletView extends ConsumerStatefulWidget { const RenameWalletView({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); static const String routeName = "/renameWallet"; diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/spark_info.dart b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/spark_info.dart new file mode 100644 index 000000000..7cb9b91f3 --- /dev/null +++ b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/spark_info.dart @@ -0,0 +1,59 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../../../../db/sqlite/firo_cache.dart'; +import '../../../../themes/stack_colors.dart'; +import '../../../../utilities/text_styles.dart'; +import '../../../../widgets/background.dart'; +import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; +import '../../../../widgets/detail_item.dart'; + +class SparkInfoView extends ConsumerWidget { + const SparkInfoView({ + super.key, + }); + + static const String routeName = "/sparkInfo"; + + @override + Widget build(BuildContext context, WidgetRef ref) { + return Background( + child: Scaffold( + backgroundColor: Theme.of(context).extension()!.background, + appBar: AppBar( + leading: AppBarBackButton( + onPressed: () { + Navigator.of(context).pop(); + }, + ), + title: Text( + "Spark Info", + style: STextStyles.navBarTitle(context), + ), + ), + body: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + FutureBuilder( + future: FiroCacheCoordinator.getSparkCacheSize(), + builder: (_, snapshot) { + String detail = "Loading..."; + if (snapshot.connectionState == ConnectionState.done) { + detail = snapshot.data ?? detail; + } + + return DetailItem( + title: "Spark electrumx cache size", + detail: detail, + ); + }, + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/wallet_settings_wallet_settings_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/wallet_settings_wallet_settings_view.dart index 90e79b216..9c874514e 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/wallet_settings_wallet_settings_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/wallet_settings_wallet_settings_view.dart @@ -10,9 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import '../../../pinpad_views/lock_screen_view.dart'; -import 'delete_wallet_warning_view.dart'; -import 'rename_wallet_view.dart'; + import '../../../../route_generator.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/constants.dart'; @@ -22,12 +20,17 @@ import '../../../../widgets/background.dart'; import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../widgets/rounded_white_container.dart'; import '../../../../widgets/stack_dialog.dart'; +import '../../../pinpad_views/lock_screen_view.dart'; +import 'delete_wallet_warning_view.dart'; +import 'lelantus_settings_view.dart'; +import 'rename_wallet_view.dart'; +import 'spark_info.dart'; class WalletSettingsWalletSettingsView extends ConsumerWidget { const WalletSettingsWalletSettingsView({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); static const String routeName = "/walletSettingsWalletSettings"; @@ -180,6 +183,73 @@ class WalletSettingsWalletSettingsView extends ConsumerWidget { ), ), ), + const SizedBox( + height: 8, + ), + RoundedWhiteContainer( + padding: const EdgeInsets.all(0), + child: RawMaterialButton( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + onPressed: () { + Navigator.of(context).pushNamed( + LelantusSettingsView.routeName, + arguments: walletId, + ); + }, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 12.0, + vertical: 20, + ), + child: Row( + children: [ + Text( + "Lelantus settings", + style: STextStyles.titleBold12(context), + ), + ], + ), + ), + ), + ), + const SizedBox( + height: 8, + ), + RoundedWhiteContainer( + padding: const EdgeInsets.all(0), + child: RawMaterialButton( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + onPressed: () { + Navigator.of(context).pushNamed( + SparkInfoView.routeName, + ); + }, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 12.0, + vertical: 20, + ), + child: Row( + children: [ + Text( + "Spark info", + style: STextStyles.titleBold12(context), + ), + ], + ), + ), + ), + ), ], ), ), diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/xpub_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/xpub_view.dart index c07e6b162..ad245d321 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/xpub_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/xpub_view.dart @@ -15,6 +15,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:qr_flutter/qr_flutter.dart'; + import '../../../../notifications/show_flush_bar.dart'; import '../../../../providers/global/wallets_provider.dart'; import '../../../../themes/stack_colors.dart'; @@ -35,10 +36,10 @@ import '../../../../widgets/rounded_white_container.dart'; class XPubView extends ConsumerStatefulWidget { const XPubView({ - Key? key, + super.key, required this.walletId, this.clipboardInterface = const ClipboardWrapper(), - }) : super(key: key); + }); final String walletId; final ClipboardInterface clipboardInterface; @@ -73,12 +74,14 @@ class _XPubViewState extends ConsumerState { Future _copy() async { await _clipboardInterface.setData(ClipboardData(text: xpub!)); if (mounted) { - unawaited(showFloatingFlushBar( - type: FlushBarType.info, - message: "Copied to clipboard", - iconAsset: Assets.svg.copy, - context: context, - )); + unawaited( + showFloatingFlushBar( + type: FlushBarType.info, + message: "Copied to clipboard", + iconAsset: Assets.svg.copy, + context: context, + ), + ); } } @@ -230,11 +233,11 @@ class _XPubViewState extends ConsumerState { class _XPub extends StatelessWidget { const _XPub({ - Key? key, + super.key, required this.xpub, required this.height, this.clipboardInterface = const ClipboardWrapper(), - }) : super(key: key); + }); final String xpub; final double height; diff --git a/lib/pages/special/firo_rescan_recovery_error_dialog.dart b/lib/pages/special/firo_rescan_recovery_error_dialog.dart index fa6b3ff1d..3a80b0b85 100644 --- a/lib/pages/special/firo_rescan_recovery_error_dialog.dart +++ b/lib/pages/special/firo_rescan_recovery_error_dialog.dart @@ -1,9 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import '../pinpad_views/lock_screen_view.dart'; -import '../settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart'; -import '../settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_warning_view.dart'; + import '../../pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_delete_wallet_dialog.dart'; import '../../pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart'; import '../../providers/global/wallets_provider.dart'; @@ -23,6 +21,9 @@ import '../../widgets/desktop/desktop_scaffold.dart'; import '../../widgets/desktop/primary_button.dart'; import '../../widgets/desktop/secondary_button.dart'; import '../../widgets/stack_dialog.dart'; +import '../pinpad_views/lock_screen_view.dart'; +import '../settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart'; +import '../settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_warning_view.dart'; enum FiroRescanRecoveryErrorViewOption { retry, @@ -149,9 +150,10 @@ class _FiroRescanRecoveryErrorViewState child: Text( "Cancel", style: STextStyles.button(context).copyWith( - color: Theme.of(context) - .extension()! - .accentColorDark), + color: Theme.of(context) + .extension()! + .accentColorDark, + ), ), ), rightButton: TextButton( @@ -179,7 +181,8 @@ class _FiroRescanRecoveryErrorViewState "Delete wallet", ), settings: const RouteSettings( - name: "/deleteWalletLockscreen"), + name: "/deleteWalletLockscreen", + ), ), ); }, @@ -249,7 +252,7 @@ class _FiroRescanRecoveryErrorViewState name: UnlockWalletKeysDesktop.routeName, arguments: widget.walletId, ), - ) + ), ]; }, ), @@ -281,7 +284,8 @@ class _FiroRescanRecoveryErrorViewState "View recovery phrase", ), settings: const RouteSettings( - name: "/viewRecoverPhraseLockscreen"), + name: "/viewRecoverPhraseLockscreen", + ), ), ); } diff --git a/lib/pages/stack_privacy_calls.dart b/lib/pages/stack_privacy_calls.dart index ad95b3903..52b5323c6 100644 --- a/lib/pages/stack_privacy_calls.dart +++ b/lib/pages/stack_privacy_calls.dart @@ -14,8 +14,8 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../db/hive/db.dart'; -import 'pinpad_views/create_pin_view.dart'; import '../pages_desktop_specific/password/create_password_view.dart'; import '../providers/global/prefs_provider.dart'; import '../providers/global/price_provider.dart'; @@ -32,12 +32,13 @@ import '../widgets/desktop/desktop_app_bar.dart'; import '../widgets/desktop/desktop_scaffold.dart'; import '../widgets/desktop/primary_button.dart'; import '../widgets/rounded_white_container.dart'; +import 'pinpad_views/create_pin_view.dart'; class StackPrivacyCalls extends ConsumerStatefulWidget { const StackPrivacyCalls({ - Key? key, + super.key, required this.isSettings, - }) : super(key: key); + }); final bool isSettings; @@ -154,7 +155,8 @@ class _StackPrivacyCalls extends ConsumerState { text: TextSpan( style: isDesktop ? STextStyles.desktopTextExtraExtraSmall( - context) + context, + ) : STextStyles.label(context).copyWith( fontSize: 12.0, ), @@ -162,18 +164,21 @@ class _StackPrivacyCalls extends ConsumerState { ? [ if (Constants.enableExchange) const TextSpan( - text: - "Exchange data preloaded for a seamless experience.\n\n"), - const TextSpan( text: - "CoinGecko enabled: (24 hour price change shown in-app, total wallet value shown in USD or other currency).\n\n"), + "Exchange data preloaded for a seamless experience.\n\n", + ), + const TextSpan( + text: + "CoinGecko enabled: (24 hour price change shown in-app, total wallet value shown in USD or other currency).\n\n", + ), TextSpan( text: "Recommended for most crypto users.", style: isDesktop ? STextStyles .desktopTextExtraExtraSmall600( - context) + context, + ) : TextStyle( color: Theme.of(context) .extension()! @@ -185,18 +190,21 @@ class _StackPrivacyCalls extends ConsumerState { : [ if (Constants.enableExchange) const TextSpan( - text: - "Exchange data not preloaded (slower experience).\n\n"), - const TextSpan( text: - "CoinGecko disabled (price changes not shown, no wallet value shown in other currencies).\n\n"), + "Exchange data not preloaded (slower experience).\n\n", + ), + const TextSpan( + text: + "CoinGecko disabled (price changes not shown, no wallet value shown in other currencies).\n\n", + ), TextSpan( text: "Recommended for the privacy conscious.", style: isDesktop ? STextStyles .desktopTextExtraExtraSmall600( - context) + context, + ) : TextStyle( color: Theme.of(context) .extension()! @@ -239,9 +247,10 @@ class _StackPrivacyCalls extends ConsumerState { DB.instance .put( - boxName: DB.boxNamePrefs, - key: "externalCalls", - value: isEasy) + boxName: DB.boxNamePrefs, + key: "externalCalls", + value: isEasy, + ) .then((_) { if (isEasy) { unawaited( @@ -290,10 +299,10 @@ class _StackPrivacyCalls extends ConsumerState { class PrivacyToggle extends ConsumerStatefulWidget { const PrivacyToggle({ - Key? key, + super.key, required this.externalCallsEnabled, this.onChanged, - }) : super(key: key); + }); final bool externalCallsEnabled; final void Function(bool)? onChanged; diff --git a/lib/pages/token_view/my_tokens_view.dart b/lib/pages/token_view/my_tokens_view.dart index a8b39c9d2..eef37ced9 100644 --- a/lib/pages/token_view/my_tokens_view.dart +++ b/lib/pages/token_view/my_tokens_view.dart @@ -30,9 +30,9 @@ import '../../widgets/textfield_icon_button.dart'; class MyTokensView extends ConsumerStatefulWidget { const MyTokensView({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); static const String routeName = "/myTokens"; final String walletId; diff --git a/lib/pages/token_view/sub_widgets/my_token_select_item.dart b/lib/pages/token_view/sub_widgets/my_token_select_item.dart index 8d8ef8711..4f1eec6d1 100644 --- a/lib/pages/token_view/sub_widgets/my_token_select_item.dart +++ b/lib/pages/token_view/sub_widgets/my_token_select_item.dart @@ -12,8 +12,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../models/isar/models/ethereum/eth_contract.dart'; -import '../token_view.dart'; import '../../../pages_desktop_specific/my_stack_view/wallet_view/desktop_token_view.dart'; import '../../../providers/db/main_db_provider.dart'; import '../../../providers/providers.dart'; @@ -24,7 +24,6 @@ import '../../../utilities/constants.dart'; import '../../../utilities/show_loading.dart'; import '../../../utilities/text_styles.dart'; import '../../../utilities/util.dart'; -import '../../../wallets/crypto_currency/coins/ethereum.dart'; import '../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../wallets/isar/providers/eth/current_token_wallet_provider.dart'; import '../../../wallets/isar/providers/eth/token_balance_provider.dart'; @@ -36,13 +35,14 @@ import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/dialogs/basic_dialog.dart'; import '../../../widgets/icon_widgets/eth_token_icon.dart'; import '../../../widgets/rounded_white_container.dart'; +import '../token_view.dart'; class MyTokenSelectItem extends ConsumerStatefulWidget { const MyTokenSelectItem({ - Key? key, + super.key, required this.walletId, required this.token, - }) : super(key: key); + }); final String walletId; final EthContract token; @@ -124,7 +124,9 @@ class _MyTokenSelectItemState extends ConsumerState { if (mounted) { final address = ref.read(pWalletReceivingAddress(widget.walletId)); await cachedBalance.fetchAndUpdateCachedBalance( - address, ref.read(mainDBProvider)); + address, + ref.read(mainDBProvider), + ); if (mounted) { setState(() {}); } @@ -180,16 +182,22 @@ class _MyTokenSelectItemState extends ConsumerState { const Spacer(), Text( ref - .watch(pAmountFormatter( - Ethereum(CryptoCurrencyNetwork.main))) + .watch( + pAmountFormatter( + Ethereum(CryptoCurrencyNetwork.main), + ), + ) .format( ref - .watch(pTokenBalance( - ( - walletId: widget.walletId, - contractAddress: widget.token.address + .watch( + pTokenBalance( + ( + walletId: widget.walletId, + contractAddress: + widget.token.address + ), ), - )) + ) .total, ethContract: widget.token, ), @@ -213,7 +221,8 @@ class _MyTokenSelectItemState extends ConsumerState { widget.token.symbol, style: isDesktop ? STextStyles.desktopTextExtraExtraSmall( - context) + context, + ) : STextStyles.itemSubtitle(context), ), const Spacer(), @@ -233,7 +242,8 @@ class _MyTokenSelectItemState extends ConsumerState { )}", style: isDesktop ? STextStyles.desktopTextExtraExtraSmall( - context) + context, + ) : STextStyles.itemSubtitle(context), ), ], diff --git a/lib/pages/token_view/sub_widgets/my_tokens_list.dart b/lib/pages/token_view/sub_widgets/my_tokens_list.dart index d6c26529d..f6ef70c38 100644 --- a/lib/pages/token_view/sub_widgets/my_tokens_list.dart +++ b/lib/pages/token_view/sub_widgets/my_tokens_list.dart @@ -11,18 +11,19 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; + import '../../../db/isar/main_db.dart'; import '../../../models/isar/models/ethereum/eth_contract.dart'; -import 'my_token_select_item.dart'; import '../../../utilities/util.dart'; +import 'my_token_select_item.dart'; class MyTokensList extends StatelessWidget { const MyTokensList({ - Key? key, + super.key, required this.walletId, required this.searchTerm, required this.tokenContracts, - }) : super(key: key); + }); final String walletId; final String searchTerm; @@ -39,7 +40,9 @@ class MyTokensList extends StatelessWidget { .getEthContracts() .filter() .anyOf( - tokenContracts, (q, e) => q.addressEqualTo(e)) + tokenContracts, + (q, e) => q.addressEqualTo(e), + ) .and() .group( (q) => q @@ -57,7 +60,9 @@ class MyTokensList extends StatelessWidget { .getEthContracts() .filter() .anyOf( - tokenContracts, (q, e) => q.addressEqualTo(e)) + tokenContracts, + (q, e) => q.addressEqualTo(e), + ) .findAllSync(); } diff --git a/lib/pages/token_view/sub_widgets/no_tokens_found.dart b/lib/pages/token_view/sub_widgets/no_tokens_found.dart index 5b7853c39..30e7b6bfb 100644 --- a/lib/pages/token_view/sub_widgets/no_tokens_found.dart +++ b/lib/pages/token_view/sub_widgets/no_tokens_found.dart @@ -13,7 +13,7 @@ import '../../../utilities/text_styles.dart'; import '../../../widgets/rounded_white_container.dart'; class NoTokensFound extends StatelessWidget { - const NoTokensFound({Key? key}) : super(key: key); + const NoTokensFound({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/pages/token_view/sub_widgets/token_summary.dart b/lib/pages/token_view/sub_widgets/token_summary.dart index 30f72920d..d20662eb4 100644 --- a/lib/pages/token_view/sub_widgets/token_summary.dart +++ b/lib/pages/token_view/sub_widgets/token_summary.dart @@ -31,7 +31,6 @@ import '../../../utilities/amount/amount_formatter.dart'; import '../../../utilities/assets.dart'; import '../../../utilities/constants.dart'; import '../../../utilities/text_styles.dart'; -import '../../../wallets/crypto_currency/coins/ethereum.dart'; import '../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../wallets/isar/providers/eth/current_token_wallet_provider.dart'; import '../../../wallets/isar/providers/eth/token_balance_provider.dart'; @@ -361,9 +360,9 @@ class TokenOptionsButton extends StatelessWidget { class CoinTickerTag extends ConsumerWidget { const CoinTickerTag({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; diff --git a/lib/pages/token_view/sub_widgets/token_transaction_list_widget.dart b/lib/pages/token_view/sub_widgets/token_transaction_list_widget.dart index 45f0921f8..657a5283a 100644 --- a/lib/pages/token_view/sub_widgets/token_transaction_list_widget.dart +++ b/lib/pages/token_view/sub_widgets/token_transaction_list_widget.dart @@ -26,9 +26,9 @@ import '../../../widgets/loading_indicator.dart'; class TokenTransactionsList extends ConsumerStatefulWidget { const TokenTransactionsList({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; @@ -81,7 +81,7 @@ class _TransactionsListState extends ConsumerState { IndexWhereClause.equalTo( indexName: 'walletId', value: [widget.walletId], - ) + ), ], filter: ref.read(pCurrentTokenWallet)!.transactionFilterOperation, sortBy: [ diff --git a/lib/pages/token_view/token_contract_details_view.dart b/lib/pages/token_view/token_contract_details_view.dart index 4553ca537..08e82e0ae 100644 --- a/lib/pages/token_view/token_contract_details_view.dart +++ b/lib/pages/token_view/token_contract_details_view.dart @@ -24,10 +24,10 @@ import '../../widgets/rounded_white_container.dart'; class TokenContractDetailsView extends ConsumerStatefulWidget { const TokenContractDetailsView({ - Key? key, + super.key, required this.contractAddress, required this.walletId, - }) : super(key: key); + }); static const String routeName = "/tokenContractDetailsView"; @@ -154,11 +154,11 @@ class _TokenContractDetailsViewState class _Item extends StatelessWidget { const _Item({ - Key? key, + super.key, required this.title, required this.data, required this.button, - }) : super(key: key); + }); final String title; final String data; diff --git a/lib/pages/token_view/token_view.dart b/lib/pages/token_view/token_view.dart index c8cbd0e87..b6acc49c5 100644 --- a/lib/pages/token_view/token_view.dart +++ b/lib/pages/token_view/token_view.dart @@ -12,10 +12,8 @@ import 'package:event_bus/event_bus.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'sub_widgets/token_summary.dart'; -import 'sub_widgets/token_transaction_list_widget.dart'; -import 'token_contract_details_view.dart'; -import '../wallet_view/transaction_views/tx_v2/all_transactions_v2_view.dart'; +import 'package:tuple/tuple.dart'; + import '../../services/event_bus/events/global/wallet_sync_status_changed_event.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/assets.dart'; @@ -26,16 +24,19 @@ import '../../widgets/background.dart'; import '../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../widgets/custom_buttons/blue_text_button.dart'; import '../../widgets/icon_widgets/eth_token_icon.dart'; -import 'package:tuple/tuple.dart'; +import '../wallet_view/transaction_views/tx_v2/all_transactions_v2_view.dart'; +import 'sub_widgets/token_summary.dart'; +import 'sub_widgets/token_transaction_list_widget.dart'; +import 'token_contract_details_view.dart'; /// [eventBus] should only be set during testing class TokenView extends ConsumerStatefulWidget { const TokenView({ - Key? key, + super.key, required this.walletId, this.popPrevious = false, this.eventBus, - }) : super(key: key); + }); static const String routeName = "/token"; @@ -112,8 +113,10 @@ class _TokenViewState extends ConsumerState { ), Flexible( child: Text( - ref.watch(pCurrentTokenWallet - .select((value) => value!.tokenContract.name)), + ref.watch( + pCurrentTokenWallet + .select((value) => value!.tokenContract.name), + ), style: STextStyles.navBarTitle(context), overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, @@ -141,8 +144,10 @@ class _TokenViewState extends ConsumerState { Navigator.of(context).pushNamed( TokenContractDetailsView.routeName, arguments: Tuple2( - ref.watch(pCurrentTokenWallet - .select((value) => value!.tokenContract.address)), + ref.watch( + pCurrentTokenWallet.select( + (value) => value!.tokenContract.address), + ), widget.walletId, ), ); diff --git a/lib/pages/wallet_view/sub_widgets/no_transactions_found.dart b/lib/pages/wallet_view/sub_widgets/no_transactions_found.dart index fff5ebf16..8be6fc5ad 100644 --- a/lib/pages/wallet_view/sub_widgets/no_transactions_found.dart +++ b/lib/pages/wallet_view/sub_widgets/no_transactions_found.dart @@ -13,7 +13,7 @@ import '../../../utilities/text_styles.dart'; import '../../../widgets/rounded_white_container.dart'; class NoTransActionsFound extends StatelessWidget { - const NoTransActionsFound({Key? key}) : super(key: key); + const NoTransActionsFound({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/pages/wallet_view/sub_widgets/transactions_list.dart b/lib/pages/wallet_view/sub_widgets/transactions_list.dart index db97ebcea..8e2fb5cb6 100644 --- a/lib/pages/wallet_view/sub_widgets/transactions_list.dart +++ b/lib/pages/wallet_view/sub_widgets/transactions_list.dart @@ -13,10 +13,9 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; +import 'package:tuple/tuple.dart'; + import '../../../models/isar/models/isar_models.dart'; -import '../../exchange_view/trade_details_view.dart'; -import 'no_transactions_found.dart'; -import '../wallet_view.dart'; import '../../../providers/db/main_db_provider.dart'; import '../../../providers/global/trades_service_provider.dart'; import '../../../providers/global/wallets_provider.dart'; @@ -32,7 +31,9 @@ import '../../../widgets/desktop/desktop_dialog_close_button.dart'; import '../../../widgets/loading_indicator.dart'; import '../../../widgets/trade_card.dart'; import '../../../widgets/transaction_card.dart'; -import 'package:tuple/tuple.dart'; +import '../../exchange_view/trade_details_view.dart'; +import '../wallet_view.dart'; +import 'no_transactions_found.dart'; class TransactionsList extends ConsumerStatefulWidget { const TransactionsList({ @@ -106,10 +107,12 @@ class _TransactionsListState extends ConsumerState { ), TradeCard( // this may mess with combined firo transactions - key: Key(tx.txid + - tx.type.name + - tx.address.value.toString() + - trade.uuid), // + key: Key( + tx.txid + + tx.type.name + + tx.address.value.toString() + + trade.uuid, + ), // trade: trade, onTap: () async { final walletName = ref.read(pWalletName(widget.walletId)); @@ -184,7 +187,7 @@ class _TransactionsListState extends ConsumerState { ); } }, - ) + ), ], ), ); diff --git a/lib/pages/wallet_view/sub_widgets/wallet_balance_toggle_sheet.dart b/lib/pages/wallet_view/sub_widgets/wallet_balance_toggle_sheet.dart index d94e183ec..c2fc747ad 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_balance_toggle_sheet.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_balance_toggle_sheet.dart @@ -19,7 +19,6 @@ import '../../../utilities/amount/amount_formatter.dart'; import '../../../utilities/constants.dart'; import '../../../utilities/enums/wallet_balance_toggle_state.dart'; import '../../../utilities/text_styles.dart'; -import '../../../wallets/crypto_currency/coins/firo.dart'; import '../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../wallets/isar/providers/wallet_info_provider.dart'; @@ -360,7 +359,7 @@ class BalanceSelector extends ConsumerWidget { .extension()! .textSubtitle1, ), - ) + ), ], ), ], diff --git a/lib/pages/wallet_view/sub_widgets/wallet_navigation_bar.dart b/lib/pages/wallet_view/sub_widgets/wallet_navigation_bar.dart index 05e39c079..a022be588 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_navigation_bar.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_navigation_bar.dart @@ -7,5 +7,3 @@ * Generated by Cypher Stack on 2023-05-26 * */ - - diff --git a/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart b/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart index b9f8c4ca1..6e98f4a3f 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart @@ -13,6 +13,7 @@ import 'dart:async'; import 'package:event_bus/event_bus.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../providers/global/wallets_provider.dart'; import '../../../services/event_bus/events/global/wallet_sync_status_changed_event.dart'; import '../../../services/event_bus/global_event_bus.dart'; @@ -25,14 +26,14 @@ import '../../../widgets/animated_widgets/rotating_arrows.dart'; /// [eventBus] should only be set during testing class WalletRefreshButton extends ConsumerStatefulWidget { const WalletRefreshButton({ - Key? key, + super.key, required this.walletId, required this.initialSyncStatus, this.tokenContractAddress, this.onPressed, this.eventBus, this.overrideIconColor, - }) : super(key: key); + }); final String walletId; final WalletSyncStatus initialSyncStatus; @@ -99,59 +100,57 @@ class _RefreshButtonState extends ConsumerState { final isDesktop = Util.isDesktop; return SizedBox( - height: isDesktop ? 22 : 36, - width: isDesktop ? 22 : 36, - child: Semantics( - label: "Refresh Button. Refreshes The Values In Summary.", - excludeSemantics: true, - child: MaterialButton( - color: isDesktop - ? Theme.of(context) - .extension()! - .buttonBackSecondary - : null, - splashColor: Theme.of(context).extension()!.highlight, - onPressed: () { - if (widget.tokenContractAddress == null) { - final wallet = ref.read(pWallets).getWallet(widget.walletId); - final isRefreshing = wallet.refreshMutex.isLocked; - if (!isRefreshing) { - _spinController.repeat?.call(); - wallet.refresh().then((_) => _spinController.stop?.call()); - } - } else { - if (!ref.read(pCurrentTokenWallet)!.refreshMutex.isLocked) { - ref.read(pCurrentTokenWallet)!.refresh(); - } + height: isDesktop ? 22 : 36, + width: isDesktop ? 22 : 36, + child: Semantics( + label: "Refresh Button. Refreshes The Values In Summary.", + excludeSemantics: true, + child: MaterialButton( + color: isDesktop + ? Theme.of(context).extension()!.buttonBackSecondary + : null, + splashColor: Theme.of(context).extension()!.highlight, + onPressed: () { + if (widget.tokenContractAddress == null) { + final wallet = ref.read(pWallets).getWallet(widget.walletId); + final isRefreshing = wallet.refreshMutex.isLocked; + if (!isRefreshing) { + _spinController.repeat?.call(); + wallet.refresh().then((_) => _spinController.stop?.call()); } - }, - elevation: 0, - highlightElevation: 0, - hoverElevation: 0, - padding: EdgeInsets.zero, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - ), - child: RotatingArrows( - spinByDefault: - widget.initialSyncStatus == WalletSyncStatus.syncing, - width: isDesktop ? 12 : 24, - height: isDesktop ? 12 : 24, - controller: _spinController, - color: widget.overrideIconColor != null - ? widget.overrideIconColor! - : isDesktop - ? Theme.of(context) - .extension()! - .textFieldDefaultSearchIconRight - : Theme.of(context) - .extension()! - .textFavoriteCard, + } else { + if (!ref.read(pCurrentTokenWallet)!.refreshMutex.isLocked) { + ref.read(pCurrentTokenWallet)!.refresh(); + } + } + }, + elevation: 0, + highlightElevation: 0, + hoverElevation: 0, + padding: EdgeInsets.zero, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, ), ), - )); + child: RotatingArrows( + spinByDefault: widget.initialSyncStatus == WalletSyncStatus.syncing, + width: isDesktop ? 12 : 24, + height: isDesktop ? 12 : 24, + controller: _spinController, + color: widget.overrideIconColor != null + ? widget.overrideIconColor! + : isDesktop + ? Theme.of(context) + .extension()! + .textFieldDefaultSearchIconRight + : Theme.of(context) + .extension()! + .textFavoriteCard, + ), + ), + ), + ); } } diff --git a/lib/pages/wallet_view/transaction_views/all_transactions_view.dart b/lib/pages/wallet_view/transaction_views/all_transactions_view.dart index e946cf6d5..232e3ee2c 100644 --- a/lib/pages/wallet_view/transaction_views/all_transactions_view.dart +++ b/lib/pages/wallet_view/transaction_views/all_transactions_view.dart @@ -14,14 +14,13 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; +import 'package:tuple/tuple.dart'; + import '../../../models/isar/models/blockchain_data/transaction.dart'; import '../../../models/isar/models/contact_entry.dart'; import '../../../models/isar/models/transaction_note.dart'; import '../../../models/transaction_filter.dart'; import '../../../notifications/show_flush_bar.dart'; -import '../sub_widgets/tx_icon.dart'; -import 'transaction_details_view.dart'; -import 'transaction_search_filter_view.dart'; import '../../../providers/db/main_db_provider.dart'; import '../../../providers/global/address_book_service_provider.dart'; import '../../../providers/providers.dart'; @@ -34,7 +33,6 @@ import '../../../utilities/constants.dart'; import '../../../utilities/format.dart'; import '../../../utilities/text_styles.dart'; import '../../../utilities/util.dart'; -import '../../../wallets/crypto_currency/coins/epiccash.dart'; import '../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../wallets/isar/providers/wallet_info_provider.dart'; import '../../../widgets/conditional_parent.dart'; @@ -49,7 +47,9 @@ import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/stack_text_field.dart'; import '../../../widgets/textfield_icon_button.dart'; import '../../../widgets/transaction_card.dart'; -import 'package:tuple/tuple.dart'; +import '../sub_widgets/tx_icon.dart'; +import 'transaction_details_view.dart'; +import 'transaction_search_filter_view.dart'; typedef _GroupedTransactions = ({ String label, @@ -94,8 +94,10 @@ class _TransactionDetailsViewState extends ConsumerState { } // TODO: optimise search+filter - List filter( - {required List transactions, TransactionFilter? filter}) { + List filter({ + required List transactions, + TransactionFilter? filter, + }) { if (filter == null) { return transactions; } @@ -147,8 +149,12 @@ class _TransactionDetailsViewState extends ConsumerState { }).toList(); } - bool _isKeywordMatch(Transaction tx, String keyword, - List contacts, List notes) { + bool _isKeywordMatch( + Transaction tx, + String keyword, + List contacts, + List notes, + ) { if (keyword.isEmpty) { return true; } @@ -157,11 +163,13 @@ class _TransactionDetailsViewState extends ConsumerState { // check if address book name contains contains |= contacts - .where((e) => - e.addresses - .where((a) => a.address == tx.address.value?.value) - .isNotEmpty && - e.name.toLowerCase().contains(keyword)) + .where( + (e) => + e.addresses + .where((a) => a.address == tx.address.value?.value) + .isNotEmpty && + e.name.toLowerCase().contains(keyword), + ) .isNotEmpty; // check if address contains @@ -218,9 +226,9 @@ class _TransactionDetailsViewState extends ConsumerState { List<_GroupedTransactions> groupTransactionsByMonth( List transactions, ) { - Map map = {}; + final Map map = {}; - for (var tx in transactions) { + for (final tx in transactions) { final date = DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000); final monthYear = "${Constants.monthMap[date.month]} ${date.year}"; if (map[monthYear] == null) { @@ -285,7 +293,8 @@ class _TransactionDetailsViewState extends ConsumerState { if (FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( - const Duration(milliseconds: 75)); + const Duration(milliseconds: 75), + ); } if (mounted) { Navigator.of(context).pop(); @@ -486,39 +495,45 @@ class _TransactionDetailsViewState extends ConsumerState { ref.watch(transactionFilterProvider.state).state; return FutureBuilder( - future: ref.watch(mainDBProvider).isar.transactions.buildQuery< - Transaction>( - whereClauses: [ - IndexWhereClause.equalTo( - indexName: 'walletId', - value: [widget.walletId], - ) - ], - // TODO: [prio=med] add filters to wallet or cryptocurrency class - // eth tokens should all be on v2 txn now so this should not be needed here - // filter: widget.contractAddress != null - // ? FilterGroup.and([ - // FilterCondition.equalTo( - // property: r"contractAddress", - // value: widget.contractAddress!, - // ), - // const FilterCondition.equalTo( - // property: r"subType", - // value: TransactionSubType.ethToken, - // ), - // ]) - // : null, - sortBy: [ - const SortProperty( - property: "timestamp", - sort: Sort.desc, - ), - ]).findAll(), + future: ref + .watch(mainDBProvider) + .isar + .transactions + .buildQuery( + whereClauses: [ + IndexWhereClause.equalTo( + indexName: 'walletId', + value: [widget.walletId], + ), + ], + // TODO: [prio=med] add filters to wallet or cryptocurrency class + // eth tokens should all be on v2 txn now so this should not be needed here + // filter: widget.contractAddress != null + // ? FilterGroup.and([ + // FilterCondition.equalTo( + // property: r"contractAddress", + // value: widget.contractAddress!, + // ), + // const FilterCondition.equalTo( + // property: r"subType", + // value: TransactionSubType.ethToken, + // ), + // ]) + // : null, + sortBy: [ + const SortProperty( + property: "timestamp", + sort: Sort.desc, + ), + ], + ).findAll(), builder: (_, AsyncSnapshot> snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { final filtered = filter( - transactions: snapshot.data!, filter: criteria); + transactions: snapshot.data!, + filter: criteria, + ); final searched = search(_searchString, filtered); searched.sort((a, b) { @@ -570,7 +585,8 @@ class _TransactionDetailsViewState extends ConsumerState { padding: const EdgeInsets.all(4), child: DesktopTransactionCardRow( key: Key( - "transactionCard_key_${month.transactions[index].txid}"), + "transactionCard_key_${month.transactions[index].txid}", + ), transaction: month.transactions[index], walletId: walletId, @@ -586,7 +602,8 @@ class _TransactionDetailsViewState extends ConsumerState { ...month.transactions.map( (tx) => TransactionCard( key: Key( - "transactionCard_key_${tx.txid}"), + "transactionCard_key_${tx.txid}", + ), transaction: tx, walletId: walletId, ), @@ -616,7 +633,7 @@ class _TransactionDetailsViewState extends ConsumerState { } class TransactionFilterOptionBar extends ConsumerStatefulWidget { - const TransactionFilterOptionBar({Key? key}) : super(key: key); + const TransactionFilterOptionBar({super.key}); @override ConsumerState createState() => @@ -774,10 +791,10 @@ class _TransactionFilterOptionBarState class TransactionFilterOptionBarItem extends StatelessWidget { const TransactionFilterOptionBarItem({ - Key? key, + super.key, required this.label, this.onPressed, - }) : super(key: key); + }); final String label; final void Function(String)? onPressed; @@ -789,9 +806,10 @@ class TransactionFilterOptionBarItem extends StatelessWidget { child: Container( height: 32, decoration: BoxDecoration( - color: - Theme.of(context).extension()!.buttonBackSecondary, - borderRadius: BorderRadius.circular(1000)), + color: + Theme.of(context).extension()!.buttonBackSecondary, + borderRadius: BorderRadius.circular(1000), + ), child: Padding( padding: const EdgeInsets.symmetric( horizontal: 14, @@ -894,7 +912,8 @@ class _DesktopTransactionCardRowState @override Widget build(BuildContext context) { final locale = ref.watch( - localeServiceChangeNotifierProvider.select((value) => value.locale)); + localeServiceChangeNotifierProvider.select((value) => value.locale), + ); final baseCurrency = ref .watch(prefsChangeNotifierProvider.select((value) => value.currency)); @@ -902,8 +921,10 @@ class _DesktopTransactionCardRowState final coin = ref.watch(pWalletCoin(walletId)); final price = ref - .watch(priceAnd24hChangeNotifierProvider - .select((value) => value.getPrice(coin))) + .watch( + priceAnd24hChangeNotifierProvider + .select((value) => value.getPrice(coin)), + ) .item1; late final String prefix; @@ -1028,8 +1049,10 @@ class _DesktopTransactionCardRowState }, ), ), - if (ref.watch(prefsChangeNotifierProvider - .select((value) => value.externalCalls))) + if (ref.watch( + prefsChangeNotifierProvider + .select((value) => value.externalCalls), + )) Expanded( flex: 4, child: Builder( diff --git a/lib/pages/wallet_view/transaction_views/dialogs/cancelling_transaction_progress_dialog.dart b/lib/pages/wallet_view/transaction_views/dialogs/cancelling_transaction_progress_dialog.dart index 0039dc5bb..f1824d17e 100644 --- a/lib/pages/wallet_view/transaction_views/dialogs/cancelling_transaction_progress_dialog.dart +++ b/lib/pages/wallet_view/transaction_views/dialogs/cancelling_transaction_progress_dialog.dart @@ -13,7 +13,7 @@ import '../../../../widgets/animated_widgets/rotating_arrows.dart'; import '../../../../widgets/stack_dialog.dart'; class CancellingTransactionProgressDialog extends StatefulWidget { - const CancellingTransactionProgressDialog({Key? key}) : super(key: key); + const CancellingTransactionProgressDialog({super.key}); @override State createState() => diff --git a/lib/pages/wallet_view/transaction_views/edit_note_view.dart b/lib/pages/wallet_view/transaction_views/edit_note_view.dart index ccae6c3fc..4d0c584eb 100644 --- a/lib/pages/wallet_view/transaction_views/edit_note_view.dart +++ b/lib/pages/wallet_view/transaction_views/edit_note_view.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../models/isar/models/transaction_note.dart'; import '../../../providers/db/main_db_provider.dart'; import '../../../providers/providers.dart'; @@ -28,10 +29,10 @@ import '../../../widgets/textfield_icon_button.dart'; class EditNoteView extends ConsumerStatefulWidget { const EditNoteView({ - Key? key, + super.key, required this.txid, required this.walletId, - }) : super(key: key); + }); static const String routeName = "/editNote"; @@ -92,7 +93,8 @@ class _EditNoteViewState extends ConsumerState { if (FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( - const Duration(milliseconds: 75)); + const Duration(milliseconds: 75), + ); } if (mounted) { Navigator.of(context).pop(); @@ -230,7 +232,7 @@ class _EditNoteViewState extends ConsumerState { "Save", style: STextStyles.button(context), ), - ) + ), ], ), ), @@ -241,9 +243,9 @@ class _EditNoteViewState extends ConsumerState { class MobileEditNoteScaffold extends StatelessWidget { const MobileEditNoteScaffold({ - Key? key, + super.key, required this.child, - }) : super(key: key); + }); final Widget child; diff --git a/lib/pages/wallet_view/transaction_views/transaction_details_view.dart b/lib/pages/wallet_view/transaction_views/transaction_details_view.dart index 38fffe56e..dad531969 100644 --- a/lib/pages/wallet_view/transaction_views/transaction_details_view.dart +++ b/lib/pages/wallet_view/transaction_views/transaction_details_view.dart @@ -36,13 +36,6 @@ import '../../../utilities/format.dart'; import '../../../utilities/logger.dart'; import '../../../utilities/text_styles.dart'; import '../../../utilities/util.dart'; -import '../../../wallets/crypto_currency/coins/bitcoincash.dart'; -import '../../../wallets/crypto_currency/coins/ecash.dart'; -import '../../../wallets/crypto_currency/coins/epiccash.dart'; -import '../../../wallets/crypto_currency/coins/ethereum.dart'; -import '../../../wallets/crypto_currency/coins/firo.dart'; -import '../../../wallets/crypto_currency/coins/monero.dart'; -import '../../../wallets/crypto_currency/coins/wownero.dart'; import '../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../wallets/crypto_currency/intermediate/nano_currency.dart'; import '../../../wallets/isar/providers/wallet_info_provider.dart'; @@ -1071,7 +1064,7 @@ class _TransactionDetailsViewState : const EdgeInsets.all(12), child: Builder( builder: (context) { - String feeString = showFeePending + final String feeString = showFeePending ? _transaction.isConfirmed( currentHeight, minConfirms, @@ -1734,7 +1727,7 @@ class _TransactionDetailsViewState } class _Divider extends StatelessWidget { - const _Divider({Key? key}) : super(key: key); + const _Divider({super.key}); @override Widget build(BuildContext context) { @@ -1747,9 +1740,9 @@ class _Divider extends StatelessWidget { class IconCopyButton extends StatelessWidget { const IconCopyButton({ - Key? key, + super.key, required this.data, - }) : super(key: key); + }); final String data; @@ -1793,9 +1786,9 @@ class IconCopyButton extends StatelessWidget { class IconPencilButton extends StatelessWidget { const IconPencilButton({ - Key? key, + super.key, this.onPressed, - }) : super(key: key); + }); final VoidCallback? onPressed; diff --git a/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart b/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart index 5e4244177..2eebe5dbe 100644 --- a/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart +++ b/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart @@ -12,6 +12,7 @@ import 'package:decimal/decimal.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../models/transaction_filter.dart'; import '../../../providers/global/locale_provider.dart'; import '../../../providers/ui/transaction_filter_provider.dart'; @@ -117,9 +118,10 @@ class _TransactionSearchViewState return Text( isDateSelected ? "From..." : _fromDateString, style: STextStyles.fieldLabel(context).copyWith( - color: isDateSelected - ? Theme.of(context).extension()!.textSubtitle2 - : Theme.of(context).extension()!.accentColorDark), + color: isDateSelected + ? Theme.of(context).extension()!.textSubtitle2 + : Theme.of(context).extension()!.accentColorDark, + ), ); } @@ -128,9 +130,10 @@ class _TransactionSearchViewState return Text( isDateSelected ? "To..." : _toDateString, style: STextStyles.fieldLabel(context).copyWith( - color: isDateSelected - ? Theme.of(context).extension()!.textSubtitle2 - : Theme.of(context).extension()!.accentColorDark), + color: isDateSelected + ? Theme.of(context).extension()!.textSubtitle2 + : Theme.of(context).extension()!.accentColorDark, + ), ); } @@ -173,7 +176,8 @@ class _TransactionSearchViewState !_selectedFromDate!.isBefore(_selectedToDate!); if (flag) { _selectedToDate = DateTime.fromMillisecondsSinceEpoch( - _selectedFromDate!.millisecondsSinceEpoch); + _selectedFromDate!.millisecondsSinceEpoch, + ); } setState(() { @@ -227,7 +231,7 @@ class _TransactionSearchViewState child: FittedBox( child: _dateFromText, ), - ) + ), ], ), ), @@ -263,7 +267,8 @@ class _TransactionSearchViewState !_selectedToDate!.isAfter(_selectedFromDate!); if (flag) { _selectedFromDate = DateTime.fromMillisecondsSinceEpoch( - _selectedToDate!.millisecondsSinceEpoch); + _selectedToDate!.millisecondsSinceEpoch, + ); } setState(() { @@ -317,7 +322,7 @@ class _TransactionSearchViewState child: FittedBox( child: _dateToText, ), - ) + ), ], ), ), @@ -449,7 +454,8 @@ class _TransactionSearchViewState width: 20, child: Checkbox( key: const Key( - "transactionSearchViewSentCheckboxKey"), + "transactionSearchViewSentCheckboxKey", + ), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, value: _isActiveSentCheckbox, @@ -481,7 +487,7 @@ class _TransactionSearchViewState ], ), ), - ) + ), ], ), ), @@ -508,7 +514,8 @@ class _TransactionSearchViewState width: 20, child: Checkbox( key: const Key( - "transactionSearchViewReceivedCheckboxKey"), + "transactionSearchViewReceivedCheckboxKey", + ), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, value: _isActiveReceivedCheckbox, @@ -540,7 +547,7 @@ class _TransactionSearchViewState ], ), ), - ) + ), ], ), ), @@ -567,7 +574,8 @@ class _TransactionSearchViewState width: 20, child: Checkbox( key: const Key( - "transactionSearchViewSentCheckboxKey"), + "transactionSearchViewSentCheckboxKey", + ), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, value: _isActiveTradeCheckbox, @@ -599,7 +607,7 @@ class _TransactionSearchViewState ], ), ), - ) + ), ], ), ), diff --git a/lib/pages/wallet_view/transaction_views/tx_v2/all_transactions_v2_view.dart b/lib/pages/wallet_view/transaction_views/tx_v2/all_transactions_v2_view.dart index e8dfcbc42..24dd77005 100644 --- a/lib/pages/wallet_view/transaction_views/tx_v2/all_transactions_v2_view.dart +++ b/lib/pages/wallet_view/transaction_views/tx_v2/all_transactions_v2_view.dart @@ -625,7 +625,7 @@ class _AllTransactionsV2ViewState extends ConsumerState { } class TransactionFilterOptionBar extends ConsumerStatefulWidget { - const TransactionFilterOptionBar({Key? key}) : super(key: key); + const TransactionFilterOptionBar({super.key}); @override ConsumerState createState() => @@ -783,10 +783,10 @@ class _TransactionFilterOptionBarState class TransactionFilterOptionBarItem extends StatelessWidget { const TransactionFilterOptionBarItem({ - Key? key, + super.key, required this.label, this.onPressed, - }) : super(key: key); + }); final String label; final void Function(String)? onPressed; @@ -841,10 +841,10 @@ class TransactionFilterOptionBarItem extends StatelessWidget { class DesktopTransactionCardRow extends ConsumerStatefulWidget { const DesktopTransactionCardRow({ - Key? key, + super.key, required this.transaction, required this.walletId, - }) : super(key: key); + }); final TransactionV2 transaction; final String walletId; diff --git a/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_card.dart b/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_card.dart index db18d772c..0cce71e0f 100644 --- a/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_card.dart +++ b/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_card.dart @@ -2,10 +2,9 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; import '../../../../models/isar/models/isar_models.dart'; -import '../../sub_widgets/tx_icon.dart'; -import 'transaction_v2_details_view.dart'; import '../../../../providers/db/main_db_provider.dart'; import '../../../../providers/global/locale_provider.dart'; import '../../../../providers/global/prefs_provider.dart'; @@ -18,11 +17,12 @@ import '../../../../utilities/constants.dart'; import '../../../../utilities/format.dart'; import '../../../../utilities/text_styles.dart'; import '../../../../utilities/util.dart'; -import '../../../../wallets/crypto_currency/coins/ethereum.dart'; import '../../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../../wallets/isar/providers/wallet_info_provider.dart'; import '../../../../wallets/wallet/wallet_mixin_interfaces/spark_interface.dart'; import '../../../../widgets/desktop/desktop_dialog.dart'; +import '../../sub_widgets/tx_icon.dart'; +import 'transaction_v2_details_view.dart'; class TransactionCardV2 extends ConsumerStatefulWidget { const TransactionCardV2({ @@ -98,15 +98,20 @@ class _TransactionCardStateV2 extends ConsumerState { @override Widget build(BuildContext context) { final locale = ref.watch( - localeServiceChangeNotifierProvider.select((value) => value.locale)); + localeServiceChangeNotifierProvider.select((value) => value.locale), + ); final baseCurrency = ref .watch(prefsChangeNotifierProvider.select((value) => value.currency)); final price = ref - .watch(priceAnd24hChangeNotifierProvider.select((value) => isTokenTx - ? value.getTokenPrice(tokenContract!.address) - : value.getPrice(coin))) + .watch( + priceAnd24hChangeNotifierProvider.select( + (value) => isTokenTx + ? value.getTokenPrice(tokenContract!.address) + : value.getPrice(coin), + ), + ) .item1; final currentHeight = ref.watch(pWalletChainHeight(walletId)); @@ -117,39 +122,45 @@ class _TransactionCardStateV2 extends ConsumerState { if (_transaction.subType == TransactionSubType.cashFusion) { amount = _transaction.getAmountReceivedInThisWallet( - fractionDigits: fractionDigits); + fractionDigits: fractionDigits, + ); } else { switch (_transaction.type) { case TransactionType.outgoing: amount = _transaction.getAmountSentFromThisWallet( - fractionDigits: fractionDigits); + fractionDigits: fractionDigits, + ); break; case TransactionType.incoming: case TransactionType.sentToSelf: if (_transaction.subType == TransactionSubType.sparkMint) { amount = _transaction.getAmountSparkSelfMinted( - fractionDigits: fractionDigits); + fractionDigits: fractionDigits, + ); } else if (_transaction.subType == TransactionSubType.sparkSpend) { final changeAddress = (ref.watch(pWallets).getWallet(walletId) as SparkInterface) .sparkChangeAddress; amount = Amount( rawValue: _transaction.outputs - .where((e) => - e.walletOwns && !e.addresses.contains(changeAddress)) + .where( + (e) => e.walletOwns && !e.addresses.contains(changeAddress), + ) .fold(BigInt.zero, (p, e) => p + e.value), fractionDigits: coin.fractionDigits, ); } else { amount = _transaction.getAmountReceivedInThisWallet( - fractionDigits: fractionDigits); + fractionDigits: fractionDigits, + ); } break; case TransactionType.unknown: amount = _transaction.getAmountSentFromThisWallet( - fractionDigits: fractionDigits); + fractionDigits: fractionDigits, + ); break; } } @@ -262,13 +273,17 @@ class _TransactionCardStateV2 extends ConsumerState { ), ), ), - if (ref.watch(prefsChangeNotifierProvider - .select((value) => value.externalCalls))) + if (ref.watch( + prefsChangeNotifierProvider + .select((value) => value.externalCalls), + )) const SizedBox( width: 10, ), - if (ref.watch(prefsChangeNotifierProvider - .select((value) => value.externalCalls))) + if (ref.watch( + prefsChangeNotifierProvider + .select((value) => value.externalCalls), + )) Flexible( child: FittedBox( fit: BoxFit.scaleDown, diff --git a/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart b/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart index 3ed6397d6..2780b4033 100644 --- a/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart +++ b/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart @@ -37,12 +37,6 @@ import '../../../../utilities/format.dart'; import '../../../../utilities/logger.dart'; import '../../../../utilities/text_styles.dart'; import '../../../../utilities/util.dart'; -import '../../../../wallets/crypto_currency/coins/bitcoincash.dart'; -import '../../../../wallets/crypto_currency/coins/ecash.dart'; -import '../../../../wallets/crypto_currency/coins/epiccash.dart'; -import '../../../../wallets/crypto_currency/coins/firo.dart'; -import '../../../../wallets/crypto_currency/coins/monero.dart'; -import '../../../../wallets/crypto_currency/coins/wownero.dart'; import '../../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../../wallets/crypto_currency/intermediate/nano_currency.dart'; import '../../../../wallets/isar/models/spark_coin.dart'; @@ -1276,7 +1270,7 @@ class _TransactionV2DetailsViewState : const EdgeInsets.all(12), child: Builder( builder: (context) { - String feeString = showFeePending + final String feeString = showFeePending ? _transaction.isConfirmed( currentHeight, minConfirms, diff --git a/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_list.dart b/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_list.dart index 859285eac..b805cd819 100644 --- a/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_list.dart +++ b/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_list.dart @@ -13,12 +13,9 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; + import '../../../../models/isar/models/blockchain_data/transaction.dart'; import '../../../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; -import '../../sub_widgets/no_transactions_found.dart'; -import 'fusion_tx_group_card.dart'; -import 'transaction_v2_list_item.dart'; -import '../../wallet_view.dart'; import '../../../../providers/db/main_db_provider.dart'; import '../../../../providers/global/wallets_provider.dart'; import '../../../../themes/stack_colors.dart'; @@ -26,12 +23,16 @@ import '../../../../utilities/constants.dart'; import '../../../../utilities/util.dart'; import '../../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../../widgets/loading_indicator.dart'; +import '../../sub_widgets/no_transactions_found.dart'; +import '../../wallet_view.dart'; +import 'fusion_tx_group_card.dart'; +import 'transaction_v2_list_item.dart'; class TransactionsV2List extends ConsumerStatefulWidget { const TransactionsV2List({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; @@ -72,27 +73,25 @@ class _TransactionsV2ListState extends ConsumerState { @override void initState() { coin = ref.read(pWallets).getWallet(widget.walletId).info.coin; - _query = ref - .read(mainDBProvider) - .isar - .transactionV2s - .buildQuery( - whereClauses: [ - IndexWhereClause.equalTo( - indexName: 'walletId', - value: [widget.walletId], - ) - ], - filter: ref - .read(pWallets) - .getWallet(widget.walletId) - .transactionFilterOperation, - sortBy: [ - const SortProperty( - property: "timestamp", - sort: Sort.desc, - ), - ]); + _query = + ref.read(mainDBProvider).isar.transactionV2s.buildQuery( + whereClauses: [ + IndexWhereClause.equalTo( + indexName: 'walletId', + value: [widget.walletId], + ), + ], + filter: ref + .read(pWallets) + .getWallet(widget.walletId) + .transactionFilterOperation, + sortBy: [ + const SortProperty( + property: "timestamp", + sort: Sort.desc, + ), + ], + ); _subscription = _query.watch().listen((event) { WidgetsBinding.instance.addPostFrameCallback((_) { @@ -158,7 +157,8 @@ class _TransactionsV2ListState extends ConsumerState { if (tx.subType == TransactionSubType.cashFusion) { if (fusions.isNotEmpty) { final prevTime = DateTime.fromMillisecondsSinceEpoch( - fusions.last.timestamp * 1000); + fusions.last.timestamp * 1000, + ); final thisTime = DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000); diff --git a/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_list_item.dart b/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_list_item.dart index ccaae32cc..f51c9f609 100644 --- a/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_list_item.dart +++ b/lib/pages/wallet_view/transaction_views/tx_v2/transaction_v2_list_item.dart @@ -2,11 +2,10 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:tuple/tuple.dart'; + import '../../../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; import '../../../../models/isar/models/isar_models.dart'; -import '../../../exchange_view/trade_details_view.dart'; -import 'fusion_tx_group_card.dart'; -import 'transaction_v2_card.dart'; import '../../../../providers/global/trades_service_provider.dart'; import '../../../../route_generator.dart'; import '../../../../themes/stack_colors.dart'; @@ -17,7 +16,9 @@ import '../../../../wallets/isar/providers/wallet_info_provider.dart'; import '../../../../widgets/desktop/desktop_dialog.dart'; import '../../../../widgets/desktop/desktop_dialog_close_button.dart'; import '../../../../widgets/trade_card.dart'; -import 'package:tuple/tuple.dart'; +import '../../../exchange_view/trade_details_view.dart'; +import 'fusion_tx_group_card.dart'; +import 'transaction_v2_card.dart'; class TxListItem extends ConsumerWidget { const TxListItem({ @@ -56,10 +57,12 @@ class TxListItem extends ConsumerWidget { transaction: _tx, ), TradeCard( - key: Key(_tx.txid + - _tx.type.name + - _tx.hashCode.toString() + - trade.uuid), // + key: Key( + _tx.txid + + _tx.type.name + + _tx.hashCode.toString() + + trade.uuid, + ), // trade: trade, onTap: () async { if (Util.isDesktop) { @@ -136,7 +139,7 @@ class TxListItem extends ConsumerWidget { ); } }, - ) + ), ], ), ); diff --git a/lib/pages/wallet_view/wallet_view.dart b/lib/pages/wallet_view/wallet_view.dart index 2f2eb334f..7147ca299 100644 --- a/lib/pages/wallet_view/wallet_view.dart +++ b/lib/pages/wallet_view/wallet_view.dart @@ -64,9 +64,6 @@ import '../../utilities/enums/sync_type_enum.dart'; import '../../utilities/logger.dart'; import '../../utilities/show_loading.dart'; import '../../utilities/text_styles.dart'; -import '../../wallets/crypto_currency/coins/banano.dart'; -import '../../wallets/crypto_currency/coins/bitcoin.dart'; -import '../../wallets/crypto_currency/coins/firo.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../wallets/crypto_currency/intermediate/frost_currency.dart'; import '../../wallets/isar/providers/wallet_info_provider.dart'; diff --git a/lib/pages/wallets_view/sub_widgets/all_wallets.dart b/lib/pages/wallets_view/sub_widgets/all_wallets.dart index a69d2bd13..067fcdcb3 100644 --- a/lib/pages/wallets_view/sub_widgets/all_wallets.dart +++ b/lib/pages/wallets_view/sub_widgets/all_wallets.dart @@ -18,7 +18,7 @@ import '../../../wallets/isar/providers/all_wallets_info_provider.dart'; import '../../../widgets/custom_buttons/blue_text_button.dart'; class AllWallets extends StatelessWidget { - const AllWallets({Key? key}) : super(key: key); + const AllWallets({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/pages/wallets_view/sub_widgets/empty_wallets.dart b/lib/pages/wallets_view/sub_widgets/empty_wallets.dart index 530c27e54..905ee350f 100644 --- a/lib/pages/wallets_view/sub_widgets/empty_wallets.dart +++ b/lib/pages/wallets_view/sub_widgets/empty_wallets.dart @@ -21,7 +21,7 @@ import '../../../utilities/text_styles.dart'; import '../../../utilities/util.dart'; class EmptyWallets extends ConsumerWidget { - const EmptyWallets({Key? key}) : super(key: key); + const EmptyWallets({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -83,9 +83,9 @@ class EmptyWallets extends ConsumerWidget { ), ), if (!isDesktop) - Row( + const Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ AddWalletButton( isDesktop: false, ), @@ -103,7 +103,7 @@ class EmptyWallets extends ConsumerWidget { } class AddWalletButton extends ConsumerWidget { - const AddWalletButton({Key? key, required this.isDesktop}) : super(key: key); + const AddWalletButton({super.key, required this.isDesktop}); final bool isDesktop; diff --git a/lib/pages/wallets_view/sub_widgets/favorite_card.dart b/lib/pages/wallets_view/sub_widgets/favorite_card.dart index 6f3dd84bb..ab91cc759 100644 --- a/lib/pages/wallets_view/sub_widgets/favorite_card.dart +++ b/lib/pages/wallets_view/sub_widgets/favorite_card.dart @@ -274,9 +274,11 @@ class _FavoriteCardState extends ConsumerState { } class CardOverlayStack extends StatelessWidget { - const CardOverlayStack( - {Key? key, required this.background, required this.child}) - : super(key: key); + const CardOverlayStack({ + super.key, + required this.background, + required this.child, + }); final Widget background; final Widget child; diff --git a/lib/pages/wallets_view/sub_widgets/favorite_wallets.dart b/lib/pages/wallets_view/sub_widgets/favorite_wallets.dart index b46e84b87..de03c3fd7 100644 --- a/lib/pages/wallets_view/sub_widgets/favorite_wallets.dart +++ b/lib/pages/wallets_view/sub_widgets/favorite_wallets.dart @@ -13,18 +13,18 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import '../../manage_favorites_view/manage_favorites_view.dart'; -import 'favorite_card.dart'; + import '../../../themes/stack_colors.dart'; import '../../../utilities/assets.dart'; import '../../../utilities/constants.dart'; import '../../../utilities/text_styles.dart'; import '../../../wallets/isar/providers/favourite_wallets_provider.dart'; -import '../../../widgets/custom_page_view/custom_page_view.dart' - as cpv; +import '../../../widgets/custom_page_view/custom_page_view.dart' as cpv; +import '../../manage_favorites_view/manage_favorites_view.dart'; +import 'favorite_card.dart'; class FavoriteWallets extends ConsumerStatefulWidget { - const FavoriteWallets({Key? key}) : super(key: key); + const FavoriteWallets({super.key}); @override ConsumerState createState() => _FavoriteWalletsState(); @@ -55,9 +55,11 @@ class _FavoriteWalletsState extends ConsumerState { _pageController.addListener(() { if (_pageController.position.pixels > (cardWidth * (_favLength - 1))) { - _pageController.animateToPage(_favLength - 1, - duration: const Duration(milliseconds: 1), - curve: Curves.decelerate); + _pageController.animateToPage( + _favLength - 1, + duration: const Duration(milliseconds: 1), + curve: Curves.decelerate, + ); } }); super.initState(); @@ -76,7 +78,7 @@ class _FavoriteWalletsState extends ConsumerState { final favorites = ref.watch(pFavouriteWalletInfos(true)); _favLength = favorites.length; - bool hasFavorites = favorites.isNotEmpty; + final bool hasFavorites = favorites.isNotEmpty; final remaining = ((screenWidth - cardWidth) / cardWidth).ceil(); @@ -100,7 +102,8 @@ class _FavoriteWalletsState extends ConsumerState { TextButton( style: ButtonStyle( backgroundColor: MaterialStateProperty.all( - Theme.of(context).extension()!.background), + Theme.of(context).extension()!.background, + ), ), child: SvgPicture.asset( Assets.svg.ellipsis, @@ -135,7 +138,8 @@ class _FavoriteWalletsState extends ConsumerState { .extension()! .textFieldDefaultBG, borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius), + Constants.size.circularBorderRadius, + ), ), child: MaterialButton( splashColor: @@ -145,7 +149,8 @@ class _FavoriteWalletsState extends ConsumerState { materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius), + Constants.size.circularBorderRadius, + ), ), onPressed: () { Navigator.of(context) diff --git a/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart b/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart index d7ec6037b..5602d2419 100644 --- a/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart +++ b/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart @@ -14,8 +14,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import '../../wallet_view/wallet_view.dart'; -import '../wallets_overview.dart'; + import '../../../providers/providers.dart'; import '../../../themes/coin_icon_provider.dart'; import '../../../themes/stack_colors.dart'; @@ -24,11 +23,12 @@ import '../../../utilities/constants.dart'; import '../../../utilities/show_loading.dart'; import '../../../utilities/text_styles.dart'; import '../../../utilities/util.dart'; -import '../../../wallets/crypto_currency/coins/ethereum.dart'; import '../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../wallets/wallet/wallet_mixin_interfaces/cw_based_interface.dart'; import '../../../widgets/dialogs/tor_warning_dialog.dart'; import '../../../widgets/rounded_white_container.dart'; +import '../../wallet_view/wallet_view.dart'; +import '../wallets_overview.dart'; class WalletListItem extends ConsumerWidget { const WalletListItem({ @@ -128,16 +128,19 @@ class WalletListItem extends ConsumerWidget { Expanded( child: Consumer( builder: (_, ref, __) { - final tuple = ref.watch(priceAnd24hChangeNotifierProvider - .select((value) => value.getPrice(coin))); + final tuple = ref.watch( + priceAnd24hChangeNotifierProvider + .select((value) => value.getPrice(coin)), + ); final calls = ref.watch(prefsChangeNotifierProvider).externalCalls; final priceString = tuple.item1.toAmount(fractionDigits: 2).fiatString( locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale)), + localeServiceChangeNotifierProvider + .select((value) => value.locale), + ), ); final double percentChange = tuple.item2; diff --git a/lib/pages/wallets_view/wallets_overview.dart b/lib/pages/wallets_view/wallets_overview.dart index ebd4931f7..f557e6f7e 100644 --- a/lib/pages/wallets_view/wallets_overview.dart +++ b/lib/pages/wallets_view/wallets_overview.dart @@ -12,9 +12,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; +import 'package:tuple/tuple.dart'; + import '../../models/add_wallet_list_entity/sub_classes/coin_entity.dart'; import '../../models/isar/models/ethereum/eth_contract.dart'; -import '../add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart'; import '../../pages_desktop_specific/my_stack_view/dialogs/desktop_expanding_wallet_card.dart'; import '../../providers/db/main_db_provider.dart'; import '../../providers/providers.dart'; @@ -23,7 +24,6 @@ import '../../utilities/assets.dart'; import '../../utilities/constants.dart'; import '../../utilities/text_styles.dart'; import '../../utilities/util.dart'; -import '../../wallets/crypto_currency/coins/ethereum.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../wallets/isar/models/wallet_info.dart'; import '../../wallets/isar/providers/wallet_info_provider.dart'; @@ -37,7 +37,7 @@ import '../../widgets/rounded_white_container.dart'; import '../../widgets/stack_text_field.dart'; import '../../widgets/textfield_icon_button.dart'; import '../../widgets/wallet_card.dart'; -import 'package:tuple/tuple.dart'; +import '../add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart'; class WalletsOverview extends ConsumerStatefulWidget { const WalletsOverview({ @@ -296,7 +296,8 @@ class _EthWalletsOverviewState extends ConsumerState { if (isDesktop) { return DesktopExpandingWalletCard( key: Key( - "${element.item1.info.name}_${element.item2.map((e) => e.address).join()}"), + "${element.item1.info.name}_${element.item2.map((e) => e.address).join()}", + ), data: element, navigatorState: widget.navigatorState!, ); diff --git a/lib/pages/wallets_view/wallets_view.dart b/lib/pages/wallets_view/wallets_view.dart index 76298c595..236e79e4d 100644 --- a/lib/pages/wallets_view/wallets_view.dart +++ b/lib/pages/wallets_view/wallets_view.dart @@ -19,7 +19,7 @@ import '../../themes/theme_providers.dart'; import '../../wallets/isar/providers/all_wallets_info_provider.dart'; class WalletsView extends ConsumerWidget { - const WalletsView({Key? key}) : super(key: key); + const WalletsView({super.key}); static const routeName = "/wallets"; @@ -28,8 +28,9 @@ class WalletsView extends ConsumerWidget { debugPrint("BUILD: $runtimeType"); final hasWallets = ref.watch(pAllWalletsInfo).isNotEmpty; - final showFavorites = ref.watch(prefsChangeNotifierProvider - .select((value) => value.showFavoriteWallets)); + final showFavorites = ref.watch( + prefsChangeNotifierProvider.select((value) => value.showFavoriteWallets), + ); return SafeArea( child: hasWallets diff --git a/lib/pages_desktop_specific/address_book_view/desktop_address_book.dart b/lib/pages_desktop_specific/address_book_view/desktop_address_book.dart index af09985df..c68b9c058 100644 --- a/lib/pages_desktop_specific/address_book_view/desktop_address_book.dart +++ b/lib/pages_desktop_specific/address_book_view/desktop_address_book.dart @@ -22,7 +22,6 @@ import '../../providers/db/main_db_provider.dart'; import '../../providers/global/address_book_service_provider.dart'; import '../../providers/providers.dart'; import '../../providers/ui/address_book_providers/address_book_filter_provider.dart'; -import '../../app_config.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/assets.dart'; import '../../utilities/constants.dart'; diff --git a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_book_scaffold.dart b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_book_scaffold.dart index a7a47e979..ce435797f 100644 --- a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_book_scaffold.dart +++ b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_book_scaffold.dart @@ -12,7 +12,7 @@ import 'package:flutter/widgets.dart'; class DesktopAddressBookScaffold extends StatelessWidget { const DesktopAddressBookScaffold({ - Key? key, + super.key, required this.controlsLeft, required this.controlsRight, required this.filterItems, @@ -21,7 +21,7 @@ class DesktopAddressBookScaffold extends StatelessWidget { required this.favorites, required this.all, required this.details, - }) : super(key: key); + }); final Widget? controlsLeft; final Widget? controlsRight; @@ -115,7 +115,7 @@ class DesktopAddressBookScaffold extends StatelessWidget { ), ], ), - ) + ), ], ); } diff --git a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_card.dart b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_card.dart index 509653aba..b124fa025 100644 --- a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_card.dart +++ b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_card.dart @@ -14,6 +14,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../../../models/isar/models/contact_entry.dart'; import '../../../notifications/show_flush_bar.dart'; import '../../../pages/address_book_views/subviews/edit_contact_address_view.dart'; @@ -22,7 +23,6 @@ import '../../../themes/coin_icon_provider.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/assets.dart'; import '../../../utilities/clipboard_interface.dart'; - import '../../../utilities/text_styles.dart'; import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../widgets/custom_buttons/blue_text_button.dart'; @@ -30,11 +30,11 @@ import '../../../widgets/desktop/desktop_dialog.dart'; class DesktopAddressCard extends ConsumerWidget { const DesktopAddressCard({ - Key? key, + super.key, required this.entry, required this.contactId, this.clipboard = const ClipboardWrapper(), - }) : super(key: key); + }); final ContactAddressEntry entry; final String contactId; @@ -103,7 +103,8 @@ class DesktopAddressCard extends ConsumerWidget { text: "Edit", onTap: () async { ref.refresh( - addressEntryDataProviderFamilyRefresher); + addressEntryDataProviderFamilyRefresher, + ); ref.read(addressEntryDataProvider(0)).address = entry.address; ref.read(addressEntryDataProvider(0)).addressLabel = @@ -155,7 +156,7 @@ class DesktopAddressCard extends ConsumerWidget { }, ), ], - ) + ), ], ), ), diff --git a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart index d38d171d3..f3037f527 100644 --- a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart +++ b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart @@ -63,12 +63,14 @@ class _DesktopContactDetailsState extends ConsumerState { .transactions .where() .filter() - .anyOf(contact.addresses.map((e) => e.address), - (q, String e) => q.address((q) => q.valueEqualTo(e))) + .anyOf( + contact.addresses.map((e) => e.address), + (q, String e) => q.address((q) => q.valueEqualTo(e)), + ) .sortByTimestampDesc() .findAll(); - List> result = []; + final List> result = []; for (final tx in transactions) { result.add(Tuple2(tx.walletId, tx)); @@ -85,8 +87,10 @@ class _DesktopContactDetailsState extends ConsumerState { // provider hack to prevent trying to update widget with deleted contact ContactEntry? _contact; try { - _contact = ref.watch(addressBookServiceProvider - .select((value) => value.getContactById(widget.contactId))); + _contact = ref.watch( + addressBookServiceProvider + .select((value) => value.getContactById(widget.contactId)), + ); } catch (_) { return Container(); } @@ -186,7 +190,8 @@ class _DesktopContactDetailsState extends ConsumerState { text: "Add new", onTap: () async { ref.refresh( - addressEntryDataProviderFamilyRefresher); + addressEntryDataProviderFamilyRefresher, + ); await showDialog( context: context, @@ -280,9 +285,11 @@ class _DesktopContactDetailsState extends ConsumerState { ), FutureBuilder( future: _filteredTransactionsByContact(), - builder: (_, - AsyncSnapshot>> - snapshot) { + builder: ( + _, + AsyncSnapshot>> + snapshot, + ) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { @@ -300,7 +307,8 @@ class _DesktopContactDetailsState extends ConsumerState { ..._cachedTransactions.map( (e) => TransactionCard( key: Key( - "contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey"), + "contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey", + ), transaction: e.item2, walletId: e.item1, ), @@ -334,7 +342,8 @@ class _DesktopContactDetailsState extends ConsumerState { ..._cachedTransactions.map( (e) => TransactionCard( key: Key( - "contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey"), + "contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey", + ), transaction: e.item2, walletId: e.item1, ), diff --git a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_options_menu_popup.dart b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_options_menu_popup.dart index 61b0de815..5601cf702 100644 --- a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_options_menu_popup.dart +++ b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_options_menu_popup.dart @@ -11,6 +11,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../../../notifications/show_flush_bar.dart'; import '../../../pages/address_book_views/subviews/edit_contact_name_emoji_view.dart'; import '../../../providers/global/address_book_service_provider.dart'; @@ -23,8 +24,7 @@ import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/desktop/secondary_button.dart'; class DesktopContactOptionsMenuPopup extends ConsumerStatefulWidget { - const DesktopContactOptionsMenuPopup({Key? key, required this.contactId}) - : super(key: key); + const DesktopContactOptionsMenuPopup({super.key, required this.contactId}); final String contactId; @@ -169,7 +169,7 @@ class _DesktopContactOptionsMenuPopupState ), ), ], - ) + ), ], ), ), @@ -256,20 +256,23 @@ class _DesktopContactOptionsMenuPopupState width: 12, ), Text( - ref.watch(addressBookServiceProvider.select( - (value) => value - .getContactById(widget.contactId) - .isFavorite)) + ref.watch( + addressBookServiceProvider.select( + (value) => value + .getContactById(widget.contactId) + .isFavorite, + ), + ) ? "Remove from favorites" : "Add to favorites", style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, ), - ) + ), ], ), ), @@ -326,13 +329,13 @@ class _DesktopContactOptionsMenuPopupState Text( "Edit contact", style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, ), - ) + ), ], ), ), @@ -389,13 +392,13 @@ class _DesktopContactOptionsMenuPopupState Text( "Delete contact", style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, ), - ) + ), ], ), ), diff --git a/lib/pages_desktop_specific/addresses/desktop_wallet_addresses_view.dart b/lib/pages_desktop_specific/addresses/desktop_wallet_addresses_view.dart index cf6c7c424..9186b8f0b 100644 --- a/lib/pages_desktop_specific/addresses/desktop_wallet_addresses_view.dart +++ b/lib/pages_desktop_specific/addresses/desktop_wallet_addresses_view.dart @@ -12,9 +12,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; + import '../../models/isar/models/isar_models.dart'; import '../../pages/receive_view/addresses/address_details_view.dart'; -import 'sub_widgets/desktop_address_list.dart'; import '../../providers/db/main_db_provider.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/assets.dart'; @@ -22,14 +22,15 @@ import '../../utilities/text_styles.dart'; import '../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../widgets/desktop/desktop_app_bar.dart'; import '../../widgets/desktop/desktop_scaffold.dart'; +import 'sub_widgets/desktop_address_list.dart'; final desktopSelectedAddressId = StateProvider.autoDispose((ref) => null); class DesktopWalletAddressesView extends ConsumerStatefulWidget { const DesktopWalletAddressesView({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); static const String routeName = "/desktopWalletAddressesView"; @@ -143,7 +144,8 @@ class _DesktopWalletAddressesViewState child: SingleChildScrollView( child: AddressDetailsView( key: Key( - "currentDesktopAddressDetails_key_${ref.watch(desktopSelectedAddressId.state).state}"), + "currentDesktopAddressDetails_key_${ref.watch(desktopSelectedAddressId.state).state}", + ), walletId: widget.walletId, addressId: ref .watch(desktopSelectedAddressId.state) diff --git a/lib/pages_desktop_specific/addresses/sub_widgets/desktop_address_list.dart b/lib/pages_desktop_specific/addresses/sub_widgets/desktop_address_list.dart index 3da33f220..9ac4fab33 100644 --- a/lib/pages_desktop_specific/addresses/sub_widgets/desktop_address_list.dart +++ b/lib/pages_desktop_specific/addresses/sub_widgets/desktop_address_list.dart @@ -12,9 +12,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; + import '../../../models/isar/models/isar_models.dart'; import '../../../pages/receive_view/addresses/address_card.dart'; -import '../desktop_wallet_addresses_view.dart'; import '../../../providers/db/main_db_provider.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/assets.dart'; @@ -26,6 +26,7 @@ import '../../../widgets/icon_widgets/x_icon.dart'; import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/stack_text_field.dart'; import '../../../widgets/textfield_icon_button.dart'; +import '../desktop_wallet_addresses_view.dart'; class DesktopAddressList extends ConsumerStatefulWidget { const DesktopAddressList({ @@ -55,14 +56,16 @@ class _DesktopAddressListState extends ConsumerState { .read(mainDBProvider) .getAddresses(widget.walletId) .filter() - .group((q) => q - .subTypeEqualTo(AddressSubType.change) - .or() - .subTypeEqualTo(AddressSubType.receiving) - .or() - .subTypeEqualTo(AddressSubType.paynymReceive) - .or() - .subTypeEqualTo(AddressSubType.paynymNotification)) + .group( + (q) => q + .subTypeEqualTo(AddressSubType.change) + .or() + .subTypeEqualTo(AddressSubType.receiving) + .or() + .subTypeEqualTo(AddressSubType.paynymReceive) + .or() + .subTypeEqualTo(AddressSubType.paynymNotification), + ) .and() .not() .typeEqualTo(AddressType.nonWallet) @@ -99,15 +102,19 @@ class _DesktopAddressListState extends ConsumerState { .getAddresses(widget.walletId) .filter() .anyOf( - labels, (q, e) => q.valueEqualTo(e.addressString)) - .group((q) => q - .subTypeEqualTo(AddressSubType.change) - .or() - .subTypeEqualTo(AddressSubType.receiving) - .or() - .subTypeEqualTo(AddressSubType.paynymReceive) - .or() - .subTypeEqualTo(AddressSubType.paynymNotification)) + labels, + (q, e) => q.valueEqualTo(e.addressString), + ) + .group( + (q) => q + .subTypeEqualTo(AddressSubType.change) + .or() + .subTypeEqualTo(AddressSubType.receiving) + .or() + .subTypeEqualTo(AddressSubType.paynymReceive) + .or() + .subTypeEqualTo(AddressSubType.paynymNotification), + ) .and() .not() .typeEqualTo(AddressType.nonWallet) diff --git a/lib/pages_desktop_specific/cashfusion/desktop_cashfusion_view.dart b/lib/pages_desktop_specific/cashfusion/desktop_cashfusion_view.dart index 9d674c585..d35da1a31 100644 --- a/lib/pages_desktop_specific/cashfusion/desktop_cashfusion_view.dart +++ b/lib/pages_desktop_specific/cashfusion/desktop_cashfusion_view.dart @@ -17,8 +17,8 @@ import 'package:flutter/services.dart'; import 'package:flutter_native_splash/cli_commands.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../pages/cashfusion/fusion_rounds_selection_sheet.dart'; -import 'sub_widgets/fusion_dialog.dart'; import '../../providers/cash_fusion/fusion_progress_ui_state_provider.dart'; import '../../providers/global/prefs_provider.dart'; import '../../providers/global/wallets_provider.dart'; @@ -38,6 +38,7 @@ import '../../widgets/desktop/desktop_scaffold.dart'; import '../../widgets/desktop/primary_button.dart'; import '../../widgets/rounded_white_container.dart'; import '../../widgets/stack_text_field.dart'; +import 'sub_widgets/fusion_dialog.dart'; class DesktopCashFusionView extends ConsumerStatefulWidget { const DesktopCashFusionView({ @@ -77,7 +78,8 @@ class _DesktopCashFusion extends ConsumerState { ); } catch (e) { if (!e.toString().contains( - "FusionProgressUIState was already set for ${widget.walletId}")) { + "FusionProgressUIState was already set for ${widget.walletId}", + )) { rethrow; } } @@ -256,7 +258,8 @@ class _DesktopCashFusion extends ConsumerState { Text( "What is Fusion?", style: STextStyles.desktopH2( - context), + context, + ), ), DesktopDialogCloseButton( onPressedOverride: () => @@ -276,8 +279,8 @@ class _DesktopCashFusion extends ConsumerState { "companies to track your coins.", style: STextStyles.desktopTextMedium( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark3, @@ -337,7 +340,8 @@ class _DesktopCashFusion extends ConsumerState { Text( "Server settings", style: STextStyles.desktopTextExtraExtraSmall( - context), + context, + ), ), CustomTextButton( text: "Default", @@ -396,7 +400,7 @@ class _DesktopCashFusion extends ConsumerState { controller: portController, focusNode: portFocusNode, inputFormatters: [ - FilteringTextInputFormatter.digitsOnly + FilteringTextInputFormatter.digitsOnly, ], onChanged: (value) { setState(() { @@ -544,7 +548,7 @@ class _DesktopCashFusion extends ConsumerState { controller: fusionRoundController, focusNode: fusionRoundFocusNode, inputFormatters: [ - FilteringTextInputFormatter.digitsOnly + FilteringTextInputFormatter.digitsOnly, ], onChanged: (value) { setState(() { @@ -562,8 +566,8 @@ class _DesktopCashFusion extends ConsumerState { context, desktopMed: true, ).copyWith( - labelText: - "Enter number of fusions.."), + labelText: "Enter number of fusions..", + ), ), ), ], diff --git a/lib/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart b/lib/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart index 437c61a55..51502bf81 100644 --- a/lib/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart +++ b/lib/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'fusion_progress.dart'; + import '../../../providers/cash_fusion/fusion_progress_ui_state_provider.dart'; import '../../../providers/global/prefs_provider.dart'; import '../../../providers/global/wallets_provider.dart'; @@ -18,6 +18,7 @@ import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/rounded_container.dart'; import '../../../widgets/rounded_white_container.dart'; +import 'fusion_progress.dart'; enum CashFusionStatus { waiting, running, success, failed } @@ -303,7 +304,8 @@ class _FusionDialogViewState extends ConsumerState { ); } catch (e) { if (!e.toString().contains( - "FusionProgressUIState was already set for ${widget.walletId}")) { + "FusionProgressUIState was already set for ${widget.walletId}", + )) { rethrow; } } diff --git a/lib/pages_desktop_specific/cashfusion/sub_widgets/fusion_progress.dart b/lib/pages_desktop_specific/cashfusion/sub_widgets/fusion_progress.dart index 8487ce863..3e3f5b44e 100644 --- a/lib/pages_desktop_specific/cashfusion/sub_widgets/fusion_progress.dart +++ b/lib/pages_desktop_specific/cashfusion/sub_widgets/fusion_progress.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../../../pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_item_card.dart'; -import 'fusion_dialog.dart'; import '../../../providers/cash_fusion/fusion_progress_ui_state_provider.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/assets.dart'; @@ -10,6 +10,7 @@ import '../../../utilities/text_styles.dart'; import '../../../utilities/util.dart'; import '../../../widgets/conditional_parent.dart'; import '../../../widgets/rounded_container.dart'; +import 'fusion_dialog.dart'; class FusionProgress extends ConsumerWidget { const FusionProgress({super.key, required this.walletId}); @@ -22,42 +23,57 @@ class FusionProgress extends ConsumerWidget { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ _ProgressItem( - iconAsset: Assets.svg.node, - label: "Connecting to server", - state: ref.watch(fusionProgressUIStateProvider(walletId) - .select((value) => value.connecting))), + iconAsset: Assets.svg.node, + label: "Connecting to server", + state: ref.watch( + fusionProgressUIStateProvider(walletId) + .select((value) => value.connecting), + ), + ), const SizedBox( height: 12, ), _ProgressItem( - iconAsset: Assets.svg.upFromLine, - label: "Allocating outputs", - state: ref.watch(fusionProgressUIStateProvider(walletId) - .select((value) => value.outputs))), + iconAsset: Assets.svg.upFromLine, + label: "Allocating outputs", + state: ref.watch( + fusionProgressUIStateProvider(walletId) + .select((value) => value.outputs), + ), + ), const SizedBox( height: 12, ), _ProgressItem( - iconAsset: Assets.svg.peers, - label: "Waiting for peers", - state: ref.watch(fusionProgressUIStateProvider(walletId) - .select((value) => value.peers))), + iconAsset: Assets.svg.peers, + label: "Waiting for peers", + state: ref.watch( + fusionProgressUIStateProvider(walletId) + .select((value) => value.peers), + ), + ), const SizedBox( height: 12, ), _ProgressItem( - iconAsset: Assets.svg.fusing, - label: "Fusing", - state: ref.watch(fusionProgressUIStateProvider(walletId) - .select((value) => value.fusing))), + iconAsset: Assets.svg.fusing, + label: "Fusing", + state: ref.watch( + fusionProgressUIStateProvider(walletId) + .select((value) => value.fusing), + ), + ), const SizedBox( height: 12, ), _ProgressItem( - iconAsset: Assets.svg.checkCircle, - label: "Complete", - state: ref.watch(fusionProgressUIStateProvider(walletId) - .select((value) => value.complete))), + iconAsset: Assets.svg.checkCircle, + label: "Complete", + state: ref.watch( + fusionProgressUIStateProvider(walletId) + .select((value) => value.complete), + ), + ), ], ); } diff --git a/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart b/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart index a76851278..dce4eeafc 100644 --- a/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart +++ b/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart @@ -14,9 +14,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; + import '../../db/isar/main_db.dart'; import '../../models/isar/models/blockchain_data/utxo.dart'; -import 'utxo_row.dart'; import '../../themes/coin_icon_provider.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/amount/amount.dart'; @@ -38,6 +38,7 @@ import '../../widgets/rounded_container.dart'; import '../../widgets/stack_text_field.dart'; import '../../widgets/textfield_icon_button.dart'; import '../../widgets/toggle.dart'; +import 'utxo_row.dart'; final desktopUseUTXOs = StateProvider((ref) => {}); @@ -295,7 +296,7 @@ class _DesktopCoinControlUseDialogState } }, displayPrefix: "Sort by", - ) + ), ], ), const SizedBox( @@ -320,7 +321,8 @@ class _DesktopCoinControlUseDialogState return UtxoRow( key: Key( - "${utxo.walletId}_${utxo.id}_${utxo.isBlocked}"), + "${utxo.walletId}_${utxo.id}_${utxo.isBlocked}", + ), data: data, compact: true, walletId: widget.walletId, @@ -391,7 +393,8 @@ class _DesktopCoinControlUseDialogState "output${entry.value.length > 1 ? "s" : ""}", style: STextStyles .desktopTextExtraExtraSmall( - context), + context, + ), ), ), RotateIcon( @@ -422,7 +425,8 @@ class _DesktopCoinControlUseDialogState return UtxoRow( key: Key( - "${utxo.walletId}_${utxo.id}_${utxo.isBlocked}"), + "${utxo.walletId}_${utxo.id}_${utxo.isBlocked}", + ), data: data, compact: true, compactWithBorder: false, @@ -477,8 +481,8 @@ class _DesktopCoinControlUseDialogState "Amount to send", style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, @@ -512,8 +516,8 @@ class _DesktopCoinControlUseDialogState Text( "Selected amount", style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, @@ -524,8 +528,8 @@ class _DesktopCoinControlUseDialogState coin.fractionDigits, )} ${coin.ticker}", style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: widget.amountToSend == null ? Theme.of(context) .extension()! diff --git a/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart b/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart index 957cfacdb..653da8a68 100644 --- a/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart +++ b/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart @@ -14,10 +14,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; + import '../../db/isar/main_db.dart'; import '../../models/isar/models/blockchain_data/utxo.dart'; -import 'freeze_button.dart'; -import 'utxo_row.dart'; import '../../themes/coin_icon_provider.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/assets.dart'; @@ -36,12 +35,14 @@ import '../../widgets/icon_widgets/x_icon.dart'; import '../../widgets/rounded_container.dart'; import '../../widgets/stack_text_field.dart'; import '../../widgets/textfield_icon_button.dart'; +import 'freeze_button.dart'; +import 'utxo_row.dart'; class DesktopCoinControlView extends ConsumerStatefulWidget { const DesktopCoinControlView({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); static const String routeName = "/desktopCoinControl"; @@ -308,7 +309,8 @@ class _DesktopCoinControlViewState return UtxoRow( key: Key( - "${utxo.walletId}_${utxo.id}_${utxo.isBlocked}"), + "${utxo.walletId}_${utxo.id}_${utxo.isBlocked}", + ), data: data, walletId: widget.walletId, onSelectionChanged: (value) { @@ -374,7 +376,8 @@ class _DesktopCoinControlViewState "output${entry.value.length > 1 ? "s" : ""}", style: STextStyles.desktopTextExtraExtraSmall( - context), + context, + ), ), ), RotateIcon( @@ -404,7 +407,8 @@ class _DesktopCoinControlViewState return UtxoRow( key: Key( - "${utxo.walletId}_${utxo.id}_${utxo.isBlocked}"), + "${utxo.walletId}_${utxo.id}_${utxo.isBlocked}", + ), data: data, walletId: widget.walletId, raiseOnSelected: false, diff --git a/lib/pages_desktop_specific/coin_control/freeze_button.dart b/lib/pages_desktop_specific/coin_control/freeze_button.dart index 0f4d6d4e8..dddcc92fa 100644 --- a/lib/pages_desktop_specific/coin_control/freeze_button.dart +++ b/lib/pages_desktop_specific/coin_control/freeze_button.dart @@ -19,9 +19,9 @@ import '../../widgets/desktop/primary_button.dart'; class FreezeButton extends StatefulWidget { const FreezeButton({ - Key? key, + super.key, required this.selectedUTXOs, - }) : super(key: key); + }); final Set selectedUTXOs; @@ -51,7 +51,7 @@ class _FreezeButtonState extends State { } Future _onFreezeStateButtonPressed() async { - List utxosToUpdate = []; + final List utxosToUpdate = []; switch (_freezeLabelCache) { case "Freeze": for (final e in widget.selectedUTXOs) { @@ -95,7 +95,7 @@ class _FreezeButtonState extends State { @override void initState() { - List> streams = []; + final List> streams = []; for (final data in widget.selectedUTXOs) { final stream = MainDB.instance.watchUTXO(id: data.utxoId); diff --git a/lib/pages_desktop_specific/coin_control/utxo_row.dart b/lib/pages_desktop_specific/coin_control/utxo_row.dart index c414f1b4f..ca33fe8f2 100644 --- a/lib/pages_desktop_specific/coin_control/utxo_row.dart +++ b/lib/pages_desktop_specific/coin_control/utxo_row.dart @@ -48,14 +48,14 @@ class UtxoRowData { class UtxoRow extends ConsumerStatefulWidget { const UtxoRow({ - Key? key, + super.key, required this.data, required this.walletId, this.onSelectionChanged, this.compact = false, this.compactWithBorder = true, this.raiseOnSelected = true, - }) : super(key: key); + }); final String walletId; final UtxoRowData data; diff --git a/lib/pages_desktop_specific/desktop_buy/desktop_buy_view.dart b/lib/pages_desktop_specific/desktop_buy/desktop_buy_view.dart index f2d0e9bef..6c5d2dc2d 100644 --- a/lib/pages_desktop_specific/desktop_buy/desktop_buy_view.dart +++ b/lib/pages_desktop_specific/desktop_buy/desktop_buy_view.dart @@ -22,7 +22,7 @@ import '../../widgets/rounded_white_container.dart'; import '../../widgets/tor_subscription.dart'; class DesktopBuyView extends ConsumerStatefulWidget { - const DesktopBuyView({Key? key}) : super(key: key); + const DesktopBuyView({super.key}); static const String routeName = "/desktopBuyView"; diff --git a/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart b/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart index e4a6129bf..c487ff991 100644 --- a/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart +++ b/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart @@ -16,6 +16,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; +import 'package:tuple/tuple.dart'; + import '../../db/isar/main_db.dart'; import '../../models/exchange/change_now/exchange_transaction_status.dart'; import '../../models/exchange/response_objects/trade.dart'; @@ -41,10 +43,9 @@ import '../../widgets/icon_widgets/x_icon.dart'; import '../../widgets/rounded_white_container.dart'; import '../../widgets/stack_text_field.dart'; import '../../widgets/textfield_icon_button.dart'; -import 'package:tuple/tuple.dart'; class DesktopAllTradesView extends ConsumerStatefulWidget { - const DesktopAllTradesView({Key? key}) : super(key: key); + const DesktopAllTradesView({super.key}); static const String routeName = "/desktopAllTrades"; @@ -60,10 +61,11 @@ class _DesktopAllTradesViewState extends ConsumerState { String _searchString = ""; List>> groupTransactionsByMonth( - List trades) { - Map> map = {}; + List trades, + ) { + final Map> map = {}; - for (var trade in trades) { + for (final trade in trades) { final date = trade.timestamp; final monthYear = "${Constants.monthMap[date.month]} ${date.year}"; if (map[monthYear] == null) { @@ -72,7 +74,7 @@ class _DesktopAllTradesViewState extends ConsumerState { map[monthYear]!.add(trade); } - List>> result = []; + final List>> result = []; map.forEach((key, value) { result.add(Tuple2(key, value)); }); @@ -214,7 +216,8 @@ class _DesktopAllTradesViewState extends ConsumerState { child: Consumer( builder: (_, ref, __) { List trades = ref.watch( - tradesServiceProvider.select((value) => value.trades)); + tradesServiceProvider.select((value) => value.trades), + ); if (_searchString.isNotEmpty) { final term = _searchString.toLowerCase(); @@ -261,7 +264,8 @@ class _DesktopAllTradesViewState extends ConsumerState { padding: const EdgeInsets.all(4), child: DesktopTradeRowCard( key: Key( - "transactionCard_key_${month.item2[index].tradeId}"), + "transactionCard_key_${month.item2[index].tradeId}", + ), tradeId: month.item2[index].tradeId, ), ), @@ -284,9 +288,9 @@ class _DesktopAllTradesViewState extends ConsumerState { class DesktopTradeRowCard extends ConsumerStatefulWidget { const DesktopTradeRowCard({ - Key? key, + super.key, required this.tradeId, - }) : super(key: key); + }); final String tradeId; @@ -563,7 +567,8 @@ class _DesktopTradeRowCardState extends ConsumerState { flex: 4, child: Text( Format.extractDateFrom( - trade.timestamp.millisecondsSinceEpoch ~/ 1000), + trade.timestamp.millisecondsSinceEpoch ~/ 1000, + ), style: STextStyles.desktopTextExtraExtraSmall(context), ), ), diff --git a/lib/pages_desktop_specific/desktop_exchange/desktop_exchange_view.dart b/lib/pages_desktop_specific/desktop_exchange/desktop_exchange_view.dart index 1476d5d72..d0d0fda65 100644 --- a/lib/pages_desktop_specific/desktop_exchange/desktop_exchange_view.dart +++ b/lib/pages_desktop_specific/desktop_exchange/desktop_exchange_view.dart @@ -26,7 +26,7 @@ import '../../widgets/desktop/desktop_scaffold.dart'; import '../../widgets/rounded_white_container.dart'; class DesktopExchangeView extends ConsumerStatefulWidget { - const DesktopExchangeView({Key? key}) : super(key: key); + const DesktopExchangeView({super.key}); static const String routeName = "/desktopExchange"; @@ -95,7 +95,7 @@ class _DesktopExchangeViewState extends ConsumerState { subMessage: "This could take a few minutes", eventBus: null, ), - ) + ), ], ); }, @@ -173,9 +173,9 @@ class _DesktopExchangeViewState extends ConsumerState { const SizedBox( width: 16, ), - Expanded( + const Expanded( child: Row( - children: const [ + children: [ Expanded( child: DesktopTradeHistory(), ), diff --git a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart index 103280f88..3c0688166 100644 --- a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart +++ b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart @@ -319,7 +319,7 @@ class _StepScaffoldState extends ConsumerState { onPressed: onBack, ), secondChild: SecondaryButton( - label: "Send from {$AppConfig.appName}", + label: "Send from ${AppConfig.appName}", buttonHeight: ButtonHeight.l, onPressed: sendFromStack, ), diff --git a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_1.dart b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_1.dart index afa894500..6d9c61831 100644 --- a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_1.dart +++ b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_1.dart @@ -10,18 +10,19 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import '../step_scaffold.dart'; -import 'desktop_step_item.dart'; + import '../../../../providers/providers.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/enums/exchange_rate_type_enum.dart'; import '../../../../utilities/text_styles.dart'; import '../../../../widgets/rounded_white_container.dart'; +import '../step_scaffold.dart'; +import 'desktop_step_item.dart'; class DesktopStep1 extends ConsumerWidget { const DesktopStep1({ - Key? key, - }) : super(key: key); + super.key, + }); @override Widget build(BuildContext context, WidgetRef ref) { @@ -73,13 +74,17 @@ class DesktopStep1 extends ConsumerWidget { color: Theme.of(context).extension()!.background, ), DesktopStepItem( - label: ref.watch(desktopExchangeModelProvider - .select((value) => value!.rateType)) == + label: ref.watch( + desktopExchangeModelProvider + .select((value) => value!.rateType), + ) == ExchangeRateType.estimated ? "Estimated rate" : "Fixed rate", - value: ref.watch(desktopExchangeModelProvider - .select((value) => value!.rateInfo)), + value: ref.watch( + desktopExchangeModelProvider + .select((value) => value!.rateInfo), + ), ), ], ), diff --git a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_2.dart b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_2.dart index a1ff7fb8d..64f4e4471 100644 --- a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_2.dart +++ b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_2.dart @@ -37,10 +37,10 @@ import '../step_scaffold.dart'; class DesktopStep2 extends ConsumerStatefulWidget { const DesktopStep2({ - Key? key, + super.key, required this.enableNextChanged, this.clipboard = const ClipboardWrapper(), - }) : super(key: key); + }); final ClipboardInterface clipboard; final void Function(bool) enableNextChanged; diff --git a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_3.dart b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_3.dart index d60a552ce..8dfb82734 100644 --- a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_3.dart +++ b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_3.dart @@ -20,8 +20,8 @@ import '../../../../widgets/rounded_white_container.dart'; class DesktopStep3 extends ConsumerStatefulWidget { const DesktopStep3({ - Key? key, - }) : super(key: key); + super.key, + }); @override ConsumerState createState() => _DesktopStep3State(); @@ -71,13 +71,17 @@ class _DesktopStep3State extends ConsumerState { color: Theme.of(context).extension()!.background, ), DesktopStepItem( - label: ref.watch(desktopExchangeModelProvider - .select((value) => value!.rateType)) == + label: ref.watch( + desktopExchangeModelProvider + .select((value) => value!.rateType), + ) == ExchangeRateType.estimated ? "Estimated rate" : "Fixed rate", - value: ref.watch(desktopExchangeModelProvider - .select((value) => value!.rateInfo)), + value: ref.watch( + desktopExchangeModelProvider + .select((value) => value!.rateInfo), + ), ), Container( height: 1, @@ -87,8 +91,10 @@ class _DesktopStep3State extends ConsumerState { vertical: true, label: "Recipient ${ref.watch(desktopExchangeModelProvider.select((value) => value!.receiveTicker.toUpperCase()))} address", - value: ref.watch(desktopExchangeModelProvider - .select((value) => value!.recipientAddress)) ?? + value: ref.watch( + desktopExchangeModelProvider + .select((value) => value!.recipientAddress), + ) ?? "Error", ), Container( @@ -99,8 +105,10 @@ class _DesktopStep3State extends ConsumerState { vertical: true, label: "Refund ${ref.watch(desktopExchangeModelProvider.select((value) => value!.sendTicker.toUpperCase()))} address", - value: ref.watch(desktopExchangeModelProvider - .select((value) => value!.refundAddress)) ?? + value: ref.watch( + desktopExchangeModelProvider + .select((value) => value!.refundAddress), + ) ?? "Error", ), ], diff --git a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_4.dart b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_4.dart index b831653a9..dd30adee2 100644 --- a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_4.dart +++ b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_4.dart @@ -12,19 +12,20 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../../app_config.dart'; -import '../step_scaffold.dart'; -import 'desktop_step_item.dart'; import '../../../../providers/providers.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/text_styles.dart'; import '../../../../widgets/rounded_container.dart'; import '../../../../widgets/rounded_white_container.dart'; +import '../step_scaffold.dart'; +import 'desktop_step_item.dart'; class DesktopStep4 extends ConsumerStatefulWidget { const DesktopStep4({ - Key? key, - }) : super(key: key); + super.key, + }); @override ConsumerState createState() => _DesktopStep4State(); @@ -147,26 +148,34 @@ class _DesktopStep4State extends ConsumerState { vertical: true, label: "Send ${ref.watch(desktopExchangeModelProvider.select((value) => value!.sendTicker.toUpperCase()))} to this address", - value: ref.watch(desktopExchangeModelProvider - .select((value) => value!.trade?.payInAddress)) ?? + value: ref.watch( + desktopExchangeModelProvider + .select((value) => value!.trade?.payInAddress), + ) ?? "Error", ), Container( height: 1, color: Theme.of(context).extension()!.background, ), - if (ref.watch(desktopExchangeModelProvider - .select((value) => value!.trade?.payInExtraId)) != + if (ref.watch( + desktopExchangeModelProvider + .select((value) => value!.trade?.payInExtraId), + ) != null) DesktopStepItem( vertical: true, label: "Memo", - value: ref.watch(desktopExchangeModelProvider - .select((value) => value!.trade?.payInExtraId)) ?? + value: ref.watch( + desktopExchangeModelProvider + .select((value) => value!.trade?.payInExtraId), + ) ?? "Error", ), - if (ref.watch(desktopExchangeModelProvider - .select((value) => value!.trade?.payInExtraId)) != + if (ref.watch( + desktopExchangeModelProvider + .select((value) => value!.trade?.payInExtraId), + ) != null) Container( height: 1, @@ -183,8 +192,10 @@ class _DesktopStep4State extends ConsumerState { ), DesktopStepItem( label: "Trade ID", - value: ref.watch(desktopExchangeModelProvider - .select((value) => value!.trade?.tradeId)) ?? + value: ref.watch( + desktopExchangeModelProvider + .select((value) => value!.trade?.tradeId), + ) ?? "Error", ), Container( diff --git a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_item.dart b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_item.dart index 6b169f573..352e353fb 100644 --- a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_item.dart +++ b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_item.dart @@ -9,18 +9,19 @@ */ import 'package:flutter/material.dart'; + import '../../../../themes/stack_colors.dart'; import '../../../../utilities/text_styles.dart'; import '../../../../widgets/conditional_parent.dart'; class DesktopStepItem extends StatelessWidget { - const DesktopStepItem( - {Key? key, - required this.label, - required this.value, - this.padding = const EdgeInsets.all(16), - this.vertical = false}) - : super(key: key); + const DesktopStepItem({ + super.key, + required this.label, + required this.value, + this.padding = const EdgeInsets.all(16), + this.vertical = false, + }); final String label; final String value; diff --git a/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_choose_from_stack.dart b/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_choose_from_stack.dart index bf9f9ffc6..bbe22138e 100644 --- a/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_choose_from_stack.dart +++ b/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_choose_from_stack.dart @@ -11,6 +11,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:tuple/tuple.dart'; + import '../../../providers/providers.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/amount/amount.dart'; @@ -18,7 +20,6 @@ import '../../../utilities/amount/amount_formatter.dart'; import '../../../utilities/assets.dart'; import '../../../utilities/constants.dart'; import '../../../utilities/text_styles.dart'; -import '../../../wallets/crypto_currency/coins/firo.dart'; import '../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../wallets/isar/providers/wallet_info_provider.dart'; import '../../../widgets/custom_buttons/blue_text_button.dart'; @@ -28,7 +29,6 @@ import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/stack_text_field.dart'; import '../../../widgets/textfield_icon_button.dart'; import '../../../widgets/wallet_info_row/sub_widgets/wallet_info_row_coin_icon.dart'; -import 'package:tuple/tuple.dart'; class DesktopChooseFromStack extends ConsumerStatefulWidget { const DesktopChooseFromStack({ @@ -194,8 +194,10 @@ class _DesktopChooseFromStackState height: 5, ), itemBuilder: (context, index) { - final wallet = ref.watch(pWallets - .select((value) => value.getWallet(walletIds[index]))); + final wallet = ref.watch( + pWallets + .select((value) => value.getWallet(walletIds[index])), + ); return RoundedWhiteContainer( borderColor: @@ -216,8 +218,8 @@ class _DesktopChooseFromStackState Text( wallet.info.name, style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, @@ -275,7 +277,7 @@ class _DesktopChooseFromStackState ), ), ], - ) + ), ], ); } diff --git a/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_exchange_steps_indicator.dart b/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_exchange_steps_indicator.dart index 6d2c677cb..c8d4ba9ff 100644 --- a/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_exchange_steps_indicator.dart +++ b/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_exchange_steps_indicator.dart @@ -14,8 +14,7 @@ import '../../../utilities/text_styles.dart'; import '../../../widgets/rounded_container.dart'; class DesktopExchangeStepsIndicator extends StatelessWidget { - const DesktopExchangeStepsIndicator({Key? key, required this.currentStep}) - : super(key: key); + const DesktopExchangeStepsIndicator({super.key, required this.currentStep}); final int currentStep; diff --git a/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_trade_history.dart b/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_trade_history.dart index 86240e37c..d589e2118 100644 --- a/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_trade_history.dart +++ b/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_trade_history.dart @@ -13,6 +13,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; + +import '../../../db/isar/main_db.dart'; import '../../../models/isar/models/blockchain_data/transaction.dart'; import '../../../pages/exchange_view/trade_details_view.dart'; import '../../../providers/exchange/trade_sent_from_stack_lookup_provider.dart'; @@ -27,10 +29,8 @@ import '../../../widgets/desktop/desktop_dialog_close_button.dart'; import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/trade_card.dart'; -import '../../../db/isar/main_db.dart'; - class DesktopTradeHistory extends ConsumerStatefulWidget { - const DesktopTradeHistory({Key? key}) : super(key: key); + const DesktopTradeHistory({super.key}); @override ConsumerState createState() => @@ -154,7 +154,8 @@ class _DesktopTradeHistoryState extends ConsumerState { Text( "Trade details", style: STextStyles.desktopH3( - context), + context, + ), ), DesktopDialogCloseButton( onPressedOverride: @@ -173,8 +174,10 @@ class _DesktopTradeHistoryState extends ConsumerState { tradeId: tradeId, transactionIfSentFromStack: tx, walletName: ref.read( - pWalletName( - walletIds.first)), + pWalletName( + walletIds.first, + ), + ), walletId: walletIds.first, ), ), @@ -220,7 +223,8 @@ class _DesktopTradeHistoryState extends ConsumerState { Text( "Trade details", style: STextStyles.desktopH3( - context), + context, + ), ), DesktopDialogCloseButton( onPressedOverride: diff --git a/lib/pages_desktop_specific/desktop_home_view.dart b/lib/pages_desktop_specific/desktop_home_view.dart index 80ca02051..980b563a0 100644 --- a/lib/pages_desktop_specific/desktop_home_view.dart +++ b/lib/pages_desktop_specific/desktop_home_view.dart @@ -10,15 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'address_book_view/desktop_address_book.dart'; -import 'desktop_buy/desktop_buy_view.dart'; -import 'desktop_exchange/desktop_exchange_view.dart'; -import 'desktop_menu.dart'; -import 'my_stack_view/my_stack_view.dart'; -import 'notifications/desktop_notifications_view.dart'; -import 'settings/desktop_settings_view.dart'; -import 'settings/settings_menu/desktop_about_view.dart'; -import 'settings/settings_menu/desktop_support_view.dart'; + import '../providers/desktop/current_desktop_menu_item.dart'; import '../providers/global/active_wallet_provider.dart'; import '../providers/global/auto_swb_service_provider.dart'; @@ -31,9 +23,18 @@ import '../route_generator.dart'; import '../themes/stack_colors.dart'; import '../utilities/enums/backup_frequency_type.dart'; import '../widgets/background.dart'; +import 'address_book_view/desktop_address_book.dart'; +import 'desktop_buy/desktop_buy_view.dart'; +import 'desktop_exchange/desktop_exchange_view.dart'; +import 'desktop_menu.dart'; +import 'my_stack_view/my_stack_view.dart'; +import 'notifications/desktop_notifications_view.dart'; +import 'settings/desktop_settings_view.dart'; +import 'settings/settings_menu/desktop_about_view.dart'; +import 'settings/settings_menu/desktop_support_view.dart'; class DesktopHomeView extends ConsumerStatefulWidget { - const DesktopHomeView({Key? key}) : super(key: key); + const DesktopHomeView({super.key}); static const String routeName = "/desktopHome"; @@ -144,11 +145,13 @@ class _DesktopHomeViewState extends ConsumerState { ref.read(unreadNotificationsStateProvider.state).state; if (unreadNotificationIds.isNotEmpty) { - List> futures = []; + final List> futures = []; for (int i = 0; i < unreadNotificationIds.length - 1; i++) { - futures.add(ref - .read(notificationsProvider) - .markAsRead(unreadNotificationIds.elementAt(i), false)); + futures.add( + ref + .read(notificationsProvider) + .markAsRead(unreadNotificationIds.elementAt(i), false), + ); } // wait for multiple to update if any diff --git a/lib/pages_desktop_specific/desktop_menu.dart b/lib/pages_desktop_specific/desktop_menu.dart index 7ff4714a4..868454541 100644 --- a/lib/pages_desktop_specific/desktop_menu.dart +++ b/lib/pages_desktop_specific/desktop_menu.dart @@ -37,10 +37,10 @@ enum DesktopMenuItemId { class DesktopMenu extends ConsumerStatefulWidget { const DesktopMenu({ - Key? key, + super.key, this.onSelectionChanged, this.onSelectionWillChange, - }) : super(key: key); + }); final void Function(DesktopMenuItemId)? onSelectionChanged; final void Function(DesktopMenuItemId)? onSelectionWillChange; @@ -70,7 +70,7 @@ class _DesktopMenuState extends ConsumerState { void toggleMinimize() { final expanded = _width == expandedWidth; - for (var e in controllers) { + for (final e in controllers) { e.toggle?.call(); } @@ -102,7 +102,7 @@ class _DesktopMenuState extends ConsumerState { @override void dispose() { - for (var e in controllers) { + for (final e in controllers) { e.dispose(); } torButtonController.dispose(); diff --git a/lib/pages_desktop_specific/desktop_menu_item.dart b/lib/pages_desktop_specific/desktop_menu_item.dart index c7eee9020..1fde1281c 100644 --- a/lib/pages_desktop_specific/desktop_menu_item.dart +++ b/lib/pages_desktop_specific/desktop_menu_item.dart @@ -13,13 +13,14 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'desktop_menu.dart'; + import '../providers/desktop/current_desktop_menu_item.dart'; import '../providers/global/notifications_provider.dart'; import '../themes/stack_colors.dart'; import '../themes/theme_providers.dart'; import '../utilities/assets.dart'; import '../utilities/text_styles.dart'; +import 'desktop_menu.dart'; class DMIController { VoidCallback? toggle; @@ -29,7 +30,7 @@ class DMIController { } class DesktopMyStackIcon extends ConsumerWidget { - const DesktopMyStackIcon({Key? key}) : super(key: key); + const DesktopMyStackIcon({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -49,7 +50,7 @@ class DesktopMyStackIcon extends ConsumerWidget { } class DesktopExchangeIcon extends ConsumerWidget { - const DesktopExchangeIcon({Key? key}) : super(key: key); + const DesktopExchangeIcon({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -69,7 +70,7 @@ class DesktopExchangeIcon extends ConsumerWidget { } class DesktopBuyIcon extends ConsumerWidget { - const DesktopBuyIcon({Key? key}) : super(key: key); + const DesktopBuyIcon({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -89,12 +90,13 @@ class DesktopBuyIcon extends ConsumerWidget { } class DesktopNotificationsIcon extends ConsumerWidget { - const DesktopNotificationsIcon({Key? key}) : super(key: key); + const DesktopNotificationsIcon({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { - return ref.watch(notificationsProvider - .select((value) => value.hasUnreadNotifications)) + return ref.watch( + notificationsProvider.select((value) => value.hasUnreadNotifications), + ) ? SvgPicture.file( File( ref.watch( @@ -110,8 +112,10 @@ class DesktopNotificationsIcon extends ConsumerWidget { Assets.svg.bell, width: 20, height: 20, - color: ref.watch(notificationsProvider - .select((value) => value.hasUnreadNotifications)) + color: ref.watch( + notificationsProvider + .select((value) => value.hasUnreadNotifications), + ) ? null : DesktopMenuItemId.notifications == ref.watch(currentDesktopMenuItemProvider.state).state @@ -127,7 +131,7 @@ class DesktopNotificationsIcon extends ConsumerWidget { } class DesktopAddressBookIcon extends ConsumerWidget { - const DesktopAddressBookIcon({Key? key}) : super(key: key); + const DesktopAddressBookIcon({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -147,7 +151,7 @@ class DesktopAddressBookIcon extends ConsumerWidget { } class DesktopSettingsIcon extends ConsumerWidget { - const DesktopSettingsIcon({Key? key}) : super(key: key); + const DesktopSettingsIcon({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -167,7 +171,7 @@ class DesktopSettingsIcon extends ConsumerWidget { } class DesktopSupportIcon extends ConsumerWidget { - const DesktopSupportIcon({Key? key}) : super(key: key); + const DesktopSupportIcon({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -187,7 +191,7 @@ class DesktopSupportIcon extends ConsumerWidget { } class DesktopAboutIcon extends ConsumerWidget { - const DesktopAboutIcon({Key? key}) : super(key: key); + const DesktopAboutIcon({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -207,7 +211,7 @@ class DesktopAboutIcon extends ConsumerWidget { } class DesktopExitIcon extends ConsumerWidget { - const DesktopExitIcon({Key? key}) : super(key: key); + const DesktopExitIcon({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -225,7 +229,7 @@ class DesktopExitIcon extends ConsumerWidget { class DesktopMenuItem extends ConsumerStatefulWidget { const DesktopMenuItem({ - Key? key, + super.key, required this.icon, required this.label, required this.value, @@ -233,7 +237,7 @@ class DesktopMenuItem extends ConsumerStatefulWidget { required this.duration, this.labelLength = 125, this.controller, - }) : super(key: key); + }); final Widget icon; final String label; @@ -350,7 +354,7 @@ class _DesktopMenuItemState extends ConsumerState> ), ), ), - ) + ), ], ), ), diff --git a/lib/pages_desktop_specific/lelantus_coins/lelantus_coins_view.dart b/lib/pages_desktop_specific/lelantus_coins/lelantus_coins_view.dart index 12b118cba..61624a272 100644 --- a/lib/pages_desktop_specific/lelantus_coins/lelantus_coins_view.dart +++ b/lib/pages_desktop_specific/lelantus_coins/lelantus_coins_view.dart @@ -24,9 +24,9 @@ import '../../widgets/rounded_white_container.dart'; class LelantusCoinsView extends ConsumerStatefulWidget { const LelantusCoinsView({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); static const String routeName = "/lelantusCoinsView"; diff --git a/lib/pages_desktop_specific/my_stack_view/coin_wallets_table.dart b/lib/pages_desktop_specific/my_stack_view/coin_wallets_table.dart index 70c11546c..e440af8fe 100644 --- a/lib/pages_desktop_specific/my_stack_view/coin_wallets_table.dart +++ b/lib/pages_desktop_specific/my_stack_view/coin_wallets_table.dart @@ -117,9 +117,9 @@ class CoinWalletsTable extends ConsumerWidget { class WalletRowHoverOverlay extends StatefulWidget { const WalletRowHoverOverlay({ - Key? key, + super.key, required this.onPressed, - }) : super(key: key); + }); final VoidCallback onPressed; diff --git a/lib/pages_desktop_specific/my_stack_view/desktop_favorite_wallets.dart b/lib/pages_desktop_specific/my_stack_view/desktop_favorite_wallets.dart index 994a5f949..4ec2e43a4 100644 --- a/lib/pages_desktop_specific/my_stack_view/desktop_favorite_wallets.dart +++ b/lib/pages_desktop_specific/my_stack_view/desktop_favorite_wallets.dart @@ -11,6 +11,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../pages/manage_favorites_view/manage_favorites_view.dart'; import '../../pages/wallets_view/sub_widgets/favorite_card.dart'; import '../../themes/stack_colors.dart'; @@ -21,7 +22,7 @@ import '../../wallets/isar/providers/favourite_wallets_provider.dart'; import '../../widgets/custom_buttons/blue_text_button.dart'; class DesktopFavoriteWallets extends ConsumerWidget { - const DesktopFavoriteWallets({Key? key}) : super(key: key); + const DesktopFavoriteWallets({super.key}); static const cardWidth = 220.0; static const cardHeight = 125.0; @@ -78,7 +79,7 @@ class DesktopFavoriteWallets extends ConsumerWidget { width: cardWidth, height: cardHeight, ); - }) + }), ], ), ) @@ -101,7 +102,8 @@ class DesktopFavoriteWallets extends ConsumerWidget { materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius), + Constants.size.circularBorderRadius, + ), ), onPressed: () { Navigator.of(context) diff --git a/lib/pages_desktop_specific/my_stack_view/dialogs/desktop_expanding_wallet_card.dart b/lib/pages_desktop_specific/my_stack_view/dialogs/desktop_expanding_wallet_card.dart index 22fe2250f..5246a6b16 100644 --- a/lib/pages_desktop_specific/my_stack_view/dialogs/desktop_expanding_wallet_card.dart +++ b/lib/pages_desktop_specific/my_stack_view/dialogs/desktop_expanding_wallet_card.dart @@ -27,10 +27,10 @@ import 'package:tuple/tuple.dart'; class DesktopExpandingWalletCard extends StatefulWidget { const DesktopExpandingWalletCard({ - Key? key, + super.key, required this.data, required this.navigatorState, - }) : super(key: key); + }); final Tuple2> data; final NavigatorState navigatorState; diff --git a/lib/pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart b/lib/pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart index 57848404b..5c43cb131 100644 --- a/lib/pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart +++ b/lib/pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart @@ -16,9 +16,9 @@ import '../../utilities/text_styles.dart'; class ExitToMyStackButton extends StatelessWidget { const ExitToMyStackButton({ - Key? key, + super.key, this.onPressed, - }) : super(key: key); + }); final VoidCallback? onPressed; diff --git a/lib/pages_desktop_specific/my_stack_view/my_stack_view.dart b/lib/pages_desktop_specific/my_stack_view/my_stack_view.dart index e981979db..99a55c8dd 100644 --- a/lib/pages_desktop_specific/my_stack_view/my_stack_view.dart +++ b/lib/pages_desktop_specific/my_stack_view/my_stack_view.dart @@ -124,7 +124,7 @@ class _DesktopMyStackTitleState extends ConsumerState { Text( "My ${AppConfig.prefix}", style: STextStyles.desktopH3(context), - ) + ), ], ); } diff --git a/lib/pages_desktop_specific/my_stack_view/my_wallets.dart b/lib/pages_desktop_specific/my_stack_view/my_wallets.dart index 1e8789239..70a756452 100644 --- a/lib/pages_desktop_specific/my_stack_view/my_wallets.dart +++ b/lib/pages_desktop_specific/my_stack_view/my_wallets.dart @@ -10,16 +10,17 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../pages/add_wallet_views/add_wallet_view/add_wallet_view.dart'; -import 'desktop_favorite_wallets.dart'; -import 'wallet_summary_table.dart'; import '../../providers/providers.dart'; import '../../themes/stack_colors.dart'; import '../../utilities/text_styles.dart'; import '../../widgets/custom_buttons/blue_text_button.dart'; +import 'desktop_favorite_wallets.dart'; +import 'wallet_summary_table.dart'; class MyWallets extends ConsumerStatefulWidget { - const MyWallets({Key? key}) : super(key: key); + const MyWallets({super.key}); @override ConsumerState createState() => _MyWalletsState(); @@ -28,8 +29,9 @@ class MyWallets extends ConsumerStatefulWidget { class _MyWalletsState extends ConsumerState { @override Widget build(BuildContext context) { - final showFavorites = ref.watch(prefsChangeNotifierProvider - .select((value) => value.showFavoriteWallets)); + final showFavorites = ref.watch( + prefsChangeNotifierProvider.select((value) => value.showFavoriteWallets), + ); return Padding( padding: const EdgeInsets.only( diff --git a/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart b/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart index 4aef6a2ba..023b9fb79 100644 --- a/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart +++ b/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart @@ -13,9 +13,9 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../models/paynym/paynym_account_lite.dart'; import '../../../models/send_view_auto_fill_data.dart'; -import '../wallet_view/sub_widgets/desktop_send.dart'; import '../../../providers/global/locale_provider.dart'; import '../../../providers/global/prefs_provider.dart'; import '../../../providers/global/price_provider.dart'; @@ -30,16 +30,17 @@ import '../../../wallets/isar/providers/wallet_info_provider.dart'; import '../../../widgets/desktop/desktop_dialog.dart'; import '../../../widgets/desktop/desktop_dialog_close_button.dart'; import '../../../widgets/rounded_white_container.dart'; +import '../wallet_view/sub_widgets/desktop_send.dart'; class DesktopPaynymSendDialog extends ConsumerStatefulWidget { const DesktopPaynymSendDialog({ - Key? key, + super.key, required this.walletId, this.autoFillData, this.clipboard = const ClipboardWrapper(), this.barcodeScanner = const BarcodeScannerWrapper(), this.accountLite, - }) : super(key: key); + }); final String walletId; final SendViewAutoFillData? autoFillData; @@ -57,7 +58,8 @@ class _DesktopPaynymSendDialogState @override Widget build(BuildContext context) { final String locale = ref.watch( - localeServiceChangeNotifierProvider.select((value) => value.locale)); + localeServiceChangeNotifierProvider.select((value) => value.locale), + ); final coin = ref.watch(pWalletCoin(widget.walletId)); @@ -126,9 +128,11 @@ class _DesktopPaynymSendDialogState crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - ref.watch(pAmountFormatter(coin)).format(ref - .watch(pWalletBalance(widget.walletId)) - .spendable), + ref.watch(pAmountFormatter(coin)).format( + ref + .watch(pWalletBalance(widget.walletId)) + .spendable, + ), style: STextStyles.titleBold12(context), textAlign: TextAlign.right, ), @@ -142,16 +146,18 @@ class _DesktopPaynymSendDialogState ), )).toAmount(fractionDigits: 2).fiatString( locale: locale, - )} ${ref.watch(prefsChangeNotifierProvider.select( - (value) => value.currency, - ))}", + )} ${ref.watch( + prefsChangeNotifierProvider.select( + (value) => value.currency, + ), + )}", style: STextStyles.baseXS(context).copyWith( color: Theme.of(context) .extension()! .textSubtitle1, ), textAlign: TextAlign.right, - ) + ), ], ), ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart b/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart index 762e0f58f..f38296cd5 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart @@ -186,7 +186,7 @@ class _DesktopWalletSummaryRowState .extension()! .textDark, ), - ) + ), ], ), ), @@ -218,7 +218,7 @@ class _DesktopWalletSummaryRowState } class TablePriceInfo extends ConsumerWidget { - const TablePriceInfo({Key? key, required this.coin}) : super(key: key); + const TablePriceInfo({super.key, required this.coin}); final CryptoCurrency coin; diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/desktop_token_view.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/desktop_token_view.dart index 9f4c17780..e30245c4d 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/desktop_token_view.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/desktop_token_view.dart @@ -36,10 +36,10 @@ import '../../../widgets/rounded_white_container.dart'; /// [eventBus] should only be set during testing class DesktopTokenView extends ConsumerStatefulWidget { const DesktopTokenView({ - Key? key, + super.key, required this.walletId, this.eventBus, - }) : super(key: key); + }); static const String routeName = "/desktopTokenView"; diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/desktop_wallet_view.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/desktop_wallet_view.dart index 58ae825ff..cf47215d1 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/desktop_wallet_view.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/desktop_wallet_view.dart @@ -16,18 +16,18 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:isar/isar.dart'; + +import '../../../db/sqlite/firo_cache.dart'; +import '../../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; +import '../../../models/isar/models/isar_models.dart'; import '../../../pages/add_wallet_views/add_token_view/edit_wallet_tokens_view.dart'; import '../../../pages/token_view/my_tokens_view.dart'; import '../../../pages/wallet_view/sub_widgets/transactions_list.dart'; import '../../../pages/wallet_view/transaction_views/all_transactions_view.dart'; import '../../../pages/wallet_view/transaction_views/tx_v2/all_transactions_v2_view.dart'; import '../../../pages/wallet_view/transaction_views/tx_v2/transaction_v2_list.dart'; -import 'sub_widgets/desktop_wallet_features.dart'; -import 'sub_widgets/desktop_wallet_summary.dart'; -import 'sub_widgets/my_wallet.dart'; -import 'sub_widgets/network_info_button.dart'; -import 'sub_widgets/wallet_keys_button.dart'; -import 'sub_widgets/wallet_options_button.dart'; +import '../../../providers/db/main_db_provider.dart'; import '../../../providers/global/active_wallet_provider.dart'; import '../../../providers/global/auto_swb_service_provider.dart'; import '../../../providers/providers.dart'; @@ -40,22 +40,31 @@ import '../../../utilities/assets.dart'; import '../../../utilities/enums/backup_frequency_type.dart'; import '../../../utilities/enums/sync_type_enum.dart'; import '../../../utilities/text_styles.dart'; +import '../../../utilities/wallet_tools.dart'; import '../../../wallets/isar/providers/wallet_info_provider.dart'; import '../../../wallets/wallet/impl/banano_wallet.dart'; +import '../../../wallets/wallet/impl/firo_wallet.dart'; import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../widgets/custom_buttons/blue_text_button.dart'; import '../../../widgets/desktop/desktop_app_bar.dart'; import '../../../widgets/desktop/desktop_scaffold.dart'; import '../../../widgets/hover_text_field.dart'; import '../../../widgets/rounded_white_container.dart'; +import '../../coin_control/desktop_coin_control_use_dialog.dart'; +import 'sub_widgets/desktop_wallet_features.dart'; +import 'sub_widgets/desktop_wallet_summary.dart'; +import 'sub_widgets/my_wallet.dart'; +import 'sub_widgets/network_info_button.dart'; +import 'sub_widgets/wallet_keys_button.dart'; +import 'sub_widgets/wallet_options_button.dart'; /// [eventBus] should only be set during testing class DesktopWalletView extends ConsumerStatefulWidget { const DesktopWalletView({ - Key? key, + super.key, required this.walletId, this.eventBus, - }) : super(key: key); + }); static const String routeName = "/desktopWalletView"; @@ -127,8 +136,12 @@ class _DesktopWalletViewState extends ConsumerState { eventBus = widget.eventBus != null ? widget.eventBus! : GlobalEventBus.instance; - WidgetsBinding.instance.addPostFrameCallback((_) => - ref.read(currentWalletIdProvider.notifier).state = wallet.walletId); + WidgetsBinding.instance.addPostFrameCallback( + (_) { + ref.read(currentWalletIdProvider.notifier).state = wallet.walletId; + ref.read(desktopUseUTXOs.notifier).state = {}; + }, + ); if (!wallet.shouldAutoSync) { // // enable auto sync if it wasn't enabled when loading wallet @@ -205,17 +218,89 @@ class _DesktopWalletViewState extends ConsumerState { ), if (kDebugMode) const Spacer(), if (kDebugMode) - Row( + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text( - "Debug Height:", + Row( + children: [ + const Text( + "dbgHeight: ", + ), + const SizedBox( + width: 2, + ), + Text( + ref + .watch(pWalletChainHeight(widget.walletId)) + .toString(), + ), + ], ), - const SizedBox( - width: 2, - ), - Text( - ref.watch(pWalletChainHeight(widget.walletId)).toString(), + Row( + children: [ + const Text( + "dbgTxCount: ", + ), + const SizedBox( + width: 2, + ), + Text( + wallet.isarTransactionVersion == 2 + ? ref + .watch(mainDBProvider) + .isar + .transactionV2s + .where() + .walletIdEqualTo(widget.walletId) + .countSync() + .toString() + : ref + .watch(mainDBProvider) + .isar + .transactions + .where() + .walletIdEqualTo(widget.walletId) + .countSync() + .toString(), + ), + ], ), + if (wallet.isarTransactionVersion == 2 && + wallet is FiroWallet) + Row( + children: [ + const Text( + "dbgBal: ", + ), + const SizedBox( + width: 2, + ), + Text( + WalletDevTools.checkFiroTransactionTally( + widget.walletId, + ), + ), + ], + ), + if (wallet.isarTransactionVersion == 2 && + wallet is FiroWallet) + Row( + children: [ + const Text( + "sparkCache: ", + ), + const SizedBox( + width: 2, + ), + FutureBuilder( + future: FiroCacheCoordinator.getSparkCacheSize(), + builder: (_, snapshot) => Text( + snapshot.data ?? "", + ), + ), + ], + ), ], ), const Spacer(), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/address_book_address_chooser.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/address_book_address_chooser.dart index a3132262b..5e1252be4 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/address_book_address_chooser.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/address_book_address_chooser.dart @@ -11,8 +11,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../../../../../models/isar/models/contact_entry.dart'; -import 'sub_widgets/contact_list_item.dart'; import '../../../../../providers/global/address_book_service_provider.dart'; import '../../../../../themes/stack_colors.dart'; import '../../../../../utilities/assets.dart'; @@ -23,6 +23,7 @@ import '../../../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../../../widgets/icon_widgets/x_icon.dart'; import '../../../../../widgets/stack_text_field.dart'; import '../../../../../widgets/textfield_icon_button.dart'; +import 'sub_widgets/contact_list_item.dart'; class AddressBookAddressChooser extends StatefulWidget { const AddressBookAddressChooser({ @@ -69,8 +70,9 @@ class _AddressBookAddressChooserState extends State { List filter(List contacts, String searchTerm) { if (widget.coin != null) { - contacts.removeWhere((e) => - e.addressesSorted.where((a) => a.coin == widget.coin!).isEmpty); + contacts.removeWhere( + (e) => e.addressesSorted.where((a) => a.coin == widget.coin!).isEmpty, + ); } contacts.retainWhere((e) => _matches(searchTerm, e)); @@ -202,8 +204,10 @@ class _AddressBookAddressChooserState extends State { child: Consumer( builder: (context, ref, _) { List contacts = ref - .watch(addressBookServiceProvider - .select((value) => value.contacts)) + .watch( + addressBookServiceProvider + .select((value) => value.contacts), + ) .toList(); contacts = filter(contacts, _searchTerm); @@ -227,7 +231,8 @@ class _AddressBookAddressChooserState extends State { if (index == 0) { return Padding( key: const Key( - "addressBookCAddressChooserFavoritesHeaderItemKey"), + "addressBookCAddressChooserFavoritesHeaderItemKey", + ), padding: const EdgeInsets.only( bottom: 10, ), @@ -247,7 +252,8 @@ class _AddressBookAddressChooserState extends State { } else if (index == favorites.length + 1) { return Padding( key: const Key( - "addressBookCAddressChooserAllContactsHeaderItemKey"), + "addressBookCAddressChooserAllContactsHeaderItemKey", + ), padding: const EdgeInsets.symmetric( vertical: 10, ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/sub_widgets/contact_list_item.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/sub_widgets/contact_list_item.dart index be7d7d138..bb7c00cea 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/sub_widgets/contact_list_item.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/sub_widgets/contact_list_item.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../../../../providers/global/address_book_service_provider.dart'; import '../../../../../../themes/stack_colors.dart'; import '../../../../../../utilities/text_styles.dart'; @@ -49,8 +50,10 @@ class _ContactListItemState extends ConsumerState { @override Widget build(BuildContext context) { - final contact = ref.watch(addressBookServiceProvider - .select((value) => value.getContactById(contactId))); + final contact = ref.watch( + addressBookServiceProvider + .select((value) => value.getContactById(contactId)), + ); // hack fix until we use a proper database (not Hive) int i = 0; @@ -79,12 +82,14 @@ class _ContactListItemState extends ConsumerState { children: [ // filter addresses by coin is provided before building address list ...contact.addressesSorted - .where((e) => - filterByCoin != null ? e.coin == filterByCoin! : true) + .where( + (e) => filterByCoin != null ? e.coin == filterByCoin! : true, + ) .map( (e) => Column( key: Key( - "contactAddress_${e.address}_${e.label}_${++i}_key"), + "contactAddress_${e.address}_${e.label}_${++i}_key", + ), mainAxisSize: MainAxisSize.min, children: [ Container( @@ -117,9 +122,9 @@ class _ContactListItemState extends ConsumerState { Text( "${contactId == "default" ? e.other! : e.label} (${e.coin.ticker})", style: STextStyles - .desktopTextExtraExtraSmall( - context) - .copyWith( + .desktopTextExtraExtraSmall( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, @@ -132,7 +137,8 @@ class _ContactListItemState extends ConsumerState { e.address, style: STextStyles .desktopTextExtraExtraSmall( - context), + context, + ), ), ), ], @@ -151,7 +157,7 @@ class _ContactListItemState extends ConsumerState { ), ], ), - ) + ), ], ), ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/delete_wallet_keys_popup.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/delete_wallet_keys_popup.dart index fd5349380..bd6dac13f 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/delete_wallet_keys_popup.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/delete_wallet_keys_popup.dart @@ -30,11 +30,11 @@ import '../../../../widgets/desktop/secondary_button.dart'; class DeleteWalletKeysPopup extends ConsumerStatefulWidget { const DeleteWalletKeysPopup({ - Key? key, + super.key, required this.walletId, required this.words, this.clipboardInterface = const ClipboardWrapper(), - }) : super(key: key); + }); final String walletId; final List words; @@ -188,9 +188,9 @@ class _DeleteWalletKeysPopup extends ConsumerState { class ConfirmDelete extends ConsumerStatefulWidget { const ConfirmDelete({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_auth_send.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_auth_send.dart index f4dffdb00..c38b33a61 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_auth_send.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_auth_send.dart @@ -13,6 +13,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../../../../providers/desktop/storage_crypto_handler_provider.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; @@ -170,7 +171,8 @@ class _DesktopAuthSendState extends ConsumerState { ), GestureDetector( key: const Key( - "restoreFromFilePasswordFieldShowPasswordButtonKey"), + "restoreFromFilePasswordFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; @@ -224,7 +226,7 @@ class _DesktopAuthSendState extends ConsumerState { ), ), ], - ) + ), ], ); } diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_balance_toggle_button.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_balance_toggle_button.dart index e873843b1..abe41055c 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_balance_toggle_button.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_balance_toggle_button.dart @@ -21,9 +21,9 @@ import '../../../../utilities/text_styles.dart'; class DesktopBalanceToggleButton extends ConsumerWidget { const DesktopBalanceToggleButton({ - Key? key, + super.key, this.onPressed, - }) : super(key: key); + }); final VoidCallback? onPressed; @@ -74,9 +74,9 @@ class DesktopBalanceToggleButton extends ConsumerWidget { class DesktopPrivateBalanceToggleButton extends ConsumerWidget { const DesktopPrivateBalanceToggleButton({ - Key? key, + super.key, this.onPressed, - }) : super(key: key); + }); final VoidCallback? onPressed; diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_delete_wallet_dialog.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_delete_wallet_dialog.dart index ddad5fd55..e8c6f89e9 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_delete_wallet_dialog.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_delete_wallet_dialog.dart @@ -13,8 +13,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../../notifications/show_flush_bar.dart'; -import 'desktop_attention_delete_wallet.dart'; import '../../../../providers/desktop/storage_crypto_handler_provider.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; @@ -26,12 +26,13 @@ import '../../../../widgets/desktop/primary_button.dart'; import '../../../../widgets/desktop/secondary_button.dart'; import '../../../../widgets/loading_indicator.dart'; import '../../../../widgets/stack_text_field.dart'; +import 'desktop_attention_delete_wallet.dart'; class DesktopDeleteWalletDialog extends ConsumerStatefulWidget { const DesktopDeleteWalletDialog({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; @@ -54,10 +55,10 @@ class _DesktopDeleteWalletDialog unawaited( showDialog( context: context, - builder: (context) => Column( + builder: (context) => const Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, - children: const [ + children: [ LoadingIndicator( width: 200, height: 200, @@ -190,7 +191,8 @@ class _DesktopDeleteWalletDialog ), GestureDetector( key: const Key( - "desktopDeleteWalletShowPasswordButtonKey"), + "desktopDeleteWalletShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; @@ -252,7 +254,7 @@ class _DesktopDeleteWalletDialog : null, ), ], - ) + ), ], ), ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_fee_dropdown.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_fee_dropdown.dart index a592d60bb..3b25f0dad 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_fee_dropdown.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_fee_dropdown.dart @@ -13,6 +13,7 @@ import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../../models/models.dart'; import '../../../../pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart'; import '../../../../providers/global/wallets_provider.dart'; @@ -25,10 +26,6 @@ import '../../../../utilities/assets.dart'; import '../../../../utilities/constants.dart'; import '../../../../utilities/enums/fee_rate_type_enum.dart'; import '../../../../utilities/text_styles.dart'; -import '../../../../wallets/crypto_currency/coins/ethereum.dart'; -import '../../../../wallets/crypto_currency/coins/firo.dart'; -import '../../../../wallets/crypto_currency/coins/monero.dart'; -import '../../../../wallets/crypto_currency/coins/wownero.dart'; import '../../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../../wallets/isar/providers/eth/current_token_wallet_provider.dart'; import '../../../../wallets/isar/providers/wallet_info_provider.dart'; @@ -76,9 +73,11 @@ class _DesktopFeeDropDownState extends ConsumerState { switch (feeRateType) { case FeeRateType.fast: if (ref - .read(widget.isToken - ? tokenFeeSessionCacheProvider - : feeSheetSessionCacheProvider) + .read( + widget.isToken + ? tokenFeeSessionCacheProvider + : feeSheetSessionCacheProvider, + ) .fast[amount] == null) { if (widget.isToken == false) { @@ -86,7 +85,9 @@ class _DesktopFeeDropDownState extends ConsumerState { if (coin is Monero || coin is Wownero) { final fee = await wallet.estimateFeeFor( - amount, MoneroTransactionPriority.fast.raw!); + amount, + MoneroTransactionPriority.fast.raw!, + ); ref.read(feeSheetSessionCacheProvider).fast[amount] = fee; } else if (coin is Firo) { final Amount fee; @@ -113,16 +114,20 @@ class _DesktopFeeDropDownState extends ConsumerState { } } return ref - .read(widget.isToken - ? tokenFeeSessionCacheProvider - : feeSheetSessionCacheProvider) + .read( + widget.isToken + ? tokenFeeSessionCacheProvider + : feeSheetSessionCacheProvider, + ) .fast[amount]!; case FeeRateType.average: if (ref - .read(widget.isToken - ? tokenFeeSessionCacheProvider - : feeSheetSessionCacheProvider) + .read( + widget.isToken + ? tokenFeeSessionCacheProvider + : feeSheetSessionCacheProvider, + ) .average[amount] == null) { if (widget.isToken == false) { @@ -130,7 +135,9 @@ class _DesktopFeeDropDownState extends ConsumerState { if (coin is Monero || coin is Wownero) { final fee = await wallet.estimateFeeFor( - amount, MoneroTransactionPriority.regular.raw!); + amount, + MoneroTransactionPriority.regular.raw!, + ); ref.read(feeSheetSessionCacheProvider).average[amount] = fee; } else if (coin is Firo) { final Amount fee; @@ -157,16 +164,20 @@ class _DesktopFeeDropDownState extends ConsumerState { } } return ref - .read(widget.isToken - ? tokenFeeSessionCacheProvider - : feeSheetSessionCacheProvider) + .read( + widget.isToken + ? tokenFeeSessionCacheProvider + : feeSheetSessionCacheProvider, + ) .average[amount]!; case FeeRateType.slow: if (ref - .read(widget.isToken - ? tokenFeeSessionCacheProvider - : feeSheetSessionCacheProvider) + .read( + widget.isToken + ? tokenFeeSessionCacheProvider + : feeSheetSessionCacheProvider, + ) .slow[amount] == null) { if (widget.isToken == false) { @@ -174,7 +185,9 @@ class _DesktopFeeDropDownState extends ConsumerState { if (coin is Monero || coin is Wownero) { final fee = await wallet.estimateFeeFor( - amount, MoneroTransactionPriority.slow.raw!); + amount, + MoneroTransactionPriority.slow.raw!, + ); ref.read(feeSheetSessionCacheProvider).slow[amount] = fee; } else if (coin is Firo) { final Amount fee; @@ -201,9 +214,11 @@ class _DesktopFeeDropDownState extends ConsumerState { } } return ref - .read(widget.isToken - ? tokenFeeSessionCacheProvider - : feeSheetSessionCacheProvider) + .read( + widget.isToken + ? tokenFeeSessionCacheProvider + : feeSheetSessionCacheProvider, + ) .slow[amount]!; default: return Amount.zero; @@ -295,13 +310,13 @@ final sendAmountProvider = class FeeDropDownChild extends ConsumerWidget { const FeeDropDownChild({ - Key? key, + super.key, required this.feeObject, required this.feeRateType, required this.walletId, required this.feeFor, required this.isSelected, - }) : super(key: key); + }); final FeeObject? feeObject; final FeeRateType feeRateType; @@ -322,10 +337,12 @@ class FeeDropDownChild extends ConsumerWidget { ]; String estimatedTimeToBeIncludedInNextBlock( - int targetBlockTime, int estimatedNumberOfBlocks) { - int time = targetBlockTime * estimatedNumberOfBlocks; + int targetBlockTime, + int estimatedNumberOfBlocks, + ) { + final int time = targetBlockTime * estimatedNumberOfBlocks; - int hours = (time / 3600).floor(); + final int hours = (time / 3600).floor(); if (hours > 1) { return "~$hours hours"; } else if (hours == 1) { diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart index 974e1f7f2..78031971e 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart @@ -17,6 +17,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:isar/isar.dart'; import 'package:qr_flutter/qr_flutter.dart'; +import 'package:tuple/tuple.dart'; + import '../../../../models/isar/models/isar_models.dart'; import '../../../../notifications/show_flush_bar.dart'; import '../../../../pages/receive_view/generate_receiving_uri_qr_code_view.dart'; @@ -41,7 +43,6 @@ import '../../../../widgets/custom_loading_overlay.dart'; import '../../../../widgets/desktop/desktop_dialog.dart'; import '../../../../widgets/desktop/secondary_button.dart'; import '../../../../widgets/rounded_white_container.dart'; -import 'package:tuple/tuple.dart'; class DesktopReceive extends ConsumerStatefulWidget { const DesktopReceive({ @@ -345,8 +346,8 @@ class _DesktopReceiveState extends ConsumerState { _sparkAddress ?? "Error", style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, @@ -370,7 +371,8 @@ class _DesktopReceiveState extends ConsumerState { onTap: () { clipboard.setData( ClipboardData( - text: ref.watch(pWalletReceivingAddress(walletId))), + text: ref.watch(pWalletReceivingAddress(walletId)), + ), ); showFloatingFlushBar( type: FlushBarType.info, @@ -435,8 +437,8 @@ class _DesktopReceiveState extends ConsumerState { child: Text( ref.watch(pWalletReceivingAddress(walletId)), style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart index afa38b49a..6c7c28296 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart @@ -17,16 +17,13 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../../../../models/isar/models/contact_entry.dart'; import '../../../../models/paynym/paynym_account_lite.dart'; import '../../../../models/send_view_auto_fill_data.dart'; import '../../../../pages/send_view/confirm_transaction_view.dart'; import '../../../../pages/send_view/sub_widgets/building_transaction_dialog.dart'; import '../../../../pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart'; -import '../../../coin_control/desktop_coin_control_use_dialog.dart'; -import '../../../desktop_home_view.dart'; -import 'address_book_address_chooser/address_book_address_chooser.dart'; -import 'desktop_fee_dropdown.dart'; import '../../../../providers/providers.dart'; import '../../../../providers/ui/fee_rate_type_state_provider.dart'; import '../../../../providers/ui/preview_tx_button_state_provider.dart'; @@ -46,13 +43,6 @@ import '../../../../utilities/logger.dart'; import '../../../../utilities/prefs.dart'; import '../../../../utilities/text_styles.dart'; import '../../../../utilities/util.dart'; -import '../../../../wallets/crypto_currency/coins/epiccash.dart'; -import '../../../../wallets/crypto_currency/coins/ethereum.dart'; -import '../../../../wallets/crypto_currency/coins/firo.dart'; -import '../../../../wallets/crypto_currency/coins/monero.dart'; -import '../../../../wallets/crypto_currency/coins/stellar.dart'; -import '../../../../wallets/crypto_currency/coins/tezos.dart'; -import '../../../../wallets/crypto_currency/coins/wownero.dart'; import '../../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../../wallets/crypto_currency/intermediate/nano_currency.dart'; import '../../../../wallets/isar/providers/wallet_info_provider.dart'; @@ -77,6 +67,10 @@ import '../../../../widgets/icon_widgets/x_icon.dart'; import '../../../../widgets/rounded_container.dart'; import '../../../../widgets/stack_text_field.dart'; import '../../../../widgets/textfield_icon_button.dart'; +import '../../../coin_control/desktop_coin_control_use_dialog.dart'; +import '../../../desktop_home_view.dart'; +import 'address_book_address_chooser/address_book_address_chooser.dart'; +import 'desktop_fee_dropdown.dart'; class DesktopSend extends ConsumerStatefulWidget { const DesktopSend({ @@ -954,7 +948,10 @@ class _DesktopSendState extends ConsumerState { (value) => value.enableCoinControl, ), ) && - ref.watch(pWallets).getWallet(walletId) is CoinControlInterface; + ref.watch(pWallets).getWallet(walletId) is CoinControlInterface && + (coin is Firo + ? ref.watch(publicPrivateBalanceStateProvider) == FiroType.public + : true); return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -1049,6 +1046,9 @@ class _DesktopSendState extends ConsumerState { ], onChanged: (value) { if (value is FiroType) { + if (value != FiroType.public) { + ref.read(desktopUseUTXOs.state).state = {}; + } setState(() { ref.read(publicPrivateBalanceStateProvider.state).state = value; diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_token_send.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_token_send.dart index 8272999c8..490465490 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_token_send.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_token_send.dart @@ -37,7 +37,6 @@ import '../../../../utilities/logger.dart'; import '../../../../utilities/prefs.dart'; import '../../../../utilities/text_styles.dart'; import '../../../../utilities/util.dart'; -import '../../../../wallets/crypto_currency/coins/firo.dart'; import '../../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../../wallets/isar/providers/eth/current_token_wallet_provider.dart'; import '../../../../wallets/isar/providers/eth/token_balance_provider.dart'; diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart index 0f55a7c70..2fa0ee1eb 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart @@ -152,7 +152,7 @@ class _DesktopWalletFeaturesState extends ConsumerState { _attemptAnonymize(), ); }, - ) + ), ], ), ], @@ -261,7 +261,7 @@ class _DesktopWalletFeaturesState extends ConsumerState { ), ), ], - ) + ), ], ), ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart index ee2c69156..5f0e0f69b 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart @@ -10,9 +10,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../../models/balance.dart'; import '../../../../pages/wallet_view/sub_widgets/wallet_refresh_button.dart'; -import 'desktop_balance_toggle_button.dart'; import '../../../../providers/providers.dart'; import '../../../../providers/wallet/public_private_balance_state_provider.dart'; import '../../../../providers/wallet/wallet_balance_toggle_state_provider.dart'; @@ -26,14 +26,15 @@ import '../../../../wallets/crypto_currency/coins/firo.dart'; import '../../../../wallets/isar/providers/eth/current_token_wallet_provider.dart'; import '../../../../wallets/isar/providers/eth/token_balance_provider.dart'; import '../../../../wallets/isar/providers/wallet_info_provider.dart'; +import 'desktop_balance_toggle_button.dart'; class DesktopWalletSummary extends ConsumerStatefulWidget { const DesktopWalletSummary({ - Key? key, + super.key, required this.walletId, required this.initialSyncStatus, this.isToken = false, - }) : super(key: key); + }); final String walletId; final WalletSyncStatus initialSyncStatus; @@ -65,7 +66,8 @@ class _WDesktopWalletSummaryState extends ConsumerState { final coin = ref.watch(pWalletCoin(widget.walletId)); final isFiro = coin is Firo; final locale = ref.watch( - localeServiceChangeNotifierProvider.select((value) => value.locale)); + localeServiceChangeNotifierProvider.select((value) => value.locale), + ); final baseCurrency = ref .watch(prefsChangeNotifierProvider.select((value) => value.currency)); @@ -75,10 +77,14 @@ class _WDesktopWalletSummaryState extends ConsumerState { : null; final priceTuple = widget.isToken - ? ref.watch(priceAnd24hChangeNotifierProvider - .select((value) => value.getTokenPrice(tokenContract!.address))) - : ref.watch(priceAnd24hChangeNotifierProvider - .select((value) => value.getPrice(coin))); + ? ref.watch( + priceAnd24hChangeNotifierProvider + .select((value) => value.getTokenPrice(tokenContract!.address)), + ) + : ref.watch( + priceAnd24hChangeNotifierProvider + .select((value) => value.getPrice(coin)), + ); final _showAvailable = ref.watch(walletBalanceToggleStateProvider.state).state == @@ -103,9 +109,12 @@ class _WDesktopWalletSummaryState extends ConsumerState { break; } } else { - Balance balance = widget.isToken - ? ref.watch(pTokenBalance( - (walletId: walletId, contractAddress: tokenContract!.address))) + final Balance balance = widget.isToken + ? ref.watch( + pTokenBalance( + (walletId: walletId, contractAddress: tokenContract!.address), + ), + ) : ref.watch(pWalletBalance(walletId)); balanceToShow = _showAvailable ? balance.spendable : balance.total; diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/more_features/more_features_dialog.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/more_features/more_features_dialog.dart index 29507d545..1ab2a6781 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/more_features/more_features_dialog.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/more_features/more_features_dialog.dart @@ -8,9 +8,13 @@ * */ +import 'dart:convert'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + +import '../../../../../providers/db/main_db_provider.dart'; import '../../../../../providers/global/prefs_provider.dart'; import '../../../../../providers/global/wallets_provider.dart'; import '../../../../../themes/stack_colors.dart'; @@ -18,17 +22,19 @@ import '../../../../../utilities/assets.dart'; import '../../../../../utilities/text_styles.dart'; import '../../../../../wallets/crypto_currency/coins/banano.dart'; import '../../../../../wallets/crypto_currency/coins/firo.dart'; +import '../../../../../wallets/isar/models/wallet_info.dart'; import '../../../../../wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart'; import '../../../../../wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart'; import '../../../../../wallets/wallet/wallet_mixin_interfaces/ordinals_interface.dart'; import '../../../../../wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart'; +import '../../../../../widgets/custom_buttons/draggable_switch_button.dart'; import '../../../../../widgets/desktop/desktop_dialog.dart'; import '../../../../../widgets/desktop/desktop_dialog_close_button.dart'; import '../../../../../widgets/rounded_container.dart'; class MoreFeaturesDialog extends ConsumerStatefulWidget { const MoreFeaturesDialog({ - Key? key, + super.key, required this.walletId, required this.onPaynymPressed, required this.onCoinControlPressed, @@ -37,7 +43,7 @@ class MoreFeaturesDialog extends ConsumerStatefulWidget { required this.onOrdinalsPressed, required this.onMonkeyPressed, required this.onFusionPressed, - }) : super(key: key); + }); final String walletId; final VoidCallback? onPaynymPressed; @@ -53,6 +59,9 @@ class MoreFeaturesDialog extends ConsumerStatefulWidget { } class _MoreFeaturesDialogState extends ConsumerState { + bool _enableLelantusScanning = false; + bool _isUpdatingLelantusScanning = false; // Mutex. + @override Widget build(BuildContext context) { final wallet = ref.watch( @@ -61,6 +70,14 @@ class _MoreFeaturesDialogState extends ConsumerState { ), ); + // Parse otherDataJsonString to get the enableLelantusScanning value. + if (wallet.info.otherDataJsonString != null) { + final otherDataJson = json.decode(wallet.info.otherDataJsonString!); + _enableLelantusScanning = + otherDataJson[WalletInfoKeys.enableLelantusScanning] as bool? ?? + false; + } + final coinControlPrefEnabled = ref.watch( prefsChangeNotifierProvider.select( (value) => value.enableCoinControl, @@ -136,6 +153,65 @@ class _MoreFeaturesDialogState extends ConsumerState { iconAsset: Assets.svg.cashFusion, onPressed: () => widget.onFusionPressed?.call(), ), + if (wallet.info.coin is Firo) + Padding( + padding: const EdgeInsets.symmetric( + vertical: 6, + horizontal: 32, + ), + child: RoundedContainer( + color: Colors.transparent, + borderColor: Theme.of(context) + .extension()! + .textFieldDefaultBG, + child: Row( + children: [ + SizedBox(width: 3), + SizedBox( + height: 20, + width: 40, + child: DraggableSwitchButton( + isOn: _enableLelantusScanning, + onValueChanged: (newValue) async { + if (_isUpdatingLelantusScanning) return; + _isUpdatingLelantusScanning = true; // Lock mutex. + + // Toggle enableLelantusScanning in wallet info. + await wallet.info.updateOtherData( + newEntries: { + WalletInfoKeys.enableLelantusScanning: + !_enableLelantusScanning, + }, + isar: ref.read(mainDBProvider).isar, + ); + + setState(() { + _enableLelantusScanning = !_enableLelantusScanning; + _isUpdatingLelantusScanning = false; // Free mutex. + }); + }, + ), + ), + const SizedBox( + width: 16, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Scan for Lelantus transactions", + style: STextStyles.w600_20(context), + ), + // Text( + // detail, + // style: STextStyles.desktopTextExtraExtraSmall(context), + // ), + ], + ), + ], + ), + ), + ), const SizedBox( height: 28, ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart index df81592c9..092f9884f 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart @@ -18,7 +18,6 @@ import 'desktop_receive.dart'; import 'desktop_send.dart'; import 'desktop_token_send.dart'; import '../../../../providers/global/wallets_provider.dart'; -import '../../../../wallets/crypto_currency/coins/ethereum.dart'; import '../../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../../wallets/wallet/impl/bitcoin_frost_wallet.dart'; import '../../../../widgets/custom_tab_view.dart'; diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/network_info_button.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/network_info_button.dart index 488f3ac4d..b84332c01 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/network_info_button.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/network_info_button.dart @@ -30,10 +30,10 @@ import 'package:tuple/tuple.dart'; class NetworkInfoButton extends ConsumerStatefulWidget { const NetworkInfoButton({ - Key? key, + super.key, required this.walletId, this.eventBus, - }) : super(key: key); + }); final String walletId; final EventBus? eventBus; diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart index af3d18683..9fb269448 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart @@ -16,9 +16,9 @@ import '../../../../widgets/desktop/desktop_dialog_close_button.dart'; class QRCodeDesktopPopupContent extends StatelessWidget { const QRCodeDesktopPopupContent({ - Key? key, + super.key, required this.value, - }) : super(key: key); + }); final String value; diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart index dddf74318..24dbe3150 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/unlock_wallet_keys_desktop.dart @@ -13,8 +13,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../../notifications/show_flush_bar.dart'; -import 'wallet_keys_desktop_popup.dart'; import '../../../../providers/desktop/storage_crypto_handler_provider.dart'; import '../../../../providers/providers.dart'; import '../../../../themes/stack_colors.dart'; @@ -29,12 +29,13 @@ import '../../../../widgets/desktop/primary_button.dart'; import '../../../../widgets/desktop/secondary_button.dart'; import '../../../../widgets/loading_indicator.dart'; import '../../../../widgets/stack_text_field.dart'; +import 'wallet_keys_desktop_popup.dart'; class UnlockWalletKeysDesktop extends ConsumerStatefulWidget { const UnlockWalletKeysDesktop({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; @@ -218,7 +219,8 @@ class _UnlockWalletKeysDesktopState children: [ GestureDetector( key: const Key( - "enterUnlockWalletKeysDesktopFieldShowPasswordButtonKey"), + "enterUnlockWalletKeysDesktopFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; @@ -305,7 +307,8 @@ class _UnlockWalletKeysDesktopState ); await Future.delayed( - const Duration(seconds: 1)); + const Duration(seconds: 1), + ); final verified = await ref .read(storageCryptoHandlerProvider) @@ -349,7 +352,8 @@ class _UnlockWalletKeysDesktopState Navigator.of(context, rootNavigator: true).pop(); await Future.delayed( - const Duration(milliseconds: 300)); + const Duration(milliseconds: 300), + ); unawaited( showFloatingFlushBar( diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_keys_button.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_keys_button.dart index 838e2c363..d58a66c4f 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_keys_button.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_keys_button.dart @@ -18,9 +18,9 @@ import '../../../../utilities/text_styles.dart'; class WalletKeysButton extends StatelessWidget { const WalletKeysButton({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; @@ -44,7 +44,7 @@ class WalletKeysButton extends StatelessWidget { name: UnlockWalletKeysDesktop.routeName, arguments: walletId, ), - ) + ), ]; }, ), @@ -71,7 +71,7 @@ class WalletKeysButton extends StatelessWidget { Text( "Wallet keys", style: STextStyles.desktopMenuItemSelected(context), - ) + ), ], ), ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_keys_desktop_popup.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_keys_desktop_popup.dart index 61bfcfebf..df9252fe5 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_keys_desktop_popup.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_keys_desktop_popup.dart @@ -12,10 +12,10 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; + import '../../../../notifications/show_flush_bar.dart'; import '../../../../pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart'; import '../../../../pages/wallet_view/transaction_views/transaction_details_view.dart'; -import 'qr_code_desktop_popup_content.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/address_utils.dart'; import '../../../../utilities/assets.dart'; @@ -26,14 +26,15 @@ import '../../../../widgets/desktop/desktop_dialog_close_button.dart'; import '../../../../widgets/desktop/primary_button.dart'; import '../../../../widgets/desktop/secondary_button.dart'; import '../../../../widgets/rounded_white_container.dart'; +import 'qr_code_desktop_popup_content.dart'; class WalletKeysDesktopPopup extends StatelessWidget { const WalletKeysDesktopPopup({ - Key? key, + super.key, required this.words, this.frostData, this.clipboardInterface = const ClipboardWrapper(), - }) : super(key: key); + }); final List words; final ({String keys, String config})? frostData; @@ -90,14 +91,17 @@ class WalletKeysDesktopPopup extends StatelessWidget { .extension()! .textFieldDefaultBG, padding: const EdgeInsets.symmetric( - horizontal: 12, vertical: 9), + horizontal: 12, + vertical: 9, + ), child: Row( children: [ Flexible( child: SelectableText( frostData!.keys, style: STextStyles.desktopTextExtraExtraSmall( - context), + context, + ), textAlign: TextAlign.center, ), ), @@ -106,7 +110,7 @@ class WalletKeysDesktopPopup extends StatelessWidget { ), IconCopyButton( data: frostData!.keys, - ) + ), // TODO [prio=low: Add QR code button and dialog. ], ), @@ -133,14 +137,17 @@ class WalletKeysDesktopPopup extends StatelessWidget { .extension()! .textFieldDefaultBG, padding: const EdgeInsets.symmetric( - horizontal: 12, vertical: 9), + horizontal: 12, + vertical: 9, + ), child: Row( children: [ Flexible( child: SelectableText( frostData!.config, style: STextStyles.desktopTextExtraExtraSmall( - context), + context, + ), textAlign: TextAlign.center, ), ), @@ -149,7 +156,7 @@ class WalletKeysDesktopPopup extends StatelessWidget { ), IconCopyButton( data: frostData!.config, - ) + ), // TODO [prio=low: Add QR code button and dialog. ], ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_options_button.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_options_button.dart index 23922cd2e..93a084c0e 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_options_button.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/wallet_options_button.dart @@ -14,13 +14,10 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../../pages/settings_views/wallet_settings_view/frost_ms/frost_ms_options_view.dart'; import '../../../../pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/change_representative_view.dart'; import '../../../../pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/xpub_view.dart'; -import '../../../addresses/desktop_wallet_addresses_view.dart'; -import '../../../lelantus_coins/lelantus_coins_view.dart'; -import 'desktop_delete_wallet_dialog.dart'; -import '../../../spark_coins/spark_coins_view.dart'; import '../../../../route_generator.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; @@ -30,6 +27,10 @@ import '../../../../wallets/crypto_currency/coins/firo.dart'; import '../../../../wallets/crypto_currency/intermediate/frost_currency.dart'; import '../../../../wallets/crypto_currency/intermediate/nano_currency.dart'; import '../../../../wallets/isar/providers/wallet_info_provider.dart'; +import '../../../addresses/desktop_wallet_addresses_view.dart'; +import '../../../lelantus_coins/lelantus_coins_view.dart'; +import '../../../spark_coins/spark_coins_view.dart'; +import 'desktop_delete_wallet_dialog.dart'; enum _WalletOptions { addressList, @@ -327,8 +328,8 @@ class WalletOptionsPopupMenu extends ConsumerWidget { child: Text( _WalletOptions.addressList.prettyName, style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, @@ -364,8 +365,8 @@ class WalletOptionsPopupMenu extends ConsumerWidget { child: Text( _WalletOptions.changeRepresentative.prettyName, style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, @@ -401,8 +402,8 @@ class WalletOptionsPopupMenu extends ConsumerWidget { child: Text( _WalletOptions.lelantusCoins.prettyName, style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, @@ -438,8 +439,8 @@ class WalletOptionsPopupMenu extends ConsumerWidget { child: Text( _WalletOptions.sparkCoins.prettyName, style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, @@ -475,8 +476,8 @@ class WalletOptionsPopupMenu extends ConsumerWidget { child: Text( _WalletOptions.frostOptions.prettyName, style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, @@ -512,8 +513,8 @@ class WalletOptionsPopupMenu extends ConsumerWidget { child: Text( _WalletOptions.showXpub.prettyName, style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, @@ -547,8 +548,8 @@ class WalletOptionsPopupMenu extends ConsumerWidget { child: Text( _WalletOptions.deleteWallet.prettyName, style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark, @@ -571,10 +572,10 @@ class WalletOptionsPopupMenu extends ConsumerWidget { class TransparentButton extends StatelessWidget { const TransparentButton({ - Key? key, + super.key, required this.child, this.onPressed, - }) : super(key: key); + }); final Widget child; final VoidCallback? onPressed; diff --git a/lib/pages_desktop_specific/notifications/desktop_notifications_view.dart b/lib/pages_desktop_specific/notifications/desktop_notifications_view.dart index bc05bafa6..e4c04fa50 100644 --- a/lib/pages_desktop_specific/notifications/desktop_notifications_view.dart +++ b/lib/pages_desktop_specific/notifications/desktop_notifications_view.dart @@ -20,7 +20,7 @@ import '../../widgets/desktop/desktop_scaffold.dart'; import '../../widgets/rounded_white_container.dart'; class DesktopNotificationsView extends ConsumerStatefulWidget { - const DesktopNotificationsView({Key? key}) : super(key: key); + const DesktopNotificationsView({super.key}); static const String routeName = "/desktopNotifications"; diff --git a/lib/pages_desktop_specific/ordinals/desktop_ordinal_details_view.dart b/lib/pages_desktop_specific/ordinals/desktop_ordinal_details_view.dart index 83a865e1e..4aff4afb0 100644 --- a/lib/pages_desktop_specific/ordinals/desktop_ordinal_details_view.dart +++ b/lib/pages_desktop_specific/ordinals/desktop_ordinal_details_view.dart @@ -5,6 +5,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:path_provider/path_provider.dart'; import 'package:permission_handler/permission_handler.dart'; + import '../../models/isar/models/blockchain_data/utxo.dart'; import '../../models/isar/ordinal.dart'; import '../../networking/http.dart'; @@ -29,10 +30,10 @@ import '../../widgets/rounded_white_container.dart'; class DesktopOrdinalDetailsView extends ConsumerStatefulWidget { const DesktopOrdinalDetailsView({ - Key? key, + super.key, required this.walletId, required this.ordinal, - }) : super(key: key); + }); final String walletId; final Ordinal ordinal; @@ -51,7 +52,7 @@ class _DesktopOrdinalDetailsViewState late final UTXO? utxo; Future _savePngToFile() async { - HTTP client = HTTP(); + final HTTP client = HTTP(); final response = await client.get( url: Uri.parse(widget.ordinal.content), @@ -62,7 +63,8 @@ class _DesktopOrdinalDetailsViewState if (response.code != 200) { throw Exception( - "DesktopOrdinalDetailsView _savePngToFile statusCode=${response.code} body=${response.bodyBytes}"); + "DesktopOrdinalDetailsView _savePngToFile statusCode=${response.code} body=${response.bodyBytes}", + ); } final bytes = response.bodyBytes; @@ -78,7 +80,7 @@ class _DesktopOrdinalDetailsViewState final docPath = dir.path; final filePath = "$docPath/ordinal_${widget.ordinal.inscriptionNumber}.png"; - File imgFile = File(filePath); + final File imgFile = File(filePath); if (imgFile.existsSync()) { throw Exception("File already exists"); @@ -284,24 +286,30 @@ class _DesktopOrdinalDetailsViewState // ), // // todo: add utxo status const _Divider(), - Consumer(builder: (context, ref, _) { - final coin = ref - .watch(pWallets) - .getWallet(widget.walletId) - .info - .coin; - return _DetailsItemWCopy( - title: "Amount", - data: utxo == null - ? "ERROR" - : ref.watch(pAmountFormatter(coin)).format( - Amount( - rawValue: BigInt.from(utxo!.value), - fractionDigits: coin.fractionDigits, + Consumer( + builder: (context, ref, _) { + final coin = ref + .watch(pWallets) + .getWallet(widget.walletId) + .info + .coin; + return _DetailsItemWCopy( + title: "Amount", + data: utxo == null + ? "ERROR" + : ref + .watch(pAmountFormatter(coin)) + .format( + Amount( + rawValue: + BigInt.from(utxo!.value), + fractionDigits: + coin.fractionDigits, + ), ), - ), - ); - }), + ); + }, + ), const _Divider(), _DetailsItemWCopy( title: "Owner address", @@ -328,7 +336,7 @@ class _DesktopOrdinalDetailsViewState } class _Divider extends StatelessWidget { - const _Divider({Key? key}) : super(key: key); + const _Divider({super.key}); @override Widget build(BuildContext context) { @@ -346,10 +354,10 @@ class _Divider extends StatelessWidget { class _DetailsItemWCopy extends StatelessWidget { const _DetailsItemWCopy({ - Key? key, + super.key, required this.title, required this.data, - }) : super(key: key); + }); final String title; final String data; diff --git a/lib/pages_desktop_specific/ordinals/desktop_ordinals_view.dart b/lib/pages_desktop_specific/ordinals/desktop_ordinals_view.dart index 3ab866f27..29291510e 100644 --- a/lib/pages_desktop_specific/ordinals/desktop_ordinals_view.dart +++ b/lib/pages_desktop_specific/ordinals/desktop_ordinals_view.dart @@ -11,6 +11,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../pages/ordinals/widgets/ordinals_list.dart'; import '../../providers/providers.dart'; import '../../themes/stack_colors.dart'; @@ -41,7 +42,7 @@ class _DesktopOrdinals extends ConsumerState { late final TextEditingController searchController; late final FocusNode searchFocusNode; - String _searchTerm = ""; + final String _searchTerm = ""; @override void initState() { @@ -106,7 +107,7 @@ class _DesktopOrdinals extends ConsumerState { Text( "Ordinals", style: STextStyles.desktopH3(context), - ) + ), ], ), ), @@ -210,15 +211,16 @@ class _DesktopOrdinals extends ConsumerState { onPressed: () async { // show loading for a minimum of 2 seconds on refreshing await showLoading( - rootNavigator: true, - whileFuture: Future.wait([ - Future.delayed(const Duration(seconds: 2)), - (ref.read(pWallets).getWallet(widget.walletId) - as OrdinalsInterface) - .refreshInscriptions() - ]), - context: context, - message: "Refreshing..."); + rootNavigator: true, + whileFuture: Future.wait([ + Future.delayed(const Duration(seconds: 2)), + (ref.read(pWallets).getWallet(widget.walletId) + as OrdinalsInterface) + .refreshInscriptions(), + ]), + context: context, + message: "Refreshing...", + ); }, ), ], diff --git a/lib/pages_desktop_specific/password/create_password_view.dart b/lib/pages_desktop_specific/password/create_password_view.dart index 31f070982..558be3077 100644 --- a/lib/pages_desktop_specific/password/create_password_view.dart +++ b/lib/pages_desktop_specific/password/create_password_view.dart @@ -13,9 +13,9 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:zxcvbn/zxcvbn.dart'; + import '../../notifications/show_flush_bar.dart'; -import '../desktop_home_view.dart'; -import 'forgotten_passphrase_restore_from_swb.dart'; import '../../providers/desktop/storage_crypto_handler_provider.dart'; import '../../providers/global/secure_store_provider.dart'; import '../../providers/providers.dart'; @@ -23,19 +23,21 @@ import '../../themes/stack_colors.dart'; import '../../utilities/assets.dart'; import '../../utilities/constants.dart'; import '../../utilities/flutter_secure_storage_interface.dart'; +import '../../utilities/show_loading.dart'; import '../../utilities/text_styles.dart'; import '../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../widgets/desktop/desktop_app_bar.dart'; import '../../widgets/desktop/desktop_scaffold.dart'; import '../../widgets/progress_bar.dart'; import '../../widgets/stack_text_field.dart'; -import 'package:zxcvbn/zxcvbn.dart'; +import '../desktop_home_view.dart'; +import 'forgotten_passphrase_restore_from_swb.dart'; class CreatePasswordView extends ConsumerStatefulWidget { const CreatePasswordView({ - Key? key, + super.key, this.restoreFromSWB = false, - }) : super(key: key); + }); static const String routeName = "/createPasswordDesktop"; final bool restoreFromSWB; @@ -67,42 +69,53 @@ class _CreatePasswordViewState extends ConsumerState { bool _nextLock = false; - void onNextPressed() async { - if (_nextLock) { - return; - } - _nextLock = true; - + Future _onNextPressed() async { final String passphrase = passwordController.text; final String repeatPassphrase = passwordRepeatController.text; if (passphrase.isEmpty) { - unawaited(showFloatingFlushBar( - type: FlushBarType.warning, - message: "A password is required", - context: context, - )); - _nextLock = false; + unawaited( + showFloatingFlushBar( + type: FlushBarType.warning, + message: "A password is required", + context: context, + ), + ); return; } if (passphrase != repeatPassphrase) { - unawaited(showFloatingFlushBar( - type: FlushBarType.warning, - message: "Password does not match", - context: context, - )); - _nextLock = false; + unawaited( + showFloatingFlushBar( + type: FlushBarType.warning, + message: "Password does not match", + context: context, + ), + ); return; } try { - if (await ref.read(storageCryptoHandlerProvider).hasPassword()) { - throw Exception( - "Tried creating a new password and attempted to overwrite an existing entry!"); + whileFuture() async { + if (await ref.read(storageCryptoHandlerProvider).hasPassword()) { + throw Exception( + "Tried creating a new password and attempted to overwrite an existing entry!", + ); + } + + await ref.read(storageCryptoHandlerProvider).initFromNew(passphrase); + await (ref.read(secureStoreProvider).store as DesktopSecureStore) + .init(); } - await ref.read(storageCryptoHandlerProvider).initFromNew(passphrase); - await (ref.read(secureStoreProvider).store as DesktopSecureStore).init(); + await showLoading( + whileFuture: whileFuture(), + context: context, + message: "Initializing...", + rootNavigator: true, + onException: (e) { + throw e; + }, + ); // load default nodes now as node service requires storage handler to exist @@ -110,12 +123,15 @@ class _CreatePasswordViewState extends ConsumerState { await ref.read(nodeServiceChangeNotifierProvider).updateDefaults(); } } catch (e) { - unawaited(showFloatingFlushBar( - type: FlushBarType.warning, - message: "Error: $e", - context: context, - )); - _nextLock = false; + if (mounted) { + unawaited( + showFloatingFlushBar( + type: FlushBarType.warning, + message: "Error: $e", + context: context, + ), + ); + } return; } @@ -136,13 +152,27 @@ class _CreatePasswordViewState extends ConsumerState { } if (!widget.restoreFromSWB && mounted) { - unawaited(showFloatingFlushBar( - type: FlushBarType.success, - message: "Your password is set up", - context: context, - )); + unawaited( + showFloatingFlushBar( + type: FlushBarType.success, + message: "Your password is set up", + context: context, + ), + ); + } + } + + void _onNextPressedWrapper() async { + if (_nextLock) { + return; + } + _nextLock = true; + + try { + await _onNextPressed(); + } finally { + _nextLock = false; } - _nextLock = false; } @override @@ -231,7 +261,8 @@ class _CreatePasswordViewState extends ConsumerState { children: [ GestureDetector( key: const Key( - "createDesktopPasswordFieldShowPasswordButtonKey"), + "createDesktopPasswordFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; @@ -279,7 +310,7 @@ class _CreatePasswordViewState extends ConsumerState { } final result = zxcvbn.evaluate(newValue); String suggestionsAndTips = ""; - for (var sug + for (final sug in result.feedback.suggestions!.toSet()) { suggestionsAndTips += "$sug\n"; } @@ -293,7 +324,9 @@ class _CreatePasswordViewState extends ConsumerState { // hack fix to format back string returned from zxcvbn if (feedback.contains("phrasesNo need")) { feedback = feedback.replaceFirst( - "phrasesNo need", "phrases\nNo need"); + "phrasesNo need", + "phrases\nNo need", + ); } if (feedback.endsWith("\n")) { @@ -385,7 +418,8 @@ class _CreatePasswordViewState extends ConsumerState { children: [ GestureDetector( key: const Key( - "createDesktopPasswordFieldShowPasswordButtonKey2"), + "createDesktopPasswordFieldShowPasswordButtonKey2", + ), onTap: () async { setState(() { hidePassword = !hidePassword; @@ -450,7 +484,7 @@ class _CreatePasswordViewState extends ConsumerState { : Theme.of(context) .extension()! .getPrimaryDisabledButtonStyle(context), - onPressed: nextEnabled ? onNextPressed : null, + onPressed: nextEnabled ? _onNextPressedWrapper : null, child: Text( "Next", style: nextEnabled diff --git a/lib/pages_desktop_specific/password/desktop_login_view.dart b/lib/pages_desktop_specific/password/desktop_login_view.dart index 62e3b70fe..54d00c789 100644 --- a/lib/pages_desktop_specific/password/desktop_login_view.dart +++ b/lib/pages_desktop_specific/password/desktop_login_view.dart @@ -63,8 +63,10 @@ class _DesktopLoginViewState extends ConsumerState { Future _checkDesktopMigrate() async { if (Util.isDesktop) { - int dbVersion = DB.instance.get( - boxName: DB.boxNameDBInfo, key: "hive_data_version") as int? ?? + final int dbVersion = DB.instance.get( + boxName: DB.boxNameDBInfo, + key: "hive_data_version", + ) as int? ?? 0; if (dbVersion < Constants.currentDataVersion) { try { @@ -73,8 +75,11 @@ class _DesktopLoginViewState extends ConsumerState { secureStore: ref.read(secureStoreProvider), ); } catch (e, s) { - Logging.instance.log("Cannot migrate desktop database\n$e $s", - level: LogLevel.Error, printFullLength: true); + Logging.instance.log( + "Cannot migrate desktop database\n$e $s", + level: LogLevel.Error, + printFullLength: true, + ); } } } @@ -249,12 +254,16 @@ class _DesktopLoginViewState extends ConsumerState { hoverColor: Colors.transparent, enabledBorder: OutlineInputBorder( borderSide: const BorderSide( - color: Colors.transparent, width: 1), + color: Colors.transparent, + width: 1, + ), borderRadius: BorderRadius.circular(10), ), focusedBorder: OutlineInputBorder( borderSide: const BorderSide( - color: Colors.transparent, width: 1), + color: Colors.transparent, + width: 1, + ), borderRadius: BorderRadius.circular(10), ), contentPadding: const EdgeInsets.only( @@ -273,7 +282,8 @@ class _DesktopLoginViewState extends ConsumerState { ), GestureDetector( key: const Key( - "restoreFromFilePasswordFieldShowPasswordButtonKey"), + "restoreFromFilePasswordFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; diff --git a/lib/pages_desktop_specific/password/forgotten_passphrase_restore_from_swb.dart b/lib/pages_desktop_specific/password/forgotten_passphrase_restore_from_swb.dart index b1efe30f1..173840528 100644 --- a/lib/pages_desktop_specific/password/forgotten_passphrase_restore_from_swb.dart +++ b/lib/pages_desktop_specific/password/forgotten_passphrase_restore_from_swb.dart @@ -15,13 +15,14 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:tuple/tuple.dart'; + import '../../app_config.dart'; import '../../db/hive/db.dart'; import '../../notifications/show_flush_bar.dart'; import '../../pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart'; import '../../pages/settings_views/global_settings_view/stack_backup_views/helpers/swb_file_system.dart'; import '../../pages/settings_views/global_settings_view/stack_backup_views/sub_views/stack_restore_progress_view.dart'; -import 'create_password_view.dart'; import '../../providers/desktop/storage_crypto_handler_provider.dart'; import '../../providers/global/secure_store_provider.dart'; import '../../providers/global/wallets_provider.dart'; @@ -38,10 +39,10 @@ import '../../widgets/desktop/desktop_scaffold.dart'; import '../../widgets/desktop/primary_button.dart'; import '../../widgets/loading_indicator.dart'; import '../../widgets/stack_text_field.dart'; -import 'package:tuple/tuple.dart'; +import 'create_password_view.dart'; class ForgottenPassphraseRestoreFromSWB extends ConsumerStatefulWidget { - const ForgottenPassphraseRestoreFromSWB({Key? key}) : super(key: key); + const ForgottenPassphraseRestoreFromSWB({super.key}); static const String routeName = "/forgottenPassphraseRestoreFromSWB"; @@ -155,7 +156,7 @@ class _ForgottenPassphraseRestoreFromSWBState mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - "Restoring {$AppConfig.appName}", + "Restoring ${AppConfig.appName}", style: STextStyles.desktopH3(context), ), ], @@ -359,7 +360,8 @@ class _ForgottenPassphraseRestoreFromSWBState ), GestureDetector( key: const Key( - "restoreFromFilePasswordFieldShowPasswordButtonKey"), + "restoreFromFilePasswordFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; diff --git a/lib/pages_desktop_specific/settings/desktop_settings_view.dart b/lib/pages_desktop_specific/settings/desktop_settings_view.dart index 3ecf30375..7ab75026d 100644 --- a/lib/pages_desktop_specific/settings/desktop_settings_view.dart +++ b/lib/pages_desktop_specific/settings/desktop_settings_view.dart @@ -27,7 +27,7 @@ import '../../widgets/desktop/desktop_app_bar.dart'; import '../../widgets/desktop/desktop_scaffold.dart'; class DesktopSettingsView extends ConsumerStatefulWidget { - const DesktopSettingsView({Key? key}) : super(key: key); + const DesktopSettingsView({super.key}); static const String routeName = "/desktopSettings"; @@ -123,7 +123,7 @@ class _DesktopSettingsViewState extends ConsumerState { } class DesktopSettingsTitle extends StatelessWidget { - const DesktopSettingsTitle({Key? key}) : super(key: key); + const DesktopSettingsTitle({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/pages_desktop_specific/settings/settings_menu.dart b/lib/pages_desktop_specific/settings/settings_menu.dart index d12cdea34..16b1a438b 100644 --- a/lib/pages_desktop_specific/settings/settings_menu.dart +++ b/lib/pages_desktop_specific/settings/settings_menu.dart @@ -11,16 +11,17 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'settings_menu_item.dart'; + import '../../themes/stack_colors.dart'; import '../../utilities/assets.dart'; +import 'settings_menu_item.dart'; final selectedSettingsMenuItemStateProvider = StateProvider((_) => 0); class SettingsMenu extends ConsumerStatefulWidget { const SettingsMenu({ - Key? key, - }) : super(key: key); + super.key, + }); @override ConsumerState createState() => _SettingsMenuState(); @@ -65,8 +66,10 @@ class _SettingsMenuState extends ConsumerState { width: 11, height: 11, color: ref - .watch(selectedSettingsMenuItemStateProvider - .state) + .watch( + selectedSettingsMenuItemStateProvider + .state, + ) .state == i ? Theme.of(context) diff --git a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart index 69661e04c..029c5e294 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart @@ -11,10 +11,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../../pages/settings_views/global_settings_view/advanced_views/manage_coin_units/manage_coin_units_view.dart'; -import 'debug_info_dialog.dart'; -import 'desktop_manage_block_explorers_dialog.dart'; -import 'stack_privacy_dialog.dart'; import '../../../../providers/global/prefs_provider.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; @@ -22,9 +20,12 @@ import '../../../../utilities/text_styles.dart'; import '../../../../widgets/custom_buttons/draggable_switch_button.dart'; import '../../../../widgets/desktop/primary_button.dart'; import '../../../../widgets/rounded_white_container.dart'; +import 'debug_info_dialog.dart'; +import 'desktop_manage_block_explorers_dialog.dart'; +import 'stack_privacy_dialog.dart'; class AdvancedSettings extends ConsumerStatefulWidget { - const AdvancedSettings({Key? key}) : super(key: key); + const AdvancedSettings({super.key}); static const String routeName = "/settingsMenuAdvanced"; @@ -73,7 +74,8 @@ class _AdvancedSettings extends ConsumerState { text: "\n\nConfigure these settings only if you know what you are doing!", style: STextStyles.desktopTextExtraExtraSmall( - context), + context, + ), ), ], ), @@ -94,9 +96,10 @@ class _AdvancedSettings extends ConsumerState { "Toggle testnet coins", style: STextStyles.desktopTextExtraSmall(context) .copyWith( - color: Theme.of(context) - .extension()! - .textDark), + color: Theme.of(context) + .extension()! + .textDark, + ), textAlign: TextAlign.left, ), SizedBox( @@ -105,7 +108,8 @@ class _AdvancedSettings extends ConsumerState { child: DraggableSwitchButton( isOn: ref.watch( prefsChangeNotifierProvider.select( - (value) => value.showTestNetCoins), + (value) => value.showTestNetCoins, + ), ), onValueChanged: (newValue) { ref @@ -132,9 +136,10 @@ class _AdvancedSettings extends ConsumerState { "Enable coin control", style: STextStyles.desktopTextExtraSmall(context) .copyWith( - color: Theme.of(context) - .extension()! - .textDark), + color: Theme.of(context) + .extension()! + .textDark, + ), textAlign: TextAlign.left, ), SizedBox( @@ -143,7 +148,8 @@ class _AdvancedSettings extends ConsumerState { child: DraggableSwitchButton( isOn: ref.watch( prefsChangeNotifierProvider.select( - (value) => value.enableCoinControl), + (value) => value.enableCoinControl, + ), ), onValueChanged: (newValue) { ref @@ -163,56 +169,62 @@ class _AdvancedSettings extends ConsumerState { ), /// TODO: Make a dialog popup - Consumer(builder: (_, ref, __) { - final externalCalls = ref.watch( - prefsChangeNotifierProvider - .select((value) => value.externalCalls), - ); - return Padding( - padding: const EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Stack Experience", - style: STextStyles.desktopTextExtraSmall( - context) - .copyWith( - color: Theme.of(context) - .extension()! - .textDark), - textAlign: TextAlign.left, - ), - Text( - externalCalls ? "Easy crypto" : "Incognito", - style: - STextStyles.desktopTextExtraExtraSmall( - context), - ), - ], - ), - PrimaryButton( - label: "Change", - buttonHeight: ButtonHeight.xs, - width: 101, - onPressed: () async { - await showDialog( - context: context, - useSafeArea: false, - barrierDismissible: true, - builder: (context) { - return const StackPrivacyDialog(); - }, - ); - }, - ) - ], - ), - ); - }), + Consumer( + builder: (_, ref, __) { + final externalCalls = ref.watch( + prefsChangeNotifierProvider + .select((value) => value.externalCalls), + ); + return Padding( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Stack Experience", + style: STextStyles.desktopTextExtraSmall( + context, + ).copyWith( + color: Theme.of(context) + .extension()! + .textDark, + ), + textAlign: TextAlign.left, + ), + Text( + externalCalls + ? "Easy crypto" + : "Incognito", + style: STextStyles + .desktopTextExtraExtraSmall( + context, + ), + ), + ], + ), + PrimaryButton( + label: "Change", + buttonHeight: ButtonHeight.xs, + width: 101, + onPressed: () async { + await showDialog( + context: context, + useSafeArea: false, + barrierDismissible: true, + builder: (context) { + return const StackPrivacyDialog(); + }, + ); + }, + ), + ], + ), + ); + }, + ), ], ), const Padding( @@ -230,9 +242,10 @@ class _AdvancedSettings extends ConsumerState { "Block explorers", style: STextStyles.desktopTextExtraSmall(context) .copyWith( - color: Theme.of(context) - .extension()! - .textDark), + color: Theme.of(context) + .extension()! + .textDark, + ), textAlign: TextAlign.left, ), PrimaryButton( @@ -268,9 +281,10 @@ class _AdvancedSettings extends ConsumerState { "Units", style: STextStyles.desktopTextExtraSmall(context) .copyWith( - color: Theme.of(context) - .extension()! - .textDark), + color: Theme.of(context) + .extension()! + .textDark, + ), textAlign: TextAlign.left, ), PrimaryButton( @@ -306,9 +320,10 @@ class _AdvancedSettings extends ConsumerState { "Debug info", style: STextStyles.desktopTextExtraSmall(context) .copyWith( - color: Theme.of(context) - .extension()! - .textDark), + color: Theme.of(context) + .extension()! + .textDark, + ), textAlign: TextAlign.left, ), PrimaryButton( diff --git a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/debug_info_dialog.dart b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/debug_info_dialog.dart index 9ce77873e..dedfe999d 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/debug_info_dialog.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/debug_info_dialog.dart @@ -10,16 +10,20 @@ import 'dart:async'; +import 'package:event_bus/event_bus.dart'; +import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../../models/isar/models/log.dart'; import '../../../../notifications/show_flush_bar.dart'; import '../../../../providers/global/debug_service_provider.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; import '../../../../utilities/constants.dart'; -import '../../../../utilities/enums/log_level_enum.dart'; +import '../../../../utilities/logger.dart'; +import '../../../../utilities/show_loading.dart'; import '../../../../utilities/text_styles.dart'; import '../../../../utilities/util.dart'; import '../../../../widgets/desktop/desktop_dialog.dart'; @@ -28,11 +32,12 @@ import '../../../../widgets/desktop/primary_button.dart'; import '../../../../widgets/desktop/secondary_button.dart'; import '../../../../widgets/icon_widgets/x_icon.dart'; import '../../../../widgets/rounded_container.dart'; +import '../../../../widgets/stack_dialog.dart'; import '../../../../widgets/stack_text_field.dart'; import '../../../../widgets/textfield_icon_button.dart'; class DebugInfoDialog extends ConsumerStatefulWidget { - const DebugInfoDialog({Key? key}) : super(key: key); + const DebugInfoDialog({super.key}); @override ConsumerState createState() => _DebugInfoDialog(); @@ -52,7 +57,8 @@ class _DebugInfoDialog extends ConsumerState { } return unfiltered .where( - (e) => (e.toString().toLowerCase().contains(filter.toLowerCase()))) + (e) => (e.toString().toLowerCase().contains(filter.toLowerCase())), + ) .toList(); } @@ -77,6 +83,29 @@ class _DebugInfoDialog extends ConsumerState { return null; } + bool _lock = false; + Future<(String?, bool)?> _saveFile() async { + final path = await FilePicker.platform.getDirectoryPath( + dialogTitle: "Choose Log Save Location", + lockParentWindow: true, + ); + + if (path == null) { + return null; + } + + bool logsSaved = true; + String? filename; + try { + filename = + await ref.read(debugServiceProvider).exportToFile(path, EventBus()); + } catch (e, s) { + logsSaved = false; + Logging.instance.log("$e $s", level: LogLevel.Error); + } + return (filename, logsSaved); + } + @override void initState() { searchDebugController = TextEditingController(); @@ -182,13 +211,16 @@ class _DebugInfoDialog extends ConsumerState { return [ SliverOverlapAbsorber( handle: NestedScrollView.sliverOverlapAbsorberHandleFor( - context), - sliver: SliverToBoxAdapter( + context, + ), + sliver: const SliverToBoxAdapter( child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 16, horizontal: 32), + padding: EdgeInsets.symmetric( + vertical: 16, + horizontal: 32, + ), child: Column( - children: const [], + children: [], ), ), ), @@ -198,11 +230,11 @@ class _DebugInfoDialog extends ConsumerState { body: Builder( builder: (context) { final logs = filtered( - ref.watch(debugServiceProvider - .select((value) => value.recentLogs)), - _searchTerm) - .reversed - .toList(growable: false); + ref.watch( + debugServiceProvider.select((value) => value.recentLogs), + ), + _searchTerm, + ).reversed.toList(growable: false); return CustomScrollView( reverse: true, // shrinkWrap: true, @@ -220,7 +252,8 @@ class _DebugInfoDialog extends ConsumerState { return Container( key: Key( - "log_${log.id}_${log.timestampInMillisUTC}"), + "log_${log.id}_${log.timestampInMillisUTC}", + ), decoration: BoxDecoration( color: Theme.of(context) .extension()! @@ -231,7 +264,8 @@ class _DebugInfoDialog extends ConsumerState { padding: const EdgeInsets.all(4), child: Padding( padding: const EdgeInsets.symmetric( - horizontal: 32), + horizontal: 32, + ), child: RoundedContainer( padding: const EdgeInsets.all(0), color: Theme.of(context) @@ -296,9 +330,10 @@ class _DebugInfoDialog extends ConsumerState { SelectableText( log.message, style: STextStyles.baseXS( - context) - .copyWith( - fontSize: 11.5), + context, + ).copyWith( + fontSize: 11.5, + ), ), ], ), @@ -333,12 +368,15 @@ class _DebugInfoDialog extends ConsumerState { await ref.read(debugServiceProvider).deleteAllLogs(); setState(() {}); - if (mounted) { + if (context.mounted) { Navigator.pop(context); - unawaited(showFloatingFlushBar( + unawaited( + showFloatingFlushBar( type: FlushBarType.info, context: context, - message: 'Logs cleared!')); + message: 'Logs cleared!', + ), + ); } }, ), @@ -349,11 +387,47 @@ class _DebugInfoDialog extends ConsumerState { Expanded( child: PrimaryButton( label: "Save logs to file", - onPressed: () { - // TODO: save file dialog + onPressed: () async { + if (_lock) { + return; + } + _lock = true; + try { + final results = await showLoading<(String?, bool)?>( + whileFuture: _saveFile(), + context: context, + message: "Generating logs file...", + ); + + if (results != null) { + if (results.$2) { + unawaited( + showDialog( + context: context, + builder: (context) => StackOkDialog( + title: "Logs saved to", + message: results.$1, + ), + ), + ); + } else { + unawaited( + showDialog( + context: context, + builder: (context) => StackOkDialog( + title: "Error Saving Logs", + message: results.$1, + ), + ), + ); + } + } + } finally { + _lock = false; + } }, ), - ) + ), ], ), ), diff --git a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/desktop_manage_block_explorers_dialog.dart b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/desktop_manage_block_explorers_dialog.dart index 45eed9054..e69f90833 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/desktop_manage_block_explorers_dialog.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/desktop_manage_block_explorers_dialog.dart @@ -13,8 +13,9 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import '../../../../providers/global/prefs_provider.dart'; + import '../../../../app_config.dart'; +import '../../../../providers/global/prefs_provider.dart'; import '../../../../themes/coin_icon_provider.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; @@ -139,8 +140,7 @@ class DesktopManageBlockExplorersDialog extends ConsumerWidget { } class _DesktopEditBlockExplorerDialog extends ConsumerStatefulWidget { - const _DesktopEditBlockExplorerDialog({Key? key, required this.coin}) - : super(key: key); + const _DesktopEditBlockExplorerDialog({super.key, required this.coin}); final CryptoCurrency coin; @@ -157,10 +157,10 @@ class _DesktopEditBlockExplorerDialogState @override void initState() { _textEditingController = TextEditingController( - text: - getBlockExplorerTransactionUrlFor(coin: widget.coin, txid: "[TXID]") - .toString() - .replaceAll("%5BTXID%5D", "[TXID]")); + text: getBlockExplorerTransactionUrlFor(coin: widget.coin, txid: "[TXID]") + .toString() + .replaceAll("%5BTXID%5D", "[TXID]"), + ); _focusNode = FocusNode(); super.initState(); } @@ -268,10 +268,10 @@ class _DesktopEditBlockExplorerDialogState ), ), ], - ) + ), ], ), - ) + ), ], ), ); diff --git a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/stack_privacy_dialog.dart b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/stack_privacy_dialog.dart index 8ebf89c70..20a9d9e62 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/stack_privacy_dialog.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/stack_privacy_dialog.dart @@ -14,6 +14,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../../db/hive/db.dart'; import '../../../../providers/global/prefs_provider.dart'; import '../../../../providers/global/price_provider.dart'; @@ -31,7 +32,7 @@ import '../../../../widgets/desktop/secondary_button.dart'; import '../../../../widgets/rounded_white_container.dart'; class StackPrivacyDialog extends ConsumerStatefulWidget { - const StackPrivacyDialog({Key? key}) : super(key: key); + const StackPrivacyDialog({super.key}); @override ConsumerState createState() => _StackPrivacyDialog(); @@ -80,7 +81,7 @@ class _StackPrivacyDialog extends ConsumerState { height: 35, ), Padding( - padding: EdgeInsets.symmetric(horizontal: 32), + padding: const EdgeInsets.symmetric(horizontal: 32), child: PrivacyToggle( externalCallsEnabled: isEasy, onChanged: (externalCalls) { @@ -110,16 +111,19 @@ class _StackPrivacyDialog extends ConsumerState { ? [ if (Constants.enableExchange) const TextSpan( - text: - "Exchange data preloaded for a seamless experience."), - const TextSpan( text: - "\n\nCoinGecko enabled: (24 hour price change shown in-app, total wallet value shown in USD or other currency)."), + "Exchange data preloaded for a seamless experience.", + ), + const TextSpan( + text: + "\n\nCoinGecko enabled: (24 hour price change shown in-app, total wallet value shown in USD or other currency).", + ), TextSpan( text: "\n\nRecommended for most crypto users.", style: isDesktop ? STextStyles.desktopTextExtraExtraSmall600( - context) + context, + ) : TextStyle( color: Theme.of(context) .extension()! @@ -130,17 +134,20 @@ class _StackPrivacyDialog extends ConsumerState { ] : [ const TextSpan( - text: - "Exchange data not preloaded (slower experience)."), + text: + "Exchange data not preloaded (slower experience).", + ), const TextSpan( - text: - "\n\nCoinGecko disabled (price changes not shown, no wallet value shown in other currencies)."), + text: + "\n\nCoinGecko disabled (price changes not shown, no wallet value shown in other currencies).", + ), TextSpan( text: "\n\nRecommended for the privacy conscious.", style: isDesktop ? STextStyles.desktopTextExtraExtraSmall600( - context) + context, + ) : TextStyle( color: Theme.of(context) .extension()! @@ -179,9 +186,10 @@ class _StackPrivacyDialog extends ConsumerState { DB.instance .put( - boxName: DB.boxNamePrefs, - key: "externalCalls", - value: isEasy) + boxName: DB.boxNamePrefs, + key: "externalCalls", + value: isEasy, + ) .then((_) { if (isEasy) { unawaited( @@ -197,7 +205,7 @@ class _StackPrivacyDialog extends ConsumerState { } }, ), - ) + ), ], ), ), @@ -209,10 +217,10 @@ class _StackPrivacyDialog extends ConsumerState { class PrivacyToggle extends ConsumerStatefulWidget { const PrivacyToggle({ - Key? key, + super.key, required this.externalCallsEnabled, this.onChanged, - }) : super(key: key); + }); final bool externalCallsEnabled; final void Function(bool)? onChanged; diff --git a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/sub_widgets/desktop_install_theme.dart b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/sub_widgets/desktop_install_theme.dart index 1126cbbfe..081540c3b 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/sub_widgets/desktop_install_theme.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/sub_widgets/desktop_install_theme.dart @@ -25,7 +25,7 @@ import '../../../../../widgets/desktop/primary_button.dart'; import '../../../../../widgets/rounded_container.dart'; class DesktopInstallTheme extends ConsumerStatefulWidget { - const DesktopInstallTheme({Key? key}) : super(key: key); + const DesktopInstallTheme({super.key}); @override ConsumerState createState() => @@ -228,7 +228,7 @@ class _DesktopInstallThemeState extends ConsumerState { ), ], ), - ) + ), ], ), ), diff --git a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/sub_widgets/desktop_manage_themes.dart b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/sub_widgets/desktop_manage_themes.dart index bf04e48f1..bf55fe744 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/sub_widgets/desktop_manage_themes.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/sub_widgets/desktop_manage_themes.dart @@ -20,7 +20,7 @@ import '../../../../../widgets/desktop/desktop_dialog_close_button.dart'; import '../../../../../widgets/toggle.dart'; class DesktopManageThemesDialog extends ConsumerStatefulWidget { - const DesktopManageThemesDialog({Key? key}) : super(key: key); + const DesktopManageThemesDialog({super.key}); @override ConsumerState createState() => diff --git a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/sub_widgets/desktop_themes_gallery.dart b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/sub_widgets/desktop_themes_gallery.dart index 160fd67f5..4571973c4 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/sub_widgets/desktop_themes_gallery.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/sub_widgets/desktop_themes_gallery.dart @@ -12,6 +12,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../../../../pages/settings_views/global_settings_view/appearance_settings/manage_themes.dart'; import '../../../../../pages/settings_views/global_settings_view/appearance_settings/sub_widgets/stack_theme_card.dart'; import '../../../../../providers/global/prefs_provider.dart'; @@ -24,9 +25,9 @@ import '../../../../../widgets/rounded_white_container.dart'; class DesktopThemeGallery extends ConsumerStatefulWidget { const DesktopThemeGallery({ - Key? key, + super.key, required this.dialogWidth, - }) : super(key: key); + }); final double dialogWidth; @@ -90,7 +91,8 @@ class _DesktopThemeGalleryState extends ConsumerState { .map( (e) => SizedBox( key: Key( - "_DesktopThemeGalleryState_card_${e.id}_key"), + "_DesktopThemeGalleryState_card_${e.id}_key", + ), width: (widget.dialogWidth - 64 - 32) / 3, child: StackThemeCard( diff --git a/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/create_auto_backup.dart b/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/create_auto_backup.dart index 80b6faea3..e7225d628 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/create_auto_backup.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/create_auto_backup.dart @@ -18,6 +18,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stack_wallet_backup/stack_wallet_backup.dart'; +import 'package:zxcvbn/zxcvbn.dart'; + import '../../../../notifications/show_flush_bar.dart'; import '../../../../pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart'; import '../../../../pages/settings_views/global_settings_view/stack_backup_views/helpers/swb_file_system.dart'; @@ -39,12 +41,11 @@ import '../../../../widgets/desktop/secondary_button.dart'; import '../../../../widgets/progress_bar.dart'; import '../../../../widgets/stack_dialog.dart'; import '../../../../widgets/stack_text_field.dart'; -import 'package:zxcvbn/zxcvbn.dart'; class CreateAutoBackup extends ConsumerStatefulWidget { const CreateAutoBackup({ - Key? key, - }) : super(key: key); + super.key, + }); @override ConsumerState createState() => _CreateAutoBackup(); @@ -175,72 +176,75 @@ class _CreateAutoBackup extends ConsumerState { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ if (!Platform.isAndroid && !Platform.isIOS) - Consumer(builder: (context, ref, __) { - return Container( - color: Colors.transparent, - child: TextField( - autocorrect: false, - enableSuggestions: false, - onTap: Platform.isAndroid || Platform.isIOS - ? null - : () async { - try { - await stackFileSystem.prepareStorage(); + Consumer( + builder: (context, ref, __) { + return Container( + color: Colors.transparent, + child: TextField( + autocorrect: false, + enableSuggestions: false, + onTap: Platform.isAndroid || Platform.isIOS + ? null + : () async { + try { + await stackFileSystem.prepareStorage(); - if (mounted) { - await stackFileSystem.pickDir(context); - } + if (mounted) { + await stackFileSystem.pickDir(context); + } - if (mounted) { - setState(() { - fileLocationController.text = - stackFileSystem.dirPath ?? ""; - }); + if (mounted) { + setState(() { + fileLocationController.text = + stackFileSystem.dirPath ?? ""; + }); + } + } catch (e, s) { + Logging.instance + .log("$e\n$s", level: LogLevel.Error); } - } catch (e, s) { - Logging.instance - .log("$e\n$s", level: LogLevel.Error); - } - }, - controller: fileLocationController, - style: STextStyles.field(context), - decoration: InputDecoration( - hintText: "Save to...", - hintStyle: STextStyles.fieldLabel(context), - suffixIcon: UnconstrainedBox( - child: Row( - children: [ - const SizedBox( - width: 16, - ), - SvgPicture.asset( - Assets.svg.folder, - color: Theme.of(context) - .extension()! - .textDark3, - width: 16, - height: 16, - ), - const SizedBox( - width: 12, - ), - ], + }, + controller: fileLocationController, + style: STextStyles.field(context), + decoration: InputDecoration( + hintText: "Save to...", + hintStyle: STextStyles.fieldLabel(context), + suffixIcon: UnconstrainedBox( + child: Row( + children: [ + const SizedBox( + width: 16, + ), + SvgPicture.asset( + Assets.svg.folder, + color: Theme.of(context) + .extension()! + .textDark3, + width: 16, + height: 16, + ), + const SizedBox( + width: 12, + ), + ], + ), ), ), + key: const Key( + "createBackupSaveToFileLocationTextFieldKey", + ), + readOnly: true, + toolbarOptions: const ToolbarOptions( + copy: true, + cut: false, + paste: false, + selectAll: false, + ), + onChanged: (newValue) {}, ), - key: const Key( - "createBackupSaveToFileLocationTextFieldKey"), - readOnly: true, - toolbarOptions: const ToolbarOptions( - copy: true, - cut: false, - paste: false, - selectAll: false, - ), - onChanged: (newValue) {}, - ), - ); - }), + ); + }, + ), if (!Platform.isAndroid && !Platform.isIOS) const SizedBox( height: 24, @@ -250,11 +254,12 @@ class _CreateAutoBackup extends ConsumerState { padding: const EdgeInsets.only(bottom: 10.0), child: Text( "Create a passphrase", - style: STextStyles.desktopTextExtraSmall(context) - .copyWith( - color: Theme.of(context) - .extension()! - .textDark3), + style: + STextStyles.desktopTextExtraSmall(context).copyWith( + color: Theme.of(context) + .extension()! + .textDark3, + ), textAlign: TextAlign.left, ), ), @@ -285,7 +290,8 @@ class _CreateAutoBackup extends ConsumerState { ), GestureDetector( key: const Key( - "createBackupPasswordFieldShowPasswordButtonKey"), + "createBackupPasswordFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; @@ -318,7 +324,7 @@ class _CreateAutoBackup extends ConsumerState { } final result = zxcvbn.evaluate(newValue); String suggestionsAndTips = ""; - for (var sug in result.feedback.suggestions!.toSet()) { + for (final sug in result.feedback.suggestions!.toSet()) { suggestionsAndTips += "$sug\n"; } suggestionsAndTips += result.feedback.warning!; @@ -331,7 +337,9 @@ class _CreateAutoBackup extends ConsumerState { // hack fix to format back string returned from zxcvbn if (feedback.contains("phrasesNo need")) { feedback = feedback.replaceFirst( - "phrasesNo need", "phrases\nNo need"); + "phrasesNo need", + "phrases\nNo need", + ); } if (feedback.endsWith("\n")) { @@ -420,7 +428,8 @@ class _CreateAutoBackup extends ConsumerState { ), GestureDetector( key: const Key( - "createBackupPasswordFieldShowPasswordButtonKey"), + "createBackupPasswordFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = !hidePassword; @@ -502,7 +511,8 @@ class _CreateAutoBackup extends ConsumerState { child: Text( message, style: STextStyles.desktopTextExtraExtraSmall( - context), + context, + ), ), ); }, @@ -646,7 +656,8 @@ class _CreateAutoBackup extends ConsumerState { Text( "Encrypting initial backup", style: STextStyles.desktopH3( - context), + context, + ), ), const SizedBox( height: 40, @@ -655,7 +666,8 @@ class _CreateAutoBackup extends ConsumerState { "This shouldn't take long", style: STextStyles .desktopTextExtraExtraSmall( - context), + context, + ), ), ], ), @@ -673,7 +685,8 @@ class _CreateAutoBackup extends ConsumerState { // make sure the dialog is able to be displayed for at least some time final fut = Future.delayed( - const Duration(milliseconds: 300)); + const Duration(milliseconds: 300), + ); String adkString; int adkVersion; @@ -683,7 +696,8 @@ class _CreateAutoBackup extends ConsumerState { adkString = Format.uint8listToString(adk.item2); adkVersion = adk.item1; } on Exception catch (e, s) { - String err = getErrorMessageFromSWBException(e); + final String err = + getErrorMessageFromSWBException(e); Logging.instance .log("$err\n$s", level: LogLevel.Error); // pop encryption progress dialog @@ -712,10 +726,13 @@ class _CreateAutoBackup extends ConsumerState { } await secureStore.write( - key: "auto_adk_string", value: adkString); + key: "auto_adk_string", + value: adkString, + ); await secureStore.write( - key: "auto_adk_version_string", - value: adkVersion.toString()); + key: "auto_adk_version_string", + value: adkVersion.toString(), + ); final DateTime now = DateTime.now(); final String fileToSave = @@ -725,7 +742,8 @@ class _CreateAutoBackup extends ConsumerState { secureStorage: secureStore, ); - bool result = await SWB.encryptStackWalletWithADK( + final bool result = + await SWB.encryptStackWalletWithADK( fileToSave, adkString, jsonEncode(backup), @@ -785,7 +803,8 @@ class _CreateAutoBackup extends ConsumerState { "Stack Auto Backup enabled!", style: STextStyles.desktopH3( - context), + context, + ), ), const DesktopDialogCloseButton(), ], @@ -808,7 +827,7 @@ class _CreateAutoBackup extends ConsumerState { ), ), ], - ) + ), ], ), ), @@ -831,13 +850,14 @@ class _CreateAutoBackup extends ConsumerState { context: context, barrierDismissible: false, builder: (_) => const StackOkDialog( - title: "Failed to enable Auto Backup"), + title: "Failed to enable Auto Backup", + ), ); } } }, ), - ) + ), ], ), ), diff --git a/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/enable_backup_dialog.dart b/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/enable_backup_dialog.dart index fcd05c57b..dcc164c41 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/enable_backup_dialog.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/enable_backup_dialog.dart @@ -18,7 +18,7 @@ import '../../../../widgets/desktop/primary_button.dart'; import '../../../../widgets/desktop/secondary_button.dart'; class EnableBackupDialog extends StatelessWidget { - const EnableBackupDialog({Key? key}) : super(key: key); + const EnableBackupDialog({super.key}); @override Widget build(BuildContext context) { @@ -88,7 +88,7 @@ class EnableBackupDialog extends StatelessWidget { createAutoBackup(); }, ), - ) + ), ], ), ), diff --git a/lib/pages_desktop_specific/settings/settings_menu/currency_settings/currency_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/currency_settings/currency_settings.dart index c9faa8182..04d73fd35 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/currency_settings/currency_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/currency_settings/currency_settings.dart @@ -20,7 +20,7 @@ import '../../../../widgets/desktop/primary_button.dart'; import '../../../../widgets/rounded_white_container.dart'; class CurrencySettings extends ConsumerStatefulWidget { - const CurrencySettings({Key? key}) : super(key: key); + const CurrencySettings({super.key}); static const String routeName = "/settingsMenuCurrency"; diff --git a/lib/pages_desktop_specific/settings/settings_menu/desktop_about_view.dart b/lib/pages_desktop_specific/settings/settings_menu/desktop_about_view.dart index 7cd74d3af..34c8a8dba 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/desktop_about_view.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/desktop_about_view.dart @@ -546,7 +546,8 @@ class DesktopAboutView extends ConsumerWidget { onTap: () { launchUrl( Uri.parse( - "https://tzkt.io"), + "https://tzkt.io", + ), mode: LaunchMode .externalApplication, ); diff --git a/lib/pages_desktop_specific/settings/settings_menu/desktop_support_view.dart b/lib/pages_desktop_specific/settings/settings_menu/desktop_support_view.dart index 2d9060e3a..cf211b27e 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/desktop_support_view.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/desktop_support_view.dart @@ -17,7 +17,7 @@ import '../../../widgets/desktop/desktop_app_bar.dart'; import '../../../widgets/desktop/desktop_scaffold.dart'; class DesktopSupportView extends ConsumerStatefulWidget { - const DesktopSupportView({Key? key}) : super(key: key); + const DesktopSupportView({super.key}); static const String routeName = "/desktopSupportView"; @@ -42,17 +42,17 @@ class _DesktopSupportView extends ConsumerState { Text( "Support", style: STextStyles.desktopH3(context), - ) + ), ], ), ), - body: Column( + body: const Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: const EdgeInsets.fromLTRB(24, 10, 0, 0), + padding: EdgeInsets.fromLTRB(24, 10, 0, 0), child: Row( - children: const [ + children: [ SizedBox( width: 576, child: SupportView(), diff --git a/lib/pages_desktop_specific/settings/settings_menu/language_settings/language_dialog.dart b/lib/pages_desktop_specific/settings/settings_menu/language_settings/language_dialog.dart index c24762da6..072906bff 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/language_settings/language_dialog.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/language_settings/language_dialog.dart @@ -11,6 +11,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../../providers/global/prefs_provider.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; @@ -27,7 +28,7 @@ import '../../../../widgets/stack_text_field.dart'; import '../../../../widgets/textfield_icon_button.dart'; class LanguageDialog extends ConsumerStatefulWidget { - const LanguageDialog({Key? key}) : super(key: key); + const LanguageDialog({super.key}); @override ConsumerState createState() => _LanguageDialog(); @@ -80,7 +81,8 @@ class _LanguageDialog extends ConsumerState { List _filtered() { return listWithoutSelected .where( - (element) => element.toLowerCase().contains(filter.toLowerCase())) + (element) => element.toLowerCase().contains(filter.toLowerCase()), + ) .toList(); } @@ -141,11 +143,12 @@ class _LanguageDialog extends ConsumerState { return [ SliverOverlapAbsorber( handle: NestedScrollView.sliverOverlapAbsorberHandleFor( - context), + context, + ), sliver: SliverToBoxAdapter( child: Padding( - padding: - EdgeInsets.symmetric(vertical: 16, horizontal: 32), + padding: const EdgeInsets.symmetric( + vertical: 16, horizontal: 32), child: Column( children: [ Padding( @@ -164,9 +167,11 @@ class _LanguageDialog extends ConsumerState { height: 2, ), textAlign: TextAlign.left, - decoration: standardInputDecoration("Search", - searchLanguageFocusNode, context) - .copyWith( + decoration: standardInputDecoration( + "Search", + searchLanguageFocusNode, + context, + ).copyWith( prefixIcon: Padding( padding: const EdgeInsets.symmetric( horizontal: 10, @@ -234,10 +239,12 @@ class _LanguageDialog extends ConsumerState { child: Padding( padding: const EdgeInsets.all(4), key: Key( - "desktopSelectLanguage_${listWithoutSelected[index]}"), + "desktopSelectLanguage_${listWithoutSelected[index]}", + ), child: Padding( padding: const EdgeInsets.symmetric( - horizontal: 32), + horizontal: 32, + ), child: RoundedContainer( padding: const EdgeInsets.all(0), color: index == 0 @@ -287,11 +294,13 @@ class _LanguageDialog extends ConsumerState { listWithoutSelected[index], key: (index == 0) ? const Key( - "desktopSettingsSelectedLanguageText") + "desktopSettingsSelectedLanguageText", + ) : null, style: STextStyles.largeMedium14( - context), + context, + ), ), const SizedBox( height: 2, @@ -300,11 +309,13 @@ class _LanguageDialog extends ConsumerState { listWithoutSelected[index], key: (index == 0) ? const Key( - "desktopSettingsSelectedLanguageTextDescription") + "desktopSettingsSelectedLanguageTextDescription", + ) : null, style: STextStyles.itemSubtitle( - context), + context, + ), ), ], ), @@ -347,7 +358,7 @@ class _LanguageDialog extends ConsumerState { label: "Save Changes", onPressed: () {}, ), - ) + ), ], ), ), diff --git a/lib/pages_desktop_specific/settings/settings_menu/language_settings/language_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/language_settings/language_settings.dart index 795fbbf8b..e02bf1263 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/language_settings/language_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/language_settings/language_settings.dart @@ -11,14 +11,15 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'language_dialog.dart'; + import '../../../../utilities/assets.dart'; import '../../../../utilities/text_styles.dart'; import '../../../../widgets/desktop/primary_button.dart'; import '../../../../widgets/rounded_white_container.dart'; +import 'language_dialog.dart'; class LanguageOptionSettings extends ConsumerStatefulWidget { - const LanguageOptionSettings({Key? key}) : super(key: key); + const LanguageOptionSettings({super.key}); static const String routeName = "/settingsMenuLanguage"; @@ -78,7 +79,8 @@ class _LanguageOptionSettings extends ConsumerState { text: "\n\nSelect the language of your wallet. We use your system language by default.", style: STextStyles.desktopTextExtraExtraSmall( - context), + context, + ), ), ], ), diff --git a/lib/pages_desktop_specific/settings/settings_menu/nodes_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/nodes_settings.dart index 0471caf73..517073f4c 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/nodes_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/nodes_settings.dart @@ -13,10 +13,11 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + +import '../../../app_config.dart'; import '../../../pages/settings_views/global_settings_view/manage_nodes_views/coin_nodes_view.dart'; import '../../../providers/providers.dart'; import '../../../route_generator.dart'; -import '../../../app_config.dart'; import '../../../themes/coin_icon_provider.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/assets.dart'; @@ -70,13 +71,6 @@ class _NodesSettings extends ConsumerState { _coins.removeWhere( (e) => e is Firo && e.network == CryptoCurrencyNetwork.test, ); - if (Platform.isWindows) { - _coins.removeWhere( - (e) => e is Monero && e is Wownero, - ); - } else if (Platform.isLinux) { - _coins.removeWhere((e) => e is Wownero); - } searchNodeController = TextEditingController(); searchNodeFocusNode = FocusNode(); diff --git a/lib/pages_desktop_specific/settings/settings_menu/security_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/security_settings.dart index 524686732..3b227f1d3 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/security_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/security_settings.dart @@ -13,18 +13,20 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:zxcvbn/zxcvbn.dart'; + import '../../../app_config.dart'; import '../../../notifications/show_flush_bar.dart'; import '../../../providers/desktop/storage_crypto_handler_provider.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/assets.dart'; import '../../../utilities/constants.dart'; +import '../../../utilities/show_loading.dart'; import '../../../utilities/text_styles.dart'; import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/progress_bar.dart'; import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/stack_text_field.dart'; -import 'package:zxcvbn/zxcvbn.dart'; class SecuritySettings extends ConsumerStatefulWidget { const SecuritySettings({super.key}); @@ -61,7 +63,8 @@ class _SecuritySettings extends ConsumerState { String passwordFeedback = "Add another word or two. Uncommon words are better. Use a few words, avoid common phrases. No need for symbols, digits, or uppercase letters."; - Future attemptChangePW() async { + bool _changePWLock = false; + Future<(bool, FlushBarType, String)> _attemptChangePW() async { final String pw = passwordCurrentController.text; final String pwNew = passwordController.text; final String pwNewRepeat = passwordRepeatController.text; @@ -73,14 +76,7 @@ class _SecuritySettings extends ConsumerState { if (pwNew != pwNewRepeat) { await Future.delayed(const Duration(seconds: 1)); - unawaited( - showFloatingFlushBar( - type: FlushBarType.warning, - message: "New passphrase does not match!", - context: context, - ), - ); - return false; + return (false, FlushBarType.warning, "New passphrase does not match!"); } else { final success = await ref.read(storageCryptoHandlerProvider).changePassphrase( @@ -91,38 +87,21 @@ class _SecuritySettings extends ConsumerState { if (success) { await Future.delayed(const Duration(seconds: 1)); - unawaited( - showFloatingFlushBar( - type: FlushBarType.success, - message: "Passphrase successfully changed", - context: context, - ), + return ( + true, + FlushBarType.success, + "Passphrase successfully changed" ); - return true; } else { await Future.delayed(const Duration(seconds: 1)); - unawaited( - showFloatingFlushBar( - type: FlushBarType.warning, - message: "Passphrase change failed", - context: context, - ), - ); - return false; + return (false, FlushBarType.warning, "Passphrase change failed"); } } } else { await Future.delayed(const Duration(seconds: 1)); - unawaited( - showFloatingFlushBar( - type: FlushBarType.warning, - message: "Current passphrase is not valid!", - context: context, - ), - ); - return false; + return (false, FlushBarType.warning, "Current passphrase is not valid!"); } } @@ -204,11 +183,12 @@ class _SecuritySettings extends ConsumerState { "Current password", style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( - color: Theme.of(context) - .extension()! - .textDark3), + context, + ).copyWith( + color: Theme.of(context) + .extension()! + .textDark3, + ), textAlign: TextAlign.left, ), const SizedBox(height: 10), @@ -218,7 +198,8 @@ class _SecuritySettings extends ConsumerState { ), child: TextField( key: const Key( - "desktopSecurityRestoreFromFilePasswordFieldKey"), + "desktopSecurityRestoreFromFilePasswordFieldKey", + ), focusNode: passwordCurrentFocusNode, controller: passwordCurrentController, style: STextStyles.field(context), @@ -240,7 +221,8 @@ class _SecuritySettings extends ConsumerState { ), GestureDetector( key: const Key( - "desktopSecurityRestoreFromFilePasswordFieldShowPasswordButtonKey"), + "desktopSecurityRestoreFromFilePasswordFieldShowPasswordButtonKey", + ), onTap: () async { setState(() { hidePassword = @@ -275,11 +257,12 @@ class _SecuritySettings extends ConsumerState { "New password", style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( - color: Theme.of(context) - .extension()! - .textDark3), + context, + ).copyWith( + color: Theme.of(context) + .extension()! + .textDark3, + ), textAlign: TextAlign.left, ), const SizedBox(height: 10), @@ -289,7 +272,8 @@ class _SecuritySettings extends ConsumerState { ), child: TextField( key: const Key( - "desktopSecurityCreateNewPasswordFieldKey1"), + "desktopSecurityCreateNewPasswordFieldKey1", + ), focusNode: passwordFocusNode, controller: passwordController, style: STextStyles.field(context), @@ -311,7 +295,8 @@ class _SecuritySettings extends ConsumerState { ), GestureDetector( key: const Key( - "desktopSecurityCreateNewPasswordButtonKey1"), + "desktopSecurityCreateNewPasswordButtonKey1", + ), onTap: () async { setState(() { hidePassword = @@ -346,7 +331,7 @@ class _SecuritySettings extends ConsumerState { final result = zxcvbn.evaluate(newValue); String suggestionsAndTips = ""; - for (var sug in result + for (final sug in result .feedback.suggestions! .toSet()) { suggestionsAndTips += "$sug\n"; @@ -363,13 +348,16 @@ class _SecuritySettings extends ConsumerState { if (feedback .contains("phrasesNo need")) { feedback = feedback.replaceFirst( - "phrasesNo need", - "phrases\nNo need"); + "phrasesNo need", + "phrases\nNo need", + ); } if (feedback.endsWith("\n")) { feedback = feedback.substring( - 0, feedback.length - 2); + 0, + feedback.length - 2, + ); } setState(() { @@ -392,7 +380,8 @@ class _SecuritySettings extends ConsumerState { ? Text( passwordFeedback, style: STextStyles.infoSmall( - context), + context, + ), ) : null, ), @@ -407,7 +396,8 @@ class _SecuritySettings extends ConsumerState { ), child: ProgressBar( key: const Key( - "desktopSecurityCreateStackBackUpProgressBar"), + "desktopSecurityCreateStackBackUpProgressBar", + ), width: 450, height: 5, fillColor: passwordStrength < 0.51 @@ -434,11 +424,12 @@ class _SecuritySettings extends ConsumerState { "Confirm new password", style: STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( - color: Theme.of(context) - .extension()! - .textDark3), + context, + ).copyWith( + color: Theme.of(context) + .extension()! + .textDark3, + ), textAlign: TextAlign.left, ), const SizedBox(height: 10), @@ -448,7 +439,8 @@ class _SecuritySettings extends ConsumerState { ), child: TextField( key: const Key( - "desktopSecurityCreateNewPasswordFieldKey2"), + "desktopSecurityCreateNewPasswordFieldKey2", + ), focusNode: passwordRepeatFocusNode, controller: passwordRepeatController, style: STextStyles.field(context), @@ -470,7 +462,8 @@ class _SecuritySettings extends ConsumerState { ), GestureDetector( key: const Key( - "desktopSecurityCreateNewPasswordButtonKey2"), + "desktopSecurityCreateNewPasswordButtonKey2", + ), onTap: () async { setState(() { hidePassword = @@ -507,15 +500,40 @@ class _SecuritySettings extends ConsumerState { enabled: shouldEnableSave, label: "Save changes", onPressed: () async { - final didChangePW = - await attemptChangePW(); - if (didChangePW) { - setState(() { - changePassword = false; - }); + if (_changePWLock) { + return; + } + _changePWLock = true; + + try { + final (didChangePW, type, message) = + (await showLoading( + whileFuture: _attemptChangePW(), + context: context, + message: "Updating...", + rootNavigator: true, + ))!; + + if (mounted) { + unawaited( + showFloatingFlushBar( + type: type, + message: message, + context: context, + ), + ); + } + + if (didChangePW == true) { + setState(() { + changePassword = false; + }); + } + } finally { + _changePWLock = false; } }, - ) + ), ], ), ) diff --git a/lib/pages_desktop_specific/settings/settings_menu/syncing_preferences_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/syncing_preferences_settings.dart index d1b03d83e..a384ffacf 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/syncing_preferences_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/syncing_preferences_settings.dart @@ -11,6 +11,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../../pages/settings_views/global_settings_view/syncing_preferences_views/syncing_options_view.dart'; import '../../../providers/global/prefs_provider.dart'; import '../../../themes/stack_colors.dart'; @@ -22,7 +23,7 @@ import '../../../widgets/rounded_container.dart'; import '../../../widgets/rounded_white_container.dart'; class SyncingPreferencesSettings extends ConsumerStatefulWidget { - const SyncingPreferencesSettings({Key? key}) : super(key: key); + const SyncingPreferencesSettings({super.key}); static const String routeName = "/settingsMenuSyncingPref"; @@ -80,14 +81,18 @@ class _SyncingPreferencesSettings child: Padding( padding: const EdgeInsets.all(8.0), child: Text( - _currentTypeDescription(ref.watch( + _currentTypeDescription( + ref.watch( prefsChangeNotifierProvider - .select((value) => value.syncType))), + .select((value) => value.syncType), + ), + ), style: STextStyles.desktopTextExtraSmall(context) .copyWith( - color: Theme.of(context) - .extension()! - .textDark2), + color: Theme.of(context) + .extension()! + .textDark2, + ), textAlign: TextAlign.left, ), ), @@ -112,7 +117,8 @@ class _SyncingPreferencesSettings text: "\n\nSet up your syncing preferences for all wallets in your Stack.", style: STextStyles.desktopTextExtraExtraSmall( - context), + context, + ), ), ], ), @@ -124,46 +130,47 @@ class _SyncingPreferencesSettings crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: const EdgeInsets.all( - 10, - ), - child: changePrefs - ? SizedBox( - width: 512, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SyncingOptionsView(), - PrimaryButton( - width: 200, - buttonHeight: ButtonHeight.m, - enabled: true, - label: "Save", - onPressed: () { - setState(() { - changePrefs = false; - }); - }, - ), - ], - ), - ) - : Column( + padding: const EdgeInsets.all( + 10, + ), + child: changePrefs + ? SizedBox( + width: 512, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - const SizedBox(height: 10), + const SyncingOptionsView(), PrimaryButton( width: 200, buttonHeight: ButtonHeight.m, enabled: true, - label: "Change preferences", + label: "Save", onPressed: () { setState(() { - changePrefs = true; + changePrefs = false; }); }, ), ], - )), + ), + ) + : Column( + children: [ + const SizedBox(height: 10), + PrimaryButton( + width: 200, + buttonHeight: ButtonHeight.m, + enabled: true, + label: "Change preferences", + onPressed: () { + setState(() { + changePrefs = true; + }); + }, + ), + ], + ), + ), ], ), ], diff --git a/lib/pages_desktop_specific/settings/settings_menu/tor_settings/tor_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/tor_settings/tor_settings.dart index 4cbce2c5e..d01a5d678 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/tor_settings/tor_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/tor_settings/tor_settings.dart @@ -15,6 +15,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../../../../providers/global/prefs_provider.dart'; import '../../../../services/event_bus/events/global/tor_connection_status_changed_event.dart'; import '../../../../services/event_bus/global_event_bus.dart'; @@ -32,7 +33,7 @@ import '../../../../widgets/desktop/secondary_button.dart'; import '../../../../widgets/rounded_white_container.dart'; class TorSettings extends ConsumerStatefulWidget { - const TorSettings({Key? key}) : super(key: key); + const TorSettings({super.key}); static const String routeName = "/torDesktopSettings"; @@ -198,7 +199,8 @@ class _TorSettingsState extends ConsumerState { text: "\nConnect to the Tor Network with one click.", style: STextStyles.desktopTextExtraExtraSmall( - context), + context, + ), ), TextSpan( text: "\tWhat is Tor?", @@ -233,7 +235,8 @@ class _TorSettingsState extends ConsumerState { "What is Tor?", style: STextStyles.desktopH2( - context), + context, + ), ), DesktopDialogCloseButton( onPressedOverride: () => @@ -250,9 +253,9 @@ class _TorSettingsState extends ConsumerState { " to remain anonymous by routing internet traffic through a series of layered nodes," " to obscure the origin and destination of data.", style: STextStyles - .desktopTextMedium( - context) - .copyWith( + .desktopTextMedium( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark3, @@ -295,9 +298,10 @@ class _TorSettingsState extends ConsumerState { style: STextStyles.desktopTextExtraExtraSmall(context) .copyWith( - color: Theme.of(context) - .extension()! - .textDark), + color: Theme.of(context) + .extension()! + .textDark, + ), ), const SizedBox( height: 8, @@ -337,7 +341,8 @@ class _TorSettingsState extends ConsumerState { "What is Tor killswitch?", style: STextStyles.desktopH2( - context), + context, + ), ), DesktopDialogCloseButton( onPressedOverride: () => @@ -354,9 +359,9 @@ class _TorSettingsState extends ConsumerState { " disconnecting your device from the Tor network if the" " connection is disrupted or compromised.", style: STextStyles - .desktopTextMedium( - context) - .copyWith( + .desktopTextMedium( + context, + ).copyWith( color: Theme.of(context) .extension()! .textDark3, diff --git a/lib/pages_desktop_specific/settings/settings_menu_item.dart b/lib/pages_desktop_specific/settings/settings_menu_item.dart index a1cc79d98..a6742fd48 100644 --- a/lib/pages_desktop_specific/settings/settings_menu_item.dart +++ b/lib/pages_desktop_specific/settings/settings_menu_item.dart @@ -14,13 +14,13 @@ import '../../utilities/text_styles.dart'; class SettingsMenuItem extends StatelessWidget { const SettingsMenuItem({ - Key? key, + super.key, required this.icon, required this.label, required this.value, required this.group, required this.onChanged, - }) : super(key: key); + }); final Widget icon; final String label; diff --git a/lib/pages_desktop_specific/spark_coins/spark_coins_view.dart b/lib/pages_desktop_specific/spark_coins/spark_coins_view.dart index 42053b155..43ba62a6a 100644 --- a/lib/pages_desktop_specific/spark_coins/spark_coins_view.dart +++ b/lib/pages_desktop_specific/spark_coins/spark_coins_view.dart @@ -24,9 +24,9 @@ import '../../widgets/rounded_white_container.dart'; class SparkCoinsView extends ConsumerStatefulWidget { const SparkCoinsView({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); static const String routeName = "/sparkCoinsView"; diff --git a/lib/providers/exchange/exchange_form_state_provider.dart b/lib/providers/exchange/exchange_form_state_provider.dart index ab1515653..433555230 100644 --- a/lib/providers/exchange/exchange_form_state_provider.dart +++ b/lib/providers/exchange/exchange_form_state_provider.dart @@ -20,7 +20,6 @@ import '../../utilities/amount/amount.dart'; import '../../utilities/amount/amount_unit.dart'; import '../../utilities/enums/exchange_rate_type_enum.dart'; -import '../../wallets/crypto_currency/coins/nano.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; import 'package:tuple/tuple.dart'; diff --git a/lib/providers/exchange/trade_sent_from_stack_lookup_provider.dart b/lib/providers/exchange/trade_sent_from_stack_lookup_provider.dart index 5eb808e3c..fc717d104 100644 --- a/lib/providers/exchange/trade_sent_from_stack_lookup_provider.dart +++ b/lib/providers/exchange/trade_sent_from_stack_lookup_provider.dart @@ -9,8 +9,10 @@ */ import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../services/trade_sent_from_stack_service.dart'; final tradeSentFromStackLookupProvider = ChangeNotifierProvider( - (ref) => TradeSentFromStackService()); + (ref) => TradeSentFromStackService(), +); diff --git a/lib/providers/global/base_currencies_provider.dart b/lib/providers/global/base_currencies_provider.dart index 341ebf2c1..1709d86c1 100644 --- a/lib/providers/global/base_currencies_provider.dart +++ b/lib/providers/global/base_currencies_provider.dart @@ -31,7 +31,7 @@ class _BaseCurrencies extends ChangeNotifier { return; } - Map newMap = {}; + final Map newMap = {}; for (final entry in _kCurrencyMap.entries) { if (list.contains(entry.key.toLowerCase())) { diff --git a/lib/providers/global/secure_store_provider.dart b/lib/providers/global/secure_store_provider.dart index 284ee2745..d49d6c552 100644 --- a/lib/providers/global/secure_store_provider.dart +++ b/lib/providers/global/secure_store_provider.dart @@ -10,15 +10,18 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; -import '../desktop/storage_crypto_handler_provider.dart'; + import '../../utilities/flutter_secure_storage_interface.dart'; import '../../utilities/util.dart'; +import '../desktop/storage_crypto_handler_provider.dart'; final secureStoreProvider = Provider((ref) { if (Util.isDesktop) { final handler = ref.read(storageCryptoHandlerProvider).handler; return SecureStorageWrapper( - store: DesktopSecureStore(handler), isDesktop: true); + store: DesktopSecureStore(handler), + isDesktop: true, + ); } else { return const SecureStorageWrapper( store: FlutterSecureStorage(), diff --git a/lib/providers/stack_restore/stack_restoring_ui_state_provider.dart b/lib/providers/stack_restore/stack_restoring_ui_state_provider.dart index a618d34e5..41f0fbe07 100644 --- a/lib/providers/stack_restore/stack_restoring_ui_state_provider.dart +++ b/lib/providers/stack_restore/stack_restoring_ui_state_provider.dart @@ -9,8 +9,10 @@ */ import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../models/stack_restoring_ui_state.dart'; final stackRestoringUIStateProvider = ChangeNotifierProvider( - (ref) => StackRestoringUIState()); + (ref) => StackRestoringUIState(), +); diff --git a/lib/providers/ui/address_book_providers/valid_contact_state_provider.dart b/lib/providers/ui/address_book_providers/valid_contact_state_provider.dart index 1bdba9729..7529484d1 100644 --- a/lib/providers/ui/address_book_providers/valid_contact_state_provider.dart +++ b/lib/providers/ui/address_book_providers/valid_contact_state_provider.dart @@ -9,6 +9,7 @@ */ import 'package:flutter_riverpod/flutter_riverpod.dart'; + import 'address_entry_data_provider.dart'; final validContactStateProvider = @@ -19,10 +20,12 @@ final validContactStateProvider = for (int i = 0; i < ids.length; i++) { final _valid = ref.watch( - addressEntryDataProvider(ids[i]).select((value) => value.isValid)); + addressEntryDataProvider(ids[i]).select((value) => value.isValid), + ); final _isEmpty = ref.watch( - addressEntryDataProvider(ids[i]).select((value) => value.isEmpty)); + addressEntryDataProvider(ids[i]).select((value) => value.isEmpty), + ); isValid = isValid && (_valid || _isEmpty); if (_valid) { diff --git a/lib/providers/ui/preview_tx_button_state_provider.dart b/lib/providers/ui/preview_tx_button_state_provider.dart index 283c7c2c8..89d960743 100644 --- a/lib/providers/ui/preview_tx_button_state_provider.dart +++ b/lib/providers/ui/preview_tx_button_state_provider.dart @@ -11,7 +11,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../wallet/public_private_balance_state_provider.dart'; import '../../utilities/amount/amount.dart'; -import '../../wallets/crypto_currency/coins/firo.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; final pSendAmount = StateProvider.autoDispose((_) => null); diff --git a/lib/providers/wallet/wallet_balance_toggle_state_provider.dart b/lib/providers/wallet/wallet_balance_toggle_state_provider.dart index 31860c052..eb9dada4f 100644 --- a/lib/providers/wallet/wallet_balance_toggle_state_provider.dart +++ b/lib/providers/wallet/wallet_balance_toggle_state_provider.dart @@ -9,8 +9,10 @@ */ import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../utilities/enums/wallet_balance_toggle_state.dart'; final walletBalanceToggleStateProvider = StateProvider.autoDispose( - (ref) => WalletBalanceToggleState.full); + (ref) => WalletBalanceToggleState.full, +); diff --git a/lib/route_generator.dart b/lib/route_generator.dart index dd22e8ccd..ccedb0a6a 100644 --- a/lib/route_generator.dart +++ b/lib/route_generator.dart @@ -11,6 +11,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:isar/isar.dart'; +import 'package:tuple/tuple.dart'; + import 'models/add_wallet_list_entity/add_wallet_list_entity.dart'; import 'models/add_wallet_list_entity/sub_classes/eth_token_entity.dart'; import 'models/buy/response_objects/quote.dart'; @@ -127,7 +129,9 @@ import 'pages/settings_views/wallet_settings_view/wallet_settings_view.dart'; import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/change_representative_view.dart'; import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_recovery_phrase_view.dart'; import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_warning_view.dart'; +import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/lelantus_settings_view.dart'; import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/rename_wallet_view.dart'; +import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/spark_info.dart'; import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/wallet_settings_wallet_settings_view.dart'; import 'pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/xpub_view.dart'; import 'pages/special/firo_rescan_recovery_error_dialog.dart'; @@ -194,7 +198,6 @@ import 'wallets/models/tx_data.dart'; import 'wallets/wallet/wallet.dart'; import 'widgets/choose_coin_view.dart'; import 'widgets/frost_scaffold.dart'; -import 'package:tuple/tuple.dart'; /* * This file contains all the routes for the app. @@ -1390,7 +1393,8 @@ class RouteGenerator { return _routeError("${settings.name} invalid args: ${args.toString()}"); case RestoreWalletView.routeName: - if (args is Tuple5) { + if (args + is Tuple6) { return getRoute( shouldUseMaterialRoute: useMaterialPageRoute, builder: (_) => RestoreWalletView( @@ -1399,6 +1403,7 @@ class RouteGenerator { seedWordsLength: args.item3, restoreFromDate: args.item4, mnemonicPassphrase: args.item5, + enableLelantusScanning: args.item6 ?? false, ), settings: RouteSettings( name: settings.name, @@ -1950,6 +1955,27 @@ class RouteGenerator { } return _routeError("${settings.name} invalid args: ${args.toString()}"); + case LelantusSettingsView.routeName: + if (args is String) { + return getRoute( + shouldUseMaterialRoute: useMaterialPageRoute, + builder: (_) => LelantusSettingsView(walletId: args), + settings: RouteSettings( + name: settings.name, + ), + ); + } + return _routeError("${settings.name} invalid args: ${args.toString()}"); + + case SparkInfoView.routeName: + return getRoute( + shouldUseMaterialRoute: useMaterialPageRoute, + builder: (_) => const SparkInfoView(), + settings: RouteSettings( + name: settings.name, + ), + ); + // == Desktop specific routes ============================================ case CreatePasswordView.routeName: if (args is bool) { @@ -2458,11 +2484,11 @@ class RouteGenerator { return PageRouteBuilder( pageBuilder: (context, animation, secondaryAnimation) => viewToInsert, transitionsBuilder: (context, animation, secondaryAnimation, child) { - var begin = const Offset(0.0, 1.0); - var end = Offset.zero; - var curve = Curves.easeInOut; + final begin = const Offset(0.0, 1.0); + final end = Offset.zero; + final curve = Curves.easeInOut; - var tween = + final tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve)); return SlideTransition( @@ -2475,7 +2501,7 @@ class RouteGenerator { static Route _routeError(String message) { // Replace with robust ErrorView page - Widget errorView = Scaffold( + final Widget errorView = Scaffold( appBar: AppBar( backgroundColor: Colors.black, title: const Text('Navigation error'), diff --git a/lib/services/auto_swb_service.dart b/lib/services/auto_swb_service.dart index d1f5d5499..1113b30f1 100644 --- a/lib/services/auto_swb_service.dart +++ b/lib/services/auto_swb_service.dart @@ -13,11 +13,12 @@ import 'dart:convert'; import 'dart:io'; import 'package:flutter/foundation.dart'; +import 'package:tuple/tuple.dart'; + import '../pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart'; import '../utilities/flutter_secure_storage_interface.dart'; import '../utilities/logger.dart'; import '../utilities/prefs.dart'; -import 'package:tuple/tuple.dart'; enum AutoSWBStatus { idle, @@ -42,8 +43,9 @@ class AutoSWBService extends ChangeNotifier { Future doBackup() async { if (_status == AutoSWBStatus.backingUp) { Logging.instance.log( - "AutoSWBService attempted to run doBackup() while a backup is in progress!", - level: LogLevel.Warning); + "AutoSWBService attempted to run doBackup() while a backup is in progress!", + level: LogLevel.Warning, + ); return; } Logging.instance @@ -61,8 +63,9 @@ class AutoSWBService extends ChangeNotifier { final autoBackupDirectoryPath = Prefs.instance.autoBackupLocation; if (autoBackupDirectoryPath == null) { Logging.instance.log( - "AutoSWBService attempted to run doBackup() when no auto backup directory was set!", - level: LogLevel.Error); + "AutoSWBService attempted to run doBackup() when no auto backup directory was set!", + level: LogLevel.Error, + ); // set error backup status and notify listeners _status = AutoSWBStatus.error; notifyListeners(); @@ -70,7 +73,8 @@ class AutoSWBService extends ChangeNotifier { } final json = await SWB.createStackWalletJSON( - secureStorage: secureStorageInterface); + secureStorage: secureStorageInterface, + ); final jsonString = jsonEncode(json); final adkString = @@ -85,7 +89,11 @@ class AutoSWBService extends ChangeNotifier { createAutoBackupFilename(autoBackupDirectoryPath, now); final result = await SWB.encryptStackWalletWithADK( - fileToSave, adkString!, jsonString, adkVersion); + fileToSave, + adkString!, + jsonString, + adkVersion, + ); if (!result) { throw Exception("stack auto backup service failed to create a backup"); @@ -99,7 +107,7 @@ class AutoSWBService extends ChangeNotifier { Logging.instance .log("AutoSWBService.doBackup() succeeded", level: LogLevel.Info); } on Exception catch (e, s) { - String err = getErrorMessageFromSWBException(e); + final String err = getErrorMessageFromSWBException(e); Logging.instance.log("$err\n$s", level: LogLevel.Error); // set error backup status and notify listeners _status = AutoSWBStatus.error; @@ -124,13 +132,13 @@ class AutoSWBService extends ChangeNotifier { final List> files = []; for (final file in dir.listSync()) { - String fileName = file.uri.pathSegments.last; + final String fileName = file.uri.pathSegments.last; // check that its a swb auto backup file if (fileName.startsWith("stackautobackup_") && fileName.endsWith(".swb")) { // get date from filename - int a = fileName.indexOf("_") + 1; - int b = fileName.indexOf(".swb"); + final int a = fileName.indexOf("_") + 1; + final int b = fileName.indexOf(".swb"); final dateString = fileName.substring(a, b); // split date components @@ -148,8 +156,9 @@ class AutoSWBService extends ChangeNotifier { } // sort from newest to oldest - files.sort((a, b) => - b.item1.millisecondsSinceEpoch - a.item1.millisecondsSinceEpoch); + files.sort( + (a, b) => b.item1.millisecondsSinceEpoch - a.item1.millisecondsSinceEpoch, + ); // delete any older backups if there are more than the number we want to keep while (files.length > numberToKeep) { diff --git a/lib/services/coins/bitcoincash/cashtokens.dart b/lib/services/coins/bitcoincash/cashtokens.dart index d35d2838c..d9da0ed01 100644 --- a/lib/services/coins/bitcoincash/cashtokens.dart +++ b/lib/services/coins/bitcoincash/cashtokens.dart @@ -99,7 +99,7 @@ class TokenOutputData { return false; } - int s = bitfield![0] & 0xf0; + final int s = bitfield![0] & 0xf0; if (s >= 0x80 || s == 0x00) { return false; } @@ -122,43 +122,43 @@ class TokenOutputData { // and pack outputs. These are called by the wrap and unwrap functions. int deserialize(Uint8List buffer, {int cursor = 0, bool strict = false}) { try { - this.id = buffer.sublist(cursor, cursor + 32); + id = buffer.sublist(cursor, cursor + 32); cursor += 32; - this.bitfield = Uint8List.fromList([buffer[cursor]]); + bitfield = Uint8List.fromList([buffer[cursor]]); cursor += 1; - if (this.hasCommitmentLength()) { + if (hasCommitmentLength()) { // Read the first byte to determine the length of the commitment data - int commitmentLength = buffer[cursor]; + final int commitmentLength = buffer[cursor]; // Move cursor to the next byte cursor += 1; // Read 'commitmentLength' bytes for the commitment data - this.commitment = buffer.sublist(cursor, cursor + commitmentLength); + commitment = buffer.sublist(cursor, cursor + commitmentLength); // Adjust the cursor by the length of the commitment data cursor += commitmentLength; } else { - this.commitment = null; + commitment = null; } - if (this.hasAmount()) { + if (hasAmount()) { // Use readCompactSize that returns CompactSizeResult - CompactSizeResult result = + final CompactSizeResult result = readCompactSize(buffer, cursor, strict: strict); - this.amount = result.amount; + amount = result.amount; cursor += result.bytesRead; } else { - this.amount = 0; + amount = 0; } - if (!this.isValidBitfield() || - (this.hasAmount() && this.amount == 0) || - (this.amount! < 0 || this.amount! > (1 << 63) - 1) || - (this.hasCommitmentLength() && this.commitment!.isEmpty) || - (this.amount! == 0 && !this.hasNFT())) { + if (!isValidBitfield() || + (hasAmount() && amount == 0) || + (amount! < 0 || amount! > (1 << 63) - 1) || + (hasCommitmentLength() && commitment!.isEmpty) || + (amount! == 0 && !hasNFT())) { throw Exception('Unable to parse token data or token data is invalid'); } @@ -170,19 +170,19 @@ class TokenOutputData { // Serialize method Uint8List serialize() { - var buffer = BytesBuilder(); + final buffer = BytesBuilder(); // write ID and bitfield - buffer.add(this.id!); - buffer.addByte(this.bitfield![0]); + buffer.add(id!); + buffer.addByte(bitfield![0]); // Write optional fields - if (this.hasCommitmentLength()) { - buffer.add(this.commitment!); + if (hasCommitmentLength()) { + buffer.add(commitment!); } - if (this.hasAmount()) { - List compactSizeBytes = writeCompactSize(this.amount!); + if (hasAmount()) { + final List compactSizeBytes = writeCompactSize(amount!); buffer.add(compactSizeBytes); } @@ -195,7 +195,7 @@ final List PREFIX_BYTE = [0xef]; // This function wraps a "normal" output together with token data. ParsedOutput wrap_spk(TokenOutputData? token_data, Uint8List script_pub_key) { - ParsedOutput parsedOutput = ParsedOutput(); + final ParsedOutput parsedOutput = ParsedOutput(); if (token_data == null) { parsedOutput.script_pub_key = script_pub_key; @@ -220,7 +220,7 @@ ParsedOutput wrap_spk(TokenOutputData? token_data, Uint8List script_pub_key) { // Note that the data returend in both cases in of ParsedOutput type, which // holds both the script pub key and token data. ParsedOutput unwrap_spk(Uint8List wrapped_spk) { - ParsedOutput parsedOutput = ParsedOutput(); + final ParsedOutput parsedOutput = ParsedOutput(); if (wrapped_spk.isEmpty || wrapped_spk[0] != PREFIX_BYTE[0]) { parsedOutput.script_pub_key = wrapped_spk; @@ -228,14 +228,15 @@ ParsedOutput unwrap_spk(Uint8List wrapped_spk) { } int read_cursor = 1; // Start after the PREFIX_BYTE - TokenOutputData token_data = TokenOutputData(); + final TokenOutputData token_data = TokenOutputData(); Uint8List wrapped_spk_without_prefix_byte; try { // Deserialize updates read_cursor by the number of bytes read wrapped_spk_without_prefix_byte = wrapped_spk.sublist(read_cursor); - int bytesRead = token_data.deserialize(wrapped_spk_without_prefix_byte); + final int bytesRead = + token_data.deserialize(wrapped_spk_without_prefix_byte); read_cursor += bytesRead; parsedOutput.token_data = token_data; @@ -294,7 +295,7 @@ CompactSizeResult readCompactSize( } Uint8List writeCompactSize(int size) { - var buffer = ByteData(9); // Maximum needed size for compact size is 9 bytes + final buffer = ByteData(9); // Maximum needed size for compact size is 9 bytes if (size < 0) { throw Exception("attempt to write size < 0"); } else if (size < 253) { diff --git a/lib/services/coins/tezos/api/tezos_api.dart b/lib/services/coins/tezos/api/tezos_api.dart index bf102ef34..e646019ee 100644 --- a/lib/services/coins/tezos/api/tezos_api.dart +++ b/lib/services/coins/tezos/api/tezos_api.dart @@ -1,11 +1,11 @@ import 'dart:convert'; import '../../../../networking/http.dart'; -import 'tezos_account.dart'; -import 'tezos_transaction.dart'; -import '../../../tor_service.dart'; import '../../../../utilities/logger.dart'; import '../../../../utilities/prefs.dart'; +import '../../../tor_service.dart'; +import 'tezos_account.dart'; +import 'tezos_transaction.dart'; abstract final class TezosAPI { static final HTTP _client = HTTP(); @@ -33,8 +33,10 @@ abstract final class TezosAPI { } } - static Future getAccount(String address, - {String type = "user"}) async { + static Future getAccount( + String address, { + String type = "user", + }) async { try { final uriString = "$_baseURL/v1/accounts/$address?legacy=false"; final response = await _client.get( @@ -74,8 +76,8 @@ abstract final class TezosAPI { final result = jsonDecode(response.body) as List; - List txs = []; - for (var tx in result) { + final List txs = []; + for (final tx in result) { if (tx["type"] == "transaction") { final theTx = TezosTransaction( id: tx["id"] as int, diff --git a/lib/services/coins/tezos/api/tezos_rpc_api.dart b/lib/services/coins/tezos/api/tezos_rpc_api.dart index fe6f1ddea..59ca98045 100644 --- a/lib/services/coins/tezos/api/tezos_rpc_api.dart +++ b/lib/services/coins/tezos/api/tezos_rpc_api.dart @@ -13,7 +13,7 @@ abstract final class TezosRpcAPI { required String address, }) async { try { - String balanceCall = + final String balanceCall = "${nodeInfo.host}:${nodeInfo.port}/chains/main/blocks/head/context/contracts/$address/balance"; final response = await _client.get( diff --git a/lib/services/coins/tezos/api/tezos_transaction.dart b/lib/services/coins/tezos/api/tezos_transaction.dart index 3ffcd4adf..e1e6bc88b 100644 --- a/lib/services/coins/tezos/api/tezos_transaction.dart +++ b/lib/services/coins/tezos/api/tezos_transaction.dart @@ -40,4 +40,4 @@ class TezosTransaction { required this.senderAddress, required this.receiverAddress, }); -} \ No newline at end of file +} diff --git a/lib/services/debug_service.dart b/lib/services/debug_service.dart index a8d7dd963..189c4f19f 100644 --- a/lib/services/debug_service.dart +++ b/lib/services/debug_service.dart @@ -14,6 +14,7 @@ import 'dart:io'; import 'package:event_bus/event_bus.dart'; import 'package:flutter/material.dart'; import 'package:isar/isar.dart'; + import '../models/isar/models/log.dart'; import '../utilities/logger.dart'; @@ -44,7 +45,11 @@ class DebugService extends ChangeNotifier { // }); } - List get recentLogs => isar.logs.where().sortByTimestampInMillisUTCDesc().limit(100).findAllSync(); + List get recentLogs => isar.logs + .where() + .sortByTimestampInMillisUTCDesc() + .limit(100) + .findAllSync(); // Future updateRecentLogs() async { // int totalCount = await isar.logs.count(); @@ -95,7 +100,7 @@ class DebugService extends ChangeNotifier { final filename = "Stack_Wallet_logs_${now.year}_${now.month}_${now.day}_${now.hour}_${now.minute}_${now.second}.txt"; final filepath = "$directory/$filename"; - File file = await File(filepath).create(); + final File file = await File(filepath).create(); final sink = file.openWrite(); final logs = await isar.logs.where().anyTimestampInMillisUTC().findAll(); diff --git a/lib/services/ethereum/ethereum_api.dart b/lib/services/ethereum/ethereum_api.dart index d2ead5aeb..faacec22e 100644 --- a/lib/services/ethereum/ethereum_api.dart +++ b/lib/services/ethereum/ethereum_api.dart @@ -11,6 +11,8 @@ import 'dart:convert'; import 'package:http/http.dart'; +import 'package:tuple/tuple.dart'; + import '../../dto/ethereum/eth_token_tx_dto.dart'; import '../../dto/ethereum/eth_token_tx_extra_dto.dart'; import '../../dto/ethereum/eth_tx_dto.dart'; @@ -18,15 +20,13 @@ import '../../dto/ethereum/pending_eth_tx_dto.dart'; import '../../models/isar/models/ethereum/eth_contract.dart'; import '../../models/paymint/fee_object_model.dart'; import '../../networking/http.dart'; -import '../tor_service.dart'; import '../../utilities/amount/amount.dart'; import '../../utilities/eth_commons.dart'; import '../../utilities/extensions/extensions.dart'; import '../../utilities/logger.dart'; import '../../utilities/prefs.dart'; -import '../../wallets/crypto_currency/coins/ethereum.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; -import 'package:tuple/tuple.dart'; +import '../tor_service.dart'; class EthApiException implements Exception { EthApiException(this.message); @@ -117,7 +117,8 @@ abstract class EthereumAPI { } static Future> getEthTransactionByHash( - String txid) async { + String txid, + ) async { try { final response = await post( Uri.parse( @@ -600,16 +601,18 @@ abstract class EthereumAPI { final feesSlow = fees.slow.shift(9).toBigInt(); return FeeObject( - numberOfBlocksFast: fees.numberOfBlocksFast, - numberOfBlocksAverage: fees.numberOfBlocksAverage, - numberOfBlocksSlow: fees.numberOfBlocksSlow, - fast: feesFast.toInt(), - medium: feesStandard.toInt(), - slow: feesSlow.toInt()); + numberOfBlocksFast: fees.numberOfBlocksFast, + numberOfBlocksAverage: fees.numberOfBlocksAverage, + numberOfBlocksSlow: fees.numberOfBlocksSlow, + fast: feesFast.toInt(), + medium: feesStandard.toInt(), + slow: feesSlow.toInt(), + ); } static Future> getTokenContractInfoByAddress( - String contractAddress) async { + String contractAddress, + ) async { try { final response = await client.get( url: Uri.parse( @@ -648,7 +651,8 @@ abstract class EthereumAPI { ); } else { throw EthApiException( - "Unsupported token type found: ${map["type"]}"); + "Unsupported token type found: ${map["type"]}", + ); } return EthereumResponse( @@ -732,7 +736,8 @@ abstract class EthereumAPI { try { final response = await client.get( url: Uri.parse( - "$stackBaseServer/state?addrs=$contractAddress&parts=proxy"), + "$stackBaseServer/state?addrs=$contractAddress&parts=proxy", + ), proxyInfo: Prefs.instance.useTor ? TorService.sharedInstance.getProxyInfo() : null, diff --git a/lib/services/event_bus/events/global/blocks_remaining_event.dart b/lib/services/event_bus/events/global/blocks_remaining_event.dart index 9a9c71c81..008d39440 100644 --- a/lib/services/event_bus/events/global/blocks_remaining_event.dart +++ b/lib/services/event_bus/events/global/blocks_remaining_event.dart @@ -16,7 +16,8 @@ class BlocksRemainingEvent { BlocksRemainingEvent(this.blocksRemaining, this.walletId) { Logging.instance.log( - "RefreshPercentChangedEvent fired on $walletId with blocks remaining = $blocksRemaining", - level: LogLevel.Info); + "RefreshPercentChangedEvent fired on $walletId with blocks remaining = $blocksRemaining", + level: LogLevel.Info, + ); } } diff --git a/lib/services/event_bus/events/global/refresh_percent_changed_event.dart b/lib/services/event_bus/events/global/refresh_percent_changed_event.dart index bbe9027b1..7429b828e 100644 --- a/lib/services/event_bus/events/global/refresh_percent_changed_event.dart +++ b/lib/services/event_bus/events/global/refresh_percent_changed_event.dart @@ -16,7 +16,8 @@ class RefreshPercentChangedEvent { RefreshPercentChangedEvent(this.percent, this.walletId) { Logging.instance.log( - "RefreshPercentChangedEvent fired on $walletId with percent (range of 0.0-1.0)= $percent", - level: LogLevel.Info); + "RefreshPercentChangedEvent fired on $walletId with percent (range of 0.0-1.0)= $percent", + level: LogLevel.Info, + ); } } diff --git a/lib/services/event_bus/events/global/tor_connection_status_changed_event.dart b/lib/services/event_bus/events/global/tor_connection_status_changed_event.dart index 640bdc1fb..9087d37e2 100644 --- a/lib/services/event_bus/events/global/tor_connection_status_changed_event.dart +++ b/lib/services/event_bus/events/global/tor_connection_status_changed_event.dart @@ -17,7 +17,8 @@ class TorConnectionStatusChangedEvent { TorConnectionStatusChangedEvent(this.newStatus, this.message) { Logging.instance.log( - "TorSyncStatusChangedEvent fired with arg newStatus = $newStatus ($message)", - level: LogLevel.Info); + "TorSyncStatusChangedEvent fired with arg newStatus = $newStatus ($message)", + level: LogLevel.Info, + ); } } diff --git a/lib/services/event_bus/events/global/updated_in_background_event.dart b/lib/services/event_bus/events/global/updated_in_background_event.dart index c492a837f..582978357 100644 --- a/lib/services/event_bus/events/global/updated_in_background_event.dart +++ b/lib/services/event_bus/events/global/updated_in_background_event.dart @@ -16,7 +16,8 @@ class UpdatedInBackgroundEvent { UpdatedInBackgroundEvent(this.message, this.walletId) { Logging.instance.log( - "UpdatedInBackgroundEvent fired with message: $message", - level: LogLevel.Info); + "UpdatedInBackgroundEvent fired with message: $message", + level: LogLevel.Info, + ); } } diff --git a/lib/services/exchange/change_now/change_now_api.dart b/lib/services/exchange/change_now/change_now_api.dart index 4ee3e5502..2882f9d4d 100644 --- a/lib/services/exchange/change_now/change_now_api.dart +++ b/lib/services/exchange/change_now/change_now_api.dart @@ -12,6 +12,8 @@ import 'dart:convert'; import 'package:decimal/decimal.dart'; import 'package:flutter/foundation.dart'; +import 'package:tuple/tuple.dart'; + import '../../../exceptions/exchange/exchange_exception.dart'; import '../../../exceptions/exchange/pair_unavailable_exception.dart'; import '../../../exceptions/exchange/unsupported_currency_exception.dart'; @@ -26,12 +28,11 @@ import '../../../models/exchange/response_objects/range.dart'; import '../../../models/isar/exchange_cache/currency.dart'; import '../../../models/isar/exchange_cache/pair.dart'; import '../../../networking/http.dart'; -import 'change_now_exchange.dart'; -import '../exchange_response.dart'; -import '../../tor_service.dart'; import '../../../utilities/logger.dart'; import '../../../utilities/prefs.dart'; -import 'package:tuple/tuple.dart'; +import '../../tor_service.dart'; +import '../exchange_response.dart'; +import 'change_now_exchange.dart'; class ChangeNowAPI { static const String scheme = "https"; @@ -172,8 +173,10 @@ class ChangeNowAPI { ); return result; } catch (e, s) { - Logging.instance.log("getAvailableCurrencies exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getAvailableCurrencies exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( "Error: $jsonArray", @@ -182,8 +185,10 @@ class ChangeNowAPI { ); } } catch (e, s) { - Logging.instance.log("getAvailableCurrencies exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getAvailableCurrencies exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -197,7 +202,7 @@ class ChangeNowAPI { Tuple2, bool> args, ) { try { - List currencies = []; + final List currencies = []; for (final json in args.item1) { try { @@ -213,8 +218,11 @@ class ChangeNowAPI { ); } catch (_) { return ExchangeResponse( - exception: ExchangeException("Failed to serialize $json", - ExchangeExceptionType.serializeResponseError)); + exception: ExchangeException( + "Failed to serialize $json", + ExchangeExceptionType.serializeResponseError, + ), + ); } } @@ -255,8 +263,10 @@ class ChangeNowAPI { ); return result; } catch (e, s) { - Logging.instance.log("getAvailableCurrencies exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getAvailableCurrencies exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( "Error: $jsonArray", @@ -265,8 +275,10 @@ class ChangeNowAPI { ); } } catch (e, s) { - Logging.instance.log("getAvailableCurrencies exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getAvailableCurrencies exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -280,7 +292,7 @@ class ChangeNowAPI { List args, ) { try { - List currencies = []; + final List currencies = []; for (final json in args) { try { @@ -296,8 +308,11 @@ class ChangeNowAPI { ); } catch (_) { return ExchangeResponse( - exception: ExchangeException("Failed to serialize $json", - ExchangeExceptionType.serializeResponseError)); + exception: ExchangeException( + "Failed to serialize $json", + ExchangeExceptionType.serializeResponseError, + ), + ); } } @@ -342,7 +357,7 @@ class ChangeNowAPI { final jsonArray = response as List; - List currencies = []; + final List currencies = []; try { for (final json in jsonArray) { try { @@ -366,11 +381,16 @@ class ChangeNowAPI { } } } catch (e, s) { - Logging.instance.log("getPairedCurrencies exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getPairedCurrencies exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( - exception: ExchangeException("Error: $jsonArray", - ExchangeExceptionType.serializeResponseError)); + exception: ExchangeException( + "Error: $jsonArray", + ExchangeExceptionType.serializeResponseError, + ), + ); } return ExchangeResponse(value: currencies); } catch (e, s) { @@ -393,7 +413,9 @@ class ChangeNowAPI { required String toTicker, String? apiKey, }) async { - Map? params = {"api_key": apiKey ?? kChangeNowApiKey}; + final Map params = { + "api_key": apiKey ?? kChangeNowApiKey, + }; final uri = _buildUri("/min-amount/${fromTicker}_$toTicker", params); @@ -413,8 +435,10 @@ class ChangeNowAPI { ); } } catch (e, s) { - Logging.instance.log("getMinimalExchangeAmount exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getMinimalExchangeAmount exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -434,11 +458,14 @@ class ChangeNowAPI { required bool isFixedRate, String? apiKey, }) async { - Map? params = {"api_key": apiKey ?? kChangeNowApiKey}; + final Map params = { + "api_key": apiKey ?? kChangeNowApiKey, + }; final uri = _buildUri( - "/exchange-range${isFixedRate ? "/fixed-rate" : ""}/${fromTicker}_$toTicker", - params); + "/exchange-range${isFixedRate ? "/fixed-rate" : ""}/${fromTicker}_$toTicker", + params, + ); try { final jsonObject = await _makeGetRequest(uri); @@ -472,7 +499,7 @@ class ChangeNowAPI { required Decimal fromAmount, String? apiKey, }) async { - Map params = {"api_key": apiKey ?? kChangeNowApiKey}; + final Map params = {"api_key": apiKey ?? kChangeNowApiKey}; final uri = _buildUri( "/exchange-amount/${fromAmount.toString()}/${fromTicker}_$toTicker", @@ -524,8 +551,10 @@ class ChangeNowAPI { ); } } catch (e, s) { - Logging.instance.log("getEstimatedExchangeAmount exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getEstimatedExchangeAmount exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -545,7 +574,7 @@ class ChangeNowAPI { bool useRateId = true, String? apiKey, }) async { - Map params = { + final Map params = { "api_key": apiKey ?? kChangeNowApiKey, "useRateId": useRateId.toString(), }; @@ -608,8 +637,10 @@ class ChangeNowAPI { ); } } catch (e, s) { - Logging.instance.log("getEstimatedExchangeAmount exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getEstimatedExchangeAmount exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -685,7 +716,7 @@ class ChangeNowAPI { CNFlowType flow = CNFlowType.standard, String? apiKey, }) async { - Map? params = { + final Map params = { "fromCurrency": fromTicker, "toCurrency": toTicker, "flow": flow.value, @@ -732,8 +763,10 @@ class ChangeNowAPI { ); } } catch (e, s) { - Logging.instance.log("getEstimatedExchangeAmountV2 exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getEstimatedExchangeAmountV2 exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -751,7 +784,9 @@ class ChangeNowAPI { String? apiKey, }) async { final uri = _buildUri( - "/market-info/fixed-rate/${apiKey ?? kChangeNowApiKey}", null); + "/market-info/fixed-rate/${apiKey ?? kChangeNowApiKey}", + null, + ); try { // json array is expected here @@ -762,8 +797,10 @@ class ChangeNowAPI { await compute(_parseFixedRateMarketsJson, jsonArray as List); return result; } catch (e, s) { - Logging.instance.log("getAvailableFixedRateMarkets exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getAvailableFixedRateMarkets exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( "Error: $jsonArray", @@ -772,8 +809,10 @@ class ChangeNowAPI { ); } } catch (e, s) { - Logging.instance.log("getAvailableFixedRateMarkets exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getAvailableFixedRateMarkets exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -784,17 +823,22 @@ class ChangeNowAPI { } ExchangeResponse> _parseFixedRateMarketsJson( - List jsonArray) { + List jsonArray, + ) { try { - List markets = []; + final List markets = []; for (final json in jsonArray) { try { markets.add( - FixedRateMarket.fromMap(Map.from(json as Map))); + FixedRateMarket.fromMap(Map.from(json as Map)), + ); } catch (_) { return ExchangeResponse( - exception: ExchangeException("Failed to serialize $json", - ExchangeExceptionType.serializeResponseError)); + exception: ExchangeException( + "Failed to serialize $json", + ExchangeExceptionType.serializeResponseError, + ), + ); } } return ExchangeResponse(value: markets); @@ -842,7 +886,8 @@ class ChangeNowAPI { try { final value = ExchangeTransaction.fromJson( - Map.from(json as Map)); + Map.from(json as Map), + ); return ExchangeResponse(value: value); } catch (_) { return ExchangeResponse( @@ -854,8 +899,9 @@ class ChangeNowAPI { } } catch (e, s) { Logging.instance.log( - "createStandardExchangeTransaction exception: $e\n$s", - level: LogLevel.Error); + "createStandardExchangeTransaction exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -915,7 +961,8 @@ class ChangeNowAPI { try { final value = ExchangeTransaction.fromJson( - Map.from(json as Map)); + Map.from(json as Map), + ); return ExchangeResponse(value: value); } catch (_) { return ExchangeResponse( @@ -927,8 +974,9 @@ class ChangeNowAPI { } } catch (e, s) { Logging.instance.log( - "createFixedRateExchangeTransaction exception: $e\n$s", - level: LogLevel.Error); + "createFixedRateExchangeTransaction exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -951,7 +999,8 @@ class ChangeNowAPI { try { final value = ExchangeTransactionStatus.fromJson( - Map.from(json as Map)); + Map.from(json as Map), + ); return ExchangeResponse(value: value); } catch (_) { return ExchangeResponse( @@ -976,8 +1025,10 @@ class ChangeNowAPI { Future>> getAvailableFloatingRatePairs({ bool includePartners = false, }) async { - final uri = _buildUri("/market-info/available-pairs", - {"includePartners": includePartners.toString()}); + final uri = _buildUri( + "/market-info/available-pairs", + {"includePartners": includePartners.toString()}, + ); try { // json array is expected here @@ -985,11 +1036,15 @@ class ChangeNowAPI { try { final result = await compute( - _parseAvailableFloatingRatePairsJson, jsonArray as List); + _parseAvailableFloatingRatePairsJson, + jsonArray as List, + ); return result; } catch (e, s) { - Logging.instance.log("getAvailableFloatingRatePairs exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getAvailableFloatingRatePairs exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( "Error: $jsonArray", @@ -998,8 +1053,10 @@ class ChangeNowAPI { ); } } catch (e, s) { - Logging.instance.log("getAvailableFloatingRatePairs exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getAvailableFloatingRatePairs exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -1010,9 +1067,10 @@ class ChangeNowAPI { } ExchangeResponse> _parseAvailableFloatingRatePairsJson( - List jsonArray) { + List jsonArray, + ) { try { - List pairs = []; + final List pairs = []; for (final json in jsonArray) { try { final List stringPair = (json as String).split("_"); @@ -1026,8 +1084,11 @@ class ChangeNowAPI { ); } catch (_) { return ExchangeResponse( - exception: ExchangeException("Failed to serialize $json", - ExchangeExceptionType.serializeResponseError)); + exception: ExchangeException( + "Failed to serialize $json", + ExchangeExceptionType.serializeResponseError, + ), + ); } } return ExchangeResponse(value: pairs); diff --git a/lib/services/exchange/exchange_data_loading_service.dart b/lib/services/exchange/exchange_data_loading_service.dart index 40d1e16bf..e500ed5cf 100644 --- a/lib/services/exchange/exchange_data_loading_service.dart +++ b/lib/services/exchange/exchange_data_loading_service.dart @@ -10,19 +10,20 @@ import 'package:flutter/foundation.dart'; import 'package:isar/isar.dart'; +import 'package:tuple/tuple.dart'; + import '../../db/hive/db.dart'; import '../../models/exchange/active_pair.dart'; import '../../models/exchange/aggregate_currency.dart'; import '../../models/isar/exchange_cache/currency.dart'; import '../../models/isar/exchange_cache/pair.dart'; -import 'change_now/change_now_exchange.dart'; -import 'majestic_bank/majestic_bank_exchange.dart'; -import 'trocador/trocador_exchange.dart'; import '../../utilities/enums/exchange_rate_type_enum.dart'; import '../../utilities/logger.dart'; import '../../utilities/prefs.dart'; import '../../utilities/stack_file_system.dart'; -import 'package:tuple/tuple.dart'; +import 'change_now/change_now_exchange.dart'; +import 'majestic_bank/majestic_bank_exchange.dart'; +import 'trocador/trocador_exchange.dart'; class ExchangeDataLoadingService { ExchangeDataLoadingService._(); @@ -40,8 +41,9 @@ class ExchangeDataLoadingService { static int get currentCacheVersion => DB.instance.get( - boxName: DB.boxNameDBInfo, - key: "exchange_data_cache_version") as int? ?? + boxName: DB.boxNameDBInfo, + key: "exchange_data_cache_version", + ) as int? ?? 0; Future _updateCurrentCacheVersion(int version) async { @@ -102,15 +104,17 @@ class ExchangeDataLoadingService { ) async { final currencies = await ExchangeDataLoadingService.instance.isar.currencies .filter() - .group((q) => rateType == ExchangeRateType.fixed - ? q - .rateTypeEqualTo(SupportedRateType.both) - .or() - .rateTypeEqualTo(SupportedRateType.fixed) - : q - .rateTypeEqualTo(SupportedRateType.both) - .or() - .rateTypeEqualTo(SupportedRateType.estimated)) + .group( + (q) => rateType == ExchangeRateType.fixed + ? q + .rateTypeEqualTo(SupportedRateType.both) + .or() + .rateTypeEqualTo(SupportedRateType.fixed) + : q + .rateTypeEqualTo(SupportedRateType.both) + .or() + .rateTypeEqualTo(SupportedRateType.estimated), + ) .and() .tickerEqualTo( ticker, @@ -213,8 +217,9 @@ class ExchangeDataLoadingService { }); } else { Logging.instance.log( - "Failed to load changeNOW currencies: ${responseCurrencies.exception?.message}", - level: LogLevel.Error); + "Failed to load changeNOW currencies: ${responseCurrencies.exception?.message}", + level: LogLevel.Error, + ); return; } } diff --git a/lib/services/exchange/majestic_bank/majestic_bank_api.dart b/lib/services/exchange/majestic_bank/majestic_bank_api.dart index c69d6ebe7..0dc46343b 100644 --- a/lib/services/exchange/majestic_bank/majestic_bank_api.dart +++ b/lib/services/exchange/majestic_bank/majestic_bank_api.dart @@ -227,8 +227,9 @@ class MajesticBankAPI { return ExchangeResponse(value: result); } catch (e, s) { Logging.instance.log( - "calculateOrder $fromCurrency-$receiveCurrency exception: $e\n$s", - level: LogLevel.Error); + "calculateOrder $fromCurrency-$receiveCurrency exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -342,9 +343,12 @@ class MajesticBankAPI { Future> trackOrder({ required String orderId, }) async { - final uri = _buildUri(endpoint: "track", params: { - "trx": orderId, - }); + final uri = _buildUri( + endpoint: "track", + params: { + "trx": orderId, + }, + ); try { final jsonObject = await _makeGetRequest(uri); diff --git a/lib/services/exchange/majestic_bank/majestic_bank_exchange.dart b/lib/services/exchange/majestic_bank/majestic_bank_exchange.dart index 351608759..e23490e0a 100644 --- a/lib/services/exchange/majestic_bank/majestic_bank_exchange.dart +++ b/lib/services/exchange/majestic_bank/majestic_bank_exchange.dart @@ -153,7 +153,9 @@ class MajesticBankExchange extends Exchange { @override Future>> getPairedCurrencies( - String forCurrency, bool fixedRate) { + String forCurrency, + bool fixedRate, + ) { // TODO: change this if the api changes to allow getting by paired currency return getAllCurrencies(fixedRate); } diff --git a/lib/services/exchange/simpleswap/simpleswap_api.dart b/lib/services/exchange/simpleswap/simpleswap_api.dart index 509977bb1..0653ff7c6 100644 --- a/lib/services/exchange/simpleswap/simpleswap_api.dart +++ b/lib/services/exchange/simpleswap/simpleswap_api.dart @@ -12,6 +12,9 @@ import 'dart:convert'; import 'package:decimal/decimal.dart'; import 'package:flutter/foundation.dart'; +import 'package:tuple/tuple.dart'; +import 'package:uuid/uuid.dart'; + import '../../../exceptions/exchange/exchange_exception.dart'; import '../../../external_api_keys.dart'; import '../../../models/exchange/response_objects/fixed_rate_market.dart'; @@ -20,13 +23,11 @@ import '../../../models/exchange/response_objects/trade.dart'; import '../../../models/exchange/simpleswap/sp_currency.dart'; import '../../../models/isar/exchange_cache/pair.dart'; import '../../../networking/http.dart'; -import '../exchange_response.dart'; -import 'simpleswap_exchange.dart'; -import '../../tor_service.dart'; import '../../../utilities/logger.dart'; import '../../../utilities/prefs.dart'; -import 'package:tuple/tuple.dart'; -import 'package:uuid/uuid.dart'; +import '../../tor_service.dart'; +import '../exchange_response.dart'; +import 'simpleswap_exchange.dart'; class SimpleSwapAPI { static const String scheme = "https"; @@ -104,7 +105,7 @@ class SimpleSwapAPI { String? extraIdTo, String? apiKey, }) async { - Map body = { + final Map body = { "fixed": isFixedRate, "currency_from": currencyFrom, "currency_to": currencyTo, @@ -148,8 +149,10 @@ class SimpleSwapAPI { ); return ExchangeResponse(value: trade, exception: null); } catch (e, s) { - Logging.instance.log("getAvailableCurrencies exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getAvailableCurrencies exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -165,15 +168,19 @@ class SimpleSwapAPI { required bool fixedRate, }) async { final uri = _buildUri( - "/get_all_currencies", {"api_key": apiKey ?? kSimpleSwapApiKey}); + "/get_all_currencies", + {"api_key": apiKey ?? kSimpleSwapApiKey}, + ); try { final jsonArray = await _makeGetRequest(uri); return await compute(_parseAvailableCurrenciesJson, jsonArray as List); } catch (e, s) { - Logging.instance.log("getAvailableCurrencies exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getAvailableCurrencies exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -184,9 +191,10 @@ class SimpleSwapAPI { } ExchangeResponse> _parseAvailableCurrenciesJson( - List jsonArray) { + List jsonArray, + ) { try { - List currencies = []; + final List currencies = []; for (final json in jsonArray) { try { @@ -194,15 +202,20 @@ class SimpleSwapAPI { .add(SPCurrency.fromJson(Map.from(json as Map))); } catch (_) { return ExchangeResponse( - exception: ExchangeException("Failed to serialize $json", - ExchangeExceptionType.serializeResponseError)); + exception: ExchangeException( + "Failed to serialize $json", + ExchangeExceptionType.serializeResponseError, + ), + ); } } return ExchangeResponse(value: currencies); } catch (e, s) { - Logging.instance.log("_parseAvailableCurrenciesJson exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "_parseAvailableCurrenciesJson exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -228,8 +241,10 @@ class SimpleSwapAPI { final jsonObject = await _makeGetRequest(uri); return ExchangeResponse( - value: SPCurrency.fromJson( - Map.from(jsonObject as Map))); + value: SPCurrency.fromJson( + Map.from(jsonObject as Map), + ), + ); } catch (e, s) { Logging.instance .log("getCurrency exception: $e\n$s", level: LogLevel.Error); @@ -279,7 +294,7 @@ class SimpleSwapAPI { Tuple2, bool> args, ) { try { - List pairs = []; + final List pairs = []; for (final entry in args.item1.entries) { try { @@ -296,15 +311,20 @@ class SimpleSwapAPI { } } catch (_) { return ExchangeResponse( - exception: ExchangeException("Failed to serialize $json", - ExchangeExceptionType.serializeResponseError)); + exception: ExchangeException( + "Failed to serialize $json", + ExchangeExceptionType.serializeResponseError, + ), + ); } } return ExchangeResponse(value: pairs); } catch (e, s) { - Logging.instance.log("_parseAvailableCurrenciesJson exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "_parseAvailableCurrenciesJson exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -468,8 +488,10 @@ class SimpleSwapAPI { ); return result; } catch (e, s) { - Logging.instance.log("getAvailableFixedRateMarkets exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getAvailableFixedRateMarkets exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( "Error: $jsonArray", @@ -478,8 +500,10 @@ class SimpleSwapAPI { ); } } catch (e, s) { - Logging.instance.log("getAvailableFixedRateMarkets exception: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "getAvailableFixedRateMarkets exception: $e\n$s", + level: LogLevel.Error, + ); return ExchangeResponse( exception: ExchangeException( e.toString(), @@ -490,24 +514,30 @@ class SimpleSwapAPI { } ExchangeResponse> _parseFixedRateMarketsJson( - List jsonArray) { + List jsonArray, + ) { try { final List markets = []; for (final json in jsonArray) { try { final map = Map.from(json as Map); - markets.add(FixedRateMarket( - from: map["currency_from"] as String, - to: map["currency_to"] as String, - min: Decimal.parse(map["min"] as String), - max: Decimal.parse(map["max"] as String), - rate: Decimal.parse(map["rate"] as String), - minerFee: null, - )); + markets.add( + FixedRateMarket( + from: map["currency_from"] as String, + to: map["currency_to"] as String, + min: Decimal.parse(map["min"] as String), + max: Decimal.parse(map["max"] as String), + rate: Decimal.parse(map["rate"] as String), + minerFee: null, + ), + ); } catch (_) { return ExchangeResponse( - exception: ExchangeException("Failed to serialize $json", - ExchangeExceptionType.serializeResponseError)); + exception: ExchangeException( + "Failed to serialize $json", + ExchangeExceptionType.serializeResponseError, + ), + ); } } return ExchangeResponse(value: markets); diff --git a/lib/services/exchange/simpleswap/simpleswap_exchange.dart b/lib/services/exchange/simpleswap/simpleswap_exchange.dart index 13d8029d5..dae14cbf7 100644 --- a/lib/services/exchange/simpleswap/simpleswap_exchange.dart +++ b/lib/services/exchange/simpleswap/simpleswap_exchange.dart @@ -175,7 +175,9 @@ class SimpleSwapExchange extends Exchange { @override Future>> getPairedCurrencies( - String forCurrency, bool fixedRate) { + String forCurrency, + bool fixedRate, + ) { // TODO: implement getPairedCurrencies throw UnimplementedError(); } diff --git a/lib/services/litescribe_api.dart b/lib/services/litescribe_api.dart index a4d9a8a42..9a41f4f2b 100644 --- a/lib/services/litescribe_api.dart +++ b/lib/services/litescribe_api.dart @@ -3,8 +3,8 @@ import 'dart:convert'; import '../dto/ordinals/inscription_data.dart'; import '../dto/ordinals/litescribe_response.dart'; import '../networking/http.dart'; -import 'tor_service.dart'; import '../utilities/prefs.dart'; +import 'tor_service.dart'; class LitescribeAPI { static final LitescribeAPI _instance = LitescribeAPI._internal(); @@ -30,7 +30,8 @@ class LitescribeAPI { return LitescribeResponse(data: _validateJson(response.body)); } else { throw Exception( - 'LitescribeAPI _getResponse exception: Failed to load data'); + 'LitescribeAPI _getResponse exception: Failed to load data', + ); } } @@ -40,18 +41,23 @@ class LitescribeAPI { return parsed; } else { throw const FormatException( - 'LitescribeAPI _validateJson exception: Invalid JSON format'); + 'LitescribeAPI _validateJson exception: Invalid JSON format', + ); } } - Future> getInscriptionsByAddress(String address, - {int cursor = 0, int size = 1000}) async { + Future> getInscriptionsByAddress( + String address, { + int cursor = 0, + int size = 1000, + }) async { // size param determines how many inscriptions are returned per response // default of 1000 is used to cover most addresses (I assume) // if the total number of inscriptions at the address exceeds the length of the list of inscriptions returned, another call with a higher size is made final int defaultLimit = 1000; final response = await _getResponse( - '/address/inscriptions?address=$address&cursor=$cursor&size=$size'); + '/address/inscriptions?address=$address&cursor=$cursor&size=$size', + ); // Check if the number of returned inscriptions equals the limit final int total = response.data['result']['total'] as int; @@ -73,14 +79,16 @@ class LitescribeAPI { try { // Iterate through the list and create InscriptionData objects from each element final List inscriptions = (list as List) - .map((json) => - InscriptionData.fromJson(json as Map)) + .map( + (json) => InscriptionData.fromJson(json as Map), + ) .toList(); return inscriptions; } catch (e) { throw const FormatException( - 'LitescribeAPI getInscriptionsByAddress exception: AddressInscriptionResponse.fromJson failure'); + 'LitescribeAPI getInscriptionsByAddress exception: AddressInscriptionResponse.fromJson failure', + ); } } } diff --git a/lib/services/nano_api.dart b/lib/services/nano_api.dart index c364f1f4a..bc2e2b84d 100644 --- a/lib/services/nano_api.dart +++ b/lib/services/nano_api.dart @@ -18,7 +18,7 @@ class NanoAPI { NAccountInfo? accountInfo; Exception? exception; - HTTP client = HTTP(); + final HTTP client = HTTP(); try { final response = await client.post( @@ -65,7 +65,7 @@ class NanoAPI { required String privateKey, required String work, }) async { - Map block = { + final Map block = { "type": "state", "account": account, "previous": previousBlock, @@ -112,7 +112,7 @@ class NanoAPI { required Uri server, required Map block, }) async { - HTTP client = HTTP(); + final HTTP client = HTTP(); final response = await client.post( url: server, diff --git a/lib/services/notifications_api.dart b/lib/services/notifications_api.dart index f614952fc..a5a62c188 100644 --- a/lib/services/notifications_api.dart +++ b/lib/services/notifications_api.dart @@ -9,9 +9,10 @@ */ import 'package:flutter_local_notifications/flutter_local_notifications.dart'; + import '../models/notification_model.dart'; -import 'notifications_service.dart'; import '../utilities/prefs.dart'; +import 'notifications_service.dart'; class NotificationApi { static final _notifications = FlutterLocalNotificationsPlugin(); @@ -19,11 +20,13 @@ class NotificationApi { static Future _notificationDetails() async { return const NotificationDetails( - android: AndroidNotificationDetails('channel id', 'channel name', - channelDescription: 'channel description', - // importance: Importance.max, - priority: Priority.high, - ticker: 'ticker'), + android: AndroidNotificationDetails( + 'channel id', 'channel name', + channelDescription: 'channel description', + // importance: Importance.max, + priority: Priority.high, + ticker: 'ticker', + ), iOS: DarwinNotificationDetails(), macOS: DarwinNotificationDetails(), ); @@ -33,7 +36,8 @@ class NotificationApi { const android = AndroidInitializationSettings('app_icon_alpha'); const iOS = DarwinInitializationSettings(); const linux = LinuxInitializationSettings( - defaultActionName: "temporary_stack_wallet"); + defaultActionName: "temporary_stack_wallet", + ); const macOS = DarwinInitializationSettings(); const settings = InitializationSettings( android: android, diff --git a/lib/services/trade_sent_from_stack_service.dart b/lib/services/trade_sent_from_stack_service.dart index 84832a345..8c04f4714 100644 --- a/lib/services/trade_sent_from_stack_service.dart +++ b/lib/services/trade_sent_from_stack_service.dart @@ -9,6 +9,7 @@ */ import 'package:flutter/material.dart'; + import '../db/hive/db.dart'; import '../models/trade_wallet_lookup.dart'; @@ -56,9 +57,10 @@ class TradeSentFromStackService extends ChangeNotifier { required TradeWalletLookup tradeWalletLookup, }) async { await DB.instance.put( - boxName: DB.boxNameTradeLookup, - key: tradeWalletLookup.uuid, - value: tradeWalletLookup); + boxName: DB.boxNameTradeLookup, + key: tradeWalletLookup.uuid, + value: tradeWalletLookup, + ); notifyListeners(); } @@ -66,6 +68,8 @@ class TradeSentFromStackService extends ChangeNotifier { required TradeWalletLookup tradeWalletLookup, }) async { await DB.instance.delete( - key: tradeWalletLookup.uuid, boxName: DB.boxNameTradeLookup); + key: tradeWalletLookup.uuid, + boxName: DB.boxNameTradeLookup, + ); } } diff --git a/lib/services/trade_service.dart b/lib/services/trade_service.dart index 7fd3dcf05..6207b102e 100644 --- a/lib/services/trade_service.dart +++ b/lib/services/trade_service.dart @@ -9,15 +9,18 @@ */ import 'package:flutter/cupertino.dart'; + import '../db/hive/db.dart'; import '../models/exchange/response_objects/trade.dart'; class TradesService extends ChangeNotifier { List get trades { final list = DB.instance.values(boxName: DB.boxNameTradesV2); - list.sort((a, b) => - b.timestamp.millisecondsSinceEpoch - - a.timestamp.millisecondsSinceEpoch); + list.sort( + (a, b) => + b.timestamp.millisecondsSinceEpoch - + a.timestamp.millisecondsSinceEpoch, + ); return list; } @@ -61,7 +64,9 @@ class TradesService extends ChangeNotifier { required bool shouldNotifyListeners, }) async { await deleteByUuid( - uuid: trade.uuid, shouldNotifyListeners: shouldNotifyListeners); + uuid: trade.uuid, + shouldNotifyListeners: shouldNotifyListeners, + ); } Future deleteByUuid({ diff --git a/lib/services/transaction_notification_tracker.dart b/lib/services/transaction_notification_tracker.dart index 328ca8753..a100b476e 100644 --- a/lib/services/transaction_notification_tracker.dart +++ b/lib/services/transaction_notification_tracker.dart @@ -17,72 +17,92 @@ class TransactionNotificationTracker { List get pendings { final notifiedPendingTransactions = DB.instance.get( - boxName: walletId, key: "notifiedPendingTransactions") as Map? ?? + boxName: walletId, + key: "notifiedPendingTransactions", + ) as Map? ?? {}; return List.from(notifiedPendingTransactions.keys); } bool wasNotifiedPending(String txid) { final notifiedPendingTransactions = DB.instance.get( - boxName: walletId, key: "notifiedPendingTransactions") as Map? ?? + boxName: walletId, + key: "notifiedPendingTransactions", + ) as Map? ?? {}; return notifiedPendingTransactions[txid] as bool? ?? false; } Future addNotifiedPending(String txid) async { final notifiedPendingTransactions = DB.instance.get( - boxName: walletId, key: "notifiedPendingTransactions") as Map? ?? + boxName: walletId, + key: "notifiedPendingTransactions", + ) as Map? ?? {}; notifiedPendingTransactions[txid] = true; await DB.instance.put( - boxName: walletId, - key: "notifiedPendingTransactions", - value: notifiedPendingTransactions); + boxName: walletId, + key: "notifiedPendingTransactions", + value: notifiedPendingTransactions, + ); } List get confirmeds { final notifiedConfirmedTransactions = DB.instance.get( - boxName: walletId, key: "notifiedConfirmedTransactions") as Map? ?? + boxName: walletId, + key: "notifiedConfirmedTransactions", + ) as Map? ?? {}; return List.from(notifiedConfirmedTransactions.keys); } bool wasNotifiedConfirmed(String txid) { final notifiedConfirmedTransactions = DB.instance.get( - boxName: walletId, key: "notifiedConfirmedTransactions") as Map? ?? + boxName: walletId, + key: "notifiedConfirmedTransactions", + ) as Map? ?? {}; return notifiedConfirmedTransactions[txid] as bool? ?? false; } Future addNotifiedConfirmed(String txid) async { final notifiedConfirmedTransactions = DB.instance.get( - boxName: walletId, key: "notifiedConfirmedTransactions") as Map? ?? + boxName: walletId, + key: "notifiedConfirmedTransactions", + ) as Map? ?? {}; notifiedConfirmedTransactions[txid] = true; await DB.instance.put( - boxName: walletId, - key: "notifiedConfirmedTransactions", - value: notifiedConfirmedTransactions); + boxName: walletId, + key: "notifiedConfirmedTransactions", + value: notifiedConfirmedTransactions, + ); } Future deleteTransaction(String txid) async { final notifiedPendingTransactions = DB.instance.get( - boxName: walletId, key: "notifiedPendingTransactions") as Map? ?? + boxName: walletId, + key: "notifiedPendingTransactions", + ) as Map? ?? {}; final notifiedConfirmedTransactions = DB.instance.get( - boxName: walletId, key: "notifiedConfirmedTransactions") as Map? ?? + boxName: walletId, + key: "notifiedConfirmedTransactions", + ) as Map? ?? {}; notifiedPendingTransactions.remove(txid); notifiedConfirmedTransactions.remove(txid); await DB.instance.put( - boxName: walletId, - key: "notifiedConfirmedTransactions", - value: notifiedConfirmedTransactions); + boxName: walletId, + key: "notifiedConfirmedTransactions", + value: notifiedConfirmedTransactions, + ); await DB.instance.put( - boxName: walletId, - key: "notifiedPendingTransactions", - value: notifiedPendingTransactions); + boxName: walletId, + key: "notifiedPendingTransactions", + value: notifiedPendingTransactions, + ); } } diff --git a/lib/themes/coin_icon_provider.dart b/lib/themes/coin_icon_provider.dart index afb47672f..4a789ad76 100644 --- a/lib/themes/coin_icon_provider.dart +++ b/lib/themes/coin_icon_provider.dart @@ -11,17 +11,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../models/isar/stack_theme.dart'; import 'theme_providers.dart'; -import '../wallets/crypto_currency/coins/bitcoin.dart'; -import '../wallets/crypto_currency/coins/bitcoincash.dart'; -import '../wallets/crypto_currency/coins/dogecoin.dart'; -import '../wallets/crypto_currency/coins/epiccash.dart'; -import '../wallets/crypto_currency/coins/ethereum.dart'; -import '../wallets/crypto_currency/coins/firo.dart'; -import '../wallets/crypto_currency/coins/litecoin.dart'; -import '../wallets/crypto_currency/coins/monero.dart'; -import '../wallets/crypto_currency/coins/namecoin.dart'; -import '../wallets/crypto_currency/coins/particl.dart'; -import '../wallets/crypto_currency/coins/wownero.dart'; import '../wallets/crypto_currency/crypto_currency.dart'; final coinIconProvider = Provider.family((ref, coin) { diff --git a/lib/themes/stack_colors.dart b/lib/themes/stack_colors.dart index 20b60e3b1..29804aa0c 100644 --- a/lib/themes/stack_colors.dart +++ b/lib/themes/stack_colors.dart @@ -9,6 +9,7 @@ */ import 'package:flutter/material.dart'; + import '../models/isar/stack_theme.dart'; class StackColors extends ThemeExtension { @@ -1429,18 +1430,20 @@ class StackColors extends ThemeExtension { t, )!, textFieldDefaultSearchIconRight: Color.lerp( - textFieldDefaultSearchIconRight, - other.textFieldDefaultSearchIconRight, - t)!, + textFieldDefaultSearchIconRight, + other.textFieldDefaultSearchIconRight, + t, + )!, textFieldErrorSearchIconRight: Color.lerp( textFieldErrorSearchIconRight, other.textFieldErrorSearchIconRight, t, )!, textFieldSuccessSearchIconRight: Color.lerp( - textFieldSuccessSearchIconRight, - other.textFieldSuccessSearchIconRight, - t)!, + textFieldSuccessSearchIconRight, + other.textFieldSuccessSearchIconRight, + t, + )!, settingsItem2ActiveBG: Color.lerp( settingsItem2ActiveBG, other.settingsItem2ActiveBG, diff --git a/lib/utilities/address_utils.dart b/lib/utilities/address_utils.dart index 2bb721fe0..97f2ec965 100644 --- a/lib/utilities/address_utils.dart +++ b/lib/utilities/address_utils.dart @@ -11,8 +11,6 @@ import 'dart:convert'; import 'logger.dart'; -import '../wallets/crypto_currency/coins/bitcoincash.dart'; -import '../wallets/crypto_currency/coins/ecash.dart'; import '../wallets/crypto_currency/crypto_currency.dart'; class AddressUtils { @@ -217,8 +215,10 @@ class AddressUtils { try { result = Map.from(jsonDecode(data) as Map); } catch (e) { - Logging.instance.log("Exception caught in parseQRSeedData($data): $e", - level: LogLevel.Error); + Logging.instance.log( + "Exception caught in parseQRSeedData($data): $e", + level: LogLevel.Error, + ); } return result; } diff --git a/lib/utilities/amount/amount.dart b/lib/utilities/amount/amount.dart index e388020e1..a1a68576f 100644 --- a/lib/utilities/amount/amount.dart +++ b/lib/utilities/amount/amount.dart @@ -11,6 +11,7 @@ import 'dart:convert'; import 'package:decimal/decimal.dart'; + import '../util.dart'; class Amount { @@ -168,7 +169,8 @@ class Amount { Amount operator +(Amount other) { if (fractionDigits != other.fractionDigits) { throw ArgumentError( - "fractionDigits do not match: this=$this, other=$other"); + "fractionDigits do not match: this=$this, other=$other", + ); } return Amount( rawValue: raw + other.raw, @@ -179,7 +181,8 @@ class Amount { Amount operator -(Amount other) { if (fractionDigits != other.fractionDigits) { throw ArgumentError( - "fractionDigits do not match: this=$this, other=$other"); + "fractionDigits do not match: this=$this, other=$other", + ); } return Amount( rawValue: raw - other.raw, @@ -190,7 +193,8 @@ class Amount { Amount operator *(Amount other) { if (fractionDigits != other.fractionDigits) { throw ArgumentError( - "fractionDigits do not match: this=$this, other=$other"); + "fractionDigits do not match: this=$this, other=$other", + ); } return Amount( rawValue: raw * other.raw, diff --git a/lib/utilities/amount/amount_input_formatter.dart b/lib/utilities/amount/amount_input_formatter.dart index f09100ad7..2ecd9fe54 100644 --- a/lib/utilities/amount/amount_input_formatter.dart +++ b/lib/utilities/amount/amount_input_formatter.dart @@ -1,8 +1,9 @@ import 'dart:math'; import 'package:flutter/services.dart'; -import 'amount_unit.dart'; + import '../util.dart'; +import 'amount_unit.dart'; class AmountInputFormatter extends TextInputFormatter { final int decimals; @@ -17,7 +18,9 @@ class AmountInputFormatter extends TextInputFormatter { @override TextEditingValue formatEditUpdate( - TextEditingValue oldValue, TextEditingValue newValue) { + TextEditingValue oldValue, + TextEditingValue newValue, + ) { // get number symbols for decimal place and group separator final numberSymbols = Util.getSymbolsFor(locale: locale); diff --git a/lib/utilities/amount/amount_unit.dart b/lib/utilities/amount/amount_unit.dart index 9911e5961..a8cbfa701 100644 --- a/lib/utilities/amount/amount_unit.dart +++ b/lib/utilities/amount/amount_unit.dart @@ -14,9 +14,6 @@ import 'package:decimal/decimal.dart'; import '../../models/isar/models/ethereum/eth_contract.dart'; import 'amount.dart'; import '../util.dart'; -import '../../wallets/crypto_currency/coins/ethereum.dart'; -import '../../wallets/crypto_currency/coins/monero.dart'; -import '../../wallets/crypto_currency/coins/wownero.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../wallets/crypto_currency/intermediate/nano_currency.dart'; diff --git a/lib/utilities/biometrics.dart b/lib/utilities/biometrics.dart index 8be9edb24..18e27cbfb 100644 --- a/lib/utilities/biometrics.dart +++ b/lib/utilities/biometrics.dart @@ -10,9 +10,9 @@ import 'dart:io'; -import 'package:flutter/cupertino.dart'; import 'package:local_auth/auth_strings.dart'; import 'package:local_auth/local_auth.dart'; + import 'logger.dart'; class Biometrics { @@ -28,14 +28,16 @@ class Biometrics { }) async { if (!(Platform.isIOS || Platform.isAndroid)) { Logging.instance.log( - "Tried to use Biometrics.authenticate() on a platform that is not Android or iOS! ...returning false.", - level: LogLevel.Error); + "Tried to use Biometrics.authenticate() on a platform that is not Android or iOS! ...returning false.", + level: LogLevel.Error, + ); return false; } if (integrationTestFlag) { Logging.instance.log( - "Tried to use Biometrics.authenticate() during integration testing. Returning false.", - level: LogLevel.Warning); + "Tried to use Biometrics.authenticate() during integration testing. Returning false.", + level: LogLevel.Warning, + ); return false; } @@ -49,7 +51,7 @@ class Biometrics { // debugPrint("isDeviceSupported: $isDeviceSupported"); if (canCheckBiometrics && isDeviceSupported) { - List availableSystems = + final List availableSystems = await localAuth.getAvailableBiometrics(); //todo: check if print needed @@ -59,7 +61,7 @@ class Biometrics { if (Platform.isIOS) { if (availableSystems.contains(BiometricType.face)) { try { - bool didAuthenticate = await localAuth.authenticate( + final bool didAuthenticate = await localAuth.authenticate( biometricOnly: true, localizedReason: localizedReason, stickyAuth: true, @@ -71,12 +73,13 @@ class Biometrics { } } catch (e) { Logging.instance.log( - "local_auth exception caught in Biometrics.authenticate(), e: $e", - level: LogLevel.Error); + "local_auth exception caught in Biometrics.authenticate(), e: $e", + level: LogLevel.Error, + ); } } else if (availableSystems.contains(BiometricType.fingerprint)) { try { - bool didAuthenticate = await localAuth.authenticate( + final bool didAuthenticate = await localAuth.authenticate( biometricOnly: true, localizedReason: localizedReason, stickyAuth: true, @@ -88,14 +91,15 @@ class Biometrics { } } catch (e) { Logging.instance.log( - "local_auth exception caught in Biometrics.authenticate(), e: $e", - level: LogLevel.Error); + "local_auth exception caught in Biometrics.authenticate(), e: $e", + level: LogLevel.Error, + ); } } } else if (Platform.isAndroid) { if (availableSystems.contains(BiometricType.fingerprint)) { try { - bool didAuthenticate = await localAuth.authenticate( + final bool didAuthenticate = await localAuth.authenticate( biometricOnly: true, localizedReason: localizedReason, stickyAuth: true, @@ -111,8 +115,9 @@ class Biometrics { } } catch (e) { Logging.instance.log( - "local_auth exception caught in Biometrics.authenticate(), e: $e", - level: LogLevel.Error); + "local_auth exception caught in Biometrics.authenticate(), e: $e", + level: LogLevel.Error, + ); } } } diff --git a/lib/utilities/bip47_utils.dart b/lib/utilities/bip47_utils.dart index 80b393dff..3d2cdfb41 100644 --- a/lib/utilities/bip47_utils.dart +++ b/lib/utilities/bip47_utils.dart @@ -11,6 +11,7 @@ import 'dart:typed_data'; import 'package:bip47/src/util.dart'; + import '../models/isar/models/blockchain_data/v2/output_v2.dart'; import '../models/isar/models/blockchain_data/v2/transaction_v2.dart'; @@ -19,7 +20,8 @@ abstract class Bip47Utils { static Uint8List? getBlindedPaymentCodeBytesFrom(TransactionV2 transaction) { for (int i = 0; i < transaction.outputs.length; i++) { final bytes = getBlindedPaymentCodeBytesFromOutput( - transaction.outputs.elementAt(i)); + transaction.outputs.elementAt(i), + ); if (bytes != null) { return bytes; } @@ -31,7 +33,7 @@ abstract class Bip47Utils { static Uint8List? getBlindedPaymentCodeBytesFromOutput(OutputV2 output) { Uint8List? blindedCodeBytes; - List? scriptChunks = output.scriptPubKeyAsm?.split(" "); + final List? scriptChunks = output.scriptPubKeyAsm?.split(" "); if (scriptChunks?.length == 2 && scriptChunks?[0] == "OP_RETURN") { final blindedPaymentCode = scriptChunks![1]; final bytes = blindedPaymentCode.fromHex; diff --git a/lib/utilities/connection_check/electrum_connection_check.dart b/lib/utilities/connection_check/electrum_connection_check.dart index a78075246..480434ce3 100644 --- a/lib/utilities/connection_check/electrum_connection_check.dart +++ b/lib/utilities/connection_check/electrum_connection_check.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:electrum_adapter/electrum_adapter.dart'; + import '../../services/event_bus/events/global/tor_connection_status_changed_event.dart'; import '../../services/tor_service.dart'; import '../logger.dart'; @@ -33,7 +34,8 @@ Future checkElectrumServer({ } else { // ... But if the killswitch is set, then we throw an exception. throw Exception( - "Tor preference and killswitch set but Tor is not enabled, not connecting to Electrum adapter"); + "Tor preference and killswitch set but Tor is not enabled, not connecting to Electrum adapter", + ); // TODO [prio=low]: Try to start Tor. } } else { diff --git a/lib/utilities/constants.dart b/lib/utilities/constants.dart index d68760139..6b64d4a73 100644 --- a/lib/utilities/constants.dart +++ b/lib/utilities/constants.dart @@ -40,7 +40,7 @@ abstract class Constants { // Enable Logger.print statements static const bool disableLogger = false; - static const int currentDataVersion = 12; + static const int currentDataVersion = 13; static const int rescanV1 = 1; diff --git a/lib/utilities/desktop_password_service.dart b/lib/utilities/desktop_password_service.dart index e563d453e..323be414b 100644 --- a/lib/utilities/desktop_password_service.dart +++ b/lib/utilities/desktop_password_service.dart @@ -10,6 +10,7 @@ import 'package:hive/hive.dart'; import 'package:stack_wallet_backup/secure_storage.dart'; + import 'logger.dart'; const String kBoxNameDesktopData = "desktopData"; @@ -44,7 +45,8 @@ class DPS { StorageCryptoHandler get handler { if (_handler == null) { throw Exception( - "DPS: attempted to access handler without proper authentication"); + "DPS: attempted to access handler without proper authentication", + ); } return _handler!; } @@ -76,7 +78,8 @@ class DPS { Future initFromExisting(String passphrase) async { if (_handler != null) { throw Exception( - "DPS: attempted to re initialize with existing passphrase"); + "DPS: attempted to re initialize with existing passphrase", + ); } try { @@ -84,7 +87,8 @@ class DPS { if (keyBlob == null) { throw Exception( - "DPS: failed to find keyBlob while attempting to initialize with existing passphrase"); + "DPS: failed to find keyBlob while attempting to initialize with existing passphrase", + ); } final blobVersion = await _getStoredKeyBlobVersion(); _handler = await StorageCryptoHandler.fromExisting( diff --git a/lib/utilities/enums/fiat_enum.dart b/lib/utilities/enums/fiat_enum.dart index a563112cf..914a97da4 100644 --- a/lib/utilities/enums/fiat_enum.dart +++ b/lib/utilities/enums/fiat_enum.dart @@ -1161,6 +1161,9 @@ Fiats fiatFromTickerCaseInsensitive(String ticker) { return Fiats.ZWD; default: throw ArgumentError.value( - ticker, "name", "No Fiat enum value with that ticker"); + ticker, + "name", + "No Fiat enum value with that ticker", + ); } } diff --git a/lib/utilities/enums/log_level_enum.dart b/lib/utilities/enums/log_level_enum.dart index 6e5e14a8f..5fb7f9e52 100644 --- a/lib/utilities/enums/log_level_enum.dart +++ b/lib/utilities/enums/log_level_enum.dart @@ -14,5 +14,6 @@ enum LogLevel { Info, Warning, Error, - Fatal; + Fatal, + Debug; } diff --git a/lib/utilities/eth_commons.dart b/lib/utilities/eth_commons.dart index b7f936c58..c105412db 100644 --- a/lib/utilities/eth_commons.dart +++ b/lib/utilities/eth_commons.dart @@ -12,7 +12,6 @@ import 'package:bip32/bip32.dart' as bip32; import 'package:bip39/bip39.dart' as bip39; import 'package:decimal/decimal.dart'; import "package:hex/hex.dart"; -import '../wallets/crypto_currency/coins/ethereum.dart'; import '../wallets/crypto_currency/crypto_currency.dart'; class GasTracker { diff --git a/lib/utilities/extensions/extensions.dart b/lib/utilities/extensions/extensions.dart index a798c002a..678e12844 100644 --- a/lib/utilities/extensions/extensions.dart +++ b/lib/utilities/extensions/extensions.dart @@ -13,5 +13,6 @@ export 'impl/box_shadow.dart'; export 'impl/cl_transaction.dart'; export 'impl/contract_abi.dart'; export 'impl/gradient.dart'; +export 'impl/list.dart'; export 'impl/string.dart'; export 'impl/uint8_list.dart'; diff --git a/lib/utilities/extensions/impl/big_int.dart b/lib/utilities/extensions/impl/big_int.dart index d0b84ff98..866c5103d 100644 --- a/lib/utilities/extensions/impl/big_int.dart +++ b/lib/utilities/extensions/impl/big_int.dart @@ -31,7 +31,7 @@ extension BigIntExtensions on BigInt { throw Exception("BigInt value is negative"); } BigInt number = this; - int bytes = (number.bitLength + 7) >> 3; + final int bytes = (number.bitLength + 7) >> 3; final b256 = BigInt.from(256); final result = Uint8List(bytes); for (int i = 0; i < bytes; i++) { diff --git a/lib/utilities/extensions/impl/contract_abi.dart b/lib/utilities/extensions/impl/contract_abi.dart index f34e33970..b067c552e 100644 --- a/lib/utilities/extensions/impl/contract_abi.dart +++ b/lib/utilities/extensions/impl/contract_abi.dart @@ -10,9 +10,10 @@ import 'dart:convert'; -import '../../logger.dart'; import 'package:web3dart/web3dart.dart'; +import '../../logger.dart'; + extension ContractAbiExtensions on ContractAbi { static ContractAbi fromJsonList({ required String name, @@ -112,12 +113,17 @@ extension ContractAbiExtensions on ContractAbi { } } - static CompositeFunctionParameter _parseTuple(String name, String typeName, - List> components) { + static CompositeFunctionParameter _parseTuple( + String name, + String typeName, + List> components, + ) { // The type will have the form tuple[3][]...[1], where the indices after the // tuple indicate that the type is part of an array. - assert(RegExp(r'^tuple(?:\[\d*\])*$').hasMatch(typeName), - '$typeName is an invalid tuple type'); + assert( + RegExp(r'^tuple(?:\[\d*\])*$').hasMatch(typeName), + '$typeName is an invalid tuple type', + ); final arrayLengths = []; var remainingName = typeName; diff --git a/lib/utilities/extensions/impl/list.dart b/lib/utilities/extensions/impl/list.dart new file mode 100644 index 000000000..c802f2704 --- /dev/null +++ b/lib/utilities/extensions/impl/list.dart @@ -0,0 +1,19 @@ +extension ListExt on List { + List> chunked({required int chunkSize}) { + final remainder = length % chunkSize; + final count = length ~/ chunkSize; + final List> result = []; + + int i = 0; + while (i < count) { + result.add(sublist(i, i + chunkSize)); + i++; + } + + if (remainder > 0) { + result.add(sublist(i, i + remainder)); + } + + return result; + } +} diff --git a/lib/utilities/extensions/impl/string.dart b/lib/utilities/extensions/impl/string.dart index d3e50fa78..6a25f23b6 100644 --- a/lib/utilities/extensions/impl/string.dart +++ b/lib/utilities/extensions/impl/string.dart @@ -14,6 +14,7 @@ import 'dart:typed_data'; import 'package:dart_bs58/dart_bs58.dart'; import 'package:dart_bs58check/dart_bs58check.dart'; import 'package:hex/hex.dart'; + import '../extensions.dart'; extension StringExtensions on String { @@ -27,4 +28,14 @@ extension StringExtensions on String { Uint8List get toUint8ListFromBase58CheckEncoded => bs58check.decode(this); BigInt get toBigIntFromHex => toUint8ListFromHex.toBigInt; + + String get toHexFromBase64 => base64Decode(LineSplitter.split(this).join()) + .map((e) => e.toRadixString(16).padLeft(2, '0')) + .join(); + + String get toHexReversedFromBase64 => + base64Decode(LineSplitter.split(this).join()) + .reversed + .map((e) => e.toRadixString(16).padLeft(2, '0')) + .join(); } diff --git a/lib/utilities/flutter_secure_storage_interface.dart b/lib/utilities/flutter_secure_storage_interface.dart index 26adefaaa..1c81119ab 100644 --- a/lib/utilities/flutter_secure_storage_interface.dart +++ b/lib/utilities/flutter_secure_storage_interface.dart @@ -11,6 +11,7 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:isar/isar.dart'; import 'package:stack_wallet_backup/secure_storage.dart'; + import '../models/isar/models/encrypted_string_value.dart'; import 'stack_file_system.dart'; @@ -140,9 +141,11 @@ class SecureStorageWrapper implements SecureStorageInterface { const SecureStorageWrapper({ required dynamic store, required bool isDesktop, - }) : assert(isDesktop - ? store is DesktopSecureStore - : store is FlutterSecureStorage), + }) : assert( + isDesktop + ? store is DesktopSecureStore + : store is FlutterSecureStorage, + ), _store = store, _isDesktop = isDesktop; diff --git a/lib/utilities/format.dart b/lib/utilities/format.dart index b11e98e1e..7a9fe1b69 100644 --- a/lib/utilities/format.dart +++ b/lib/utilities/format.dart @@ -113,7 +113,7 @@ abstract class Format { static String uint8listToString(Uint8List list) { String result = ""; - for (var n in list) { + for (final n in list) { result += (n.toRadixString(16).length == 1 ? "0" : "") + n.toRadixString(16); } @@ -121,7 +121,7 @@ abstract class Format { } static Uint8List stringToUint8List(String string) { - List list = []; + final List list = []; for (var leg = 0; leg < string.length; leg = leg + 2) { list.add(int.parse(string.substring(leg, leg + 2), radix: 16)); } diff --git a/lib/utilities/logger.dart b/lib/utilities/logger.dart index 9574db009..6af09473a 100644 --- a/lib/utilities/logger.dart +++ b/lib/utilities/logger.dart @@ -105,17 +105,17 @@ abstract class Logger { return; } final utcTime = withTimeStamp ? "${core.DateTime.now().toUtc()}: " : ""; - core.int defaultPrintLength = 1020 - utcTime.length; + final core.int defaultPrintLength = 1020 - utcTime.length; if (normalLength) { debugPrint("$utcTime$object"); } else if (object == null || object.toString().length <= defaultPrintLength) { debugPrint("$utcTime$object"); } else { - core.String log = object.toString(); + final core.String log = object.toString(); core.int start = 0; core.int endIndex = defaultPrintLength; - core.int logLength = log.length; + final core.int logLength = log.length; core.int tmpLogLength = log.length; while (endIndex < logLength) { debugPrint(utcTime + log.substring(start, endIndex)); diff --git a/lib/utilities/paynym_is_api.dart b/lib/utilities/paynym_is_api.dart index 1ed94d751..8b42e6143 100644 --- a/lib/utilities/paynym_is_api.dart +++ b/lib/utilities/paynym_is_api.dart @@ -10,6 +10,8 @@ import 'dart:convert'; +import 'package:tuple/tuple.dart'; + import '../models/paynym/created_paynym.dart'; import '../models/paynym/paynym_account.dart'; import '../models/paynym/paynym_claim.dart'; @@ -19,7 +21,6 @@ import '../models/paynym/paynym_unfollow.dart'; import '../networking/http.dart'; import '../services/tor_service.dart'; import 'prefs.dart'; -import 'package:tuple/tuple.dart'; // todo: better error message parsing (from response itself?) @@ -34,13 +35,13 @@ class PaynymIsApi { Map body, [ Map additionalHeaders = const {}, ]) async { - String url = baseURL + + final String url = baseURL + version + (endpoint.startsWith("/") ? endpoint : "/$endpoint"); final uri = Uri.parse(url); // Calculate the body length. - int contentLength = utf8.encode(jsonEncode(body)).length; + final int contentLength = utf8.encode(jsonEncode(body)).length; final headers = { 'Content-Type': 'application/json; charset=UTF-8', @@ -248,8 +249,10 @@ class PaynymIsApi { // | 200 | Nym found and returned | // | 404 | Nym not found | // | 400 | Bad request | - Future> nym(String code, - [bool compact = false]) async { + Future> nym( + String code, [ + bool compact = false, + ]) async { final Map requestBody = {"nym": code}; if (compact) { requestBody["compact"] = true; diff --git a/lib/utilities/stack_file_system.dart b/lib/utilities/stack_file_system.dart index b5f28e48a..da3d33cfe 100644 --- a/lib/utilities/stack_file_system.dart +++ b/lib/utilities/stack_file_system.dart @@ -42,7 +42,8 @@ abstract class StackFileSystem { appDirectory = Directory(_overrideDesktopDirPath!); } else { appDirectory = Directory( - "${Platform.environment['HOME']}/.${AppConfig.appDefaultDataDirName}"); + "${Platform.environment['HOME']}/.${AppConfig.appDefaultDataDirName}", + ); } } else if (Platform.isWindows) { if (_overrideDesktopDirPath != null) { @@ -56,7 +57,8 @@ abstract class StackFileSystem { } else { appDirectory = await getLibraryDirectory(); appDirectory = Directory( - "${appDirectory.path}/${AppConfig.appDefaultDataDirName}"); + "${appDirectory.path}/${AppConfig.appDefaultDataDirName}", + ); } } else if (Platform.isIOS) { // todo: check if we need different behaviour here @@ -89,6 +91,20 @@ abstract class StackFileSystem { } } + // Not used in general now. See applicationFiroCacheSQLiteDirectory() + // static Future applicationSQLiteDirectory() async { + // final root = await applicationRootDirectory(); + // if (Util.isDesktop) { + // final dir = Directory("${root.path}/sqlite"); + // if (!dir.existsSync()) { + // await dir.create(); + // } + // return dir; + // } else { + // return root; + // } + // } + static Future applicationTorDirectory() async { final root = await applicationRootDirectory(); if (Util.isDesktop) { @@ -102,6 +118,19 @@ abstract class StackFileSystem { } } + static Future applicationFiroCacheSQLiteDirectory() async { + final root = await applicationRootDirectory(); + if (Util.isDesktop) { + final dir = Directory("${root.path}/sqlite/firo_cache"); + if (!dir.existsSync()) { + await dir.create(); + } + return dir; + } else { + return root; + } + } + static Future applicationHiveDirectory() async { final root = await applicationRootDirectory(); if (Util.isDesktop) { diff --git a/lib/utilities/test_epic_box_connection.dart b/lib/utilities/test_epic_box_connection.dart index 471d6fcce..039fa7ec8 100644 --- a/lib/utilities/test_epic_box_connection.dart +++ b/lib/utilities/test_epic_box_connection.dart @@ -17,7 +17,7 @@ import 'logger.dart'; import 'prefs.dart'; Future _testEpicBoxNodeConnection(Uri uri) async { - HTTP client = HTTP(); + final HTTP client = HTTP(); try { final response = await client .get( @@ -27,8 +27,10 @@ Future _testEpicBoxNodeConnection(Uri uri) async { ? TorService.sharedInstance.getProxyInfo() : null, ) - .timeout(const Duration(milliseconds: 2000), - onTimeout: () async => Response(utf8.encode('Error'), 408)); + .timeout( + const Duration(milliseconds: 2000), + onTimeout: () async => Response(utf8.encode('Error'), 408), + ); final json = jsonDecode(response.body); diff --git a/lib/utilities/test_eth_node_connection.dart b/lib/utilities/test_eth_node_connection.dart index f90ae1353..be95a19ce 100644 --- a/lib/utilities/test_eth_node_connection.dart +++ b/lib/utilities/test_eth_node_connection.dart @@ -2,7 +2,7 @@ import 'package:http/http.dart'; import 'package:web3dart/web3dart.dart' as web3; Future testEthNodeConnection(String host) async { - web3.Web3Client client = web3.Web3Client(host, Client()); + final web3.Web3Client client = web3.Web3Client(host, Client()); try { await client.getBlockNumber(); return true; diff --git a/lib/utilities/test_monero_node_connection.dart b/lib/utilities/test_monero_node_connection.dart index d6fe05cd5..bc9c95a69 100644 --- a/lib/utilities/test_monero_node_connection.dart +++ b/lib/utilities/test_monero_node_connection.dart @@ -12,11 +12,12 @@ import 'dart:convert'; import 'dart:io'; import 'package:flutter/material.dart'; -import 'format.dart'; -import 'logger.dart'; + import '../widgets/desktop/primary_button.dart'; import '../widgets/desktop/secondary_button.dart'; import '../widgets/stack_dialog.dart'; +import 'format.dart'; +import 'logger.dart'; class MoneroNodeConnectionResponse { final X509Certificate? cert; diff --git a/lib/utilities/test_node_connection.dart b/lib/utilities/test_node_connection.dart index c47fb49ac..7dd432140 100644 --- a/lib/utilities/test_node_connection.dart +++ b/lib/utilities/test_node_connection.dart @@ -13,12 +13,6 @@ import 'test_eth_node_connection.dart'; import 'test_monero_node_connection.dart'; import 'test_stellar_node_connection.dart'; import '../wallets/api/tezos/tezos_rpc_api.dart'; -import '../wallets/crypto_currency/coins/bitcoin_frost.dart'; -import '../wallets/crypto_currency/coins/epiccash.dart'; -import '../wallets/crypto_currency/coins/ethereum.dart'; -import '../wallets/crypto_currency/coins/solana.dart'; -import '../wallets/crypto_currency/coins/stellar.dart'; -import '../wallets/crypto_currency/coins/tezos.dart'; import '../wallets/crypto_currency/crypto_currency.dart'; import '../wallets/crypto_currency/interfaces/electrumx_currency_interface.dart'; import '../wallets/crypto_currency/intermediate/cryptonote_currency.dart'; diff --git a/lib/utilities/test_stellar_node_connection.dart b/lib/utilities/test_stellar_node_connection.dart index 7b580e85c..2fd2f9fcc 100644 --- a/lib/utilities/test_stellar_node_connection.dart +++ b/lib/utilities/test_stellar_node_connection.dart @@ -1,13 +1,14 @@ import 'dart:convert'; +import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart'; + import '../networking/http.dart' as http; import '../services/tor_service.dart'; import 'prefs.dart'; -import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart'; Future testStellarNodeConnection(String host, int port) async { - http.HTTP client = http.HTTP(); - Uri uri = Uri.parse("$host:$port"); + final http.HTTP client = http.HTTP(); + final Uri uri = Uri.parse("$host:$port"); final response = await client .get( @@ -17,12 +18,14 @@ Future testStellarNodeConnection(String host, int port) async { ? TorService.sharedInstance.getProxyInfo() : null, ) - .timeout(const Duration(milliseconds: 2000), - onTimeout: () async => http.Response(utf8.encode('Error'), 408)); + .timeout( + const Duration(milliseconds: 2000), + onTimeout: () async => http.Response(utf8.encode('Error'), 408), + ); if (response.code == 200) { //Get chain height for sdk - StellarSDK stellarSdk = StellarSDK(host); + final StellarSDK stellarSdk = StellarSDK(host); final height = await stellarSdk.ledgers .order(RequestBuilderOrder.DESC) .limit(1) diff --git a/lib/utilities/util.dart b/lib/utilities/util.dart index cdfc1bfb7..d573d9b90 100644 --- a/lib/utilities/util.dart +++ b/lib/utilities/util.dart @@ -54,14 +54,14 @@ abstract class Util { } static MaterialColor createMaterialColor(Color color) { - List strengths = [.05]; + final List strengths = [.05]; final swatch = {}; final int r = color.red, g = color.green, b = color.blue; for (int i = 1; i < 10; i++) { strengths.add(0.1 * i); } - for (var strength in strengths) { + for (final strength in strengths) { final double ds = 0.5 - strength; swatch[(strength * 1000).round()] = Color.fromRGBO( r + ((ds < 0 ? r : (255 - r)) * ds).round(), diff --git a/lib/utilities/wallet_tools.dart b/lib/utilities/wallet_tools.dart new file mode 100644 index 000000000..cbc3c616c --- /dev/null +++ b/lib/utilities/wallet_tools.dart @@ -0,0 +1,55 @@ +import 'package:isar/isar.dart'; + +import '../db/isar/main_db.dart'; +import '../models/isar/models/blockchain_data/v2/transaction_v2.dart'; +import '../wallets/crypto_currency/crypto_currency.dart'; +import 'amount/amount.dart'; +import 'amount/amount_formatter.dart'; +import 'amount/amount_unit.dart'; + +abstract class WalletDevTools { + static String checkFiroTransactionTally(String walletId) { + final amtFmt = AmountFormatter( + unit: AmountUnit.normal, + locale: "en_US", + coin: Firo(CryptoCurrencyNetwork.main), + maxDecimals: 8, + ); + + final all = MainDB.instance.isar.transactionV2s + .where() + .walletIdEqualTo(walletId) + .findAllSync(); + + final totalCount = all.length; + + BigInt runningBalance = BigInt.zero; + for (final tx in all) { + final ownIns = tx.inputs + .where((e) => e.walletOwns) + .map((e) => e.value) + .fold(BigInt.zero, (p, e) => p + e); + runningBalance -= ownIns; + + final ownOuts = tx.outputs + .where((e) => e.walletOwns) + .map((e) => e.value) + .fold(BigInt.zero, (p, e) => p + e); + runningBalance += ownOuts; + } + + final balanceAccordingToTxHistory = Amount( + rawValue: runningBalance, + fractionDigits: 8, + ); + + print("======== $walletId ============="); + print("totalTxCount: $totalCount"); + print( + "balanceAccordingToTxns: ${amtFmt.format(balanceAccordingToTxHistory)}", + ); + print("=================================================="); + + return amtFmt.format(balanceAccordingToTxHistory); + } +} diff --git a/lib/wallets/api/lelantus_ffi_wrapper.dart b/lib/wallets/api/lelantus_ffi_wrapper.dart index e6037bedb..d43f504c4 100644 --- a/lib/wallets/api/lelantus_ffi_wrapper.dart +++ b/lib/wallets/api/lelantus_ffi_wrapper.dart @@ -2,6 +2,7 @@ import 'package:bip32/bip32.dart'; import 'package:bitcoindart/bitcoindart.dart' as bitcoindart; import 'package:flutter/foundation.dart'; import 'package:lelantus/lelantus.dart' as lelantus; + import '../../models/isar/models/isar_models.dart' as isar_models; import '../../models/isar/models/isar_models.dart'; import '../../models/lelantus_fee_data.dart'; @@ -70,8 +71,8 @@ abstract final class LelantusFfiWrapper { String partialDerivationPath, }) args, ) async { - List jindexes = []; - List lelantusCoins = []; + final List jindexes = []; + final List lelantusCoins = []; final List spendTxIds = []; int lastFoundIndex = 0; @@ -121,10 +122,12 @@ abstract final class LelantusFfiWrapper { ); final bool isUsed = args.usedSerialNumbers.contains(serialNumber); - lelantusCoins.removeWhere((e) => - e.txid == txId && - e.mintIndex == currentIndex && - e.anonymitySetId != setId); + lelantusCoins.removeWhere( + (e) => + e.txid == txId && + e.mintIndex == currentIndex && + e.anonymitySetId != setId, + ); lelantusCoins.add( isar_models.LelantusCoin( @@ -164,10 +167,12 @@ abstract final class LelantusFfiWrapper { ); final bool isUsed = args.usedSerialNumbers.contains(serialNumber); - lelantusCoins.removeWhere((e) => - e.txid == txId && - e.mintIndex == currentIndex && - e.anonymitySetId != setId); + lelantusCoins.removeWhere( + (e) => + e.txid == txId && + e.mintIndex == currentIndex && + e.anonymitySetId != setId, + ); lelantusCoins.add( isar_models.LelantusCoin( @@ -218,12 +223,13 @@ abstract final class LelantusFfiWrapper { } static Future _estimateJoinSplitFee( - ({ - int spendAmount, - bool subtractFeeFromAmount, - List lelantusEntries, - bool isTestNet, - }) data) async { + ({ + int spendAmount, + bool subtractFeeFromAmount, + List lelantusEntries, + bool isTestNet, + }) data, + ) async { debugPrint("estimateJoinSplit fee"); // for (int i = 0; i < lelantusEntries.length; i++) { // Logging.instance.log(lelantusEntries[i], addToDebugMessagesDB: false); @@ -232,8 +238,8 @@ abstract final class LelantusFfiWrapper { "${data.spendAmount} ${data.subtractFeeFromAmount}", ); - List changeToMint = List.empty(growable: true); - List spendCoinIndexes = List.empty(growable: true); + final List changeToMint = List.empty(growable: true); + final List spendCoinIndexes = List.empty(growable: true); // Logging.instance.log(lelantusEntries, addToDebugMessagesDB: false); final fee = lelantus.estimateFee( data.spendAmount, @@ -286,18 +292,19 @@ abstract final class LelantusFfiWrapper { } static Future _createJoinSplitTransaction( - ({ - TxData txData, - bool subtractFeeFromAmount, - int index, - List lelantusEntries, - int locktime, - Bip39HDCurrency cryptoCurrency, - List> anonymitySetsArg, - String partialDerivationPath, - String hexRootPrivateKey, - Uint8List chaincode, - }) arg) async { + ({ + TxData txData, + bool subtractFeeFromAmount, + int index, + List lelantusEntries, + int locktime, + Bip39HDCurrency cryptoCurrency, + List> anonymitySetsArg, + String partialDerivationPath, + String hexRootPrivateKey, + Uint8List chaincode, + }) arg, + ) async { final spendAmount = arg.txData.recipients!.first.amount.raw.toInt(); final address = arg.txData.recipients!.first.address; final isChange = arg.txData.recipients!.first.isChange; @@ -401,12 +408,13 @@ abstract final class LelantusFfiWrapper { if (!setIds.contains(anonymitySetId)) { setIds.add(anonymitySetId); final anonymitySet = arg.anonymitySetsArg.firstWhere( - (element) => element["setId"] == anonymitySetId, - orElse: () => {}); + (element) => element["setId"] == anonymitySetId, + orElse: () => {}, + ); if (anonymitySet.isNotEmpty) { anonymitySetHashes.add(anonymitySet['setHash'] as String); groupBlockHashes.add(anonymitySet['blockHash'] as String); - List list = []; + final List list = []; for (int i = 0; i < (anonymitySet['coins'] as List).length; i++) { list.add(anonymitySet['coins'][i][0] as String); } @@ -447,7 +455,8 @@ abstract final class LelantusFfiWrapper { final extTx = finalTx.buildIncomplete(); extTx.addInput( Format.stringToUint8List( - '0000000000000000000000000000000000000000000000000000000000000000'), + '0000000000000000000000000000000000000000000000000000000000000000', + ), 4294967295, 4294967295, Format.stringToUint8List("c9"), @@ -467,7 +476,7 @@ abstract final class LelantusFfiWrapper { txid: txId, raw: txHex, recipients: [ - (address: address, amount: amountAmount, isChange: isChange) + (address: address, amount: amountAmount, isChange: isChange), ], fee: Amount( rawValue: BigInt.from(fee), @@ -509,14 +518,15 @@ abstract final class LelantusFfiWrapper { // =========================================================================== static Future _getMintScriptWrapper( - ({ - int amount, - String privateKeyHex, - int index, - String seedId, - bool isTestNet - }) data) async { - String mintHex = lelantus.getMintScript( + ({ + int amount, + String privateKeyHex, + int index, + String seedId, + bool isTestNet + }) data, + ) async { + final String mintHex = lelantus.getMintScript( data.amount, data.privateKeyHex, data.index, diff --git a/lib/wallets/api/tezos/tezos_api.dart b/lib/wallets/api/tezos/tezos_api.dart index 754fc17aa..abe126ac3 100644 --- a/lib/wallets/api/tezos/tezos_api.dart +++ b/lib/wallets/api/tezos/tezos_api.dart @@ -33,8 +33,10 @@ abstract final class TezosAPI { } } - static Future getAccount(String address, - {String type = "user"}) async { + static Future getAccount( + String address, { + String type = "user", + }) async { try { final uriString = "$_baseURL/v1/accounts/$address?legacy=false"; final response = await _client.get( @@ -76,8 +78,8 @@ abstract final class TezosAPI { final result = jsonDecode(response.body) as List; - List txs = []; - for (var tx in result) { + final List txs = []; + for (final tx in result) { if (tx["type"] == "transaction") { final theTx = TezosTransaction( id: tx["id"] as int, diff --git a/lib/wallets/api/tezos/tezos_rpc_api.dart b/lib/wallets/api/tezos/tezos_rpc_api.dart index 201cd3b9b..1497a46c0 100644 --- a/lib/wallets/api/tezos/tezos_rpc_api.dart +++ b/lib/wallets/api/tezos/tezos_rpc_api.dart @@ -13,7 +13,7 @@ abstract final class TezosRpcAPI { required String address, }) async { try { - String balanceCall = + final String balanceCall = "${nodeInfo.host}:${nodeInfo.port}/chains/main/blocks/head/context/contracts/$address/balance"; final response = await _client.get( diff --git a/lib/wallets/crypto_currency/coins/bitcoincash.dart b/lib/wallets/crypto_currency/coins/bitcoincash.dart index e713dd417..25e18f6a3 100644 --- a/lib/wallets/crypto_currency/coins/bitcoincash.dart +++ b/lib/wallets/crypto_currency/coins/bitcoincash.dart @@ -4,6 +4,7 @@ import 'package:bech32/bech32.dart'; import 'package:bitbox/bitbox.dart' as bitbox; import 'package:bs58check/bs58check.dart' as bs58check; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/node_model.dart'; import '../../../utilities/amount/amount.dart'; @@ -133,7 +134,8 @@ class Bitcoincash extends Bip39HDCurrency with ElectrumXCurrencyInterface { final addr = coinlib.Address.fromString(address, networkParams); return Bip39HDCurrency.convertBytesToScriptHash( - addr.program.script.compiled); + addr.program.script.compiled, + ); } catch (e) { rethrow; } @@ -159,7 +161,8 @@ class Bitcoincash extends Bip39HDCurrency with ElectrumXCurrencyInterface { break; default: throw Exception( - "DerivePathType $derivePathType not supported for coinType"); + "DerivePathType $derivePathType not supported for coinType", + ); } break; case 0xef: diff --git a/lib/wallets/crypto_currency/coins/ecash.dart b/lib/wallets/crypto_currency/coins/ecash.dart index bf173fe67..593bb34f5 100644 --- a/lib/wallets/crypto_currency/coins/ecash.dart +++ b/lib/wallets/crypto_currency/coins/ecash.dart @@ -4,6 +4,7 @@ import 'package:bech32/bech32.dart'; import 'package:bitbox/bitbox.dart' as bitbox; import 'package:bs58check/bs58check.dart' as bs58check; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/node_model.dart'; import '../../../utilities/amount/amount.dart'; @@ -128,7 +129,8 @@ class Ecash extends Bip39HDCurrency with ElectrumXCurrencyInterface { final addr = coinlib.Address.fromString(address, networkParams); return Bip39HDCurrency.convertBytesToScriptHash( - addr.program.script.compiled); + addr.program.script.compiled, + ); } catch (e) { rethrow; } @@ -153,12 +155,14 @@ class Ecash extends Bip39HDCurrency with ElectrumXCurrencyInterface { break; default: throw Exception( - "DerivePathType $derivePathType not supported for coinType"); + "DerivePathType $derivePathType not supported for coinType", + ); } break; case 0xef: // testnet wif throw Exception( - "DerivePathType $derivePathType not supported for coinType"); + "DerivePathType $derivePathType not supported for coinType", + ); default: throw Exception("Invalid ECash network wif used!"); } @@ -278,10 +282,8 @@ class Ecash extends Bip39HDCurrency with ElectrumXCurrencyInterface { switch (network) { case CryptoCurrencyNetwork.main: return NodeModel( - // host: "ecash.stackwallet.com", - // port: 59002, - host: "electrum.bitcoinabc.org", - port: 50002, + host: "ecash.stackwallet.com", + port: 59002, name: DefaultNodes.defaultName, id: DefaultNodes.buildId(this), useSSL: true, diff --git a/lib/wallets/crypto_currency/coins/monero.dart b/lib/wallets/crypto_currency/coins/monero.dart index 47deb80ab..fa7e32886 100644 --- a/lib/wallets/crypto_currency/coins/monero.dart +++ b/lib/wallets/crypto_currency/coins/monero.dart @@ -1,4 +1,5 @@ -import 'package:cw_monero/api/wallet.dart' as monero_wallet; +import 'package:monero/monero.dart' as monero; + import '../../../models/node_model.dart'; import '../../../utilities/default_nodes.dart'; import '../../../utilities/enums/derive_path_type_enum.dart'; @@ -44,7 +45,12 @@ class Monero extends CryptonoteCurrency { @override bool validateAddress(String address) { - return monero_wallet.validateAddress(address); + switch (network) { + case CryptoCurrencyNetwork.main: + return monero.Wallet_addressValid(address, 0); + default: + throw Exception("Unsupported network: $network"); + } } @override diff --git a/lib/wallets/crypto_currency/coins/namecoin.dart b/lib/wallets/crypto_currency/coins/namecoin.dart index 557644b84..daca04916 100644 --- a/lib/wallets/crypto_currency/coins/namecoin.dart +++ b/lib/wallets/crypto_currency/coins/namecoin.dart @@ -1,4 +1,5 @@ import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/node_model.dart'; import '../../../utilities/amount/amount.dart'; @@ -130,9 +131,10 @@ class Namecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface { } @override - ({coinlib.Address address, AddressType addressType}) getAddressForPublicKey( - {required coinlib.ECPublicKey publicKey, - required DerivePathType derivePathType}) { + ({coinlib.Address address, AddressType addressType}) getAddressForPublicKey({ + required coinlib.ECPublicKey publicKey, + required DerivePathType derivePathType, + }) { switch (derivePathType) { // case DerivePathType.bip16: diff --git a/lib/wallets/crypto_currency/coins/particl.dart b/lib/wallets/crypto_currency/coins/particl.dart index 9fb53ab1f..382602e7a 100644 --- a/lib/wallets/crypto_currency/coins/particl.dart +++ b/lib/wallets/crypto_currency/coins/particl.dart @@ -1,4 +1,5 @@ import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/node_model.dart'; import '../../../utilities/amount/amount.dart'; @@ -51,11 +52,12 @@ class Particl extends Bip39HDCurrency with ElectrumXCurrencyInterface { @override // See https://github.com/cypherstack/stack_wallet/blob/d08b5c9b22b58db800ad07b2ceeb44c6d05f9cf3/lib/services/coins/particl/particl_wallet.dart#L68 - String constructDerivePath( - {required DerivePathType derivePathType, - int account = 0, - required int chain, - required int index}) { + String constructDerivePath({ + required DerivePathType derivePathType, + int account = 0, + required int chain, + required int index, + }) { String coinType; switch (networkParams.wifPrefix) { case 0x6c: // PART mainnet wif. diff --git a/lib/wallets/crypto_currency/coins/peercoin.dart b/lib/wallets/crypto_currency/coins/peercoin.dart index 3287b38ed..0edc1cbfa 100644 --- a/lib/wallets/crypto_currency/coins/peercoin.dart +++ b/lib/wallets/crypto_currency/coins/peercoin.dart @@ -1,5 +1,6 @@ import 'package:coinlib/src/network.dart'; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/node_model.dart'; import '../../../utilities/amount/amount.dart'; @@ -142,9 +143,10 @@ class Peercoin extends Bip39HDCurrency with ElectrumXCurrencyInterface { } @override - ({coinlib.Address address, AddressType addressType}) getAddressForPublicKey( - {required coinlib.ECPublicKey publicKey, - required DerivePathType derivePathType}) { + ({coinlib.Address address, AddressType addressType}) getAddressForPublicKey({ + required coinlib.ECPublicKey publicKey, + required DerivePathType derivePathType, + }) { switch (derivePathType) { // case DerivePathType.bip16: diff --git a/lib/wallets/crypto_currency/coins/solana.dart b/lib/wallets/crypto_currency/coins/solana.dart index 96ff3f2ae..7ae69ed43 100644 --- a/lib/wallets/crypto_currency/coins/solana.dart +++ b/lib/wallets/crypto_currency/coins/solana.dart @@ -1,4 +1,5 @@ import 'package:solana/solana.dart'; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/node_model.dart'; import '../../../utilities/default_nodes.dart'; @@ -70,7 +71,8 @@ class Solana extends Bip39Currency { @override bool validateAddress(String address) { return isPointOnEd25519Curve( - Ed25519HDPublicKey.fromBase58(address).toByteArray()); + Ed25519HDPublicKey.fromBase58(address).toByteArray(), + ); } @override diff --git a/lib/wallets/crypto_currency/coins/stellar.dart b/lib/wallets/crypto_currency/coins/stellar.dart index dfcb37fce..e9749c515 100644 --- a/lib/wallets/crypto_currency/coins/stellar.dart +++ b/lib/wallets/crypto_currency/coins/stellar.dart @@ -120,7 +120,8 @@ class Stellar extends Bip39Currency { @override DerivePathType get primaryDerivePathType => throw UnsupportedError( - "$runtimeType does not use bitcoin style derivation paths",); + "$runtimeType does not use bitcoin style derivation paths", + ); @override Uri defaultBlockExplorer(String txid) { diff --git a/lib/wallets/crypto_currency/coins/tezos.dart b/lib/wallets/crypto_currency/coins/tezos.dart index 0cf344993..96f2acc0d 100644 --- a/lib/wallets/crypto_currency/coins/tezos.dart +++ b/lib/wallets/crypto_currency/coins/tezos.dart @@ -3,14 +3,15 @@ import 'dart:typed_data'; import 'package:bip39/bip39.dart' as bip39; import 'package:coinlib_flutter/coinlib_flutter.dart'; +import 'package:tezart/src/crypto/crypto.dart'; +import 'package:tezart/tezart.dart'; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/node_model.dart'; import '../../../utilities/default_nodes.dart'; import '../../../utilities/enums/derive_path_type_enum.dart'; import '../crypto_currency.dart'; import '../intermediate/bip39_currency.dart'; -import 'package:tezart/src/crypto/crypto.dart'; -import 'package:tezart/tezart.dart'; class Tezos extends Bip39Currency { Tezos(super.network) { @@ -128,12 +129,15 @@ class Tezos extends Bip39Currency { // =========== Private ======================================================= static ({Uint8List privateKey, Uint8List chainCode}) _deriveRootNode( - Uint8List seed) { + Uint8List seed, + ) { return _deriveNode(seed, Uint8List.fromList(utf8.encode("ed25519 seed"))); } static ({Uint8List privateKey, Uint8List chainCode}) _deriveNode( - Uint8List msg, Uint8List key) { + Uint8List msg, + Uint8List key, + ) { final hMac = hmacSha512(key, msg); final privateKey = hMac.sublist(0, 32); final chainCode = hMac.sublist(32); @@ -141,11 +145,13 @@ class Tezos extends Bip39Currency { } static ({Uint8List privateKey, Uint8List chainCode}) _deriveChildNode( - ({Uint8List privateKey, Uint8List chainCode}) node, int index) { - Uint8List indexBuf = Uint8List(4); + ({Uint8List privateKey, Uint8List chainCode}) node, + int index, + ) { + final Uint8List indexBuf = Uint8List(4); ByteData.view(indexBuf.buffer).setUint32(0, index, Endian.big); - Uint8List message = Uint8List.fromList([ + final Uint8List message = Uint8List.fromList([ Uint8List(1)[0], ...node.privateKey, ...indexBuf, diff --git a/lib/wallets/crypto_currency/coins/wownero.dart b/lib/wallets/crypto_currency/coins/wownero.dart index 9b83b9481..c7cb41ff7 100644 --- a/lib/wallets/crypto_currency/coins/wownero.dart +++ b/lib/wallets/crypto_currency/coins/wownero.dart @@ -44,7 +44,7 @@ class Wownero extends CryptonoteCurrency { @override bool validateAddress(String address) { - return wownero_wallet.validateAddress(address); + return wownero_wallet.addressValid(address); } @override diff --git a/lib/wallets/isar/models/wallet_info.dart b/lib/wallets/isar/models/wallet_info.dart index 60a7a1b30..55fc5e8a6 100644 --- a/lib/wallets/isar/models/wallet_info.dart +++ b/lib/wallets/isar/models/wallet_info.dart @@ -81,7 +81,9 @@ class WalletInfo implements IsarId { return Balance.zeroFor(currency: coin); } else { return Balance.fromJson( - cachedBalanceSecondaryString!, coin.fractionDigits); + cachedBalanceSecondaryString!, + coin.fractionDigits, + ); } } @@ -92,7 +94,9 @@ class WalletInfo implements IsarId { return Balance.zeroFor(currency: coin); } else { return Balance.fromJson( - cachedBalanceTertiaryString!, coin.fractionDigits); + cachedBalanceTertiaryString!, + coin.fractionDigits, + ); } } @@ -503,4 +507,7 @@ abstract class WalletInfoKeys { static const String tezosDerivationPath = "tezosDerivationPathKey"; static const String lelantusCoinIsarRescanRequired = "lelantusCoinIsarRescanRequired"; + static const String enableLelantusScanning = "enableLelantusScanningKey"; + static const String firoSparkCacheSetTimestampCache = + "firoSparkCacheSetTimestampCacheKey"; } diff --git a/lib/wallets/isar/providers/eth/token_balance_provider.dart b/lib/wallets/isar/providers/eth/token_balance_provider.dart index 741092387..9a4f054a9 100644 --- a/lib/wallets/isar/providers/eth/token_balance_provider.dart +++ b/lib/wallets/isar/providers/eth/token_balance_provider.dart @@ -1,5 +1,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; + import '../../../../models/balance.dart'; import '../../../../models/isar/models/isar_models.dart'; import '../../../../providers/db/main_db_provider.dart'; @@ -53,7 +54,10 @@ final pTokenWalletInfo = Provider.family( (ref, data) { - return ref.watch(_twiProvider(data).select( - (value) => (value.value as TokenWalletInfo).getCachedBalance())); + return ref.watch( + _twiProvider(data).select( + (value) => (value.value as TokenWalletInfo).getCachedBalance(), + ), + ); }, ); diff --git a/lib/wallets/isar/providers/wallet_info_provider.dart b/lib/wallets/isar/providers/wallet_info_provider.dart index a3ec30e49..b4247dc6f 100644 --- a/lib/wallets/isar/providers/wallet_info_provider.dart +++ b/lib/wallets/isar/providers/wallet_info_provider.dart @@ -1,5 +1,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; + import '../../../models/balance.dart'; import '../../../providers/db/main_db_provider.dart'; import '../../crypto_currency/crypto_currency.dart'; @@ -48,7 +49,8 @@ final pWalletBalanceSecondary = Provider.family( (ref, walletId) { return ref.watch( _wiProvider(walletId).select( - (value) => (value.value as WalletInfo).cachedBalanceSecondary), + (value) => (value.value as WalletInfo).cachedBalanceSecondary, + ), ); }, ); @@ -92,7 +94,8 @@ final pWalletReceivingAddress = Provider.family( (ref, walletId) { return ref.watch( _wiProvider(walletId).select( - (value) => (value.value as WalletInfo).cachedReceivingAddress), + (value) => (value.value as WalletInfo).cachedReceivingAddress, + ), ); }, ); @@ -101,7 +104,8 @@ final pWalletTokenAddresses = Provider.family, String>( (ref, walletId) { return ref.watch( _wiProvider(walletId).select( - (value) => (value.value as WalletInfo).tokenContractAddresses), + (value) => (value.value as WalletInfo).tokenContractAddresses, + ), ); }, ); diff --git a/lib/wallets/wallet/impl/banano_wallet.dart b/lib/wallets/wallet/impl/banano_wallet.dart index 044e31efd..6f6017322 100644 --- a/lib/wallets/wallet/impl/banano_wallet.dart +++ b/lib/wallets/wallet/impl/banano_wallet.dart @@ -1,4 +1,3 @@ -import '../../crypto_currency/coins/banano.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/intermediate/nano_currency.dart'; import '../../isar/models/wallet_info.dart'; diff --git a/lib/wallets/wallet/impl/bitcoin_frost_wallet.dart b/lib/wallets/wallet/impl/bitcoin_frost_wallet.dart index 953a1f0cf..d41d3d4c2 100644 --- a/lib/wallets/wallet/impl/bitcoin_frost_wallet.dart +++ b/lib/wallets/wallet/impl/bitcoin_frost_wallet.dart @@ -21,7 +21,6 @@ import '../../../services/frost.dart'; import '../../../utilities/amount/amount.dart'; import '../../../utilities/extensions/extensions.dart'; import '../../../utilities/logger.dart'; -import '../../crypto_currency/coins/bitcoin_frost.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/intermediate/frost_currency.dart'; import '../../isar/models/frost_wallet_info.dart'; diff --git a/lib/wallets/wallet/impl/bitcoin_wallet.dart b/lib/wallets/wallet/impl/bitcoin_wallet.dart index 207ca30fc..5487d8083 100644 --- a/lib/wallets/wallet/impl/bitcoin_wallet.dart +++ b/lib/wallets/wallet/impl/bitcoin_wallet.dart @@ -1,7 +1,7 @@ import 'package:isar/isar.dart'; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../utilities/amount/amount.dart'; -import '../../crypto_currency/coins/bitcoin.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/interfaces/paynym_currency_interface.dart'; import '../intermediate/bip39_hd_wallet.dart'; @@ -48,8 +48,9 @@ class BitcoinWallet extends Bip39HDWallet Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) { return Amount( rawValue: BigInt.from( - ((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() * - (feeRatePerKB / 1000).ceil()), + ((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() * + (feeRatePerKB / 1000).ceil(), + ), fractionDigits: cryptoCurrency.fractionDigits, ); } diff --git a/lib/wallets/wallet/impl/bitcoincash_wallet.dart b/lib/wallets/wallet/impl/bitcoincash_wallet.dart index 45a81afd2..b00f650f2 100644 --- a/lib/wallets/wallet/impl/bitcoincash_wallet.dart +++ b/lib/wallets/wallet/impl/bitcoincash_wallet.dart @@ -1,18 +1,17 @@ import 'package:bitbox/bitbox.dart' as bitbox; import 'package:isar/isar.dart'; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/transaction.dart'; import '../../../models/isar/models/blockchain_data/v2/input_v2.dart'; import '../../../models/isar/models/blockchain_data/v2/output_v2.dart'; import '../../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; import '../../../services/coins/bitcoincash/bch_utils.dart'; -import '../../../services/coins/bitcoincash/cashtokens.dart' - as cash_tokens; +import '../../../services/coins/bitcoincash/cashtokens.dart' as cash_tokens; import '../../../utilities/amount/amount.dart'; import '../../../utilities/enums/derive_path_type_enum.dart'; import '../../../utilities/extensions/extensions.dart'; import '../../../utilities/logger.dart'; -import '../../crypto_currency/coins/bitcoincash.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/interfaces/electrumx_currency_interface.dart'; import '../intermediate/bip39_hd_wallet.dart'; @@ -76,10 +75,12 @@ class BitcoincashWallet .not() .typeEqualTo(AddressType.nonWallet) .and() - .group((q) => q - .subTypeEqualTo(AddressSubType.receiving) - .or() - .subTypeEqualTo(AddressSubType.change)) + .group( + (q) => q + .subTypeEqualTo(AddressSubType.receiving) + .or() + .subTypeEqualTo(AddressSubType.change), + ) .findAll(); return allAddresses; } @@ -100,14 +101,15 @@ class BitcoincashWallet @override Future updateTransactions() async { - List
allAddressesOld = await fetchAddressesForElectrumXScan(); + final List
allAddressesOld = + await fetchAddressesForElectrumXScan(); - Set receivingAddresses = allAddressesOld + final Set receivingAddresses = allAddressesOld .where((e) => e.subType == AddressSubType.receiving) .map((e) => convertAddressString(e.value)) .toSet(); - Set changeAddresses = allAddressesOld + final Set changeAddresses = allAddressesOld .where((e) => e.subType == AddressSubType.change) .map((e) => convertAddressString(e.value)) .toSet(); @@ -117,7 +119,7 @@ class BitcoincashWallet final List> allTxHashes = await fetchHistory(allAddressesSet); - List> allTransactions = []; + final List> allTransactions = []; for (final txHash in allTxHashes) { // final storedTx = await mainDB.isar.transactionV2s @@ -177,8 +179,9 @@ class BitcoincashWallet try { final prevOutJson = Map.from( - (inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) - as Map); + (inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) + as Map, + ); final prevOut = OutputV2.fromElectrumXJson( prevOutJson, decimalPlaces: cryptoCurrency.fractionDigits, @@ -194,8 +197,9 @@ class BitcoincashWallet addresses.addAll(prevOut.addresses); } catch (e, s) { Logging.instance.log( - "Error getting prevOutJson: $e\nStack trace: $s", - level: LogLevel.Warning); + "Error getting prevOutJson: $e\nStack trace: $s", + level: LogLevel.Warning, + ); } } @@ -360,8 +364,10 @@ class BitcoincashWallet @override Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) { return Amount( - rawValue: BigInt.from(((181 * inputCount) + (34 * outputCount) + 10) * - (feeRatePerKB / 1000).ceil()), + rawValue: BigInt.from( + ((181 * inputCount) + (34 * outputCount) + 10) * + (feeRatePerKB / 1000).ceil(), + ), fractionDigits: info.coin.fractionDigits, ); } diff --git a/lib/wallets/wallet/impl/dogecoin_wallet.dart b/lib/wallets/wallet/impl/dogecoin_wallet.dart index f91cda4e5..2c2dcd309 100644 --- a/lib/wallets/wallet/impl/dogecoin_wallet.dart +++ b/lib/wallets/wallet/impl/dogecoin_wallet.dart @@ -1,4 +1,5 @@ import 'package:isar/isar.dart'; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/transaction.dart'; import '../../../models/isar/models/blockchain_data/v2/input_v2.dart'; @@ -7,7 +8,6 @@ import '../../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; import '../../../utilities/amount/amount.dart'; import '../../../utilities/extensions/extensions.dart'; import '../../../utilities/logger.dart'; -import '../../crypto_currency/coins/dogecoin.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/interfaces/electrumx_currency_interface.dart'; import '../intermediate/bip39_hd_wallet.dart'; @@ -55,14 +55,15 @@ class DogecoinWallet @override Future updateTransactions() async { // Get all addresses. - List
allAddressesOld = await fetchAddressesForElectrumXScan(); + final List
allAddressesOld = + await fetchAddressesForElectrumXScan(); // Separate receiving and change addresses. - Set receivingAddresses = allAddressesOld + final Set receivingAddresses = allAddressesOld .where((e) => e.subType == AddressSubType.receiving) .map((e) => e.value) .toSet(); - Set changeAddresses = allAddressesOld + final Set changeAddresses = allAddressesOld .where((e) => e.subType == AddressSubType.change) .map((e) => e.value) .toSet(); @@ -75,7 +76,7 @@ class DogecoinWallet await fetchHistory(allAddressesSet); // Only parse new txs (not in db yet). - List> allTransactions = []; + final List> allTransactions = []; for (final txHash in allTxHashes) { // Check for duplicates by searching for tx by tx_hash in db. final storedTx = await mainDB.isar.transactionV2s @@ -136,8 +137,8 @@ class DogecoinWallet ); final prevOutJson = Map.from( - (inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) - as Map); + (inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) as Map, + ); final prevOut = OutputV2.fromElectrumXJson( prevOutJson, @@ -211,7 +212,7 @@ class DogecoinWallet .fold(BigInt.zero, (value, element) => value + element); TransactionType type; - TransactionSubType subType = TransactionSubType.none; + final TransactionSubType subType = TransactionSubType.none; // At least one input was owned by this wallet. if (wasSentFromThisWallet) { @@ -277,7 +278,7 @@ class DogecoinWallet // check for bip47 notification final outputs = jsonTX["vout"] as List; for (final output in outputs) { - List? scriptChunks = + final List? scriptChunks = (output['scriptPubKey']?['asm'] as String?)?.split(" "); if (scriptChunks?.length == 2 && scriptChunks?[0] == "OP_RETURN") { final blindedPaymentCode = scriptChunks![1]; @@ -300,8 +301,10 @@ class DogecoinWallet @override Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) { return Amount( - rawValue: BigInt.from(((181 * inputCount) + (34 * outputCount) + 10) * - (feeRatePerKB / 1000).ceil()), + rawValue: BigInt.from( + ((181 * inputCount) + (34 * outputCount) + 10) * + (feeRatePerKB / 1000).ceil(), + ), fractionDigits: cryptoCurrency.fractionDigits, ); } diff --git a/lib/wallets/wallet/impl/ecash_wallet.dart b/lib/wallets/wallet/impl/ecash_wallet.dart index 2a0eeb1e8..53c0f895b 100644 --- a/lib/wallets/wallet/impl/ecash_wallet.dart +++ b/lib/wallets/wallet/impl/ecash_wallet.dart @@ -1,18 +1,17 @@ import 'package:bitbox/bitbox.dart' as bitbox; import 'package:isar/isar.dart'; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/transaction.dart'; import '../../../models/isar/models/blockchain_data/v2/input_v2.dart'; import '../../../models/isar/models/blockchain_data/v2/output_v2.dart'; import '../../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; import '../../../services/coins/bitcoincash/bch_utils.dart'; -import '../../../services/coins/bitcoincash/cashtokens.dart' - as cash_tokens; +import '../../../services/coins/bitcoincash/cashtokens.dart' as cash_tokens; import '../../../utilities/amount/amount.dart'; import '../../../utilities/enums/derive_path_type_enum.dart'; import '../../../utilities/extensions/extensions.dart'; import '../../../utilities/logger.dart'; -import '../../crypto_currency/coins/ecash.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/interfaces/electrumx_currency_interface.dart'; import '../intermediate/bip39_hd_wallet.dart'; @@ -92,14 +91,15 @@ class EcashWallet extends Bip39HDWallet @override Future updateTransactions() async { - List
allAddressesOld = await fetchAddressesForElectrumXScan(); + final List
allAddressesOld = + await fetchAddressesForElectrumXScan(); - Set receivingAddresses = allAddressesOld + final Set receivingAddresses = allAddressesOld .where((e) => e.subType == AddressSubType.receiving) .map((e) => convertAddressString(e.value)) .toSet(); - Set changeAddresses = allAddressesOld + final Set changeAddresses = allAddressesOld .where((e) => e.subType == AddressSubType.change) .map((e) => convertAddressString(e.value)) .toSet(); @@ -109,7 +109,7 @@ class EcashWallet extends Bip39HDWallet final List> allTxHashes = await fetchHistory(allAddressesSet); - List> allTransactions = []; + final List> allTransactions = []; for (final txHash in allTxHashes) { final storedTx = await mainDB.isar.transactionV2s @@ -168,8 +168,8 @@ class EcashWallet extends Bip39HDWallet ); final prevOutJson = Map.from( - (inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) - as Map); + (inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) as Map, + ); final prevOut = OutputV2.fromElectrumXJson( prevOutJson, @@ -351,8 +351,10 @@ class EcashWallet extends Bip39HDWallet @override Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) { return Amount( - rawValue: BigInt.from(((181 * inputCount) + (34 * outputCount) + 10) * - (feeRatePerKB / 1000).ceil()), + rawValue: BigInt.from( + ((181 * inputCount) + (34 * outputCount) + 10) * + (feeRatePerKB / 1000).ceil(), + ), fractionDigits: info.coin.fractionDigits, ); } diff --git a/lib/wallets/wallet/impl/epiccash_wallet.dart b/lib/wallets/wallet/impl/epiccash_wallet.dart index 62b43ff1d..9df6a936a 100644 --- a/lib/wallets/wallet/impl/epiccash_wallet.dart +++ b/lib/wallets/wallet/impl/epiccash_wallet.dart @@ -9,6 +9,8 @@ import 'package:flutter_libepiccash/models/transaction.dart' as epic_models; import 'package:isar/isar.dart'; import 'package:mutex/mutex.dart'; import 'package:stack_wallet_backup/generate_password.dart'; +import 'package:web_socket_channel/web_socket_channel.dart'; + import '../../../models/balance.dart'; import '../../../models/epicbox_config_model.dart'; import '../../../models/isar/models/blockchain_data/address.dart'; @@ -30,12 +32,10 @@ import '../../../utilities/flutter_secure_storage_interface.dart'; import '../../../utilities/logger.dart'; import '../../../utilities/stack_file_system.dart'; import '../../../utilities/test_epic_box_connection.dart'; -import '../../crypto_currency/coins/epiccash.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../models/tx_data.dart'; import '../intermediate/bip39_wallet.dart'; import '../supporting/epiccash_wallet_info_extension.dart'; -import 'package:web_socket_channel/web_socket_channel.dart'; // // refactor of https://github.com/cypherstack/stack_wallet/blob/1d9fb4cd069f22492ece690ac788e05b8f8b1209/lib/services/coins/epiccash/epiccash_wallet.dart @@ -493,11 +493,17 @@ class EpiccashWallet extends Bip39Wallet { final EpicBoxConfigModel epicboxConfig = await getEpicBoxConfig(); await secureStorageInterface.write( - key: '${walletId}_config', value: stringConfig); + key: '${walletId}_config', + value: stringConfig, + ); await secureStorageInterface.write( - key: '${walletId}_password', value: password); + key: '${walletId}_password', + value: password, + ); await secureStorageInterface.write( - key: '${walletId}_epicboxConfig', value: epicboxConfig.toString()); + key: '${walletId}_epicboxConfig', + value: epicboxConfig.toString(), + ); final String name = walletId; @@ -523,7 +529,8 @@ class EpiccashWallet extends Bip39Wallet { // subtract a couple days to ensure we have a buffer for SWB final bufferedCreateHeight = _calculateRestoreHeightFrom( - date: DateTime.now().subtract(const Duration(days: 2))); + date: DateTime.now().subtract(const Duration(days: 2)), + ); final epicData = ExtraEpiccashWalletInfo( receivingIndex: 0, @@ -542,8 +549,9 @@ class EpiccashWallet extends Bip39Wallet { } else { try { Logging.instance.log( - "initializeExisting() ${cryptoCurrency.prettyName} wallet", - level: LogLevel.Info); + "initializeExisting() ${cryptoCurrency.prettyName} wallet", + level: LogLevel.Info, + ); final config = await _getRealConfig(); final password = @@ -554,7 +562,9 @@ class EpiccashWallet extends Bip39Wallet { password: password!, ); await secureStorageInterface.write( - key: '${walletId}_wallet', value: walletOpen); + key: '${walletId}_wallet', + value: walletOpen, + ); await updateNode(); } catch (e, s) { @@ -650,7 +660,8 @@ class EpiccashWallet extends Bip39Wallet { if (feeAmount > info.cachedBalance.spendable) { throw Exception( - "Epic cash prepare send fee is greater than available balance!"); + "Epic cash prepare send fee is greater than available balance!", + ); } if (info.cachedBalance.spendable == recipient.amount) { @@ -742,15 +753,17 @@ class EpiccashWallet extends Bip39Wallet { ); await _generateAndStoreReceivingAddressForIndex( - epicData.receivingIndex); + epicData.receivingIndex, + ); } }); unawaited(refresh()); } catch (e, s) { Logging.instance.log( - "Exception rethrown from electrumx_mixin recover(): $e\n$s", - level: LogLevel.Info); + "Exception rethrown from electrumx_mixin recover(): $e\n$s", + level: LogLevel.Info, + ); rethrow; } @@ -1117,12 +1130,13 @@ class EpiccashWallet extends Bip39Wallet { // this wasn't done before the refactor either so... // TODO: implement _getFees return FeeObject( - numberOfBlocksFast: 10, - numberOfBlocksAverage: 10, - numberOfBlocksSlow: 10, - fast: 1, - medium: 1, - slow: 1); + numberOfBlocksFast: 10, + numberOfBlocksAverage: 10, + numberOfBlocksSlow: 10, + fast: 1, + medium: 1, + slow: 1, + ); } @override diff --git a/lib/wallets/wallet/impl/ethereum_wallet.dart b/lib/wallets/wallet/impl/ethereum_wallet.dart index 05b075868..736f0fb05 100644 --- a/lib/wallets/wallet/impl/ethereum_wallet.dart +++ b/lib/wallets/wallet/impl/ethereum_wallet.dart @@ -5,6 +5,8 @@ import 'package:decimal/decimal.dart'; import 'package:ethereum_addresses/ethereum_addresses.dart'; import 'package:http/http.dart'; import 'package:isar/isar.dart'; +import 'package:web3dart/web3dart.dart' as web3; + import '../../../models/balance.dart'; import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/transaction.dart'; @@ -19,12 +21,10 @@ import '../../../utilities/amount/amount.dart'; import '../../../utilities/enums/fee_rate_type_enum.dart'; import '../../../utilities/eth_commons.dart'; import '../../../utilities/logger.dart'; -import '../../crypto_currency/coins/ethereum.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../models/tx_data.dart'; import '../intermediate/bip39_wallet.dart'; import '../wallet_mixin_interfaces/private_key_interface.dart'; -import 'package:web3dart/web3dart.dart' as web3; // Eth can not use tor with web3dart @@ -142,7 +142,7 @@ class EthereumWallet extends Bip39Wallet with PrivateKeyInterface { @override Future pingCheck() async { - web3.Web3Client client = getEthClient(); + final web3.Web3Client client = getEthClient(); try { await client.getBlockNumber(); return true; @@ -158,7 +158,7 @@ class EthereumWallet extends Bip39Wallet with PrivateKeyInterface { final addressHex = (await getCurrentReceivingAddress())!.value; final address = web3.EthereumAddress.fromHex(addressHex); - web3.EtherAmount ethBalance = await client.getBalance(address); + final web3.EtherAmount ethBalance = await client.getBalance(address); final balance = Balance( total: Amount( rawValue: ethBalance.getInWei, @@ -287,7 +287,7 @@ class EthereumWallet extends Bip39Wallet with PrivateKeyInterface { final List outputs = []; final List inputs = []; - OutputV2 output = OutputV2.isarCantDoRequiredInDefaultConstructor( + final OutputV2 output = OutputV2.isarCantDoRequiredInDefaultConstructor( scriptPubKeyHex: "00", valueStringSats: transactionAmount.raw.toString(), addresses: [ @@ -295,7 +295,7 @@ class EthereumWallet extends Bip39Wallet with PrivateKeyInterface { ], walletOwns: addressTo == thisAddress, ); - InputV2 input = InputV2.isarCantDoRequiredInDefaultConstructor( + final InputV2 input = InputV2.isarCantDoRequiredInDefaultConstructor( scriptSigHex: null, scriptSigAsm: null, sequence: null, @@ -413,8 +413,10 @@ class EthereumWallet extends Bip39Wallet with PrivateKeyInterface { // ); final nonce = txData.nonce ?? - await client.getTransactionCount(myWeb3Address, - atBlock: const web3.BlockNum.pending()); + await client.getTransactionCount( + myWeb3Address, + atBlock: const web3.BlockNum.pending(), + ); // final nResponse = await EthereumAPI.getAddressNonce(address: myAddress); // print("=============================================================="); diff --git a/lib/wallets/wallet/impl/firo_wallet.dart b/lib/wallets/wallet/impl/firo_wallet.dart index 0be178086..9359043be 100644 --- a/lib/wallets/wallet/impl/firo_wallet.dart +++ b/lib/wallets/wallet/impl/firo_wallet.dart @@ -5,6 +5,8 @@ import 'dart:math'; import 'package:decimal/decimal.dart'; import 'package:flutter_libsparkmobile/flutter_libsparkmobile.dart'; import 'package:isar/isar.dart'; + +import '../../../db/sqlite/firo_cache.dart'; import '../../../models/isar/models/blockchain_data/v2/input_v2.dart'; import '../../../models/isar/models/blockchain_data/v2/output_v2.dart'; import '../../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; @@ -13,13 +15,13 @@ import '../../../utilities/amount/amount.dart'; import '../../../utilities/extensions/extensions.dart'; import '../../../utilities/logger.dart'; import '../../../utilities/util.dart'; -import '../../crypto_currency/coins/firo.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/interfaces/electrumx_currency_interface.dart'; import '../../isar/models/spark_coin.dart'; import '../../isar/models/wallet_info.dart'; import '../../models/tx_data.dart'; import '../intermediate/bip39_hd_wallet.dart'; +import '../wallet_mixin_interfaces/coin_control_interface.dart'; import '../wallet_mixin_interfaces/electrumx_interface.dart'; import '../wallet_mixin_interfaces/lelantus_interface.dart'; import '../wallet_mixin_interfaces/spark_interface.dart'; @@ -27,7 +29,11 @@ import '../wallet_mixin_interfaces/spark_interface.dart'; const sparkStartBlock = 819300; // (approx 18 Jan 2024) class FiroWallet extends Bip39HDWallet - with ElectrumXInterface, LelantusInterface, SparkInterface { + with + ElectrumXInterface, + LelantusInterface, + SparkInterface, + CoinControlInterface { // IMPORTANT: The order of the above mixins matters. // SparkInterface MUST come after LelantusInterface. @@ -259,9 +265,9 @@ class FiroWallet extends Bip39HDWallet .toUint8ListFromHex .first; if (opByte == OP_SPARKMINT || opByte == OP_SPARKSMINT) { - final serCoin = base64Encode(output.scriptPubKeyHex - .substring(2, 488) - .toUint8ListFromHex); + final serCoin = base64Encode( + output.scriptPubKeyHex.substring(2, 488).toUint8ListFromHex, + ); final coin = sparkCoinsInvolved .where((e) => e.serializedCoinB64!.startsWith(serCoin)) .firstOrNull; @@ -384,8 +390,8 @@ class FiroWallet extends Bip39HDWallet ); final prevOutJson = Map.from( - (inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) - as Map); + (inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) as Map, + ); final prevOut = OutputV2.fromElectrumXJson( prevOutJson, @@ -587,6 +593,15 @@ class FiroWallet extends Bip39HDWallet @override Future recover({required bool isRescan}) async { + // reset last checked values + await info.updateOtherData( + newEntries: { + WalletInfoKeys.firoSparkCacheSetTimestampCache: {}, + }, + isar: mainDB.isar, + ); + + final start = DateTime.now(); final root = await getRootHDNode(); final List addresses})>> receiveFutures = @@ -604,29 +619,42 @@ class FiroWallet extends Bip39HDWallet if (isRescan) { // clear cache await electrumXCachedClient.clearSharedTransactionCache( - cryptoCurrency: info.coin); + cryptoCurrency: info.coin, + ); // clear blockchain info await mainDB.deleteWalletBlockchainData(walletId); } // lelantus - final latestSetId = await electrumXClient.getLelantusLatestCoinId(); - final setDataMapFuture = getSetDataMap(latestSetId); - final usedSerialNumbersFuture = + int? latestSetId; + final List> lelantusFutures = []; + final enableLelantusScanning = + info.otherData[WalletInfoKeys.enableLelantusScanning] as bool? ?? + false; + if (enableLelantusScanning) { + latestSetId = await electrumXClient.getLelantusLatestCoinId(); + lelantusFutures.add( electrumXCachedClient.getUsedCoinSerials( - cryptoCurrency: info.coin, - ); + cryptoCurrency: info.coin, + ), + ); + lelantusFutures.add(getSetDataMap(latestSetId)); + } // spark final latestSparkCoinId = await electrumXClient.getSparkLatestCoinId(); - final sparkAnonSetFuture = electrumXCachedClient.getSparkAnonymitySet( - groupId: latestSparkCoinId.toString(), - cryptoCurrency: info.coin, - useOnlyCacheIfNotEmpty: false, - ); + final List> sparkAnonSetFutures = []; + for (int i = 1; i <= latestSparkCoinId; i++) { + sparkAnonSetFutures.add( + FiroCacheCoordinator.runFetchAndUpdateSparkAnonSetCacheForGroupId( + i, + electrumXClient, + ), + ); + } final sparkUsedCoinTagsFuture = - electrumXCachedClient.getSparkUsedCoinsTags( - cryptoCurrency: info.coin, + FiroCacheCoordinator.runFetchAndUpdateSparkUsedCoinTags( + electrumXClient, ); // receiving addresses @@ -717,12 +745,16 @@ class FiroWallet extends Bip39HDWallet } // remove extra addresses to help minimize risk of creating a large gap - addressesToStore.removeWhere((e) => - e.subType == AddressSubType.change && - e.derivationIndex > highestChangeIndexWithHistory); - addressesToStore.removeWhere((e) => - e.subType == AddressSubType.receiving && - e.derivationIndex > highestReceivingIndexWithHistory); + addressesToStore.removeWhere( + (e) => + e.subType == AddressSubType.change && + e.derivationIndex > highestChangeIndexWithHistory, + ); + addressesToStore.removeWhere( + (e) => + e.subType == AddressSubType.receiving && + e.derivationIndex > highestReceivingIndexWithHistory, + ); await mainDB.updateOrPutAddresses(addressesToStore); @@ -731,51 +763,61 @@ class FiroWallet extends Bip39HDWallet updateUTXOs(), ]); - final futureResults = await Future.wait([ - usedSerialNumbersFuture, - setDataMapFuture, - sparkAnonSetFuture, - sparkUsedCoinTagsFuture, - ]); + final List> futures = []; + if (enableLelantusScanning) { + futures.add(lelantusFutures[0]); + futures.add(lelantusFutures[1]); + } + futures.add(sparkUsedCoinTagsFuture); + futures.addAll(sparkAnonSetFutures); + + final futureResults = await Future.wait(futures); // lelantus - final usedSerialsSet = (futureResults[0] as List).toSet(); - final setDataMap = futureResults[1] as Map; - - // spark - final sparkAnonymitySet = futureResults[2] as Map; - final sparkSpentCoinTags = futureResults[3] as Set; + Set? usedSerialsSet; + Map? setDataMap; + if (enableLelantusScanning) { + usedSerialsSet = (futureResults[0] as List).toSet(); + setDataMap = futureResults[1] as Map; + } if (Util.isDesktop) { await Future.wait([ - recoverLelantusWallet( - latestSetId: latestSetId, - usedSerialNumbers: usedSerialsSet, - setDataMap: setDataMap, - ), + if (enableLelantusScanning) + recoverLelantusWallet( + latestSetId: latestSetId!, + usedSerialNumbers: usedSerialsSet!, + setDataMap: setDataMap!, + ), recoverSparkWallet( - anonymitySet: sparkAnonymitySet, - spentCoinTags: sparkSpentCoinTags, + latestSparkCoinId: latestSparkCoinId, ), ]); } else { - await recoverLelantusWallet( - latestSetId: latestSetId, - usedSerialNumbers: usedSerialsSet, - setDataMap: setDataMap, - ); + if (enableLelantusScanning) { + await recoverLelantusWallet( + latestSetId: latestSetId!, + usedSerialNumbers: usedSerialsSet!, + setDataMap: setDataMap!, + ); + } await recoverSparkWallet( - anonymitySet: sparkAnonymitySet, - spentCoinTags: sparkSpentCoinTags, + latestSparkCoinId: latestSparkCoinId, ); } }); unawaited(refresh()); + Logging.instance.log( + "Firo recover for " + "${info.name}: ${DateTime.now().difference(start)}", + level: LogLevel.Info, + ); } catch (e, s) { Logging.instance.log( - "Exception rethrown from electrumx_mixin recover(): $e\n$s", - level: LogLevel.Info); + "Exception rethrown from electrumx_mixin recover(): $e\n$s", + level: LogLevel.Info, + ); rethrow; } @@ -784,8 +826,10 @@ class FiroWallet extends Bip39HDWallet @override Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) { return Amount( - rawValue: BigInt.from(((181 * inputCount) + (34 * outputCount) + 10) * - (feeRatePerKB / 1000).ceil()), + rawValue: BigInt.from( + ((181 * inputCount) + (34 * outputCount) + 10) * + (feeRatePerKB / 1000).ceil(), + ), fractionDigits: cryptoCurrency.fractionDigits, ); } diff --git a/lib/wallets/wallet/impl/litecoin_wallet.dart b/lib/wallets/wallet/impl/litecoin_wallet.dart index 0cce6fd8d..97c9bd42c 100644 --- a/lib/wallets/wallet/impl/litecoin_wallet.dart +++ b/lib/wallets/wallet/impl/litecoin_wallet.dart @@ -1,4 +1,5 @@ import 'package:isar/isar.dart'; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/transaction.dart'; import '../../../models/isar/models/blockchain_data/v2/input_v2.dart'; @@ -7,7 +8,6 @@ import '../../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; import '../../../models/isar/ordinal.dart'; import '../../../utilities/amount/amount.dart'; import '../../../utilities/logger.dart'; -import '../../crypto_currency/coins/litecoin.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/interfaces/electrumx_currency_interface.dart'; import '../intermediate/bip39_hd_wallet.dart'; @@ -54,14 +54,15 @@ class LitecoinWallet @override Future updateTransactions() async { // Get all addresses. - List
allAddressesOld = await fetchAddressesForElectrumXScan(); + final List
allAddressesOld = + await fetchAddressesForElectrumXScan(); // Separate receiving and change addresses. - Set receivingAddresses = allAddressesOld + final Set receivingAddresses = allAddressesOld .where((e) => e.subType == AddressSubType.receiving) .map((e) => e.value) .toSet(); - Set changeAddresses = allAddressesOld + final Set changeAddresses = allAddressesOld .where((e) => e.subType == AddressSubType.change) .map((e) => e.value) .toSet(); @@ -78,7 +79,7 @@ class LitecoinWallet await fetchHistory(allAddressesSet); // Only parse new txs (not in db yet). - List> allTransactions = []; + final List> allTransactions = []; for (final txHash in allTxHashes) { // Check for duplicates by searching for tx by tx_hash in db. final storedTx = await mainDB.isar.transactionV2s @@ -141,8 +142,8 @@ class LitecoinWallet ); final prevOutJson = Map.from( - (inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) - as Map); + (inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) as Map, + ); final prevOut = OutputV2.fromElectrumXJson( prevOutJson, @@ -310,8 +311,9 @@ class LitecoinWallet Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) { return Amount( rawValue: BigInt.from( - ((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() * - (feeRatePerKB / 1000).ceil()), + ((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() * + (feeRatePerKB / 1000).ceil(), + ), fractionDigits: cryptoCurrency.fractionDigits, ); } diff --git a/lib/wallets/wallet/impl/monero_wallet.dart b/lib/wallets/wallet/impl/monero_wallet.dart index 7c1007064..9bcb4c3d7 100644 --- a/lib/wallets/wallet/impl/monero_wallet.dart +++ b/lib/wallets/wallet/impl/monero_wallet.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'dart:math'; import 'package:cw_core/monero_transaction_priority.dart'; @@ -18,26 +19,62 @@ import 'package:flutter_libmonero/core/wallet_creation_service.dart'; import 'package:flutter_libmonero/monero/monero.dart' as xmr_dart; import 'package:flutter_libmonero/view_model/send/output.dart' as monero_output; import 'package:isar/isar.dart'; +import 'package:mutex/mutex.dart'; +import 'package:tuple/tuple.dart'; + import '../../../db/hive/db.dart'; import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/transaction.dart'; +import '../../../services/event_bus/events/global/tor_connection_status_changed_event.dart'; +import '../../../services/event_bus/events/global/tor_status_changed_event.dart'; +import '../../../services/event_bus/global_event_bus.dart'; +import '../../../services/tor_service.dart'; import '../../../utilities/amount/amount.dart'; import '../../../utilities/enums/fee_rate_type_enum.dart'; import '../../../utilities/logger.dart'; -import '../../crypto_currency/coins/monero.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../models/tx_data.dart'; import '../intermediate/cryptonote_wallet.dart'; import '../wallet.dart'; import '../wallet_mixin_interfaces/cw_based_interface.dart'; -import 'package:tuple/tuple.dart'; class MoneroWallet extends CryptonoteWallet with CwBasedInterface { - MoneroWallet(CryptoCurrencyNetwork network) : super(Monero(network)); + MoneroWallet(CryptoCurrencyNetwork network) : super(Monero(network)) { + final bus = GlobalEventBus.instance; + + // Listen for tor status changes. + _torStatusListener = bus.on().listen( + (event) async { + switch (event.newStatus) { + case TorConnectionStatus.connecting: + if (!_torConnectingLock.isLocked) { + await _torConnectingLock.acquire(); + } + _requireMutex = true; + break; + + case TorConnectionStatus.connected: + case TorConnectionStatus.disconnected: + if (_torConnectingLock.isLocked) { + _torConnectingLock.release(); + } + _requireMutex = false; + break; + } + }, + ); + + // Listen for tor preference changes. + _torPreferenceListener = bus.on().listen( + (event) async { + await updateNode(); + }, + ); + } @override Address addressFor({required int index, int account = 0}) { - String address = (CwBasedInterface.cwWalletBase as MoneroWalletBase) + final String address = (CwBasedInterface.cwWalletBase as MoneroWalletBase) .getTransactionAddress(account, index); final newReceivingAddress = Address( @@ -89,6 +126,18 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { await updateNode(); + Address? currentAddress = await getCurrentReceivingAddress(); + if (currentAddress == null) { + currentAddress = addressFor(index: 0); + await mainDB.updateOrPutAddresses([currentAddress]); + } + if (info.cachedReceivingAddress != currentAddress.value) { + await info.updateReceivingAddress( + newAddress: currentAddress.value, + isar: mainDB.isar, + ); + } + await CwBasedInterface.cwWalletBase?.startSync(); unawaited(refresh()); autoSaveTimer?.cancel(); @@ -153,13 +202,37 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { final node = getCurrentNode(); final host = Uri.parse(node.host).host; - await CwBasedInterface.cwWalletBase?.connectToNode( - node: Node( - uri: "$host:${node.port}", - type: WalletType.monero, - trusted: node.trusted ?? false, - ), - ); + ({InternetAddress host, int port})? proxy; + if (prefs.useTor) { + proxy = TorService.sharedInstance.getProxyInfo(); + } + if (_requireMutex) { + await _torConnectingLock.protect(() async { + await CwBasedInterface.cwWalletBase?.connectToNode( + node: Node( + uri: "$host:${node.port}", + type: WalletType.monero, + trusted: node.trusted ?? false, + useSSL: node.useSSL, + ), + socksProxyAddress: + proxy == null ? null : "${proxy.host.address}:${proxy.port}", + ); + }); + } else { + await CwBasedInterface.cwWalletBase?.connectToNode( + node: Node( + uri: "$host:${node.port}", + type: WalletType.monero, + trusted: node.trusted ?? false, + useSSL: node.useSSL, + ), + socksProxyAddress: + proxy == null ? null : "${proxy.host.address}:${proxy.port}", + ); + } + + return; } @override @@ -335,7 +408,8 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { // subtract a couple days to ensure we have a buffer for SWB final bufferedCreateHeight = xmr_dart.monero.getHeigthByDate( - date: DateTime.now().subtract(const Duration(days: 2))); + date: DateTime.now().subtract(const Duration(days: 2)), + ); await info.updateRestoreHeight( newRestoreHeight: bufferedCreateHeight, @@ -379,7 +453,7 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { // clear blockchain info await mainDB.deleteWalletBlockchainData(walletId); - var restoreHeight = + final restoreHeight = CwBasedInterface.cwWalletBase?.walletInfo.restoreHeight; highestPercentCached = 0; await CwBasedInterface.cwWalletBase?.rescan(height: restoreHeight ?? 0); @@ -392,7 +466,7 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { final mnemonic = await getMnemonic(); final seedLength = mnemonic.trim().split(" ").length; - if (seedLength != 25) { + if (seedLength != 25 && seedLength != 16) { throw Exception("Invalid monero mnemonic length found: $seedLength"); } @@ -408,7 +482,7 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { .createMoneroWalletService(DB.instance.moneroWalletInfoBox); WalletInfo walletInfo; WalletCredentials credentials; - String name = walletId; + final String name = walletId; final dirPath = await pathForWalletDir(name: name, type: WalletType.monero); final path = await pathForWallet(name: name, type: WalletType.monero); @@ -473,8 +547,9 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { CwBasedInterface.cwWalletBase?.close(); } catch (e, s) { Logging.instance.log( - "Exception rethrown from recoverFromMnemonic(): $e\n$s", - level: LogLevel.Error); + "Exception rethrown from recoverFromMnemonic(): $e\n$s", + level: LogLevel.Error, + ); rethrow; } }); @@ -510,12 +585,12 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { isSendAll = true; } - List outputs = []; + final List outputs = []; for (final recipient in txData.recipients!) { final output = monero_output.Output(CwBasedInterface.cwWalletBase!); output.address = recipient.address; output.sendAll = isSendAll; - String amountToSend = recipient.amount.decimal.toString(); + final String amountToSend = recipient.amount.decimal.toString(); output.setCryptoAmount(amountToSend); outputs.add(output); } @@ -531,11 +606,13 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { CwBasedInterface.cwWalletBase!.createTransaction(tmp); }); } catch (e, s) { - Logging.instance.log("Exception rethrown from prepareSend(): $e\n$s", - level: LogLevel.Warning); + Logging.instance.log( + "Exception rethrown from prepareSend(): $e\n$s", + level: LogLevel.Warning, + ); } - PendingMoneroTransaction pendingMoneroTransaction = + final PendingMoneroTransaction pendingMoneroTransaction = await (awaitPendingTransaction!) as PendingMoneroTransaction; final realFee = Amount.fromDecimal( Decimal.parse(pendingMoneroTransaction.feeFormatted), @@ -550,8 +627,10 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { throw ArgumentError("Invalid fee rate argument provided!"); } } catch (e, s) { - Logging.instance.log("Exception rethrown from prepare send(): $e\n$s", - level: LogLevel.Info); + Logging.instance.log( + "Exception rethrown from prepare send(): $e\n$s", + level: LogLevel.Info, + ); if (e.toString().contains("Incorrect unlocked balance")) { throw Exception("Insufficient balance!"); @@ -569,17 +648,22 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { try { await txData.pendingMoneroTransaction!.commit(); Logging.instance.log( - "transaction ${txData.pendingMoneroTransaction!.id} has been sent", - level: LogLevel.Info); + "transaction ${txData.pendingMoneroTransaction!.id} has been sent", + level: LogLevel.Info, + ); return txData.copyWith(txid: txData.pendingMoneroTransaction!.id); } catch (e, s) { - Logging.instance.log("${info.name} monero confirmSend: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "${info.name} monero confirmSend: $e\n$s", + level: LogLevel.Error, + ); rethrow; } } catch (e, s) { - Logging.instance.log("Exception rethrown from confirmSend(): $e\n$s", - level: LogLevel.Info); + Logging.instance.log( + "Exception rethrown from confirmSend(): $e\n$s", + level: LogLevel.Info, + ); rethrow; } } @@ -617,7 +701,7 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { ?.entries; if (balanceEntries != null) { int bal = 0; - for (var element in balanceEntries) { + for (final element in balanceEntries) { bal = bal + element.value.fullBalance; } return Amount( @@ -630,7 +714,7 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { .transactionHistory! .transactions; int transactionBalance = 0; - for (var tx in transactions!.entries) { + for (final tx in transactions!.entries) { if (tx.value.direction == TransactionDirection.incoming) { transactionBalance += tx.value.amount!; } else { @@ -647,4 +731,12 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { return info.cachedBalance.total; } } + + // ============== Private ==================================================== + + StreamSubscription? _torStatusListener; + StreamSubscription? _torPreferenceListener; + + final Mutex _torConnectingLock = Mutex(); + bool _requireMutex = false; } diff --git a/lib/wallets/wallet/impl/namecoin_wallet.dart b/lib/wallets/wallet/impl/namecoin_wallet.dart index 48321a888..a401d6395 100644 --- a/lib/wallets/wallet/impl/namecoin_wallet.dart +++ b/lib/wallets/wallet/impl/namecoin_wallet.dart @@ -1,4 +1,5 @@ import 'package:isar/isar.dart'; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/transaction.dart'; import '../../../models/isar/models/blockchain_data/v2/input_v2.dart'; @@ -6,14 +7,14 @@ import '../../../models/isar/models/blockchain_data/v2/output_v2.dart'; import '../../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; import '../../../utilities/amount/amount.dart'; import '../../../utilities/logger.dart'; -import '../../crypto_currency/coins/namecoin.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/interfaces/electrumx_currency_interface.dart'; import '../intermediate/bip39_hd_wallet.dart'; import '../wallet_mixin_interfaces/coin_control_interface.dart'; import '../wallet_mixin_interfaces/electrumx_interface.dart'; -class NamecoinWallet extends Bip39HDWallet +class NamecoinWallet + extends Bip39HDWallet with ElectrumXInterface, CoinControlInterface { @override int get isarTransactionVersion => 2; @@ -74,8 +75,9 @@ class NamecoinWallet extends Bip39HDWallet Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) { return Amount( rawValue: BigInt.from( - ((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() * - (feeRatePerKB / 1000).ceil()), + ((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() * + (feeRatePerKB / 1000).ceil(), + ), fractionDigits: cryptoCurrency.fractionDigits, ); } @@ -83,14 +85,15 @@ class NamecoinWallet extends Bip39HDWallet @override Future updateTransactions() async { // Get all addresses. - List
allAddressesOld = await fetchAddressesForElectrumXScan(); + final List
allAddressesOld = + await fetchAddressesForElectrumXScan(); // Separate receiving and change addresses. - Set receivingAddresses = allAddressesOld + final Set receivingAddresses = allAddressesOld .where((e) => e.subType == AddressSubType.receiving) .map((e) => e.value) .toSet(); - Set changeAddresses = allAddressesOld + final Set changeAddresses = allAddressesOld .where((e) => e.subType == AddressSubType.change) .map((e) => e.value) .toSet(); @@ -103,7 +106,7 @@ class NamecoinWallet extends Bip39HDWallet await fetchHistory(allAddressesSet); // Only parse new txs (not in db yet). - List> allTransactions = []; + final List> allTransactions = []; for (final txHash in allTxHashes) { // Check for duplicates by searching for tx by tx_hash in db. final storedTx = await mainDB.isar.transactionV2s @@ -164,8 +167,8 @@ class NamecoinWallet extends Bip39HDWallet ); final prevOutJson = Map.from( - (inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) - as Map); + (inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) as Map, + ); final prevOut = OutputV2.fromElectrumXJson( prevOutJson, @@ -239,7 +242,7 @@ class NamecoinWallet extends Bip39HDWallet .fold(BigInt.zero, (value, element) => value + element); TransactionType type; - TransactionSubType subType = TransactionSubType.none; + final TransactionSubType subType = TransactionSubType.none; // At least one input was owned by this wallet. if (wasSentFromThisWallet) { diff --git a/lib/wallets/wallet/impl/nano_wallet.dart b/lib/wallets/wallet/impl/nano_wallet.dart index e541ad1f7..db66769cf 100644 --- a/lib/wallets/wallet/impl/nano_wallet.dart +++ b/lib/wallets/wallet/impl/nano_wallet.dart @@ -1,4 +1,3 @@ -import '../../crypto_currency/coins/nano.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/intermediate/nano_currency.dart'; import '../intermediate/bip39_wallet.dart'; diff --git a/lib/wallets/wallet/impl/particl_wallet.dart b/lib/wallets/wallet/impl/particl_wallet.dart index 760c88e97..0ce72b393 100644 --- a/lib/wallets/wallet/impl/particl_wallet.dart +++ b/lib/wallets/wallet/impl/particl_wallet.dart @@ -2,6 +2,7 @@ import 'dart:typed_data'; import 'package:bitcoindart/bitcoindart.dart' as bitcoindart; import 'package:isar/isar.dart'; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/transaction.dart'; import '../../../models/isar/models/blockchain_data/v2/input_v2.dart'; @@ -12,7 +13,6 @@ import '../../../utilities/amount/amount.dart'; import '../../../utilities/enums/derive_path_type_enum.dart'; import '../../../utilities/extensions/impl/uint8_list.dart'; import '../../../utilities/logger.dart'; -import '../../crypto_currency/coins/particl.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/interfaces/electrumx_currency_interface.dart'; import '../../models/tx_data.dart'; @@ -120,8 +120,9 @@ class ParticlWallet Amount roughFeeEstimate(int inputCount, int outputCount, int feeRatePerKB) { return Amount( rawValue: BigInt.from( - ((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() * - (feeRatePerKB / 1000).ceil()), + ((42 + (272 * inputCount) + (128 * outputCount)) / 4).ceil() * + (feeRatePerKB / 1000).ceil(), + ), fractionDigits: cryptoCurrency.fractionDigits, ); } @@ -129,14 +130,15 @@ class ParticlWallet @override Future updateTransactions() async { // Get all addresses. - List
allAddressesOld = await fetchAddressesForElectrumXScan(); + final List
allAddressesOld = + await fetchAddressesForElectrumXScan(); // Separate receiving and change addresses. - Set receivingAddresses = allAddressesOld + final Set receivingAddresses = allAddressesOld .where((e) => e.subType == AddressSubType.receiving) .map((e) => e.value) .toSet(); - Set changeAddresses = allAddressesOld + final Set changeAddresses = allAddressesOld .where((e) => e.subType == AddressSubType.change) .map((e) => e.value) .toSet(); @@ -149,7 +151,7 @@ class ParticlWallet await fetchHistory(allAddressesSet); // Only parse new txs (not in db yet). - List> allTransactions = []; + final List> allTransactions = []; for (final txHash in allTxHashes) { // Check for duplicates by searching for tx by tx_hash in db. final storedTx = await mainDB.isar.transactionV2s @@ -210,8 +212,8 @@ class ParticlWallet ); final prevOutJson = Map.from( - (inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) - as Map); + (inputTx["vout"] as List).firstWhere((e) => e["n"] == vout) as Map, + ); final prevOut = _parseOutput( prevOutJson, @@ -285,7 +287,7 @@ class ParticlWallet .fold(BigInt.zero, (value, element) => value + element); TransactionType type; - TransactionSubType subType = TransactionSubType.none; + final TransactionSubType subType = TransactionSubType.none; // Particl has special outputs like confidential amounts. We can check // for them here. They're also checked in checkBlockUTXO. @@ -342,8 +344,10 @@ class ParticlWallet required TxData txData, required List utxoSigningData, }) async { - Logging.instance.log("Starting Particl buildTransaction ----------", - level: LogLevel.Info); + Logging.instance.log( + "Starting Particl buildTransaction ----------", + level: LogLevel.Info, + ); // TODO: use coinlib (For this we need coinlib to support particl) @@ -515,8 +519,10 @@ class ParticlWallet ); } } catch (e, s) { - Logging.instance.log("Caught exception while signing transaction: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "Caught exception while signing transaction: $e\n$s", + level: LogLevel.Error, + ); rethrow; } @@ -530,8 +536,10 @@ class ParticlWallet String hexString = builtTx.toHex(isParticl: true).toString(); if (hexString.length % 2 != 0) { // Ensure the string has an even length. - Logging.instance.log("Hex string has odd length, which is unexpected.", - level: LogLevel.Error); + Logging.instance.log( + "Hex string has odd length, which is unexpected.", + level: LogLevel.Error, + ); throw Exception("Invalid hex string length."); } // int maxStrips = 3; // Strip up to 3 0x00s (match previous particl_wallet). diff --git a/lib/wallets/wallet/impl/peercoin_wallet.dart b/lib/wallets/wallet/impl/peercoin_wallet.dart index b7297dd47..2567e841d 100644 --- a/lib/wallets/wallet/impl/peercoin_wallet.dart +++ b/lib/wallets/wallet/impl/peercoin_wallet.dart @@ -6,7 +6,6 @@ import '../../../models/isar/models/blockchain_data/v2/output_v2.dart'; import '../../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; import '../../../utilities/amount/amount.dart'; import '../../../utilities/logger.dart'; -import '../../crypto_currency/coins/peercoin.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/interfaces/electrumx_currency_interface.dart'; import '../intermediate/bip39_hd_wallet.dart'; diff --git a/lib/wallets/wallet/impl/solana_wallet.dart b/lib/wallets/wallet/impl/solana_wallet.dart index f194dcfee..55ecafade 100644 --- a/lib/wallets/wallet/impl/solana_wallet.dart +++ b/lib/wallets/wallet/impl/solana_wallet.dart @@ -7,9 +7,10 @@ import 'package:isar/isar.dart'; import 'package:socks5_proxy/socks_client.dart'; import 'package:solana/dto.dart'; import 'package:solana/solana.dart'; +import 'package:tuple/tuple.dart'; + import '../../../models/balance.dart'; -import '../../../models/isar/models/blockchain_data/transaction.dart' - as isar; +import '../../../models/isar/models/blockchain_data/transaction.dart' as isar; import '../../../models/isar/models/isar_models.dart'; import '../../../models/node_model.dart'; import '../../../models/paymint/fee_object_model.dart'; @@ -17,11 +18,9 @@ import '../../../services/node_service.dart'; import '../../../services/tor_service.dart'; import '../../../utilities/amount/amount.dart'; import '../../../utilities/logger.dart'; -import '../../crypto_currency/coins/solana.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../models/tx_data.dart'; import '../intermediate/bip39_wallet.dart'; -import 'package:tuple/tuple.dart'; class SolanaWallet extends Bip39Wallet { SolanaWallet(CryptoCurrencyNetwork network) : super(Solana(network)); @@ -63,13 +62,15 @@ class SolanaWallet extends Bip39Wallet { final latestBlockhash = await _rpcClient?.getLatestBlockhash(); final pubKey = (await _getKeyPair()).publicKey; - final compiledMessage = Message(instructions: [ - SystemInstruction.transfer( - fundingAccount: pubKey, - recipientAccount: pubKey, - lamports: transferAmount.raw.toInt(), - ) - ]).compile( + final compiledMessage = Message( + instructions: [ + SystemInstruction.transfer( + fundingAccount: pubKey, + recipientAccount: pubKey, + lamports: transferAmount.raw.toInt(), + ), + ], + ).compile( recentBlockhash: latestBlockhash!.value.blockhash, feePayer: pubKey, ); @@ -119,7 +120,8 @@ class SolanaWallet extends Bip39Wallet { final feeAmount = await _getEstimatedNetworkFee(sendAmount); if (feeAmount == null) { throw Exception( - "Failed to get fees, please check your node connection."); + "Failed to get fees, please check your node connection.", + ); } final address = await getCurrentReceivingAddress(); @@ -128,7 +130,8 @@ class SolanaWallet extends Bip39Wallet { final accInfo = await _rpcClient?.getAccountInfo(address!.value); final int minimumRent = await _rpcClient?.getMinimumBalanceForRentExemption( - accInfo!.value!.data.toString().length) ?? + accInfo!.value!.data.toString().length, + ) ?? 0; // TODO revisit null condition. if (minimumRent > ((await _getCurrentBalanceInLamports()) - @@ -167,11 +170,13 @@ class SolanaWallet extends Bip39Wallet { final message = Message( instructions: [ SystemInstruction.transfer( - fundingAccount: keyPair.publicKey, - recipientAccount: recipientPubKey, - lamports: txData.amount!.raw.toInt()), + fundingAccount: keyPair.publicKey, + recipientAccount: recipientPubKey, + lamports: txData.amount!.raw.toInt(), + ), ComputeBudgetInstruction.setComputeUnitPrice( - microLamports: txData.fee!.raw.toInt() - 5000), + microLamports: txData.fee!.raw.toInt() - 5000, + ), // 5000 lamports is the base fee for a transaction. This instruction adds the necessary fee on top of base fee if it is needed. ComputeBudgetInstruction.setComputeUnitLimit(units: 1000000), // 1000000 is the multiplication number to turn the compute unit price of microLamports to lamports. @@ -230,12 +235,13 @@ class SolanaWallet extends Bip39Wallet { } return FeeObject( - numberOfBlocksFast: 1, - numberOfBlocksAverage: 1, - numberOfBlocksSlow: 1, - fast: fee, - medium: fee, - slow: fee); + numberOfBlocksFast: 1, + numberOfBlocksAverage: 1, + numberOfBlocksSlow: 1, + fast: fee, + medium: fee, + slow: fee, + ); } @override @@ -292,7 +298,8 @@ class SolanaWallet extends Bip39Wallet { // TODO [prio=low]: handle null account info. final int minimumRent = await _rpcClient?.getMinimumBalanceForRentExemption( - accInfo!.value!.data.toString().length) ?? + accInfo!.value!.data.toString().length, + ) ?? 0; // TODO [prio=low]: revisit null condition. final spendableBalance = balance!.value - minimumRent; @@ -366,8 +373,9 @@ class SolanaWallet extends Bip39Wallet { _checkClient(); final transactionsList = await _rpcClient?.getTransactionsList( - (await _getKeyPair()).publicKey, - encoding: Encoding.jsonParsed); + (await _getKeyPair()).publicKey, + encoding: Encoding.jsonParsed, + ); final txsList = List>.empty(growable: true); diff --git a/lib/wallets/wallet/impl/stellar_wallet.dart b/lib/wallets/wallet/impl/stellar_wallet.dart index 3742bc992..09d5d48fa 100644 --- a/lib/wallets/wallet/impl/stellar_wallet.dart +++ b/lib/wallets/wallet/impl/stellar_wallet.dart @@ -5,6 +5,8 @@ import 'dart:io'; import 'package:isar/isar.dart'; import 'package:mutex/mutex.dart'; import 'package:socks5_proxy/socks.dart'; +import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart' as stellar; + import '../../../models/balance.dart'; import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/transaction.dart'; @@ -20,11 +22,9 @@ import '../../../utilities/amount/amount.dart'; import '../../../utilities/enums/fee_rate_type_enum.dart'; import '../../../utilities/logger.dart'; import '../../../utilities/test_stellar_node_connection.dart'; -import '../../crypto_currency/coins/stellar.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../models/tx_data.dart'; import '../intermediate/bip39_wallet.dart'; -import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart' as stellar; class StellarWallet extends Bip39Wallet { StellarWallet(CryptoCurrencyNetwork network) : super(Stellar(network)) { @@ -143,8 +143,9 @@ class StellarWallet extends Bip39Wallet { } } catch (e, s) { Logging.instance.log( - "Error getting account ${e.toString()} - ${s.toString()}", - level: LogLevel.Error); + "Error getting account ${e.toString()} - ${s.toString()}", + level: LogLevel.Error, + ); } return exists; } @@ -235,8 +236,10 @@ class StellarWallet extends Bip39Wallet { ), ); } catch (e, s) { - Logging.instance.log("$runtimeType prepareSend() failed: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "$runtimeType prepareSend() failed: $e\n$s", + level: LogLevel.Error, + ); rethrow; } } @@ -478,10 +481,12 @@ class StellarWallet extends Bip39Wallet { type = TransactionType.incoming; } final amount = Amount( - rawValue: BigInt.parse(float - .parse(por.amount!) - .toStringAsFixed(cryptoCurrency.fractionDigits) - .replaceAll(".", "")), + rawValue: BigInt.parse( + float + .parse(por.amount!) + .toStringAsFixed(cryptoCurrency.fractionDigits) + .replaceAll(".", ""), + ), fractionDigits: cryptoCurrency.fractionDigits, ); @@ -560,10 +565,12 @@ class StellarWallet extends Bip39Wallet { type = TransactionType.incoming; } final amount = Amount( - rawValue: BigInt.parse(float - .parse(caor.startingBalance!) - .toStringAsFixed(cryptoCurrency.fractionDigits) - .replaceAll(".", "")), + rawValue: BigInt.parse( + float + .parse(caor.startingBalance!) + .toStringAsFixed(cryptoCurrency.fractionDigits) + .replaceAll(".", ""), + ), fractionDigits: cryptoCurrency.fractionDigits, ); @@ -640,8 +647,9 @@ class StellarWallet extends Bip39Wallet { await mainDB.updateOrPutTransactionV2s(transactionList); } catch (e, s) { Logging.instance.log( - "Exception rethrown from updateTransactions(): $e\n$s", - level: LogLevel.Error); + "Exception rethrown from updateTransactions(): $e\n$s", + level: LogLevel.Error, + ); rethrow; } } diff --git a/lib/wallets/wallet/impl/tezos_wallet.dart b/lib/wallets/wallet/impl/tezos_wallet.dart index ead0247aa..f4c8c0ebe 100644 --- a/lib/wallets/wallet/impl/tezos_wallet.dart +++ b/lib/wallets/wallet/impl/tezos_wallet.dart @@ -14,7 +14,6 @@ import '../../../utilities/logger.dart'; import '../../api/tezos/tezos_account.dart'; import '../../api/tezos/tezos_api.dart'; import '../../api/tezos/tezos_rpc_api.dart'; -import '../../crypto_currency/coins/tezos.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../isar/models/wallet_info.dart'; import '../../models/tx_data.dart'; diff --git a/lib/wallets/wallet/impl/wownero_wallet.dart b/lib/wallets/wallet/impl/wownero_wallet.dart index 48e2c8508..ced514aa3 100644 --- a/lib/wallets/wallet/impl/wownero_wallet.dart +++ b/lib/wallets/wallet/impl/wownero_wallet.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'dart:math'; import 'package:cw_core/monero_transaction_priority.dart'; @@ -11,7 +12,6 @@ import 'package:cw_core/wallet_credentials.dart'; import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:cw_monero/api/exceptions/creation_transaction_exception.dart'; -import 'package:cw_wownero/api/wallet.dart'; import 'package:cw_wownero/pending_wownero_transaction.dart'; import 'package:cw_wownero/wownero_wallet.dart'; import 'package:decimal/decimal.dart'; @@ -20,26 +20,62 @@ import 'package:flutter_libmonero/view_model/send/output.dart' as wownero_output; import 'package:flutter_libmonero/wownero/wownero.dart' as wow_dart; import 'package:isar/isar.dart'; +import 'package:mutex/mutex.dart'; +import 'package:tuple/tuple.dart'; + import '../../../db/hive/db.dart'; import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/transaction.dart'; +import '../../../services/event_bus/events/global/tor_connection_status_changed_event.dart'; +import '../../../services/event_bus/events/global/tor_status_changed_event.dart'; +import '../../../services/event_bus/global_event_bus.dart'; +import '../../../services/tor_service.dart'; import '../../../utilities/amount/amount.dart'; import '../../../utilities/enums/fee_rate_type_enum.dart'; import '../../../utilities/logger.dart'; -import '../../crypto_currency/coins/wownero.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../models/tx_data.dart'; import '../intermediate/cryptonote_wallet.dart'; import '../wallet.dart'; import '../wallet_mixin_interfaces/cw_based_interface.dart'; -import 'package:tuple/tuple.dart'; class WowneroWallet extends CryptonoteWallet with CwBasedInterface { - WowneroWallet(CryptoCurrencyNetwork network) : super(Wownero(network)); + WowneroWallet(CryptoCurrencyNetwork network) : super(Wownero(network)) { + final bus = GlobalEventBus.instance; + + // Listen for tor status changes. + _torStatusListener = bus.on().listen( + (event) async { + switch (event.newStatus) { + case TorConnectionStatus.connecting: + if (!_torConnectingLock.isLocked) { + await _torConnectingLock.acquire(); + } + _requireMutex = true; + break; + + case TorConnectionStatus.connected: + case TorConnectionStatus.disconnected: + if (_torConnectingLock.isLocked) { + _torConnectingLock.release(); + } + _requireMutex = false; + break; + } + }, + ); + + // Listen for tor preference changes. + _torPreferenceListener = bus.on().listen( + (event) async { + await updateNode(); + }, + ); + } @override Address addressFor({required int index, int account = 0}) { - String address = (CwBasedInterface.cwWalletBase as WowneroWalletBase) + final String address = (CwBasedInterface.cwWalletBase as WowneroWalletBase) .getTransactionAddress(account, index); final newReceivingAddress = Address( @@ -143,13 +179,37 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { final node = getCurrentNode(); final host = Uri.parse(node.host).host; - await CwBasedInterface.cwWalletBase?.connectToNode( - node: Node( - uri: "$host:${node.port}", - type: WalletType.wownero, - trusted: node.trusted ?? false, - ), - ); + ({InternetAddress host, int port})? proxy; + if (prefs.useTor) { + proxy = TorService.sharedInstance.getProxyInfo(); + } + if (_requireMutex) { + await _torConnectingLock.protect(() async { + await CwBasedInterface.cwWalletBase?.connectToNode( + node: Node( + uri: "$host:${node.port}", + type: WalletType.wownero, + trusted: node.trusted ?? false, + useSSL: node.useSSL, + ), + socksProxyAddress: + proxy == null ? null : "${proxy.host.address}:${proxy.port}", + ); + }); + } else { + await CwBasedInterface.cwWalletBase?.connectToNode( + node: Node( + uri: "$host:${node.port}", + type: WalletType.wownero, + trusted: node.trusted ?? false, + useSSL: node.useSSL, + ), + socksProxyAddress: + proxy == null ? null : "${proxy.host.address}:${proxy.port}", + ); + } + + return; } @override @@ -199,7 +259,7 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { final List> txnsData = []; if (transactions != null) { - for (var tx in transactions.entries) { + for (final tx in transactions.entries) { Address? address; TransactionType type; if (tx.value.direction == TransactionDirection.incoming) { @@ -330,7 +390,9 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { // date: DateTime.now().subtract(const Duration( // days: // 2))); // subtract a couple days to ensure we have a buffer for SWB - final bufferedCreateHeight = getSeedHeightSync(wallet!.seed.trim()); + // TODO(mrcyjanek): implement + const bufferedCreateHeight = + 1; //getSeedHeightSync(wallet!.seed.trim()); await info.updateRestoreHeight( newRestoreHeight: bufferedCreateHeight, @@ -390,6 +452,18 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { await updateNode(); + Address? currentAddress = await getCurrentReceivingAddress(); + if (currentAddress == null) { + currentAddress = addressFor(index: 0); + await mainDB.updateOrPutAddresses([currentAddress]); + } + if (info.cachedReceivingAddress != currentAddress.value) { + await info.updateReceivingAddress( + newAddress: currentAddress.value, + isar: mainDB.isar, + ); + } + await (CwBasedInterface.cwWalletBase as WowneroWalletBase?)?.startSync(); unawaited(refresh()); autoSaveTimer?.cancel(); @@ -419,7 +493,7 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { // clear blockchain info await mainDB.deleteWalletBlockchainData(walletId); - var restoreHeight = + final restoreHeight = CwBasedInterface.cwWalletBase?.walletInfo.restoreHeight; highestPercentCached = 0; await CwBasedInterface.cwWalletBase?.rescan(height: restoreHeight ?? 0); @@ -441,7 +515,8 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { // extract seed height from 14 word seed if (seedLength == 14) { - height = getSeedHeightSync(mnemonic.trim()); + // TODO(mrcyjanek): implement + height = 1; // getSeedHeightSync(mnemonic.trim()); } else { height = max(height, 0); } @@ -454,7 +529,7 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { .createWowneroWalletService(DB.instance.moneroWalletInfoBox); WalletInfo walletInfo; WalletCredentials credentials; - String name = walletId; + final String name = walletId; final dirPath = await pathForWalletDir(name: name, type: WalletType.wownero); final path = await pathForWallet(name: name, type: WalletType.wownero); @@ -466,16 +541,17 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { ); try { walletInfo = WalletInfo.external( - id: WalletBase.idFor(name, WalletType.wownero), - name: name, - type: WalletType.wownero, - isRecovery: false, - restoreHeight: credentials.height ?? 0, - date: DateTime.now(), - path: path, - dirPath: dirPath, - // TODO: find out what to put for address - address: ''); + id: WalletBase.idFor(name, WalletType.wownero), + name: name, + type: WalletType.wownero, + isRecovery: false, + restoreHeight: credentials.height ?? 0, + date: DateTime.now(), + path: path, + dirPath: dirPath, + // TODO: find out what to put for address + address: '', + ); credentials.walletInfo = walletInfo; final cwWalletCreationService = WalletCreationService( @@ -519,8 +595,9 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { CwBasedInterface.cwWalletBase?.close(); } catch (e, s) { Logging.instance.log( - "Exception rethrown from recoverFromMnemonic(): $e\n$s", - level: LogLevel.Error); + "Exception rethrown from recoverFromMnemonic(): $e\n$s", + level: LogLevel.Error, + ); rethrow; } }); @@ -556,13 +633,13 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { isSendAll = true; } - List outputs = []; + final List outputs = []; for (final recipient in txData.recipients!) { final output = wownero_output.Output(CwBasedInterface.cwWalletBase!); output.address = recipient.address; output.sendAll = isSendAll; - String amountToSend = recipient.amount.decimal.toString(); + final String amountToSend = recipient.amount.decimal.toString(); output.setCryptoAmount(amountToSend); outputs.add(output); } @@ -578,11 +655,13 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { CwBasedInterface.cwWalletBase!.createTransaction(tmp); }); } catch (e, s) { - Logging.instance.log("Exception rethrown from prepareSend(): $e\n$s", - level: LogLevel.Warning); + Logging.instance.log( + "Exception rethrown from prepareSend(): $e\n$s", + level: LogLevel.Warning, + ); } - PendingWowneroTransaction pendingWowneroTransaction = + final PendingWowneroTransaction pendingWowneroTransaction = await (awaitPendingTransaction!) as PendingWowneroTransaction; final realFee = Amount.fromDecimal( Decimal.parse(pendingWowneroTransaction.feeFormatted), @@ -597,8 +676,10 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { throw ArgumentError("Invalid fee rate argument provided!"); } } catch (e, s) { - Logging.instance.log("Exception rethrown from prepare send(): $e\n$s", - level: LogLevel.Info); + Logging.instance.log( + "Exception rethrown from prepare send(): $e\n$s", + level: LogLevel.Info, + ); if (e.toString().contains("Incorrect unlocked balance")) { throw Exception("Insufficient balance!"); @@ -616,17 +697,22 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { try { await txData.pendingWowneroTransaction!.commit(); Logging.instance.log( - "transaction ${txData.pendingWowneroTransaction!.id} has been sent", - level: LogLevel.Info); + "transaction ${txData.pendingWowneroTransaction!.id} has been sent", + level: LogLevel.Info, + ); return txData.copyWith(txid: txData.pendingWowneroTransaction!.id); } catch (e, s) { - Logging.instance.log("${info.name} wownero confirmSend: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "${info.name} wownero confirmSend: $e\n$s", + level: LogLevel.Error, + ); rethrow; } } catch (e, s) { - Logging.instance.log("Exception rethrown from confirmSend(): $e\n$s", - level: LogLevel.Info); + Logging.instance.log( + "Exception rethrown from confirmSend(): $e\n$s", + level: LogLevel.Info, + ); rethrow; } } @@ -665,7 +751,7 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { ?.entries; if (balanceEntries != null) { int bal = 0; - for (var element in balanceEntries) { + for (final element in balanceEntries) { bal = bal + element.value.fullBalance; } return Amount( @@ -676,7 +762,7 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { final transactions = CwBasedInterface.cwWalletBase!.transactionHistory!.transactions; int transactionBalance = 0; - for (var tx in transactions!.entries) { + for (final tx in transactions!.entries) { if (tx.value.direction == TransactionDirection.incoming) { transactionBalance += tx.value.amount!; } else { @@ -693,4 +779,12 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { return info.cachedBalance.total; } } + + // ============== Private ==================================================== + + StreamSubscription? _torStatusListener; + StreamSubscription? _torPreferenceListener; + + final Mutex _torConnectingLock = Mutex(); + bool _requireMutex = false; } diff --git a/lib/wallets/wallet/intermediate/cryptonote_wallet.dart b/lib/wallets/wallet/intermediate/cryptonote_wallet.dart index 95790a169..aabee237b 100644 --- a/lib/wallets/wallet/intermediate/cryptonote_wallet.dart +++ b/lib/wallets/wallet/intermediate/cryptonote_wallet.dart @@ -7,7 +7,7 @@ import '../wallet_mixin_interfaces/mnemonic_interface.dart'; abstract class CryptonoteWallet extends Wallet with MnemonicInterface { - CryptonoteWallet(T currency) : super(currency); + CryptonoteWallet(super.currency); Completer? walletOpenCompleter; diff --git a/lib/wallets/wallet/wallet.dart b/lib/wallets/wallet/wallet.dart index 36d9130b3..b579f9632 100644 --- a/lib/wallets/wallet/wallet.dart +++ b/lib/wallets/wallet/wallet.dart @@ -1,8 +1,10 @@ import 'dart:async'; +import 'dart:convert'; import 'package:isar/isar.dart'; import 'package:meta/meta.dart'; import 'package:mutex/mutex.dart'; + import '../../db/isar/main_db.dart'; import '../../models/isar/models/blockchain_data/address.dart'; import '../../models/isar/models/ethereum/eth_contract.dart'; @@ -20,25 +22,6 @@ import '../../utilities/flutter_secure_storage_interface.dart'; import '../../utilities/logger.dart'; import '../../utilities/paynym_is_api.dart'; import '../../utilities/prefs.dart'; -import '../crypto_currency/coins/banano.dart'; -import '../crypto_currency/coins/bitcoin.dart'; -import '../crypto_currency/coins/bitcoin_frost.dart'; -import '../crypto_currency/coins/bitcoincash.dart'; -import '../crypto_currency/coins/dogecoin.dart'; -import '../crypto_currency/coins/ecash.dart'; -import '../crypto_currency/coins/epiccash.dart'; -import '../crypto_currency/coins/ethereum.dart'; -import '../crypto_currency/coins/firo.dart'; -import '../crypto_currency/coins/litecoin.dart'; -import '../crypto_currency/coins/monero.dart'; -import '../crypto_currency/coins/namecoin.dart'; -import '../crypto_currency/coins/nano.dart'; -import '../crypto_currency/coins/particl.dart'; -import '../crypto_currency/coins/peercoin.dart'; -import '../crypto_currency/coins/solana.dart'; -import '../crypto_currency/coins/stellar.dart'; -import '../crypto_currency/coins/tezos.dart'; -import '../crypto_currency/coins/wownero.dart'; import '../crypto_currency/crypto_currency.dart'; import '../isar/models/wallet_info.dart'; import '../models/tx_data.dart'; @@ -122,7 +105,8 @@ abstract class Wallet { bool _isConnected = false; void xmrAndWowSyncSpecificFunctionThatShouldBeGottenRidOfInTheFuture( - bool flag) { + bool flag, + ) { _isConnected = flag; } @@ -490,6 +474,7 @@ abstract class Wallet { if (refreshMutex.isLocked) { return; } + final start = DateTime.now(); try { // this acquire should be almost instant due to above check. @@ -575,7 +560,17 @@ abstract class Wallet { // TODO: [prio=low] handle this differently. Extra modification of this file for coin specific functionality should be avoided. if (this is LelantusInterface) { - await (this as LelantusInterface).refreshLelantusData(); + // Parse otherDataJsonString to get the enableLelantusScanning value. + bool enableLelantusScanning = false; + if (this.info.otherDataJsonString != null) { + final otherDataJson = json.decode(this.info.otherDataJsonString!); + enableLelantusScanning = + otherDataJson[WalletInfoKeys.enableLelantusScanning] as bool? ?? + false; + } + if (enableLelantusScanning) { + await (this as LelantusInterface).refreshLelantusData(); + } } GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.90, walletId)); @@ -625,6 +620,12 @@ abstract class Wallet { ); } finally { refreshMutex.release(); + + Logging.instance.log( + "Refresh for " + "${info.name}: ${DateTime.now().difference(start)}", + level: LogLevel.Info, + ); } } diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/bcash_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/bcash_interface.dart index a7a75e397..9559fa848 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/bcash_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/bcash_interface.dart @@ -1,6 +1,7 @@ import 'package:bitbox/bitbox.dart' as bitbox; import 'package:bitbox/src/utils/network.dart' as bitbox_utils; import 'package:isar/isar.dart'; + import '../../../models/isar/models/blockchain_data/v2/input_v2.dart'; import '../../../models/isar/models/blockchain_data/v2/output_v2.dart'; import '../../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; @@ -112,8 +113,10 @@ mixin BCashInterface ); } } catch (e, s) { - Logging.instance.log("Caught exception while signing transaction: $e\n$s", - level: LogLevel.Error); + Logging.instance.log( + "Caught exception while signing transaction: $e\n$s", + level: LogLevel.Error, + ); rethrow; } diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart index 4858c8bdc..c22064d03 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart @@ -5,6 +5,7 @@ import 'package:bitbox/bitbox.dart' as bitbox; import 'package:flutter/foundation.dart'; import 'package:fusiondart/fusiondart.dart' as fusion; import 'package:isar/isar.dart'; + import '../../../models/fusion_progress_ui_state.dart'; import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/transaction.dart'; @@ -13,8 +14,6 @@ import '../../../pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dar import '../../../services/fusion_tor_service.dart'; import '../../../utilities/logger.dart'; import '../../../utilities/stack_file_system.dart'; -import '../../crypto_currency/coins/bitcoincash.dart'; -import '../../crypto_currency/coins/ecash.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/interfaces/electrumx_currency_interface.dart'; import 'coin_control_interface.dart'; @@ -152,88 +151,113 @@ mixin CashFusionInterface switch (status) { case fusion.FusionStatus.connecting: _uiState?.setConnecting( - CashFusionState(status: CashFusionStatus.running, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.running, info: null), + shouldNotify: false, + ); _uiState?.setOutputs( - CashFusionState(status: CashFusionStatus.waiting, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.waiting, info: null), + shouldNotify: false, + ); _uiState?.setPeers( - CashFusionState(status: CashFusionStatus.waiting, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.waiting, info: null), + shouldNotify: false, + ); _uiState?.setFusing( - CashFusionState(status: CashFusionStatus.waiting, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.waiting, info: null), + shouldNotify: false, + ); _uiState?.setComplete( - CashFusionState(status: CashFusionStatus.waiting, info: null), - shouldNotify: true); + CashFusionState(status: CashFusionStatus.waiting, info: null), + shouldNotify: true, + ); break; case fusion.FusionStatus.setup: _uiState?.setConnecting( - CashFusionState(status: CashFusionStatus.success, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.success, info: null), + shouldNotify: false, + ); _uiState?.setOutputs( - CashFusionState(status: CashFusionStatus.running, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.running, info: null), + shouldNotify: false, + ); _uiState?.setPeers( - CashFusionState(status: CashFusionStatus.waiting, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.waiting, info: null), + shouldNotify: false, + ); _uiState?.setFusing( - CashFusionState(status: CashFusionStatus.waiting, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.waiting, info: null), + shouldNotify: false, + ); _uiState?.setComplete( - CashFusionState(status: CashFusionStatus.waiting, info: null), - shouldNotify: true); + CashFusionState(status: CashFusionStatus.waiting, info: null), + shouldNotify: true, + ); break; case fusion.FusionStatus.waiting: _uiState?.setConnecting( - CashFusionState(status: CashFusionStatus.success, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.success, info: null), + shouldNotify: false, + ); _uiState?.setOutputs( - CashFusionState(status: CashFusionStatus.success, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.success, info: null), + shouldNotify: false, + ); _uiState?.setPeers( - CashFusionState(status: CashFusionStatus.running, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.running, info: null), + shouldNotify: false, + ); _uiState?.setFusing( - CashFusionState(status: CashFusionStatus.waiting, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.waiting, info: null), + shouldNotify: false, + ); _uiState?.setComplete( - CashFusionState(status: CashFusionStatus.waiting, info: null), - shouldNotify: true); + CashFusionState(status: CashFusionStatus.waiting, info: null), + shouldNotify: true, + ); break; case fusion.FusionStatus.running: _uiState?.setConnecting( - CashFusionState(status: CashFusionStatus.success, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.success, info: null), + shouldNotify: false, + ); _uiState?.setOutputs( - CashFusionState(status: CashFusionStatus.success, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.success, info: null), + shouldNotify: false, + ); _uiState?.setPeers( - CashFusionState(status: CashFusionStatus.success, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.success, info: null), + shouldNotify: false, + ); _uiState?.setFusing( - CashFusionState(status: CashFusionStatus.running, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.running, info: null), + shouldNotify: false, + ); _uiState?.setComplete( - CashFusionState(status: CashFusionStatus.waiting, info: null), - shouldNotify: true); + CashFusionState(status: CashFusionStatus.waiting, info: null), + shouldNotify: true, + ); break; case fusion.FusionStatus.complete: _uiState?.setConnecting( - CashFusionState(status: CashFusionStatus.success, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.success, info: null), + shouldNotify: false, + ); _uiState?.setOutputs( - CashFusionState(status: CashFusionStatus.success, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.success, info: null), + shouldNotify: false, + ); _uiState?.setPeers( - CashFusionState(status: CashFusionStatus.success, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.success, info: null), + shouldNotify: false, + ); _uiState?.setFusing( - CashFusionState(status: CashFusionStatus.success, info: null), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.success, info: null), + shouldNotify: false, + ); _uiState?.setComplete( - CashFusionState(status: CashFusionStatus.success, info: null), - shouldNotify: true); + CashFusionState(status: CashFusionStatus.success, info: null), + shouldNotify: true, + ); break; case fusion.FusionStatus.failed: failCurrentUiState(info); @@ -243,24 +267,30 @@ mixin CashFusionInterface break; case fusion.FusionStatus.reset: _uiState?.setConnecting( - CashFusionState(status: CashFusionStatus.waiting, info: info), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.waiting, info: info), + shouldNotify: false, + ); _uiState?.setOutputs( - CashFusionState(status: CashFusionStatus.waiting, info: info), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.waiting, info: info), + shouldNotify: false, + ); _uiState?.setPeers( - CashFusionState(status: CashFusionStatus.waiting, info: info), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.waiting, info: info), + shouldNotify: false, + ); _uiState?.setFusing( - CashFusionState(status: CashFusionStatus.waiting, info: info), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.waiting, info: info), + shouldNotify: false, + ); _uiState?.setComplete( - CashFusionState(status: CashFusionStatus.waiting, info: info), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.waiting, info: info), + shouldNotify: false, + ); _uiState?.setFusionState( - CashFusionState(status: CashFusionStatus.waiting, info: info), - shouldNotify: false); + CashFusionState(status: CashFusionStatus.waiting, info: info), + shouldNotify: false, + ); _uiState?.setFailed(false, shouldNotify: true); break; @@ -271,32 +301,37 @@ mixin CashFusionInterface // Check each _uiState value to see if it is running. If so, set it to failed. if (_uiState?.connecting.status == CashFusionStatus.running) { _uiState?.setConnecting( - CashFusionState(status: CashFusionStatus.failed, info: info), - shouldNotify: true); + CashFusionState(status: CashFusionStatus.failed, info: info), + shouldNotify: true, + ); return; } if (_uiState?.outputs.status == CashFusionStatus.running) { _uiState?.setOutputs( - CashFusionState(status: CashFusionStatus.failed, info: info), - shouldNotify: true); + CashFusionState(status: CashFusionStatus.failed, info: info), + shouldNotify: true, + ); return; } if (_uiState?.peers.status == CashFusionStatus.running) { _uiState?.setPeers( - CashFusionState(status: CashFusionStatus.failed, info: info), - shouldNotify: true); + CashFusionState(status: CashFusionStatus.failed, info: info), + shouldNotify: true, + ); return; } if (_uiState?.fusing.status == CashFusionStatus.running) { _uiState?.setFusing( - CashFusionState(status: CashFusionStatus.failed, info: info), - shouldNotify: true); + CashFusionState(status: CashFusionStatus.failed, info: info), + shouldNotify: true, + ); return; } if (_uiState?.complete.status == CashFusionStatus.running) { _uiState?.setComplete( - CashFusionState(status: CashFusionStatus.failed, info: info), - shouldNotify: true); + CashFusionState(status: CashFusionStatus.failed, info: info), + shouldNotify: true, + ); return; } } @@ -329,10 +364,12 @@ mixin CashFusionInterface .and() .derivationPathIsNotNull() .and() - .group((q) => q - .subTypeEqualTo(AddressSubType.receiving) - .or() - .subTypeEqualTo(AddressSubType.change)) + .group( + (q) => q + .subTypeEqualTo(AddressSubType.receiving) + .or() + .subTypeEqualTo(AddressSubType.change), + ) .findAll()) .firstWhere((e) => e.publicKey.toString() == pubKey.toString()) .derivationPath! @@ -406,8 +443,11 @@ mixin CashFusionInterface .where((e) => e.otherData == kReservedFusionAddress) .toList(); - unusedReservedAddresses.addAll(await _reserveAddresses( - unusedChangeAddresses.where((e) => e.otherData == null))); + unusedReservedAddresses.addAll( + await _reserveAddresses( + unusedChangeAddresses.where((e) => e.otherData == null), + ), + ); // Return the list of unused reserved change addresses. return unusedReservedAddresses @@ -570,7 +610,7 @@ mixin CashFusionInterface ); // Use server host and port which ultimately come from text fields. - fusion.FusionParams serverParams = fusion.FusionParams( + final fusion.FusionParams serverParams = fusion.FusionParams( serverHost: fusionInfo.host, serverPort: fusionInfo.port, serverSsl: fusionInfo.ssl, @@ -682,13 +722,17 @@ mixin CashFusionInterface .getAddresses(walletId) .filter() .anyOf>( - possibleAddresses, (q, e) => q.valueEqualTo(e)) + QueryBuilder>( + possibleAddresses, + (q, e) => q.valueEqualTo(e), + ) .and() - .group((q) => q - .subTypeEqualTo(AddressSubType.change) - .or() - .subTypeEqualTo(AddressSubType.receiving)) + .group( + (q) => q + .subTypeEqualTo(AddressSubType.change) + .or() + .subTypeEqualTo(AddressSubType.receiving), + ) .and() .typeEqualTo(AddressType.p2pkh) .findFirst(); @@ -753,8 +797,9 @@ mixin CashFusionInterface if (coinList.isEmpty || e.toString().contains("Started with no coins")) { _updateStatus( - status: fusion.FusionStatus.failed, - info: "Started with no coins, stopping."); + status: fusion.FusionStatus.failed, + info: "Started with no coins, stopping.", + ); _stopRequested = true; _uiState?.setFailed(true, shouldNotify: true); } @@ -762,8 +807,9 @@ mixin CashFusionInterface // If we fail too many times in a row, stop trying. if (_failedFuseCount >= maxFailedFuseCount) { _updateStatus( - status: fusion.FusionStatus.failed, - info: "Failed $maxFailedFuseCount times in a row, stopping."); + status: fusion.FusionStatus.failed, + info: "Failed $maxFailedFuseCount times in a row, stopping.", + ); _stopRequested = true; _uiState?.setFailed(true, shouldNotify: true); } diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/cw_based_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/cw_based_interface.dart index 80a7f6d31..069571ead 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/cw_based_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/cw_based_interface.dart @@ -11,6 +11,7 @@ import 'package:cw_core/wallet_type.dart'; import 'package:flutter_libmonero/core/key_service.dart'; import 'package:isar/isar.dart'; import 'package:mutex/mutex.dart'; + import '../../../models/balance.dart'; import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/paymint/fee_object_model.dart'; @@ -344,7 +345,7 @@ mixin CwBasedInterface on CryptonoteWallet if (entries != null) { for (final element in entries) { if (element.value.direction == TransactionDirection.incoming) { - int curAddressIndex = + final int curAddressIndex = element.value.additionalInfo!['addressIndex'] as int; if (curAddressIndex > highestIndex) { highestIndex = curAddressIndex; @@ -381,13 +382,15 @@ mixin CwBasedInterface on CryptonoteWallet } } on SocketException catch (se, s) { Logging.instance.log( - "SocketException caught in _checkReceivingAddressForTransactions(): $se\n$s", - level: LogLevel.Error); + "SocketException caught in _checkReceivingAddressForTransactions(): $se\n$s", + level: LogLevel.Error, + ); return; } catch (e, s) { Logging.instance.log( - "Exception rethrown from _checkReceivingAddressForTransactions(): $e\n$s", - level: LogLevel.Error); + "Exception rethrown from _checkReceivingAddressForTransactions(): $e\n$s", + level: LogLevel.Error, + ); rethrow; } } diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart index eda467a6a..03eb150ac 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart @@ -4,6 +4,7 @@ import 'dart:typed_data'; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; import 'package:isar/isar.dart'; + import '../../../electrumx_rpc/cached_electrumx_client.dart'; import '../../../electrumx_rpc/client_manager.dart'; import '../../../electrumx_rpc/electrumx_client.dart'; @@ -64,7 +65,10 @@ mixin ElectrumXInterface } Future> - _helperRecipientsConvert(List addrs, List satValues) async { + _helperRecipientsConvert( + List addrs, + List satValues, + ) async { final List<({String address, Amount amount, bool isChange})> results = []; for (int i = 0; i < addrs.length; i++) { @@ -72,7 +76,7 @@ mixin ElectrumXInterface ( address: addrs[i], amount: Amount( - rawValue: BigInt.from(satValues[i]), + rawValue: satValues[i], fractionDigits: cryptoCurrency.fractionDigits, ), isChange: (await mainDB.isar.addresses @@ -105,44 +109,47 @@ mixin ElectrumXInterface // TODO: multiple recipients one day assert(txData.recipients!.length == 1); + if (coinControl && utxos == null) { + throw Exception("Coin control used where utxos is null!"); + } + final recipientAddress = txData.recipients!.first.address; - final satoshiAmountToSend = txData.amount!.raw.toInt(); + final satoshiAmountToSend = txData.amount!.raw; final int? satsPerVByte = txData.satsPerVByte; final selectedTxFeeRate = txData.feeRateAmount!; final List availableOutputs = utxos ?? await mainDB.getUTXOs(walletId).findAll(); final currentChainHeight = await chainHeight; - final List spendableOutputs = []; - int spendableSatoshiValue = 0; - // Build list of spendable outputs and totaling their satoshi amount - for (final utxo in availableOutputs) { - if (utxo.isBlocked == false && - utxo.isConfirmed(currentChainHeight, cryptoCurrency.minConfirms) && - utxo.used != true) { - spendableOutputs.add(utxo); - spendableSatoshiValue += utxo.value; - } + final spendableOutputs = availableOutputs + .where( + (e) => + !e.isBlocked && + (e.used != true) && + e.isConfirmed(currentChainHeight, cryptoCurrency.minConfirms), + ) + .toList(); + final spendableSatoshiValue = + spendableOutputs.fold(BigInt.zero, (p, e) => p + BigInt.from(e.value)); + + if (spendableSatoshiValue < satoshiAmountToSend) { + throw Exception("Insufficient balance"); + } else if (spendableSatoshiValue == satoshiAmountToSend && !isSendAll) { + throw Exception("Insufficient balance to pay transaction fee"); } if (coinControl) { if (spendableOutputs.length < availableOutputs.length) { throw ArgumentError("Attempted to use an unavailable utxo"); } - } - - // don't care about sorting if using all utxos - if (!coinControl) { + // don't care about sorting if using all utxos + } else { // sort spendable by age (oldest first) spendableOutputs.sort( (a, b) => (b.blockTime ?? currentChainHeight) .compareTo((a.blockTime ?? currentChainHeight)), ); - // Null check operator changed to null assignment in order to resolve a - // `Null check operator used on a null value` error. currentChainHeight - // used in order to sort these unconfirmed outputs as the youngest, but we - // could just as well use currentChainHeight + 1. } Logging.instance.log( @@ -161,26 +168,10 @@ mixin ElectrumXInterface ); Logging.instance .log("satoshiAmountToSend: $satoshiAmountToSend", level: LogLevel.Info); - // If the amount the user is trying to send is smaller than the amount that they have spendable, - // then return 1, which indicates that they have an insufficient balance. - if (spendableSatoshiValue < satoshiAmountToSend) { - // return 1; - throw Exception("Insufficient balance"); - // If the amount the user wants to send is exactly equal to the amount they can spend, then return - // 2, which indicates that they are not leaving enough over to pay the transaction fee - } else if (spendableSatoshiValue == satoshiAmountToSend && !isSendAll) { - throw Exception("Insufficient balance to pay transaction fee"); - // return 2; - } - // If neither of these statements pass, we assume that the user has a spendable balance greater - // than the amount they're attempting to send. Note that this value still does not account for - // the added transaction fee, which may require an extra input and will need to be checked for - // later on. - // Possible situation right here - int satoshisBeingUsed = 0; + BigInt satoshisBeingUsed = BigInt.zero; int inputsBeingConsumed = 0; - List utxoObjectsToUse = []; + final List utxoObjectsToUse = []; if (!coinControl) { for (var i = 0; @@ -188,7 +179,7 @@ mixin ElectrumXInterface i < spendableOutputs.length; i++) { utxoObjectsToUse.add(spendableOutputs[i]); - satoshisBeingUsed += spendableOutputs[i].value; + satoshisBeingUsed += BigInt.from(spendableOutputs[i].value); inputsBeingConsumed += 1; } for (int i = 0; @@ -196,12 +187,13 @@ mixin ElectrumXInterface inputsBeingConsumed < spendableOutputs.length; i++) { utxoObjectsToUse.add(spendableOutputs[inputsBeingConsumed]); - satoshisBeingUsed += spendableOutputs[inputsBeingConsumed].value; + satoshisBeingUsed += + BigInt.from(spendableOutputs[inputsBeingConsumed].value); inputsBeingConsumed += 1; } } else { satoshisBeingUsed = spendableSatoshiValue; - utxoObjectsToUse = spendableOutputs; + utxoObjectsToUse.addAll(spendableOutputs); inputsBeingConsumed = spendableOutputs.length; } @@ -214,72 +206,20 @@ mixin ElectrumXInterface // numberOfOutputs' length must always be equal to that of recipientsArray and recipientsAmtArray final List recipientsArray = [recipientAddress]; - final List recipientsAmtArray = [satoshiAmountToSend]; + final List recipientsAmtArray = [satoshiAmountToSend]; // gather required signing data final utxoSigningData = await fetchBuildTxData(utxoObjectsToUse); if (isSendAll) { - Logging.instance - .log("Attempting to send all $cryptoCurrency", level: LogLevel.Info); - if (txData.recipients!.length != 1) { - throw Exception( - "Send all to more than one recipient not yet supported", - ); - } - - final int vSizeForOneOutput = (await buildTransaction( + return await _sendAllBuilder( + txData: txData, + recipientAddress: recipientAddress, + satoshiAmountToSend: satoshiAmountToSend, + satoshisBeingUsed: satoshisBeingUsed, utxoSigningData: utxoSigningData, - txData: txData.copyWith( - recipients: await _helperRecipientsConvert( - [recipientAddress], - [satoshisBeingUsed - 1], - ), - ), - )) - .vSize!; - int feeForOneOutput = satsPerVByte != null - ? (satsPerVByte * vSizeForOneOutput) - : estimateTxFee( - vSize: vSizeForOneOutput, - feeRatePerKB: selectedTxFeeRate, - ); - - if (satsPerVByte == null) { - final int roughEstimate = roughFeeEstimate( - spendableOutputs.length, - 1, - selectedTxFeeRate, - ).raw.toInt(); - if (feeForOneOutput < roughEstimate) { - feeForOneOutput = roughEstimate; - } - } - - final int amount = satoshiAmountToSend - feeForOneOutput; - - if (amount < 0) { - throw Exception( - "Estimated fee ($feeForOneOutput sats) is greater than balance!", - ); - } - - final data = await buildTransaction( - txData: txData.copyWith( - recipients: await _helperRecipientsConvert( - [recipientAddress], - [amount], - ), - ), - utxoSigningData: utxoSigningData, - ); - - return data.copyWith( - fee: Amount( - rawValue: BigInt.from(feeForOneOutput), - fractionDigits: cryptoCurrency.fractionDigits, - ), - usedUTXOs: utxoSigningData.map((e) => e.utxo).toList(), + satsPerVByte: satsPerVByte, + feeRatePerKB: selectedTxFeeRate, ); } @@ -290,7 +230,7 @@ mixin ElectrumXInterface txData: txData.copyWith( recipients: await _helperRecipientsConvert( [recipientAddress], - [satoshisBeingUsed - 1], + [satoshisBeingUsed - BigInt.one], ), ), )) @@ -301,6 +241,9 @@ mixin ElectrumXInterface } final int vSizeForTwoOutPuts; + + BigInt maxBI(BigInt a, BigInt b) => a > b ? a : b; + try { vSizeForTwoOutPuts = (await buildTransaction( utxoSigningData: utxoSigningData, @@ -309,7 +252,10 @@ mixin ElectrumXInterface [recipientAddress, (await getCurrentChangeAddress())!.value], [ satoshiAmountToSend, - max(0, satoshisBeingUsed - satoshiAmountToSend - 1), + maxBI( + BigInt.zero, + satoshisBeingUsed - (satoshiAmountToSend + BigInt.one), + ), ], ), ), @@ -321,53 +267,112 @@ mixin ElectrumXInterface } // Assume 1 output, only for recipient and no change - final feeForOneOutput = satsPerVByte != null - ? (satsPerVByte * vSizeForOneOutput) - : estimateTxFee( - vSize: vSizeForOneOutput, - feeRatePerKB: selectedTxFeeRate, - ); + final feeForOneOutput = BigInt.from( + satsPerVByte != null + ? (satsPerVByte * vSizeForOneOutput) + : estimateTxFee( + vSize: vSizeForOneOutput, + feeRatePerKB: selectedTxFeeRate, + ), + ); // Assume 2 outputs, one for recipient and one for change - final feeForTwoOutputs = satsPerVByte != null - ? (satsPerVByte * vSizeForTwoOutPuts) - : estimateTxFee( - vSize: vSizeForTwoOutPuts, - feeRatePerKB: selectedTxFeeRate, - ); + final feeForTwoOutputs = BigInt.from( + satsPerVByte != null + ? (satsPerVByte * vSizeForTwoOutPuts) + : estimateTxFee( + vSize: vSizeForTwoOutPuts, + feeRatePerKB: selectedTxFeeRate, + ), + ); - Logging.instance - .log("feeForTwoOutputs: $feeForTwoOutputs", level: LogLevel.Info); - Logging.instance - .log("feeForOneOutput: $feeForOneOutput", level: LogLevel.Info); + Logging.instance.log( + "feeForTwoOutputs: $feeForTwoOutputs", + level: LogLevel.Info, + ); + Logging.instance.log( + "feeForOneOutput: $feeForOneOutput", + level: LogLevel.Info, + ); - if (satoshisBeingUsed - satoshiAmountToSend > feeForOneOutput) { - if (satoshisBeingUsed - satoshiAmountToSend > - feeForOneOutput + cryptoCurrency.dustLimit.raw.toInt()) { - // Here, we know that theoretically, we may be able to include another output(change) but we first need to - // factor in the value of this output in satoshis. - final int changeOutputSize = - satoshisBeingUsed - satoshiAmountToSend - feeForTwoOutputs; - // We check to see if the user can pay for the new transaction with 2 outputs instead of one. If they can and - // the second output's size > cryptoCurrency.dustLimit satoshis, we perform the mechanics required to properly generate and use a new - // change address. - if (changeOutputSize > cryptoCurrency.dustLimit.raw.toInt() && - satoshisBeingUsed - satoshiAmountToSend - changeOutputSize == - feeForTwoOutputs) { + final difference = satoshisBeingUsed - satoshiAmountToSend; + + Future singleOutputTxn() async { + Logging.instance.log( + 'Input size: $satoshisBeingUsed', + level: LogLevel.Info, + ); + Logging.instance.log( + 'Recipient output size: $satoshiAmountToSend', + level: LogLevel.Info, + ); + Logging.instance.log( + 'Fee being paid: $difference sats', + level: LogLevel.Info, + ); + Logging.instance.log( + 'Estimated fee: $feeForOneOutput', + level: LogLevel.Info, + ); + final txnData = await buildTransaction( + utxoSigningData: utxoSigningData, + txData: txData.copyWith( + recipients: await _helperRecipientsConvert( + recipientsArray, + recipientsAmtArray, + ), + ), + ); + return txnData.copyWith( + fee: Amount( + rawValue: feeForOneOutput, + fractionDigits: cryptoCurrency.fractionDigits, + ), + usedUTXOs: utxoSigningData.map((e) => e.utxo).toList(), + ); + } + + // no change output required + if (difference == feeForOneOutput) { + Logging.instance.log('1 output in tx', level: LogLevel.Info); + return await singleOutputTxn(); + } else if (difference < feeForOneOutput) { + Logging.instance.log( + 'Cannot pay tx fee - checking for more outputs and trying again', + level: LogLevel.Warning, + ); + // try adding more outputs + if (spendableOutputs.length > inputsBeingConsumed) { + return coinSelection( + txData: txData, + isSendAll: isSendAll, + additionalOutputs: additionalOutputs + 1, + utxos: utxos, + coinControl: coinControl, + ); + } + throw Exception("Insufficient balance to pay transaction fee"); + } else { + if (difference > (feeForOneOutput + cryptoCurrency.dustLimit.raw)) { + final changeOutputSize = difference - feeForTwoOutputs; + // check if possible to add the change output + if (changeOutputSize > cryptoCurrency.dustLimit.raw && + difference - changeOutputSize == feeForTwoOutputs) { // generate new change address if current change address has been used await checkChangeAddressForTransactions(); final String newChangeAddress = (await getCurrentChangeAddress())!.value; - int feeBeingPaid = - satoshisBeingUsed - satoshiAmountToSend - changeOutputSize; + BigInt feeBeingPaid = difference - changeOutputSize; + // add change output recipientsArray.add(newChangeAddress); recipientsAmtArray.add(changeOutputSize); - // At this point, we have the outputs we're going to use, the amounts to send along with which addresses - // we intend to send these amounts to. We have enough to send instructions to build the transaction. + Logging.instance.log('2 outputs in tx', level: LogLevel.Info); - Logging.instance - .log('Input size: $satoshisBeingUsed', level: LogLevel.Info); + Logging.instance.log( + 'Input size: $satoshisBeingUsed', + level: LogLevel.Info, + ); Logging.instance.log( 'Recipient output size: $satoshiAmountToSend', level: LogLevel.Info, @@ -380,10 +385,12 @@ mixin ElectrumXInterface 'Difference (fee being paid): $feeBeingPaid sats', level: LogLevel.Info, ); - Logging.instance - .log('Estimated fee: $feeForTwoOutputs', level: LogLevel.Info); + Logging.instance.log( + 'Estimated fee: $feeForTwoOutputs', + level: LogLevel.Info, + ); - var txn = await buildTransaction( + TxData txnData = await buildTransaction( utxoSigningData: utxoSigningData, txData: txData.copyWith( recipients: await _helperRecipientsConvert( @@ -394,13 +401,12 @@ mixin ElectrumXInterface ); // make sure minimum fee is accurate if that is being used - if (txn.vSize! - feeBeingPaid == 1) { - final int changeOutputSize = - satoshisBeingUsed - satoshiAmountToSend - txn.vSize!; - feeBeingPaid = - satoshisBeingUsed - satoshiAmountToSend - changeOutputSize; + if (BigInt.from(txnData.vSize!) - feeBeingPaid == BigInt.one) { + final changeOutputSize = difference - BigInt.from(txnData.vSize!); + feeBeingPaid = difference - changeOutputSize; recipientsAmtArray.removeLast(); recipientsAmtArray.add(changeOutputSize); + Logging.instance.log( 'Adjusted Input size: $satoshisBeingUsed', level: LogLevel.Info, @@ -421,7 +427,8 @@ mixin ElectrumXInterface 'Adjusted Estimated fee: $feeForTwoOutputs', level: LogLevel.Info, ); - txn = await buildTransaction( + + txnData = await buildTransaction( utxoSigningData: utxoSigningData, txData: txData.copyWith( recipients: await _helperRecipientsConvert( @@ -432,9 +439,9 @@ mixin ElectrumXInterface ); } - return txn.copyWith( + return txnData.copyWith( fee: Amount( - rawValue: BigInt.from(feeBeingPaid), + rawValue: feeBeingPaid, fractionDigits: cryptoCurrency.fractionDigits, ), usedUTXOs: utxoSigningData.map((e) => e.utxo).toList(), @@ -442,126 +449,91 @@ mixin ElectrumXInterface } else { // Something went wrong here. It either overshot or undershot the estimated fee amount or the changeOutputSize // is smaller than or equal to cryptoCurrency.dustLimit. Revert to single output transaction. - Logging.instance.log('1 output in tx', level: LogLevel.Info); - Logging.instance - .log('Input size: $satoshisBeingUsed', level: LogLevel.Info); Logging.instance.log( - 'Recipient output size: $satoshiAmountToSend', + 'Reverting to 1 output in tx', level: LogLevel.Info, ); - Logging.instance.log( - 'Difference (fee being paid): ${satoshisBeingUsed - satoshiAmountToSend} sats', - level: LogLevel.Info, - ); - Logging.instance - .log('Estimated fee: $feeForOneOutput', level: LogLevel.Info); - final txn = await buildTransaction( - utxoSigningData: utxoSigningData, - txData: txData.copyWith( - recipients: await _helperRecipientsConvert( - recipientsArray, - recipientsAmtArray, - ), - ), - ); - return txn.copyWith( - fee: Amount( - rawValue: BigInt.from(satoshisBeingUsed - satoshiAmountToSend), - fractionDigits: cryptoCurrency.fractionDigits, - ), - usedUTXOs: utxoSigningData.map((e) => e.utxo).toList(), - ); + return await singleOutputTxn(); } - } else { - // No additional outputs needed since adding one would mean that it'd be smaller than cryptoCurrency.dustLimit sats - // which makes it uneconomical to add to the transaction. Here, we pass data directly to instruct - // the wallet to begin crafting the transaction that the user requested. - Logging.instance.log('1 output in tx', level: LogLevel.Info); - Logging.instance - .log('Input size: $satoshisBeingUsed', level: LogLevel.Info); - Logging.instance.log( - 'Recipient output size: $satoshiAmountToSend', - level: LogLevel.Info, - ); - Logging.instance.log( - 'Difference (fee being paid): ${satoshisBeingUsed - satoshiAmountToSend} sats', - level: LogLevel.Info, - ); - Logging.instance - .log('Estimated fee: $feeForOneOutput', level: LogLevel.Info); - final txn = await buildTransaction( - utxoSigningData: utxoSigningData, - txData: txData.copyWith( - recipients: await _helperRecipientsConvert( - recipientsArray, - recipientsAmtArray, - ), - ), - ); - - return txn.copyWith( - fee: Amount( - rawValue: BigInt.from(satoshisBeingUsed - satoshiAmountToSend), - fractionDigits: cryptoCurrency.fractionDigits, - ), - usedUTXOs: utxoSigningData.map((e) => e.utxo).toList(), - ); } - } else if (satoshisBeingUsed - satoshiAmountToSend == feeForOneOutput) { - // In this scenario, no additional change output is needed since inputs - outputs equal exactly - // what we need to pay for fees. Here, we pass data directly to instruct the wallet to begin - // crafting the transaction that the user requested. - Logging.instance.log('1 output in tx', level: LogLevel.Info); - Logging.instance - .log('Input size: $satoshisBeingUsed', level: LogLevel.Info); - Logging.instance.log( - 'Recipient output size: $satoshiAmountToSend', - level: LogLevel.Info, - ); - Logging.instance.log( - 'Fee being paid: ${satoshisBeingUsed - satoshiAmountToSend} sats', - level: LogLevel.Info, - ); - Logging.instance - .log('Estimated fee: $feeForOneOutput', level: LogLevel.Info); - final txn = await buildTransaction( - utxoSigningData: utxoSigningData, - txData: txData.copyWith( - recipients: await _helperRecipientsConvert( - recipientsArray, - recipientsAmtArray, - ), - ), - ); - return txn.copyWith( - fee: Amount( - rawValue: BigInt.from(feeForOneOutput), - fractionDigits: cryptoCurrency.fractionDigits, - ), - usedUTXOs: utxoSigningData.map((e) => e.utxo).toList(), - ); - } else { - // Remember that returning 2 indicates that the user does not have a sufficient balance to - // pay for the transaction fee. Ideally, at this stage, we should check if the user has any - // additional outputs they're able to spend and then recalculate fees. - Logging.instance.log( - 'Cannot pay tx fee - checking for more outputs and trying again', - level: LogLevel.Warning, - ); - // try adding more outputs - if (spendableOutputs.length > inputsBeingConsumed) { - return coinSelection( - txData: txData, - isSendAll: isSendAll, - additionalOutputs: additionalOutputs + 1, - utxos: utxos, - coinControl: coinControl, - ); - } - throw Exception("Insufficient balance to pay transaction fee"); - // return 2; } + + return txData; + } + + Future _sendAllBuilder({ + required TxData txData, + required String recipientAddress, + required BigInt satoshiAmountToSend, + required BigInt satoshisBeingUsed, + required List utxoSigningData, + required int? satsPerVByte, + required int feeRatePerKB, + }) async { + Logging.instance + .log("Attempting to send all $cryptoCurrency", level: LogLevel.Info); + if (txData.recipients!.length != 1) { + throw Exception( + "Send all to more than one recipient not yet supported", + ); + } + + final int vSizeForOneOutput = (await buildTransaction( + utxoSigningData: utxoSigningData, + txData: txData.copyWith( + recipients: await _helperRecipientsConvert( + [recipientAddress], + [satoshisBeingUsed - BigInt.one], + ), + ), + )) + .vSize!; + BigInt feeForOneOutput = BigInt.from( + satsPerVByte != null + ? (satsPerVByte * vSizeForOneOutput) + : estimateTxFee( + vSize: vSizeForOneOutput, + feeRatePerKB: feeRatePerKB, + ), + ); + + if (satsPerVByte == null) { + final roughEstimate = roughFeeEstimate( + utxoSigningData.length, + 1, + feeRatePerKB, + ).raw; + if (feeForOneOutput < roughEstimate) { + feeForOneOutput = roughEstimate; + } + } + + final amount = satoshiAmountToSend - feeForOneOutput; + + if (amount.isNegative) { + throw Exception( + "Estimated fee ($feeForOneOutput sats) is greater than balance!", + ); + } + + final data = await buildTransaction( + txData: txData.copyWith( + recipients: await _helperRecipientsConvert( + [recipientAddress], + [amount], + ), + ), + utxoSigningData: utxoSigningData, + ); + + return data.copyWith( + fee: Amount( + rawValue: feeForOneOutput, + fractionDigits: cryptoCurrency.fractionDigits, + ), + usedUTXOs: utxoSigningData.map((e) => e.utxo).toList(), + ); } Future> fetchBuildTxData( diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/lelantus_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/lelantus_interface.dart index 26410c526..9d536197a 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/lelantus_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/lelantus_interface.dart @@ -718,7 +718,7 @@ mixin LelantusInterface ); Logging.instance.log(spendTxs, level: LogLevel.Info); - for (var element in spendTxs.entries) { + for (final element in spendTxs.entries) { final address = element.value.address.value ?? data[element.value.txid]?.item1 ?? element.key; @@ -840,7 +840,7 @@ mixin LelantusInterface amount += signingData[i].utxo.value; } - for (var mintsElement in txData.mintsMapLelantus!) { + for (final mintsElement in txData.mintsMapLelantus!) { Logging.instance.log("using $mintsElement", level: LogLevel.Info); final Uint8List mintu8 = Format.stringToUint8List(mintsElement['script'] as String); @@ -952,7 +952,7 @@ mixin LelantusInterface for (final value in data) { if (value.inputs.isNotEmpty) { - for (var element in value.inputs) { + for (final element in value.inputs) { if (lelantusCoins.any((e) => e.txid == value.txid) && spendableOutputs.firstWhere( (output) => output?.txid == element.txid, diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/ordinals_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/ordinals_interface.dart index da0a36c70..4ca21ef1a 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/ordinals_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/ordinals_interface.dart @@ -1,4 +1,5 @@ import 'package:isar/isar.dart'; + import '../../../dto/ordinals/inscription_data.dart'; import '../../../models/isar/models/blockchain_data/utxo.dart'; import '../../../models/isar/ordinal.dart'; @@ -37,7 +38,8 @@ mixin OrdinalsInterface .addressProperty() .findAll(); final inscriptions = await _getInscriptionDataFromAddresses( - uniqueAddresses.cast()); + uniqueAddresses.cast(), + ); final ords = inscriptions .map((e) => Ordinal.fromInscriptionData(e, walletId)) @@ -111,11 +113,12 @@ mixin OrdinalsInterface // ===================== Private ============================================= Future> _getInscriptionDataFromAddresses( - List addresses) async { - List allInscriptions = []; - for (String address in addresses) { + List addresses, + ) async { + final List allInscriptions = []; + for (final String address in addresses) { try { - var inscriptions = + final inscriptions = await _litescribeAPI.getInscriptionsByAddress(address); allInscriptions.addAll(inscriptions); } catch (e) { diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart index b2114b09b..b9759d474 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart @@ -24,7 +24,6 @@ import '../../../utilities/enums/derive_path_type_enum.dart'; import '../../../utilities/extensions/extensions.dart'; import '../../../utilities/format.dart'; import '../../../utilities/logger.dart'; -import '../../crypto_currency/coins/dogecoin.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/interfaces/paynym_currency_interface.dart'; import '../../models/tx_data.dart'; diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart index 08131fabf..b0409c899 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart @@ -6,6 +6,8 @@ import 'package:decimal/decimal.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter_libsparkmobile/flutter_libsparkmobile.dart'; import 'package:isar/isar.dart'; + +import '../../../db/sqlite/firo_cache.dart'; import '../../../models/balance.dart'; import '../../../models/isar/models/blockchain_data/v2/input_v2.dart'; import '../../../models/isar/models/blockchain_data/v2/output_v2.dart'; @@ -19,6 +21,7 @@ import '../../../utilities/logger.dart'; import '../../crypto_currency/crypto_currency.dart'; import '../../crypto_currency/interfaces/electrumx_currency_interface.dart'; import '../../isar/models/spark_coin.dart'; +import '../../isar/models/wallet_info.dart'; import '../../models/tx_data.dart'; import '../intermediate/bip39_hd_wallet.dart'; import 'electrumx_interface.dart'; @@ -258,17 +261,39 @@ mixin SparkInterface final List> setMaps = []; final List<({int groupId, String blockHash})> idAndBlockHashes = []; for (int i = 1; i <= currentId; i++) { - final set = await electrumXCachedClient.getSparkAnonymitySet( - groupId: i.toString(), - cryptoCurrency: info.coin, - useOnlyCacheIfNotEmpty: true, + final resultSet = await FiroCacheCoordinator.getSetCoinsForGroupId(i); + if (resultSet.isEmpty) { + continue; + } + + final info = await FiroCacheCoordinator.getLatestSetInfoForGroupId( + i, ); - set["coinGroupID"] = i; - setMaps.add(set); + if (info == null) { + throw Exception("The `info` should never be null here"); + } + + final Map setData = { + "blockHash": info.blockHash, + "setHash": info.setHash, + "coinGroupID": i, + "coins": resultSet + .map( + (row) => [ + row["serialized"] as String, + row["txHash"] as String, + row["context"] as String, + ], + ) + .toList(), + }; + + setData["coinGroupID"] = i; + setMaps.add(setData); idAndBlockHashes.add( ( groupId: i, - blockHash: set["blockHash"] as String, + blockHash: setData["blockHash"] as String, ), ); } @@ -606,78 +631,42 @@ mixin SparkInterface } Future refreshSparkData() async { - final sparkAddresses = await mainDB.isar.addresses - .where() - .walletIdEqualTo(walletId) - .filter() - .typeEqualTo(AddressType.spark) - .findAll(); - - final Set paths = - sparkAddresses.map((e) => e.derivationPath!.value).toSet(); - try { - final latestSparkCoinId = await electrumXClient.getSparkLatestCoinId(); - - final anonymitySetFuture = electrumXCachedClient.getSparkAnonymitySet( - groupId: latestSparkCoinId.toString(), - cryptoCurrency: info.coin, - useOnlyCacheIfNotEmpty: false, - ); - - final spentCoinTagsFuture = electrumXCachedClient.getSparkUsedCoinsTags( - cryptoCurrency: info.coin); - - final futureResults = await Future.wait([ - anonymitySetFuture, - spentCoinTagsFuture, - ]); - - final anonymitySet = futureResults[0] as Map; - final spentCoinTags = futureResults[1] as Set; - - final List myCoins = []; - - if (anonymitySet["coins"] is List && - (anonymitySet["coins"] as List).isNotEmpty) { - final root = await getRootHDNode(); - final privateKeyHexSet = paths - .map( - (e) => root.derivePath(e).privateKey.data.toHex, - ) - .toSet(); - - final identifiedCoins = await compute( - _identifyCoins, - ( - anonymitySetCoins: anonymitySet["coins"] as List, - groupId: latestSparkCoinId, - spentCoinTags: spentCoinTags, - privateKeyHexSet: privateKeyHexSet, - walletId: walletId, - isTestNet: cryptoCurrency.network == CryptoCurrencyNetwork.test, - ), - ); - - myCoins.addAll(identifiedCoins); - } - - // check current coins - final currentCoins = await mainDB.isar.sparkCoins - .where() - .walletIdEqualToAnyLTagHash(walletId) - .filter() - .isUsedEqualTo(false) - .findAll(); - for (final coin in currentCoins) { - if (spentCoinTags.contains(coin.lTagHash)) { - myCoins.add(coin.copyWith(isUsed: true)); + // start by checking if any previous sets are missing from db and add the + // missing groupIds to the list if sets to check and update + final latestGroupId = await electrumXClient.getSparkLatestCoinId(); + final List groupIds = []; + if (latestGroupId > 1) { + for (int id = 1; id < latestGroupId; id++) { + final setExists = + await FiroCacheCoordinator.checkSetInfoForGroupIdExists( + id, + ); + if (!setExists) { + groupIds.add(id); + } } } + groupIds.add(latestGroupId); - // update wallet spark coins in isar - await _addOrUpdateSparkCoins(myCoins); + // start fetch and update process for each set groupId as required + final possibleFutures = groupIds.map( + (e) => + FiroCacheCoordinator.runFetchAndUpdateSparkAnonSetCacheForGroupId( + e, + electrumXClient, + ), + ); + // wait for each fetch and update to complete + await Future.wait([ + ...possibleFutures, + FiroCacheCoordinator.runFetchAndUpdateSparkUsedCoinTags( + electrumXClient, + ), + ]); + + await _checkAndUpdateCoins(); // refresh spark balance await refreshSparkBalance(); } catch (e, s) { @@ -735,8 +724,7 @@ mixin SparkInterface /// Should only be called within the standard wallet [recover] function due to /// mutex locking. Otherwise behaviour MAY be undefined. Future recoverSparkWallet({ - required Map anonymitySet, - required Set spentCoinTags, + required int latestSparkCoinId, }) async { // generate spark addresses if non existing if (await getCurrentReceivingSparkAddress() == null) { @@ -744,35 +732,8 @@ mixin SparkInterface await mainDB.putAddress(address); } - final sparkAddresses = await mainDB.isar.addresses - .where() - .walletIdEqualTo(walletId) - .filter() - .typeEqualTo(AddressType.spark) - .findAll(); - - final Set paths = - sparkAddresses.map((e) => e.derivationPath!.value).toSet(); - try { - final root = await getRootHDNode(); - final privateKeyHexSet = - paths.map((e) => root.derivePath(e).privateKey.data.toHex).toSet(); - - final myCoins = await compute( - _identifyCoins, - ( - anonymitySetCoins: anonymitySet["coins"] as List, - groupId: anonymitySet["coinGroupID"] as int, - spentCoinTags: spentCoinTags, - privateKeyHexSet: privateKeyHexSet, - walletId: walletId, - isTestNet: cryptoCurrency.network == CryptoCurrencyNetwork.test, - ), - ); - - // update wallet spark coins in isar - await _addOrUpdateSparkCoins(myCoins); + await _checkAndUpdateCoins(); // refresh spark balance await refreshSparkBalance(); @@ -785,6 +746,115 @@ mixin SparkInterface } } + Future _checkAndUpdateCoins() async { + final sparkAddresses = await mainDB.isar.addresses + .where() + .walletIdEqualTo(walletId) + .filter() + .typeEqualTo(AddressType.spark) + .findAll(); + final root = await getRootHDNode(); + final Set privateKeyHexSet = sparkAddresses + .map( + (e) => root.derivePath(e.derivationPath!.value).privateKey.data.toHex, + ) + .toSet(); + + final Map>> rawCoinsBySetId = {}; + + final groupIdTimestampUTCMap = + info.otherData[WalletInfoKeys.firoSparkCacheSetTimestampCache] + as Map? ?? + {}; + + final latestSparkCoinId = await electrumXClient.getSparkLatestCoinId(); + for (int i = 1; i <= latestSparkCoinId; i++) { + final lastCheckedTimeStampUTC = + groupIdTimestampUTCMap[i.toString()] as int? ?? 0; + final info = await FiroCacheCoordinator.getLatestSetInfoForGroupId( + i, + ); + final anonymitySetResult = + await FiroCacheCoordinator.getSetCoinsForGroupId( + i, + newerThanTimeStamp: lastCheckedTimeStampUTC, + ); + final coinsRaw = anonymitySetResult + .map( + (row) => [ + row["serialized"] as String, + row["txHash"] as String, + row["context"] as String, + ], + ) + .toList(); + + if (coinsRaw.isNotEmpty) { + rawCoinsBySetId[i] = coinsRaw; + } + + groupIdTimestampUTCMap[i.toString()] = max( + lastCheckedTimeStampUTC, + info?.timestampUTC ?? lastCheckedTimeStampUTC, + ); + } + + await info.updateOtherData( + newEntries: { + WalletInfoKeys.firoSparkCacheSetTimestampCache: groupIdTimestampUTCMap, + }, + isar: mainDB.isar, + ); + + final List newlyIdCoins = []; + for (final groupId in rawCoinsBySetId.keys) { + final myCoins = await compute( + _identifyCoins, + ( + anonymitySetCoins: rawCoinsBySetId[groupId]!, + groupId: groupId, + privateKeyHexSet: privateKeyHexSet, + walletId: walletId, + isTestNet: cryptoCurrency.network == CryptoCurrencyNetwork.test, + ), + ); + newlyIdCoins.addAll(myCoins); + } + + await _checkAndMarkCoinsUsedInDB(coinsNotInDbYet: newlyIdCoins); + } + + Future _checkAndMarkCoinsUsedInDB({ + List coinsNotInDbYet = const [], + }) async { + final List coins = await mainDB.isar.sparkCoins + .where() + .walletIdEqualToAnyLTagHash(walletId) + .filter() + .isUsedEqualTo(false) + .findAll(); + + final List coinsToWrite = []; + + final spentCoinTags = await FiroCacheCoordinator.getUsedCoinTags(0); + + for (final coin in coins) { + if (spentCoinTags.contains(coin.lTagHash)) { + coinsToWrite.add(coin.copyWith(isUsed: true)); + } + } + for (final coin in coinsNotInDbYet) { + if (spentCoinTags.contains(coin.lTagHash)) { + coinsToWrite.add(coin.copyWith(isUsed: true)); + } else { + coinsToWrite.add(coin); + } + } + + // update wallet spark coins in isar + await _addOrUpdateSparkCoins(coinsToWrite); + } + // modelled on CSparkWallet::CreateSparkMintTransactions https://github.com/firoorg/firo/blob/39c41e5e7ec634ced3700fe3f4f5509dc2e480d0/src/spark/sparkwallet.cpp#L752 Future> _createSparkMintTransactions({ required List availableUtxos, @@ -1628,12 +1698,6 @@ mixin SparkInterface ); } -String base64ToReverseHex(String source) => - base64Decode(LineSplitter.split(source).join()) - .reversed - .map((e) => e.toRadixString(16).padLeft(2, '0')) - .join(); - /// Top level function which should be called wrapped in [compute] Future< ({ @@ -1699,7 +1763,6 @@ Future> _identifyCoins( ({ List anonymitySetCoins, int groupId, - Set spentCoinTags, Set privateKeyHexSet, String walletId, bool isTestNet, @@ -1716,7 +1779,7 @@ Future> _identifyCoins( } final serializedCoinB64 = data[0]; - final txHash = base64ToReverseHex(data[1]); + final txHash = data[1].toHexReversedFromBase64; final contextB64 = data[2]; final coin = LibSpark.identifyAndRecoverCoin( @@ -1742,7 +1805,7 @@ Future> _identifyCoins( SparkCoin( walletId: args.walletId, type: coinType, - isUsed: args.spentCoinTags.contains(coin.lTagHash!), + isUsed: false, groupId: args.groupId, nonce: coin.nonceHex?.toUint8ListFromHex, address: coin.address!, diff --git a/lib/widgets/address_book_card.dart b/lib/widgets/address_book_card.dart index 51a9fe134..9c9254080 100644 --- a/lib/widgets/address_book_card.dart +++ b/lib/widgets/address_book_card.dart @@ -61,8 +61,10 @@ class _AddressBookCardState extends ConsumerState { // provider hack to prevent trying to update widget with deleted contact ContactEntry? _contact; try { - _contact = ref.watch(addressBookServiceProvider - .select((value) => value.getContactById(contactId))); + _contact = ref.watch( + addressBookServiceProvider + .select((value) => value.getContactById(contactId)), + ); } catch (_) { return Container(); } diff --git a/lib/widgets/animated_text.dart b/lib/widgets/animated_text.dart index 136da21c6..428cb8544 100644 --- a/lib/widgets/animated_text.dart +++ b/lib/widgets/animated_text.dart @@ -14,11 +14,11 @@ import 'package:flutter/cupertino.dart'; class AnimatedText extends StatefulWidget { const AnimatedText({ - Key? key, + super.key, required this.stringsToLoopThrough, required this.style, this.duration = const Duration(milliseconds: 700), - }) : super(key: key); + }); final List stringsToLoopThrough; final TextStyle style; diff --git a/lib/widgets/animated_widgets/rotate_icon.dart b/lib/widgets/animated_widgets/rotate_icon.dart index 2b54b1367..92b428d9e 100644 --- a/lib/widgets/animated_widgets/rotate_icon.dart +++ b/lib/widgets/animated_widgets/rotate_icon.dart @@ -18,13 +18,13 @@ class RotateIconController { class RotateIcon extends StatefulWidget { const RotateIcon({ - Key? key, + super.key, required this.icon, required this.curve, this.controller, this.animationDurationMultiplier = 1.0, this.rotationPercent = 0.5, - }) : super(key: key); + }); final Widget icon; final Curve curve; diff --git a/lib/widgets/animated_widgets/rotating_arrows.dart b/lib/widgets/animated_widgets/rotating_arrows.dart index c0025a45a..3da54f63a 100644 --- a/lib/widgets/animated_widgets/rotating_arrows.dart +++ b/lib/widgets/animated_widgets/rotating_arrows.dart @@ -23,13 +23,13 @@ class RotatingArrowsController { class RotatingArrows extends StatefulWidget { const RotatingArrows({ - Key? key, + super.key, required this.height, required this.width, this.controller, this.color, this.spinByDefault = true, - }) : super(key: key); + }); final double height; final double width; diff --git a/lib/widgets/app_bar_field.dart b/lib/widgets/app_bar_field.dart index d48b20ee9..8499748a9 100644 --- a/lib/widgets/app_bar_field.dart +++ b/lib/widgets/app_bar_field.dart @@ -13,10 +13,10 @@ import '../utilities/text_styles.dart'; class AppBarSearchField extends StatefulWidget { const AppBarSearchField({ - Key? key, + super.key, required this.controller, this.focusNode, - }) : super(key: key); + }); final TextEditingController? controller; final FocusNode? focusNode; diff --git a/lib/widgets/background.dart b/lib/widgets/background.dart index 3d27b24b1..11290a9df 100644 --- a/lib/widgets/background.dart +++ b/lib/widgets/background.dart @@ -19,9 +19,9 @@ import 'conditional_parent.dart'; class Background extends ConsumerWidget { const Background({ - Key? key, + super.key, required this.child, - }) : super(key: key); + }); final Widget child; diff --git a/lib/widgets/choose_coin_view.dart b/lib/widgets/choose_coin_view.dart index b1238fb6a..b44f7152a 100644 --- a/lib/widgets/choose_coin_view.dart +++ b/lib/widgets/choose_coin_view.dart @@ -148,7 +148,7 @@ class _ChooseCoinViewState extends ConsumerState { style: STextStyles.titleBold12(context), ), ], - ) + ), ], ), ), diff --git a/lib/widgets/conditional_parent.dart b/lib/widgets/conditional_parent.dart index e664c581e..64a3f8876 100644 --- a/lib/widgets/conditional_parent.dart +++ b/lib/widgets/conditional_parent.dart @@ -12,11 +12,11 @@ import 'package:flutter/material.dart'; class ConditionalParent extends StatelessWidget { const ConditionalParent({ - Key? key, + super.key, required this.condition, required this.builder, required this.child, - }) : super(key: key); + }); final bool condition; final Widget Function(Widget) builder; @@ -34,12 +34,12 @@ class ConditionalParent extends StatelessWidget { class BranchedParent extends StatelessWidget { const BranchedParent({ - Key? key, + super.key, required this.condition, required this.conditionBranchBuilder, required this.otherBranchBuilder, required this.children, - }) : super(key: key); + }); final bool condition; final Widget Function(List) conditionBranchBuilder; diff --git a/lib/widgets/custom_buttons/app_bar_icon_button.dart b/lib/widgets/custom_buttons/app_bar_icon_button.dart index 5327d298f..5147f132d 100644 --- a/lib/widgets/custom_buttons/app_bar_icon_button.dart +++ b/lib/widgets/custom_buttons/app_bar_icon_button.dart @@ -10,13 +10,14 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; + import '../../themes/stack_colors.dart'; import '../../utilities/assets.dart'; import '../../utilities/util.dart'; class AppBarIconButton extends StatelessWidget { const AppBarIconButton({ - Key? key, + super.key, required this.icon, required this.onPressed, this.color, @@ -24,7 +25,7 @@ class AppBarIconButton extends StatelessWidget { this.size = 36.0, this.shadows = const [], this.semanticsLabel = "Button", - }) : super(key: key); + }); final Widget icon; final VoidCallback? onPressed; @@ -37,40 +38,40 @@ class AppBarIconButton extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - height: size, - width: size, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1000), - color: - color ?? Theme.of(context).extension()!.background, - boxShadow: shadows, - ), - child: Semantics( - excludeSemantics: true, - label: semanticsLabel, - child: MaterialButton( - splashColor: Theme.of(context).extension()!.highlight, - padding: EdgeInsets.zero, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(1000), - ), - onPressed: onPressed, - child: icon, + height: size, + width: size, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1000), + color: color ?? Theme.of(context).extension()!.background, + boxShadow: shadows, + ), + child: Semantics( + excludeSemantics: true, + label: semanticsLabel, + child: MaterialButton( + splashColor: Theme.of(context).extension()!.highlight, + padding: EdgeInsets.zero, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(1000), ), - )); + onPressed: onPressed, + child: icon, + ), + ), + ); } } class AppBarBackButton extends StatelessWidget { const AppBarBackButton({ - Key? key, + super.key, this.onPressed, this.isCompact = false, this.size, this.iconSize, this.semanticsLabel = "Back Button. Takes Back To Previous Page.", - }) : super(key: key); + }); final VoidCallback? onPressed; final bool isCompact; @@ -82,32 +83,32 @@ class AppBarBackButton extends StatelessWidget { Widget build(BuildContext context) { final isDesktop = Util.isDesktop; return Padding( - padding: isDesktop - ? const EdgeInsets.symmetric( - vertical: 20, - horizontal: 24, - ) - : const EdgeInsets.all(10), - child: AppBarIconButton( - semanticsLabel: semanticsLabel, - size: size ?? - (isDesktop - ? isCompact - ? 42 - : 56 - : 32), - color: isDesktop - ? Theme.of(context).extension()!.textFieldDefaultBG - : Theme.of(context).extension()!.background, - shadows: const [], - icon: SvgPicture.asset( - Assets.svg.arrowLeft, - width: iconSize ?? (isCompact ? 18 : 24), - height: iconSize ?? (isCompact ? 18 : 24), - color: - Theme.of(context).extension()!.topNavIconPrimary, - ), - onPressed: onPressed ?? Navigator.of(context).pop, - )); + padding: isDesktop + ? const EdgeInsets.symmetric( + vertical: 20, + horizontal: 24, + ) + : const EdgeInsets.all(10), + child: AppBarIconButton( + semanticsLabel: semanticsLabel, + size: size ?? + (isDesktop + ? isCompact + ? 42 + : 56 + : 32), + color: isDesktop + ? Theme.of(context).extension()!.textFieldDefaultBG + : Theme.of(context).extension()!.background, + shadows: const [], + icon: SvgPicture.asset( + Assets.svg.arrowLeft, + width: iconSize ?? (isCompact ? 18 : 24), + height: iconSize ?? (isCompact ? 18 : 24), + color: Theme.of(context).extension()!.topNavIconPrimary, + ), + onPressed: onPressed ?? Navigator.of(context).pop, + ), + ); } } diff --git a/lib/widgets/custom_buttons/blue_text_button.dart b/lib/widgets/custom_buttons/blue_text_button.dart index 8639fc1b1..eee64d8e0 100644 --- a/lib/widgets/custom_buttons/blue_text_button.dart +++ b/lib/widgets/custom_buttons/blue_text_button.dart @@ -18,14 +18,14 @@ import '../rounded_container.dart'; class _CustomTextButton extends StatefulWidget { const _CustomTextButton({ - Key? key, + super.key, required this.text, required this.enabledColor, required this.disabledColor, this.onTap, this.enabled = true, this.textSize, - }) : super(key: key); + }); final String text; final VoidCallback? onTap; @@ -128,12 +128,12 @@ class _CustomTextButtonState extends State<_CustomTextButton> class CustomTextButton extends StatelessWidget { const CustomTextButton({ - Key? key, + super.key, required this.text, this.onTap, this.enabled = true, this.textSize, - }) : super(key: key); + }); final String text; final VoidCallback? onTap; diff --git a/lib/widgets/custom_buttons/draggable_switch_button.dart b/lib/widgets/custom_buttons/draggable_switch_button.dart index 6d77e720c..47e706704 100644 --- a/lib/widgets/custom_buttons/draggable_switch_button.dart +++ b/lib/widgets/custom_buttons/draggable_switch_button.dart @@ -9,18 +9,19 @@ */ import 'package:flutter/material.dart'; + import '../../themes/stack_colors.dart'; class DraggableSwitchButton extends StatefulWidget { const DraggableSwitchButton({ - Key? key, + super.key, this.onItem, this.offItem, this.onValueChanged, required this.isOn, this.enabled = true, this.controller, - }) : super(key: key); + }); final Widget? onItem; final Widget? offItem; @@ -131,7 +132,7 @@ class DraggableSwitchButtonState extends State { .clamp(0.0, 1.0); }, onHorizontalDragEnd: (details) { - bool oldValue = _isOn; + final bool oldValue = _isOn; if (valueListener.value > 0.5) { valueListener.value = 1.0; _isOn = true; @@ -158,7 +159,10 @@ class DraggableSwitchButtonState extends State { constraint.maxHeight / 2, ), color: _colorFG( - _isOn, _enabled, valueListener.value), + _isOn, + _enabled, + valueListener.value, + ), ), ); }, diff --git a/lib/widgets/custom_buttons/dropdown_button.dart b/lib/widgets/custom_buttons/dropdown_button.dart index 6ee148a22..b2044376a 100644 --- a/lib/widgets/custom_buttons/dropdown_button.dart +++ b/lib/widgets/custom_buttons/dropdown_button.dart @@ -10,18 +10,19 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../../themes/stack_colors.dart'; import '../../utilities/assets.dart'; import '../../utilities/constants.dart'; import '../../utilities/text_styles.dart'; import '../animated_widgets/rotate_icon.dart'; -import 'app_bar_icon_button.dart'; import '../desktop/secondary_button.dart'; import '../rounded_white_container.dart'; +import 'app_bar_icon_button.dart'; class JDropdownButton extends StatefulWidget { const JDropdownButton({ - Key? key, + super.key, this.label, required this.items, this.width, @@ -29,7 +30,7 @@ class JDropdownButton extends StatefulWidget { this.groupValue, this.redrawOnScreenSizeChanged = false, this.showIcon = false, - }) : super(key: key); + }); final String? label; final double? width; @@ -137,14 +138,14 @@ class _JDropdownButtonState extends State> { class JDropdownIconButton extends StatefulWidget { const JDropdownIconButton({ - Key? key, + super.key, required this.items, required this.displayPrefix, this.onSelectionChanged, this.groupValue, this.redrawOnScreenSizeChanged = false, this.mobileAppBar = false, - }) : super(key: key); + }); final String displayPrefix; final void Function(T?)? onSelectionChanged; @@ -275,12 +276,12 @@ class _JDropdownIconButtonState extends State> { // ============================================================================= class _JDropdownButtonMenu extends StatefulWidget { - const _JDropdownButtonMenu( - {Key? key, - required this.items, - required this.size, - required this.position}) - : super(key: key); + const _JDropdownButtonMenu({ + super.key, + required this.items, + required this.size, + required this.position, + }); final List<_JDropdownButtonItem> items; final Size size; @@ -335,13 +336,13 @@ class _JDropdownButtonMenuState extends State<_JDropdownButtonMenu> { class _JDropdownButtonItem extends StatelessWidget { const _JDropdownButtonItem({ - Key? key, + super.key, required this.value, required this.groupValue, required this.onSelected, this.height = 53, this.displayPrefix, - }) : super(key: key); + }); final T value; final T? groupValue; diff --git a/lib/widgets/custom_buttons/favorite_toggle.dart b/lib/widgets/custom_buttons/favorite_toggle.dart index 6014767c6..5d79cb0da 100644 --- a/lib/widgets/custom_buttons/favorite_toggle.dart +++ b/lib/widgets/custom_buttons/favorite_toggle.dart @@ -17,14 +17,14 @@ import '../../utilities/assets.dart'; class FavoriteToggle extends ConsumerStatefulWidget { const FavoriteToggle({ - Key? key, + super.key, this.backGround, this.borderRadius = BorderRadius.zero, this.initialState = false, this.on, this.off, required this.onChanged, - }) : super(key: key); + }); final Color? backGround; final Color? on; diff --git a/lib/widgets/custom_buttons/paynym_follow_toggle_button.dart b/lib/widgets/custom_buttons/paynym_follow_toggle_button.dart index ad5e80e30..5bc6143d1 100644 --- a/lib/widgets/custom_buttons/paynym_follow_toggle_button.dart +++ b/lib/widgets/custom_buttons/paynym_follow_toggle_button.dart @@ -13,6 +13,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../../models/paynym/paynym_account_lite.dart'; import '../../models/paynym/paynym_response.dart'; import '../../notifications/show_flush_bar.dart'; @@ -35,11 +36,11 @@ enum PaynymFollowToggleButtonStyle { class PaynymFollowToggleButton extends ConsumerStatefulWidget { const PaynymFollowToggleButton({ - Key? key, + super.key, required this.walletId, required this.paymentCodeStringToFollow, this.style = PaynymFollowToggleButtonStyle.primary, - }) : super(key: key); + }); final String walletId; final String paymentCodeStringToFollow; @@ -83,8 +84,11 @@ class _PaynymFollowToggleButtonState // sign token with notification private key String signature = await wallet.signStringWithNotificationKey(token.value!); - var result = await ref.read(paynymAPIProvider).follow(token.value!, - signature, followedAccount.value!.nonSegwitPaymentCode.code); + var result = await ref.read(paynymAPIProvider).follow( + token.value!, + signature, + followedAccount.value!.nonSegwitPaymentCode.code, + ); int i = 0; for (; @@ -96,8 +100,11 @@ class _PaynymFollowToggleButtonState // sign token with notification private key signature = await wallet.signStringWithNotificationKey(token.value!); - result = await ref.read(paynymAPIProvider).follow(token.value!, signature, - followedAccount.value!.nonSegwitPaymentCode.code); + result = await ref.read(paynymAPIProvider).follow( + token.value!, + signature, + followedAccount.value!.nonSegwitPaymentCode.code, + ); await Future.delayed(const Duration(milliseconds: 200)); print("RRR result: $result"); @@ -181,8 +188,11 @@ class _PaynymFollowToggleButtonState // sign token with notification private key String signature = await wallet.signStringWithNotificationKey(token.value!); - var result = await ref.read(paynymAPIProvider).unfollow(token.value!, - signature, followedAccount.value!.nonSegwitPaymentCode.code); + var result = await ref.read(paynymAPIProvider).unfollow( + token.value!, + signature, + followedAccount.value!.nonSegwitPaymentCode.code, + ); int i = 0; for (; @@ -194,8 +204,11 @@ class _PaynymFollowToggleButtonState // sign token with notification private key signature = await wallet.signStringWithNotificationKey(token.value!); - result = await ref.read(paynymAPIProvider).unfollow(token.value!, - signature, followedAccount.value!.nonSegwitPaymentCode.code); + result = await ref.read(paynymAPIProvider).unfollow( + token.value!, + signature, + followedAccount.value!.nonSegwitPaymentCode.code, + ); await Future.delayed(const Duration(milliseconds: 200)); print("unfollow RRR result: $result"); } diff --git a/lib/widgets/custom_buttons/simple_copy_button.dart b/lib/widgets/custom_buttons/simple_copy_button.dart index e8bcc560c..794f0cdb1 100644 --- a/lib/widgets/custom_buttons/simple_copy_button.dart +++ b/lib/widgets/custom_buttons/simple_copy_button.dart @@ -20,9 +20,9 @@ import '../../utilities/text_styles.dart'; class SimpleCopyButton extends StatelessWidget { const SimpleCopyButton({ - Key? key, + super.key, required this.data, - }) : super(key: key); + }); final String data; diff --git a/lib/widgets/custom_loading_overlay.dart b/lib/widgets/custom_loading_overlay.dart index f5c326d01..45d02a5d1 100644 --- a/lib/widgets/custom_loading_overlay.dart +++ b/lib/widgets/custom_loading_overlay.dart @@ -21,13 +21,13 @@ import 'loading_indicator.dart'; class CustomLoadingOverlay extends ConsumerStatefulWidget { const CustomLoadingOverlay({ - Key? key, + super.key, required this.message, this.subMessage, required this.eventBus, this.textColor, this.actionButton, - }) : super(key: key); + }); final String message; final String? subMessage; diff --git a/lib/widgets/custom_page_view/custom_page_view.dart b/lib/widgets/custom_page_view/custom_page_view.dart index 5540820fe..6e26139d2 100644 --- a/lib/widgets/custom_page_view/custom_page_view.dart +++ b/lib/widgets/custom_page_view/custom_page_view.dart @@ -18,6 +18,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart' show precisionErrorTolerance; import 'package:flutter/gestures.dart' show DragStartBehavior; import 'package:flutter/rendering.dart'; + import 'custom_sliver_fill_viewport.dart'; /// A controller for [CustomPageView]. @@ -227,14 +228,19 @@ class PageController extends ScrollController { /// The returned [Future] resolves when the animation completes. /// /// The `duration` and `curve` arguments must not be null. - Future previousPage( - {required Duration duration, required Curve curve}) { + Future previousPage({ + required Duration duration, + required Curve curve, + }) { return animateToPage(page!.round() - 1, duration: duration, curve: curve); } @override - ScrollPosition createScrollPosition(ScrollPhysics physics, - ScrollContext context, ScrollPosition? oldPosition) { + ScrollPosition createScrollPosition( + ScrollPhysics physics, + ScrollContext context, + ScrollPosition? oldPosition, + ) { return _PagePosition( physics: physics, context: context, @@ -260,21 +266,14 @@ class PageController extends ScrollController { class PageMetrics extends FixedScrollMetrics { /// Creates an immutable snapshot of values associated with a [CustomPageView]. PageMetrics({ - required double? minScrollExtent, - required double? maxScrollExtent, - required double? pixels, - required double? viewportDimension, - required AxisDirection axisDirection, - required double devicePixelRatio, + required super.minScrollExtent, + required super.maxScrollExtent, + required super.pixels, + required super.viewportDimension, + required super.axisDirection, + required super.devicePixelRatio, required this.viewportFraction, - }) : super( - minScrollExtent: minScrollExtent, - maxScrollExtent: maxScrollExtent, - pixels: pixels, - viewportDimension: viewportDimension, - axisDirection: axisDirection, - devicePixelRatio: devicePixelRatio, - ); + }); @override PageMetrics copyWith({ @@ -315,21 +314,18 @@ class PageMetrics extends FixedScrollMetrics { class _PagePosition extends ScrollPositionWithSingleContext implements PageMetrics { _PagePosition({ - required ScrollPhysics physics, - required ScrollContext context, + required super.physics, + required super.context, this.initialPage = 0, bool keepPage = true, double viewportFraction = 1.0, - ScrollPosition? oldPosition, + super.oldPosition, }) : assert(viewportFraction > 0.0), _viewportFraction = viewportFraction, _pageToUseOnStartup = initialPage.toDouble(), super( - physics: physics, - context: context, initialPixels: null, keepScrollOffset: keepPage, - oldPosition: oldPosition, ); final int initialPage; @@ -405,14 +401,18 @@ class _PagePosition extends ScrollPositionWithSingleContext return !hasPixels || !hasContentDimensions ? null : _cachedPage ?? - getPageFromPixels(pixels.clamp(minScrollExtent, maxScrollExtent), - viewportDimension); + getPageFromPixels( + pixels.clamp(minScrollExtent, maxScrollExtent), + viewportDimension, + ); } @override void saveScrollOffset() { - PageStorage.of(context.storageContext).writeState(context.storageContext, - _cachedPage ?? getPageFromPixels(pixels, viewportDimension)); + PageStorage.of(context.storageContext).writeState( + context.storageContext, + _cachedPage ?? getPageFromPixels(pixels, viewportDimension), + ); } @override @@ -427,7 +427,8 @@ class _PagePosition extends ScrollPositionWithSingleContext @override void saveOffset() { context.saveOffset( - _cachedPage ?? getPageFromPixels(pixels, viewportDimension)); + _cachedPage ?? getPageFromPixels(pixels, viewportDimension), + ); } @override @@ -507,8 +508,8 @@ class _PagePosition extends ScrollPositionWithSingleContext class _ForceImplicitScrollPhysics extends ScrollPhysics { const _ForceImplicitScrollPhysics({ required this.allowImplicitScrolling, - ScrollPhysics? parent, - }) : super(parent: parent); + super.parent, + }); @override _ForceImplicitScrollPhysics applyTo(ScrollPhysics? ancestor) { @@ -533,7 +534,7 @@ class _ForceImplicitScrollPhysics extends ScrollPhysics { /// * [CustomPageView.physics], which can override the physics used by a page view. class PageScrollPhysics extends ScrollPhysics { /// Creates physics for a [CustomPageView]. - const PageScrollPhysics({ScrollPhysics? parent}) : super(parent: parent); + const PageScrollPhysics({super.parent}); @override PageScrollPhysics applyTo(ScrollPhysics? ancestor) { @@ -551,7 +552,10 @@ class PageScrollPhysics extends ScrollPhysics { } double _getTargetPixels( - ScrollMetrics position, Tolerance tolerance, double velocity) { + ScrollMetrics position, + Tolerance tolerance, + double velocity, + ) { double page = _getPage(position); if (velocity < -tolerance.velocity) { page -= 0.5; @@ -563,7 +567,9 @@ class PageScrollPhysics extends ScrollPhysics { @override Simulation? createBallisticSimulation( - ScrollMetrics position, double velocity) { + ScrollMetrics position, + double velocity, + ) { // If we're out of range and not headed back in range, defer to the parent // ballistics, which should put us back in range at a page boundary. if ((velocity <= 0.0 && position.pixels <= position.minScrollExtent) || @@ -573,8 +579,13 @@ class PageScrollPhysics extends ScrollPhysics { final Tolerance tolerance = this.tolerance; final double target = _getTargetPixels(position, tolerance, velocity); if (target != position.pixels) { - return ScrollSpringSimulation(spring, position.pixels, target, velocity, - tolerance: tolerance); + return ScrollSpringSimulation( + spring, + position.pixels, + target, + velocity, + tolerance: tolerance, + ); } return null; } @@ -641,7 +652,7 @@ class CustomPageView extends StatefulWidget { /// rather than into the contents of the [CustomPageView]. /// {@endtemplate} CustomPageView({ - Key? key, + super.key, this.scrollDirection = Axis.horizontal, this.reverse = false, PageController? controller, @@ -657,8 +668,7 @@ class CustomPageView extends StatefulWidget { this.scrollBehavior, this.padEnds = true, }) : controller = controller ?? _defaultPageController, - childrenDelegate = SliverChildListDelegate(children), - super(key: key); + childrenDelegate = SliverChildListDelegate(children); /// Creates a scrollable list that works page by page using widgets that are /// created on demand. @@ -684,7 +694,7 @@ class CustomPageView extends StatefulWidget { /// /// {@macro flutter.widgets.PageView.allowImplicitScrolling} CustomPageView.builder({ - Key? key, + super.key, this.scrollDirection = Axis.horizontal, this.reverse = false, PageController? controller, @@ -706,8 +716,7 @@ class CustomPageView extends StatefulWidget { itemBuilder, findChildIndexCallback: findChildIndexCallback, childCount: itemCount, - ), - super(key: key); + ); /// Creates a scrollable list that works page by page with a custom child /// model. @@ -794,7 +803,7 @@ class CustomPageView extends StatefulWidget { /// /// {@macro flutter.widgets.PageView.allowImplicitScrolling} CustomPageView.custom({ - Key? key, + super.key, this.scrollDirection = Axis.horizontal, this.reverse = false, PageController? controller, @@ -809,8 +818,7 @@ class CustomPageView extends StatefulWidget { this.scrollBehavior, this.viewportFractionalPadding = 0.25, this.padEnds = true, - }) : controller = controller ?? _defaultPageController, - super(key: key); + }) : controller = controller ?? _defaultPageController; final double viewportFractionalPadding; @@ -951,8 +959,10 @@ class _CustomPageViewState extends State { allowImplicitScrolling: widget.allowImplicitScrolling, ).applyTo( widget.pageSnapping - ? _kPagePhysics.applyTo(widget.physics ?? - widget.scrollBehavior?.getScrollPhysics(context)) + ? _kPagePhysics.applyTo( + widget.physics ?? + widget.scrollBehavior?.getScrollPhysics(context), + ) : widget.physics ?? widget.scrollBehavior?.getScrollPhysics(context), ); @@ -1008,17 +1018,35 @@ class _CustomPageViewState extends State { description .add(EnumProperty('scrollDirection', widget.scrollDirection)); description.add( - FlagProperty('reverse', value: widget.reverse, ifTrue: 'reversed')); - description.add(DiagnosticsProperty( - 'controller', widget.controller, - showName: false)); - description.add(DiagnosticsProperty( - 'physics', widget.physics, - showName: false)); - description.add(FlagProperty('pageSnapping', - value: widget.pageSnapping, ifFalse: 'snapping disabled')); - description.add(FlagProperty('allowImplicitScrolling', + FlagProperty('reverse', value: widget.reverse, ifTrue: 'reversed'), + ); + description.add( + DiagnosticsProperty( + 'controller', + widget.controller, + showName: false, + ), + ); + description.add( + DiagnosticsProperty( + 'physics', + widget.physics, + showName: false, + ), + ); + description.add( + FlagProperty( + 'pageSnapping', + value: widget.pageSnapping, + ifFalse: 'snapping disabled', + ), + ); + description.add( + FlagProperty( + 'allowImplicitScrolling', value: widget.allowImplicitScrolling, - ifTrue: 'allow implicit scrolling')); + ifTrue: 'allow implicit scrolling', + ), + ); } } diff --git a/lib/widgets/custom_page_view/custom_sliver_fill_viewport.dart b/lib/widgets/custom_page_view/custom_sliver_fill_viewport.dart index 94f6a2e35..54e99fa2b 100644 --- a/lib/widgets/custom_page_view/custom_sliver_fill_viewport.dart +++ b/lib/widgets/custom_page_view/custom_sliver_fill_viewport.dart @@ -34,15 +34,14 @@ import 'package:flutter/rendering.dart'; class CustomSliverFillViewport extends StatelessWidget { /// Creates a sliver whose box children that each fill the viewport. const CustomSliverFillViewport({ - Key? key, + super.key, required this.delegate, this.viewportFraction = 1.0, this.viewportFractionalPadding = 0.25, this.padEnds = true, }) : assert(viewportFraction > 0.0), assert(viewportFractionalPadding > 0.0), - assert(viewportFractionalPadding <= 0.25), - super(key: key); + assert(viewportFractionalPadding <= 0.25); /// The fraction of the viewport that each child should fill in the main axis. /// @@ -84,11 +83,10 @@ class CustomSliverFillViewport extends StatelessWidget { class _SliverFillViewportRenderObjectWidget extends SliverMultiBoxAdaptorWidget { const _SliverFillViewportRenderObjectWidget({ - Key? key, - required SliverChildDelegate delegate, + super.key, + required super.delegate, this.viewportFraction = 1.0, - }) : assert(viewportFraction > 0.0), - super(key: key, delegate: delegate); + }) : assert(viewportFraction > 0.0); final double viewportFraction; @@ -97,12 +95,16 @@ class _SliverFillViewportRenderObjectWidget final SliverMultiBoxAdaptorElement element = context as SliverMultiBoxAdaptorElement; return RenderSliverFillViewport( - childManager: element, viewportFraction: viewportFraction); + childManager: element, + viewportFraction: viewportFraction, + ); } @override void updateRenderObject( - BuildContext context, RenderSliverFillViewport renderObject) { + BuildContext context, + RenderSliverFillViewport renderObject, + ) { renderObject.viewportFraction = viewportFraction; } } @@ -123,7 +125,9 @@ class _SliverFractionalPadding extends SingleChildRenderObjectWidget { @override void updateRenderObject( - BuildContext context, _RenderSliverFractionalPadding renderObject) { + BuildContext context, + _RenderSliverFractionalPadding renderObject, + ) { renderObject.viewportFraction = viewportFraction; } } @@ -274,11 +278,11 @@ class _RenderSliverFractionalPadding extends RenderSliverEdgeInsetsPadding { class SliverFillRemaining extends StatelessWidget { /// Creates a sliver that fills the remaining space in the viewport. const SliverFillRemaining({ - Key? key, + super.key, this.child, this.hasScrollBody = true, this.fillOverscroll = false, - }) : super(key: key); + }); /// Box child widget that fills the remaining space in the viewport. /// @@ -336,22 +340,23 @@ class SliverFillRemaining extends StatelessWidget { class _SliverFillRemainingWithScrollable extends SingleChildRenderObjectWidget { const _SliverFillRemainingWithScrollable({ - Key? key, - Widget? child, - }) : super(key: key, child: child); + super.key, + super.child, + }); @override RenderSliverFillRemainingWithScrollable createRenderObject( - BuildContext context) => + BuildContext context, + ) => RenderSliverFillRemainingWithScrollable(); } class _SliverFillRemainingWithoutScrollable extends SingleChildRenderObjectWidget { const _SliverFillRemainingWithoutScrollable({ - Key? key, - Widget? child, - }) : super(key: key, child: child); + super.key, + super.child, + }); @override RenderSliverFillRemaining createRenderObject(BuildContext context) => @@ -360,12 +365,13 @@ class _SliverFillRemainingWithoutScrollable class _SliverFillRemainingAndOverscroll extends SingleChildRenderObjectWidget { const _SliverFillRemainingAndOverscroll({ - Key? key, - Widget? child, - }) : super(key: key, child: child); + super.key, + super.child, + }); @override RenderSliverFillRemainingAndOverscroll createRenderObject( - BuildContext context) => + BuildContext context, + ) => RenderSliverFillRemainingAndOverscroll(); } diff --git a/lib/widgets/custom_pin_put/custom_pin_put.dart b/lib/widgets/custom_pin_put/custom_pin_put.dart index 7d978076b..999775b07 100644 --- a/lib/widgets/custom_pin_put/custom_pin_put.dart +++ b/lib/widgets/custom_pin_put/custom_pin_put.dart @@ -15,7 +15,7 @@ import 'pin_keyboard.dart'; class CustomPinPut extends StatefulWidget { const CustomPinPut({ - Key? key, + super.key, required this.fieldsCount, required this.isRandom, this.height, @@ -64,7 +64,7 @@ class CustomPinPut extends StatefulWidget { this.autofillHints, this.customKey, this.onPinLengthChanged, - }) : super(key: key); + }); final void Function(int)? onPinLengthChanged; diff --git a/lib/widgets/custom_pin_put/pin_keyboard.dart b/lib/widgets/custom_pin_put/pin_keyboard.dart index 274287a17..9eb44ae4d 100644 --- a/lib/widgets/custom_pin_put/pin_keyboard.dart +++ b/lib/widgets/custom_pin_put/pin_keyboard.dart @@ -12,16 +12,17 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../../themes/stack_colors.dart'; import '../../utilities/assets.dart'; import '../../utilities/text_styles.dart'; class NumberKey extends StatefulWidget { const NumberKey({ - Key? key, + super.key, required this.number, required this.onPressed, - }) : super(key: key); + }); final String number; final ValueSetter onPressed; @@ -94,9 +95,9 @@ class _NumberKeyState extends State { class BackspaceKey extends StatefulWidget { const BackspaceKey({ - Key? key, + super.key, required this.onPressed, - }) : super(key: key); + }); final VoidCallback onPressed; @@ -129,51 +130,51 @@ class _BackspaceKeyState extends State { shadows: const [], ), child: MaterialButton( - // splashColor: Theme.of(context).extension()!.highlight, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - shape: const StadiumBorder(), - onPressed: () { - onPressed.call(); - setState(() { - _color = Theme.of(context) - .extension()! - .numpadBackDefault - .withOpacity(0.8); - }); + // splashColor: Theme.of(context).extension()!.highlight, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + shape: const StadiumBorder(), + onPressed: () { + onPressed.call(); + setState(() { + _color = Theme.of(context) + .extension()! + .numpadBackDefault + .withOpacity(0.8); + }); - Future.delayed(const Duration(milliseconds: 200), () { - if (mounted) { - setState(() { - _color = Theme.of(context) - .extension()! - .numpadBackDefault; - }); - } - }); - }, - child: Semantics( - label: "Backspace Button. Deletes The Last Digit.", - excludeSemantics: true, - child: Center( - child: SvgPicture.asset( - Assets.svg.delete, - width: 20, - height: 20, - color: Theme.of(context) + Future.delayed(const Duration(milliseconds: 200), () { + if (mounted) { + setState(() { + _color = Theme.of(context) .extension()! - .numpadTextDefault, - ), + .numpadBackDefault; + }); + } + }); + }, + child: Semantics( + label: "Backspace Button. Deletes The Last Digit.", + excludeSemantics: true, + child: Center( + child: SvgPicture.asset( + Assets.svg.delete, + width: 20, + height: 20, + color: + Theme.of(context).extension()!.numpadTextDefault, ), - )), + ), + ), + ), ); } } class SubmitKey extends StatelessWidget { const SubmitKey({ - Key? key, + super.key, required this.onPressed, - }) : super(key: key); + }); final VoidCallback onPressed; @@ -210,11 +211,11 @@ class SubmitKey extends StatelessWidget { class CustomKey extends StatelessWidget { const CustomKey({ - Key? key, + super.key, required this.onPressed, this.iconAssetName, this.semanticsLabel = "Button", - }) : super(key: key); + }); final VoidCallback onPressed; final String? iconAssetName; @@ -223,43 +224,44 @@ class CustomKey extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - height: 72, - width: 72, - decoration: ShapeDecoration( + height: 72, + width: 72, + decoration: ShapeDecoration( + shape: const StadiumBorder(), + color: Theme.of(context).extension()!.numpadBackDefault, + shadows: const [], + ), + child: Semantics( + label: semanticsLabel, + excludeSemantics: true, + child: MaterialButton( + // splashColor: Theme.of(context).extension()!.highlight, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, shape: const StadiumBorder(), - color: Theme.of(context).extension()!.numpadBackDefault, - shadows: const [], - ), - child: Semantics( - label: semanticsLabel, - excludeSemantics: true, - child: MaterialButton( - // splashColor: Theme.of(context).extension()!.highlight, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - shape: const StadiumBorder(), - onPressed: () { - onPressed.call(); - }, - child: Center( - child: iconAssetName == null - ? null - : SvgPicture.asset( - iconAssetName!, - width: 20, - height: 20, - color: Theme.of(context) - .extension()! - .numpadTextDefault, - ), - ), + onPressed: () { + onPressed.call(); + }, + child: Center( + child: iconAssetName == null + ? null + : SvgPicture.asset( + iconAssetName!, + width: 20, + height: 20, + color: Theme.of(context) + .extension()! + .numpadTextDefault, + ), ), - )); + ), + ), + ); } } class PinKeyboard extends ConsumerWidget { const PinKeyboard({ - Key? key, + super.key, required this.onNumberKeyPressed, required this.onBackPressed, required this.onSubmitPressed, @@ -268,7 +270,7 @@ class PinKeyboard extends ConsumerWidget { this.width = 264, this.height = 360, this.customKey, - }) : super(key: key); + }); final ValueSetter onNumberKeyPressed; final VoidCallback onBackPressed; @@ -411,7 +413,7 @@ class PinKeyboard extends ConsumerWidget { onPressed: _submitHandler, ), ], - ) + ), ], ), ); @@ -420,7 +422,7 @@ class PinKeyboard extends ConsumerWidget { class RandomKeyboard extends StatelessWidget { const RandomKeyboard({ - Key? key, + super.key, required this.onNumberKeyPressed, required this.onBackPressed, required this.onSubmitPressed, @@ -428,7 +430,7 @@ class RandomKeyboard extends StatelessWidget { this.width = 264, this.height = 360, this.customKey, - }) : super(key: key); + }); final ValueSetter onNumberKeyPressed; final VoidCallback onBackPressed; @@ -567,7 +569,7 @@ class RandomKeyboard extends StatelessWidget { onPressed: _submitHandler, ), ], - ) + ), ], ), ); diff --git a/lib/widgets/custom_tab_view.dart b/lib/widgets/custom_tab_view.dart index db69a47a5..181f67341 100644 --- a/lib/widgets/custom_tab_view.dart +++ b/lib/widgets/custom_tab_view.dart @@ -9,18 +9,18 @@ */ import 'package:flutter/material.dart'; + import '../themes/stack_colors.dart'; import '../utilities/text_styles.dart'; class CustomTabView extends StatefulWidget { const CustomTabView({ - Key? key, + super.key, required this.titles, required this.children, this.initialIndex = 0, this.childPadding, - }) : assert(titles.length == children.length), - super(key: key); + }) : assert(titles.length == children.length); final List titles; final List children; diff --git a/lib/widgets/desktop/custom_text_button.dart b/lib/widgets/desktop/custom_text_button.dart index a868ff9ff..e526ba9af 100644 --- a/lib/widgets/desktop/custom_text_button.dart +++ b/lib/widgets/desktop/custom_text_button.dart @@ -23,11 +23,11 @@ enum ButtonHeight { class CustomTextButtonBase extends StatelessWidget { const CustomTextButtonBase({ - Key? key, + super.key, this.width, this.height, this.textButton, - }) : super(key: key); + }); final double? width; final double? height; diff --git a/lib/widgets/desktop/delete_button.dart b/lib/widgets/desktop/delete_button.dart index 897a4f8fe..80eaa79b6 100644 --- a/lib/widgets/desktop/delete_button.dart +++ b/lib/widgets/desktop/delete_button.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; + import '../../themes/stack_colors.dart'; import '../../utilities/assets.dart'; import '../../utilities/text_styles.dart'; @@ -18,14 +19,14 @@ import 'custom_text_button.dart'; class DeleteButton extends StatelessWidget { const DeleteButton({ - Key? key, + super.key, this.width, this.height, this.label, this.onPressed, this.enabled = true, this.desktopMed = false, - }) : super(key: key); + }); final double? width; final double? height; @@ -48,7 +49,8 @@ class DeleteButton extends StatelessWidget { return enabled ? STextStyles.desktopButtonSecondaryEnabled(context).copyWith( color: - Theme.of(context).extension()!.accentColorRed) + Theme.of(context).extension()!.accentColorRed, + ) : STextStyles.desktopButtonSecondaryDisabled(context); } } else { diff --git a/lib/widgets/desktop/desktop_app_bar.dart b/lib/widgets/desktop/desktop_app_bar.dart index 2c6b39763..2cb365153 100644 --- a/lib/widgets/desktop/desktop_app_bar.dart +++ b/lib/widgets/desktop/desktop_app_bar.dart @@ -16,7 +16,7 @@ const double kDesktopAppBarHeightCompact = 82.0; class DesktopAppBar extends StatelessWidget { const DesktopAppBar({ - Key? key, + super.key, this.leading, this.center, this.overlayCenter, @@ -24,7 +24,7 @@ class DesktopAppBar extends StatelessWidget { this.background = Colors.transparent, required this.isCompactHeight, this.useSpacers = true, - }) : super(key: key); + }); final Widget? leading; final Widget? center; diff --git a/lib/widgets/desktop/desktop_dialog.dart b/lib/widgets/desktop/desktop_dialog.dart index d01fb3d77..e550627df 100644 --- a/lib/widgets/desktop/desktop_dialog.dart +++ b/lib/widgets/desktop/desktop_dialog.dart @@ -13,11 +13,11 @@ import '../../themes/stack_colors.dart'; class DesktopDialog extends StatelessWidget { const DesktopDialog({ - Key? key, + super.key, this.child, this.maxWidth = 641, this.maxHeight = 474, - }) : super(key: key); + }); final Widget? child; final double maxWidth; diff --git a/lib/widgets/desktop/desktop_dialog_close_button.dart b/lib/widgets/desktop/desktop_dialog_close_button.dart index a9b258737..4ec2ee3d8 100644 --- a/lib/widgets/desktop/desktop_dialog_close_button.dart +++ b/lib/widgets/desktop/desktop_dialog_close_button.dart @@ -16,9 +16,9 @@ import '../custom_buttons/app_bar_icon_button.dart'; class DesktopDialogCloseButton extends StatelessWidget { const DesktopDialogCloseButton({ - Key? key, + super.key, this.onPressedOverride, - }) : super(key: key); + }); final VoidCallback? onPressedOverride; diff --git a/lib/widgets/desktop/desktop_fee_dialog.dart b/lib/widgets/desktop/desktop_fee_dialog.dart index 08597b9eb..90304e80c 100644 --- a/lib/widgets/desktop/desktop_fee_dialog.dart +++ b/lib/widgets/desktop/desktop_fee_dialog.dart @@ -11,10 +11,6 @@ import '../../utilities/amount/amount.dart'; import '../../utilities/amount/amount_formatter.dart'; import '../../utilities/enums/fee_rate_type_enum.dart'; import '../../utilities/text_styles.dart'; -import '../../wallets/crypto_currency/coins/ethereum.dart'; -import '../../wallets/crypto_currency/coins/firo.dart'; -import '../../wallets/crypto_currency/coins/monero.dart'; -import '../../wallets/crypto_currency/coins/wownero.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../wallets/isar/providers/eth/current_token_wallet_provider.dart'; import '../../wallets/wallet/impl/firo_wallet.dart'; @@ -311,9 +307,9 @@ class _DesktopFeeItemState extends ConsumerState { int targetBlockTime, int estimatedNumberOfBlocks, ) { - int time = targetBlockTime * estimatedNumberOfBlocks; + final int time = targetBlockTime * estimatedNumberOfBlocks; - int hours = (time / 3600).floor(); + final int hours = (time / 3600).floor(); if (hours > 1) { return "~$hours hours"; } else if (hours == 1) { diff --git a/lib/widgets/desktop/desktop_scaffold.dart b/lib/widgets/desktop/desktop_scaffold.dart index f3913b094..25b18963b 100644 --- a/lib/widgets/desktop/desktop_scaffold.dart +++ b/lib/widgets/desktop/desktop_scaffold.dart @@ -14,11 +14,11 @@ import '../background.dart'; class DesktopScaffold extends StatelessWidget { const DesktopScaffold({ - Key? key, + super.key, this.background, this.appBar, this.body, - }) : super(key: key); + }); final Color? background; final Widget? appBar; @@ -47,12 +47,12 @@ class DesktopScaffold extends StatelessWidget { class MasterScaffold extends StatelessWidget { const MasterScaffold({ - Key? key, + super.key, required this.isDesktop, required this.appBar, required this.body, this.background, - }) : super(key: key); + }); final bool isDesktop; final Widget appBar; diff --git a/lib/widgets/desktop/outline_blue_button.dart b/lib/widgets/desktop/outline_blue_button.dart index 6073db347..e0b4c0a20 100644 --- a/lib/widgets/desktop/outline_blue_button.dart +++ b/lib/widgets/desktop/outline_blue_button.dart @@ -19,7 +19,7 @@ export 'custom_text_button.dart'; class OutlineBlueButton extends StatelessWidget { const OutlineBlueButton({ - Key? key, + super.key, this.width, this.height, this.label, @@ -28,7 +28,7 @@ class OutlineBlueButton extends StatelessWidget { this.enabled = true, this.buttonHeight, this.iconSpacing = 10, - }) : super(key: key); + }); final double? width; final double? height; diff --git a/lib/widgets/desktop/paynym_search_button.dart b/lib/widgets/desktop/paynym_search_button.dart index 48d8134a3..d1a757d98 100644 --- a/lib/widgets/desktop/paynym_search_button.dart +++ b/lib/widgets/desktop/paynym_search_button.dart @@ -16,9 +16,9 @@ import '../rounded_container.dart'; class PaynymSearchButton extends StatefulWidget { const PaynymSearchButton({ - Key? key, + super.key, required this.onPressed, - }) : super(key: key); + }); final VoidCallback onPressed; diff --git a/lib/widgets/desktop/primary_button.dart b/lib/widgets/desktop/primary_button.dart index e9d555700..c2f126998 100644 --- a/lib/widgets/desktop/primary_button.dart +++ b/lib/widgets/desktop/primary_button.dart @@ -19,7 +19,7 @@ export 'custom_text_button.dart'; class PrimaryButton extends StatelessWidget { const PrimaryButton({ - Key? key, + super.key, this.width, this.height, this.label, @@ -28,7 +28,7 @@ class PrimaryButton extends StatelessWidget { this.enabled = true, this.buttonHeight, this.iconSpacing = 10, - }) : super(key: key); + }); final double? width; final double? height; diff --git a/lib/widgets/desktop/secondary_button.dart b/lib/widgets/desktop/secondary_button.dart index eba9a59f3..f9e18ec0a 100644 --- a/lib/widgets/desktop/secondary_button.dart +++ b/lib/widgets/desktop/secondary_button.dart @@ -19,7 +19,7 @@ export 'custom_text_button.dart'; class SecondaryButton extends StatelessWidget { const SecondaryButton({ - Key? key, + super.key, this.width, this.height, this.label, @@ -30,7 +30,7 @@ class SecondaryButton extends StatelessWidget { this.buttonHeight, this.iconSpacing = 10, this.padding = EdgeInsets.zero, - }) : super(key: key); + }); final double? width; final double? height; diff --git a/lib/widgets/desktop/simple_desktop_dialog.dart b/lib/widgets/desktop/simple_desktop_dialog.dart index 4b342c060..80cad79b0 100644 --- a/lib/widgets/desktop/simple_desktop_dialog.dart +++ b/lib/widgets/desktop/simple_desktop_dialog.dart @@ -16,10 +16,10 @@ import 'primary_button.dart'; class SimpleDesktopDialog extends StatelessWidget { const SimpleDesktopDialog({ - Key? key, + super.key, required this.title, required this.message, - }) : super(key: key); + }); final String title; final String message; @@ -80,7 +80,7 @@ class SimpleDesktopDialog extends StatelessWidget { ), ], ), - ) + ), ], ), ); diff --git a/lib/widgets/dialogs/basic_dialog.dart b/lib/widgets/dialogs/basic_dialog.dart index fcb54d2eb..8071ec53c 100644 --- a/lib/widgets/dialogs/basic_dialog.dart +++ b/lib/widgets/dialogs/basic_dialog.dart @@ -17,7 +17,7 @@ import '../stack_dialog.dart'; class BasicDialog extends StatelessWidget { const BasicDialog({ - Key? key, + super.key, this.leftButton, this.rightButton, this.icon, @@ -27,7 +27,7 @@ class BasicDialog extends StatelessWidget { this.desktopWidth = 641, this.canPopWithBackButton = false, this.flex = false, - }) : super(key: key); + }); final Widget? leftButton; final Widget? rightButton; @@ -103,7 +103,7 @@ class BasicDialog extends StatelessWidget { : const Spacer(), ], ), - ) + ), ], ), ); diff --git a/lib/widgets/dialogs/frost/frost_step_explanation_dialog.dart b/lib/widgets/dialogs/frost/frost_step_explanation_dialog.dart index fc8be900c..2b3dffa81 100644 --- a/lib/widgets/dialogs/frost/frost_step_explanation_dialog.dart +++ b/lib/widgets/dialogs/frost/frost_step_explanation_dialog.dart @@ -9,6 +9,7 @@ */ import 'package:flutter/material.dart'; + import '../../../utilities/text_styles.dart'; import '../../desktop/secondary_button.dart'; import '../../stack_dialog.dart'; @@ -16,7 +17,8 @@ import '../../stack_dialog.dart'; class FrostStepExplanationDialog extends StatelessWidget { final String title; final String body; - const FrostStepExplanationDialog({super.key, required this.title, required this.body}); + const FrostStepExplanationDialog( + {super.key, required this.title, required this.body}); @override Widget build(BuildContext context) { diff --git a/lib/widgets/dialogs/frost/frost_step_qr_dialog.dart b/lib/widgets/dialogs/frost/frost_step_qr_dialog.dart index 2de302720..c19eb2b2c 100644 --- a/lib/widgets/dialogs/frost/frost_step_qr_dialog.dart +++ b/lib/widgets/dialogs/frost/frost_step_qr_dialog.dart @@ -9,6 +9,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:path_provider/path_provider.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:share_plus/share_plus.dart'; + import '../../../notifications/show_flush_bar.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/assets.dart'; @@ -16,9 +17,9 @@ import '../../../utilities/text_styles.dart'; import '../../../utilities/util.dart'; import '../../conditional_parent.dart'; import '../../desktop/secondary_button.dart'; -import '../simple_mobile_dialog.dart'; import '../../rounded_container.dart'; import '../../rounded_white_container.dart'; +import '../simple_mobile_dialog.dart'; class FrostStepQrDialog extends StatefulWidget { const FrostStepQrDialog({ @@ -52,7 +53,8 @@ class _FrostStepQrDialogState extends State { final dir = Directory("${Platform.environment['HOME']}"); if (!dir.existsSync()) { throw Exception( - "Home dir not found while trying to open filepicker on QR image save"); + "Home dir not found while trying to open filepicker on QR image save", + ); } final path = await FilePicker.platform.saveFile( fileName: "qrcode.png", @@ -91,8 +93,10 @@ class _FrostStepQrDialogState extends State { final file = await File("${tempDir.path}/qrcode.png").create(); await file.writeAsBytes(pngBytes); - await Share.shareFiles(["${tempDir.path}/qrcode.png"], - text: "Receive URI QR Code"); + await Share.shareFiles( + ["${tempDir.path}/qrcode.png"], + text: "Receive URI QR Code", + ); } } catch (e) { //todo: comeback to this @@ -111,7 +115,7 @@ class _FrostStepQrDialogState extends State { key: _qrKey, child: RoundedWhiteContainer( boxShadow: [ - Theme.of(context).extension()!.standardBoxShadow + Theme.of(context).extension()!.standardBoxShadow, ], child: Column( mainAxisSize: MainAxisSize.min, diff --git a/lib/widgets/emoji_select_sheet.dart b/lib/widgets/emoji_select_sheet.dart index b4330a232..608aa30a3 100644 --- a/lib/widgets/emoji_select_sheet.dart +++ b/lib/widgets/emoji_select_sheet.dart @@ -12,6 +12,7 @@ import 'package:emojis/emoji.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; + import '../themes/stack_colors.dart'; import '../utilities/assets.dart'; import '../utilities/constants.dart'; @@ -25,8 +26,8 @@ import 'textfield_icon_button.dart'; class EmojiSelectSheet extends ConsumerStatefulWidget { const EmojiSelectSheet({ - Key? key, - }) : super(key: key); + super.key, + }); final double horizontalPadding = 24; final double emojiSize = 24; @@ -55,11 +56,13 @@ class _EmojiSelectSheetState extends ConsumerState { text = text.toLowerCase(); return Emoji.all() - .where((e) => e.keywords - .where( - (e) => e.contains(text), - ) - .isNotEmpty) + .where( + (e) => e.keywords + .where( + (e) => e.contains(text), + ) + .isNotEmpty, + ) .toList(growable: false); } @@ -239,7 +242,7 @@ class _EmojiSelectSheetState extends ConsumerState { ); }, ), - ) + ), ], ), ), diff --git a/lib/widgets/eth_wallet_radio.dart b/lib/widgets/eth_wallet_radio.dart index a164d85ba..fe1da6efa 100644 --- a/lib/widgets/eth_wallet_radio.dart +++ b/lib/widgets/eth_wallet_radio.dart @@ -18,10 +18,10 @@ import 'wallet_info_row/sub_widgets/wallet_info_row_coin_icon.dart'; class EthWalletRadio extends ConsumerStatefulWidget { const EthWalletRadio({ - Key? key, + super.key, required this.walletId, this.selectedWalletId, - }) : super(key: key); + }); final String walletId; final String? selectedWalletId; diff --git a/lib/widgets/exchange/trocador/trocador_kyc_icon.dart b/lib/widgets/exchange/trocador/trocador_kyc_icon.dart index dc7b75a26..17161cac8 100644 --- a/lib/widgets/exchange/trocador/trocador_kyc_icon.dart +++ b/lib/widgets/exchange/trocador/trocador_kyc_icon.dart @@ -16,11 +16,11 @@ import 'trocador_rating_type_enum.dart'; class TrocadorKYCIcon extends StatelessWidget { const TrocadorKYCIcon({ - Key? key, + super.key, required this.kycType, this.width = 18, this.height = 18, - }) : super(key: key); + }); final TrocadorKYCType kycType; final double width; diff --git a/lib/widgets/exchange/trocador/trocador_kyc_info_button.dart b/lib/widgets/exchange/trocador/trocador_kyc_info_button.dart index 91fc2f732..2c1c288ce 100644 --- a/lib/widgets/exchange/trocador/trocador_kyc_info_button.dart +++ b/lib/widgets/exchange/trocador/trocador_kyc_info_button.dart @@ -15,9 +15,9 @@ import '../../trocador_kyc_rating_info.dart'; class TrocadorKYCInfoButton extends StatelessWidget { const TrocadorKYCInfoButton({ - Key? key, + super.key, required this.kycType, - }) : super(key: key); + }); final TrocadorKYCType kycType; diff --git a/lib/widgets/expandable.dart b/lib/widgets/expandable.dart index 2d84e29a7..2a3060d1b 100644 --- a/lib/widgets/expandable.dart +++ b/lib/widgets/expandable.dart @@ -22,7 +22,7 @@ class ExpandableController { class Expandable extends StatefulWidget { const Expandable({ - Key? key, + super.key, required this.header, required this.body, this.animationController, @@ -34,7 +34,7 @@ class Expandable extends StatefulWidget { this.expandOverride, this.curve = Curves.easeInOut, this.initialState = ExpandableState.collapsed, - }) : super(key: key); + }); final Widget header; final Widget body; diff --git a/lib/widgets/expandable2.dart b/lib/widgets/expandable2.dart index c806217df..b8dad923a 100644 --- a/lib/widgets/expandable2.dart +++ b/lib/widgets/expandable2.dart @@ -24,7 +24,7 @@ class Expandable2Controller { class Expandable2 extends StatefulWidget { const Expandable2({ - Key? key, + super.key, required this.header, required this.children, this.background = Colors.white, @@ -36,7 +36,7 @@ class Expandable2 extends StatefulWidget { this.onExpandChanged, this.controller, this.expandOverride, - }) : super(key: key); + }); final Widget header; final List children; diff --git a/lib/widgets/fee_slider.dart b/lib/widgets/fee_slider.dart index 806e9306f..aff7fc131 100644 --- a/lib/widgets/fee_slider.dart +++ b/lib/widgets/fee_slider.dart @@ -2,7 +2,6 @@ import 'dart:math'; import 'package:flutter/material.dart'; import '../utilities/text_styles.dart'; -import '../wallets/crypto_currency/coins/dogecoin.dart'; import '../wallets/crypto_currency/crypto_currency.dart'; class FeeSlider extends StatefulWidget { diff --git a/lib/widgets/frost_scaffold.dart b/lib/widgets/frost_scaffold.dart index 6ce59ce1d..9a527eb57 100644 --- a/lib/widgets/frost_scaffold.dart +++ b/lib/widgets/frost_scaffold.dart @@ -186,7 +186,7 @@ class _FrostScaffoldState extends ConsumerState { width: 500, child: child, ), - ) + ), ], ), child: ConditionalParent( diff --git a/lib/widgets/hover_text_field.dart b/lib/widgets/hover_text_field.dart index 9ade4d63d..f4b9528ff 100644 --- a/lib/widgets/hover_text_field.dart +++ b/lib/widgets/hover_text_field.dart @@ -22,9 +22,9 @@ import '../utilities/util.dart'; class DesktopWalletNameField extends ConsumerStatefulWidget { const DesktopWalletNameField({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); final String walletId; diff --git a/lib/widgets/icon_widgets/addressbook_icon.dart b/lib/widgets/icon_widgets/addressbook_icon.dart index f373c9dbf..62b54d333 100644 --- a/lib/widgets/icon_widgets/addressbook_icon.dart +++ b/lib/widgets/icon_widgets/addressbook_icon.dart @@ -15,11 +15,11 @@ import '../../utilities/assets.dart'; class AddressBookIcon extends StatelessWidget { const AddressBookIcon({ - Key? key, + super.key, this.width = 16, this.height = 16, this.color, - }) : super(key: key); + }); final double width; final double height; diff --git a/lib/widgets/icon_widgets/clipboard_icon.dart b/lib/widgets/icon_widgets/clipboard_icon.dart index 062b3c70d..b8701d707 100644 --- a/lib/widgets/icon_widgets/clipboard_icon.dart +++ b/lib/widgets/icon_widgets/clipboard_icon.dart @@ -15,11 +15,11 @@ import '../../utilities/assets.dart'; class ClipboardIcon extends StatelessWidget { const ClipboardIcon({ - Key? key, + super.key, this.width = 18, this.height = 18, this.color, - }) : super(key: key); + }); final double width; final double height; diff --git a/lib/widgets/icon_widgets/copy_icon.dart b/lib/widgets/icon_widgets/copy_icon.dart index 7d5bd4af9..ceb5074ce 100644 --- a/lib/widgets/icon_widgets/copy_icon.dart +++ b/lib/widgets/icon_widgets/copy_icon.dart @@ -15,11 +15,11 @@ import '../../utilities/assets.dart'; class CopyIcon extends StatelessWidget { const CopyIcon({ - Key? key, + super.key, this.width = 18, this.height = 18, this.color, - }) : super(key: key); + }); final double width; final double height; diff --git a/lib/widgets/icon_widgets/dice_icon.dart b/lib/widgets/icon_widgets/dice_icon.dart index 27b88a684..1d688a2b9 100644 --- a/lib/widgets/icon_widgets/dice_icon.dart +++ b/lib/widgets/icon_widgets/dice_icon.dart @@ -15,11 +15,11 @@ import '../../utilities/assets.dart'; class DiceIcon extends StatelessWidget { const DiceIcon({ - Key? key, + super.key, this.width = 17, this.height = 17, this.color, - }) : super(key: key); + }); final double width; final double height; diff --git a/lib/widgets/icon_widgets/eth_token_icon.dart b/lib/widgets/icon_widgets/eth_token_icon.dart index 2e0e83a2a..5908270f6 100644 --- a/lib/widgets/icon_widgets/eth_token_icon.dart +++ b/lib/widgets/icon_widgets/eth_token_icon.dart @@ -15,7 +15,6 @@ import 'package:isar/isar.dart'; import '../../models/isar/exchange_cache/currency.dart'; import '../../services/exchange/exchange_data_loading_service.dart'; import '../../themes/coin_icon_provider.dart'; -import '../../wallets/crypto_currency/coins/ethereum.dart'; import '../../wallets/crypto_currency/crypto_currency.dart'; class EthTokenIcon extends ConsumerStatefulWidget { diff --git a/lib/widgets/icon_widgets/pencil_icon.dart b/lib/widgets/icon_widgets/pencil_icon.dart index 1389207a2..0cf1b30e8 100644 --- a/lib/widgets/icon_widgets/pencil_icon.dart +++ b/lib/widgets/icon_widgets/pencil_icon.dart @@ -15,11 +15,11 @@ import '../../utilities/assets.dart'; class PencilIcon extends StatelessWidget { const PencilIcon({ - Key? key, + super.key, this.width = 18, this.height = 18, this.color, - }) : super(key: key); + }); final double width; final double height; diff --git a/lib/widgets/icon_widgets/qrcode_icon.dart b/lib/widgets/icon_widgets/qrcode_icon.dart index cc84ff39a..fa3a28749 100644 --- a/lib/widgets/icon_widgets/qrcode_icon.dart +++ b/lib/widgets/icon_widgets/qrcode_icon.dart @@ -15,11 +15,11 @@ import '../../utilities/assets.dart'; class QrCodeIcon extends StatelessWidget { const QrCodeIcon({ - Key? key, + super.key, this.width = 17, this.height = 17, this.color, - }) : super(key: key); + }); final double width; final double height; diff --git a/lib/widgets/icon_widgets/share_icon.dart b/lib/widgets/icon_widgets/share_icon.dart index 449f04ae1..2e6efac3c 100644 --- a/lib/widgets/icon_widgets/share_icon.dart +++ b/lib/widgets/icon_widgets/share_icon.dart @@ -15,11 +15,11 @@ import '../../utilities/assets.dart'; class ShareIcon extends StatelessWidget { const ShareIcon({ - Key? key, + super.key, this.width = 18, this.height = 18, this.color, - }) : super(key: key); + }); final double width; final double height; diff --git a/lib/widgets/icon_widgets/utxo_status_icon.dart b/lib/widgets/icon_widgets/utxo_status_icon.dart index 3c78308df..30a39b1fc 100644 --- a/lib/widgets/icon_widgets/utxo_status_icon.dart +++ b/lib/widgets/icon_widgets/utxo_status_icon.dart @@ -22,14 +22,14 @@ enum UTXOStatusIconStatus { class UTXOStatusIcon extends StatelessWidget { const UTXOStatusIcon({ - Key? key, + super.key, required this.width, required this.height, required this.blocked, required this.selected, required this.status, required this.background, - }) : super(key: key); + }); final double width; final double height; diff --git a/lib/widgets/icon_widgets/x_icon.dart b/lib/widgets/icon_widgets/x_icon.dart index 03a536e51..b77a967d2 100644 --- a/lib/widgets/icon_widgets/x_icon.dart +++ b/lib/widgets/icon_widgets/x_icon.dart @@ -15,11 +15,11 @@ import '../../utilities/assets.dart'; class XIcon extends StatelessWidget { const XIcon({ - Key? key, + super.key, this.width = 18, this.height = 18, this.color, - }) : super(key: key); + }); final double width; final double height; diff --git a/lib/widgets/loading_indicator.dart b/lib/widgets/loading_indicator.dart index e42216fae..1e9db2809 100644 --- a/lib/widgets/loading_indicator.dart +++ b/lib/widgets/loading_indicator.dart @@ -18,10 +18,10 @@ import '../utilities/assets.dart'; class LoadingIndicator extends ConsumerWidget { const LoadingIndicator({ - Key? key, + super.key, this.width, this.height, - }) : super(key: key); + }); final double? width; final double? height; diff --git a/lib/widgets/master_wallet_card.dart b/lib/widgets/master_wallet_card.dart index 3eb07a6db..33427a752 100644 --- a/lib/widgets/master_wallet_card.dart +++ b/lib/widgets/master_wallet_card.dart @@ -24,10 +24,10 @@ import 'wallet_info_row/wallet_info_row.dart'; class MasterWalletCard extends ConsumerStatefulWidget { const MasterWalletCard({ - Key? key, + super.key, required this.walletId, this.popPrevious = false, - }) : super(key: key); + }); final String walletId; final bool popPrevious; diff --git a/lib/widgets/node_options_sheet.dart b/lib/widgets/node_options_sheet.dart index 37316dd05..82137ac80 100644 --- a/lib/widgets/node_options_sheet.dart +++ b/lib/widgets/node_options_sheet.dart @@ -14,6 +14,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:solana/solana.dart'; +import 'package:tuple/tuple.dart'; + import '../models/node_model.dart'; import '../notifications/show_flush_bar.dart'; import '../pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart'; @@ -34,7 +36,6 @@ import '../utilities/test_monero_node_connection.dart'; import '../utilities/text_styles.dart'; import '../wallets/crypto_currency/crypto_currency.dart'; import 'rounded_white_container.dart'; -import 'package:tuple/tuple.dart'; class NodeOptionsSheet extends ConsumerWidget { const NodeOptionsSheet({ @@ -228,7 +229,8 @@ class NodeOptionsSheet extends ConsumerWidget { final status = ref .watch( nodeServiceChangeNotifierProvider.select( - (value) => value.getPrimaryNodeFor(currency: coin)), + (value) => value.getPrimaryNodeFor(currency: coin), + ), ) ?.id != nodeId diff --git a/lib/widgets/onetime_popups/tor_has_been_add_dialog.dart b/lib/widgets/onetime_popups/tor_has_been_add_dialog.dart index 0c189cf63..ab03f5ae0 100644 --- a/lib/widgets/onetime_popups/tor_has_been_add_dialog.dart +++ b/lib/widgets/onetime_popups/tor_has_been_add_dialog.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:hive_flutter/hive_flutter.dart'; + import '../../db/hive/db.dart'; import '../../utilities/assets.dart'; import '../../utilities/text_styles.dart'; @@ -14,7 +15,8 @@ const _kOneTimeTorHasBeenAddedDialogWasShown = "oneTimeTorHasBeenAddedDialogWasShown"; Future showOneTimeTorHasBeenAddedDialogIfRequired( - BuildContext context) async { + BuildContext context, +) async { final box = await Hive.openBox(DB.boxNameOneTimeDialogsShown); if (!box.get( @@ -102,7 +104,7 @@ class _TorHasBeenAddedDialogState extends State<_TorHasBeenAddedDialog> { ), ], ), - ) + ), ], ), ), diff --git a/lib/widgets/progress_bar.dart b/lib/widgets/progress_bar.dart index a58c42c69..212167dae 100644 --- a/lib/widgets/progress_bar.dart +++ b/lib/widgets/progress_bar.dart @@ -12,13 +12,13 @@ import 'package:flutter/cupertino.dart'; class ProgressBar extends StatelessWidget { const ProgressBar({ - Key? key, + super.key, required this.width, required this.height, required this.fillColor, required this.backgroundColor, required this.percent, - }) : super(key: key); + }); final double width; final double height; @@ -49,7 +49,7 @@ class ProgressBar extends StatelessWidget { color: fillColor, borderRadius: BorderRadius.circular(height / 2), ), - ) + ), ], ), ), diff --git a/lib/widgets/rounded_container.dart b/lib/widgets/rounded_container.dart index d75dc6966..fa8bc3f27 100644 --- a/lib/widgets/rounded_container.dart +++ b/lib/widgets/rounded_container.dart @@ -14,7 +14,7 @@ import 'conditional_parent.dart'; class RoundedContainer extends StatelessWidget { const RoundedContainer({ - Key? key, + super.key, this.child, required this.color, this.padding = const EdgeInsets.all(12), @@ -25,7 +25,7 @@ class RoundedContainer extends StatelessWidget { this.hoverColor, this.boxShadow, this.onPressed, - }) : super(key: key); + }); final Widget? child; final Color color; diff --git a/lib/widgets/rounded_white_container.dart b/lib/widgets/rounded_white_container.dart index 0097397e8..a24059c8c 100644 --- a/lib/widgets/rounded_white_container.dart +++ b/lib/widgets/rounded_white_container.dart @@ -14,7 +14,7 @@ import 'rounded_container.dart'; class RoundedWhiteContainer extends StatelessWidget { const RoundedWhiteContainer({ - Key? key, + super.key, this.child, this.padding = const EdgeInsets.all(12), this.radiusMultiplier = 1.0, @@ -24,7 +24,7 @@ class RoundedWhiteContainer extends StatelessWidget { this.hoverColor, this.boxShadow, this.onPressed, - }) : super(key: key); + }); final Widget? child; final EdgeInsets padding; diff --git a/lib/widgets/shake/shake.dart b/lib/widgets/shake/shake.dart index c19241ee1..798368368 100644 --- a/lib/widgets/shake/shake.dart +++ b/lib/widgets/shake/shake.dart @@ -12,12 +12,12 @@ import 'package:flutter/cupertino.dart'; class Shake extends StatefulWidget { const Shake({ - Key? key, + super.key, required this.child, required this.animationRange, required this.controller, required this.animationDuration, - }) : super(key: key); + }); final Widget child; final double animationRange; diff --git a/lib/widgets/stack_dialog.dart b/lib/widgets/stack_dialog.dart index 58fb69ea2..147e83bbd 100644 --- a/lib/widgets/stack_dialog.dart +++ b/lib/widgets/stack_dialog.dart @@ -15,11 +15,11 @@ import '../utilities/util.dart'; class StackDialogBase extends StatelessWidget { const StackDialogBase({ - Key? key, + super.key, this.child, this.padding = const EdgeInsets.all(24), this.keyboardPaddingAmount = 0, - }) : super(key: key); + }); final EdgeInsets padding; final Widget? child; @@ -67,13 +67,13 @@ class StackDialogBase extends StatelessWidget { class StackDialog extends StatelessWidget { const StackDialog({ - Key? key, + super.key, this.leftButton, this.rightButton, this.icon, required this.title, this.message, - }) : super(key: key); + }); final Widget? leftButton; final Widget? rightButton; @@ -132,7 +132,7 @@ class StackDialog extends StatelessWidget { ? const Spacer() : Expanded(child: rightButton!), ], - ) + ), ], ), ); @@ -141,14 +141,14 @@ class StackDialog extends StatelessWidget { class StackOkDialog extends StatelessWidget { const StackOkDialog({ - Key? key, + super.key, this.leftButton, this.onOkPressed, this.icon, required this.title, this.message, this.desktopPopRootNavigator = false, - }) : super(key: key); + }); final bool desktopPopRootNavigator; final Widget? leftButton; @@ -228,7 +228,7 @@ class StackOkDialog extends StatelessWidget { ), ), ], - ) + ), ], ), ); diff --git a/lib/widgets/stack_text_field.dart b/lib/widgets/stack_text_field.dart index 359f5c0d3..c64c6a5e8 100644 --- a/lib/widgets/stack_text_field.dart +++ b/lib/widgets/stack_text_field.dart @@ -9,6 +9,7 @@ */ import 'package:flutter/material.dart'; + import '../themes/stack_colors.dart'; import '../utilities/text_styles.dart'; import '../utilities/util.dart'; @@ -31,7 +32,8 @@ InputDecoration standardInputDecoration( ? STextStyles.desktopTextExtraSmall(context).copyWith( color: Theme.of(context) .extension()! - .textFieldDefaultText) + .textFieldDefaultText, + ) : STextStyles.desktopTextFieldLabel(context) : STextStyles.fieldLabel(context), hintStyle: isDesktop @@ -39,7 +41,8 @@ InputDecoration standardInputDecoration( ? STextStyles.desktopTextExtraSmall(context).copyWith( color: Theme.of(context) .extension()! - .textFieldDefaultText) + .textFieldDefaultText, + ) : STextStyles.desktopTextFieldLabel(context) : STextStyles.fieldLabel(context), enabledBorder: InputBorder.none, diff --git a/lib/widgets/table_view/table_view.dart b/lib/widgets/table_view/table_view.dart index 4fedb067a..ee208716a 100644 --- a/lib/widgets/table_view/table_view.dart +++ b/lib/widgets/table_view/table_view.dart @@ -12,11 +12,11 @@ import 'package:flutter/material.dart'; class TableView extends StatelessWidget { const TableView({ - Key? key, + super.key, required this.rows, this.rowSpacing = 10.0, this.shrinkWrap = false, - }) : super(key: key); + }); final List rows; final double rowSpacing; @@ -42,7 +42,7 @@ class TableView extends StatelessWidget { ), rows[i], ], - ) + ), ], ); } diff --git a/lib/widgets/table_view/table_view_cell.dart b/lib/widgets/table_view/table_view_cell.dart index fb87ce86d..d0543a2c2 100644 --- a/lib/widgets/table_view/table_view_cell.dart +++ b/lib/widgets/table_view/table_view_cell.dart @@ -12,10 +12,10 @@ import 'package:flutter/material.dart'; class TableViewCell extends StatelessWidget { const TableViewCell({ - Key? key, + super.key, required this.flex, required this.child, - }) : super(key: key); + }); final int flex; final Widget child; diff --git a/lib/widgets/table_view/table_view_row.dart b/lib/widgets/table_view/table_view_row.dart index 3f8bd826d..6d2ddb6c3 100644 --- a/lib/widgets/table_view/table_view_row.dart +++ b/lib/widgets/table_view/table_view_row.dart @@ -15,7 +15,7 @@ import 'table_view_cell.dart'; class TableViewRow extends StatefulWidget { const TableViewRow({ - Key? key, + super.key, required this.cells, required this.expandingChild, this.decoration, @@ -24,7 +24,7 @@ class TableViewRow extends StatefulWidget { this.padding = const EdgeInsets.all(0), this.spacing = 0.0, this.crossAxisAlignment = CrossAxisAlignment.center, - }) : super(key: key); + }); final List cells; final Widget? expandingChild; diff --git a/lib/widgets/textfield_icon_button.dart b/lib/widgets/textfield_icon_button.dart index b600e98cc..8faea5495 100644 --- a/lib/widgets/textfield_icon_button.dart +++ b/lib/widgets/textfield_icon_button.dart @@ -12,14 +12,14 @@ import 'package:flutter/material.dart'; class TextFieldIconButton extends StatefulWidget { const TextFieldIconButton({ - Key? key, + super.key, this.width = 40, this.height = 40, this.onTap, required this.child, this.color = Colors.transparent, this.semanticsLabel = "Button", - }) : super(key: key); + }); final double width; final double height; @@ -66,7 +66,7 @@ class _TextFieldIconButtonState extends State { ), ), ), - ) + ), ), ); } diff --git a/lib/widgets/textfields/exchange_textfield.dart b/lib/widgets/textfields/exchange_textfield.dart index 0266d6637..3f6dfc3ca 100644 --- a/lib/widgets/textfields/exchange_textfield.dart +++ b/lib/widgets/textfields/exchange_textfield.dart @@ -25,7 +25,7 @@ import '../loading_indicator.dart'; class ExchangeTextField extends ConsumerStatefulWidget { const ExchangeTextField({ - Key? key, + super.key, this.borderRadius = 0, this.background, required this.controller, @@ -40,7 +40,7 @@ class ExchangeTextField extends ConsumerStatefulWidget { required this.isWalletCoin, this.currency, this.readOnly = false, - }) : super(key: key); + }); final double borderRadius; final Color? background; @@ -136,8 +136,10 @@ class _ExchangeTextFieldState extends ConsumerState { inputFormatters: [ AmountInputFormatter( decimals: 8, // todo change this - locale: ref.watch(localeServiceChangeNotifierProvider - .select((value) => value.locale)), + locale: ref.watch( + localeServiceChangeNotifierProvider + .select((value) => value.locale), + ), ), // // regex to validate a crypto amount with 8 decimal places // TextInputFormatter.withFunction((oldValue, newValue) => @@ -176,7 +178,8 @@ class _ExchangeTextFieldState extends ConsumerState { child: Builder( builder: (context) { if (AppConfig.isStackCoin( - widget.currency?.ticker)) { + widget.currency?.ticker, + )) { return Center( child: CoinIconForTicker( size: 18, diff --git a/lib/widgets/textfields/frost_step_field.dart b/lib/widgets/textfields/frost_step_field.dart index 8ce64b089..f805dc64a 100644 --- a/lib/widgets/textfields/frost_step_field.dart +++ b/lib/widgets/textfields/frost_step_field.dart @@ -1,6 +1,7 @@ import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; + import '../../themes/stack_colors.dart'; import '../../utilities/constants.dart'; import '../../utilities/logger.dart'; @@ -154,7 +155,8 @@ class _FrostStepFieldState extends State { if (FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( - const Duration(milliseconds: 75)); + const Duration(milliseconds: 75), + ); } final qrResult = await BarcodeScanner.scan(); diff --git a/lib/widgets/toggle.dart b/lib/widgets/toggle.dart index dec082d5f..eec7cec4c 100644 --- a/lib/widgets/toggle.dart +++ b/lib/widgets/toggle.dart @@ -10,13 +10,14 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; + import '../themes/stack_colors.dart'; import '../utilities/text_styles.dart'; import '../utilities/util.dart'; class Toggle extends StatefulWidget { const Toggle({ - Key? key, + super.key, this.onIcon, this.onText, this.offIcon, @@ -28,7 +29,7 @@ class Toggle extends StatefulWidget { required this.onColor, required this.offColor, this.decoration, - }) : super(key: key); + }); final String? onIcon; final String? onText; @@ -142,7 +143,7 @@ class ToggleState extends State { .clamp(0.0, 1.0); }, onHorizontalDragEnd: (details) { - bool oldValue = _isOn; + final bool oldValue = _isOn; if (valueListener.value > 0.5) { valueListener.value = 1.0; _isOn = true; @@ -225,8 +226,8 @@ class ToggleState extends State { widget.onText ?? "", style: isDesktop ? STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: !_isOn ? Theme.of(context) .extension()! @@ -284,8 +285,8 @@ class ToggleState extends State { widget.offText ?? "", style: isDesktop ? STextStyles.desktopTextExtraExtraSmall( - context) - .copyWith( + context, + ).copyWith( color: _isOn ? Theme.of(context) .extension()! diff --git a/lib/widgets/trade_card.dart b/lib/widgets/trade_card.dart index 5305ad584..28a05f9ae 100644 --- a/lib/widgets/trade_card.dart +++ b/lib/widgets/trade_card.dart @@ -14,6 +14,7 @@ import 'package:decimal/decimal.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; + import '../models/exchange/change_now/exchange_transaction_status.dart'; import '../models/exchange/response_objects/trade.dart'; import '../models/isar/stack_theme.dart'; @@ -26,10 +27,10 @@ import 'rounded_white_container.dart'; class TradeCard extends ConsumerWidget { const TradeCard({ - Key? key, + super.key, required this.trade, required this.onTap, - }) : super(key: key); + }); final Trade trade; final VoidCallback onTap; @@ -139,7 +140,8 @@ class TradeCard extends ConsumerWidget { ), Text( Format.extractDateFrom( - trade.timestamp.millisecondsSinceEpoch ~/ 1000), + trade.timestamp.millisecondsSinceEpoch ~/ 1000, + ), style: STextStyles.label(context), ), if (isDesktop) @@ -151,7 +153,7 @@ class TradeCard extends ConsumerWidget { ), ], ), - ) + ), ], ), ), diff --git a/lib/widgets/transaction_card.dart b/lib/widgets/transaction_card.dart index 323fb7ebe..b83b09696 100644 --- a/lib/widgets/transaction_card.dart +++ b/lib/widgets/transaction_card.dart @@ -12,6 +12,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:tuple/tuple.dart'; + import '../models/isar/models/isar_models.dart'; import '../notifications/show_flush_bar.dart'; import '../pages/wallet_view/sub_widgets/tx_icon.dart'; @@ -25,18 +27,15 @@ import '../utilities/constants.dart'; import '../utilities/format.dart'; import '../utilities/text_styles.dart'; import '../utilities/util.dart'; -import '../wallets/crypto_currency/coins/epiccash.dart'; -import '../wallets/crypto_currency/coins/ethereum.dart'; import '../wallets/crypto_currency/crypto_currency.dart'; import 'desktop/desktop_dialog.dart'; -import 'package:tuple/tuple.dart'; class TransactionCard extends ConsumerStatefulWidget { const TransactionCard({ - Key? key, + super.key, required this.transaction, required this.walletId, - }) : super(key: key); + }); final Transaction transaction; final String walletId; @@ -141,19 +140,26 @@ class _TransactionCardState extends ConsumerState { @override Widget build(BuildContext context) { final locale = ref.watch( - localeServiceChangeNotifierProvider.select((value) => value.locale)); + localeServiceChangeNotifierProvider.select((value) => value.locale), + ); final baseCurrency = ref .watch(prefsChangeNotifierProvider.select((value) => value.currency)); final price = ref - .watch(priceAnd24hChangeNotifierProvider.select((value) => isTokenTx - ? value.getTokenPrice(_transaction.otherData!) - : value.getPrice(coin))) + .watch( + priceAnd24hChangeNotifierProvider.select( + (value) => isTokenTx + ? value.getTokenPrice(_transaction.otherData!) + : value.getPrice(coin), + ), + ) .item1; - final currentHeight = ref.watch(pWallets - .select((value) => value.getWallet(walletId).info.cachedChainHeight)); + final currentHeight = ref.watch( + pWallets + .select((value) => value.getWallet(walletId).info.cachedChainHeight), + ); return Material( color: Theme.of(context).extension()!.popupBG, @@ -172,13 +178,15 @@ class _TransactionCardState extends ConsumerState { ), onPressed: () async { if (coin is Epiccash && _transaction.slateId == null) { - unawaited(showFloatingFlushBar( - context: context, - message: - "Restored Epic funds from your Seed have no Data.\nUse Stack Backup to keep your transaction history.", - type: FlushBarType.warning, - duration: const Duration(seconds: 5), - )); + unawaited( + showFloatingFlushBar( + context: context, + message: + "Restored Epic funds from your Seed have no Data.\nUse Stack Backup to keep your transaction history.", + type: FlushBarType.warning, + duration: const Duration(seconds: 5), + ), + ); return; } if (Util.isDesktop) { @@ -280,13 +288,17 @@ class _TransactionCardState extends ConsumerState { ), ), ), - if (ref.watch(prefsChangeNotifierProvider - .select((value) => value.externalCalls))) + if (ref.watch( + prefsChangeNotifierProvider + .select((value) => value.externalCalls), + )) const SizedBox( width: 10, ), - if (ref.watch(prefsChangeNotifierProvider - .select((value) => value.externalCalls))) + if (ref.watch( + prefsChangeNotifierProvider + .select((value) => value.externalCalls), + )) Flexible( child: FittedBox( fit: BoxFit.scaleDown, diff --git a/lib/widgets/trocador_kyc_rating_info.dart b/lib/widgets/trocador_kyc_rating_info.dart index 9c5b04c9f..826c1bc5c 100644 --- a/lib/widgets/trocador_kyc_rating_info.dart +++ b/lib/widgets/trocador_kyc_rating_info.dart @@ -20,7 +20,7 @@ import 'exchange/trocador/trocador_rating_type_enum.dart'; import 'stack_dialog.dart'; class TrocadorKYCRatingInfo extends StatelessWidget { - const TrocadorKYCRatingInfo({Key? key}) : super(key: key); + const TrocadorKYCRatingInfo({super.key}); @override Widget build(BuildContext context) { @@ -71,7 +71,7 @@ class TrocadorKYCRatingInfo extends StatelessWidget { ), ], ), - ) + ), ], ), ), @@ -138,7 +138,7 @@ class TrocadorKYCRatingInfo extends StatelessWidget { label: "Close", onPressed: Navigator.of(context).pop, ), - ) + ), ], ), ), @@ -151,10 +151,10 @@ class TrocadorKYCRatingInfo extends StatelessWidget { class _Rating extends StatelessWidget { const _Rating({ - Key? key, + super.key, required this.kycType, required this.text, - }) : super(key: key); + }); final TrocadorKYCType kycType; final String text; diff --git a/lib/widgets/wallet_card.dart b/lib/widgets/wallet_card.dart index 98c5fbeac..a2185186c 100644 --- a/lib/widgets/wallet_card.dart +++ b/lib/widgets/wallet_card.dart @@ -12,6 +12,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../models/isar/models/ethereum/eth_contract.dart'; import '../pages/token_view/token_view.dart'; import '../pages/wallet_view/wallet_view.dart'; @@ -36,12 +37,12 @@ import 'wallet_info_row/wallet_info_row.dart'; class SimpleWalletCard extends ConsumerWidget { const SimpleWalletCard({ - Key? key, + super.key, required this.walletId, this.contractAddress, this.popPrevious = false, this.desktopNavigatorState, - }) : super(key: key); + }); final String walletId; final String? contractAddress; @@ -131,7 +132,11 @@ class SimpleWalletCard extends ConsumerWidget { final success = await showLoading( whileFuture: _loadTokenWallet( - desktopNavigatorState?.context ?? context, ref, wallet, contract), + desktopNavigatorState?.context ?? context, + ref, + wallet, + contract, + ), context: desktopNavigatorState?.context ?? context, opaqueBG: true, message: "Loading ${contract.name}", diff --git a/lib/widgets/wallet_info_row/wallet_info_row.dart b/lib/widgets/wallet_info_row/wallet_info_row.dart index 3510e389f..2cc35b7aa 100644 --- a/lib/widgets/wallet_info_row/wallet_info_row.dart +++ b/lib/widgets/wallet_info_row/wallet_info_row.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; + import '../../models/isar/models/ethereum/eth_contract.dart'; import '../../pages/token_view/sub_widgets/token_summary.dart'; import '../../providers/db/main_db_provider.dart'; @@ -23,12 +24,12 @@ import 'sub_widgets/wallet_info_row_coin_icon.dart'; class WalletInfoRow extends ConsumerWidget { const WalletInfoRow({ - Key? key, + super.key, required this.walletId, this.onPressedDesktop, this.contractAddress, this.padding = const EdgeInsets.all(0), - }) : super(key: key); + }); final String walletId; final String? contractAddress; @@ -41,8 +42,10 @@ class WalletInfoRow extends ConsumerWidget { EthContract? contract; if (contractAddress != null) { - contract = ref.watch(mainDBProvider - .select((value) => value.getEthContractSync(contractAddress!))); + contract = ref.watch( + mainDBProvider + .select((value) => value.getEthContractSync(contractAddress!)), + ); } if (Util.isDesktop) { @@ -114,7 +117,7 @@ class WalletInfoRow extends ConsumerWidget { ), ], ), - ) + ), ], ), ), diff --git a/lib/widgets/wallet_navigation_bar/components/icons/buy_nav_icon.dart b/lib/widgets/wallet_navigation_bar/components/icons/buy_nav_icon.dart index 586fae900..70e34a109 100644 --- a/lib/widgets/wallet_navigation_bar/components/icons/buy_nav_icon.dart +++ b/lib/widgets/wallet_navigation_bar/components/icons/buy_nav_icon.dart @@ -16,7 +16,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import '../../../../themes/theme_providers.dart'; class BuyNavIcon extends ConsumerWidget { - const BuyNavIcon({Key? key}) : super(key: key); + const BuyNavIcon({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { diff --git a/lib/widgets/wallet_navigation_bar/components/icons/coin_control_nav_icon.dart b/lib/widgets/wallet_navigation_bar/components/icons/coin_control_nav_icon.dart index 94c5bae23..fde47bcfa 100644 --- a/lib/widgets/wallet_navigation_bar/components/icons/coin_control_nav_icon.dart +++ b/lib/widgets/wallet_navigation_bar/components/icons/coin_control_nav_icon.dart @@ -14,7 +14,7 @@ import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; class CoinControlNavIcon extends StatelessWidget { - const CoinControlNavIcon({Key? key}) : super(key: key); + const CoinControlNavIcon({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/widgets/wallet_navigation_bar/components/icons/exchange_nav_icon.dart b/lib/widgets/wallet_navigation_bar/components/icons/exchange_nav_icon.dart index 25e4c0122..f17aabbda 100644 --- a/lib/widgets/wallet_navigation_bar/components/icons/exchange_nav_icon.dart +++ b/lib/widgets/wallet_navigation_bar/components/icons/exchange_nav_icon.dart @@ -16,7 +16,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import '../../../../themes/theme_providers.dart'; class ExchangeNavIcon extends ConsumerWidget { - const ExchangeNavIcon({Key? key}) : super(key: key); + const ExchangeNavIcon({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { diff --git a/lib/widgets/wallet_navigation_bar/components/icons/fusion_nav_icon.dart b/lib/widgets/wallet_navigation_bar/components/icons/fusion_nav_icon.dart index 07b0b16bc..7d46653da 100644 --- a/lib/widgets/wallet_navigation_bar/components/icons/fusion_nav_icon.dart +++ b/lib/widgets/wallet_navigation_bar/components/icons/fusion_nav_icon.dart @@ -14,7 +14,7 @@ import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; class FusionNavIcon extends StatelessWidget { - const FusionNavIcon({Key? key}) : super(key: key); + const FusionNavIcon({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/widgets/wallet_navigation_bar/components/icons/ordinals_nav_icon.dart b/lib/widgets/wallet_navigation_bar/components/icons/ordinals_nav_icon.dart index 98bfecb4f..e347b372a 100644 --- a/lib/widgets/wallet_navigation_bar/components/icons/ordinals_nav_icon.dart +++ b/lib/widgets/wallet_navigation_bar/components/icons/ordinals_nav_icon.dart @@ -14,7 +14,7 @@ import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; class OrdinalsNavIcon extends StatelessWidget { - const OrdinalsNavIcon({Key? key}) : super(key: key); + const OrdinalsNavIcon({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/widgets/wallet_navigation_bar/components/icons/paynym_nav_icon.dart b/lib/widgets/wallet_navigation_bar/components/icons/paynym_nav_icon.dart index 9f11d4136..5236bfec8 100644 --- a/lib/widgets/wallet_navigation_bar/components/icons/paynym_nav_icon.dart +++ b/lib/widgets/wallet_navigation_bar/components/icons/paynym_nav_icon.dart @@ -14,7 +14,7 @@ import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; class PaynymNavIcon extends StatelessWidget { - const PaynymNavIcon({Key? key}) : super(key: key); + const PaynymNavIcon({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/widgets/wallet_navigation_bar/components/icons/receive_nav_icon.dart b/lib/widgets/wallet_navigation_bar/components/icons/receive_nav_icon.dart index 96be35a96..bfd10f900 100644 --- a/lib/widgets/wallet_navigation_bar/components/icons/receive_nav_icon.dart +++ b/lib/widgets/wallet_navigation_bar/components/icons/receive_nav_icon.dart @@ -14,7 +14,7 @@ import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; class ReceiveNavIcon extends StatelessWidget { - const ReceiveNavIcon({Key? key}) : super(key: key); + const ReceiveNavIcon({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/widgets/wallet_navigation_bar/components/icons/send_nav_icon.dart b/lib/widgets/wallet_navigation_bar/components/icons/send_nav_icon.dart index 3d388f3a2..64d0f861f 100644 --- a/lib/widgets/wallet_navigation_bar/components/icons/send_nav_icon.dart +++ b/lib/widgets/wallet_navigation_bar/components/icons/send_nav_icon.dart @@ -14,7 +14,7 @@ import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; class SendNavIcon extends StatelessWidget { - const SendNavIcon({Key? key}) : super(key: key); + const SendNavIcon({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/widgets/wallet_navigation_bar/components/icons/whirlpool_nav_icon.dart b/lib/widgets/wallet_navigation_bar/components/icons/whirlpool_nav_icon.dart index 02c9aaf80..579ea148d 100644 --- a/lib/widgets/wallet_navigation_bar/components/icons/whirlpool_nav_icon.dart +++ b/lib/widgets/wallet_navigation_bar/components/icons/whirlpool_nav_icon.dart @@ -14,7 +14,7 @@ import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; class WhirlpoolNavIcon extends StatelessWidget { - const WhirlpoolNavIcon({Key? key}) : super(key: key); + const WhirlpoolNavIcon({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/widgets/wallet_navigation_bar/components/wallet_navigation_bar_item.dart b/lib/widgets/wallet_navigation_bar/components/wallet_navigation_bar_item.dart index 6cf3c2601..3f5bddc08 100644 --- a/lib/widgets/wallet_navigation_bar/components/wallet_navigation_bar_item.dart +++ b/lib/widgets/wallet_navigation_bar/components/wallet_navigation_bar_item.dart @@ -33,10 +33,10 @@ class WalletNavigationBarItemData { class WalletNavigationBarItem extends ConsumerWidget { const WalletNavigationBarItem({ - Key? key, + super.key, required this.data, required this.disableDuration, - }) : super(key: key); + }); final WalletNavigationBarItemData data; final Duration disableDuration; @@ -95,9 +95,9 @@ class WalletNavigationBarItem extends ConsumerWidget { class WalletNavigationBarMoreItem extends ConsumerWidget { const WalletNavigationBarMoreItem({ - Key? key, + super.key, required this.data, - }) : super(key: key); + }); final WalletNavigationBarItemData data; diff --git a/lib/widgets/wallet_navigation_bar/wallet_navigation_bar.dart b/lib/widgets/wallet_navigation_bar/wallet_navigation_bar.dart index b272048c3..8c93a1c74 100644 --- a/lib/widgets/wallet_navigation_bar/wallet_navigation_bar.dart +++ b/lib/widgets/wallet_navigation_bar/wallet_navigation_bar.dart @@ -21,10 +21,10 @@ final walletNavBarMore = StateProvider.autoDispose((ref) => false); class WalletNavigationBar extends ConsumerStatefulWidget { const WalletNavigationBar({ - Key? key, + super.key, required this.items, required this.moreItems, - }) : super(key: key); + }); final List items; final List moreItems; @@ -131,7 +131,7 @@ class _WalletNavigationBarState extends ConsumerState { boxShadow: [ Theme.of(context) .extension()! - .standardBoxShadow + .standardBoxShadow, ], borderRadius: BorderRadius.circular( 1000, diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index b174939fa..499e835f2 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -35,6 +36,9 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) isar_flutter_libs_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "IsarFlutterLibsPlugin"); isar_flutter_libs_plugin_register_with_registrar(isar_flutter_libs_registrar); + g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin"); + sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar); g_autoptr(FlPluginRegistrar) stack_wallet_backup_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "StackWalletBackupPlugin"); stack_wallet_backup_plugin_register_with_registrar(stack_wallet_backup_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index e1af526f4..a8bc74800 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -9,6 +9,7 @@ list(APPEND FLUTTER_PLUGIN_LIST flutter_libmonero flutter_secure_storage_linux isar_flutter_libs + sqlite3_flutter_libs stack_wallet_backup url_launcher_linux window_size diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index b044b4b00..762e46f56 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -6,9 +6,6 @@ import FlutterMacOS import Foundation import connectivity_plus -import cw_monero -import cw_shared_external -import cw_wownero import desktop_drop import device_info_plus import devicelocale @@ -20,6 +17,7 @@ import lelantus import package_info_plus import path_provider_foundation import share_plus +import sqlite3_flutter_libs import stack_wallet_backup import url_launcher_macos import wakelock_macos @@ -27,9 +25,6 @@ import window_size func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) - CwMoneroPlugin.register(with: registry.registrar(forPlugin: "CwMoneroPlugin")) - CwSharedExternalPlugin.register(with: registry.registrar(forPlugin: "CwSharedExternalPlugin")) - CwWowneroPlugin.register(with: registry.registrar(forPlugin: "CwWowneroPlugin")) DesktopDropPlugin.register(with: registry.registrar(forPlugin: "DesktopDropPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DevicelocalePlugin.register(with: registry.registrar(forPlugin: "DevicelocalePlugin")) @@ -41,6 +36,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) + Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin")) StackWalletBackupPlugin.register(with: registry.registrar(forPlugin: "StackWalletBackupPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin")) diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 35c7171cb..f7100bab5 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -5,48 +5,6 @@ PODS: - connectivity_plus (0.0.1): - FlutterMacOS - ReachabilitySwift - - cw_monero (0.0.1): - - cw_monero/Boost (= 0.0.1) - - cw_monero/Monero (= 0.0.1) - - cw_monero/OpenSSL (= 0.0.1) - - cw_monero/Sodium (= 0.0.1) - - cw_monero/Unbound (= 0.0.1) - - FlutterMacOS - - cw_monero/Boost (0.0.1): - - FlutterMacOS - - cw_monero/Monero (0.0.1): - - FlutterMacOS - - cw_monero/OpenSSL (0.0.1): - - FlutterMacOS - - cw_monero/Sodium (0.0.1): - - FlutterMacOS - - cw_monero/Unbound (0.0.1): - - FlutterMacOS - - cw_shared_external (0.0.1): - - cw_shared_external/Boost (= 0.0.1) - - cw_shared_external/OpenSSL (= 0.0.1) - - FlutterMacOS - - cw_shared_external/Boost (0.0.1): - - FlutterMacOS - - cw_shared_external/OpenSSL (0.0.1): - - FlutterMacOS - - cw_wownero (0.0.1): - - cw_wownero/Boost (= 0.0.1) - - cw_wownero/OpenSSL (= 0.0.1) - - cw_wownero/Sodium (= 0.0.1) - - cw_wownero/Unbound (= 0.0.1) - - cw_wownero/Wownero (= 0.0.1) - - FlutterMacOS - - cw_wownero/Boost (0.0.1): - - FlutterMacOS - - cw_wownero/OpenSSL (0.0.1): - - FlutterMacOS - - cw_wownero/Sodium (0.0.1): - - FlutterMacOS - - cw_wownero/Unbound (0.0.1): - - FlutterMacOS - - cw_wownero/Wownero (0.0.1): - - FlutterMacOS - desktop_drop (0.0.1): - FlutterMacOS - device_info_plus (0.0.1): @@ -76,6 +34,21 @@ PODS: - ReachabilitySwift (5.0.0) - share_plus (0.0.1): - FlutterMacOS + - sqlite3 (3.46.0): + - sqlite3/common (= 3.46.0) + - sqlite3/common (3.46.0) + - sqlite3/fts5 (3.46.0): + - sqlite3/common + - sqlite3/perf-threadsafe (3.46.0): + - sqlite3/common + - sqlite3/rtree (3.46.0): + - sqlite3/common + - sqlite3_flutter_libs (0.0.1): + - FlutterMacOS + - sqlite3 (~> 3.46.0) + - sqlite3/fts5 + - sqlite3/perf-threadsafe + - sqlite3/rtree - stack_wallet_backup (0.0.1): - FlutterMacOS - tor_ffi_plugin (0.0.1) @@ -89,9 +62,6 @@ PODS: DEPENDENCIES: - coinlib_flutter (from `Flutter/ephemeral/.symlinks/plugins/coinlib_flutter/darwin`) - connectivity_plus (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos`) - - cw_monero (from `Flutter/ephemeral/.symlinks/plugins/cw_monero/macos`) - - cw_shared_external (from `Flutter/ephemeral/.symlinks/plugins/cw_shared_external/macos`) - - cw_wownero (from `Flutter/ephemeral/.symlinks/plugins/cw_wownero/macos`) - desktop_drop (from `Flutter/ephemeral/.symlinks/plugins/desktop_drop/macos`) - device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`) - devicelocale (from `Flutter/ephemeral/.symlinks/plugins/devicelocale/macos`) @@ -106,6 +76,7 @@ DEPENDENCIES: - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`) + - sqlite3_flutter_libs (from `Flutter/ephemeral/.symlinks/plugins/sqlite3_flutter_libs/macos`) - stack_wallet_backup (from `Flutter/ephemeral/.symlinks/plugins/stack_wallet_backup/macos`) - tor_ffi_plugin (from `Flutter/ephemeral/.symlinks/plugins/tor_ffi_plugin/macos`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) @@ -115,18 +86,13 @@ DEPENDENCIES: SPEC REPOS: trunk: - ReachabilitySwift + - sqlite3 EXTERNAL SOURCES: coinlib_flutter: :path: Flutter/ephemeral/.symlinks/plugins/coinlib_flutter/darwin connectivity_plus: :path: Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos - cw_monero: - :path: Flutter/ephemeral/.symlinks/plugins/cw_monero/macos - cw_shared_external: - :path: Flutter/ephemeral/.symlinks/plugins/cw_shared_external/macos - cw_wownero: - :path: Flutter/ephemeral/.symlinks/plugins/cw_wownero/macos desktop_drop: :path: Flutter/ephemeral/.symlinks/plugins/desktop_drop/macos device_info_plus: @@ -155,6 +121,8 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin share_plus: :path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos + sqlite3_flutter_libs: + :path: Flutter/ephemeral/.symlinks/plugins/sqlite3_flutter_libs/macos stack_wallet_backup: :path: Flutter/ephemeral/.symlinks/plugins/stack_wallet_backup/macos tor_ffi_plugin: @@ -169,9 +137,6 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: coinlib_flutter: 6abec900d67762a6e7ccfd567a3cd3ae00bbee35 connectivity_plus: 18d3c32514c886e046de60e9c13895109866c747 - cw_monero: 7acce7238d217e3993ecac6ec2dec07be728769a - cw_shared_external: c6adfd29c9be4d64f84e1fa9c541ccbcbdb6b457 - cw_wownero: bcd7f2ad6c0a3e8e2a51756fb14f0579b6f8b4ff desktop_drop: 69eeff437544aa619c8db7f4481b3a65f7696898 device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f devicelocale: 9f0f36ac651cabae2c33f32dcff4f32b61c38225 @@ -187,6 +152,8 @@ SPEC CHECKSUMS: path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 share_plus: 76dd39142738f7a68dd57b05093b5e8193f220f7 + sqlite3: 154b084339ede06960a5b3c8160066adc9176b7d + sqlite3_flutter_libs: 1be4459672f8168ded2d8667599b8e3ca5e72b83 stack_wallet_backup: 6ebc60b1bdcf11cf1f1cbad9aa78332e1e15778c tor_ffi_plugin: 2566c1ed174688cca560fa0c64b7a799c66f07cb url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 @@ -195,4 +162,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 -COCOAPODS: 1.14.3 +COCOAPODS: 1.15.2 diff --git a/pubspec.lock b/pubspec.lock index c4e4adb85..47dc7ef13 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -346,10 +346,10 @@ packages: dependency: transitive description: name: cross_file - sha256: fd832b5384d0d6da4f6df60b854d33accaaeb63aa9e10e736a87381f08dee2cb + sha256: "55d7b444feb71301ef6b8838dbc1ae02e63dd48c8773f3810ff53bb1e2945b32" url: "https://pub.dev" source: hosted - version: "0.3.3+5" + version: "0.3.4+1" crypto: dependency: "direct main" description: @@ -388,13 +388,6 @@ packages: relative: true source: path version: "0.0.1" - cw_shared_external: - dependency: transitive - description: - path: "crypto_plugins/flutter_libmonero/cw_shared_external" - relative: true - source: path - version: "0.0.1" cw_wownero: dependency: "direct main" description: @@ -623,11 +616,11 @@ packages: dependency: "direct main" description: path: "." - ref: f0930d9fa79d347b2a0e25a7de4f5a4a88a9a907 - resolved-ref: f0930d9fa79d347b2a0e25a7de4f5a4a88a9a907 - url: "https://github.com/muttsu-623/flutter_file_picker.git" + ref: "9abc0930081c9859884e073bd25ab88b2114d9e7" + resolved-ref: "9abc0930081c9859884e073bd25ab88b2114d9e7" + url: "https://github.com/cypherstack/flutter_file_picker.git" source: git - version: "5.3.3" + version: "8.0.3" fixnum: dependency: transitive description: @@ -696,8 +689,8 @@ packages: dependency: "direct main" description: path: "." - ref: "439727b278250c61a291f5335c298c0f2d952517" - resolved-ref: "439727b278250c61a291f5335c298c0f2d952517" + ref: "7a11d0cadf8c7a6a5d5144dab18cef9536aa5943" + resolved-ref: "7a11d0cadf8c7a6a5d5144dab18cef9536aa5943" url: "https://github.com/cypherstack/flutter_libsparkmobile.git" source: git version: "0.0.1" @@ -753,10 +746,10 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: f185ac890306b5779ecbd611f52502d8d4d63d27703ef73161ca0407e815f02c + sha256: "8cf40eebf5dec866a6d1956ad7b4f7016e6c0cc69847ab946833b7d43743809f" url: "https://pub.dev" source: hosted - version: "2.0.16" + version: "2.0.19" flutter_riverpod: dependency: "direct main" description: @@ -1188,10 +1181,10 @@ packages: dependency: "direct dev" description: name: mockito - sha256: "7d5b53bcd556c1bc7ffbe4e4d5a19c3e112b7e925e9e172dd7c6ad0630812616" + sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" url: "https://pub.dev" source: hosted - version: "5.4.2" + version: "5.4.4" mocktail: dependency: transitive description: @@ -1200,6 +1193,15 @@ packages: url: "https://pub.dev" source: hosted version: "0.2.0" + monero: + dependency: "direct main" + description: + path: "." + ref: "6a17a405a1a260fa228b2f4fc94044088a4335ac" + resolved-ref: "6a17a405a1a260fa228b2f4fc94044088a4335ac" + url: "https://www.github.com/mrcyjanek/monero.dart" + source: git + version: "0.0.0" mutex: dependency: "direct main" description: @@ -1388,10 +1390,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.6" + version: "2.1.8" pointycastle: dependency: "direct main" description: @@ -1631,6 +1633,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sqlite3: + dependency: "direct main" + description: + name: sqlite3 + sha256: b384f598b813b347c5a7e5ffad82cbaff1bec3d1561af267041e66f6f0899295 + url: "https://pub.dev" + source: hosted + version: "2.4.3" + sqlite3_flutter_libs: + dependency: "direct main" + description: + name: sqlite3_flutter_libs + sha256: "1e62698dc1ab396152ccaf3b3990d826244e9f3c8c39b51805f209adcd6dbea3" + url: "https://pub.dev" + source: hosted + version: "0.5.22" stack_trace: dependency: transitive description: @@ -2047,10 +2065,10 @@ packages: dependency: transitive description: name: win32 - sha256: c97defd418eef4ec88c0d1652cdce84b9f7b63dd7198e266d06ac1710d527067 + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" url: "https://pub.dev" source: hosted - version: "5.0.8" + version: "5.2.0" win32_registry: dependency: transitive description: diff --git a/scripts/android/build_all.sh b/scripts/android/build_all.sh index 861f02cb5..7cb2e083d 100755 --- a/scripts/android/build_all.sh +++ b/scripts/android/build_all.sh @@ -12,11 +12,11 @@ mkdir -p build PLUGINS_DIR=../../crypto_plugins -(cd "${PLUGINS_DIR}"/flutter_liblelantus/scripts/android && ./build_all.sh ) & -(cd "${PLUGINS_DIR}"/flutter_libepiccash/scripts/android && ./build_all.sh ) & -(cd "${PLUGINS_DIR}"/flutter_libmonero/scripts/android/ && ./build_all.sh ) && -set_rust_to_1720 && -(cd "${PLUGINS_DIR}"/frostdart/scripts/android && ./build_all.sh ) & +(cd "${PLUGINS_DIR}"/flutter_liblelantus/scripts/android && ./build_all.sh ) +(cd "${PLUGINS_DIR}"/flutter_libepiccash/scripts/android && ./build_all.sh ) +(cd "${PLUGINS_DIR}"/flutter_libmonero/scripts/android/ && ./build_all.sh ) +set_rust_to_1720 +(cd "${PLUGINS_DIR}"/frostdart/scripts/android && ./build_all.sh ) wait echo "Done building" diff --git a/scripts/android/build_all_campfire.sh b/scripts/android/build_all_campfire.sh new file mode 100755 index 000000000..7cb2e083d --- /dev/null +++ b/scripts/android/build_all_campfire.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -x -e + +# libepiccash requires old rust +source ../rust_version.sh +set_rust_to_1671 + +mkdir -p build +. ./config.sh +./install_ndk.sh + +PLUGINS_DIR=../../crypto_plugins + +(cd "${PLUGINS_DIR}"/flutter_liblelantus/scripts/android && ./build_all.sh ) +(cd "${PLUGINS_DIR}"/flutter_libepiccash/scripts/android && ./build_all.sh ) +(cd "${PLUGINS_DIR}"/flutter_libmonero/scripts/android/ && ./build_all.sh ) +set_rust_to_1720 +(cd "${PLUGINS_DIR}"/frostdart/scripts/android && ./build_all.sh ) + +wait +echo "Done building" diff --git a/scripts/android/build_all_duo.sh b/scripts/android/build_all_duo.sh index bca175541..aec2ebbb3 100755 --- a/scripts/android/build_all_duo.sh +++ b/scripts/android/build_all_duo.sh @@ -14,11 +14,11 @@ mkdir -p build PLUGINS_DIR=../../crypto_plugins -(cd "${PLUGINS_DIR}"/flutter_liblelantus/scripts/android && ./build_all.sh ) & -(cd "${PLUGINS_DIR}"/flutter_libepiccash/scripts/android && ./build_all.sh ) & -(cd "${PLUGINS_DIR}"/flutter_libmonero/scripts/android/ && ./build_all.sh ) && -set_rust_to_1720 && -(cd "${PLUGINS_DIR}"/frostdart/scripts/android && ./build_all.sh ) & +(cd "${PLUGINS_DIR}"/flutter_liblelantus/scripts/android && ./build_all.sh ) +(cd "${PLUGINS_DIR}"/flutter_libepiccash/scripts/android && ./build_all.sh ) +(cd "${PLUGINS_DIR}"/flutter_libmonero/scripts/android/ && ./build_all.sh ) +set_rust_to_1720 +(cd "${PLUGINS_DIR}"/frostdart/scripts/android && ./build_all.sh ) wait echo "Done building" diff --git a/scripts/app_config/configure_campfire.sh b/scripts/app_config/configure_campfire.sh new file mode 100755 index 000000000..6298443db --- /dev/null +++ b/scripts/app_config/configure_campfire.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +set -x -e + +# Configure files for Duo. +APP_BUILD_PLATFORM=$1 + +export NEW_NAME="Campfire" +if [[ "$APP_BUILD_PLATFORM" != "ios" ]]; then + export NEW_APP_ID="com.cypherstack.campfire" +else + # for some reason this was different in the old campfire code for ios + export NEW_APP_ID="com.cypherstack.campfirefirowallet" +fi +export NEW_APP_ID_CAMEL="com.cypherstack.campfire" +export NEW_APP_ID_SNAKE="com.cypherstack.campfire" +export NEW_BASIC_NAME="campfire" + +NEW_PUBSPEC_NAME="paymint" # paymint used in original pubspec for some reason +PUBSPEC_FILE="${APP_PROJECT_ROOT_DIR}/pubspec.yaml" + +# String replacements. +if [[ "$(uname)" == 'Darwin' ]]; then + # macos specific sed + sed -i '' "s/name: PLACEHOLDER/name: ${NEW_PUBSPEC_NAME}/g" "${PUBSPEC_FILE}" + sed -i '' "s/description: PLACEHOLDER/description: ${NEW_NAME}/g" "${PUBSPEC_FILE}" +else + sed -i "s/name: PLACEHOLDER/name: ${NEW_PUBSPEC_NAME}/g" "${PUBSPEC_FILE}" + sed -i "s/description: PLACEHOLDER/description: ${NEW_NAME}/g" "${PUBSPEC_FILE}" +fi + +pushd "${APP_PROJECT_ROOT_DIR}" +BUILT_COMMIT_HASH=$(git log -1 --pretty=format:"%H") +popd + +APP_CONFIG_DART_FILE="${APP_PROJECT_ROOT_DIR}/lib/app_config.g.dart" +rm -f "$APP_CONFIG_DART_FILE" +cat << EOF > "$APP_CONFIG_DART_FILE" +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'app_config.dart'; + +const _prefix = "Campfire"; +const _separator = ""; +const _suffix = ""; +const _appDataDirName = "campfire"; +const _commitHash = "$BUILT_COMMIT_HASH"; + +const Set _features = {}; + +const ({String light, String dark})? _appIconAsset = ( + light: "assets/in_app_logo_icons/campfire-icon_light.svg", + dark: "assets/in_app_logo_icons/campfire-icon_dark.svg", +); + +final List _supportedCoins = List.unmodifiable([ + Firo(CryptoCurrencyNetwork.main), + Firo(CryptoCurrencyNetwork.test), +]); + +EOF \ No newline at end of file diff --git a/scripts/app_config/configure_stack_duo.sh b/scripts/app_config/configure_stack_duo.sh index 16b68a030..56c12bd37 100755 --- a/scripts/app_config/configure_stack_duo.sh +++ b/scripts/app_config/configure_stack_duo.sh @@ -40,6 +40,12 @@ const _suffix = "Duo"; const _appDataDirName = "stackduo"; const _commitHash = "$BUILT_COMMIT_HASH"; +const Set _features = { + AppFeature.themeSelection, + AppFeature.buy, + AppFeature.swap +}; + const ({String light, String dark})? _appIconAsset = ( light: "assets/in_app_logo_icons/stack-duo-icon_light.svg", dark: "assets/in_app_logo_icons/stack-duo-icon_dark.svg", diff --git a/scripts/app_config/configure_stack_wallet.sh b/scripts/app_config/configure_stack_wallet.sh index cd0b463b5..7c0dc2a67 100755 --- a/scripts/app_config/configure_stack_wallet.sh +++ b/scripts/app_config/configure_stack_wallet.sh @@ -40,28 +40,34 @@ const _suffix = "Wallet"; const _appDataDirName = "stackwallet"; const _commitHash = "$BUILT_COMMIT_HASH"; +const Set _features = { + AppFeature.themeSelection, + AppFeature.buy, + AppFeature.swap +}; + const ({String light, String dark})? _appIconAsset = null; final List _supportedCoins = List.unmodifiable([ Bitcoin(CryptoCurrencyNetwork.main), - BitcoinFrost(CryptoCurrencyNetwork.main), - Litecoin(CryptoCurrencyNetwork.main), + Monero(CryptoCurrencyNetwork.main), + Banano(CryptoCurrencyNetwork.main), Bitcoincash(CryptoCurrencyNetwork.main), + BitcoinFrost(CryptoCurrencyNetwork.main), Dogecoin(CryptoCurrencyNetwork.main), - Epiccash(CryptoCurrencyNetwork.main), Ecash(CryptoCurrencyNetwork.main), + Epiccash(CryptoCurrencyNetwork.main), Ethereum(CryptoCurrencyNetwork.main), Firo(CryptoCurrencyNetwork.main), - Monero(CryptoCurrencyNetwork.main), + Litecoin(CryptoCurrencyNetwork.main), + Nano(CryptoCurrencyNetwork.main), + Namecoin(CryptoCurrencyNetwork.main), Particl(CryptoCurrencyNetwork.main), Peercoin(CryptoCurrencyNetwork.main), Solana(CryptoCurrencyNetwork.main), Stellar(CryptoCurrencyNetwork.main), Tezos(CryptoCurrencyNetwork.main), Wownero(CryptoCurrencyNetwork.main), - Namecoin(CryptoCurrencyNetwork.main), - Nano(CryptoCurrencyNetwork.main), - Banano(CryptoCurrencyNetwork.main), Bitcoin(CryptoCurrencyNetwork.test), BitcoinFrost(CryptoCurrencyNetwork.test), Litecoin(CryptoCurrencyNetwork.test), diff --git a/scripts/app_config/shared/asset_generators.sh b/scripts/app_config/shared/asset_generators.sh index a0150866a..50d035a65 100755 --- a/scripts/app_config/shared/asset_generators.sh +++ b/scripts/app_config/shared/asset_generators.sh @@ -11,8 +11,17 @@ APP_BUILD_PLATFORM=$1 # run icon and image generators pushd "${APP_PROJECT_ROOT_DIR}" -flutter pub get -#native splash screen not used -#dart run flutter_native_splash:create -dart run flutter_launcher_icons -f "${APP_PROJECT_ROOT_DIR}/scripts/app_config/platforms/${APP_BUILD_PLATFORM}/flutter_launcher_icons.yaml" +YAML_FILE="${APP_PROJECT_ROOT_DIR}/scripts/app_config/platforms/${APP_BUILD_PLATFORM}/flutter_launcher_icons.yaml" +if [[ "${APP_BUILD_PLATFORM}" = 'windows' ]]; then + cmd.exe /c flutter pub get + WIN_PATH_VERSION=$(wslpath -w ${YAML_FILE}) + cmd.exe /c dart run flutter_launcher_icons -f "${WIN_PATH_VERSION}" + #native splash screen not used + #cmd.exe /c dart run flutter_native_splash:create +else + flutter pub get + dart run flutter_launcher_icons -f "${YAML_FILE}" + #native splash screen not used + #dart run flutter_native_splash:create +fi popd \ No newline at end of file diff --git a/scripts/app_config/shared/link_assets.sh b/scripts/app_config/shared/link_assets.sh index c443b1262..90074e459 100755 --- a/scripts/app_config/shared/link_assets.sh +++ b/scripts/app_config/shared/link_assets.sh @@ -2,12 +2,13 @@ set -x -e -if [ $# -ne 1 ]; then - echo "Usage: $0 " +if [ $# -ne 2 ]; then + echo "Usage: $0 " exit 1 fi SELECT_ASSETS_DIR=$1 +APP_BUILD_PLATFORM=$2 # declare full paths ASSET_SOURCES_DIR="${APP_PROJECT_ROOT_DIR}/asset_sources" @@ -16,14 +17,16 @@ ASSETS_DIR="${APP_PROJECT_ROOT_DIR}/assets" # finally update symlinks -rm -f "${ASSETS_DIR}/default_themes" -ln -s "${ASSET_SOURCES_DIR}/bundled_themes/${SELECT_ASSETS_DIR}" "${ASSETS_DIR}/default_themes" +for dirname in "default_themes" "icon" "lottie" "in_app_logo_icons"; do + LINK_SOURCE_DIR="${ASSET_SOURCES_DIR}/${dirname}/${SELECT_ASSETS_DIR}" -rm -f "${ASSETS_DIR}/icon" -ln -s "${ASSET_SOURCES_DIR}/icon/${SELECT_ASSETS_DIR}" "${ASSETS_DIR}/icon" + rm -f "${ASSETS_DIR}/${dirname}" -rm -f "${ASSETS_DIR}/lottie" -ln -s "${ASSET_SOURCES_DIR}/lottie/${SELECT_ASSETS_DIR}" "${ASSETS_DIR}/lottie" - -rm -f "${ASSETS_DIR}/in_app_logo_icons" -ln -s "${ASSET_SOURCES_DIR}/in_app_logo_icons/${SELECT_ASSETS_DIR}" "${ASSETS_DIR}/in_app_logo_icons" + if [[ "${APP_BUILD_PLATFORM}" = 'windows' ]]; then + LINK_SOURCE_DIR_WIN_PATH_VERSION=$(wslpath -w "${LINK_SOURCE_DIR}") + LINK_NAME_WIN_PATH_VERSION=$(wslpath -w "${ASSETS_DIR}") + cmd.exe /c mklink /D "${LINK_NAME_WIN_PATH_VERSION}\\${dirname}" "${LINK_SOURCE_DIR_WIN_PATH_VERSION}" + else + ln -s "${LINK_SOURCE_DIR}" "${ASSETS_DIR}/${dirname}" + fi +done diff --git a/scripts/app_config/templates/android/app/build.gradle b/scripts/app_config/templates/android/app/build.gradle index 4d134796a..e440e9d0d 100644 --- a/scripts/app_config/templates/android/app/build.gradle +++ b/scripts/app_config/templates/android/app/build.gradle @@ -45,7 +45,12 @@ android { lintOptions { disable 'InvalidPackage' } - + packagingOptions { + pickFirst 'lib/x86/libc++_shared.so' + pickFirst 'lib/x86_64/libc++_shared.so' + pickFirst 'lib/armeabi-v7a/libc++_shared.so' + pickFirst 'lib/arm64-v8a/libc++_shared.so' + } defaultConfig { applicationId "com.place.holder" minSdkVersion 23 diff --git a/scripts/app_config/templates/android/app/src/main/AndroidManifest.xml b/scripts/app_config/templates/android/app/src/main/AndroidManifest.xml index bfcdf171f..2ae40734c 100644 --- a/scripts/app_config/templates/android/app/src/main/AndroidManifest.xml +++ b/scripts/app_config/templates/android/app/src/main/AndroidManifest.xml @@ -23,7 +23,8 @@ android:requestLegacyExternalStorage="true" android:icon="@mipmap/ic_launcher" android:allowBackup="false" - android:fullBackupContent="false"> + android:fullBackupContent="false" + android:extractNativeLibs="true"> (super.noSuchMethod( Invocation.getter(#host), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.getter(#host), + ), ) as String); @override int get port => (super.noSuchMethod( @@ -132,16 +138,16 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { returnValue: false, ) as bool); @override - _i6.Future closeAdapter() => (super.noSuchMethod( + _i7.Future closeAdapter() => (super.noSuchMethod( Invocation.method( #closeAdapter, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future request({ + _i7.Future request({ required String? command, List? args = const [], String? requestID, @@ -160,10 +166,10 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { #requestTimeout: requestTimeout, }, ), - returnValue: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future> batchRequest({ + _i7.Future> batchRequest({ required String? command, required List? args, Duration? requestTimeout = const Duration(seconds: 60), @@ -180,10 +186,10 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { #retries: retries, }, ), - returnValue: _i6.Future>.value([]), - ) as _i6.Future>); + returnValue: _i7.Future>.value([]), + ) as _i7.Future>); @override - _i6.Future ping({ + _i7.Future ping({ String? requestID, int? retryCount = 1, }) => @@ -196,10 +202,10 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { #retryCount: retryCount, }, ), - returnValue: _i6.Future.value(false), - ) as _i6.Future); + returnValue: _i7.Future.value(false), + ) as _i7.Future); @override - _i6.Future> getBlockHeadTip({String? requestID}) => + _i7.Future> getBlockHeadTip({String? requestID}) => (super.noSuchMethod( Invocation.method( #getBlockHeadTip, @@ -207,10 +213,10 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i6.Future>.value({}), - ) as _i6.Future>); + _i7.Future>.value({}), + ) as _i7.Future>); @override - _i6.Future> getServerFeatures({String? requestID}) => + _i7.Future> getServerFeatures({String? requestID}) => (super.noSuchMethod( Invocation.method( #getServerFeatures, @@ -218,10 +224,10 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i6.Future>.value({}), - ) as _i6.Future>); + _i7.Future>.value({}), + ) as _i7.Future>); @override - _i6.Future broadcastTransaction({ + _i7.Future broadcastTransaction({ required String? rawTx, String? requestID, }) => @@ -234,10 +240,20 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i6.Future.value(''), - ) as _i6.Future); + returnValue: _i7.Future.value(_i6.dummyValue( + this, + Invocation.method( + #broadcastTransaction, + [], + { + #rawTx: rawTx, + #requestID: requestID, + }, + ), + )), + ) as _i7.Future); @override - _i6.Future> getBalance({ + _i7.Future> getBalance({ required String? scripthash, String? requestID, }) => @@ -251,10 +267,10 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { }, ), returnValue: - _i6.Future>.value({}), - ) as _i6.Future>); + _i7.Future>.value({}), + ) as _i7.Future>); @override - _i6.Future>> getHistory({ + _i7.Future>> getHistory({ required String? scripthash, String? requestID, }) => @@ -267,11 +283,11 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i6.Future>>.value( + returnValue: _i7.Future>>.value( >[]), - ) as _i6.Future>>); + ) as _i7.Future>>); @override - _i6.Future>>> getBatchHistory( + _i7.Future>>> getBatchHistory( {required List? args}) => (super.noSuchMethod( Invocation.method( @@ -279,11 +295,11 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { [], {#args: args}, ), - returnValue: _i6.Future>>>.value( + returnValue: _i7.Future>>>.value( >>[]), - ) as _i6.Future>>>); + ) as _i7.Future>>>); @override - _i6.Future>> getUTXOs({ + _i7.Future>> getUTXOs({ required String? scripthash, String? requestID, }) => @@ -296,11 +312,11 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i6.Future>>.value( + returnValue: _i7.Future>>.value( >[]), - ) as _i6.Future>>); + ) as _i7.Future>>); @override - _i6.Future>>> getBatchUTXOs( + _i7.Future>>> getBatchUTXOs( {required List? args}) => (super.noSuchMethod( Invocation.method( @@ -308,11 +324,11 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { [], {#args: args}, ), - returnValue: _i6.Future>>>.value( + returnValue: _i7.Future>>>.value( >>[]), - ) as _i6.Future>>>); + ) as _i7.Future>>>); @override - _i6.Future> getTransaction({ + _i7.Future> getTransaction({ required String? txHash, bool? verbose = true, String? requestID, @@ -328,10 +344,10 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { }, ), returnValue: - _i6.Future>.value({}), - ) as _i6.Future>); + _i7.Future>.value({}), + ) as _i7.Future>); @override - _i6.Future> getLelantusAnonymitySet({ + _i7.Future> getLelantusAnonymitySet({ String? groupId = r'1', String? blockhash = r'', String? requestID, @@ -347,10 +363,10 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { }, ), returnValue: - _i6.Future>.value({}), - ) as _i6.Future>); + _i7.Future>.value({}), + ) as _i7.Future>); @override - _i6.Future getLelantusMintData({ + _i7.Future getLelantusMintData({ dynamic mints, String? requestID, }) => @@ -363,10 +379,10 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future> getLelantusUsedCoinSerials({ + _i7.Future> getLelantusUsedCoinSerials({ String? requestID, required int? startNumber, }) => @@ -380,20 +396,20 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { }, ), returnValue: - _i6.Future>.value({}), - ) as _i6.Future>); + _i7.Future>.value({}), + ) as _i7.Future>); @override - _i6.Future getLelantusLatestCoinId({String? requestID}) => + _i7.Future getLelantusLatestCoinId({String? requestID}) => (super.noSuchMethod( Invocation.method( #getLelantusLatestCoinId, [], {#requestID: requestID}, ), - returnValue: _i6.Future.value(0), - ) as _i6.Future); + returnValue: _i7.Future.value(0), + ) as _i7.Future); @override - _i6.Future> getSparkAnonymitySet({ + _i7.Future> getSparkAnonymitySet({ String? coinGroupId = r'1', String? startBlockHash = r'', String? requestID, @@ -409,26 +425,26 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { }, ), returnValue: - _i6.Future>.value({}), - ) as _i6.Future>); + _i7.Future>.value({}), + ) as _i7.Future>); @override - _i6.Future> getSparkUsedCoinsTags({ + _i7.Future> getSparkUnhashedUsedCoinsTags({ String? requestID, required int? startNumber, }) => (super.noSuchMethod( Invocation.method( - #getSparkUsedCoinsTags, + #getSparkUnhashedUsedCoinsTags, [], { #requestID: requestID, #startNumber: startNumber, }, ), - returnValue: _i6.Future>.value({}), - ) as _i6.Future>); + returnValue: _i7.Future>.value([]), + ) as _i7.Future>); @override - _i6.Future>> getSparkMintMetaData({ + _i7.Future>> getSparkMintMetaData({ String? requestID, required List? sparkCoinHashes, }) => @@ -441,21 +457,21 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { #sparkCoinHashes: sparkCoinHashes, }, ), - returnValue: _i6.Future>>.value( + returnValue: _i7.Future>>.value( >[]), - ) as _i6.Future>>); + ) as _i7.Future>>); @override - _i6.Future getSparkLatestCoinId({String? requestID}) => + _i7.Future getSparkLatestCoinId({String? requestID}) => (super.noSuchMethod( Invocation.method( #getSparkLatestCoinId, [], {#requestID: requestID}, ), - returnValue: _i6.Future.value(0), - ) as _i6.Future); + returnValue: _i7.Future.value(0), + ) as _i7.Future); @override - _i6.Future> getFeeRate({String? requestID}) => + _i7.Future> getFeeRate({String? requestID}) => (super.noSuchMethod( Invocation.method( #getFeeRate, @@ -463,10 +479,10 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i6.Future>.value({}), - ) as _i6.Future>); + _i7.Future>.value({}), + ) as _i7.Future>); @override - _i6.Future<_i3.Decimal> estimateFee({ + _i7.Future<_i3.Decimal> estimateFee({ String? requestID, required int? blocks, }) => @@ -479,7 +495,7 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { #blocks: blocks, }, ), - returnValue: _i6.Future<_i3.Decimal>.value(_FakeDecimal_2( + returnValue: _i7.Future<_i3.Decimal>.value(_FakeDecimal_2( this, Invocation.method( #estimateFee, @@ -490,15 +506,15 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { }, ), )), - ) as _i6.Future<_i3.Decimal>); + ) as _i7.Future<_i3.Decimal>); @override - _i6.Future<_i3.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( + _i7.Future<_i3.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( Invocation.method( #relayFee, [], {#requestID: requestID}, ), - returnValue: _i6.Future<_i3.Decimal>.value(_FakeDecimal_2( + returnValue: _i7.Future<_i3.Decimal>.value(_FakeDecimal_2( this, Invocation.method( #relayFee, @@ -506,13 +522,13 @@ class MockElectrumXClient extends _i1.Mock implements _i5.ElectrumXClient { {#requestID: requestID}, ), )), - ) as _i6.Future<_i3.Decimal>); + ) as _i7.Future<_i3.Decimal>); } /// A class which mocks [Prefs]. /// /// See the documentation for Mockito's code generation for more information. -class MockPrefs extends _i1.Mock implements _i7.Prefs { +class MockPrefs extends _i1.Mock implements _i8.Prefs { MockPrefs() { _i1.throwOnMissingStub(this); } @@ -568,12 +584,12 @@ class MockPrefs extends _i1.Mock implements _i7.Prefs { returnValueForMissingStub: null, ); @override - _i8.SyncingType get syncType => (super.noSuchMethod( + _i9.SyncingType get syncType => (super.noSuchMethod( Invocation.getter(#syncType), - returnValue: _i8.SyncingType.currentWalletOnly, - ) as _i8.SyncingType); + returnValue: _i9.SyncingType.currentWalletOnly, + ) as _i9.SyncingType); @override - set syncType(_i8.SyncingType? syncType) => super.noSuchMethod( + set syncType(_i9.SyncingType? syncType) => super.noSuchMethod( Invocation.setter( #syncType, syncType, @@ -609,7 +625,10 @@ class MockPrefs extends _i1.Mock implements _i7.Prefs { @override String get language => (super.noSuchMethod( Invocation.getter(#language), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.getter(#language), + ), ) as String); @override set language(String? newLanguage) => super.noSuchMethod( @@ -622,7 +641,10 @@ class MockPrefs extends _i1.Mock implements _i7.Prefs { @override String get currency => (super.noSuchMethod( Invocation.getter(#currency), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.getter(#currency), + ), ) as String); @override set currency(String? newCurrency) => super.noSuchMethod( @@ -732,12 +754,12 @@ class MockPrefs extends _i1.Mock implements _i7.Prefs { returnValueForMissingStub: null, ); @override - _i9.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( + _i10.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( Invocation.getter(#backupFrequencyType), - returnValue: _i9.BackupFrequencyType.everyTenMinutes, - ) as _i9.BackupFrequencyType); + returnValue: _i10.BackupFrequencyType.everyTenMinutes, + ) as _i10.BackupFrequencyType); @override - set backupFrequencyType(_i9.BackupFrequencyType? backupFrequencyType) => + set backupFrequencyType(_i10.BackupFrequencyType? backupFrequencyType) => super.noSuchMethod( Invocation.setter( #backupFrequencyType, @@ -831,7 +853,10 @@ class MockPrefs extends _i1.Mock implements _i7.Prefs { @override String get themeId => (super.noSuchMethod( Invocation.getter(#themeId), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.getter(#themeId), + ), ) as String); @override set themeId(String? themeId) => super.noSuchMethod( @@ -844,7 +869,10 @@ class MockPrefs extends _i1.Mock implements _i7.Prefs { @override String get systemBrightnessLightThemeId => (super.noSuchMethod( Invocation.getter(#systemBrightnessLightThemeId), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.getter(#systemBrightnessLightThemeId), + ), ) as String); @override set systemBrightnessLightThemeId(String? systemBrightnessLightThemeId) => @@ -858,7 +886,10 @@ class MockPrefs extends _i1.Mock implements _i7.Prefs { @override String get systemBrightnessDarkThemeId => (super.noSuchMethod( Invocation.getter(#systemBrightnessDarkThemeId), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.getter(#systemBrightnessDarkThemeId), + ), ) as String); @override set systemBrightnessDarkThemeId(String? systemBrightnessDarkThemeId) => @@ -888,61 +919,61 @@ class MockPrefs extends _i1.Mock implements _i7.Prefs { returnValue: false, ) as bool); @override - _i6.Future init() => (super.noSuchMethod( + _i7.Future init() => (super.noSuchMethod( Invocation.method( #init, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future incrementCurrentNotificationIndex() => (super.noSuchMethod( + _i7.Future incrementCurrentNotificationIndex() => (super.noSuchMethod( Invocation.method( #incrementCurrentNotificationIndex, [], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future isExternalCallsSet() => (super.noSuchMethod( + _i7.Future isExternalCallsSet() => (super.noSuchMethod( Invocation.method( #isExternalCallsSet, [], ), - returnValue: _i6.Future.value(false), - ) as _i6.Future); + returnValue: _i7.Future.value(false), + ) as _i7.Future); @override - _i6.Future saveUserID(String? userId) => (super.noSuchMethod( + _i7.Future saveUserID(String? userId) => (super.noSuchMethod( Invocation.method( #saveUserID, [userId], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i6.Future saveSignupEpoch(int? signupEpoch) => (super.noSuchMethod( + _i7.Future saveSignupEpoch(int? signupEpoch) => (super.noSuchMethod( Invocation.method( #saveSignupEpoch, [signupEpoch], ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); + returnValue: _i7.Future.value(), + returnValueForMissingStub: _i7.Future.value(), + ) as _i7.Future); @override - _i10.AmountUnit amountUnit(_i2.CryptoCurrency? coin) => (super.noSuchMethod( + _i11.AmountUnit amountUnit(_i2.CryptoCurrency? coin) => (super.noSuchMethod( Invocation.method( #amountUnit, [coin], ), - returnValue: _i10.AmountUnit.normal, - ) as _i10.AmountUnit); + returnValue: _i11.AmountUnit.normal, + ) as _i11.AmountUnit); @override void updateAmountUnit({ required _i2.CryptoCurrency? coin, - required _i10.AmountUnit? amountUnit, + required _i11.AmountUnit? amountUnit, }) => super.noSuchMethod( Invocation.method( @@ -1010,7 +1041,7 @@ class MockPrefs extends _i1.Mock implements _i7.Prefs { returnValueForMissingStub: null, ); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -1018,7 +1049,7 @@ class MockPrefs extends _i1.Mock implements _i7.Prefs { returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/flutter_secure_storage_interface_test.mocks.dart b/test/flutter_secure_storage_interface_test.mocks.dart index e1541d3a2..8779d5147 100644 --- a/test/flutter_secure_storage_interface_test.mocks.dart +++ b/test/flutter_secure_storage_interface_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/flutter_secure_storage_interface_test.dart. // Do not manually edit this file. @@ -12,6 +12,8 @@ import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors diff --git a/test/global_events_test.dart b/test/global_events_test.dart index c7d68bdcc..fc65d41f9 100644 --- a/test/global_events_test.dart +++ b/test/global_events_test.dart @@ -4,7 +4,6 @@ import 'package:stackwallet/services/event_bus/events/global/refresh_percent_cha import 'package:stackwallet/services/event_bus/events/global/updated_in_background_event.dart'; import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart'; import 'package:stackwallet/services/event_bus/global_event_bus.dart'; -import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; void main() { diff --git a/test/models/type_adapter_tests/lelantus_coin_adapter_test.dart b/test/models/type_adapter_tests/lelantus_coin_adapter_test.dart index 44c2a1a70..cae7ca876 100644 --- a/test/models/type_adapter_tests/lelantus_coin_adapter_test.dart +++ b/test/models/type_adapter_tests/lelantus_coin_adapter_test.dart @@ -10,11 +10,11 @@ import 'lelantus_coin_adapter_test.mocks.dart'; @GenerateMocks([BinaryReader, BinaryWriter]) void main() { test("read", () { - LelantusCoinAdapter adapter = LelantusCoinAdapter(); + final LelantusCoinAdapter adapter = LelantusCoinAdapter(); final reader = MockBinaryReader(); - List readByteResponses = [6, 0, 1, 2, 3, 4, 5]; - List readResponses = [ + final List readByteResponses = [6, 0, 1, 2, 3, 4, 5]; + final List readResponses = [ 1, 1000, "kjhxzcfg8u7ty23w8gbdsf87cfgsdf3", @@ -35,8 +35,8 @@ void main() { }); test("write", () { - LelantusCoinAdapter adapter = LelantusCoinAdapter(); - LelantusCoin obj = + final LelantusCoinAdapter adapter = LelantusCoinAdapter(); + final LelantusCoin obj = LelantusCoin(1, 100, "some public coin", "some txid", 1, true); final writer = MockBinaryWriter(); diff --git a/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart b/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart index 0ca7abc8d..13aeb65c7 100644 --- a/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart +++ b/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/models/type_adapter_tests/lelantus_coin_adapter_test.dart. // Do not manually edit this file. @@ -9,11 +9,14 @@ import 'dart:typed_data' as _i4; import 'package:hive/hive.dart' as _i3; import 'package:hive/src/object/hive_object.dart' as _i1; import 'package:mockito/mockito.dart' as _i2; +import 'package:mockito/src/dummies.dart' as _i6; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -143,7 +146,16 @@ class MockBinaryReader extends _i2.Mock implements _i3.BinaryReader { decoder, ], ), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.method( + #readString, + [ + byteCount, + decoder, + ], + ), + ), ) as String); @override _i4.Uint8List readByteList([int? length]) => (super.noSuchMethod( diff --git a/test/models/type_adapter_tests/transactions_model_adapter_test.dart b/test/models/type_adapter_tests/transactions_model_adapter_test.dart index a7c9d0441..265cdc159 100644 --- a/test/models/type_adapter_tests/transactions_model_adapter_test.dart +++ b/test/models/type_adapter_tests/transactions_model_adapter_test.dart @@ -14,7 +14,7 @@ void main() { final adapter = TransactionDataAdapter(); final reader = MockBinaryReader(); - List readeByteResponses = [1, 0]; + final List readeByteResponses = [1, 0]; when(reader.readByte()).thenAnswer((_) => readeByteResponses.removeAt(0)); @@ -100,11 +100,11 @@ void main() { final adapter = TransactionChunkAdapter(); final reader = MockBinaryReader(); - List readByteResponses = [2, 0, 1]; + final List readByteResponses = [2, 0, 1]; when(reader.readByte()).thenAnswer((_) => readByteResponses.removeAt(0)); - List readResponses = [ + final List readResponses = [ 3426523234, [], ]; @@ -195,14 +195,14 @@ void main() { final adapter = TransactionAdapter(); final reader = MockBinaryReader(); - List readByteResponses = [20]; + final List readByteResponses = [20]; for (int i = 0; i < 20; i++) { readByteResponses.add(i); } when(reader.readByte()).thenAnswer((_) => readByteResponses.removeAt(0)); - List readResponses = [ + final List readResponses = [ "some txid", true, 872346534, @@ -425,14 +425,14 @@ void main() { final adapter = InputAdapter(); final reader = MockBinaryReader(); - List readByteResponses = [9]; + final List readByteResponses = [9]; for (int i = 0; i < 9; i++) { readByteResponses.add(i); } when(reader.readByte()).thenAnswer((_) => readByteResponses.removeAt(0)); - List readResponses = [ + final List readResponses = [ "some txid", 1, Output(scriptpubkeyAddress: "adr", value: 1), @@ -565,14 +565,14 @@ void main() { final adapter = OutputAdapter(); final reader = MockBinaryReader(); - List readByteResponses = [5]; + final List readByteResponses = [5]; for (int i = 0; i < 5; i++) { readByteResponses.add(i); } when(reader.readByte()).thenAnswer((_) => readByteResponses.removeAt(0)); - List readResponses = [ + final List readResponses = [ "some scriptpubkey", "some scriptpubkey asm", "some scriptpubkey type", diff --git a/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart b/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart index 3d5db62f2..53dd08255 100644 --- a/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart +++ b/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/models/type_adapter_tests/transactions_model_adapter_test.dart. // Do not manually edit this file. @@ -9,11 +9,14 @@ import 'dart:typed_data' as _i4; import 'package:hive/hive.dart' as _i3; import 'package:hive/src/object/hive_object.dart' as _i1; import 'package:mockito/mockito.dart' as _i2; +import 'package:mockito/src/dummies.dart' as _i6; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -143,7 +146,16 @@ class MockBinaryReader extends _i2.Mock implements _i3.BinaryReader { decoder, ], ), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.method( + #readString, + [ + byteCount, + decoder, + ], + ), + ), ) as String); @override _i4.Uint8List readByteList([int? length]) => (super.noSuchMethod( diff --git a/test/models/type_adapter_tests/utxo_model_adapter_test.dart b/test/models/type_adapter_tests/utxo_model_adapter_test.dart index 9dfd5b0ba..5849c61bd 100644 --- a/test/models/type_adapter_tests/utxo_model_adapter_test.dart +++ b/test/models/type_adapter_tests/utxo_model_adapter_test.dart @@ -14,12 +14,12 @@ void main() { final adapter = UtxoDataAdapter(); final reader = MockBinaryReader(); - List readByteResponses = [5]; + final List readByteResponses = [5]; for (int i = 0; i < 5; i++) { readByteResponses.add(i); } - List readResponses = [ + final List readResponses = [ "100", 100000000, "10", @@ -135,12 +135,12 @@ void main() { final adapter = UtxoObjectAdapter(); final reader = MockBinaryReader(); - List readByteResponses = [8]; + final List readByteResponses = [8]; for (int i = 0; i < 8; i++) { readByteResponses.add(i); } - List readResponses = [ + final List readResponses = [ "100", 1, Status( @@ -286,12 +286,12 @@ void main() { final adapter = StatusAdapter(); final reader = MockBinaryReader(); - List readByteResponses = [5]; + final List readByteResponses = [5]; for (int i = 0; i < 5; i++) { readByteResponses.add(i); } - List readResponses = [ + final List readResponses = [ true, "some blockhash", 4587364, diff --git a/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart b/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart index f326e8cbc..f2750cf2a 100644 --- a/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart +++ b/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/models/type_adapter_tests/utxo_model_adapter_test.dart. // Do not manually edit this file. @@ -9,11 +9,14 @@ import 'dart:typed_data' as _i4; import 'package:hive/hive.dart' as _i3; import 'package:hive/src/object/hive_object.dart' as _i1; import 'package:mockito/mockito.dart' as _i2; +import 'package:mockito/src/dummies.dart' as _i6; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -143,7 +146,16 @@ class MockBinaryReader extends _i2.Mock implements _i3.BinaryReader { decoder, ], ), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.method( + #readString, + [ + byteCount, + decoder, + ], + ), + ), ) as String); @override _i4.Uint8List readByteList([int? length]) => (super.noSuchMethod( diff --git a/test/notifications/notification_card_test.mocks.dart b/test/notifications/notification_card_test.mocks.dart index e325b3056..52f5ee6db 100644 --- a/test/notifications/notification_card_test.mocks.dart +++ b/test/notifications/notification_card_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/notifications/notification_card_test.dart. // Do not manually edit this file. @@ -16,6 +16,8 @@ import 'package:stackwallet/themes/theme_service.dart' as _i4; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors diff --git a/test/pages/send_view/send_view_test.mocks.dart b/test/pages/send_view/send_view_test.mocks.dart index bf71bbcf2..6a0bc127f 100644 --- a/test/pages/send_view/send_view_test.mocks.dart +++ b/test/pages/send_view/send_view_test.mocks.dart @@ -1,24 +1,25 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/pages/send_view/send_view_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i10; -import 'dart:typed_data' as _i18; +import 'dart:typed_data' as _i19; import 'dart:ui' as _i14; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i16; import 'package:stackwallet/db/isar/main_db.dart' as _i3; -import 'package:stackwallet/models/isar/stack_theme.dart' as _i17; +import 'package:stackwallet/models/isar/stack_theme.dart' as _i18; import 'package:stackwallet/models/node_model.dart' as _i13; import 'package:stackwallet/networking/http.dart' as _i7; import 'package:stackwallet/services/locale_service.dart' as _i15; import 'package:stackwallet/services/node_service.dart' as _i2; import 'package:stackwallet/services/wallets.dart' as _i9; -import 'package:stackwallet/themes/theme_service.dart' as _i16; -import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i21; -import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i20; -import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i19; +import 'package:stackwallet/themes/theme_service.dart' as _i17; +import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i22; +import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i21; +import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i20; import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' as _i6; import 'package:stackwallet/utilities/prefs.dart' as _i12; @@ -33,6 +34,8 @@ import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/cash_fusion_i // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -439,7 +442,10 @@ class MockLocaleService extends _i1.Mock implements _i15.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#locale), + ), ) as String); @override bool get hasListeners => (super.noSuchMethod( @@ -493,7 +499,7 @@ class MockLocaleService extends _i1.Mock implements _i15.LocaleService { /// A class which mocks [ThemeService]. /// /// See the documentation for Mockito's code generation for more information. -class MockThemeService extends _i1.Mock implements _i16.ThemeService { +class MockThemeService extends _i1.Mock implements _i17.ThemeService { MockThemeService() { _i1.throwOnMissingStub(this); } @@ -523,10 +529,10 @@ class MockThemeService extends _i1.Mock implements _i16.ThemeService { ), ) as _i3.MainDB); @override - List<_i17.StackTheme> get installedThemes => (super.noSuchMethod( + List<_i18.StackTheme> get installedThemes => (super.noSuchMethod( Invocation.getter(#installedThemes), - returnValue: <_i17.StackTheme>[], - ) as List<_i17.StackTheme>); + returnValue: <_i18.StackTheme>[], + ) as List<_i18.StackTheme>); @override void init(_i3.MainDB? db) => super.noSuchMethod( Invocation.method( @@ -536,7 +542,7 @@ class MockThemeService extends _i1.Mock implements _i16.ThemeService { returnValueForMissingStub: null, ); @override - _i10.Future install({required _i18.Uint8List? themeArchiveData}) => + _i10.Future install({required _i19.Uint8List? themeArchiveData}) => (super.noSuchMethod( Invocation.method( #install, @@ -576,33 +582,33 @@ class MockThemeService extends _i1.Mock implements _i16.ThemeService { returnValue: _i10.Future.value(false), ) as _i10.Future); @override - _i10.Future> fetchThemes() => + _i10.Future> fetchThemes() => (super.noSuchMethod( Invocation.method( #fetchThemes, [], ), - returnValue: _i10.Future>.value( - <_i16.StackThemeMetaData>[]), - ) as _i10.Future>); + returnValue: _i10.Future>.value( + <_i17.StackThemeMetaData>[]), + ) as _i10.Future>); @override - _i10.Future<_i18.Uint8List> fetchTheme( - {required _i16.StackThemeMetaData? themeMetaData}) => + _i10.Future<_i19.Uint8List> fetchTheme( + {required _i17.StackThemeMetaData? themeMetaData}) => (super.noSuchMethod( Invocation.method( #fetchTheme, [], {#themeMetaData: themeMetaData}, ), - returnValue: _i10.Future<_i18.Uint8List>.value(_i18.Uint8List(0)), - ) as _i10.Future<_i18.Uint8List>); + returnValue: _i10.Future<_i19.Uint8List>.value(_i19.Uint8List(0)), + ) as _i10.Future<_i19.Uint8List>); @override - _i17.StackTheme? getTheme({required String? themeId}) => + _i18.StackTheme? getTheme({required String? themeId}) => (super.noSuchMethod(Invocation.method( #getTheme, [], {#themeId: themeId}, - )) as _i17.StackTheme?); + )) as _i18.StackTheme?); } /// A class which mocks [Prefs]. @@ -664,12 +670,12 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: null, ); @override - _i19.SyncingType get syncType => (super.noSuchMethod( + _i20.SyncingType get syncType => (super.noSuchMethod( Invocation.getter(#syncType), - returnValue: _i19.SyncingType.currentWalletOnly, - ) as _i19.SyncingType); + returnValue: _i20.SyncingType.currentWalletOnly, + ) as _i20.SyncingType); @override - set syncType(_i19.SyncingType? syncType) => super.noSuchMethod( + set syncType(_i20.SyncingType? syncType) => super.noSuchMethod( Invocation.setter( #syncType, syncType, @@ -705,7 +711,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get language => (super.noSuchMethod( Invocation.getter(#language), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#language), + ), ) as String); @override set language(String? newLanguage) => super.noSuchMethod( @@ -718,7 +727,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get currency => (super.noSuchMethod( Invocation.getter(#currency), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#currency), + ), ) as String); @override set currency(String? newCurrency) => super.noSuchMethod( @@ -828,12 +840,12 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: null, ); @override - _i20.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( + _i21.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( Invocation.getter(#backupFrequencyType), - returnValue: _i20.BackupFrequencyType.everyTenMinutes, - ) as _i20.BackupFrequencyType); + returnValue: _i21.BackupFrequencyType.everyTenMinutes, + ) as _i21.BackupFrequencyType); @override - set backupFrequencyType(_i20.BackupFrequencyType? backupFrequencyType) => + set backupFrequencyType(_i21.BackupFrequencyType? backupFrequencyType) => super.noSuchMethod( Invocation.setter( #backupFrequencyType, @@ -927,7 +939,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get themeId => (super.noSuchMethod( Invocation.getter(#themeId), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#themeId), + ), ) as String); @override set themeId(String? themeId) => super.noSuchMethod( @@ -940,7 +955,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get systemBrightnessLightThemeId => (super.noSuchMethod( Invocation.getter(#systemBrightnessLightThemeId), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#systemBrightnessLightThemeId), + ), ) as String); @override set systemBrightnessLightThemeId(String? systemBrightnessLightThemeId) => @@ -954,7 +972,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get systemBrightnessDarkThemeId => (super.noSuchMethod( Invocation.getter(#systemBrightnessDarkThemeId), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#systemBrightnessDarkThemeId), + ), ) as String); @override set systemBrightnessDarkThemeId(String? systemBrightnessDarkThemeId) => @@ -1028,17 +1049,17 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override - _i21.AmountUnit amountUnit(_i4.CryptoCurrency? coin) => (super.noSuchMethod( + _i22.AmountUnit amountUnit(_i4.CryptoCurrency? coin) => (super.noSuchMethod( Invocation.method( #amountUnit, [coin], ), - returnValue: _i21.AmountUnit.normal, - ) as _i21.AmountUnit); + returnValue: _i22.AmountUnit.normal, + ) as _i22.AmountUnit); @override void updateAmountUnit({ required _i4.CryptoCurrency? coin, - required _i21.AmountUnit? amountUnit, + required _i22.AmountUnit? amountUnit, }) => super.noSuchMethod( Invocation.method( diff --git a/test/price_test.mocks.dart b/test/price_test.mocks.dart index 59b90851e..8ba8c6d26 100644 --- a/test/price_test.mocks.dart +++ b/test/price_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/price_test.dart. // Do not manually edit this file. @@ -14,6 +14,8 @@ import 'package:stackwallet/networking/http.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors diff --git a/test/sample_data/transaction_data_samples.dart b/test/sample_data/transaction_data_samples.dart index ed248a0ea..42962888b 100644 --- a/test/sample_data/transaction_data_samples.dart +++ b/test/sample_data/transaction_data_samples.dart @@ -2526,9 +2526,9 @@ final jsonTransactions = [ ]; Map get transactionDataMap { - Map result = {}; + final Map result = {}; for (final tx in jsonTransactions) { - String? bob = tx["txid"] as String?; + final String? bob = tx["txid"] as String?; result[bob] = tx; } return result; diff --git a/test/screen_tests/address_book_view/address_book_view_screen_test.dart b/test/screen_tests/address_book_view/address_book_view_screen_test.dart index dffa8f69d..ad7aff7c1 100644 --- a/test/screen_tests/address_book_view/address_book_view_screen_test.dart +++ b/test/screen_tests/address_book_view/address_book_view_screen_test.dart @@ -13,7 +13,7 @@ import 'package:stackwallet/services/address_book_service.dart'; // import 'address_book_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("AddressBookView builds correctly", (tester) async { diff --git a/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart index b359426c3..b7a88864d 100644 --- a/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/address_book_view/address_book_view_screen_test.dart. // Do not manually edit this file. @@ -14,6 +14,8 @@ import 'package:stackwallet/services/address_book_service.dart' as _i3; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -36,6 +38,10 @@ class _FakeContactEntry_0 extends _i1.SmartFake implements _i2.ContactEntry { /// See the documentation for Mockito's code generation for more information. class MockAddressBookService extends _i1.Mock implements _i3.AddressBookService { + MockAddressBookService() { + _i1.throwOnMissingStub(this); + } + @override List<_i2.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), diff --git a/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.dart b/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.dart index 5967b7f3f..437d941a0 100644 --- a/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.dart +++ b/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.dart @@ -21,7 +21,7 @@ import 'package:stackwallet/utilities/barcode_scanner_interface.dart'; @GenerateMocks([ BarcodeScannerWrapper ], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("AddAddressBookEntryView builds correctly", (tester) async { diff --git a/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart index 4926f74fb..63bbc41c5 100644 --- a/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.dart. // Do not manually edit this file. @@ -16,6 +16,8 @@ import 'package:stackwallet/utilities/barcode_scanner_interface.dart' as _i4; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -77,6 +79,10 @@ class MockBarcodeScannerWrapper extends _i1.Mock /// See the documentation for Mockito's code generation for more information. class MockAddressBookService extends _i1.Mock implements _i6.AddressBookService { + MockAddressBookService() { + _i1.throwOnMissingStub(this); + } + @override List<_i3.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), diff --git a/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.dart b/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.dart index 40379c4f4..1d39a09ef 100644 --- a/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.dart +++ b/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.dart @@ -23,8 +23,8 @@ import 'package:stackwallet/services/locale_service.dart'; // import 'address_book_entry_details_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), - MockSpec(returnNullOnMissingStub: true), + MockSpec(), + MockSpec(), ]) void main() { // testWidgets("AddressBookDetailsView builds correctly", (tester) async { diff --git a/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart index b16ab6149..97a359919 100644 --- a/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.dart. // Do not manually edit this file. @@ -7,6 +7,7 @@ import 'dart:async' as _i4; import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i7; import 'package:stackwallet/models/isar/models/contact_entry.dart' as _i2; import 'package:stackwallet/services/address_book_service.dart' as _i3; import 'package:stackwallet/services/locale_service.dart' as _i6; @@ -15,6 +16,8 @@ import 'package:stackwallet/services/locale_service.dart' as _i6; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -37,6 +40,10 @@ class _FakeContactEntry_0 extends _i1.SmartFake implements _i2.ContactEntry { /// See the documentation for Mockito's code generation for more information. class MockAddressBookService extends _i1.Mock implements _i3.AddressBookService { + MockAddressBookService() { + _i1.throwOnMissingStub(this); + } + @override List<_i2.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), @@ -150,10 +157,17 @@ class MockAddressBookService extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockLocaleService extends _i1.Mock implements _i6.LocaleService { + MockLocaleService() { + _i1.throwOnMissingStub(this); + } + @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), - returnValue: '', + returnValue: _i7.dummyValue( + this, + Invocation.getter(#locale), + ), ) as String); @override bool get hasListeners => (super.noSuchMethod( diff --git a/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.dart b/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.dart index db0e02703..bb93f1a2c 100644 --- a/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.dart +++ b/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.dart @@ -20,7 +20,7 @@ import 'package:stackwallet/services/address_book_service.dart'; // import 'edit_address_book_entry_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("EditAddressBookEntryView builds correctly", (tester) async { diff --git a/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart index 1f3ee97fa..1f195d5c3 100644 --- a/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.dart. // Do not manually edit this file. @@ -14,6 +14,8 @@ import 'package:stackwallet/services/address_book_service.dart' as _i3; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -36,6 +38,10 @@ class _FakeContactEntry_0 extends _i1.SmartFake implements _i2.ContactEntry { /// See the documentation for Mockito's code generation for more information. class MockAddressBookService extends _i1.Mock implements _i3.AddressBookService { + MockAddressBookService() { + _i1.throwOnMissingStub(this); + } + @override List<_i2.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), diff --git a/test/screen_tests/exchange/exchange_view_test.mocks.dart b/test/screen_tests/exchange/exchange_view_test.mocks.dart index 2691281c4..f00e95494 100644 --- a/test/screen_tests/exchange/exchange_view_test.mocks.dart +++ b/test/screen_tests/exchange/exchange_view_test.mocks.dart @@ -1,41 +1,42 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/exchange/exchange_view_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i8; -import 'dart:ui' as _i11; +import 'dart:async' as _i9; +import 'dart:ui' as _i12; -import 'package:decimal/decimal.dart' as _i17; +import 'package:decimal/decimal.dart' as _i18; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i7; import 'package:stackwallet/models/exchange/change_now/cn_exchange_estimate.dart' - as _i20; -import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart' - as _i22; -import 'package:stackwallet/models/exchange/change_now/exchange_transaction_status.dart' - as _i23; -import 'package:stackwallet/models/exchange/response_objects/estimate.dart' - as _i19; -import 'package:stackwallet/models/exchange/response_objects/fixed_rate_market.dart' as _i21; +import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart' + as _i23; +import 'package:stackwallet/models/exchange/change_now/exchange_transaction_status.dart' + as _i24; +import 'package:stackwallet/models/exchange/response_objects/estimate.dart' + as _i20; +import 'package:stackwallet/models/exchange/response_objects/fixed_rate_market.dart' + as _i22; import 'package:stackwallet/models/exchange/response_objects/range.dart' - as _i18; + as _i19; import 'package:stackwallet/models/exchange/response_objects/trade.dart' - as _i13; -import 'package:stackwallet/models/isar/exchange_cache/currency.dart' as _i16; -import 'package:stackwallet/models/isar/exchange_cache/pair.dart' as _i24; + as _i14; +import 'package:stackwallet/models/isar/exchange_cache/currency.dart' as _i17; +import 'package:stackwallet/models/isar/exchange_cache/pair.dart' as _i25; import 'package:stackwallet/networking/http.dart' as _i3; import 'package:stackwallet/services/exchange/change_now/change_now_api.dart' - as _i15; + as _i16; import 'package:stackwallet/services/exchange/exchange_response.dart' as _i4; -import 'package:stackwallet/services/trade_notes_service.dart' as _i14; -import 'package:stackwallet/services/trade_service.dart' as _i12; -import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i9; -import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i7; +import 'package:stackwallet/services/trade_notes_service.dart' as _i15; +import 'package:stackwallet/services/trade_service.dart' as _i13; +import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i10; +import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i8; import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i6; import 'package:stackwallet/utilities/prefs.dart' as _i5; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' - as _i10; + as _i11; import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart' as _i2; @@ -43,6 +44,8 @@ import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/cash_fusion_i // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -181,7 +184,10 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { @override String get language => (super.noSuchMethod( Invocation.getter(#language), - returnValue: '', + returnValue: _i7.dummyValue( + this, + Invocation.getter(#language), + ), ) as String); @override set language(String? newLanguage) => super.noSuchMethod( @@ -194,7 +200,10 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { @override String get currency => (super.noSuchMethod( Invocation.getter(#currency), - returnValue: '', + returnValue: _i7.dummyValue( + this, + Invocation.getter(#currency), + ), ) as String); @override set currency(String? newCurrency) => super.noSuchMethod( @@ -304,12 +313,12 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { returnValueForMissingStub: null, ); @override - _i7.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( + _i8.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( Invocation.getter(#backupFrequencyType), - returnValue: _i7.BackupFrequencyType.everyTenMinutes, - ) as _i7.BackupFrequencyType); + returnValue: _i8.BackupFrequencyType.everyTenMinutes, + ) as _i8.BackupFrequencyType); @override - set backupFrequencyType(_i7.BackupFrequencyType? backupFrequencyType) => + set backupFrequencyType(_i8.BackupFrequencyType? backupFrequencyType) => super.noSuchMethod( Invocation.setter( #backupFrequencyType, @@ -403,7 +412,10 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { @override String get themeId => (super.noSuchMethod( Invocation.getter(#themeId), - returnValue: '', + returnValue: _i7.dummyValue( + this, + Invocation.getter(#themeId), + ), ) as String); @override set themeId(String? themeId) => super.noSuchMethod( @@ -416,7 +428,10 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { @override String get systemBrightnessLightThemeId => (super.noSuchMethod( Invocation.getter(#systemBrightnessLightThemeId), - returnValue: '', + returnValue: _i7.dummyValue( + this, + Invocation.getter(#systemBrightnessLightThemeId), + ), ) as String); @override set systemBrightnessLightThemeId(String? systemBrightnessLightThemeId) => @@ -430,7 +445,10 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { @override String get systemBrightnessDarkThemeId => (super.noSuchMethod( Invocation.getter(#systemBrightnessDarkThemeId), - returnValue: '', + returnValue: _i7.dummyValue( + this, + Invocation.getter(#systemBrightnessDarkThemeId), + ), ) as String); @override set systemBrightnessDarkThemeId(String? systemBrightnessDarkThemeId) => @@ -460,61 +478,61 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { returnValue: false, ) as bool); @override - _i8.Future init() => (super.noSuchMethod( + _i9.Future init() => (super.noSuchMethod( Invocation.method( #init, [], ), - returnValue: _i8.Future.value(), - returnValueForMissingStub: _i8.Future.value(), - ) as _i8.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i8.Future incrementCurrentNotificationIndex() => (super.noSuchMethod( + _i9.Future incrementCurrentNotificationIndex() => (super.noSuchMethod( Invocation.method( #incrementCurrentNotificationIndex, [], ), - returnValue: _i8.Future.value(), - returnValueForMissingStub: _i8.Future.value(), - ) as _i8.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i8.Future isExternalCallsSet() => (super.noSuchMethod( + _i9.Future isExternalCallsSet() => (super.noSuchMethod( Invocation.method( #isExternalCallsSet, [], ), - returnValue: _i8.Future.value(false), - ) as _i8.Future); + returnValue: _i9.Future.value(false), + ) as _i9.Future); @override - _i8.Future saveUserID(String? userId) => (super.noSuchMethod( + _i9.Future saveUserID(String? userId) => (super.noSuchMethod( Invocation.method( #saveUserID, [userId], ), - returnValue: _i8.Future.value(), - returnValueForMissingStub: _i8.Future.value(), - ) as _i8.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i8.Future saveSignupEpoch(int? signupEpoch) => (super.noSuchMethod( + _i9.Future saveSignupEpoch(int? signupEpoch) => (super.noSuchMethod( Invocation.method( #saveSignupEpoch, [signupEpoch], ), - returnValue: _i8.Future.value(), - returnValueForMissingStub: _i8.Future.value(), - ) as _i8.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i9.AmountUnit amountUnit(_i10.CryptoCurrency? coin) => (super.noSuchMethod( + _i10.AmountUnit amountUnit(_i11.CryptoCurrency? coin) => (super.noSuchMethod( Invocation.method( #amountUnit, [coin], ), - returnValue: _i9.AmountUnit.normal, - ) as _i9.AmountUnit); + returnValue: _i10.AmountUnit.normal, + ) as _i10.AmountUnit); @override void updateAmountUnit({ - required _i10.CryptoCurrency? coin, - required _i9.AmountUnit? amountUnit, + required _i11.CryptoCurrency? coin, + required _i10.AmountUnit? amountUnit, }) => super.noSuchMethod( Invocation.method( @@ -528,7 +546,7 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { returnValueForMissingStub: null, ); @override - int maxDecimals(_i10.CryptoCurrency? coin) => (super.noSuchMethod( + int maxDecimals(_i11.CryptoCurrency? coin) => (super.noSuchMethod( Invocation.method( #maxDecimals, [coin], @@ -537,7 +555,7 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { ) as int); @override void updateMaxDecimals({ - required _i10.CryptoCurrency? coin, + required _i11.CryptoCurrency? coin, required int? maxDecimals, }) => super.noSuchMethod( @@ -552,7 +570,7 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { returnValueForMissingStub: null, ); @override - _i2.FusionInfo getFusionServerInfo(_i10.CryptoCurrency? coin) => + _i2.FusionInfo getFusionServerInfo(_i11.CryptoCurrency? coin) => (super.noSuchMethod( Invocation.method( #getFusionServerInfo, @@ -568,7 +586,7 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { ) as _i2.FusionInfo); @override void setFusionServerInfo( - _i10.CryptoCurrency? coin, + _i11.CryptoCurrency? coin, _i2.FusionInfo? fusionServerInfo, ) => super.noSuchMethod( @@ -582,7 +600,7 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { returnValueForMissingStub: null, ); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -590,7 +608,7 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -618,29 +636,29 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { /// A class which mocks [TradesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockTradesService extends _i1.Mock implements _i12.TradesService { +class MockTradesService extends _i1.Mock implements _i13.TradesService { MockTradesService() { _i1.throwOnMissingStub(this); } @override - List<_i13.Trade> get trades => (super.noSuchMethod( + List<_i14.Trade> get trades => (super.noSuchMethod( Invocation.getter(#trades), - returnValue: <_i13.Trade>[], - ) as List<_i13.Trade>); + returnValue: <_i14.Trade>[], + ) as List<_i14.Trade>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); @override - _i13.Trade? get(String? tradeId) => (super.noSuchMethod(Invocation.method( + _i14.Trade? get(String? tradeId) => (super.noSuchMethod(Invocation.method( #get, [tradeId], - )) as _i13.Trade?); + )) as _i14.Trade?); @override - _i8.Future add({ - required _i13.Trade? trade, + _i9.Future add({ + required _i14.Trade? trade, required bool? shouldNotifyListeners, }) => (super.noSuchMethod( @@ -652,12 +670,12 @@ class MockTradesService extends _i1.Mock implements _i12.TradesService { #shouldNotifyListeners: shouldNotifyListeners, }, ), - returnValue: _i8.Future.value(), - returnValueForMissingStub: _i8.Future.value(), - ) as _i8.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i8.Future edit({ - required _i13.Trade? trade, + _i9.Future edit({ + required _i14.Trade? trade, required bool? shouldNotifyListeners, }) => (super.noSuchMethod( @@ -669,12 +687,12 @@ class MockTradesService extends _i1.Mock implements _i12.TradesService { #shouldNotifyListeners: shouldNotifyListeners, }, ), - returnValue: _i8.Future.value(), - returnValueForMissingStub: _i8.Future.value(), - ) as _i8.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i8.Future delete({ - required _i13.Trade? trade, + _i9.Future delete({ + required _i14.Trade? trade, required bool? shouldNotifyListeners, }) => (super.noSuchMethod( @@ -686,11 +704,11 @@ class MockTradesService extends _i1.Mock implements _i12.TradesService { #shouldNotifyListeners: shouldNotifyListeners, }, ), - returnValue: _i8.Future.value(), - returnValueForMissingStub: _i8.Future.value(), - ) as _i8.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i8.Future deleteByUuid({ + _i9.Future deleteByUuid({ required String? uuid, required bool? shouldNotifyListeners, }) => @@ -703,11 +721,11 @@ class MockTradesService extends _i1.Mock implements _i12.TradesService { #shouldNotifyListeners: shouldNotifyListeners, }, ), - returnValue: _i8.Future.value(), - returnValueForMissingStub: _i8.Future.value(), - ) as _i8.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -715,7 +733,7 @@ class MockTradesService extends _i1.Mock implements _i12.TradesService { returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -743,7 +761,7 @@ class MockTradesService extends _i1.Mock implements _i12.TradesService { /// A class which mocks [TradeNotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockTradeNotesService extends _i1.Mock implements _i14.TradeNotesService { +class MockTradeNotesService extends _i1.Mock implements _i15.TradeNotesService { MockTradeNotesService() { _i1.throwOnMissingStub(this); } @@ -765,10 +783,17 @@ class MockTradeNotesService extends _i1.Mock implements _i14.TradeNotesService { [], {#tradeId: tradeId}, ), - returnValue: '', + returnValue: _i7.dummyValue( + this, + Invocation.method( + #getNote, + [], + {#tradeId: tradeId}, + ), + ), ) as String); @override - _i8.Future set({ + _i9.Future set({ required String? tradeId, required String? note, }) => @@ -781,21 +806,21 @@ class MockTradeNotesService extends _i1.Mock implements _i14.TradeNotesService { #note: note, }, ), - returnValue: _i8.Future.value(), - returnValueForMissingStub: _i8.Future.value(), - ) as _i8.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - _i8.Future delete({required String? tradeId}) => (super.noSuchMethod( + _i9.Future delete({required String? tradeId}) => (super.noSuchMethod( Invocation.method( #delete, [], {#tradeId: tradeId}, ), - returnValue: _i8.Future.value(), - returnValueForMissingStub: _i8.Future.value(), - ) as _i8.Future); + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -803,7 +828,7 @@ class MockTradeNotesService extends _i1.Mock implements _i14.TradeNotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -831,7 +856,7 @@ class MockTradeNotesService extends _i1.Mock implements _i14.TradeNotesService { /// A class which mocks [ChangeNowAPI]. /// /// See the documentation for Mockito's code generation for more information. -class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { +class MockChangeNowAPI extends _i1.Mock implements _i16.ChangeNowAPI { MockChangeNowAPI() { _i1.throwOnMissingStub(this); } @@ -845,7 +870,7 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { ), ) as _i3.HTTP); @override - _i8.Future<_i4.ExchangeResponse>> getAvailableCurrencies({ + _i9.Future<_i4.ExchangeResponse>> getAvailableCurrencies({ bool? fixedRate, bool? active, }) => @@ -859,8 +884,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { }, ), returnValue: - _i8.Future<_i4.ExchangeResponse>>.value( - _FakeExchangeResponse_2>( + _i9.Future<_i4.ExchangeResponse>>.value( + _FakeExchangeResponse_2>( this, Invocation.method( #getAvailableCurrencies, @@ -871,26 +896,26 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { }, ), )), - ) as _i8.Future<_i4.ExchangeResponse>>); + ) as _i9.Future<_i4.ExchangeResponse>>); @override - _i8.Future<_i4.ExchangeResponse>> getCurrenciesV2() => + _i9.Future<_i4.ExchangeResponse>> getCurrenciesV2() => (super.noSuchMethod( Invocation.method( #getCurrenciesV2, [], ), returnValue: - _i8.Future<_i4.ExchangeResponse>>.value( - _FakeExchangeResponse_2>( + _i9.Future<_i4.ExchangeResponse>>.value( + _FakeExchangeResponse_2>( this, Invocation.method( #getCurrenciesV2, [], ), )), - ) as _i8.Future<_i4.ExchangeResponse>>); + ) as _i9.Future<_i4.ExchangeResponse>>); @override - _i8.Future<_i4.ExchangeResponse>> getPairedCurrencies({ + _i9.Future<_i4.ExchangeResponse>> getPairedCurrencies({ required String? ticker, bool? fixedRate, }) => @@ -904,8 +929,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { }, ), returnValue: - _i8.Future<_i4.ExchangeResponse>>.value( - _FakeExchangeResponse_2>( + _i9.Future<_i4.ExchangeResponse>>.value( + _FakeExchangeResponse_2>( this, Invocation.method( #getPairedCurrencies, @@ -916,9 +941,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { }, ), )), - ) as _i8.Future<_i4.ExchangeResponse>>); + ) as _i9.Future<_i4.ExchangeResponse>>); @override - _i8.Future<_i4.ExchangeResponse<_i17.Decimal>> getMinimalExchangeAmount({ + _i9.Future<_i4.ExchangeResponse<_i18.Decimal>> getMinimalExchangeAmount({ required String? fromTicker, required String? toTicker, String? apiKey, @@ -933,8 +958,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i8.Future<_i4.ExchangeResponse<_i17.Decimal>>.value( - _FakeExchangeResponse_2<_i17.Decimal>( + returnValue: _i9.Future<_i4.ExchangeResponse<_i18.Decimal>>.value( + _FakeExchangeResponse_2<_i18.Decimal>( this, Invocation.method( #getMinimalExchangeAmount, @@ -946,9 +971,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { }, ), )), - ) as _i8.Future<_i4.ExchangeResponse<_i17.Decimal>>); + ) as _i9.Future<_i4.ExchangeResponse<_i18.Decimal>>); @override - _i8.Future<_i4.ExchangeResponse<_i18.Range>> getRange({ + _i9.Future<_i4.ExchangeResponse<_i19.Range>> getRange({ required String? fromTicker, required String? toTicker, required bool? isFixedRate, @@ -965,8 +990,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i8.Future<_i4.ExchangeResponse<_i18.Range>>.value( - _FakeExchangeResponse_2<_i18.Range>( + returnValue: _i9.Future<_i4.ExchangeResponse<_i19.Range>>.value( + _FakeExchangeResponse_2<_i19.Range>( this, Invocation.method( #getRange, @@ -979,12 +1004,12 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { }, ), )), - ) as _i8.Future<_i4.ExchangeResponse<_i18.Range>>); + ) as _i9.Future<_i4.ExchangeResponse<_i19.Range>>); @override - _i8.Future<_i4.ExchangeResponse<_i19.Estimate>> getEstimatedExchangeAmount({ + _i9.Future<_i4.ExchangeResponse<_i20.Estimate>> getEstimatedExchangeAmount({ required String? fromTicker, required String? toTicker, - required _i17.Decimal? fromAmount, + required _i18.Decimal? fromAmount, String? apiKey, }) => (super.noSuchMethod( @@ -998,8 +1023,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i8.Future<_i4.ExchangeResponse<_i19.Estimate>>.value( - _FakeExchangeResponse_2<_i19.Estimate>( + returnValue: _i9.Future<_i4.ExchangeResponse<_i20.Estimate>>.value( + _FakeExchangeResponse_2<_i20.Estimate>( this, Invocation.method( #getEstimatedExchangeAmount, @@ -1012,13 +1037,13 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { }, ), )), - ) as _i8.Future<_i4.ExchangeResponse<_i19.Estimate>>); + ) as _i9.Future<_i4.ExchangeResponse<_i20.Estimate>>); @override - _i8.Future<_i4.ExchangeResponse<_i19.Estimate>> + _i9.Future<_i4.ExchangeResponse<_i20.Estimate>> getEstimatedExchangeAmountFixedRate({ required String? fromTicker, required String? toTicker, - required _i17.Decimal? fromAmount, + required _i18.Decimal? fromAmount, required bool? reversed, bool? useRateId = true, String? apiKey, @@ -1036,8 +1061,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i8.Future<_i4.ExchangeResponse<_i19.Estimate>>.value( - _FakeExchangeResponse_2<_i19.Estimate>( + returnValue: _i9.Future<_i4.ExchangeResponse<_i20.Estimate>>.value( + _FakeExchangeResponse_2<_i20.Estimate>( this, Invocation.method( #getEstimatedExchangeAmountFixedRate, @@ -1052,17 +1077,17 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { }, ), )), - ) as _i8.Future<_i4.ExchangeResponse<_i19.Estimate>>); + ) as _i9.Future<_i4.ExchangeResponse<_i20.Estimate>>); @override - _i8.Future<_i4.ExchangeResponse<_i20.CNExchangeEstimate>> + _i9.Future<_i4.ExchangeResponse<_i21.CNExchangeEstimate>> getEstimatedExchangeAmountV2({ required String? fromTicker, required String? toTicker, - required _i20.CNEstimateType? fromOrTo, - required _i17.Decimal? amount, + required _i21.CNEstimateType? fromOrTo, + required _i18.Decimal? amount, String? fromNetwork, String? toNetwork, - _i20.CNFlowType? flow = _i20.CNFlowType.standard, + _i21.CNFlowType? flow = _i21.CNFlowType.standard, String? apiKey, }) => (super.noSuchMethod( @@ -1081,8 +1106,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { }, ), returnValue: - _i8.Future<_i4.ExchangeResponse<_i20.CNExchangeEstimate>>.value( - _FakeExchangeResponse_2<_i20.CNExchangeEstimate>( + _i9.Future<_i4.ExchangeResponse<_i21.CNExchangeEstimate>>.value( + _FakeExchangeResponse_2<_i21.CNExchangeEstimate>( this, Invocation.method( #getEstimatedExchangeAmountV2, @@ -1099,18 +1124,18 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { }, ), )), - ) as _i8.Future<_i4.ExchangeResponse<_i20.CNExchangeEstimate>>); + ) as _i9.Future<_i4.ExchangeResponse<_i21.CNExchangeEstimate>>); @override - _i8.Future<_i4.ExchangeResponse>> + _i9.Future<_i4.ExchangeResponse>> getAvailableFixedRateMarkets({String? apiKey}) => (super.noSuchMethod( Invocation.method( #getAvailableFixedRateMarkets, [], {#apiKey: apiKey}, ), - returnValue: _i8 - .Future<_i4.ExchangeResponse>>.value( - _FakeExchangeResponse_2>( + returnValue: _i9 + .Future<_i4.ExchangeResponse>>.value( + _FakeExchangeResponse_2>( this, Invocation.method( #getAvailableFixedRateMarkets, @@ -1118,14 +1143,14 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { {#apiKey: apiKey}, ), )), - ) as _i8.Future<_i4.ExchangeResponse>>); + ) as _i9.Future<_i4.ExchangeResponse>>); @override - _i8.Future<_i4.ExchangeResponse<_i22.ExchangeTransaction>> + _i9.Future<_i4.ExchangeResponse<_i23.ExchangeTransaction>> createStandardExchangeTransaction({ required String? fromTicker, required String? toTicker, required String? receivingAddress, - required _i17.Decimal? amount, + required _i18.Decimal? amount, String? extraId = r'', String? userId = r'', String? contactEmail = r'', @@ -1150,9 +1175,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i8 - .Future<_i4.ExchangeResponse<_i22.ExchangeTransaction>>.value( - _FakeExchangeResponse_2<_i22.ExchangeTransaction>( + returnValue: _i9 + .Future<_i4.ExchangeResponse<_i23.ExchangeTransaction>>.value( + _FakeExchangeResponse_2<_i23.ExchangeTransaction>( this, Invocation.method( #createStandardExchangeTransaction, @@ -1171,14 +1196,14 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { }, ), )), - ) as _i8.Future<_i4.ExchangeResponse<_i22.ExchangeTransaction>>); + ) as _i9.Future<_i4.ExchangeResponse<_i23.ExchangeTransaction>>); @override - _i8.Future<_i4.ExchangeResponse<_i22.ExchangeTransaction>> + _i9.Future<_i4.ExchangeResponse<_i23.ExchangeTransaction>> createFixedRateExchangeTransaction({ required String? fromTicker, required String? toTicker, required String? receivingAddress, - required _i17.Decimal? amount, + required _i18.Decimal? amount, required String? rateId, required bool? reversed, String? extraId = r'', @@ -1207,9 +1232,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i8 - .Future<_i4.ExchangeResponse<_i22.ExchangeTransaction>>.value( - _FakeExchangeResponse_2<_i22.ExchangeTransaction>( + returnValue: _i9 + .Future<_i4.ExchangeResponse<_i23.ExchangeTransaction>>.value( + _FakeExchangeResponse_2<_i23.ExchangeTransaction>( this, Invocation.method( #createFixedRateExchangeTransaction, @@ -1230,11 +1255,11 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { }, ), )), - ) as _i8.Future<_i4.ExchangeResponse<_i22.ExchangeTransaction>>); + ) as _i9.Future<_i4.ExchangeResponse<_i23.ExchangeTransaction>>); @override - _i8.Future< + _i9.Future< _i4 - .ExchangeResponse<_i23.ExchangeTransactionStatus>> getTransactionStatus({ + .ExchangeResponse<_i24.ExchangeTransactionStatus>> getTransactionStatus({ required String? id, String? apiKey, }) => @@ -1247,9 +1272,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i8 - .Future<_i4.ExchangeResponse<_i23.ExchangeTransactionStatus>>.value( - _FakeExchangeResponse_2<_i23.ExchangeTransactionStatus>( + returnValue: _i9 + .Future<_i4.ExchangeResponse<_i24.ExchangeTransactionStatus>>.value( + _FakeExchangeResponse_2<_i24.ExchangeTransactionStatus>( this, Invocation.method( #getTransactionStatus, @@ -1260,9 +1285,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { }, ), )), - ) as _i8.Future<_i4.ExchangeResponse<_i23.ExchangeTransactionStatus>>); + ) as _i9.Future<_i4.ExchangeResponse<_i24.ExchangeTransactionStatus>>); @override - _i8.Future<_i4.ExchangeResponse>> + _i9.Future<_i4.ExchangeResponse>> getAvailableFloatingRatePairs({bool? includePartners = false}) => (super.noSuchMethod( Invocation.method( @@ -1271,8 +1296,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { {#includePartners: includePartners}, ), returnValue: - _i8.Future<_i4.ExchangeResponse>>.value( - _FakeExchangeResponse_2>( + _i9.Future<_i4.ExchangeResponse>>.value( + _FakeExchangeResponse_2>( this, Invocation.method( #getAvailableFloatingRatePairs, @@ -1280,5 +1305,5 @@ class MockChangeNowAPI extends _i1.Mock implements _i15.ChangeNowAPI { {#includePartners: includePartners}, ), )), - ) as _i8.Future<_i4.ExchangeResponse>>); + ) as _i9.Future<_i4.ExchangeResponse>>); } diff --git a/test/screen_tests/lockscreen_view_screen_test.dart b/test/screen_tests/lockscreen_view_screen_test.dart index c52838459..8019ad22d 100644 --- a/test/screen_tests/lockscreen_view_screen_test.dart +++ b/test/screen_tests/lockscreen_view_screen_test.dart @@ -5,10 +5,13 @@ import 'package:mockito/annotations.dart'; import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/wallets_service.dart'; -@GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), - MockSpec(returnNullOnMissingStub: true), -]) +@GenerateMocks( + [], + customMocks: [ + MockSpec(), + MockSpec(), + ], +) void main() { testWidgets("LockscreenView builds correctly", (tester) async { // final navigator = mockingjay.MockNavigator(); diff --git a/test/screen_tests/lockscreen_view_screen_test.mocks.dart b/test/screen_tests/lockscreen_view_screen_test.mocks.dart index a76f5c498..2a0844351 100644 --- a/test/screen_tests/lockscreen_view_screen_test.mocks.dart +++ b/test/screen_tests/lockscreen_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/lockscreen_view_screen_test.dart. // Do not manually edit this file. @@ -19,6 +19,8 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -41,6 +43,10 @@ class _FakeSecureStorageInterface_0 extends _i1.SmartFake /// /// See the documentation for Mockito's code generation for more information. class MockWalletsService extends _i1.Mock implements _i3.WalletsService { + MockWalletsService() { + _i1.throwOnMissingStub(this); + } + @override _i4.Future> get walletNames => (super.noSuchMethod( @@ -91,6 +97,10 @@ class MockWalletsService extends _i1.Mock implements _i3.WalletsService { /// /// See the documentation for Mockito's code generation for more information. class MockNodeService extends _i1.Mock implements _i6.NodeService { + MockNodeService() { + _i1.throwOnMissingStub(this); + } + @override _i2.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), diff --git a/test/screen_tests/main_view_tests/main_view_screen_testA_test.dart b/test/screen_tests/main_view_tests/main_view_screen_testA_test.dart index f38c3735d..2ae8ea4dd 100644 --- a/test/screen_tests/main_view_tests/main_view_screen_testA_test.dart +++ b/test/screen_tests/main_view_tests/main_view_screen_testA_test.dart @@ -14,8 +14,8 @@ import 'package:stackwallet/services/wallets_service.dart'; // import 'main_view_screen_testA_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), - MockSpec(returnNullOnMissingStub: true), + MockSpec(), + MockSpec(), ]) void main() { // testWidgets("tap receive", (tester) async { diff --git a/test/screen_tests/main_view_tests/main_view_screen_testA_test.mocks.dart b/test/screen_tests/main_view_tests/main_view_screen_testA_test.mocks.dart index e9b29b616..9860ea5e7 100644 --- a/test/screen_tests/main_view_tests/main_view_screen_testA_test.mocks.dart +++ b/test/screen_tests/main_view_tests/main_view_screen_testA_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/main_view_tests/main_view_screen_testA_test.dart. // Do not manually edit this file. @@ -7,6 +7,7 @@ import 'dart:async' as _i3; import 'dart:ui' as _i4; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i6; import 'package:stackwallet/services/locale_service.dart' as _i5; import 'package:stackwallet/services/wallets_service.dart' as _i2; @@ -14,6 +15,8 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -25,6 +28,10 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; /// /// See the documentation for Mockito's code generation for more information. class MockWalletsService extends _i1.Mock implements _i2.WalletsService { + MockWalletsService() { + _i1.throwOnMissingStub(this); + } + @override _i3.Future> get walletNames => (super.noSuchMethod( @@ -75,10 +82,17 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { /// /// See the documentation for Mockito's code generation for more information. class MockLocaleService extends _i1.Mock implements _i5.LocaleService { + MockLocaleService() { + _i1.throwOnMissingStub(this); + } + @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.getter(#locale), + ), ) as String); @override bool get hasListeners => (super.noSuchMethod( diff --git a/test/screen_tests/main_view_tests/main_view_screen_testB_test.dart b/test/screen_tests/main_view_tests/main_view_screen_testB_test.dart index a14410d2d..59f049955 100644 --- a/test/screen_tests/main_view_tests/main_view_screen_testB_test.dart +++ b/test/screen_tests/main_view_tests/main_view_screen_testB_test.dart @@ -16,8 +16,8 @@ import 'package:stackwallet/services/wallets_service.dart'; // import 'main_view_screen_testB_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), - MockSpec(returnNullOnMissingStub: true), + MockSpec(), + MockSpec(), ]) void main() { // testWidgets("tap refresh", (tester) async { diff --git a/test/screen_tests/main_view_tests/main_view_screen_testB_test.mocks.dart b/test/screen_tests/main_view_tests/main_view_screen_testB_test.mocks.dart index 75731831b..2cc8ad83e 100644 --- a/test/screen_tests/main_view_tests/main_view_screen_testB_test.mocks.dart +++ b/test/screen_tests/main_view_tests/main_view_screen_testB_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/main_view_tests/main_view_screen_testB_test.dart. // Do not manually edit this file. @@ -7,6 +7,7 @@ import 'dart:async' as _i3; import 'dart:ui' as _i4; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i6; import 'package:stackwallet/services/locale_service.dart' as _i5; import 'package:stackwallet/services/wallets_service.dart' as _i2; @@ -14,6 +15,8 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -25,6 +28,10 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; /// /// See the documentation for Mockito's code generation for more information. class MockWalletsService extends _i1.Mock implements _i2.WalletsService { + MockWalletsService() { + _i1.throwOnMissingStub(this); + } + @override _i3.Future> get walletNames => (super.noSuchMethod( @@ -75,10 +82,17 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { /// /// See the documentation for Mockito's code generation for more information. class MockLocaleService extends _i1.Mock implements _i5.LocaleService { + MockLocaleService() { + _i1.throwOnMissingStub(this); + } + @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.getter(#locale), + ), ) as String); @override bool get hasListeners => (super.noSuchMethod( diff --git a/test/screen_tests/main_view_tests/main_view_screen_testC_test.dart b/test/screen_tests/main_view_tests/main_view_screen_testC_test.dart index 9e10391e8..191974b1c 100644 --- a/test/screen_tests/main_view_tests/main_view_screen_testC_test.dart +++ b/test/screen_tests/main_view_tests/main_view_screen_testC_test.dart @@ -14,8 +14,8 @@ import 'package:stackwallet/services/wallets_service.dart'; // import 'main_view_screen_testC_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), - MockSpec(returnNullOnMissingStub: true), + MockSpec(), + MockSpec(), ]) void main() { // testWidgets("tap send", (tester) async { diff --git a/test/screen_tests/main_view_tests/main_view_screen_testC_test.mocks.dart b/test/screen_tests/main_view_tests/main_view_screen_testC_test.mocks.dart index 01b3907bc..2da39262c 100644 --- a/test/screen_tests/main_view_tests/main_view_screen_testC_test.mocks.dart +++ b/test/screen_tests/main_view_tests/main_view_screen_testC_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/main_view_tests/main_view_screen_testC_test.dart. // Do not manually edit this file. @@ -7,6 +7,7 @@ import 'dart:async' as _i3; import 'dart:ui' as _i4; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i6; import 'package:stackwallet/services/locale_service.dart' as _i5; import 'package:stackwallet/services/wallets_service.dart' as _i2; @@ -14,6 +15,8 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -25,6 +28,10 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; /// /// See the documentation for Mockito's code generation for more information. class MockWalletsService extends _i1.Mock implements _i2.WalletsService { + MockWalletsService() { + _i1.throwOnMissingStub(this); + } + @override _i3.Future> get walletNames => (super.noSuchMethod( @@ -75,10 +82,17 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { /// /// See the documentation for Mockito's code generation for more information. class MockLocaleService extends _i1.Mock implements _i5.LocaleService { + MockLocaleService() { + _i1.throwOnMissingStub(this); + } + @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.getter(#locale), + ), ) as String); @override bool get hasListeners => (super.noSuchMethod( diff --git a/test/screen_tests/onboarding/backup_key_warning_view_screen_test.dart b/test/screen_tests/onboarding/backup_key_warning_view_screen_test.dart index ec6e105ba..023d6758a 100644 --- a/test/screen_tests/onboarding/backup_key_warning_view_screen_test.dart +++ b/test/screen_tests/onboarding/backup_key_warning_view_screen_test.dart @@ -12,7 +12,7 @@ import 'package:stackwallet/services/wallets_service.dart'; // import 'backup_key_warning_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("BackupKeyWarningView builds correctly", (tester) async { diff --git a/test/screen_tests/onboarding/backup_key_warning_view_screen_test.mocks.dart b/test/screen_tests/onboarding/backup_key_warning_view_screen_test.mocks.dart index fe6e52860..7544b767c 100644 --- a/test/screen_tests/onboarding/backup_key_warning_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/backup_key_warning_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/onboarding/backup_key_warning_view_screen_test.dart. // Do not manually edit this file. @@ -13,6 +13,8 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -24,6 +26,10 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; /// /// See the documentation for Mockito's code generation for more information. class MockWalletsService extends _i1.Mock implements _i2.WalletsService { + MockWalletsService() { + _i1.throwOnMissingStub(this); + } + @override _i3.Future> get walletNames => (super.noSuchMethod( diff --git a/test/screen_tests/onboarding/create_pin_view_screen_test.dart b/test/screen_tests/onboarding/create_pin_view_screen_test.dart index d7b0ce28f..fcd0aa2c5 100644 --- a/test/screen_tests/onboarding/create_pin_view_screen_test.dart +++ b/test/screen_tests/onboarding/create_pin_view_screen_test.dart @@ -18,8 +18,8 @@ import 'package:stackwallet/services/wallets_service.dart'; // import 'create_pin_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), - MockSpec(returnNullOnMissingStub: true), + MockSpec(), + MockSpec(), ]) void main() { // testWidgets("CreatePinView builds correctly", (tester) async { diff --git a/test/screen_tests/onboarding/create_pin_view_screen_test.mocks.dart b/test/screen_tests/onboarding/create_pin_view_screen_test.mocks.dart index 3f7fd0767..5aed33644 100644 --- a/test/screen_tests/onboarding/create_pin_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/create_pin_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/onboarding/create_pin_view_screen_test.dart. // Do not manually edit this file. @@ -19,6 +19,8 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -41,6 +43,10 @@ class _FakeSecureStorageInterface_0 extends _i1.SmartFake /// /// See the documentation for Mockito's code generation for more information. class MockWalletsService extends _i1.Mock implements _i3.WalletsService { + MockWalletsService() { + _i1.throwOnMissingStub(this); + } + @override _i4.Future> get walletNames => (super.noSuchMethod( @@ -91,6 +97,10 @@ class MockWalletsService extends _i1.Mock implements _i3.WalletsService { /// /// See the documentation for Mockito's code generation for more information. class MockNodeService extends _i1.Mock implements _i6.NodeService { + MockNodeService() { + _i1.throwOnMissingStub(this); + } + @override _i2.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), diff --git a/test/screen_tests/onboarding/name_your_wallet_view_screen_test.dart b/test/screen_tests/onboarding/name_your_wallet_view_screen_test.dart index ee75e1260..44dbe8baf 100644 --- a/test/screen_tests/onboarding/name_your_wallet_view_screen_test.dart +++ b/test/screen_tests/onboarding/name_your_wallet_view_screen_test.dart @@ -12,7 +12,7 @@ import 'package:stackwallet/services/wallets_service.dart'; // import 'name_your_wallet_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("NameYourWalletView builds correctly with testnet option", diff --git a/test/screen_tests/onboarding/name_your_wallet_view_screen_test.mocks.dart b/test/screen_tests/onboarding/name_your_wallet_view_screen_test.mocks.dart index 35f9c5505..ea7cadff1 100644 --- a/test/screen_tests/onboarding/name_your_wallet_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/name_your_wallet_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/onboarding/name_your_wallet_view_screen_test.dart. // Do not manually edit this file. @@ -13,6 +13,8 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -24,6 +26,10 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; /// /// See the documentation for Mockito's code generation for more information. class MockWalletsService extends _i1.Mock implements _i2.WalletsService { + MockWalletsService() { + _i1.throwOnMissingStub(this); + } + @override _i3.Future> get walletNames => (super.noSuchMethod( diff --git a/test/screen_tests/onboarding/restore_wallet_view_screen_test.dart b/test/screen_tests/onboarding/restore_wallet_view_screen_test.dart index f0f00fb85..a38774977 100644 --- a/test/screen_tests/onboarding/restore_wallet_view_screen_test.dart +++ b/test/screen_tests/onboarding/restore_wallet_view_screen_test.dart @@ -24,8 +24,8 @@ import 'package:stackwallet/utilities/barcode_scanner_interface.dart'; @GenerateMocks([ BarcodeScannerWrapper ], customMocks: [ - MockSpec(returnNullOnMissingStub: true), - MockSpec(returnNullOnMissingStub: true), + MockSpec(), + MockSpec(), ]) void main() { // testWidgets("RestoreWalletView builds correctly", (tester) async { diff --git a/test/screen_tests/onboarding/restore_wallet_view_screen_test.mocks.dart b/test/screen_tests/onboarding/restore_wallet_view_screen_test.mocks.dart index 58c717a5b..7ce8c0b95 100644 --- a/test/screen_tests/onboarding/restore_wallet_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/restore_wallet_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/onboarding/restore_wallet_view_screen_test.dart. // Do not manually edit this file. @@ -21,6 +21,8 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -82,6 +84,10 @@ class MockBarcodeScannerWrapper extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockWalletsService extends _i1.Mock implements _i6.WalletsService { + MockWalletsService() { + _i1.throwOnMissingStub(this); + } + @override _i5.Future> get walletNames => (super.noSuchMethod( @@ -132,6 +138,10 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { /// /// See the documentation for Mockito's code generation for more information. class MockNodeService extends _i1.Mock implements _i8.NodeService { + MockNodeService() { + _i1.throwOnMissingStub(this); + } + @override _i3.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), diff --git a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.dart b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.dart index 5db5f662e..524971fcb 100644 --- a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.dart +++ b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.dart @@ -15,7 +15,7 @@ import 'package:stackwallet/services/node_service.dart'; // import 'add_custom_node_view_screen_test.mocks.dart'; // @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("AddCustomNodeView builds correctly", (tester) async { diff --git a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.mocks.dart index ab3c043d3..6216d4e86 100644 --- a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.dart. // Do not manually edit this file. @@ -18,6 +18,8 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -40,6 +42,10 @@ class _FakeSecureStorageInterface_0 extends _i1.SmartFake /// /// See the documentation for Mockito's code generation for more information. class MockNodeService extends _i1.Mock implements _i3.NodeService { + MockNodeService() { + _i1.throwOnMissingStub(this); + } + @override _i2.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), diff --git a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.dart b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.dart index 02309a56d..6637999f8 100644 --- a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.dart +++ b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.dart @@ -17,7 +17,7 @@ import 'package:stackwallet/services/node_service.dart'; // import 'node_details_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("NodeDetailsView non-editing builds correctly", (tester) async { diff --git a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.mocks.dart index f203b112b..f1948fa9a 100644 --- a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.dart. // Do not manually edit this file. @@ -18,6 +18,8 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -40,6 +42,10 @@ class _FakeSecureStorageInterface_0 extends _i1.SmartFake /// /// See the documentation for Mockito's code generation for more information. class MockNodeService extends _i1.Mock implements _i3.NodeService { + MockNodeService() { + _i1.throwOnMissingStub(this); + } + @override _i2.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), diff --git a/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.dart b/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.dart index a466a5dfc..67d5398ab 100644 --- a/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.dart +++ b/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.dart @@ -13,7 +13,7 @@ import 'package:stackwallet/services/node_service.dart'; // import 'network_settings_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("NetworkSettingsView builds correctly", (tester) async { diff --git a/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.mocks.dart index 217f88d9f..4adf647f0 100644 --- a/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.dart. // Do not manually edit this file. @@ -18,6 +18,8 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -40,6 +42,10 @@ class _FakeSecureStorageInterface_0 extends _i1.SmartFake /// /// See the documentation for Mockito's code generation for more information. class MockNodeService extends _i1.Mock implements _i3.NodeService { + MockNodeService() { + _i1.throwOnMissingStub(this); + } + @override _i2.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.dart index 8cf9cc7bb..3c7332e9a 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.dart @@ -15,7 +15,7 @@ import 'package:stackwallet/services/wallets_service.dart'; // import 'change_pin_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("ChangePinView builds correctly", (tester) async { diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.mocks.dart index 764ed5967..b9014e5fe 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.dart. // Do not manually edit this file. @@ -13,6 +13,8 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -24,6 +26,10 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; /// /// See the documentation for Mockito's code generation for more information. class MockWalletsService extends _i1.Mock implements _i2.WalletsService { + MockWalletsService() { + _i1.throwOnMissingStub(this); + } + @override _i3.Future> get walletNames => (super.noSuchMethod( diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.dart index 59a45306a..5216180ac 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.dart @@ -14,7 +14,7 @@ import 'package:stackwallet/services/wallets_service.dart'; // import 'rename_wallet_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("RenameWalletView builds correctly", (tester) async { diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.mocks.dart index 7db7d3109..e35762cce 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.dart. // Do not manually edit this file. @@ -13,6 +13,8 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -24,6 +26,10 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; /// /// See the documentation for Mockito's code generation for more information. class MockWalletsService extends _i1.Mock implements _i2.WalletsService { + MockWalletsService() { + _i1.throwOnMissingStub(this); + } + @override _i3.Future> get walletNames => (super.noSuchMethod( diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.dart index 86a674aec..802e8a522 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.dart @@ -20,7 +20,7 @@ import 'package:stackwallet/services/wallets_service.dart'; // import 'wallet_delete_mnemonic_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("WalletDeleteMnemonicView builds correctly", (tester) async { diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.mocks.dart index 42b82db3b..7855c17d8 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.dart. // Do not manually edit this file. @@ -13,6 +13,8 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -24,6 +26,10 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; /// /// See the documentation for Mockito's code generation for more information. class MockWalletsService extends _i1.Mock implements _i2.WalletsService { + MockWalletsService() { + _i1.throwOnMissingStub(this); + } + @override _i3.Future> get walletNames => (super.noSuchMethod( diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.dart index 7f6c150bc..c23cc32e0 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.dart @@ -24,7 +24,7 @@ import 'package:stackwallet/utilities/biometrics.dart'; LocalAuthentication, Biometrics, ], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("WalletSettingsView builds correctly", (tester) async { diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.mocks.dart index 63c207931..e4c45b863 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.mocks.dart @@ -1,18 +1,19 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; -import 'dart:ui' as _i10; +import 'dart:ui' as _i11; -import 'package:local_auth/auth_strings.dart' as _i7; -import 'package:local_auth/local_auth.dart' as _i6; +import 'package:local_auth/auth_strings.dart' as _i8; +import 'package:local_auth/local_auth.dart' as _i7; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i6; import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i3; import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i2; -import 'package:stackwallet/services/wallets_service.dart' as _i9; -import 'package:stackwallet/utilities/biometrics.dart' as _i8; +import 'package:stackwallet/services/wallets_service.dart' as _i10; +import 'package:stackwallet/utilities/biometrics.dart' as _i9; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' as _i5; @@ -20,6 +21,8 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -75,33 +78,18 @@ class MockCachedElectrumXClient extends _i1.Mock _i4.Future>.value({}), ) as _i4.Future>); @override - _i4.Future> getSparkAnonymitySet({ - required String? groupId, - String? blockhash = r'', - required _i5.CryptoCurrency? cryptoCurrency, - required bool? useOnlyCacheIfNotEmpty, - }) => - (super.noSuchMethod( - Invocation.method( - #getSparkAnonymitySet, - [], - { - #groupId: groupId, - #blockhash: blockhash, - #cryptoCurrency: cryptoCurrency, - #useOnlyCacheIfNotEmpty: useOnlyCacheIfNotEmpty, - }, - ), - returnValue: - _i4.Future>.value({}), - ) as _i4.Future>); - @override String base64ToHex(String? source) => (super.noSuchMethod( Invocation.method( #base64ToHex, [source], ), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.method( + #base64ToHex, + [source], + ), + ), ) as String); @override String base64ToReverseHex(String? source) => (super.noSuchMethod( @@ -109,7 +97,13 @@ class MockCachedElectrumXClient extends _i1.Mock #base64ToReverseHex, [source], ), - returnValue: '', + returnValue: _i6.dummyValue( + this, + Invocation.method( + #base64ToReverseHex, + [source], + ), + ), ) as String); @override _i4.Future> getTransaction({ @@ -147,17 +141,6 @@ class MockCachedElectrumXClient extends _i1.Mock returnValue: _i4.Future>.value([]), ) as _i4.Future>); @override - _i4.Future> getSparkUsedCoinsTags( - {required _i5.CryptoCurrency? cryptoCurrency}) => - (super.noSuchMethod( - Invocation.method( - #getSparkUsedCoinsTags, - [], - {#cryptoCurrency: cryptoCurrency}, - ), - returnValue: _i4.Future>.value({}), - ) as _i4.Future>); - @override _i4.Future clearSharedTransactionCache( {required _i5.CryptoCurrency? cryptoCurrency}) => (super.noSuchMethod( @@ -175,7 +158,7 @@ class MockCachedElectrumXClient extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockLocalAuthentication extends _i1.Mock - implements _i6.LocalAuthentication { + implements _i7.LocalAuthentication { MockLocalAuthentication() { _i1.throwOnMissingStub(this); } @@ -190,9 +173,9 @@ class MockLocalAuthentication extends _i1.Mock required String? localizedReason, bool? useErrorDialogs = true, bool? stickyAuth = false, - _i7.AndroidAuthMessages? androidAuthStrings = - const _i7.AndroidAuthMessages(), - _i7.IOSAuthMessages? iOSAuthStrings = const _i7.IOSAuthMessages(), + _i8.AndroidAuthMessages? androidAuthStrings = + const _i8.AndroidAuthMessages(), + _i8.IOSAuthMessages? iOSAuthStrings = const _i8.IOSAuthMessages(), bool? sensitiveTransaction = true, }) => (super.noSuchMethod( @@ -215,9 +198,9 @@ class MockLocalAuthentication extends _i1.Mock required String? localizedReason, bool? useErrorDialogs = true, bool? stickyAuth = false, - _i7.AndroidAuthMessages? androidAuthStrings = - const _i7.AndroidAuthMessages(), - _i7.IOSAuthMessages? iOSAuthStrings = const _i7.IOSAuthMessages(), + _i8.AndroidAuthMessages? androidAuthStrings = + const _i8.AndroidAuthMessages(), + _i8.IOSAuthMessages? iOSAuthStrings = const _i8.IOSAuthMessages(), bool? sensitiveTransaction = true, bool? biometricOnly = false, }) => @@ -254,21 +237,21 @@ class MockLocalAuthentication extends _i1.Mock returnValue: _i4.Future.value(false), ) as _i4.Future); @override - _i4.Future> getAvailableBiometrics() => + _i4.Future> getAvailableBiometrics() => (super.noSuchMethod( Invocation.method( #getAvailableBiometrics, [], ), returnValue: - _i4.Future>.value(<_i6.BiometricType>[]), - ) as _i4.Future>); + _i4.Future>.value(<_i7.BiometricType>[]), + ) as _i4.Future>); } /// A class which mocks [Biometrics]. /// /// See the documentation for Mockito's code generation for more information. -class MockBiometrics extends _i1.Mock implements _i8.Biometrics { +class MockBiometrics extends _i1.Mock implements _i9.Biometrics { MockBiometrics() { _i1.throwOnMissingStub(this); } @@ -296,21 +279,25 @@ class MockBiometrics extends _i1.Mock implements _i8.Biometrics { /// A class which mocks [WalletsService]. /// /// See the documentation for Mockito's code generation for more information. -class MockWalletsService extends _i1.Mock implements _i9.WalletsService { +class MockWalletsService extends _i1.Mock implements _i10.WalletsService { + MockWalletsService() { + _i1.throwOnMissingStub(this); + } + @override - _i4.Future> get walletNames => + _i4.Future> get walletNames => (super.noSuchMethod( Invocation.getter(#walletNames), - returnValue: _i4.Future>.value( - {}), - ) as _i4.Future>); + returnValue: _i4.Future>.value( + {}), + ) as _i4.Future>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -318,7 +305,7 @@ class MockWalletsService extends _i1.Mock implements _i9.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_view_screen_test.dart b/test/screen_tests/settings_view/settings_view_screen_test.dart index 10e05b8f9..5cfe925b3 100644 --- a/test/screen_tests/settings_view/settings_view_screen_test.dart +++ b/test/screen_tests/settings_view/settings_view_screen_test.dart @@ -16,7 +16,7 @@ import 'package:stackwallet/services/wallets_service.dart'; // import 'settings_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("SettingsView builds correctly", (tester) async { diff --git a/test/screen_tests/settings_view/settings_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_view_screen_test.mocks.dart index a4edcd6ab..21c907eb7 100644 --- a/test/screen_tests/settings_view/settings_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/settings_view/settings_view_screen_test.dart. // Do not manually edit this file. @@ -13,6 +13,8 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -24,6 +26,10 @@ import 'package:stackwallet/services/wallets_service.dart' as _i2; /// /// See the documentation for Mockito's code generation for more information. class MockWalletsService extends _i1.Mock implements _i2.WalletsService { + MockWalletsService() { + _i1.throwOnMissingStub(this); + } + @override _i3.Future> get walletNames => (super.noSuchMethod( diff --git a/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.dart b/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.dart index 41bb64552..868698391 100644 --- a/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.dart +++ b/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.dart @@ -15,8 +15,8 @@ import 'package:stackwallet/services/locale_service.dart'; // import 'transaction_details_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), - MockSpec(returnNullOnMissingStub: true), + MockSpec(), + MockSpec(), ]) void main() { // final transactionA = Transaction( diff --git a/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart b/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart index 7d62e5a47..7c8355a96 100644 --- a/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart +++ b/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.dart. // Do not manually edit this file. @@ -7,6 +7,7 @@ import 'dart:async' as _i4; import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i7; import 'package:stackwallet/models/isar/models/contact_entry.dart' as _i2; import 'package:stackwallet/services/address_book_service.dart' as _i3; import 'package:stackwallet/services/locale_service.dart' as _i6; @@ -15,6 +16,8 @@ import 'package:stackwallet/services/locale_service.dart' as _i6; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -37,6 +40,10 @@ class _FakeContactEntry_0 extends _i1.SmartFake implements _i2.ContactEntry { /// See the documentation for Mockito's code generation for more information. class MockAddressBookService extends _i1.Mock implements _i3.AddressBookService { + MockAddressBookService() { + _i1.throwOnMissingStub(this); + } + @override List<_i2.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), @@ -150,10 +157,17 @@ class MockAddressBookService extends _i1.Mock /// /// See the documentation for Mockito's code generation for more information. class MockLocaleService extends _i1.Mock implements _i6.LocaleService { + MockLocaleService() { + _i1.throwOnMissingStub(this); + } + @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), - returnValue: '', + returnValue: _i7.dummyValue( + this, + Invocation.getter(#locale), + ), ) as String); @override bool get hasListeners => (super.noSuchMethod( diff --git a/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.dart b/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.dart index d3d676211..8a50045a6 100644 --- a/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.dart +++ b/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.dart @@ -16,7 +16,7 @@ import 'package:stackwallet/services/locale_service.dart'; // import 'transaction_search_results_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets( diff --git a/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.mocks.dart b/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.mocks.dart index 46f63781d..c4aad0a14 100644 --- a/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.mocks.dart +++ b/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.mocks.dart @@ -1,18 +1,21 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i3; -import 'dart:ui' as _i4; +import 'dart:async' as _i4; +import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i3; import 'package:stackwallet/services/locale_service.dart' as _i2; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -24,10 +27,17 @@ import 'package:stackwallet/services/locale_service.dart' as _i2; /// /// See the documentation for Mockito's code generation for more information. class MockLocaleService extends _i1.Mock implements _i2.LocaleService { + MockLocaleService() { + _i1.throwOnMissingStub(this); + } + @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), - returnValue: '', + returnValue: _i3.dummyValue( + this, + Invocation.getter(#locale), + ), ) as String); @override bool get hasListeners => (super.noSuchMethod( @@ -35,17 +45,17 @@ class MockLocaleService extends _i1.Mock implements _i2.LocaleService { returnValue: false, ) as bool); @override - _i3.Future loadLocale({bool? notify = true}) => (super.noSuchMethod( + _i4.Future loadLocale({bool? notify = true}) => (super.noSuchMethod( Invocation.method( #loadLocale, [], {#notify: notify}, ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - void addListener(_i4.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -53,7 +63,7 @@ class MockLocaleService extends _i1.Mock implements _i2.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i4.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.dart b/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.dart index fb4280932..080a1ffbd 100644 --- a/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.dart +++ b/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.dart @@ -14,7 +14,7 @@ import 'package:stackwallet/services/address_book_service.dart'; // import 'transaction_search_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("TransactionSearchView builds correctly", (tester) async { diff --git a/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart b/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart index 652e170f0..6fd708af7 100644 --- a/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart +++ b/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.dart. // Do not manually edit this file. @@ -14,6 +14,8 @@ import 'package:stackwallet/services/address_book_service.dart' as _i3; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -36,6 +38,10 @@ class _FakeContactEntry_0 extends _i1.SmartFake implements _i2.ContactEntry { /// See the documentation for Mockito's code generation for more information. class MockAddressBookService extends _i1.Mock implements _i3.AddressBookService { + MockAddressBookService() { + _i1.throwOnMissingStub(this); + } + @override List<_i2.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), diff --git a/test/screen_tests/wallet_view/send_view_screen_test.mocks.dart b/test/screen_tests/wallet_view/send_view_screen_test.mocks.dart index 666ce4e98..a7a3ad695 100644 --- a/test/screen_tests/wallet_view/send_view_screen_test.mocks.dart +++ b/test/screen_tests/wallet_view/send_view_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/wallet_view/send_view_screen_test.dart. // Do not manually edit this file. @@ -13,6 +13,8 @@ import 'package:stackwallet/utilities/barcode_scanner_interface.dart' as _i3; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors diff --git a/test/screen_tests/wallet_view/wallet_view_screen_test.dart b/test/screen_tests/wallet_view/wallet_view_screen_test.dart index 6c6815d4c..02ed59580 100644 --- a/test/screen_tests/wallet_view/wallet_view_screen_test.dart +++ b/test/screen_tests/wallet_view/wallet_view_screen_test.dart @@ -22,7 +22,7 @@ import 'package:stackwallet/services/locale_service.dart'; // import 'wallet_view_screen_test.mocks.dart'; @GenerateMocks([], customMocks: [ - MockSpec(returnNullOnMissingStub: true), + MockSpec(), ]) void main() { // testWidgets("WalletView builds correctly with no transactions", diff --git a/test/screen_tests/wallet_view/wallet_view_screen_test.mocks.dart b/test/screen_tests/wallet_view/wallet_view_screen_test.mocks.dart index 41319572b..b85201783 100644 --- a/test/screen_tests/wallet_view/wallet_view_screen_test.mocks.dart +++ b/test/screen_tests/wallet_view/wallet_view_screen_test.mocks.dart @@ -1,18 +1,21 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/screen_tests/wallet_view/wallet_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i3; -import 'dart:ui' as _i4; +import 'dart:async' as _i4; +import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i3; import 'package:stackwallet/services/locale_service.dart' as _i2; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -24,10 +27,17 @@ import 'package:stackwallet/services/locale_service.dart' as _i2; /// /// See the documentation for Mockito's code generation for more information. class MockLocaleService extends _i1.Mock implements _i2.LocaleService { + MockLocaleService() { + _i1.throwOnMissingStub(this); + } + @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), - returnValue: '', + returnValue: _i3.dummyValue( + this, + Invocation.getter(#locale), + ), ) as String); @override bool get hasListeners => (super.noSuchMethod( @@ -35,17 +45,17 @@ class MockLocaleService extends _i1.Mock implements _i2.LocaleService { returnValue: false, ) as bool); @override - _i3.Future loadLocale({bool? notify = true}) => (super.noSuchMethod( + _i4.Future loadLocale({bool? notify = true}) => (super.noSuchMethod( Invocation.method( #loadLocale, [], {#notify: notify}, ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - void addListener(_i4.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -53,7 +63,7 @@ class MockLocaleService extends _i1.Mock implements _i2.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i4.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/services/change_now/change_now_test.mocks.dart b/test/services/change_now/change_now_test.mocks.dart index f0b375d72..1ee496d32 100644 --- a/test/services/change_now/change_now_test.mocks.dart +++ b/test/services/change_now/change_now_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/services/change_now/change_now_test.dart. // Do not manually edit this file. @@ -14,6 +14,8 @@ import 'package:stackwallet/networking/http.dart' as _i2; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors diff --git a/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart b/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart index efcb9f626..af94be20b 100644 --- a/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart +++ b/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart @@ -1,16 +1,17 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/services/coins/bitcoin/bitcoin_wallet_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i5; +import 'dart:async' as _i6; import 'package:decimal/decimal.dart' as _i3; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i6; +import 'package:mockito/src/dummies.dart' as _i5; +import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i7; import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i4; import 'package:stackwallet/services/transaction_notification_tracker.dart' - as _i7; + as _i8; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' as _i2; @@ -18,6 +19,8 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -116,7 +119,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { @override String get host => (super.noSuchMethod( Invocation.getter(#host), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.getter(#host), + ), ) as String); @override int get port => (super.noSuchMethod( @@ -129,16 +135,16 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { returnValue: false, ) as bool); @override - _i5.Future closeAdapter() => (super.noSuchMethod( + _i6.Future closeAdapter() => (super.noSuchMethod( Invocation.method( #closeAdapter, [], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future request({ + _i6.Future request({ required String? command, List? args = const [], String? requestID, @@ -157,10 +163,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestTimeout: requestTimeout, }, ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future> batchRequest({ + _i6.Future> batchRequest({ required String? command, required List? args, Duration? requestTimeout = const Duration(seconds: 60), @@ -177,10 +183,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #retries: retries, }, ), - returnValue: _i5.Future>.value([]), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future ping({ + _i6.Future ping({ String? requestID, int? retryCount = 1, }) => @@ -193,10 +199,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #retryCount: retryCount, }, ), - returnValue: _i5.Future.value(false), - ) as _i5.Future); + returnValue: _i6.Future.value(false), + ) as _i6.Future); @override - _i5.Future> getBlockHeadTip({String? requestID}) => + _i6.Future> getBlockHeadTip({String? requestID}) => (super.noSuchMethod( Invocation.method( #getBlockHeadTip, @@ -204,10 +210,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getServerFeatures({String? requestID}) => + _i6.Future> getServerFeatures({String? requestID}) => (super.noSuchMethod( Invocation.method( #getServerFeatures, @@ -215,10 +221,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future broadcastTransaction({ + _i6.Future broadcastTransaction({ required String? rawTx, String? requestID, }) => @@ -231,10 +237,20 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future.value(''), - ) as _i5.Future); + returnValue: _i6.Future.value(_i5.dummyValue( + this, + Invocation.method( + #broadcastTransaction, + [], + { + #rawTx: rawTx, + #requestID: requestID, + }, + ), + )), + ) as _i6.Future); @override - _i5.Future> getBalance({ + _i6.Future> getBalance({ required String? scripthash, String? requestID, }) => @@ -248,10 +264,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future>> getHistory({ + _i6.Future>> getHistory({ required String? scripthash, String? requestID, }) => @@ -264,11 +280,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future>>> getBatchHistory( + _i6.Future>>> getBatchHistory( {required List? args}) => (super.noSuchMethod( Invocation.method( @@ -276,11 +292,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { [], {#args: args}, ), - returnValue: _i5.Future>>>.value( + returnValue: _i6.Future>>>.value( >>[]), - ) as _i5.Future>>>); + ) as _i6.Future>>>); @override - _i5.Future>> getUTXOs({ + _i6.Future>> getUTXOs({ required String? scripthash, String? requestID, }) => @@ -293,11 +309,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future>>> getBatchUTXOs( + _i6.Future>>> getBatchUTXOs( {required List? args}) => (super.noSuchMethod( Invocation.method( @@ -305,11 +321,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { [], {#args: args}, ), - returnValue: _i5.Future>>>.value( + returnValue: _i6.Future>>>.value( >>[]), - ) as _i5.Future>>>); + ) as _i6.Future>>>); @override - _i5.Future> getTransaction({ + _i6.Future> getTransaction({ required String? txHash, bool? verbose = true, String? requestID, @@ -325,10 +341,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getLelantusAnonymitySet({ + _i6.Future> getLelantusAnonymitySet({ String? groupId = r'1', String? blockhash = r'', String? requestID, @@ -344,10 +360,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future getLelantusMintData({ + _i6.Future getLelantusMintData({ dynamic mints, String? requestID, }) => @@ -360,10 +376,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future> getLelantusUsedCoinSerials({ + _i6.Future> getLelantusUsedCoinSerials({ String? requestID, required int? startNumber, }) => @@ -377,20 +393,20 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future getLelantusLatestCoinId({String? requestID}) => + _i6.Future getLelantusLatestCoinId({String? requestID}) => (super.noSuchMethod( Invocation.method( #getLelantusLatestCoinId, [], {#requestID: requestID}, ), - returnValue: _i5.Future.value(0), - ) as _i5.Future); + returnValue: _i6.Future.value(0), + ) as _i6.Future); @override - _i5.Future> getSparkAnonymitySet({ + _i6.Future> getSparkAnonymitySet({ String? coinGroupId = r'1', String? startBlockHash = r'', String? requestID, @@ -406,26 +422,26 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getSparkUsedCoinsTags({ + _i6.Future> getSparkUnhashedUsedCoinsTags({ String? requestID, required int? startNumber, }) => (super.noSuchMethod( Invocation.method( - #getSparkUsedCoinsTags, + #getSparkUnhashedUsedCoinsTags, [], { #requestID: requestID, #startNumber: startNumber, }, ), - returnValue: _i5.Future>.value({}), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future>> getSparkMintMetaData({ + _i6.Future>> getSparkMintMetaData({ String? requestID, required List? sparkCoinHashes, }) => @@ -438,21 +454,21 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #sparkCoinHashes: sparkCoinHashes, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future getSparkLatestCoinId({String? requestID}) => + _i6.Future getSparkLatestCoinId({String? requestID}) => (super.noSuchMethod( Invocation.method( #getSparkLatestCoinId, [], {#requestID: requestID}, ), - returnValue: _i5.Future.value(0), - ) as _i5.Future); + returnValue: _i6.Future.value(0), + ) as _i6.Future); @override - _i5.Future> getFeeRate({String? requestID}) => + _i6.Future> getFeeRate({String? requestID}) => (super.noSuchMethod( Invocation.method( #getFeeRate, @@ -460,10 +476,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future<_i3.Decimal> estimateFee({ + _i6.Future<_i3.Decimal> estimateFee({ String? requestID, required int? blocks, }) => @@ -476,7 +492,7 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #blocks: blocks, }, ), - returnValue: _i5.Future<_i3.Decimal>.value(_FakeDecimal_2( + returnValue: _i6.Future<_i3.Decimal>.value(_FakeDecimal_2( this, Invocation.method( #estimateFee, @@ -487,15 +503,15 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), )), - ) as _i5.Future<_i3.Decimal>); + ) as _i6.Future<_i3.Decimal>); @override - _i5.Future<_i3.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( + _i6.Future<_i3.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( Invocation.method( #relayFee, [], {#requestID: requestID}, ), - returnValue: _i5.Future<_i3.Decimal>.value(_FakeDecimal_2( + returnValue: _i6.Future<_i3.Decimal>.value(_FakeDecimal_2( this, Invocation.method( #relayFee, @@ -503,14 +519,14 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), )), - ) as _i5.Future<_i3.Decimal>); + ) as _i6.Future<_i3.Decimal>); } /// A class which mocks [CachedElectrumXClient]. /// /// See the documentation for Mockito's code generation for more information. class MockCachedElectrumXClient extends _i1.Mock - implements _i6.CachedElectrumXClient { + implements _i7.CachedElectrumXClient { MockCachedElectrumXClient() { _i1.throwOnMissingStub(this); } @@ -524,7 +540,7 @@ class MockCachedElectrumXClient extends _i1.Mock ), ) as _i4.ElectrumXClient); @override - _i5.Future> getAnonymitySet({ + _i6.Future> getAnonymitySet({ required String? groupId, String? blockhash = r'', required _i2.CryptoCurrency? cryptoCurrency, @@ -540,36 +556,21 @@ class MockCachedElectrumXClient extends _i1.Mock }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); - @override - _i5.Future> getSparkAnonymitySet({ - required String? groupId, - String? blockhash = r'', - required _i2.CryptoCurrency? cryptoCurrency, - required bool? useOnlyCacheIfNotEmpty, - }) => - (super.noSuchMethod( - Invocation.method( - #getSparkAnonymitySet, - [], - { - #groupId: groupId, - #blockhash: blockhash, - #cryptoCurrency: cryptoCurrency, - #useOnlyCacheIfNotEmpty: useOnlyCacheIfNotEmpty, - }, - ), - returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override String base64ToHex(String? source) => (super.noSuchMethod( Invocation.method( #base64ToHex, [source], ), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.method( + #base64ToHex, + [source], + ), + ), ) as String); @override String base64ToReverseHex(String? source) => (super.noSuchMethod( @@ -577,10 +578,16 @@ class MockCachedElectrumXClient extends _i1.Mock #base64ToReverseHex, [source], ), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.method( + #base64ToReverseHex, + [source], + ), + ), ) as String); @override - _i5.Future> getTransaction({ + _i6.Future> getTransaction({ required String? txHash, required _i2.CryptoCurrency? cryptoCurrency, bool? verbose = true, @@ -596,10 +603,10 @@ class MockCachedElectrumXClient extends _i1.Mock }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getUsedCoinSerials({ + _i6.Future> getUsedCoinSerials({ required _i2.CryptoCurrency? cryptoCurrency, int? startNumber = 0, }) => @@ -612,21 +619,10 @@ class MockCachedElectrumXClient extends _i1.Mock #startNumber: startNumber, }, ), - returnValue: _i5.Future>.value([]), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future> getSparkUsedCoinsTags( - {required _i2.CryptoCurrency? cryptoCurrency}) => - (super.noSuchMethod( - Invocation.method( - #getSparkUsedCoinsTags, - [], - {#cryptoCurrency: cryptoCurrency}, - ), - returnValue: _i5.Future>.value({}), - ) as _i5.Future>); - @override - _i5.Future clearSharedTransactionCache( + _i6.Future clearSharedTransactionCache( {required _i2.CryptoCurrency? cryptoCurrency}) => (super.noSuchMethod( Invocation.method( @@ -634,16 +630,16 @@ class MockCachedElectrumXClient extends _i1.Mock [], {#cryptoCurrency: cryptoCurrency}, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } /// A class which mocks [TransactionNotificationTracker]. /// /// See the documentation for Mockito's code generation for more information. class MockTransactionNotificationTracker extends _i1.Mock - implements _i7.TransactionNotificationTracker { + implements _i8.TransactionNotificationTracker { MockTransactionNotificationTracker() { _i1.throwOnMissingStub(this); } @@ -651,7 +647,10 @@ class MockTransactionNotificationTracker extends _i1.Mock @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.getter(#walletId), + ), ) as String); @override List get pendings => (super.noSuchMethod( @@ -672,14 +671,14 @@ class MockTransactionNotificationTracker extends _i1.Mock returnValue: false, ) as bool); @override - _i5.Future addNotifiedPending(String? txid) => (super.noSuchMethod( + _i6.Future addNotifiedPending(String? txid) => (super.noSuchMethod( Invocation.method( #addNotifiedPending, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override bool wasNotifiedConfirmed(String? txid) => (super.noSuchMethod( Invocation.method( @@ -689,21 +688,21 @@ class MockTransactionNotificationTracker extends _i1.Mock returnValue: false, ) as bool); @override - _i5.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( + _i6.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( Invocation.method( #addNotifiedConfirmed, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future deleteTransaction(String? txid) => (super.noSuchMethod( + _i6.Future deleteTransaction(String? txid) => (super.noSuchMethod( Invocation.method( #deleteTransaction, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } diff --git a/test/services/coins/bitcoincash/bitcoincash_wallet_test.mocks.dart b/test/services/coins/bitcoincash/bitcoincash_wallet_test.mocks.dart index 7cfef5ab4..85565e3cf 100644 --- a/test/services/coins/bitcoincash/bitcoincash_wallet_test.mocks.dart +++ b/test/services/coins/bitcoincash/bitcoincash_wallet_test.mocks.dart @@ -1,16 +1,17 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/services/coins/bitcoincash/bitcoincash_wallet_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i5; +import 'dart:async' as _i6; import 'package:decimal/decimal.dart' as _i3; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i6; +import 'package:mockito/src/dummies.dart' as _i5; +import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i7; import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i4; import 'package:stackwallet/services/transaction_notification_tracker.dart' - as _i7; + as _i8; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' as _i2; @@ -18,6 +19,8 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -116,7 +119,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { @override String get host => (super.noSuchMethod( Invocation.getter(#host), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.getter(#host), + ), ) as String); @override int get port => (super.noSuchMethod( @@ -129,16 +135,16 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { returnValue: false, ) as bool); @override - _i5.Future closeAdapter() => (super.noSuchMethod( + _i6.Future closeAdapter() => (super.noSuchMethod( Invocation.method( #closeAdapter, [], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future request({ + _i6.Future request({ required String? command, List? args = const [], String? requestID, @@ -157,10 +163,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestTimeout: requestTimeout, }, ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future> batchRequest({ + _i6.Future> batchRequest({ required String? command, required List? args, Duration? requestTimeout = const Duration(seconds: 60), @@ -177,10 +183,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #retries: retries, }, ), - returnValue: _i5.Future>.value([]), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future ping({ + _i6.Future ping({ String? requestID, int? retryCount = 1, }) => @@ -193,10 +199,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #retryCount: retryCount, }, ), - returnValue: _i5.Future.value(false), - ) as _i5.Future); + returnValue: _i6.Future.value(false), + ) as _i6.Future); @override - _i5.Future> getBlockHeadTip({String? requestID}) => + _i6.Future> getBlockHeadTip({String? requestID}) => (super.noSuchMethod( Invocation.method( #getBlockHeadTip, @@ -204,10 +210,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getServerFeatures({String? requestID}) => + _i6.Future> getServerFeatures({String? requestID}) => (super.noSuchMethod( Invocation.method( #getServerFeatures, @@ -215,10 +221,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future broadcastTransaction({ + _i6.Future broadcastTransaction({ required String? rawTx, String? requestID, }) => @@ -231,10 +237,20 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future.value(''), - ) as _i5.Future); + returnValue: _i6.Future.value(_i5.dummyValue( + this, + Invocation.method( + #broadcastTransaction, + [], + { + #rawTx: rawTx, + #requestID: requestID, + }, + ), + )), + ) as _i6.Future); @override - _i5.Future> getBalance({ + _i6.Future> getBalance({ required String? scripthash, String? requestID, }) => @@ -248,10 +264,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future>> getHistory({ + _i6.Future>> getHistory({ required String? scripthash, String? requestID, }) => @@ -264,11 +280,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future>>> getBatchHistory( + _i6.Future>>> getBatchHistory( {required List? args}) => (super.noSuchMethod( Invocation.method( @@ -276,11 +292,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { [], {#args: args}, ), - returnValue: _i5.Future>>>.value( + returnValue: _i6.Future>>>.value( >>[]), - ) as _i5.Future>>>); + ) as _i6.Future>>>); @override - _i5.Future>> getUTXOs({ + _i6.Future>> getUTXOs({ required String? scripthash, String? requestID, }) => @@ -293,11 +309,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future>>> getBatchUTXOs( + _i6.Future>>> getBatchUTXOs( {required List? args}) => (super.noSuchMethod( Invocation.method( @@ -305,11 +321,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { [], {#args: args}, ), - returnValue: _i5.Future>>>.value( + returnValue: _i6.Future>>>.value( >>[]), - ) as _i5.Future>>>); + ) as _i6.Future>>>); @override - _i5.Future> getTransaction({ + _i6.Future> getTransaction({ required String? txHash, bool? verbose = true, String? requestID, @@ -325,10 +341,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getLelantusAnonymitySet({ + _i6.Future> getLelantusAnonymitySet({ String? groupId = r'1', String? blockhash = r'', String? requestID, @@ -344,10 +360,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future getLelantusMintData({ + _i6.Future getLelantusMintData({ dynamic mints, String? requestID, }) => @@ -360,10 +376,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future> getLelantusUsedCoinSerials({ + _i6.Future> getLelantusUsedCoinSerials({ String? requestID, required int? startNumber, }) => @@ -377,20 +393,20 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future getLelantusLatestCoinId({String? requestID}) => + _i6.Future getLelantusLatestCoinId({String? requestID}) => (super.noSuchMethod( Invocation.method( #getLelantusLatestCoinId, [], {#requestID: requestID}, ), - returnValue: _i5.Future.value(0), - ) as _i5.Future); + returnValue: _i6.Future.value(0), + ) as _i6.Future); @override - _i5.Future> getSparkAnonymitySet({ + _i6.Future> getSparkAnonymitySet({ String? coinGroupId = r'1', String? startBlockHash = r'', String? requestID, @@ -406,26 +422,26 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getSparkUsedCoinsTags({ + _i6.Future> getSparkUnhashedUsedCoinsTags({ String? requestID, required int? startNumber, }) => (super.noSuchMethod( Invocation.method( - #getSparkUsedCoinsTags, + #getSparkUnhashedUsedCoinsTags, [], { #requestID: requestID, #startNumber: startNumber, }, ), - returnValue: _i5.Future>.value({}), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future>> getSparkMintMetaData({ + _i6.Future>> getSparkMintMetaData({ String? requestID, required List? sparkCoinHashes, }) => @@ -438,21 +454,21 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #sparkCoinHashes: sparkCoinHashes, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future getSparkLatestCoinId({String? requestID}) => + _i6.Future getSparkLatestCoinId({String? requestID}) => (super.noSuchMethod( Invocation.method( #getSparkLatestCoinId, [], {#requestID: requestID}, ), - returnValue: _i5.Future.value(0), - ) as _i5.Future); + returnValue: _i6.Future.value(0), + ) as _i6.Future); @override - _i5.Future> getFeeRate({String? requestID}) => + _i6.Future> getFeeRate({String? requestID}) => (super.noSuchMethod( Invocation.method( #getFeeRate, @@ -460,10 +476,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future<_i3.Decimal> estimateFee({ + _i6.Future<_i3.Decimal> estimateFee({ String? requestID, required int? blocks, }) => @@ -476,7 +492,7 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #blocks: blocks, }, ), - returnValue: _i5.Future<_i3.Decimal>.value(_FakeDecimal_2( + returnValue: _i6.Future<_i3.Decimal>.value(_FakeDecimal_2( this, Invocation.method( #estimateFee, @@ -487,15 +503,15 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), )), - ) as _i5.Future<_i3.Decimal>); + ) as _i6.Future<_i3.Decimal>); @override - _i5.Future<_i3.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( + _i6.Future<_i3.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( Invocation.method( #relayFee, [], {#requestID: requestID}, ), - returnValue: _i5.Future<_i3.Decimal>.value(_FakeDecimal_2( + returnValue: _i6.Future<_i3.Decimal>.value(_FakeDecimal_2( this, Invocation.method( #relayFee, @@ -503,14 +519,14 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), )), - ) as _i5.Future<_i3.Decimal>); + ) as _i6.Future<_i3.Decimal>); } /// A class which mocks [CachedElectrumXClient]. /// /// See the documentation for Mockito's code generation for more information. class MockCachedElectrumXClient extends _i1.Mock - implements _i6.CachedElectrumXClient { + implements _i7.CachedElectrumXClient { MockCachedElectrumXClient() { _i1.throwOnMissingStub(this); } @@ -524,7 +540,7 @@ class MockCachedElectrumXClient extends _i1.Mock ), ) as _i4.ElectrumXClient); @override - _i5.Future> getAnonymitySet({ + _i6.Future> getAnonymitySet({ required String? groupId, String? blockhash = r'', required _i2.CryptoCurrency? cryptoCurrency, @@ -540,36 +556,21 @@ class MockCachedElectrumXClient extends _i1.Mock }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); - @override - _i5.Future> getSparkAnonymitySet({ - required String? groupId, - String? blockhash = r'', - required _i2.CryptoCurrency? cryptoCurrency, - required bool? useOnlyCacheIfNotEmpty, - }) => - (super.noSuchMethod( - Invocation.method( - #getSparkAnonymitySet, - [], - { - #groupId: groupId, - #blockhash: blockhash, - #cryptoCurrency: cryptoCurrency, - #useOnlyCacheIfNotEmpty: useOnlyCacheIfNotEmpty, - }, - ), - returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override String base64ToHex(String? source) => (super.noSuchMethod( Invocation.method( #base64ToHex, [source], ), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.method( + #base64ToHex, + [source], + ), + ), ) as String); @override String base64ToReverseHex(String? source) => (super.noSuchMethod( @@ -577,10 +578,16 @@ class MockCachedElectrumXClient extends _i1.Mock #base64ToReverseHex, [source], ), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.method( + #base64ToReverseHex, + [source], + ), + ), ) as String); @override - _i5.Future> getTransaction({ + _i6.Future> getTransaction({ required String? txHash, required _i2.CryptoCurrency? cryptoCurrency, bool? verbose = true, @@ -596,10 +603,10 @@ class MockCachedElectrumXClient extends _i1.Mock }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getUsedCoinSerials({ + _i6.Future> getUsedCoinSerials({ required _i2.CryptoCurrency? cryptoCurrency, int? startNumber = 0, }) => @@ -612,21 +619,10 @@ class MockCachedElectrumXClient extends _i1.Mock #startNumber: startNumber, }, ), - returnValue: _i5.Future>.value([]), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future> getSparkUsedCoinsTags( - {required _i2.CryptoCurrency? cryptoCurrency}) => - (super.noSuchMethod( - Invocation.method( - #getSparkUsedCoinsTags, - [], - {#cryptoCurrency: cryptoCurrency}, - ), - returnValue: _i5.Future>.value({}), - ) as _i5.Future>); - @override - _i5.Future clearSharedTransactionCache( + _i6.Future clearSharedTransactionCache( {required _i2.CryptoCurrency? cryptoCurrency}) => (super.noSuchMethod( Invocation.method( @@ -634,16 +630,16 @@ class MockCachedElectrumXClient extends _i1.Mock [], {#cryptoCurrency: cryptoCurrency}, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } /// A class which mocks [TransactionNotificationTracker]. /// /// See the documentation for Mockito's code generation for more information. class MockTransactionNotificationTracker extends _i1.Mock - implements _i7.TransactionNotificationTracker { + implements _i8.TransactionNotificationTracker { MockTransactionNotificationTracker() { _i1.throwOnMissingStub(this); } @@ -651,7 +647,10 @@ class MockTransactionNotificationTracker extends _i1.Mock @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.getter(#walletId), + ), ) as String); @override List get pendings => (super.noSuchMethod( @@ -672,14 +671,14 @@ class MockTransactionNotificationTracker extends _i1.Mock returnValue: false, ) as bool); @override - _i5.Future addNotifiedPending(String? txid) => (super.noSuchMethod( + _i6.Future addNotifiedPending(String? txid) => (super.noSuchMethod( Invocation.method( #addNotifiedPending, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override bool wasNotifiedConfirmed(String? txid) => (super.noSuchMethod( Invocation.method( @@ -689,21 +688,21 @@ class MockTransactionNotificationTracker extends _i1.Mock returnValue: false, ) as bool); @override - _i5.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( + _i6.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( Invocation.method( #addNotifiedConfirmed, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future deleteTransaction(String? txid) => (super.noSuchMethod( + _i6.Future deleteTransaction(String? txid) => (super.noSuchMethod( Invocation.method( #deleteTransaction, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } diff --git a/test/services/coins/bitcoincash/cashtokens_test.dart b/test/services/coins/bitcoincash/cashtokens_test.dart index be8a8b24b..d5e8b390b 100644 --- a/test/services/coins/bitcoincash/cashtokens_test.dart +++ b/test/services/coins/bitcoincash/cashtokens_test.dart @@ -10,17 +10,17 @@ void main() { // Replace "var1" with a hex string containing an output (script pub key) test("testUnwrapSPK", () { // Example Hex format string - String var1 = "76a91463456150b05a67084d795fbce22c8fbbca37697288ac"; + final String var1 = "76a91463456150b05a67084d795fbce22c8fbbca37697288ac"; // Convert the Hex string to Uint8List - Uint8List wrapped_spk = Uint8List.fromList(HEX.decode(var1)); + final Uint8List wrapped_spk = Uint8List.fromList(HEX.decode(var1)); // Call unwrap_spk - ParsedOutput parsedOutput = unwrap_spk(wrapped_spk); + final ParsedOutput parsedOutput = unwrap_spk(wrapped_spk); print("Parsed Output: $parsedOutput"); // Access token_data inside parsedOutput - TokenOutputData? tokenData = parsedOutput.token_data; + final TokenOutputData? tokenData = parsedOutput.token_data; // Check if tokenData is null if (tokenData != null) { diff --git a/test/services/coins/dogecoin/dogecoin_wallet_test.mocks.dart b/test/services/coins/dogecoin/dogecoin_wallet_test.mocks.dart index eb9afea89..03e117e4b 100644 --- a/test/services/coins/dogecoin/dogecoin_wallet_test.mocks.dart +++ b/test/services/coins/dogecoin/dogecoin_wallet_test.mocks.dart @@ -1,16 +1,17 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/services/coins/dogecoin/dogecoin_wallet_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i5; +import 'dart:async' as _i6; import 'package:decimal/decimal.dart' as _i3; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i6; +import 'package:mockito/src/dummies.dart' as _i5; +import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i7; import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i4; import 'package:stackwallet/services/transaction_notification_tracker.dart' - as _i7; + as _i8; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' as _i2; @@ -18,6 +19,8 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -116,7 +119,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { @override String get host => (super.noSuchMethod( Invocation.getter(#host), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.getter(#host), + ), ) as String); @override int get port => (super.noSuchMethod( @@ -129,16 +135,16 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { returnValue: false, ) as bool); @override - _i5.Future closeAdapter() => (super.noSuchMethod( + _i6.Future closeAdapter() => (super.noSuchMethod( Invocation.method( #closeAdapter, [], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future request({ + _i6.Future request({ required String? command, List? args = const [], String? requestID, @@ -157,10 +163,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestTimeout: requestTimeout, }, ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future> batchRequest({ + _i6.Future> batchRequest({ required String? command, required List? args, Duration? requestTimeout = const Duration(seconds: 60), @@ -177,10 +183,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #retries: retries, }, ), - returnValue: _i5.Future>.value([]), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future ping({ + _i6.Future ping({ String? requestID, int? retryCount = 1, }) => @@ -193,10 +199,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #retryCount: retryCount, }, ), - returnValue: _i5.Future.value(false), - ) as _i5.Future); + returnValue: _i6.Future.value(false), + ) as _i6.Future); @override - _i5.Future> getBlockHeadTip({String? requestID}) => + _i6.Future> getBlockHeadTip({String? requestID}) => (super.noSuchMethod( Invocation.method( #getBlockHeadTip, @@ -204,10 +210,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getServerFeatures({String? requestID}) => + _i6.Future> getServerFeatures({String? requestID}) => (super.noSuchMethod( Invocation.method( #getServerFeatures, @@ -215,10 +221,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future broadcastTransaction({ + _i6.Future broadcastTransaction({ required String? rawTx, String? requestID, }) => @@ -231,10 +237,20 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future.value(''), - ) as _i5.Future); + returnValue: _i6.Future.value(_i5.dummyValue( + this, + Invocation.method( + #broadcastTransaction, + [], + { + #rawTx: rawTx, + #requestID: requestID, + }, + ), + )), + ) as _i6.Future); @override - _i5.Future> getBalance({ + _i6.Future> getBalance({ required String? scripthash, String? requestID, }) => @@ -248,10 +264,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future>> getHistory({ + _i6.Future>> getHistory({ required String? scripthash, String? requestID, }) => @@ -264,11 +280,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future>>> getBatchHistory( + _i6.Future>>> getBatchHistory( {required List? args}) => (super.noSuchMethod( Invocation.method( @@ -276,11 +292,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { [], {#args: args}, ), - returnValue: _i5.Future>>>.value( + returnValue: _i6.Future>>>.value( >>[]), - ) as _i5.Future>>>); + ) as _i6.Future>>>); @override - _i5.Future>> getUTXOs({ + _i6.Future>> getUTXOs({ required String? scripthash, String? requestID, }) => @@ -293,11 +309,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future>>> getBatchUTXOs( + _i6.Future>>> getBatchUTXOs( {required List? args}) => (super.noSuchMethod( Invocation.method( @@ -305,11 +321,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { [], {#args: args}, ), - returnValue: _i5.Future>>>.value( + returnValue: _i6.Future>>>.value( >>[]), - ) as _i5.Future>>>); + ) as _i6.Future>>>); @override - _i5.Future> getTransaction({ + _i6.Future> getTransaction({ required String? txHash, bool? verbose = true, String? requestID, @@ -325,10 +341,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getLelantusAnonymitySet({ + _i6.Future> getLelantusAnonymitySet({ String? groupId = r'1', String? blockhash = r'', String? requestID, @@ -344,10 +360,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future getLelantusMintData({ + _i6.Future getLelantusMintData({ dynamic mints, String? requestID, }) => @@ -360,10 +376,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future> getLelantusUsedCoinSerials({ + _i6.Future> getLelantusUsedCoinSerials({ String? requestID, required int? startNumber, }) => @@ -377,20 +393,20 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future getLelantusLatestCoinId({String? requestID}) => + _i6.Future getLelantusLatestCoinId({String? requestID}) => (super.noSuchMethod( Invocation.method( #getLelantusLatestCoinId, [], {#requestID: requestID}, ), - returnValue: _i5.Future.value(0), - ) as _i5.Future); + returnValue: _i6.Future.value(0), + ) as _i6.Future); @override - _i5.Future> getSparkAnonymitySet({ + _i6.Future> getSparkAnonymitySet({ String? coinGroupId = r'1', String? startBlockHash = r'', String? requestID, @@ -406,26 +422,26 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getSparkUsedCoinsTags({ + _i6.Future> getSparkUnhashedUsedCoinsTags({ String? requestID, required int? startNumber, }) => (super.noSuchMethod( Invocation.method( - #getSparkUsedCoinsTags, + #getSparkUnhashedUsedCoinsTags, [], { #requestID: requestID, #startNumber: startNumber, }, ), - returnValue: _i5.Future>.value({}), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future>> getSparkMintMetaData({ + _i6.Future>> getSparkMintMetaData({ String? requestID, required List? sparkCoinHashes, }) => @@ -438,21 +454,21 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #sparkCoinHashes: sparkCoinHashes, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future getSparkLatestCoinId({String? requestID}) => + _i6.Future getSparkLatestCoinId({String? requestID}) => (super.noSuchMethod( Invocation.method( #getSparkLatestCoinId, [], {#requestID: requestID}, ), - returnValue: _i5.Future.value(0), - ) as _i5.Future); + returnValue: _i6.Future.value(0), + ) as _i6.Future); @override - _i5.Future> getFeeRate({String? requestID}) => + _i6.Future> getFeeRate({String? requestID}) => (super.noSuchMethod( Invocation.method( #getFeeRate, @@ -460,10 +476,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future<_i3.Decimal> estimateFee({ + _i6.Future<_i3.Decimal> estimateFee({ String? requestID, required int? blocks, }) => @@ -476,7 +492,7 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #blocks: blocks, }, ), - returnValue: _i5.Future<_i3.Decimal>.value(_FakeDecimal_2( + returnValue: _i6.Future<_i3.Decimal>.value(_FakeDecimal_2( this, Invocation.method( #estimateFee, @@ -487,15 +503,15 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), )), - ) as _i5.Future<_i3.Decimal>); + ) as _i6.Future<_i3.Decimal>); @override - _i5.Future<_i3.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( + _i6.Future<_i3.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( Invocation.method( #relayFee, [], {#requestID: requestID}, ), - returnValue: _i5.Future<_i3.Decimal>.value(_FakeDecimal_2( + returnValue: _i6.Future<_i3.Decimal>.value(_FakeDecimal_2( this, Invocation.method( #relayFee, @@ -503,14 +519,14 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), )), - ) as _i5.Future<_i3.Decimal>); + ) as _i6.Future<_i3.Decimal>); } /// A class which mocks [CachedElectrumXClient]. /// /// See the documentation for Mockito's code generation for more information. class MockCachedElectrumXClient extends _i1.Mock - implements _i6.CachedElectrumXClient { + implements _i7.CachedElectrumXClient { MockCachedElectrumXClient() { _i1.throwOnMissingStub(this); } @@ -524,7 +540,7 @@ class MockCachedElectrumXClient extends _i1.Mock ), ) as _i4.ElectrumXClient); @override - _i5.Future> getAnonymitySet({ + _i6.Future> getAnonymitySet({ required String? groupId, String? blockhash = r'', required _i2.CryptoCurrency? cryptoCurrency, @@ -540,36 +556,21 @@ class MockCachedElectrumXClient extends _i1.Mock }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); - @override - _i5.Future> getSparkAnonymitySet({ - required String? groupId, - String? blockhash = r'', - required _i2.CryptoCurrency? cryptoCurrency, - required bool? useOnlyCacheIfNotEmpty, - }) => - (super.noSuchMethod( - Invocation.method( - #getSparkAnonymitySet, - [], - { - #groupId: groupId, - #blockhash: blockhash, - #cryptoCurrency: cryptoCurrency, - #useOnlyCacheIfNotEmpty: useOnlyCacheIfNotEmpty, - }, - ), - returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override String base64ToHex(String? source) => (super.noSuchMethod( Invocation.method( #base64ToHex, [source], ), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.method( + #base64ToHex, + [source], + ), + ), ) as String); @override String base64ToReverseHex(String? source) => (super.noSuchMethod( @@ -577,10 +578,16 @@ class MockCachedElectrumXClient extends _i1.Mock #base64ToReverseHex, [source], ), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.method( + #base64ToReverseHex, + [source], + ), + ), ) as String); @override - _i5.Future> getTransaction({ + _i6.Future> getTransaction({ required String? txHash, required _i2.CryptoCurrency? cryptoCurrency, bool? verbose = true, @@ -596,10 +603,10 @@ class MockCachedElectrumXClient extends _i1.Mock }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getUsedCoinSerials({ + _i6.Future> getUsedCoinSerials({ required _i2.CryptoCurrency? cryptoCurrency, int? startNumber = 0, }) => @@ -612,21 +619,10 @@ class MockCachedElectrumXClient extends _i1.Mock #startNumber: startNumber, }, ), - returnValue: _i5.Future>.value([]), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future> getSparkUsedCoinsTags( - {required _i2.CryptoCurrency? cryptoCurrency}) => - (super.noSuchMethod( - Invocation.method( - #getSparkUsedCoinsTags, - [], - {#cryptoCurrency: cryptoCurrency}, - ), - returnValue: _i5.Future>.value({}), - ) as _i5.Future>); - @override - _i5.Future clearSharedTransactionCache( + _i6.Future clearSharedTransactionCache( {required _i2.CryptoCurrency? cryptoCurrency}) => (super.noSuchMethod( Invocation.method( @@ -634,16 +630,16 @@ class MockCachedElectrumXClient extends _i1.Mock [], {#cryptoCurrency: cryptoCurrency}, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } /// A class which mocks [TransactionNotificationTracker]. /// /// See the documentation for Mockito's code generation for more information. class MockTransactionNotificationTracker extends _i1.Mock - implements _i7.TransactionNotificationTracker { + implements _i8.TransactionNotificationTracker { MockTransactionNotificationTracker() { _i1.throwOnMissingStub(this); } @@ -651,7 +647,10 @@ class MockTransactionNotificationTracker extends _i1.Mock @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.getter(#walletId), + ), ) as String); @override List get pendings => (super.noSuchMethod( @@ -672,14 +671,14 @@ class MockTransactionNotificationTracker extends _i1.Mock returnValue: false, ) as bool); @override - _i5.Future addNotifiedPending(String? txid) => (super.noSuchMethod( + _i6.Future addNotifiedPending(String? txid) => (super.noSuchMethod( Invocation.method( #addNotifiedPending, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override bool wasNotifiedConfirmed(String? txid) => (super.noSuchMethod( Invocation.method( @@ -689,21 +688,21 @@ class MockTransactionNotificationTracker extends _i1.Mock returnValue: false, ) as bool); @override - _i5.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( + _i6.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( Invocation.method( #addNotifiedConfirmed, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future deleteTransaction(String? txid) => (super.noSuchMethod( + _i6.Future deleteTransaction(String? txid) => (super.noSuchMethod( Invocation.method( #deleteTransaction, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } diff --git a/test/services/coins/firo/sample_data/transaction_data_samples.dart b/test/services/coins/firo/sample_data/transaction_data_samples.dart index 07108ece0..6e22d9b2f 100644 --- a/test/services/coins/firo/sample_data/transaction_data_samples.dart +++ b/test/services/coins/firo/sample_data/transaction_data_samples.dart @@ -2506,7 +2506,7 @@ final jsonTransactions = [ ]; Map get transactionDataMap { - Map result = {}; + final Map result = {}; for (final tx in jsonTransactions) { result[tx["txid"] as String] = Transaction.fromJson(tx); } diff --git a/test/services/coins/namecoin/namecoin_wallet_test.mocks.dart b/test/services/coins/namecoin/namecoin_wallet_test.mocks.dart index a8a5fb3c2..4e57a7657 100644 --- a/test/services/coins/namecoin/namecoin_wallet_test.mocks.dart +++ b/test/services/coins/namecoin/namecoin_wallet_test.mocks.dart @@ -1,16 +1,17 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/services/coins/namecoin/namecoin_wallet_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i5; +import 'dart:async' as _i6; import 'package:decimal/decimal.dart' as _i3; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i6; +import 'package:mockito/src/dummies.dart' as _i5; +import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i7; import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i4; import 'package:stackwallet/services/transaction_notification_tracker.dart' - as _i7; + as _i8; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' as _i2; @@ -18,6 +19,8 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -116,7 +119,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { @override String get host => (super.noSuchMethod( Invocation.getter(#host), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.getter(#host), + ), ) as String); @override int get port => (super.noSuchMethod( @@ -129,16 +135,16 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { returnValue: false, ) as bool); @override - _i5.Future closeAdapter() => (super.noSuchMethod( + _i6.Future closeAdapter() => (super.noSuchMethod( Invocation.method( #closeAdapter, [], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future request({ + _i6.Future request({ required String? command, List? args = const [], String? requestID, @@ -157,10 +163,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestTimeout: requestTimeout, }, ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future> batchRequest({ + _i6.Future> batchRequest({ required String? command, required List? args, Duration? requestTimeout = const Duration(seconds: 60), @@ -177,10 +183,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #retries: retries, }, ), - returnValue: _i5.Future>.value([]), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future ping({ + _i6.Future ping({ String? requestID, int? retryCount = 1, }) => @@ -193,10 +199,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #retryCount: retryCount, }, ), - returnValue: _i5.Future.value(false), - ) as _i5.Future); + returnValue: _i6.Future.value(false), + ) as _i6.Future); @override - _i5.Future> getBlockHeadTip({String? requestID}) => + _i6.Future> getBlockHeadTip({String? requestID}) => (super.noSuchMethod( Invocation.method( #getBlockHeadTip, @@ -204,10 +210,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getServerFeatures({String? requestID}) => + _i6.Future> getServerFeatures({String? requestID}) => (super.noSuchMethod( Invocation.method( #getServerFeatures, @@ -215,10 +221,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future broadcastTransaction({ + _i6.Future broadcastTransaction({ required String? rawTx, String? requestID, }) => @@ -231,10 +237,20 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future.value(''), - ) as _i5.Future); + returnValue: _i6.Future.value(_i5.dummyValue( + this, + Invocation.method( + #broadcastTransaction, + [], + { + #rawTx: rawTx, + #requestID: requestID, + }, + ), + )), + ) as _i6.Future); @override - _i5.Future> getBalance({ + _i6.Future> getBalance({ required String? scripthash, String? requestID, }) => @@ -248,10 +264,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future>> getHistory({ + _i6.Future>> getHistory({ required String? scripthash, String? requestID, }) => @@ -264,11 +280,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future>>> getBatchHistory( + _i6.Future>>> getBatchHistory( {required List? args}) => (super.noSuchMethod( Invocation.method( @@ -276,11 +292,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { [], {#args: args}, ), - returnValue: _i5.Future>>>.value( + returnValue: _i6.Future>>>.value( >>[]), - ) as _i5.Future>>>); + ) as _i6.Future>>>); @override - _i5.Future>> getUTXOs({ + _i6.Future>> getUTXOs({ required String? scripthash, String? requestID, }) => @@ -293,11 +309,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future>>> getBatchUTXOs( + _i6.Future>>> getBatchUTXOs( {required List? args}) => (super.noSuchMethod( Invocation.method( @@ -305,11 +321,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { [], {#args: args}, ), - returnValue: _i5.Future>>>.value( + returnValue: _i6.Future>>>.value( >>[]), - ) as _i5.Future>>>); + ) as _i6.Future>>>); @override - _i5.Future> getTransaction({ + _i6.Future> getTransaction({ required String? txHash, bool? verbose = true, String? requestID, @@ -325,10 +341,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getLelantusAnonymitySet({ + _i6.Future> getLelantusAnonymitySet({ String? groupId = r'1', String? blockhash = r'', String? requestID, @@ -344,10 +360,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future getLelantusMintData({ + _i6.Future getLelantusMintData({ dynamic mints, String? requestID, }) => @@ -360,10 +376,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future> getLelantusUsedCoinSerials({ + _i6.Future> getLelantusUsedCoinSerials({ String? requestID, required int? startNumber, }) => @@ -377,20 +393,20 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future getLelantusLatestCoinId({String? requestID}) => + _i6.Future getLelantusLatestCoinId({String? requestID}) => (super.noSuchMethod( Invocation.method( #getLelantusLatestCoinId, [], {#requestID: requestID}, ), - returnValue: _i5.Future.value(0), - ) as _i5.Future); + returnValue: _i6.Future.value(0), + ) as _i6.Future); @override - _i5.Future> getSparkAnonymitySet({ + _i6.Future> getSparkAnonymitySet({ String? coinGroupId = r'1', String? startBlockHash = r'', String? requestID, @@ -406,26 +422,26 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getSparkUsedCoinsTags({ + _i6.Future> getSparkUnhashedUsedCoinsTags({ String? requestID, required int? startNumber, }) => (super.noSuchMethod( Invocation.method( - #getSparkUsedCoinsTags, + #getSparkUnhashedUsedCoinsTags, [], { #requestID: requestID, #startNumber: startNumber, }, ), - returnValue: _i5.Future>.value({}), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future>> getSparkMintMetaData({ + _i6.Future>> getSparkMintMetaData({ String? requestID, required List? sparkCoinHashes, }) => @@ -438,21 +454,21 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #sparkCoinHashes: sparkCoinHashes, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future getSparkLatestCoinId({String? requestID}) => + _i6.Future getSparkLatestCoinId({String? requestID}) => (super.noSuchMethod( Invocation.method( #getSparkLatestCoinId, [], {#requestID: requestID}, ), - returnValue: _i5.Future.value(0), - ) as _i5.Future); + returnValue: _i6.Future.value(0), + ) as _i6.Future); @override - _i5.Future> getFeeRate({String? requestID}) => + _i6.Future> getFeeRate({String? requestID}) => (super.noSuchMethod( Invocation.method( #getFeeRate, @@ -460,10 +476,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future<_i3.Decimal> estimateFee({ + _i6.Future<_i3.Decimal> estimateFee({ String? requestID, required int? blocks, }) => @@ -476,7 +492,7 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #blocks: blocks, }, ), - returnValue: _i5.Future<_i3.Decimal>.value(_FakeDecimal_2( + returnValue: _i6.Future<_i3.Decimal>.value(_FakeDecimal_2( this, Invocation.method( #estimateFee, @@ -487,15 +503,15 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), )), - ) as _i5.Future<_i3.Decimal>); + ) as _i6.Future<_i3.Decimal>); @override - _i5.Future<_i3.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( + _i6.Future<_i3.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( Invocation.method( #relayFee, [], {#requestID: requestID}, ), - returnValue: _i5.Future<_i3.Decimal>.value(_FakeDecimal_2( + returnValue: _i6.Future<_i3.Decimal>.value(_FakeDecimal_2( this, Invocation.method( #relayFee, @@ -503,14 +519,14 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), )), - ) as _i5.Future<_i3.Decimal>); + ) as _i6.Future<_i3.Decimal>); } /// A class which mocks [CachedElectrumXClient]. /// /// See the documentation for Mockito's code generation for more information. class MockCachedElectrumXClient extends _i1.Mock - implements _i6.CachedElectrumXClient { + implements _i7.CachedElectrumXClient { MockCachedElectrumXClient() { _i1.throwOnMissingStub(this); } @@ -524,7 +540,7 @@ class MockCachedElectrumXClient extends _i1.Mock ), ) as _i4.ElectrumXClient); @override - _i5.Future> getAnonymitySet({ + _i6.Future> getAnonymitySet({ required String? groupId, String? blockhash = r'', required _i2.CryptoCurrency? cryptoCurrency, @@ -540,36 +556,21 @@ class MockCachedElectrumXClient extends _i1.Mock }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); - @override - _i5.Future> getSparkAnonymitySet({ - required String? groupId, - String? blockhash = r'', - required _i2.CryptoCurrency? cryptoCurrency, - required bool? useOnlyCacheIfNotEmpty, - }) => - (super.noSuchMethod( - Invocation.method( - #getSparkAnonymitySet, - [], - { - #groupId: groupId, - #blockhash: blockhash, - #cryptoCurrency: cryptoCurrency, - #useOnlyCacheIfNotEmpty: useOnlyCacheIfNotEmpty, - }, - ), - returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override String base64ToHex(String? source) => (super.noSuchMethod( Invocation.method( #base64ToHex, [source], ), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.method( + #base64ToHex, + [source], + ), + ), ) as String); @override String base64ToReverseHex(String? source) => (super.noSuchMethod( @@ -577,10 +578,16 @@ class MockCachedElectrumXClient extends _i1.Mock #base64ToReverseHex, [source], ), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.method( + #base64ToReverseHex, + [source], + ), + ), ) as String); @override - _i5.Future> getTransaction({ + _i6.Future> getTransaction({ required String? txHash, required _i2.CryptoCurrency? cryptoCurrency, bool? verbose = true, @@ -596,10 +603,10 @@ class MockCachedElectrumXClient extends _i1.Mock }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getUsedCoinSerials({ + _i6.Future> getUsedCoinSerials({ required _i2.CryptoCurrency? cryptoCurrency, int? startNumber = 0, }) => @@ -612,21 +619,10 @@ class MockCachedElectrumXClient extends _i1.Mock #startNumber: startNumber, }, ), - returnValue: _i5.Future>.value([]), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future> getSparkUsedCoinsTags( - {required _i2.CryptoCurrency? cryptoCurrency}) => - (super.noSuchMethod( - Invocation.method( - #getSparkUsedCoinsTags, - [], - {#cryptoCurrency: cryptoCurrency}, - ), - returnValue: _i5.Future>.value({}), - ) as _i5.Future>); - @override - _i5.Future clearSharedTransactionCache( + _i6.Future clearSharedTransactionCache( {required _i2.CryptoCurrency? cryptoCurrency}) => (super.noSuchMethod( Invocation.method( @@ -634,16 +630,16 @@ class MockCachedElectrumXClient extends _i1.Mock [], {#cryptoCurrency: cryptoCurrency}, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } /// A class which mocks [TransactionNotificationTracker]. /// /// See the documentation for Mockito's code generation for more information. class MockTransactionNotificationTracker extends _i1.Mock - implements _i7.TransactionNotificationTracker { + implements _i8.TransactionNotificationTracker { MockTransactionNotificationTracker() { _i1.throwOnMissingStub(this); } @@ -651,7 +647,10 @@ class MockTransactionNotificationTracker extends _i1.Mock @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.getter(#walletId), + ), ) as String); @override List get pendings => (super.noSuchMethod( @@ -672,14 +671,14 @@ class MockTransactionNotificationTracker extends _i1.Mock returnValue: false, ) as bool); @override - _i5.Future addNotifiedPending(String? txid) => (super.noSuchMethod( + _i6.Future addNotifiedPending(String? txid) => (super.noSuchMethod( Invocation.method( #addNotifiedPending, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override bool wasNotifiedConfirmed(String? txid) => (super.noSuchMethod( Invocation.method( @@ -689,21 +688,21 @@ class MockTransactionNotificationTracker extends _i1.Mock returnValue: false, ) as bool); @override - _i5.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( + _i6.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( Invocation.method( #addNotifiedConfirmed, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future deleteTransaction(String? txid) => (super.noSuchMethod( + _i6.Future deleteTransaction(String? txid) => (super.noSuchMethod( Invocation.method( #deleteTransaction, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } diff --git a/test/services/coins/particl/particl_wallet_test.mocks.dart b/test/services/coins/particl/particl_wallet_test.mocks.dart index aac19401c..9cb9db169 100644 --- a/test/services/coins/particl/particl_wallet_test.mocks.dart +++ b/test/services/coins/particl/particl_wallet_test.mocks.dart @@ -1,16 +1,17 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/services/coins/particl/particl_wallet_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i5; +import 'dart:async' as _i6; import 'package:decimal/decimal.dart' as _i3; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i6; +import 'package:mockito/src/dummies.dart' as _i5; +import 'package:stackwallet/electrumx_rpc/cached_electrumx_client.dart' as _i7; import 'package:stackwallet/electrumx_rpc/electrumx_client.dart' as _i4; import 'package:stackwallet/services/transaction_notification_tracker.dart' - as _i7; + as _i8; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' as _i2; @@ -18,6 +19,8 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -116,7 +119,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { @override String get host => (super.noSuchMethod( Invocation.getter(#host), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.getter(#host), + ), ) as String); @override int get port => (super.noSuchMethod( @@ -129,16 +135,16 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { returnValue: false, ) as bool); @override - _i5.Future closeAdapter() => (super.noSuchMethod( + _i6.Future closeAdapter() => (super.noSuchMethod( Invocation.method( #closeAdapter, [], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future request({ + _i6.Future request({ required String? command, List? args = const [], String? requestID, @@ -157,10 +163,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestTimeout: requestTimeout, }, ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future> batchRequest({ + _i6.Future> batchRequest({ required String? command, required List? args, Duration? requestTimeout = const Duration(seconds: 60), @@ -177,10 +183,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #retries: retries, }, ), - returnValue: _i5.Future>.value([]), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future ping({ + _i6.Future ping({ String? requestID, int? retryCount = 1, }) => @@ -193,10 +199,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #retryCount: retryCount, }, ), - returnValue: _i5.Future.value(false), - ) as _i5.Future); + returnValue: _i6.Future.value(false), + ) as _i6.Future); @override - _i5.Future> getBlockHeadTip({String? requestID}) => + _i6.Future> getBlockHeadTip({String? requestID}) => (super.noSuchMethod( Invocation.method( #getBlockHeadTip, @@ -204,10 +210,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getServerFeatures({String? requestID}) => + _i6.Future> getServerFeatures({String? requestID}) => (super.noSuchMethod( Invocation.method( #getServerFeatures, @@ -215,10 +221,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future broadcastTransaction({ + _i6.Future broadcastTransaction({ required String? rawTx, String? requestID, }) => @@ -231,10 +237,20 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future.value(''), - ) as _i5.Future); + returnValue: _i6.Future.value(_i5.dummyValue( + this, + Invocation.method( + #broadcastTransaction, + [], + { + #rawTx: rawTx, + #requestID: requestID, + }, + ), + )), + ) as _i6.Future); @override - _i5.Future> getBalance({ + _i6.Future> getBalance({ required String? scripthash, String? requestID, }) => @@ -248,10 +264,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future>> getHistory({ + _i6.Future>> getHistory({ required String? scripthash, String? requestID, }) => @@ -264,11 +280,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future>>> getBatchHistory( + _i6.Future>>> getBatchHistory( {required List? args}) => (super.noSuchMethod( Invocation.method( @@ -276,11 +292,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { [], {#args: args}, ), - returnValue: _i5.Future>>>.value( + returnValue: _i6.Future>>>.value( >>[]), - ) as _i5.Future>>>); + ) as _i6.Future>>>); @override - _i5.Future>> getUTXOs({ + _i6.Future>> getUTXOs({ required String? scripthash, String? requestID, }) => @@ -293,11 +309,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future>>> getBatchUTXOs( + _i6.Future>>> getBatchUTXOs( {required List? args}) => (super.noSuchMethod( Invocation.method( @@ -305,11 +321,11 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { [], {#args: args}, ), - returnValue: _i5.Future>>>.value( + returnValue: _i6.Future>>>.value( >>[]), - ) as _i5.Future>>>); + ) as _i6.Future>>>); @override - _i5.Future> getTransaction({ + _i6.Future> getTransaction({ required String? txHash, bool? verbose = true, String? requestID, @@ -325,10 +341,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getLelantusAnonymitySet({ + _i6.Future> getLelantusAnonymitySet({ String? groupId = r'1', String? blockhash = r'', String? requestID, @@ -344,10 +360,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future getLelantusMintData({ + _i6.Future getLelantusMintData({ dynamic mints, String? requestID, }) => @@ -360,10 +376,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #requestID: requestID, }, ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future> getLelantusUsedCoinSerials({ + _i6.Future> getLelantusUsedCoinSerials({ String? requestID, required int? startNumber, }) => @@ -377,20 +393,20 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future getLelantusLatestCoinId({String? requestID}) => + _i6.Future getLelantusLatestCoinId({String? requestID}) => (super.noSuchMethod( Invocation.method( #getLelantusLatestCoinId, [], {#requestID: requestID}, ), - returnValue: _i5.Future.value(0), - ) as _i5.Future); + returnValue: _i6.Future.value(0), + ) as _i6.Future); @override - _i5.Future> getSparkAnonymitySet({ + _i6.Future> getSparkAnonymitySet({ String? coinGroupId = r'1', String? startBlockHash = r'', String? requestID, @@ -406,26 +422,26 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getSparkUsedCoinsTags({ + _i6.Future> getSparkUnhashedUsedCoinsTags({ String? requestID, required int? startNumber, }) => (super.noSuchMethod( Invocation.method( - #getSparkUsedCoinsTags, + #getSparkUnhashedUsedCoinsTags, [], { #requestID: requestID, #startNumber: startNumber, }, ), - returnValue: _i5.Future>.value({}), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future>> getSparkMintMetaData({ + _i6.Future>> getSparkMintMetaData({ String? requestID, required List? sparkCoinHashes, }) => @@ -438,21 +454,21 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #sparkCoinHashes: sparkCoinHashes, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i6.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i6.Future>>); @override - _i5.Future getSparkLatestCoinId({String? requestID}) => + _i6.Future getSparkLatestCoinId({String? requestID}) => (super.noSuchMethod( Invocation.method( #getSparkLatestCoinId, [], {#requestID: requestID}, ), - returnValue: _i5.Future.value(0), - ) as _i5.Future); + returnValue: _i6.Future.value(0), + ) as _i6.Future); @override - _i5.Future> getFeeRate({String? requestID}) => + _i6.Future> getFeeRate({String? requestID}) => (super.noSuchMethod( Invocation.method( #getFeeRate, @@ -460,10 +476,10 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future<_i3.Decimal> estimateFee({ + _i6.Future<_i3.Decimal> estimateFee({ String? requestID, required int? blocks, }) => @@ -476,7 +492,7 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { #blocks: blocks, }, ), - returnValue: _i5.Future<_i3.Decimal>.value(_FakeDecimal_2( + returnValue: _i6.Future<_i3.Decimal>.value(_FakeDecimal_2( this, Invocation.method( #estimateFee, @@ -487,15 +503,15 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { }, ), )), - ) as _i5.Future<_i3.Decimal>); + ) as _i6.Future<_i3.Decimal>); @override - _i5.Future<_i3.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( + _i6.Future<_i3.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( Invocation.method( #relayFee, [], {#requestID: requestID}, ), - returnValue: _i5.Future<_i3.Decimal>.value(_FakeDecimal_2( + returnValue: _i6.Future<_i3.Decimal>.value(_FakeDecimal_2( this, Invocation.method( #relayFee, @@ -503,14 +519,14 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { {#requestID: requestID}, ), )), - ) as _i5.Future<_i3.Decimal>); + ) as _i6.Future<_i3.Decimal>); } /// A class which mocks [CachedElectrumXClient]. /// /// See the documentation for Mockito's code generation for more information. class MockCachedElectrumXClient extends _i1.Mock - implements _i6.CachedElectrumXClient { + implements _i7.CachedElectrumXClient { MockCachedElectrumXClient() { _i1.throwOnMissingStub(this); } @@ -524,7 +540,7 @@ class MockCachedElectrumXClient extends _i1.Mock ), ) as _i4.ElectrumXClient); @override - _i5.Future> getAnonymitySet({ + _i6.Future> getAnonymitySet({ required String? groupId, String? blockhash = r'', required _i2.CryptoCurrency? cryptoCurrency, @@ -540,36 +556,21 @@ class MockCachedElectrumXClient extends _i1.Mock }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); - @override - _i5.Future> getSparkAnonymitySet({ - required String? groupId, - String? blockhash = r'', - required _i2.CryptoCurrency? cryptoCurrency, - required bool? useOnlyCacheIfNotEmpty, - }) => - (super.noSuchMethod( - Invocation.method( - #getSparkAnonymitySet, - [], - { - #groupId: groupId, - #blockhash: blockhash, - #cryptoCurrency: cryptoCurrency, - #useOnlyCacheIfNotEmpty: useOnlyCacheIfNotEmpty, - }, - ), - returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override String base64ToHex(String? source) => (super.noSuchMethod( Invocation.method( #base64ToHex, [source], ), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.method( + #base64ToHex, + [source], + ), + ), ) as String); @override String base64ToReverseHex(String? source) => (super.noSuchMethod( @@ -577,10 +578,16 @@ class MockCachedElectrumXClient extends _i1.Mock #base64ToReverseHex, [source], ), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.method( + #base64ToReverseHex, + [source], + ), + ), ) as String); @override - _i5.Future> getTransaction({ + _i6.Future> getTransaction({ required String? txHash, required _i2.CryptoCurrency? cryptoCurrency, bool? verbose = true, @@ -596,10 +603,10 @@ class MockCachedElectrumXClient extends _i1.Mock }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i6.Future>.value({}), + ) as _i6.Future>); @override - _i5.Future> getUsedCoinSerials({ + _i6.Future> getUsedCoinSerials({ required _i2.CryptoCurrency? cryptoCurrency, int? startNumber = 0, }) => @@ -612,21 +619,10 @@ class MockCachedElectrumXClient extends _i1.Mock #startNumber: startNumber, }, ), - returnValue: _i5.Future>.value([]), - ) as _i5.Future>); + returnValue: _i6.Future>.value([]), + ) as _i6.Future>); @override - _i5.Future> getSparkUsedCoinsTags( - {required _i2.CryptoCurrency? cryptoCurrency}) => - (super.noSuchMethod( - Invocation.method( - #getSparkUsedCoinsTags, - [], - {#cryptoCurrency: cryptoCurrency}, - ), - returnValue: _i5.Future>.value({}), - ) as _i5.Future>); - @override - _i5.Future clearSharedTransactionCache( + _i6.Future clearSharedTransactionCache( {required _i2.CryptoCurrency? cryptoCurrency}) => (super.noSuchMethod( Invocation.method( @@ -634,16 +630,16 @@ class MockCachedElectrumXClient extends _i1.Mock [], {#cryptoCurrency: cryptoCurrency}, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } /// A class which mocks [TransactionNotificationTracker]. /// /// See the documentation for Mockito's code generation for more information. class MockTransactionNotificationTracker extends _i1.Mock - implements _i7.TransactionNotificationTracker { + implements _i8.TransactionNotificationTracker { MockTransactionNotificationTracker() { _i1.throwOnMissingStub(this); } @@ -651,7 +647,10 @@ class MockTransactionNotificationTracker extends _i1.Mock @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), - returnValue: '', + returnValue: _i5.dummyValue( + this, + Invocation.getter(#walletId), + ), ) as String); @override List get pendings => (super.noSuchMethod( @@ -672,14 +671,14 @@ class MockTransactionNotificationTracker extends _i1.Mock returnValue: false, ) as bool); @override - _i5.Future addNotifiedPending(String? txid) => (super.noSuchMethod( + _i6.Future addNotifiedPending(String? txid) => (super.noSuchMethod( Invocation.method( #addNotifiedPending, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override bool wasNotifiedConfirmed(String? txid) => (super.noSuchMethod( Invocation.method( @@ -689,21 +688,21 @@ class MockTransactionNotificationTracker extends _i1.Mock returnValue: false, ) as bool); @override - _i5.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( + _i6.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( Invocation.method( #addNotifiedConfirmed, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); @override - _i5.Future deleteTransaction(String? txid) => (super.noSuchMethod( + _i6.Future deleteTransaction(String? txid) => (super.noSuchMethod( Invocation.method( #deleteTransaction, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); } diff --git a/test/utilities/amount/amount_unit_test.dart b/test/utilities/amount/amount_unit_test.dart index e4ecb33dd..96a708702 100644 --- a/test/utilities/amount/amount_unit_test.dart +++ b/test/utilities/amount/amount_unit_test.dart @@ -2,8 +2,6 @@ import 'package:decimal/decimal.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/amount/amount_unit.dart'; -import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin.dart'; -import 'package:stackwallet/wallets/crypto_currency/coins/ethereum.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; void main() { diff --git a/test/utilities/extensions/list_test.dart b/test/utilities/extensions/list_test.dart new file mode 100644 index 000000000..594328034 --- /dev/null +++ b/test/utilities/extensions/list_test.dart @@ -0,0 +1,33 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:stackwallet/utilities/extensions/extensions.dart'; + +void main() { + test("Empty list", () { + final List list = []; + expect( + list.chunked(chunkSize: 3).isEmpty, + true, + ); + }); + + test("No remainder", () { + final List list = [0, 1, 2, 3, 4, 5, 6, 7, 8]; + final chunked = list.chunked(chunkSize: 3); + expect(chunked.length == 3, true); + expect( + chunked.map((e) => e.length == 3).reduce((v, e) => v && e), + true, + ); + }); + + test("Some remainder", () { + final List list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + final chunked = list.chunked(chunkSize: 3); + expect(chunked.length == 4, true); + expect(chunked.last.length == 1, true); + expect( + chunked.map((e) => e.length == 3).reduce((v, e) => v && e), + false, + ); + }); +} diff --git a/test/widget_tests/address_book_card_test.dart b/test/widget_tests/address_book_card_test.dart index 674a259af..36199554f 100644 --- a/test/widget_tests/address_book_card_test.dart +++ b/test/widget_tests/address_book_card_test.dart @@ -12,7 +12,6 @@ import 'package:stackwallet/providers/global/address_book_service_provider.dart' import 'package:stackwallet/services/address_book_service.dart'; import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/util.dart'; -import 'package:stackwallet/wallets/crypto_currency/coins/bitcoincash.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/widgets/address_book_card.dart'; diff --git a/test/widget_tests/address_book_card_test.mocks.dart b/test/widget_tests/address_book_card_test.mocks.dart index b24ff6ed7..cfb056577 100644 --- a/test/widget_tests/address_book_card_test.mocks.dart +++ b/test/widget_tests/address_book_card_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/widget_tests/address_book_card_test.dart. // Do not manually edit this file. @@ -14,6 +14,8 @@ import 'package:stackwallet/services/address_book_service.dart' as _i3; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors diff --git a/test/widget_tests/custom_buttons/favorite_toggle_test.mocks.dart b/test/widget_tests/custom_buttons/favorite_toggle_test.mocks.dart index 20727e854..9463dccb8 100644 --- a/test/widget_tests/custom_buttons/favorite_toggle_test.mocks.dart +++ b/test/widget_tests/custom_buttons/favorite_toggle_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/widget_tests/custom_buttons/favorite_toggle_test.dart. // Do not manually edit this file. @@ -16,6 +16,8 @@ import 'package:stackwallet/themes/theme_service.dart' as _i4; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors diff --git a/test/widget_tests/custom_loading_overlay_test.mocks.dart b/test/widget_tests/custom_loading_overlay_test.mocks.dart index 142052fa2..6848da7ee 100644 --- a/test/widget_tests/custom_loading_overlay_test.mocks.dart +++ b/test/widget_tests/custom_loading_overlay_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/widget_tests/custom_loading_overlay_test.dart. // Do not manually edit this file. @@ -16,6 +16,8 @@ import 'package:stackwallet/themes/theme_service.dart' as _i4; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors diff --git a/test/widget_tests/custom_pin_put_test.dart b/test/widget_tests/custom_pin_put_test.dart index 1b3c1eee3..473731639 100644 --- a/test/widget_tests/custom_pin_put_test.dart +++ b/test/widget_tests/custom_pin_put_test.dart @@ -32,7 +32,7 @@ class PinWidgetState extends State { @override Widget build(BuildContext context) { - bool submittedPinMatches = false; + final bool submittedPinMatches = false; return CustomPinPut( fieldsCount: pinCount, diff --git a/test/widget_tests/desktop/desktop_scaffold_test.mocks.dart b/test/widget_tests/desktop/desktop_scaffold_test.mocks.dart index 8507ace66..046da5ebf 100644 --- a/test/widget_tests/desktop/desktop_scaffold_test.mocks.dart +++ b/test/widget_tests/desktop/desktop_scaffold_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/widget_tests/desktop/desktop_scaffold_test.dart. // Do not manually edit this file. @@ -16,6 +16,8 @@ import 'package:stackwallet/themes/theme_service.dart' as _i4; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors diff --git a/test/widget_tests/managed_favorite_test.dart b/test/widget_tests/managed_favorite_test.dart index 0d60b87c9..5298f4498 100644 --- a/test/widget_tests/managed_favorite_test.dart +++ b/test/widget_tests/managed_favorite_test.dart @@ -14,14 +14,17 @@ Amount _a(int i) => Amount.fromDecimal( fractionDigits: 8, ); -@GenerateMocks([ - Wallets, - ThemeService, - Prefs, - LocaleService -], customMocks: [ - MockSpec(returnNullOnMissingStub: true), -]) +@GenerateMocks( + [ + Wallets, + ThemeService, + Prefs, + LocaleService, + ], + customMocks: [ + MockSpec(), + ], +) void main() { // testWidgets("Test wallet info row displays correctly", (widgetTester) async { // final wallets = MockWallets(); diff --git a/test/widget_tests/managed_favorite_test.mocks.dart b/test/widget_tests/managed_favorite_test.mocks.dart index ce01550b6..dad98a259 100644 --- a/test/widget_tests/managed_favorite_test.mocks.dart +++ b/test/widget_tests/managed_favorite_test.mocks.dart @@ -1,23 +1,24 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/widget_tests/managed_favorite_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i10; import 'dart:typed_data' as _i15; -import 'dart:ui' as _i19; +import 'dart:ui' as _i20; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i17; import 'package:stackwallet/db/isar/main_db.dart' as _i3; import 'package:stackwallet/models/isar/stack_theme.dart' as _i14; -import 'package:stackwallet/models/node_model.dart' as _i21; +import 'package:stackwallet/models/node_model.dart' as _i22; import 'package:stackwallet/networking/http.dart' as _i6; -import 'package:stackwallet/services/locale_service.dart' as _i20; +import 'package:stackwallet/services/locale_service.dart' as _i21; import 'package:stackwallet/services/node_service.dart' as _i2; import 'package:stackwallet/services/wallets.dart' as _i9; import 'package:stackwallet/themes/theme_service.dart' as _i13; -import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i18; -import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i17; +import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i19; +import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i18; import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i16; import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' as _i8; @@ -33,6 +34,8 @@ import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/cash_fusion_i // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -437,7 +440,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get language => (super.noSuchMethod( Invocation.getter(#language), - returnValue: '', + returnValue: _i17.dummyValue( + this, + Invocation.getter(#language), + ), ) as String); @override set language(String? newLanguage) => super.noSuchMethod( @@ -450,7 +456,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get currency => (super.noSuchMethod( Invocation.getter(#currency), - returnValue: '', + returnValue: _i17.dummyValue( + this, + Invocation.getter(#currency), + ), ) as String); @override set currency(String? newCurrency) => super.noSuchMethod( @@ -560,12 +569,12 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: null, ); @override - _i17.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( + _i18.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( Invocation.getter(#backupFrequencyType), - returnValue: _i17.BackupFrequencyType.everyTenMinutes, - ) as _i17.BackupFrequencyType); + returnValue: _i18.BackupFrequencyType.everyTenMinutes, + ) as _i18.BackupFrequencyType); @override - set backupFrequencyType(_i17.BackupFrequencyType? backupFrequencyType) => + set backupFrequencyType(_i18.BackupFrequencyType? backupFrequencyType) => super.noSuchMethod( Invocation.setter( #backupFrequencyType, @@ -659,7 +668,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get themeId => (super.noSuchMethod( Invocation.getter(#themeId), - returnValue: '', + returnValue: _i17.dummyValue( + this, + Invocation.getter(#themeId), + ), ) as String); @override set themeId(String? themeId) => super.noSuchMethod( @@ -672,7 +684,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get systemBrightnessLightThemeId => (super.noSuchMethod( Invocation.getter(#systemBrightnessLightThemeId), - returnValue: '', + returnValue: _i17.dummyValue( + this, + Invocation.getter(#systemBrightnessLightThemeId), + ), ) as String); @override set systemBrightnessLightThemeId(String? systemBrightnessLightThemeId) => @@ -686,7 +701,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get systemBrightnessDarkThemeId => (super.noSuchMethod( Invocation.getter(#systemBrightnessDarkThemeId), - returnValue: '', + returnValue: _i17.dummyValue( + this, + Invocation.getter(#systemBrightnessDarkThemeId), + ), ) as String); @override set systemBrightnessDarkThemeId(String? systemBrightnessDarkThemeId) => @@ -760,17 +778,17 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override - _i18.AmountUnit amountUnit(_i4.CryptoCurrency? coin) => (super.noSuchMethod( + _i19.AmountUnit amountUnit(_i4.CryptoCurrency? coin) => (super.noSuchMethod( Invocation.method( #amountUnit, [coin], ), - returnValue: _i18.AmountUnit.normal, - ) as _i18.AmountUnit); + returnValue: _i19.AmountUnit.normal, + ) as _i19.AmountUnit); @override void updateAmountUnit({ required _i4.CryptoCurrency? coin, - required _i18.AmountUnit? amountUnit, + required _i19.AmountUnit? amountUnit, }) => super.noSuchMethod( Invocation.method( @@ -838,7 +856,7 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: null, ); @override - void addListener(_i19.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i20.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -846,7 +864,7 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: null, ); @override - void removeListener(_i19.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -874,7 +892,7 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i20.LocaleService { +class MockLocaleService extends _i1.Mock implements _i21.LocaleService { MockLocaleService() { _i1.throwOnMissingStub(this); } @@ -882,7 +900,10 @@ class MockLocaleService extends _i1.Mock implements _i20.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), - returnValue: '', + returnValue: _i17.dummyValue( + this, + Invocation.getter(#locale), + ), ) as String); @override bool get hasListeners => (super.noSuchMethod( @@ -900,7 +921,7 @@ class MockLocaleService extends _i1.Mock implements _i20.LocaleService { returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override - void addListener(_i19.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i20.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -908,7 +929,7 @@ class MockLocaleService extends _i1.Mock implements _i20.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i19.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -937,6 +958,10 @@ class MockLocaleService extends _i1.Mock implements _i20.LocaleService { /// /// See the documentation for Mockito's code generation for more information. class MockNodeService extends _i1.Mock implements _i2.NodeService { + MockNodeService() { + _i1.throwOnMissingStub(this); + } + @override _i8.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), @@ -946,15 +971,15 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { ), ) as _i8.SecureStorageInterface); @override - List<_i21.NodeModel> get primaryNodes => (super.noSuchMethod( + List<_i22.NodeModel> get primaryNodes => (super.noSuchMethod( Invocation.getter(#primaryNodes), - returnValue: <_i21.NodeModel>[], - ) as List<_i21.NodeModel>); + returnValue: <_i22.NodeModel>[], + ) as List<_i22.NodeModel>); @override - List<_i21.NodeModel> get nodes => (super.noSuchMethod( + List<_i22.NodeModel> get nodes => (super.noSuchMethod( Invocation.getter(#nodes), - returnValue: <_i21.NodeModel>[], - ) as List<_i21.NodeModel>); + returnValue: <_i22.NodeModel>[], + ) as List<_i22.NodeModel>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), @@ -972,7 +997,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { @override _i10.Future setPrimaryNodeFor({ required _i4.CryptoCurrency? coin, - required _i21.NodeModel? node, + required _i22.NodeModel? node, bool? shouldNotifyListeners = false, }) => (super.noSuchMethod( @@ -989,30 +1014,30 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override - _i21.NodeModel? getPrimaryNodeFor({required _i4.CryptoCurrency? currency}) => + _i22.NodeModel? getPrimaryNodeFor({required _i4.CryptoCurrency? currency}) => (super.noSuchMethod(Invocation.method( #getPrimaryNodeFor, [], {#currency: currency}, - )) as _i21.NodeModel?); + )) as _i22.NodeModel?); @override - List<_i21.NodeModel> getNodesFor(_i4.CryptoCurrency? coin) => + List<_i22.NodeModel> getNodesFor(_i4.CryptoCurrency? coin) => (super.noSuchMethod( Invocation.method( #getNodesFor, [coin], ), - returnValue: <_i21.NodeModel>[], - ) as List<_i21.NodeModel>); + returnValue: <_i22.NodeModel>[], + ) as List<_i22.NodeModel>); @override - _i21.NodeModel? getNodeById({required String? id}) => + _i22.NodeModel? getNodeById({required String? id}) => (super.noSuchMethod(Invocation.method( #getNodeById, [], {#id: id}, - )) as _i21.NodeModel?); + )) as _i22.NodeModel?); @override - List<_i21.NodeModel> failoverNodesFor( + List<_i22.NodeModel> failoverNodesFor( {required _i4.CryptoCurrency? currency}) => (super.noSuchMethod( Invocation.method( @@ -1020,11 +1045,11 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { [], {#currency: currency}, ), - returnValue: <_i21.NodeModel>[], - ) as List<_i21.NodeModel>); + returnValue: <_i22.NodeModel>[], + ) as List<_i22.NodeModel>); @override _i10.Future add( - _i21.NodeModel? node, + _i22.NodeModel? node, String? password, bool? shouldNotifyListeners, ) => @@ -1076,7 +1101,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { ) as _i10.Future); @override _i10.Future edit( - _i21.NodeModel? editedNode, + _i22.NodeModel? editedNode, String? password, bool? shouldNotifyListeners, ) => @@ -1102,7 +1127,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override - void addListener(_i19.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i20.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -1110,7 +1135,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i19.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/widget_tests/node_card_test.dart b/test/widget_tests/node_card_test.dart index f98814b58..45c0dbe12 100644 --- a/test/widget_tests/node_card_test.dart +++ b/test/widget_tests/node_card_test.dart @@ -10,7 +10,6 @@ import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/util.dart'; -import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/widgets/node_card.dart'; import 'package:stackwallet/widgets/node_options_sheet.dart'; diff --git a/test/widget_tests/node_card_test.mocks.dart b/test/widget_tests/node_card_test.mocks.dart index ec802d4e8..c34b5b77f 100644 --- a/test/widget_tests/node_card_test.mocks.dart +++ b/test/widget_tests/node_card_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/widget_tests/node_card_test.dart. // Do not manually edit this file. @@ -18,6 +18,8 @@ import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart' // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors diff --git a/test/widget_tests/node_options_sheet_test.dart b/test/widget_tests/node_options_sheet_test.dart index 94121acf2..c289b29b5 100644 --- a/test/widget_tests/node_options_sheet_test.dart +++ b/test/widget_tests/node_options_sheet_test.dart @@ -12,7 +12,6 @@ import 'package:stackwallet/services/tor_service.dart'; import 'package:stackwallet/services/wallets.dart'; import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/prefs.dart'; -import 'package:stackwallet/wallets/crypto_currency/coins/bitcoin.dart'; import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart'; import 'package:stackwallet/widgets/node_options_sheet.dart'; @@ -166,7 +165,7 @@ void main() { await tester.tap(find.text("Details")); await tester.pumpAndSettle(); - var currentRoute = navigatorKey.currentState?.overlay?.context; + final currentRoute = navigatorKey.currentState?.overlay?.context; expect(currentRoute, isNotNull); }); diff --git a/test/widget_tests/node_options_sheet_test.mocks.dart b/test/widget_tests/node_options_sheet_test.mocks.dart index ff15b6330..59450b63e 100644 --- a/test/widget_tests/node_options_sheet_test.mocks.dart +++ b/test/widget_tests/node_options_sheet_test.mocks.dart @@ -1,22 +1,23 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/widget_tests/node_options_sheet_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i10; import 'dart:io' as _i8; -import 'dart:ui' as _i16; +import 'dart:ui' as _i17; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i14; import 'package:stackwallet/db/isar/main_db.dart' as _i3; -import 'package:stackwallet/models/node_model.dart' as _i17; +import 'package:stackwallet/models/node_model.dart' as _i18; import 'package:stackwallet/services/event_bus/events/global/tor_connection_status_changed_event.dart' - as _i19; + as _i20; import 'package:stackwallet/services/node_service.dart' as _i2; -import 'package:stackwallet/services/tor_service.dart' as _i18; +import 'package:stackwallet/services/tor_service.dart' as _i19; import 'package:stackwallet/services/wallets.dart' as _i9; -import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i15; -import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i14; +import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i16; +import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i15; import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i13; import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' as _i7; @@ -27,12 +28,14 @@ import 'package:stackwallet/wallets/isar/models/wallet_info.dart' as _i11; import 'package:stackwallet/wallets/wallet/wallet.dart' as _i5; import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/cash_fusion_interface.dart' as _i6; -import 'package:tor_ffi_plugin/tor_ffi_plugin.dart' as _i20; +import 'package:tor_ffi_plugin/tor_ffi_plugin.dart' as _i21; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -323,7 +326,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get language => (super.noSuchMethod( Invocation.getter(#language), - returnValue: '', + returnValue: _i14.dummyValue( + this, + Invocation.getter(#language), + ), ) as String); @override set language(String? newLanguage) => super.noSuchMethod( @@ -336,7 +342,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get currency => (super.noSuchMethod( Invocation.getter(#currency), - returnValue: '', + returnValue: _i14.dummyValue( + this, + Invocation.getter(#currency), + ), ) as String); @override set currency(String? newCurrency) => super.noSuchMethod( @@ -446,12 +455,12 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: null, ); @override - _i14.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( + _i15.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( Invocation.getter(#backupFrequencyType), - returnValue: _i14.BackupFrequencyType.everyTenMinutes, - ) as _i14.BackupFrequencyType); + returnValue: _i15.BackupFrequencyType.everyTenMinutes, + ) as _i15.BackupFrequencyType); @override - set backupFrequencyType(_i14.BackupFrequencyType? backupFrequencyType) => + set backupFrequencyType(_i15.BackupFrequencyType? backupFrequencyType) => super.noSuchMethod( Invocation.setter( #backupFrequencyType, @@ -545,7 +554,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get themeId => (super.noSuchMethod( Invocation.getter(#themeId), - returnValue: '', + returnValue: _i14.dummyValue( + this, + Invocation.getter(#themeId), + ), ) as String); @override set themeId(String? themeId) => super.noSuchMethod( @@ -558,7 +570,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get systemBrightnessLightThemeId => (super.noSuchMethod( Invocation.getter(#systemBrightnessLightThemeId), - returnValue: '', + returnValue: _i14.dummyValue( + this, + Invocation.getter(#systemBrightnessLightThemeId), + ), ) as String); @override set systemBrightnessLightThemeId(String? systemBrightnessLightThemeId) => @@ -572,7 +587,10 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { @override String get systemBrightnessDarkThemeId => (super.noSuchMethod( Invocation.getter(#systemBrightnessDarkThemeId), - returnValue: '', + returnValue: _i14.dummyValue( + this, + Invocation.getter(#systemBrightnessDarkThemeId), + ), ) as String); @override set systemBrightnessDarkThemeId(String? systemBrightnessDarkThemeId) => @@ -646,17 +664,17 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override - _i15.AmountUnit amountUnit(_i4.CryptoCurrency? coin) => (super.noSuchMethod( + _i16.AmountUnit amountUnit(_i4.CryptoCurrency? coin) => (super.noSuchMethod( Invocation.method( #amountUnit, [coin], ), - returnValue: _i15.AmountUnit.normal, - ) as _i15.AmountUnit); + returnValue: _i16.AmountUnit.normal, + ) as _i16.AmountUnit); @override void updateAmountUnit({ required _i4.CryptoCurrency? coin, - required _i15.AmountUnit? amountUnit, + required _i16.AmountUnit? amountUnit, }) => super.noSuchMethod( Invocation.method( @@ -724,7 +742,7 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: null, ); @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i17.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -732,7 +750,7 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: null, ); @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i17.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -774,15 +792,15 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { ), ) as _i7.SecureStorageInterface); @override - List<_i17.NodeModel> get primaryNodes => (super.noSuchMethod( + List<_i18.NodeModel> get primaryNodes => (super.noSuchMethod( Invocation.getter(#primaryNodes), - returnValue: <_i17.NodeModel>[], - ) as List<_i17.NodeModel>); + returnValue: <_i18.NodeModel>[], + ) as List<_i18.NodeModel>); @override - List<_i17.NodeModel> get nodes => (super.noSuchMethod( + List<_i18.NodeModel> get nodes => (super.noSuchMethod( Invocation.getter(#nodes), - returnValue: <_i17.NodeModel>[], - ) as List<_i17.NodeModel>); + returnValue: <_i18.NodeModel>[], + ) as List<_i18.NodeModel>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), @@ -800,7 +818,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { @override _i10.Future setPrimaryNodeFor({ required _i4.CryptoCurrency? coin, - required _i17.NodeModel? node, + required _i18.NodeModel? node, bool? shouldNotifyListeners = false, }) => (super.noSuchMethod( @@ -817,30 +835,30 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override - _i17.NodeModel? getPrimaryNodeFor({required _i4.CryptoCurrency? currency}) => + _i18.NodeModel? getPrimaryNodeFor({required _i4.CryptoCurrency? currency}) => (super.noSuchMethod(Invocation.method( #getPrimaryNodeFor, [], {#currency: currency}, - )) as _i17.NodeModel?); + )) as _i18.NodeModel?); @override - List<_i17.NodeModel> getNodesFor(_i4.CryptoCurrency? coin) => + List<_i18.NodeModel> getNodesFor(_i4.CryptoCurrency? coin) => (super.noSuchMethod( Invocation.method( #getNodesFor, [coin], ), - returnValue: <_i17.NodeModel>[], - ) as List<_i17.NodeModel>); + returnValue: <_i18.NodeModel>[], + ) as List<_i18.NodeModel>); @override - _i17.NodeModel? getNodeById({required String? id}) => + _i18.NodeModel? getNodeById({required String? id}) => (super.noSuchMethod(Invocation.method( #getNodeById, [], {#id: id}, - )) as _i17.NodeModel?); + )) as _i18.NodeModel?); @override - List<_i17.NodeModel> failoverNodesFor( + List<_i18.NodeModel> failoverNodesFor( {required _i4.CryptoCurrency? currency}) => (super.noSuchMethod( Invocation.method( @@ -848,11 +866,11 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { [], {#currency: currency}, ), - returnValue: <_i17.NodeModel>[], - ) as List<_i17.NodeModel>); + returnValue: <_i18.NodeModel>[], + ) as List<_i18.NodeModel>); @override _i10.Future add( - _i17.NodeModel? node, + _i18.NodeModel? node, String? password, bool? shouldNotifyListeners, ) => @@ -904,7 +922,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { ) as _i10.Future); @override _i10.Future edit( - _i17.NodeModel? editedNode, + _i18.NodeModel? editedNode, String? password, bool? shouldNotifyListeners, ) => @@ -930,7 +948,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i17.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -938,7 +956,7 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i17.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -966,16 +984,16 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService { /// A class which mocks [TorService]. /// /// See the documentation for Mockito's code generation for more information. -class MockTorService extends _i1.Mock implements _i18.TorService { +class MockTorService extends _i1.Mock implements _i19.TorService { MockTorService() { _i1.throwOnMissingStub(this); } @override - _i19.TorConnectionStatus get status => (super.noSuchMethod( + _i20.TorConnectionStatus get status => (super.noSuchMethod( Invocation.getter(#status), - returnValue: _i19.TorConnectionStatus.disconnected, - ) as _i19.TorConnectionStatus); + returnValue: _i20.TorConnectionStatus.disconnected, + ) as _i20.TorConnectionStatus); @override ({_i8.InternetAddress host, int port}) getProxyInfo() => (super.noSuchMethod( Invocation.method( @@ -996,7 +1014,7 @@ class MockTorService extends _i1.Mock implements _i18.TorService { @override void init({ required String? torDataDirPath, - _i20.Tor? mockableOverride, + _i21.Tor? mockableOverride, }) => super.noSuchMethod( Invocation.method( diff --git a/test/widget_tests/table_view/table_view_row_test.mocks.dart b/test/widget_tests/table_view/table_view_row_test.mocks.dart index 9880d1e22..09791d1f0 100644 --- a/test/widget_tests/table_view/table_view_row_test.mocks.dart +++ b/test/widget_tests/table_view/table_view_row_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/widget_tests/table_view/table_view_row_test.dart. // Do not manually edit this file. @@ -25,6 +25,8 @@ import 'package:stackwallet/wallets/wallet/wallet.dart' as _i5; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors diff --git a/test/widget_tests/trade_card_test.mocks.dart b/test/widget_tests/trade_card_test.mocks.dart index e8bb7f552..0f62658a4 100644 --- a/test/widget_tests/trade_card_test.mocks.dart +++ b/test/widget_tests/trade_card_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/widget_tests/trade_card_test.dart. // Do not manually edit this file. @@ -7,6 +7,7 @@ import 'dart:async' as _i6; import 'dart:typed_data' as _i7; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i8; import 'package:stackwallet/db/isar/main_db.dart' as _i3; import 'package:stackwallet/models/isar/stack_theme.dart' as _i5; import 'package:stackwallet/networking/http.dart' as _i2; @@ -16,6 +17,8 @@ import 'package:stackwallet/themes/theme_service.dart' as _i4; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -168,91 +171,145 @@ class MockIThemeAssets extends _i1.Mock implements _i5.IThemeAssets { @override String get bellNew => (super.noSuchMethod( Invocation.getter(#bellNew), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#bellNew), + ), ) as String); @override String get buy => (super.noSuchMethod( Invocation.getter(#buy), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#buy), + ), ) as String); @override String get exchange => (super.noSuchMethod( Invocation.getter(#exchange), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#exchange), + ), ) as String); @override String get personaIncognito => (super.noSuchMethod( Invocation.getter(#personaIncognito), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#personaIncognito), + ), ) as String); @override String get personaEasy => (super.noSuchMethod( Invocation.getter(#personaEasy), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#personaEasy), + ), ) as String); @override String get stack => (super.noSuchMethod( Invocation.getter(#stack), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#stack), + ), ) as String); @override String get stackIcon => (super.noSuchMethod( Invocation.getter(#stackIcon), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#stackIcon), + ), ) as String); @override String get receive => (super.noSuchMethod( Invocation.getter(#receive), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#receive), + ), ) as String); @override String get receivePending => (super.noSuchMethod( Invocation.getter(#receivePending), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#receivePending), + ), ) as String); @override String get receiveCancelled => (super.noSuchMethod( Invocation.getter(#receiveCancelled), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#receiveCancelled), + ), ) as String); @override String get send => (super.noSuchMethod( Invocation.getter(#send), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#send), + ), ) as String); @override String get sendPending => (super.noSuchMethod( Invocation.getter(#sendPending), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#sendPending), + ), ) as String); @override String get sendCancelled => (super.noSuchMethod( Invocation.getter(#sendCancelled), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#sendCancelled), + ), ) as String); @override String get themeSelector => (super.noSuchMethod( Invocation.getter(#themeSelector), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#themeSelector), + ), ) as String); @override String get themePreview => (super.noSuchMethod( Invocation.getter(#themePreview), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#themePreview), + ), ) as String); @override String get txExchange => (super.noSuchMethod( Invocation.getter(#txExchange), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#txExchange), + ), ) as String); @override String get txExchangePending => (super.noSuchMethod( Invocation.getter(#txExchangePending), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#txExchangePending), + ), ) as String); @override String get txExchangeFailed => (super.noSuchMethod( Invocation.getter(#txExchangeFailed), - returnValue: '', + returnValue: _i8.dummyValue( + this, + Invocation.getter(#txExchangeFailed), + ), ) as String); } diff --git a/test/widget_tests/transaction_card_test.mocks.dart b/test/widget_tests/transaction_card_test.mocks.dart index 6d3d98e0f..cc4157a10 100644 --- a/test/widget_tests/transaction_card_test.mocks.dart +++ b/test/widget_tests/transaction_card_test.mocks.dart @@ -1,31 +1,32 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/widget_tests/transaction_card_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i11; -import 'dart:typed_data' as _i24; -import 'dart:ui' as _i16; +import 'dart:typed_data' as _i25; +import 'dart:ui' as _i17; -import 'package:decimal/decimal.dart' as _i21; +import 'package:decimal/decimal.dart' as _i22; import 'package:isar/isar.dart' as _i9; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i16; import 'package:stackwallet/db/isar/main_db.dart' as _i3; -import 'package:stackwallet/models/isar/models/block_explorer.dart' as _i26; +import 'package:stackwallet/models/isar/models/block_explorer.dart' as _i27; import 'package:stackwallet/models/isar/models/blockchain_data/v2/transaction_v2.dart' - as _i28; -import 'package:stackwallet/models/isar/models/contact_entry.dart' as _i25; -import 'package:stackwallet/models/isar/models/isar_models.dart' as _i27; -import 'package:stackwallet/models/isar/stack_theme.dart' as _i23; + as _i29; +import 'package:stackwallet/models/isar/models/contact_entry.dart' as _i26; +import 'package:stackwallet/models/isar/models/isar_models.dart' as _i28; +import 'package:stackwallet/models/isar/stack_theme.dart' as _i24; import 'package:stackwallet/networking/http.dart' as _i8; import 'package:stackwallet/services/locale_service.dart' as _i15; import 'package:stackwallet/services/node_service.dart' as _i2; -import 'package:stackwallet/services/price_service.dart' as _i20; +import 'package:stackwallet/services/price_service.dart' as _i21; import 'package:stackwallet/services/wallets.dart' as _i10; -import 'package:stackwallet/themes/theme_service.dart' as _i22; -import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i19; -import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i18; -import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i17; +import 'package:stackwallet/themes/theme_service.dart' as _i23; +import 'package:stackwallet/utilities/amount/amount_unit.dart' as _i20; +import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i19; +import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i18; import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' as _i13; import 'package:stackwallet/utilities/prefs.dart' as _i14; @@ -41,6 +42,8 @@ import 'package:tuple/tuple.dart' as _i7; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -272,7 +275,10 @@ class MockLocaleService extends _i1.Mock implements _i15.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#locale), + ), ) as String); @override bool get hasListeners => (super.noSuchMethod( @@ -290,7 +296,7 @@ class MockLocaleService extends _i1.Mock implements _i15.LocaleService { returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i17.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -298,7 +304,7 @@ class MockLocaleService extends _i1.Mock implements _i15.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i17.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -382,12 +388,12 @@ class MockPrefs extends _i1.Mock implements _i14.Prefs { returnValueForMissingStub: null, ); @override - _i17.SyncingType get syncType => (super.noSuchMethod( + _i18.SyncingType get syncType => (super.noSuchMethod( Invocation.getter(#syncType), - returnValue: _i17.SyncingType.currentWalletOnly, - ) as _i17.SyncingType); + returnValue: _i18.SyncingType.currentWalletOnly, + ) as _i18.SyncingType); @override - set syncType(_i17.SyncingType? syncType) => super.noSuchMethod( + set syncType(_i18.SyncingType? syncType) => super.noSuchMethod( Invocation.setter( #syncType, syncType, @@ -423,7 +429,10 @@ class MockPrefs extends _i1.Mock implements _i14.Prefs { @override String get language => (super.noSuchMethod( Invocation.getter(#language), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#language), + ), ) as String); @override set language(String? newLanguage) => super.noSuchMethod( @@ -436,7 +445,10 @@ class MockPrefs extends _i1.Mock implements _i14.Prefs { @override String get currency => (super.noSuchMethod( Invocation.getter(#currency), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#currency), + ), ) as String); @override set currency(String? newCurrency) => super.noSuchMethod( @@ -546,12 +558,12 @@ class MockPrefs extends _i1.Mock implements _i14.Prefs { returnValueForMissingStub: null, ); @override - _i18.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( + _i19.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( Invocation.getter(#backupFrequencyType), - returnValue: _i18.BackupFrequencyType.everyTenMinutes, - ) as _i18.BackupFrequencyType); + returnValue: _i19.BackupFrequencyType.everyTenMinutes, + ) as _i19.BackupFrequencyType); @override - set backupFrequencyType(_i18.BackupFrequencyType? backupFrequencyType) => + set backupFrequencyType(_i19.BackupFrequencyType? backupFrequencyType) => super.noSuchMethod( Invocation.setter( #backupFrequencyType, @@ -645,7 +657,10 @@ class MockPrefs extends _i1.Mock implements _i14.Prefs { @override String get themeId => (super.noSuchMethod( Invocation.getter(#themeId), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#themeId), + ), ) as String); @override set themeId(String? themeId) => super.noSuchMethod( @@ -658,7 +673,10 @@ class MockPrefs extends _i1.Mock implements _i14.Prefs { @override String get systemBrightnessLightThemeId => (super.noSuchMethod( Invocation.getter(#systemBrightnessLightThemeId), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#systemBrightnessLightThemeId), + ), ) as String); @override set systemBrightnessLightThemeId(String? systemBrightnessLightThemeId) => @@ -672,7 +690,10 @@ class MockPrefs extends _i1.Mock implements _i14.Prefs { @override String get systemBrightnessDarkThemeId => (super.noSuchMethod( Invocation.getter(#systemBrightnessDarkThemeId), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#systemBrightnessDarkThemeId), + ), ) as String); @override set systemBrightnessDarkThemeId(String? systemBrightnessDarkThemeId) => @@ -746,17 +767,17 @@ class MockPrefs extends _i1.Mock implements _i14.Prefs { returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override - _i19.AmountUnit amountUnit(_i4.CryptoCurrency? coin) => (super.noSuchMethod( + _i20.AmountUnit amountUnit(_i4.CryptoCurrency? coin) => (super.noSuchMethod( Invocation.method( #amountUnit, [coin], ), - returnValue: _i19.AmountUnit.normal, - ) as _i19.AmountUnit); + returnValue: _i20.AmountUnit.normal, + ) as _i20.AmountUnit); @override void updateAmountUnit({ required _i4.CryptoCurrency? coin, - required _i19.AmountUnit? amountUnit, + required _i20.AmountUnit? amountUnit, }) => super.noSuchMethod( Invocation.method( @@ -824,7 +845,7 @@ class MockPrefs extends _i1.Mock implements _i14.Prefs { returnValueForMissingStub: null, ); @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i17.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -832,7 +853,7 @@ class MockPrefs extends _i1.Mock implements _i14.Prefs { returnValueForMissingStub: null, ); @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i17.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -860,7 +881,7 @@ class MockPrefs extends _i1.Mock implements _i14.Prefs { /// A class which mocks [PriceService]. /// /// See the documentation for Mockito's code generation for more information. -class MockPriceService extends _i1.Mock implements _i20.PriceService { +class MockPriceService extends _i1.Mock implements _i21.PriceService { MockPriceService() { _i1.throwOnMissingStub(this); } @@ -868,7 +889,10 @@ class MockPriceService extends _i1.Mock implements _i20.PriceService { @override String get baseTicker => (super.noSuchMethod( Invocation.getter(#baseTicker), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#baseTicker), + ), ) as String); @override set baseTicker(String? _baseTicker) => super.noSuchMethod( @@ -898,35 +922,35 @@ class MockPriceService extends _i1.Mock implements _i20.PriceService { returnValue: false, ) as bool); @override - _i7.Tuple2<_i21.Decimal, double> getPrice(_i4.CryptoCurrency? coin) => + _i7.Tuple2<_i22.Decimal, double> getPrice(_i4.CryptoCurrency? coin) => (super.noSuchMethod( Invocation.method( #getPrice, [coin], ), - returnValue: _FakeTuple2_5<_i21.Decimal, double>( + returnValue: _FakeTuple2_5<_i22.Decimal, double>( this, Invocation.method( #getPrice, [coin], ), ), - ) as _i7.Tuple2<_i21.Decimal, double>); + ) as _i7.Tuple2<_i22.Decimal, double>); @override - _i7.Tuple2<_i21.Decimal, double> getTokenPrice(String? contractAddress) => + _i7.Tuple2<_i22.Decimal, double> getTokenPrice(String? contractAddress) => (super.noSuchMethod( Invocation.method( #getTokenPrice, [contractAddress], ), - returnValue: _FakeTuple2_5<_i21.Decimal, double>( + returnValue: _FakeTuple2_5<_i22.Decimal, double>( this, Invocation.method( #getTokenPrice, [contractAddress], ), ), - ) as _i7.Tuple2<_i21.Decimal, double>); + ) as _i7.Tuple2<_i22.Decimal, double>); @override _i11.Future updatePrice() => (super.noSuchMethod( Invocation.method( @@ -961,7 +985,7 @@ class MockPriceService extends _i1.Mock implements _i20.PriceService { returnValueForMissingStub: null, ); @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i17.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -969,7 +993,7 @@ class MockPriceService extends _i1.Mock implements _i20.PriceService { returnValueForMissingStub: null, ); @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i17.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -989,7 +1013,7 @@ class MockPriceService extends _i1.Mock implements _i20.PriceService { /// A class which mocks [ThemeService]. /// /// See the documentation for Mockito's code generation for more information. -class MockThemeService extends _i1.Mock implements _i22.ThemeService { +class MockThemeService extends _i1.Mock implements _i23.ThemeService { MockThemeService() { _i1.throwOnMissingStub(this); } @@ -1019,10 +1043,10 @@ class MockThemeService extends _i1.Mock implements _i22.ThemeService { ), ) as _i3.MainDB); @override - List<_i23.StackTheme> get installedThemes => (super.noSuchMethod( + List<_i24.StackTheme> get installedThemes => (super.noSuchMethod( Invocation.getter(#installedThemes), - returnValue: <_i23.StackTheme>[], - ) as List<_i23.StackTheme>); + returnValue: <_i24.StackTheme>[], + ) as List<_i24.StackTheme>); @override void init(_i3.MainDB? db) => super.noSuchMethod( Invocation.method( @@ -1032,7 +1056,7 @@ class MockThemeService extends _i1.Mock implements _i22.ThemeService { returnValueForMissingStub: null, ); @override - _i11.Future install({required _i24.Uint8List? themeArchiveData}) => + _i11.Future install({required _i25.Uint8List? themeArchiveData}) => (super.noSuchMethod( Invocation.method( #install, @@ -1072,33 +1096,33 @@ class MockThemeService extends _i1.Mock implements _i22.ThemeService { returnValue: _i11.Future.value(false), ) as _i11.Future); @override - _i11.Future> fetchThemes() => + _i11.Future> fetchThemes() => (super.noSuchMethod( Invocation.method( #fetchThemes, [], ), - returnValue: _i11.Future>.value( - <_i22.StackThemeMetaData>[]), - ) as _i11.Future>); + returnValue: _i11.Future>.value( + <_i23.StackThemeMetaData>[]), + ) as _i11.Future>); @override - _i11.Future<_i24.Uint8List> fetchTheme( - {required _i22.StackThemeMetaData? themeMetaData}) => + _i11.Future<_i25.Uint8List> fetchTheme( + {required _i23.StackThemeMetaData? themeMetaData}) => (super.noSuchMethod( Invocation.method( #fetchTheme, [], {#themeMetaData: themeMetaData}, ), - returnValue: _i11.Future<_i24.Uint8List>.value(_i24.Uint8List(0)), - ) as _i11.Future<_i24.Uint8List>); + returnValue: _i11.Future<_i25.Uint8List>.value(_i25.Uint8List(0)), + ) as _i11.Future<_i25.Uint8List>); @override - _i23.StackTheme? getTheme({required String? themeId}) => + _i24.StackTheme? getTheme({required String? themeId}) => (super.noSuchMethod(Invocation.method( #getTheme, [], {#themeId: themeId}, - )) as _i23.StackTheme?); + )) as _i24.StackTheme?); } /// A class which mocks [MainDB]. @@ -1147,13 +1171,13 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override - List<_i25.ContactEntry> getContactEntries() => (super.noSuchMethod( + List<_i26.ContactEntry> getContactEntries() => (super.noSuchMethod( Invocation.method( #getContactEntries, [], ), - returnValue: <_i25.ContactEntry>[], - ) as List<_i25.ContactEntry>); + returnValue: <_i26.ContactEntry>[], + ) as List<_i26.ContactEntry>); @override _i11.Future deleteContactEntry({required String? id}) => (super.noSuchMethod( @@ -1175,15 +1199,15 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValue: _i11.Future.value(false), ) as _i11.Future); @override - _i25.ContactEntry? getContactEntry({required String? id}) => + _i26.ContactEntry? getContactEntry({required String? id}) => (super.noSuchMethod(Invocation.method( #getContactEntry, [], {#id: id}, - )) as _i25.ContactEntry?); + )) as _i26.ContactEntry?); @override _i11.Future putContactEntry( - {required _i25.ContactEntry? contactEntry}) => + {required _i26.ContactEntry? contactEntry}) => (super.noSuchMethod( Invocation.method( #putContactEntry, @@ -1193,16 +1217,16 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValue: _i11.Future.value(false), ) as _i11.Future); @override - _i26.TransactionBlockExplorer? getTransactionBlockExplorer( + _i27.TransactionBlockExplorer? getTransactionBlockExplorer( {required _i4.CryptoCurrency? cryptoCurrency}) => (super.noSuchMethod(Invocation.method( #getTransactionBlockExplorer, [], {#cryptoCurrency: cryptoCurrency}, - )) as _i26.TransactionBlockExplorer?); + )) as _i27.TransactionBlockExplorer?); @override _i11.Future putTransactionBlockExplorer( - _i26.TransactionBlockExplorer? explorer) => + _i27.TransactionBlockExplorer? explorer) => (super.noSuchMethod( Invocation.method( #putTransactionBlockExplorer, @@ -1211,13 +1235,13 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValue: _i11.Future.value(0), ) as _i11.Future); @override - _i9.QueryBuilder<_i27.Address, _i27.Address, _i9.QAfterWhereClause> + _i9.QueryBuilder<_i28.Address, _i28.Address, _i9.QAfterWhereClause> getAddresses(String? walletId) => (super.noSuchMethod( Invocation.method( #getAddresses, [walletId], ), - returnValue: _FakeQueryBuilder_8<_i27.Address, _i27.Address, + returnValue: _FakeQueryBuilder_8<_i28.Address, _i28.Address, _i9.QAfterWhereClause>( this, Invocation.method( @@ -1226,9 +1250,9 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { ), ), ) as _i9 - .QueryBuilder<_i27.Address, _i27.Address, _i9.QAfterWhereClause>); + .QueryBuilder<_i28.Address, _i28.Address, _i9.QAfterWhereClause>); @override - _i11.Future putAddress(_i27.Address? address) => (super.noSuchMethod( + _i11.Future putAddress(_i28.Address? address) => (super.noSuchMethod( Invocation.method( #putAddress, [address], @@ -1236,7 +1260,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValue: _i11.Future.value(0), ) as _i11.Future); @override - _i11.Future> putAddresses(List<_i27.Address>? addresses) => + _i11.Future> putAddresses(List<_i28.Address>? addresses) => (super.noSuchMethod( Invocation.method( #putAddresses, @@ -1245,7 +1269,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValue: _i11.Future>.value([]), ) as _i11.Future>); @override - _i11.Future> updateOrPutAddresses(List<_i27.Address>? addresses) => + _i11.Future> updateOrPutAddresses(List<_i28.Address>? addresses) => (super.noSuchMethod( Invocation.method( #updateOrPutAddresses, @@ -1254,7 +1278,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValue: _i11.Future>.value([]), ) as _i11.Future>); @override - _i11.Future<_i27.Address?> getAddress( + _i11.Future<_i28.Address?> getAddress( String? walletId, String? address, ) => @@ -1266,12 +1290,12 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { address, ], ), - returnValue: _i11.Future<_i27.Address?>.value(), - ) as _i11.Future<_i27.Address?>); + returnValue: _i11.Future<_i28.Address?>.value(), + ) as _i11.Future<_i28.Address?>); @override _i11.Future updateAddress( - _i27.Address? oldAddress, - _i27.Address? newAddress, + _i28.Address? oldAddress, + _i28.Address? newAddress, ) => (super.noSuchMethod( Invocation.method( @@ -1284,13 +1308,13 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValue: _i11.Future.value(0), ) as _i11.Future); @override - _i9.QueryBuilder<_i27.Transaction, _i27.Transaction, _i9.QAfterWhereClause> + _i9.QueryBuilder<_i28.Transaction, _i28.Transaction, _i9.QAfterWhereClause> getTransactions(String? walletId) => (super.noSuchMethod( Invocation.method( #getTransactions, [walletId], ), - returnValue: _FakeQueryBuilder_8<_i27.Transaction, _i27.Transaction, + returnValue: _FakeQueryBuilder_8<_i28.Transaction, _i28.Transaction, _i9.QAfterWhereClause>( this, Invocation.method( @@ -1298,10 +1322,10 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { [walletId], ), ), - ) as _i9.QueryBuilder<_i27.Transaction, _i27.Transaction, + ) as _i9.QueryBuilder<_i28.Transaction, _i28.Transaction, _i9.QAfterWhereClause>); @override - _i11.Future putTransaction(_i27.Transaction? transaction) => + _i11.Future putTransaction(_i28.Transaction? transaction) => (super.noSuchMethod( Invocation.method( #putTransaction, @@ -1311,7 +1335,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { ) as _i11.Future); @override _i11.Future> putTransactions( - List<_i27.Transaction>? transactions) => + List<_i28.Transaction>? transactions) => (super.noSuchMethod( Invocation.method( #putTransactions, @@ -1320,7 +1344,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValue: _i11.Future>.value([]), ) as _i11.Future>); @override - _i11.Future<_i27.Transaction?> getTransaction( + _i11.Future<_i28.Transaction?> getTransaction( String? walletId, String? txid, ) => @@ -1332,10 +1356,10 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { txid, ], ), - returnValue: _i11.Future<_i27.Transaction?>.value(), - ) as _i11.Future<_i27.Transaction?>); + returnValue: _i11.Future<_i28.Transaction?>.value(), + ) as _i11.Future<_i28.Transaction?>); @override - _i11.Stream<_i27.Transaction?> watchTransaction({ + _i11.Stream<_i28.Transaction?> watchTransaction({ required int? id, bool? fireImmediately = false, }) => @@ -1348,10 +1372,10 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { #fireImmediately: fireImmediately, }, ), - returnValue: _i11.Stream<_i27.Transaction?>.empty(), - ) as _i11.Stream<_i27.Transaction?>); + returnValue: _i11.Stream<_i28.Transaction?>.empty(), + ) as _i11.Stream<_i28.Transaction?>); @override - _i9.QueryBuilder<_i27.UTXO, _i27.UTXO, _i9.QAfterWhereClause> getUTXOs( + _i9.QueryBuilder<_i28.UTXO, _i28.UTXO, _i9.QAfterWhereClause> getUTXOs( String? walletId) => (super.noSuchMethod( Invocation.method( @@ -1359,16 +1383,16 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { [walletId], ), returnValue: - _FakeQueryBuilder_8<_i27.UTXO, _i27.UTXO, _i9.QAfterWhereClause>( + _FakeQueryBuilder_8<_i28.UTXO, _i28.UTXO, _i9.QAfterWhereClause>( this, Invocation.method( #getUTXOs, [walletId], ), ), - ) as _i9.QueryBuilder<_i27.UTXO, _i27.UTXO, _i9.QAfterWhereClause>); + ) as _i9.QueryBuilder<_i28.UTXO, _i28.UTXO, _i9.QAfterWhereClause>); @override - _i9.QueryBuilder<_i27.UTXO, _i27.UTXO, _i9.QAfterFilterCondition> + _i9.QueryBuilder<_i28.UTXO, _i28.UTXO, _i9.QAfterFilterCondition> getUTXOsByAddress( String? walletId, String? address, @@ -1381,7 +1405,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { address, ], ), - returnValue: _FakeQueryBuilder_8<_i27.UTXO, _i27.UTXO, + returnValue: _FakeQueryBuilder_8<_i28.UTXO, _i28.UTXO, _i9.QAfterFilterCondition>( this, Invocation.method( @@ -1393,9 +1417,9 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { ), ), ) as _i9 - .QueryBuilder<_i27.UTXO, _i27.UTXO, _i9.QAfterFilterCondition>); + .QueryBuilder<_i28.UTXO, _i28.UTXO, _i9.QAfterFilterCondition>); @override - _i11.Future putUTXO(_i27.UTXO? utxo) => (super.noSuchMethod( + _i11.Future putUTXO(_i28.UTXO? utxo) => (super.noSuchMethod( Invocation.method( #putUTXO, [utxo], @@ -1404,7 +1428,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override - _i11.Future putUTXOs(List<_i27.UTXO>? utxos) => (super.noSuchMethod( + _i11.Future putUTXOs(List<_i28.UTXO>? utxos) => (super.noSuchMethod( Invocation.method( #putUTXOs, [utxos], @@ -1415,7 +1439,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { @override _i11.Future updateUTXOs( String? walletId, - List<_i27.UTXO>? utxos, + List<_i28.UTXO>? utxos, ) => (super.noSuchMethod( Invocation.method( @@ -1428,7 +1452,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValue: _i11.Future.value(false), ) as _i11.Future); @override - _i11.Stream<_i27.UTXO?> watchUTXO({ + _i11.Stream<_i28.UTXO?> watchUTXO({ required int? id, bool? fireImmediately = false, }) => @@ -1441,10 +1465,10 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { #fireImmediately: fireImmediately, }, ), - returnValue: _i11.Stream<_i27.UTXO?>.empty(), - ) as _i11.Stream<_i27.UTXO?>); + returnValue: _i11.Stream<_i28.UTXO?>.empty(), + ) as _i11.Stream<_i28.UTXO?>); @override - _i9.QueryBuilder<_i27.TransactionNote, _i27.TransactionNote, + _i9.QueryBuilder<_i28.TransactionNote, _i28.TransactionNote, _i9.QAfterWhereClause> getTransactionNotes( String? walletId) => (super.noSuchMethod( @@ -1452,18 +1476,18 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { #getTransactionNotes, [walletId], ), - returnValue: _FakeQueryBuilder_8<_i27.TransactionNote, - _i27.TransactionNote, _i9.QAfterWhereClause>( + returnValue: _FakeQueryBuilder_8<_i28.TransactionNote, + _i28.TransactionNote, _i9.QAfterWhereClause>( this, Invocation.method( #getTransactionNotes, [walletId], ), ), - ) as _i9.QueryBuilder<_i27.TransactionNote, _i27.TransactionNote, + ) as _i9.QueryBuilder<_i28.TransactionNote, _i28.TransactionNote, _i9.QAfterWhereClause>); @override - _i11.Future putTransactionNote(_i27.TransactionNote? transactionNote) => + _i11.Future putTransactionNote(_i28.TransactionNote? transactionNote) => (super.noSuchMethod( Invocation.method( #putTransactionNote, @@ -1474,7 +1498,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { ) as _i11.Future); @override _i11.Future putTransactionNotes( - List<_i27.TransactionNote>? transactionNotes) => + List<_i28.TransactionNote>? transactionNotes) => (super.noSuchMethod( Invocation.method( #putTransactionNotes, @@ -1484,7 +1508,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override - _i11.Future<_i27.TransactionNote?> getTransactionNote( + _i11.Future<_i28.TransactionNote?> getTransactionNote( String? walletId, String? txid, ) => @@ -1496,10 +1520,10 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { txid, ], ), - returnValue: _i11.Future<_i27.TransactionNote?>.value(), - ) as _i11.Future<_i27.TransactionNote?>); + returnValue: _i11.Future<_i28.TransactionNote?>.value(), + ) as _i11.Future<_i28.TransactionNote?>); @override - _i11.Stream<_i27.TransactionNote?> watchTransactionNote({ + _i11.Stream<_i28.TransactionNote?> watchTransactionNote({ required int? id, bool? fireImmediately = false, }) => @@ -1512,27 +1536,27 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { #fireImmediately: fireImmediately, }, ), - returnValue: _i11.Stream<_i27.TransactionNote?>.empty(), - ) as _i11.Stream<_i27.TransactionNote?>); + returnValue: _i11.Stream<_i28.TransactionNote?>.empty(), + ) as _i11.Stream<_i28.TransactionNote?>); @override - _i9.QueryBuilder<_i27.AddressLabel, _i27.AddressLabel, _i9.QAfterWhereClause> + _i9.QueryBuilder<_i28.AddressLabel, _i28.AddressLabel, _i9.QAfterWhereClause> getAddressLabels(String? walletId) => (super.noSuchMethod( Invocation.method( #getAddressLabels, [walletId], ), - returnValue: _FakeQueryBuilder_8<_i27.AddressLabel, - _i27.AddressLabel, _i9.QAfterWhereClause>( + returnValue: _FakeQueryBuilder_8<_i28.AddressLabel, + _i28.AddressLabel, _i9.QAfterWhereClause>( this, Invocation.method( #getAddressLabels, [walletId], ), ), - ) as _i9.QueryBuilder<_i27.AddressLabel, _i27.AddressLabel, + ) as _i9.QueryBuilder<_i28.AddressLabel, _i28.AddressLabel, _i9.QAfterWhereClause>); @override - _i11.Future putAddressLabel(_i27.AddressLabel? addressLabel) => + _i11.Future putAddressLabel(_i28.AddressLabel? addressLabel) => (super.noSuchMethod( Invocation.method( #putAddressLabel, @@ -1541,7 +1565,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValue: _i11.Future.value(0), ) as _i11.Future); @override - int putAddressLabelSync(_i27.AddressLabel? addressLabel) => + int putAddressLabelSync(_i28.AddressLabel? addressLabel) => (super.noSuchMethod( Invocation.method( #putAddressLabelSync, @@ -1550,7 +1574,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValue: 0, ) as int); @override - _i11.Future putAddressLabels(List<_i27.AddressLabel>? addressLabels) => + _i11.Future putAddressLabels(List<_i28.AddressLabel>? addressLabels) => (super.noSuchMethod( Invocation.method( #putAddressLabels, @@ -1560,7 +1584,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override - _i11.Future<_i27.AddressLabel?> getAddressLabel( + _i11.Future<_i28.AddressLabel?> getAddressLabel( String? walletId, String? addressString, ) => @@ -1572,10 +1596,10 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { addressString, ], ), - returnValue: _i11.Future<_i27.AddressLabel?>.value(), - ) as _i11.Future<_i27.AddressLabel?>); + returnValue: _i11.Future<_i28.AddressLabel?>.value(), + ) as _i11.Future<_i28.AddressLabel?>); @override - _i27.AddressLabel? getAddressLabelSync( + _i28.AddressLabel? getAddressLabelSync( String? walletId, String? addressString, ) => @@ -1585,9 +1609,9 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { walletId, addressString, ], - )) as _i27.AddressLabel?); + )) as _i28.AddressLabel?); @override - _i11.Stream<_i27.AddressLabel?> watchAddressLabel({ + _i11.Stream<_i28.AddressLabel?> watchAddressLabel({ required int? id, bool? fireImmediately = false, }) => @@ -1600,10 +1624,10 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { #fireImmediately: fireImmediately, }, ), - returnValue: _i11.Stream<_i27.AddressLabel?>.empty(), - ) as _i11.Stream<_i27.AddressLabel?>); + returnValue: _i11.Stream<_i28.AddressLabel?>.empty(), + ) as _i11.Stream<_i28.AddressLabel?>); @override - _i11.Future updateAddressLabel(_i27.AddressLabel? addressLabel) => + _i11.Future updateAddressLabel(_i28.AddressLabel? addressLabel) => (super.noSuchMethod( Invocation.method( #updateAddressLabel, @@ -1643,7 +1667,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { ) as _i11.Future); @override _i11.Future addNewTransactionData( - List<_i7.Tuple2<_i27.Transaction, _i27.Address?>>? transactionsData, + List<_i7.Tuple2<_i28.Transaction, _i28.Address?>>? transactionsData, String? walletId, ) => (super.noSuchMethod( @@ -1659,7 +1683,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { ) as _i11.Future); @override _i11.Future> updateOrPutTransactionV2s( - List<_i28.TransactionV2>? transactions) => + List<_i29.TransactionV2>? transactions) => (super.noSuchMethod( Invocation.method( #updateOrPutTransactionV2s, @@ -1668,13 +1692,13 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValue: _i11.Future>.value([]), ) as _i11.Future>); @override - _i9.QueryBuilder<_i27.EthContract, _i27.EthContract, _i9.QWhere> + _i9.QueryBuilder<_i28.EthContract, _i28.EthContract, _i9.QWhere> getEthContracts() => (super.noSuchMethod( Invocation.method( #getEthContracts, [], ), - returnValue: _FakeQueryBuilder_8<_i27.EthContract, _i27.EthContract, + returnValue: _FakeQueryBuilder_8<_i28.EthContract, _i28.EthContract, _i9.QWhere>( this, Invocation.method( @@ -1683,24 +1707,24 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { ), ), ) as _i9 - .QueryBuilder<_i27.EthContract, _i27.EthContract, _i9.QWhere>); + .QueryBuilder<_i28.EthContract, _i28.EthContract, _i9.QWhere>); @override - _i11.Future<_i27.EthContract?> getEthContract(String? contractAddress) => + _i11.Future<_i28.EthContract?> getEthContract(String? contractAddress) => (super.noSuchMethod( Invocation.method( #getEthContract, [contractAddress], ), - returnValue: _i11.Future<_i27.EthContract?>.value(), - ) as _i11.Future<_i27.EthContract?>); + returnValue: _i11.Future<_i28.EthContract?>.value(), + ) as _i11.Future<_i28.EthContract?>); @override - _i27.EthContract? getEthContractSync(String? contractAddress) => + _i28.EthContract? getEthContractSync(String? contractAddress) => (super.noSuchMethod(Invocation.method( #getEthContractSync, [contractAddress], - )) as _i27.EthContract?); + )) as _i28.EthContract?); @override - _i11.Future putEthContract(_i27.EthContract? contract) => + _i11.Future putEthContract(_i28.EthContract? contract) => (super.noSuchMethod( Invocation.method( #putEthContract, @@ -1709,7 +1733,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { returnValue: _i11.Future.value(0), ) as _i11.Future); @override - _i11.Future putEthContracts(List<_i27.EthContract>? contracts) => + _i11.Future putEthContracts(List<_i28.EthContract>? contracts) => (super.noSuchMethod( Invocation.method( #putEthContracts, @@ -1733,7 +1757,7 @@ class MockMainDB extends _i1.Mock implements _i3.MainDB { /// A class which mocks [IThemeAssets]. /// /// See the documentation for Mockito's code generation for more information. -class MockIThemeAssets extends _i1.Mock implements _i23.IThemeAssets { +class MockIThemeAssets extends _i1.Mock implements _i24.IThemeAssets { MockIThemeAssets() { _i1.throwOnMissingStub(this); } @@ -1741,91 +1765,145 @@ class MockIThemeAssets extends _i1.Mock implements _i23.IThemeAssets { @override String get bellNew => (super.noSuchMethod( Invocation.getter(#bellNew), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#bellNew), + ), ) as String); @override String get buy => (super.noSuchMethod( Invocation.getter(#buy), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#buy), + ), ) as String); @override String get exchange => (super.noSuchMethod( Invocation.getter(#exchange), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#exchange), + ), ) as String); @override String get personaIncognito => (super.noSuchMethod( Invocation.getter(#personaIncognito), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#personaIncognito), + ), ) as String); @override String get personaEasy => (super.noSuchMethod( Invocation.getter(#personaEasy), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#personaEasy), + ), ) as String); @override String get stack => (super.noSuchMethod( Invocation.getter(#stack), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#stack), + ), ) as String); @override String get stackIcon => (super.noSuchMethod( Invocation.getter(#stackIcon), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#stackIcon), + ), ) as String); @override String get receive => (super.noSuchMethod( Invocation.getter(#receive), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#receive), + ), ) as String); @override String get receivePending => (super.noSuchMethod( Invocation.getter(#receivePending), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#receivePending), + ), ) as String); @override String get receiveCancelled => (super.noSuchMethod( Invocation.getter(#receiveCancelled), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#receiveCancelled), + ), ) as String); @override String get send => (super.noSuchMethod( Invocation.getter(#send), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#send), + ), ) as String); @override String get sendPending => (super.noSuchMethod( Invocation.getter(#sendPending), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#sendPending), + ), ) as String); @override String get sendCancelled => (super.noSuchMethod( Invocation.getter(#sendCancelled), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#sendCancelled), + ), ) as String); @override String get themeSelector => (super.noSuchMethod( Invocation.getter(#themeSelector), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#themeSelector), + ), ) as String); @override String get themePreview => (super.noSuchMethod( Invocation.getter(#themePreview), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#themePreview), + ), ) as String); @override String get txExchange => (super.noSuchMethod( Invocation.getter(#txExchange), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#txExchange), + ), ) as String); @override String get txExchangePending => (super.noSuchMethod( Invocation.getter(#txExchangePending), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#txExchangePending), + ), ) as String); @override String get txExchangeFailed => (super.noSuchMethod( Invocation.getter(#txExchangeFailed), - returnValue: '', + returnValue: _i16.dummyValue( + this, + Invocation.getter(#txExchangeFailed), + ), ) as String); } diff --git a/test/widget_tests/wallet_card_test.mocks.dart b/test/widget_tests/wallet_card_test.mocks.dart index d984f4aef..1c8afe8db 100644 --- a/test/widget_tests/wallet_card_test.mocks.dart +++ b/test/widget_tests/wallet_card_test.mocks.dart @@ -1,20 +1,21 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/widget_tests/wallet_card_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:typed_data' as _i16; -import 'dart:ui' as _i13; +import 'dart:typed_data' as _i17; +import 'dart:ui' as _i14; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i13; import 'package:stackwallet/db/isar/main_db.dart' as _i3; -import 'package:stackwallet/models/isar/stack_theme.dart' as _i15; +import 'package:stackwallet/models/isar/stack_theme.dart' as _i16; import 'package:stackwallet/networking/http.dart' as _i6; import 'package:stackwallet/services/locale_service.dart' as _i12; import 'package:stackwallet/services/node_service.dart' as _i2; import 'package:stackwallet/services/wallets.dart' as _i7; -import 'package:stackwallet/themes/theme_service.dart' as _i14; +import 'package:stackwallet/themes/theme_service.dart' as _i15; import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' as _i10; import 'package:stackwallet/utilities/prefs.dart' as _i11; @@ -27,6 +28,8 @@ import 'package:stackwallet/wallets/wallet/wallet.dart' as _i5; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -206,7 +209,10 @@ class MockLocaleService extends _i1.Mock implements _i12.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), - returnValue: '', + returnValue: _i13.dummyValue( + this, + Invocation.getter(#locale), + ), ) as String); @override bool get hasListeners => (super.noSuchMethod( @@ -224,7 +230,7 @@ class MockLocaleService extends _i1.Mock implements _i12.LocaleService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i13.VoidCallback? listener) => super.noSuchMethod( + void addListener(_i14.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -232,7 +238,7 @@ class MockLocaleService extends _i1.Mock implements _i12.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i13.VoidCallback? listener) => super.noSuchMethod( + void removeListener(_i14.VoidCallback? listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -260,7 +266,7 @@ class MockLocaleService extends _i1.Mock implements _i12.LocaleService { /// A class which mocks [ThemeService]. /// /// See the documentation for Mockito's code generation for more information. -class MockThemeService extends _i1.Mock implements _i14.ThemeService { +class MockThemeService extends _i1.Mock implements _i15.ThemeService { MockThemeService() { _i1.throwOnMissingStub(this); } @@ -290,10 +296,10 @@ class MockThemeService extends _i1.Mock implements _i14.ThemeService { ), ) as _i3.MainDB); @override - List<_i15.StackTheme> get installedThemes => (super.noSuchMethod( + List<_i16.StackTheme> get installedThemes => (super.noSuchMethod( Invocation.getter(#installedThemes), - returnValue: <_i15.StackTheme>[], - ) as List<_i15.StackTheme>); + returnValue: <_i16.StackTheme>[], + ) as List<_i16.StackTheme>); @override void init(_i3.MainDB? db) => super.noSuchMethod( Invocation.method( @@ -303,7 +309,7 @@ class MockThemeService extends _i1.Mock implements _i14.ThemeService { returnValueForMissingStub: null, ); @override - _i8.Future install({required _i16.Uint8List? themeArchiveData}) => + _i8.Future install({required _i17.Uint8List? themeArchiveData}) => (super.noSuchMethod( Invocation.method( #install, @@ -343,31 +349,31 @@ class MockThemeService extends _i1.Mock implements _i14.ThemeService { returnValue: _i8.Future.value(false), ) as _i8.Future); @override - _i8.Future> fetchThemes() => + _i8.Future> fetchThemes() => (super.noSuchMethod( Invocation.method( #fetchThemes, [], ), - returnValue: _i8.Future>.value( - <_i14.StackThemeMetaData>[]), - ) as _i8.Future>); + returnValue: _i8.Future>.value( + <_i15.StackThemeMetaData>[]), + ) as _i8.Future>); @override - _i8.Future<_i16.Uint8List> fetchTheme( - {required _i14.StackThemeMetaData? themeMetaData}) => + _i8.Future<_i17.Uint8List> fetchTheme( + {required _i15.StackThemeMetaData? themeMetaData}) => (super.noSuchMethod( Invocation.method( #fetchTheme, [], {#themeMetaData: themeMetaData}, ), - returnValue: _i8.Future<_i16.Uint8List>.value(_i16.Uint8List(0)), - ) as _i8.Future<_i16.Uint8List>); + returnValue: _i8.Future<_i17.Uint8List>.value(_i17.Uint8List(0)), + ) as _i8.Future<_i17.Uint8List>); @override - _i15.StackTheme? getTheme({required String? themeId}) => + _i16.StackTheme? getTheme({required String? themeId}) => (super.noSuchMethod(Invocation.method( #getTheme, [], {#themeId: themeId}, - )) as _i15.StackTheme?); + )) as _i16.StackTheme?); } diff --git a/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.dart b/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.dart index a3161a73e..470f89225 100644 --- a/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.dart +++ b/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.dart @@ -2,12 +2,15 @@ import 'package:mockito/annotations.dart'; import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/wallets.dart'; -@GenerateMocks([ - Wallets, -], customMocks: [ - MockSpec(returnNullOnMissingStub: true), - // MockSpec(returnNullOnMissingStub: true), -]) +@GenerateMocks( + [ + Wallets, + ], + customMocks: [ + MockSpec(), + // MockSpec(), + ], +) void main() { // testWidgets("Test wallet info row balance loads correctly", // (widgetTester) async { diff --git a/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart b/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart index b94f2e713..2084bd833 100644 --- a/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart +++ b/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.dart. // Do not manually edit this file. @@ -23,6 +23,8 @@ import 'package:stackwallet/wallets/wallet/wallet.dart' as _i5; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -196,6 +198,10 @@ class MockWallets extends _i1.Mock implements _i7.Wallets { /// /// See the documentation for Mockito's code generation for more information. class MockNodeService extends _i1.Mock implements _i2.NodeService { + MockNodeService() { + _i1.throwOnMissingStub(this); + } + @override _i6.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), diff --git a/test/widget_tests/wallet_info_row/wallet_info_row_test.dart b/test/widget_tests/wallet_info_row/wallet_info_row_test.dart index d4f97e600..a9fc6756a 100644 --- a/test/widget_tests/wallet_info_row/wallet_info_row_test.dart +++ b/test/widget_tests/wallet_info_row/wallet_info_row_test.dart @@ -1,16 +1,18 @@ import 'package:mockito/annotations.dart'; import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/wallets.dart'; -import 'package:stackwallet/services/wallets_service.dart'; import 'package:stackwallet/themes/theme_service.dart'; -@GenerateMocks([ - Wallets, - ThemeService, -], customMocks: [ - MockSpec(returnNullOnMissingStub: true), - // MockSpec(returnNullOnMissingStub: true), -]) +@GenerateMocks( + [ + Wallets, + ThemeService, + ], + customMocks: [ + MockSpec(), + // MockSpec(), + ], +) void main() { // testWidgets("Test wallet info row displays correctly", (widgetTester) async { // final wallets = MockWallets(); diff --git a/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart b/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart index 9c90bcdcd..057284d51 100644 --- a/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart +++ b/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in stackwallet/test/widget_tests/wallet_info_row/wallet_info_row_test.dart. // Do not manually edit this file. @@ -27,6 +27,8 @@ import 'package:stackwallet/wallets/wallet/wallet.dart' as _i5; // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -325,6 +327,10 @@ class MockThemeService extends _i1.Mock implements _i12.ThemeService { /// /// See the documentation for Mockito's code generation for more information. class MockNodeService extends _i1.Mock implements _i2.NodeService { + MockNodeService() { + _i1.throwOnMissingStub(this); + } + @override _i7.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index f886b2cc1..d8d4b219f 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); SharePlusWindowsPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); + Sqlite3FlutterLibsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin")); StackWalletBackupPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("StackWalletBackupPluginCApi")); UrlLauncherWindowsRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 02d70698f..b00cd149f 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -10,6 +10,7 @@ list(APPEND FLUTTER_PLUGIN_LIST isar_flutter_libs permission_handler_windows share_plus + sqlite3_flutter_libs stack_wallet_backup url_launcher_windows window_size