diff --git a/apps/mobile_app/assets/shared/animations/fitness_tracker.json b/apps/mobile_app/assets/shared/animations/fitness_tracker.json new file mode 100644 index 00000000..f1b88c95 --- /dev/null +++ b/apps/mobile_app/assets/shared/animations/fitness_tracker.json @@ -0,0 +1 @@ +{"v":"4.8.0","meta":{"g":"LottieFiles AE 1.1.0","a":"","k":"","d":"","tc":""},"fr":30,"ip":0,"op":150,"w":500,"h":500,"nm":"2 - Fitness tracker","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":2,"ty":4,"nm":"Line","parent":6,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[27,167,0],"ix":2},"a":{"a":0,"k":[144.262,42.555,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"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],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[-116.917,15.21],[-43.979,15.21],[-22.652,-6.116],[-2.556,13.98],[26.634,-15.21],[116.917,-15.21]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.830999995213,0.277999997606,0.184000007779,1],"ix":3,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller').effect('Color')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":10.938,"ix":5},"lc":1,"lj":1,"ml":10,"bm":0,"d":[{"n":"d","nm":"dash","v":{"a":0,"k":215,"ix":1}},{"n":"g","nm":"gap","v":{"a":0,"k":40,"ix":2}},{"n":"o","nm":"offset","v":{"a":1,"k":[{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":60,"s":[0]},{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":90,"s":[-255]},{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":120,"s":[-511]},{"t":150,"s":[-766]}],"ix":7}}],"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[144.262,42.555],"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":"tm","s":{"a":1,"k":[{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":0,"s":[8]},{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":20,"s":[28]},{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":40,"s":[0]},{"t":60,"s":[8]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":0,"s":[90]},{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":20,"s":[100]},{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":40,"s":[65]},{"t":60,"s":[90]}],"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":150,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Heart","parent":6,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":4,"s":[15,176,0],"to":[-0.833,0,0],"ti":[-0.833,0,0]},{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":24,"s":[10,176,0],"to":[0.833,0,0],"ti":[-0.833,0,0]},{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":44,"s":[20,176,0],"to":[0.833,0,0],"ti":[0.833,0,0]},{"t":64,"s":[15,176,0]}],"ix":2},"a":{"a":0,"k":[67.785,60.407,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.3,0.3,0.3],"y":[1,1,1]},"o":{"x":[0.7,0.7,0.7],"y":[0,0,0]},"t":60,"s":[100,100,100]},{"i":{"x":[0.3,0.3,0.3],"y":[1,1,1]},"o":{"x":[0.7,0.7,0.7],"y":[0,0,0]},"t":75,"s":[80,80,100]},{"i":{"x":[0.3,0.3,0.3],"y":[1,1,1]},"o":{"x":[0.7,0.7,0.7],"y":[0,0,0]},"t":90,"s":[100,100,100]},{"i":{"x":[0.3,0.3,0.3],"y":[1,1,1]},"o":{"x":[0.7,0.7,0.7],"y":[0,0,0]},"t":105,"s":[80,80,100]},{"i":{"x":[0.3,0.3,0.3],"y":[1,1,1]},"o":{"x":[0.7,0.7,0.7],"y":[0,0,0]},"t":120,"s":[100,100,100]},{"i":{"x":[0.3,0.3,0.3],"y":[1,1,1]},"o":{"x":[0.7,0.7,0.7],"y":[0,0,0]},"t":135,"s":[80,80,100]},{"t":150,"s":[100,100,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,42.763],[20.044,0],[6.315,-10.692],[13.316,0],[0,-20.044],[0,0]],"o":[[0,-20.044],[-13.316,0],[-6.316,-10.692],[-20.045,0],[0,42.763],[0,0]],"v":[[67.535,-23.862],[31.24,-60.156],[0.001,-42.27],[-31.239,-60.156],[-67.535,-23.862],[0.001,60.156]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.941000007181,0.368999974868,0.337000020345,1],"ix":4,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller').effect('Color 2')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"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":[67.785,60.407],"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":150,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Frame","parent":6,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":2,"s":[48,175,0],"to":[-1.667,0,0],"ti":[-1.667,0,0]},{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":22,"s":[38,175,0],"to":[1.667,0,0],"ti":[-1.667,0,0]},{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":42,"s":[58,175,0],"to":[1.667,0,0],"ti":[1.667,0,0]},{"t":62,"s":[48,175,0]}],"ix":2},"a":{"a":0,"k":[87.958,114.845,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[1.538,5.939],[0,24.823],[-5.712,22.072],[-6.416,0],[0,0],[-2.55,-3.294],[1.042,-4.029],[0,-24.816],[-5.712,-22.066],[2.551,-3.293],[4.164,0],[0,0]],"o":[[-5.712,-22.066],[0,-24.816],[1.351,-6.008],[0,0],[4.164,0],[2.547,3.293],[-5.712,22.072],[0,24.823],[1.042,4.029],[-2.55,3.293],[0,0],[-6.136,0]],"v":[[-49.718,77.414],[-60.919,0],[-49.823,-77.006],[-36.69,-87.5],[46.846,-87.5],[57.491,-82.277],[59.877,-70.663],[51.267,0],[59.877,70.664],[57.491,82.278],[46.846,87.5],[-36.687,87.5]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.372999991623,0.4,0.458999992819,1],"ix":3,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller').effect('Color 3')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":10.938,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[88.264,114.845],"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":150,"st":0,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"Screen","parent":6,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":1,"s":[48,175,0],"to":[-1.667,0,0],"ti":[-1.667,0,0]},{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":21,"s":[38,175,0],"to":[1.667,0,0],"ti":[-1.667,0,0]},{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":41,"s":[58,175,0],"to":[1.667,0,0],"ti":[1.667,0,0]},{"t":61,"s":[48,175,0]}],"ix":2},"a":{"a":0,"k":[60.863,87.75,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[1.538,5.939],[0,24.823],[-5.712,22.072],[-6.416,0],[0,0],[-2.55,-3.294],[1.042,-4.029],[0,-24.816],[-5.712,-22.066],[2.551,-3.293],[4.164,0],[0,0]],"o":[[-5.712,-22.066],[0,-24.816],[1.351,-6.008],[0,0],[4.164,0],[2.547,3.293],[-5.712,22.072],[0,24.823],[1.042,4.029],[-2.55,3.293],[0,0],[-6.136,0]],"v":[[-49.718,77.414],[-60.919,0],[-49.823,-77.006],[-36.69,-87.5],[46.846,-87.5],[57.491,-82.277],[59.877,-70.663],[51.267,0],[59.877,70.664],[57.491,82.278],[46.846,87.5],[-36.687,87.5]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.811999990426,0.811999990426,0.811999990426,1],"ix":4,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller').effect('Color 4')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"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":[61.169,87.75],"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":150,"st":0,"bm":0},{"ddd":0,"ind":6,"ty":4,"nm":"Bracelet","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":0,"s":[280,250,0],"to":[-5,0,0],"ti":[0,0,0]},{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":20,"s":[250,250,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":40,"s":[310,250,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":60,"s":[280,250,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":90,"s":[280,265,0],"to":[0,0,0],"ti":[0,2.5,0]},{"i":{"x":0.5,"y":1},"o":{"x":0.5,"y":0},"t":120,"s":[280,235,0],"to":[0,-2.5,0],"ti":[0,-2.5,0]},{"t":150,"s":[280,250,0]}],"ix":2},"a":{"a":0,"k":[142.442,175.25,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"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":[[174.599,44],[203.654,44]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.811999990426,0.811999990426,0.811999990426,1],"ix":3,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller')('Effects')('Color 4')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":13.672,"ix":5},"lc":1,"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":"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":[[192.364,80.75],[235.938,80.75]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.811999990426,0.811999990426,0.811999990426,1],"ix":3,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller')('Effects')('Color 4')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":13.672,"ix":5},"lc":1,"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":"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],[0,0]],"o":[[0,0],[0,0]],"v":[[207.594,122.75],[251.158,122.75]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.811999990426,0.811999990426,0.811999990426,1],"ix":3,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller')('Effects')('Color 4')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":13.672,"ix":5},"lc":1,"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":"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],[0,0]],"o":[[0,0],[0,0]],"v":[[174.599,306.5],[203.661,306.5]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.811999990426,0.811999990426,0.811999990426,1],"ix":3,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller')('Effects')('Color 4')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":13.672,"ix":5},"lc":1,"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":"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":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[192.368,269.75],[235.942,269.75]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.811999990426,0.811999990426,0.811999990426,1],"ix":3,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller')('Effects')('Color 4')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":13.672,"ix":5},"lc":1,"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":"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":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[207.597,227.75],[251.161,227.75]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.811999990426,0.811999990426,0.811999990426,1],"ix":3,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller')('Effects')('Color 4')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":13.672,"ix":5},"lc":1,"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":"Group 6","np":2,"cix":2,"bm":0,"ix":6,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-15.821,0],[0,0],[0,96.65],[-51.345,0],[0,0],[13.042,-13.122],[0,-66.869],[-29.284,-29.462]],"o":[[0,0],[-51.345,0],[0,-96.65],[0,0],[-15.821,0],[-29.284,29.462],[0,66.869],[13.042,13.122]],"v":[[90.239,175],[2.729,175],[-90.239,0],[2.729,-175],[90.239,-175],[46.484,-154.418],[-2.731,0],[46.484,154.418]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.969000004787,0.741000007181,0.328999986836,1],"ix":4,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller').effect('Color 5')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"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":[90.489,175.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 7","np":2,"cix":2,"bm":0,"ix":7,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[2.651,3.372],[0,60.394],[-24.725,31.447],[-2.834,2.851],[-12.816,2.079],[2.817,0],[0,0],[0,-96.65],[-51.345,0],[0,0],[-2.745,0.459],[10.793,10.86]],"o":[[-24.723,-31.448],[0,-60.397],[2.649,-3.37],[10.801,-10.867],[-2.753,-0.462],[0,0],[-51.345,0],[0,96.65],[0,0],[2.808,0],[-12.807,-2.084],[-2.836,-2.852]],"v":[[42.309,144.995],[1.298,0],[42.313,-145],[50.512,-154.418],[86.21,-174.27],[77.859,-175],[6.757,-175],[-86.21,0],[6.757,175],[77.859,175],[86.184,174.265],[50.512,154.418]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.898000021542,0.588000009574,0.298000021542,1],"ix":4,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller').effect('Color 6')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"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":[102.868,175.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 8","np":2,"cix":2,"bm":0,"ix":8,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[2.649,-3.37],[-1.375,-57.048],[-21.896,21.469],[46.037,7.72],[10.801,-10.867]],"o":[[23.606,30.045],[21.861,21.503],[-2.095,-87.696],[-12.816,2.079],[-2.834,2.851]],"v":[[-64.204,-64.605],[-23.347,72.358],[64.204,72.406],[-20.306,-93.875],[-56.004,-74.023]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.372999991623,0.4,0.458999992819,1],"ix":4,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller')('Effects')('Color 3')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"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":[209.385,94.855],"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 9","np":2,"cix":2,"bm":0,"ix":9,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,91.364],[0.063,2.65],[21.861,21.503],[0,-2.702],[24.723,-31.448],[-2.836,-2.852],[-12.806,-2.084]],"o":[[0,-2.679],[-21.896,21.469],[0.065,2.672],[0,60.394],[2.651,3.372],[10.793,10.859],[47.441,-7.931]],"v":[[64.26,-83.114],[64.152,-91.103],[-23.399,-91.151],[-23.249,-83.114],[-64.26,61.881],[-56.055,71.304],[-20.383,91.151]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.532999973671,0.588000009574,0.638999968884,1],"ix":4,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller').effect('Color 7')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"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":[209.436,258.364],"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 10","np":2,"cix":2,"bm":0,"ix":10,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,-2.686],[29.283,-29.462],[-15.821,0],[0,96.65],[0.063,2.65]],"o":[[0.064,2.656],[0,66.869],[13.042,13.121],[51.345,0],[0,-2.679],[0,0]],"v":[[-19.295,-91.495],[-19.148,-83.505],[-68.361,70.914],[-24.607,91.495],[68.361,-83.505],[68.255,-91.495]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.969000004787,0.741000007181,0.328999986836,1],"ix":4,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller')('Effects')('Color 5')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"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":[216.273,258.755],"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 11","np":2,"cix":2,"bm":0,"ix":11,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[49.922,0],[13.042,-13.122],[-1.529,-63.454],[0,-0.016],[0,0]],"o":[[-15.821,0],[28.1,28.271],[0,0.016],[0,0],[-2.22,-92.939]],"v":[[-24.554,-83.506],[-68.308,-62.924],[-19.243,83.458],[-19.242,83.506],[68.308,83.506]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.898000021542,0.588000009574,0.298000021542,1],"ix":4,"x":"var $bm_rt;\ntry {\n $bm_rt = thisComp.layer('Controller')('Effects')('Color 6')('ADBE Color Control-0001');\n} catch (e) {\n $bm_rt = value;\n}"},"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":[216.219,83.756],"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 12","np":2,"cix":2,"bm":0,"ix":12,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":150,"st":0,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/apps/mobile_app/pubspec.yaml b/apps/mobile_app/pubspec.yaml index b8f14e35..f65a7e8c 100644 --- a/apps/mobile_app/pubspec.yaml +++ b/apps/mobile_app/pubspec.yaml @@ -123,6 +123,7 @@ flutter: # To add assets to your application, add an assets section, like this: assets: - assets/shared/images/ + - assets/shared/animations/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/to/resolution-aware-images diff --git a/modules/legacy/modules/control_panel/lib/src/features/control_panel/presentation/state/control_panel_view_model.dart b/modules/legacy/modules/control_panel/lib/src/features/control_panel/presentation/state/control_panel_view_model.dart index 7e27ba74..c9ea44ff 100644 --- a/modules/legacy/modules/control_panel/lib/src/features/control_panel/presentation/state/control_panel_view_model.dart +++ b/modules/legacy/modules/control_panel/lib/src/features/control_panel/presentation/state/control_panel_view_model.dart @@ -93,6 +93,7 @@ class ControlPanelViewModel extends Notifier { Future refreshPositions() async { if (state.devices.isEmpty) return; + state = state.copyWith(errorMessage: ''); try { final positionLists = await Future.wait( state.devices.map( diff --git a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/activity_meter_screen.dart b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/activity_meter_screen.dart index 813ada40..a1ff6bc9 100644 --- a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/activity_meter_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/activity_meter_screen.dart @@ -7,6 +7,7 @@ import 'package:utils/utils.dart'; import '../../../core/presentation/widgets/time_range_selector.dart'; import 'state/activity_meter_view_model.dart'; +import 'state/activity_meter_view_state.dart'; import 'widgets/steps_bar_chart.dart'; import 'widgets/steps_history_section.dart'; import 'widgets/steps_progress_ring.dart'; @@ -20,12 +21,18 @@ class ActivityMeterScreen extends ConsumerWidget { final theme = ref.watch(themePortProvider); final state = ref.watch(activityMeterViewModelProvider); final vm = ref.read(activityMeterViewModelProvider.notifier); + final device = ref.watch(selectedDeviceProvider); ref.listen( - activityMeterViewModelProvider.select((s) => s.errorMessage), + activityMeterViewModelProvider.select((s) => s.errorEvent), (previous, next) { - if (next.isNotEmpty) { - showTopSnackbar(context, message: next, type: MessageType.error); + if (next != null) { + final message = switch (next) { + ActivityMeterErrorEvent.loadData => context.translate(I18n.errorActivityData), + ActivityMeterErrorEvent.loadMore => context.translate(I18n.errorActivityData), + ActivityMeterErrorEvent.pedometer => context.translate(I18n.errorPedometer), + }; + showTopSnackbar(context, message: message, type: MessageType.error); } }, ); @@ -69,6 +76,43 @@ class ActivityMeterScreen extends ConsumerWidget { ], ), ), + Padding( + padding: EdgeInsets.symmetric( + horizontal: SizeUtils.getByScreen(small: 16, big: 14), + vertical: SizeUtils.getByScreen(small: 4, big: 4), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + context.translate(I18n.activityMeterPedometer), + style: TextStyle( + fontSize: SizeUtils.getByScreen(small: 14, big: 15), + fontWeight: FontWeight.w500, + ), + ), + Switch.adaptive( + value: device?.settings.pedometer ?? false, + activeTrackColor: theme.getColorFor(ThemeCode.legacyPrimary), + onChanged: (value) async { + final success = await vm.togglePedometer(enabled: value); + if (!context.mounted) return; + if (success) { + showTopSnackbar( + context, + message: context.translate( + value + ? I18n.activityMeterPedometerEnabled + : I18n.activityMeterPedometerDisabled, + ), + type: MessageType.success, + ); + } + }, + ), + ], + ), + ), StepsProgressRing( steps: state.todayTotal, goal: state.dailyGoal, diff --git a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/state/activity_meter_view_model.dart b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/state/activity_meter_view_model.dart index 87c2bba2..b29c985a 100644 --- a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/state/activity_meter_view_model.dart +++ b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/state/activity_meter_view_model.dart @@ -79,7 +79,7 @@ class ActivityMeterViewModel extends Notifier { if (!ref.mounted) return; state = state.copyWith( isLoadingMore: false, - errorMessage: _formatError(e), + errorEvent: ActivityMeterErrorEvent.loadMore, ); } } @@ -113,7 +113,7 @@ class ActivityMeterViewModel extends Notifier { await _loadFilteredData(); } catch (e) { if (!ref.mounted) return; - state = state.copyWith(isLoading: false, errorMessage: _formatError(e)); + state = state.copyWith(isLoading: false, errorEvent: ActivityMeterErrorEvent.loadData); } } @@ -157,11 +157,11 @@ class ActivityMeterViewModel extends Notifier { hasMoreHistory: histSteps.length >= _historyPageSize, stats: _computeStats(chartDaily), isLoading: false, - errorMessage: '', + errorEvent: null, ); } catch (e) { if (!ref.mounted) return; - state = state.copyWith(isLoading: false, errorMessage: _formatError(e)); + state = state.copyWith(isLoading: false, errorEvent: ActivityMeterErrorEvent.loadData); } } @@ -243,8 +243,24 @@ class ActivityMeterViewModel extends Notifier { } } - String _formatError(Object e) { - final msg = e.toString(); - return msg.startsWith('Exception: ') ? msg.substring(11) : msg; + Future togglePedometer({required bool enabled}) async { + final device = ref.read(selectedDeviceProvider); + if (device == null) return false; + + state = state.copyWith(errorEvent: null); + try { + final updatedSettings = device.settings.copyWith(pedometer: enabled); + await ref.read(deviceSettingsUpdateProvider).updateDeviceSettings( + device: device, + updatedSettings: updatedSettings, + ); + if (!ref.mounted) return false; + return true; + } catch (e) { + if (!ref.mounted) return false; + state = state.copyWith(errorEvent: ActivityMeterErrorEvent.pedometer); + return false; + } } + } diff --git a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/state/activity_meter_view_state.dart b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/state/activity_meter_view_state.dart index 86f5ad60..140832d6 100644 --- a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/state/activity_meter_view_state.dart +++ b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/state/activity_meter_view_state.dart @@ -4,6 +4,12 @@ import '../../../../core/presentation/time_range.dart'; part 'activity_meter_view_state.freezed.dart'; +enum ActivityMeterErrorEvent { + loadData, + loadMore, + pedometer, +} + @freezed abstract class DailySteps with _$DailySteps { const factory DailySteps({ @@ -36,6 +42,6 @@ abstract class ActivityMeterViewState with _$ActivityMeterViewState { DateTime? customEnd, @Default(true) bool isLoading, @Default(false) bool isLoadingMore, - @Default('') String errorMessage, + ActivityMeterErrorEvent? errorEvent, }) = _ActivityMeterViewState; } diff --git a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/state/activity_meter_view_state.freezed.dart b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/state/activity_meter_view_state.freezed.dart index 53c2392d..03204c6b 100644 --- a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/state/activity_meter_view_state.freezed.dart +++ b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/state/activity_meter_view_state.freezed.dart @@ -537,7 +537,7 @@ as int, /// @nodoc mixin _$ActivityMeterViewState { - int get todayTotal; int get dailyGoal; List get chartData; List get historyData; int get currentHistoryPage; bool get hasMoreHistory; StepsStats get stats; TimeRange get timeRange; DateTime? get customStart; DateTime? get customEnd; bool get isLoading; bool get isLoadingMore; String get errorMessage; + int get todayTotal; int get dailyGoal; List get chartData; List get historyData; int get currentHistoryPage; bool get hasMoreHistory; StepsStats get stats; TimeRange get timeRange; DateTime? get customStart; DateTime? get customEnd; bool get isLoading; bool get isLoadingMore; ActivityMeterErrorEvent? get errorEvent; /// Create a copy of ActivityMeterViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -548,16 +548,16 @@ $ActivityMeterViewStateCopyWith get copyWith => _$Activi @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ActivityMeterViewState&&(identical(other.todayTotal, todayTotal) || other.todayTotal == todayTotal)&&(identical(other.dailyGoal, dailyGoal) || other.dailyGoal == dailyGoal)&&const DeepCollectionEquality().equals(other.chartData, chartData)&&const DeepCollectionEquality().equals(other.historyData, historyData)&&(identical(other.currentHistoryPage, currentHistoryPage) || other.currentHistoryPage == currentHistoryPage)&&(identical(other.hasMoreHistory, hasMoreHistory) || other.hasMoreHistory == hasMoreHistory)&&(identical(other.stats, stats) || other.stats == stats)&&(identical(other.timeRange, timeRange) || other.timeRange == timeRange)&&(identical(other.customStart, customStart) || other.customStart == customStart)&&(identical(other.customEnd, customEnd) || other.customEnd == customEnd)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is ActivityMeterViewState&&(identical(other.todayTotal, todayTotal) || other.todayTotal == todayTotal)&&(identical(other.dailyGoal, dailyGoal) || other.dailyGoal == dailyGoal)&&const DeepCollectionEquality().equals(other.chartData, chartData)&&const DeepCollectionEquality().equals(other.historyData, historyData)&&(identical(other.currentHistoryPage, currentHistoryPage) || other.currentHistoryPage == currentHistoryPage)&&(identical(other.hasMoreHistory, hasMoreHistory) || other.hasMoreHistory == hasMoreHistory)&&(identical(other.stats, stats) || other.stats == stats)&&(identical(other.timeRange, timeRange) || other.timeRange == timeRange)&&(identical(other.customStart, customStart) || other.customStart == customStart)&&(identical(other.customEnd, customEnd) || other.customEnd == customEnd)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)); } @override -int get hashCode => Object.hash(runtimeType,todayTotal,dailyGoal,const DeepCollectionEquality().hash(chartData),const DeepCollectionEquality().hash(historyData),currentHistoryPage,hasMoreHistory,stats,timeRange,customStart,customEnd,isLoading,isLoadingMore,errorMessage); +int get hashCode => Object.hash(runtimeType,todayTotal,dailyGoal,const DeepCollectionEquality().hash(chartData),const DeepCollectionEquality().hash(historyData),currentHistoryPage,hasMoreHistory,stats,timeRange,customStart,customEnd,isLoading,isLoadingMore,errorEvent); @override String toString() { - return 'ActivityMeterViewState(todayTotal: $todayTotal, dailyGoal: $dailyGoal, chartData: $chartData, historyData: $historyData, currentHistoryPage: $currentHistoryPage, hasMoreHistory: $hasMoreHistory, stats: $stats, timeRange: $timeRange, customStart: $customStart, customEnd: $customEnd, isLoading: $isLoading, isLoadingMore: $isLoadingMore, errorMessage: $errorMessage)'; + return 'ActivityMeterViewState(todayTotal: $todayTotal, dailyGoal: $dailyGoal, chartData: $chartData, historyData: $historyData, currentHistoryPage: $currentHistoryPage, hasMoreHistory: $hasMoreHistory, stats: $stats, timeRange: $timeRange, customStart: $customStart, customEnd: $customEnd, isLoading: $isLoading, isLoadingMore: $isLoadingMore, errorEvent: $errorEvent)'; } @@ -568,7 +568,7 @@ abstract mixin class $ActivityMeterViewStateCopyWith<$Res> { factory $ActivityMeterViewStateCopyWith(ActivityMeterViewState value, $Res Function(ActivityMeterViewState) _then) = _$ActivityMeterViewStateCopyWithImpl; @useResult $Res call({ - int todayTotal, int dailyGoal, List chartData, List historyData, int currentHistoryPage, bool hasMoreHistory, StepsStats stats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, String errorMessage + int todayTotal, int dailyGoal, List chartData, List historyData, int currentHistoryPage, bool hasMoreHistory, StepsStats stats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, ActivityMeterErrorEvent? errorEvent }); @@ -585,7 +585,7 @@ class _$ActivityMeterViewStateCopyWithImpl<$Res> /// Create a copy of ActivityMeterViewState /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? todayTotal = null,Object? dailyGoal = null,Object? chartData = null,Object? historyData = null,Object? currentHistoryPage = null,Object? hasMoreHistory = null,Object? stats = null,Object? timeRange = null,Object? customStart = freezed,Object? customEnd = freezed,Object? isLoading = null,Object? isLoadingMore = null,Object? errorMessage = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? todayTotal = null,Object? dailyGoal = null,Object? chartData = null,Object? historyData = null,Object? currentHistoryPage = null,Object? hasMoreHistory = null,Object? stats = null,Object? timeRange = null,Object? customStart = freezed,Object? customEnd = freezed,Object? isLoading = null,Object? isLoadingMore = null,Object? errorEvent = freezed,}) { return _then(_self.copyWith( todayTotal: null == todayTotal ? _self.todayTotal : todayTotal // ignore: cast_nullable_to_non_nullable as int,dailyGoal: null == dailyGoal ? _self.dailyGoal : dailyGoal // ignore: cast_nullable_to_non_nullable @@ -599,8 +599,8 @@ as TimeRange,customStart: freezed == customStart ? _self.customStart : customSta as DateTime?,customEnd: freezed == customEnd ? _self.customEnd : customEnd // ignore: cast_nullable_to_non_nullable as DateTime?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable as bool,isLoadingMore: null == isLoadingMore ? _self.isLoadingMore : isLoadingMore // ignore: cast_nullable_to_non_nullable -as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable -as String, +as bool,errorEvent: freezed == errorEvent ? _self.errorEvent : errorEvent // ignore: cast_nullable_to_non_nullable +as ActivityMeterErrorEvent?, )); } /// Create a copy of ActivityMeterViewState @@ -694,10 +694,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( int todayTotal, int dailyGoal, List chartData, List historyData, int currentHistoryPage, bool hasMoreHistory, StepsStats stats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( int todayTotal, int dailyGoal, List chartData, List historyData, int currentHistoryPage, bool hasMoreHistory, StepsStats stats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, ActivityMeterErrorEvent? errorEvent)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _ActivityMeterViewState() when $default != null: -return $default(_that.todayTotal,_that.dailyGoal,_that.chartData,_that.historyData,_that.currentHistoryPage,_that.hasMoreHistory,_that.stats,_that.timeRange,_that.customStart,_that.customEnd,_that.isLoading,_that.isLoadingMore,_that.errorMessage);case _: +return $default(_that.todayTotal,_that.dailyGoal,_that.chartData,_that.historyData,_that.currentHistoryPage,_that.hasMoreHistory,_that.stats,_that.timeRange,_that.customStart,_that.customEnd,_that.isLoading,_that.isLoadingMore,_that.errorEvent);case _: return orElse(); } @@ -715,10 +715,10 @@ return $default(_that.todayTotal,_that.dailyGoal,_that.chartData,_that.historyDa /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( int todayTotal, int dailyGoal, List chartData, List historyData, int currentHistoryPage, bool hasMoreHistory, StepsStats stats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, String errorMessage) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( int todayTotal, int dailyGoal, List chartData, List historyData, int currentHistoryPage, bool hasMoreHistory, StepsStats stats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, ActivityMeterErrorEvent? errorEvent) $default,) {final _that = this; switch (_that) { case _ActivityMeterViewState(): -return $default(_that.todayTotal,_that.dailyGoal,_that.chartData,_that.historyData,_that.currentHistoryPage,_that.hasMoreHistory,_that.stats,_that.timeRange,_that.customStart,_that.customEnd,_that.isLoading,_that.isLoadingMore,_that.errorMessage);case _: +return $default(_that.todayTotal,_that.dailyGoal,_that.chartData,_that.historyData,_that.currentHistoryPage,_that.hasMoreHistory,_that.stats,_that.timeRange,_that.customStart,_that.customEnd,_that.isLoading,_that.isLoadingMore,_that.errorEvent);case _: throw StateError('Unexpected subclass'); } @@ -735,10 +735,10 @@ return $default(_that.todayTotal,_that.dailyGoal,_that.chartData,_that.historyDa /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( int todayTotal, int dailyGoal, List chartData, List historyData, int currentHistoryPage, bool hasMoreHistory, StepsStats stats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, String errorMessage)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( int todayTotal, int dailyGoal, List chartData, List historyData, int currentHistoryPage, bool hasMoreHistory, StepsStats stats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, ActivityMeterErrorEvent? errorEvent)? $default,) {final _that = this; switch (_that) { case _ActivityMeterViewState() when $default != null: -return $default(_that.todayTotal,_that.dailyGoal,_that.chartData,_that.historyData,_that.currentHistoryPage,_that.hasMoreHistory,_that.stats,_that.timeRange,_that.customStart,_that.customEnd,_that.isLoading,_that.isLoadingMore,_that.errorMessage);case _: +return $default(_that.todayTotal,_that.dailyGoal,_that.chartData,_that.historyData,_that.currentHistoryPage,_that.hasMoreHistory,_that.stats,_that.timeRange,_that.customStart,_that.customEnd,_that.isLoading,_that.isLoadingMore,_that.errorEvent);case _: return null; } @@ -750,7 +750,7 @@ return $default(_that.todayTotal,_that.dailyGoal,_that.chartData,_that.historyDa class _ActivityMeterViewState implements ActivityMeterViewState { - const _ActivityMeterViewState({this.todayTotal = 0, this.dailyGoal = 8000, final List chartData = const [], final List historyData = const [], this.currentHistoryPage = 1, this.hasMoreHistory = false, this.stats = const StepsStats(), this.timeRange = TimeRange.today, this.customStart, this.customEnd, this.isLoading = true, this.isLoadingMore = false, this.errorMessage = ''}): _chartData = chartData,_historyData = historyData; + const _ActivityMeterViewState({this.todayTotal = 0, this.dailyGoal = 8000, final List chartData = const [], final List historyData = const [], this.currentHistoryPage = 1, this.hasMoreHistory = false, this.stats = const StepsStats(), this.timeRange = TimeRange.today, this.customStart, this.customEnd, this.isLoading = true, this.isLoadingMore = false, this.errorEvent}): _chartData = chartData,_historyData = historyData; @override@JsonKey() final int todayTotal; @@ -777,7 +777,7 @@ class _ActivityMeterViewState implements ActivityMeterViewState { @override final DateTime? customEnd; @override@JsonKey() final bool isLoading; @override@JsonKey() final bool isLoadingMore; -@override@JsonKey() final String errorMessage; +@override final ActivityMeterErrorEvent? errorEvent; /// Create a copy of ActivityMeterViewState /// with the given fields replaced by the non-null parameter values. @@ -789,16 +789,16 @@ _$ActivityMeterViewStateCopyWith<_ActivityMeterViewState> get copyWith => __$Act @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _ActivityMeterViewState&&(identical(other.todayTotal, todayTotal) || other.todayTotal == todayTotal)&&(identical(other.dailyGoal, dailyGoal) || other.dailyGoal == dailyGoal)&&const DeepCollectionEquality().equals(other._chartData, _chartData)&&const DeepCollectionEquality().equals(other._historyData, _historyData)&&(identical(other.currentHistoryPage, currentHistoryPage) || other.currentHistoryPage == currentHistoryPage)&&(identical(other.hasMoreHistory, hasMoreHistory) || other.hasMoreHistory == hasMoreHistory)&&(identical(other.stats, stats) || other.stats == stats)&&(identical(other.timeRange, timeRange) || other.timeRange == timeRange)&&(identical(other.customStart, customStart) || other.customStart == customStart)&&(identical(other.customEnd, customEnd) || other.customEnd == customEnd)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ActivityMeterViewState&&(identical(other.todayTotal, todayTotal) || other.todayTotal == todayTotal)&&(identical(other.dailyGoal, dailyGoal) || other.dailyGoal == dailyGoal)&&const DeepCollectionEquality().equals(other._chartData, _chartData)&&const DeepCollectionEquality().equals(other._historyData, _historyData)&&(identical(other.currentHistoryPage, currentHistoryPage) || other.currentHistoryPage == currentHistoryPage)&&(identical(other.hasMoreHistory, hasMoreHistory) || other.hasMoreHistory == hasMoreHistory)&&(identical(other.stats, stats) || other.stats == stats)&&(identical(other.timeRange, timeRange) || other.timeRange == timeRange)&&(identical(other.customStart, customStart) || other.customStart == customStart)&&(identical(other.customEnd, customEnd) || other.customEnd == customEnd)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)); } @override -int get hashCode => Object.hash(runtimeType,todayTotal,dailyGoal,const DeepCollectionEquality().hash(_chartData),const DeepCollectionEquality().hash(_historyData),currentHistoryPage,hasMoreHistory,stats,timeRange,customStart,customEnd,isLoading,isLoadingMore,errorMessage); +int get hashCode => Object.hash(runtimeType,todayTotal,dailyGoal,const DeepCollectionEquality().hash(_chartData),const DeepCollectionEquality().hash(_historyData),currentHistoryPage,hasMoreHistory,stats,timeRange,customStart,customEnd,isLoading,isLoadingMore,errorEvent); @override String toString() { - return 'ActivityMeterViewState(todayTotal: $todayTotal, dailyGoal: $dailyGoal, chartData: $chartData, historyData: $historyData, currentHistoryPage: $currentHistoryPage, hasMoreHistory: $hasMoreHistory, stats: $stats, timeRange: $timeRange, customStart: $customStart, customEnd: $customEnd, isLoading: $isLoading, isLoadingMore: $isLoadingMore, errorMessage: $errorMessage)'; + return 'ActivityMeterViewState(todayTotal: $todayTotal, dailyGoal: $dailyGoal, chartData: $chartData, historyData: $historyData, currentHistoryPage: $currentHistoryPage, hasMoreHistory: $hasMoreHistory, stats: $stats, timeRange: $timeRange, customStart: $customStart, customEnd: $customEnd, isLoading: $isLoading, isLoadingMore: $isLoadingMore, errorEvent: $errorEvent)'; } @@ -809,7 +809,7 @@ abstract mixin class _$ActivityMeterViewStateCopyWith<$Res> implements $Activity factory _$ActivityMeterViewStateCopyWith(_ActivityMeterViewState value, $Res Function(_ActivityMeterViewState) _then) = __$ActivityMeterViewStateCopyWithImpl; @override @useResult $Res call({ - int todayTotal, int dailyGoal, List chartData, List historyData, int currentHistoryPage, bool hasMoreHistory, StepsStats stats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, String errorMessage + int todayTotal, int dailyGoal, List chartData, List historyData, int currentHistoryPage, bool hasMoreHistory, StepsStats stats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, ActivityMeterErrorEvent? errorEvent }); @@ -826,7 +826,7 @@ class __$ActivityMeterViewStateCopyWithImpl<$Res> /// Create a copy of ActivityMeterViewState /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? todayTotal = null,Object? dailyGoal = null,Object? chartData = null,Object? historyData = null,Object? currentHistoryPage = null,Object? hasMoreHistory = null,Object? stats = null,Object? timeRange = null,Object? customStart = freezed,Object? customEnd = freezed,Object? isLoading = null,Object? isLoadingMore = null,Object? errorMessage = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? todayTotal = null,Object? dailyGoal = null,Object? chartData = null,Object? historyData = null,Object? currentHistoryPage = null,Object? hasMoreHistory = null,Object? stats = null,Object? timeRange = null,Object? customStart = freezed,Object? customEnd = freezed,Object? isLoading = null,Object? isLoadingMore = null,Object? errorEvent = freezed,}) { return _then(_ActivityMeterViewState( todayTotal: null == todayTotal ? _self.todayTotal : todayTotal // ignore: cast_nullable_to_non_nullable as int,dailyGoal: null == dailyGoal ? _self.dailyGoal : dailyGoal // ignore: cast_nullable_to_non_nullable @@ -840,8 +840,8 @@ as TimeRange,customStart: freezed == customStart ? _self.customStart : customSta as DateTime?,customEnd: freezed == customEnd ? _self.customEnd : customEnd // ignore: cast_nullable_to_non_nullable as DateTime?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable as bool,isLoadingMore: null == isLoadingMore ? _self.isLoadingMore : isLoadingMore // ignore: cast_nullable_to_non_nullable -as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable -as String, +as bool,errorEvent: freezed == errorEvent ? _self.errorEvent : errorEvent // ignore: cast_nullable_to_non_nullable +as ActivityMeterErrorEvent?, )); } diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/health_screen.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/health_screen.dart index a6982284..a6ab97c9 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/health_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/health_screen.dart @@ -2,11 +2,13 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; +import 'package:lottie/lottie.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; import 'state/health_view_model.dart'; +import 'state/health_view_state.dart'; import 'widgets/blood_pressure_tab.dart'; import 'widgets/health_summary_cards.dart'; import 'widgets/heart_rate_tab.dart'; @@ -55,13 +57,20 @@ class _HealthScreenState extends ConsumerState final theme = ref.watch(themePortProvider); final state = ref.watch(healthViewModelProvider); final vm = ref.read(healthViewModelProvider.notifier); + final device = ref.watch(selectedDeviceProvider); - ref.listen(healthViewModelProvider.select((s) => s.errorMessage), ( + ref.listen(healthViewModelProvider.select((s) => s.errorEvent), ( previous, next, ) { - if (next.isNotEmpty) { - showTopSnackbar(context, message: next, type: MessageType.error); + if (next != null) { + final message = switch (next) { + HealthErrorEvent.loadData => context.translate(I18n.errorHealthData), + HealthErrorEvent.loadMore => context.translate(I18n.errorHealthData), + HealthErrorEvent.measure => context.translate(I18n.errorHealthMeasure), + HealthErrorEvent.heartRateFrequency => context.translate(I18n.errorHeartRateFrequency), + }; + showTopSnackbar(context, message: message, type: MessageType.error); } }); @@ -70,7 +79,12 @@ class _HealthScreenState extends ConsumerState title: context.translate(I18n.health), body: state.isLoading ? const Center(child: CircularProgressIndicator()) - : Column( + : state.isMeasuringCountdown + ? _MeasuringOverlay( + remainingSeconds: state.measureRemainingSeconds, + theme: theme, + ) + : Column( children: [ HealthSummaryCards( heartbeats: state.latestHeartbeats, @@ -84,6 +98,31 @@ class _HealthScreenState extends ConsumerState onCustomTap: () => _pickCustomRange(vm), theme: theme, ), + if (device?.capabilities?.heartbeats != null && + device!.capabilities!.heartbeats!.options.isNotEmpty) + _HeartRateFrequencySelector( + currentFrequency: + device.settings.frequencyHeartRate, + options: + device.capabilities!.heartbeats!.options, + theme: theme, + onChanged: (frequency) async { + final success = + await vm.updateHeartRateFrequency( + frequency: frequency); + if (!context.mounted) return; + if (success) { + showTopSnackbar( + context, + message: context.translate( + I18n.locationFrequencyUpdated, + args: {'minutes': '${frequency ~/ 60}'}, + ), + type: MessageType.success, + ); + } + }, + ), TabBar( controller: _tabController, labelColor: theme.getColorFor(ThemeCode.legacyPrimary), @@ -141,18 +180,123 @@ class _SaveSection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final theme = ref.read(themePortProvider); - final vm = ref.read(healthViewModelProvider.notifier); + final isMeasuring = ref.watch( + healthViewModelProvider.select((s) => s.isMeasuring), + ); + final isCountdown = ref.watch( + healthViewModelProvider.select((s) => s.isMeasuringCountdown), + ); + + if (isCountdown) return const SizedBox.shrink(); return Padding( padding: EdgeInsets.symmetric(horizontal: 24, vertical: 10), child: PrimaryButton( - onPressed: () async { - await vm.measure(); - }, - text: context.translate(I18n.measure), + onPressed: isMeasuring ? null : () => vm.measure(), + text: isMeasuring + ? '...' + : context.translate(I18n.measure), color: theme.getColorFor(ThemeCode.legacyPrimary), ), ); } } + +class _HeartRateFrequencySelector extends StatelessWidget { + final int currentFrequency; + final List options; + final ThemePort theme; + final ValueChanged onChanged; + + const _HeartRateFrequencySelector({ + required this.currentFrequency, + required this.options, + required this.theme, + required this.onChanged, + }); + + @override + Widget build(BuildContext context) { + final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Row( + children: [ + Icon(Icons.timer_outlined, size: 18, color: primaryColor), + const SizedBox(width: 8), + Text( + context.translate(I18n.healthFrequency), + style: TextStyle(fontSize: 13, color: primaryColor), + ), + const Spacer(), + ...options.map( + (opt) => Padding( + padding: const EdgeInsets.only(left: 6), + child: ChoiceChip( + label: Text('${opt ~/ 60}m'), + selected: opt == currentFrequency, + selectedColor: primaryColor, + labelStyle: TextStyle( + fontSize: 12, + color: opt == currentFrequency ? Colors.white : primaryColor, + ), + side: BorderSide(color: primaryColor), + onSelected: (_) => onChanged(opt), + visualDensity: VisualDensity.compact, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + ), + ), + ], + ), + ); + } +} + +class _MeasuringOverlay extends StatelessWidget { + final int remainingSeconds; + final ThemePort theme; + + const _MeasuringOverlay({ + required this.remainingSeconds, + required this.theme, + }); + + @override + Widget build(BuildContext context) { + final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + + return Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Lottie.asset( + 'assets/shared/animations/fitness_tracker.json', + width: 200, + height: 200, + ), + const SizedBox(height: 24), + Text( + context.translate(I18n.healthMeasuring), + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: primaryColor, + ), + ), + const SizedBox(height: 12), + Text( + '${remainingSeconds}s', + style: TextStyle( + fontSize: 32, + fontWeight: FontWeight.bold, + color: primaryColor, + ), + ), + ], + ), + ); + } +} diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/state/health_view_model.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/state/health_view_model.dart index 9433affe..9c88db4c 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/state/health_view_model.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/state/health_view_model.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -7,6 +9,18 @@ import '../../../../core/domain/repositories/health_repository.dart'; import '../../../../core/providers/health_repository_provider.dart'; import 'health_view_state.dart'; +final _measureEndTimeProvider = + NotifierProvider<_MeasureEndTimeNotifier, DateTime?>( + _MeasureEndTimeNotifier.new, +); + +class _MeasureEndTimeNotifier extends Notifier { + @override + DateTime? build() => null; + + void set(DateTime? value) => state = value; +} + final healthViewModelProvider = NotifierProvider.autoDispose( HealthViewModel.new, @@ -15,24 +29,46 @@ final healthViewModelProvider = class HealthViewModel extends Notifier { late final HealthRepository _repository; late final CommandsRepository _commandsRepository; + Timer? _measureTimer; static const int _historyPageSize = 20; + static const int _measureDurationSeconds = 35; @override HealthViewState build() { _repository = ref.read(healthRepositoryProvider); _commandsRepository = ref.read(commandsRepositoryProvider); _init(); + _resumeMeasureIfNeeded(); return const HealthViewState(); } + void _resumeMeasureIfNeeded() { + final endTime = ref.read(_measureEndTimeProvider); + if (endTime == null) return; + + final remaining = endTime.difference(DateTime.now()).inSeconds; + if (remaining <= 0) { + ref.read(_measureEndTimeProvider.notifier).set(null); + return; + } + + Future.microtask(() { + state = state.copyWith( + isMeasuringCountdown: true, + measureRemainingSeconds: remaining, + ); + _startCountdownTimer(); + }); + } + String? get _identificator => ref.read(selectedDeviceProvider)?.identificator; Future selectTimeRange(TimeRange range) async { if (range == state.timeRange) return; - state = state.copyWith(timeRange: range, isLoading: true); + state = state.copyWith(timeRange: range, isLoading: true, errorEvent: null); await _loadFilteredData(); } @@ -42,6 +78,7 @@ class HealthViewModel extends Notifier { customStart: start, customEnd: end, isLoading: true, + errorEvent: null, ); await _loadFilteredData(); } @@ -91,7 +128,7 @@ class HealthViewModel extends Notifier { if (!ref.mounted) return; state = state.copyWith( isLoadingMore: false, - errorMessage: _formatError(e), + errorEvent: HealthErrorEvent.loadMore, ); } } @@ -131,7 +168,7 @@ class HealthViewModel extends Notifier { await _loadFilteredData(); } catch (e) { if (!ref.mounted) return; - state = state.copyWith(isLoading: false, errorMessage: _formatError(e)); + state = state.copyWith(isLoading: false, errorEvent: HealthErrorEvent.loadData); } } @@ -201,11 +238,11 @@ class HealthViewModel extends Notifier { chartOxygens.map((e) => e.oxygen).toList(), ), isLoading: false, - errorMessage: '', + errorEvent: null, ); } catch (e) { if (!ref.mounted) return; - state = state.copyWith(isLoading: false, errorMessage: _formatError(e)); + state = state.copyWith(isLoading: false, errorEvent: HealthErrorEvent.loadData); } } @@ -245,9 +282,25 @@ class HealthViewModel extends Notifier { ); } - String _formatError(Object e) { - final msg = e.toString(); - return msg.startsWith('Exception: ') ? msg.substring(11) : msg; + Future updateHeartRateFrequency({required int frequency}) async { + final device = ref.read(selectedDeviceProvider); + if (device == null) return false; + + try { + final updatedSettings = device.settings.copyWith( + frequencyHeartRate: frequency, + ); + await ref.read(deviceSettingsUpdateProvider).updateDeviceSettings( + device: device, + updatedSettings: updatedSettings, + ); + if (!ref.mounted) return false; + return true; + } catch (e) { + if (!ref.mounted) return false; + state = state.copyWith(errorEvent: HealthErrorEvent.heartRateFrequency); + return false; + } } Future measure() async { @@ -255,23 +308,54 @@ class HealthViewModel extends Notifier { if (device == null) return; try { - state = state.copyWith(isLoading: true); + state = state.copyWith(isMeasuring: true, errorEvent: null); final request = SendCommandRequestModel( device: device.identificator, command: DeviceCommand.requestHeartRate, ); - await _commandsRepository.send(request: request); if (!ref.mounted) return; - state = state.copyWith(isLoading: false); + ref.read(_measureEndTimeProvider.notifier).set( + DateTime.now().add(const Duration(seconds: _measureDurationSeconds))); + + state = state.copyWith( + isMeasuring: false, + isMeasuringCountdown: true, + measureRemainingSeconds: _measureDurationSeconds, + ); + + _startCountdownTimer(); } catch (e) { if (!ref.mounted) return; state = state.copyWith( - isLoading: false, - errorMessage: _formatError(e), + isMeasuring: false, + errorEvent: HealthErrorEvent.measure, ); } } + + void _startCountdownTimer() { + _measureTimer?.cancel(); + _measureTimer = Timer.periodic(const Duration(seconds: 1), (timer) { + if (!ref.mounted) { + timer.cancel(); + return; + } + final remaining = state.measureRemainingSeconds - 1; + if (remaining <= 0) { + timer.cancel(); + _measureTimer = null; + ref.read(_measureEndTimeProvider.notifier).set(null); + state = state.copyWith( + isMeasuringCountdown: false, + measureRemainingSeconds: 0, + ); + _init(); + } else { + state = state.copyWith(measureRemainingSeconds: remaining); + } + }); + } } diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/state/health_view_state.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/state/health_view_state.dart index c186fa52..50fede91 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/state/health_view_state.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/state/health_view_state.dart @@ -6,6 +6,13 @@ import '../../domain/entities/oxygen_entity.dart'; part 'health_view_state.freezed.dart'; +enum HealthErrorEvent { + loadData, + loadMore, + measure, + heartRateFrequency, +} + @freezed abstract class HealthStats with _$HealthStats { const factory HealthStats({ @@ -33,6 +40,9 @@ abstract class HealthViewState with _$HealthViewState { @Default(null) DateTime? customEnd, @Default(true) bool isLoading, @Default(false) bool isLoadingMore, - @Default('') String errorMessage, + @Default(false) bool isMeasuring, + @Default(false) bool isMeasuringCountdown, + @Default(0) int measureRemainingSeconds, + HealthErrorEvent? errorEvent, }) = _HealthViewState; } diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/state/health_view_state.freezed.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/state/health_view_state.freezed.dart index e8798e1e..e5144f44 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/state/health_view_state.freezed.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/state/health_view_state.freezed.dart @@ -277,7 +277,7 @@ as int, /// @nodoc mixin _$HealthViewState { - List get latestHeartbeats; List get latestOxygens; List get chartHeartbeats; List get chartOxygens; List get historyHeartbeats; List get historyOxygens; int get currentHistoryPage; bool get hasMoreHistory; HealthStats get heartRateStats; HealthStats get oxygenStats; TimeRange get timeRange; DateTime? get customStart; DateTime? get customEnd; bool get isLoading; bool get isLoadingMore; String get errorMessage; + List get latestHeartbeats; List get latestOxygens; List get chartHeartbeats; List get chartOxygens; List get historyHeartbeats; List get historyOxygens; int get currentHistoryPage; bool get hasMoreHistory; HealthStats get heartRateStats; HealthStats get oxygenStats; TimeRange get timeRange; DateTime? get customStart; DateTime? get customEnd; bool get isLoading; bool get isLoadingMore; bool get isMeasuring; bool get isMeasuringCountdown; int get measureRemainingSeconds; HealthErrorEvent? get errorEvent; /// Create a copy of HealthViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -288,16 +288,16 @@ $HealthViewStateCopyWith get copyWith => _$HealthViewStateCopyW @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is HealthViewState&&const DeepCollectionEquality().equals(other.latestHeartbeats, latestHeartbeats)&&const DeepCollectionEquality().equals(other.latestOxygens, latestOxygens)&&const DeepCollectionEquality().equals(other.chartHeartbeats, chartHeartbeats)&&const DeepCollectionEquality().equals(other.chartOxygens, chartOxygens)&&const DeepCollectionEquality().equals(other.historyHeartbeats, historyHeartbeats)&&const DeepCollectionEquality().equals(other.historyOxygens, historyOxygens)&&(identical(other.currentHistoryPage, currentHistoryPage) || other.currentHistoryPage == currentHistoryPage)&&(identical(other.hasMoreHistory, hasMoreHistory) || other.hasMoreHistory == hasMoreHistory)&&(identical(other.heartRateStats, heartRateStats) || other.heartRateStats == heartRateStats)&&(identical(other.oxygenStats, oxygenStats) || other.oxygenStats == oxygenStats)&&(identical(other.timeRange, timeRange) || other.timeRange == timeRange)&&(identical(other.customStart, customStart) || other.customStart == customStart)&&(identical(other.customEnd, customEnd) || other.customEnd == customEnd)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is HealthViewState&&const DeepCollectionEquality().equals(other.latestHeartbeats, latestHeartbeats)&&const DeepCollectionEquality().equals(other.latestOxygens, latestOxygens)&&const DeepCollectionEquality().equals(other.chartHeartbeats, chartHeartbeats)&&const DeepCollectionEquality().equals(other.chartOxygens, chartOxygens)&&const DeepCollectionEquality().equals(other.historyHeartbeats, historyHeartbeats)&&const DeepCollectionEquality().equals(other.historyOxygens, historyOxygens)&&(identical(other.currentHistoryPage, currentHistoryPage) || other.currentHistoryPage == currentHistoryPage)&&(identical(other.hasMoreHistory, hasMoreHistory) || other.hasMoreHistory == hasMoreHistory)&&(identical(other.heartRateStats, heartRateStats) || other.heartRateStats == heartRateStats)&&(identical(other.oxygenStats, oxygenStats) || other.oxygenStats == oxygenStats)&&(identical(other.timeRange, timeRange) || other.timeRange == timeRange)&&(identical(other.customStart, customStart) || other.customStart == customStart)&&(identical(other.customEnd, customEnd) || other.customEnd == customEnd)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.isMeasuring, isMeasuring) || other.isMeasuring == isMeasuring)&&(identical(other.isMeasuringCountdown, isMeasuringCountdown) || other.isMeasuringCountdown == isMeasuringCountdown)&&(identical(other.measureRemainingSeconds, measureRemainingSeconds) || other.measureRemainingSeconds == measureRemainingSeconds)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)); } @override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(latestHeartbeats),const DeepCollectionEquality().hash(latestOxygens),const DeepCollectionEquality().hash(chartHeartbeats),const DeepCollectionEquality().hash(chartOxygens),const DeepCollectionEquality().hash(historyHeartbeats),const DeepCollectionEquality().hash(historyOxygens),currentHistoryPage,hasMoreHistory,heartRateStats,oxygenStats,timeRange,customStart,customEnd,isLoading,isLoadingMore,errorMessage); +int get hashCode => Object.hashAll([runtimeType,const DeepCollectionEquality().hash(latestHeartbeats),const DeepCollectionEquality().hash(latestOxygens),const DeepCollectionEquality().hash(chartHeartbeats),const DeepCollectionEquality().hash(chartOxygens),const DeepCollectionEquality().hash(historyHeartbeats),const DeepCollectionEquality().hash(historyOxygens),currentHistoryPage,hasMoreHistory,heartRateStats,oxygenStats,timeRange,customStart,customEnd,isLoading,isLoadingMore,isMeasuring,isMeasuringCountdown,measureRemainingSeconds,errorEvent]); @override String toString() { - return 'HealthViewState(latestHeartbeats: $latestHeartbeats, latestOxygens: $latestOxygens, chartHeartbeats: $chartHeartbeats, chartOxygens: $chartOxygens, historyHeartbeats: $historyHeartbeats, historyOxygens: $historyOxygens, currentHistoryPage: $currentHistoryPage, hasMoreHistory: $hasMoreHistory, heartRateStats: $heartRateStats, oxygenStats: $oxygenStats, timeRange: $timeRange, customStart: $customStart, customEnd: $customEnd, isLoading: $isLoading, isLoadingMore: $isLoadingMore, errorMessage: $errorMessage)'; + return 'HealthViewState(latestHeartbeats: $latestHeartbeats, latestOxygens: $latestOxygens, chartHeartbeats: $chartHeartbeats, chartOxygens: $chartOxygens, historyHeartbeats: $historyHeartbeats, historyOxygens: $historyOxygens, currentHistoryPage: $currentHistoryPage, hasMoreHistory: $hasMoreHistory, heartRateStats: $heartRateStats, oxygenStats: $oxygenStats, timeRange: $timeRange, customStart: $customStart, customEnd: $customEnd, isLoading: $isLoading, isLoadingMore: $isLoadingMore, isMeasuring: $isMeasuring, isMeasuringCountdown: $isMeasuringCountdown, measureRemainingSeconds: $measureRemainingSeconds, errorEvent: $errorEvent)'; } @@ -308,7 +308,7 @@ abstract mixin class $HealthViewStateCopyWith<$Res> { factory $HealthViewStateCopyWith(HealthViewState value, $Res Function(HealthViewState) _then) = _$HealthViewStateCopyWithImpl; @useResult $Res call({ - List latestHeartbeats, List latestOxygens, List chartHeartbeats, List chartOxygens, List historyHeartbeats, List historyOxygens, int currentHistoryPage, bool hasMoreHistory, HealthStats heartRateStats, HealthStats oxygenStats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, String errorMessage + List latestHeartbeats, List latestOxygens, List chartHeartbeats, List chartOxygens, List historyHeartbeats, List historyOxygens, int currentHistoryPage, bool hasMoreHistory, HealthStats heartRateStats, HealthStats oxygenStats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, bool isMeasuring, bool isMeasuringCountdown, int measureRemainingSeconds, HealthErrorEvent? errorEvent }); @@ -325,7 +325,7 @@ class _$HealthViewStateCopyWithImpl<$Res> /// Create a copy of HealthViewState /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? latestHeartbeats = null,Object? latestOxygens = null,Object? chartHeartbeats = null,Object? chartOxygens = null,Object? historyHeartbeats = null,Object? historyOxygens = null,Object? currentHistoryPage = null,Object? hasMoreHistory = null,Object? heartRateStats = null,Object? oxygenStats = null,Object? timeRange = null,Object? customStart = freezed,Object? customEnd = freezed,Object? isLoading = null,Object? isLoadingMore = null,Object? errorMessage = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? latestHeartbeats = null,Object? latestOxygens = null,Object? chartHeartbeats = null,Object? chartOxygens = null,Object? historyHeartbeats = null,Object? historyOxygens = null,Object? currentHistoryPage = null,Object? hasMoreHistory = null,Object? heartRateStats = null,Object? oxygenStats = null,Object? timeRange = null,Object? customStart = freezed,Object? customEnd = freezed,Object? isLoading = null,Object? isLoadingMore = null,Object? isMeasuring = null,Object? isMeasuringCountdown = null,Object? measureRemainingSeconds = null,Object? errorEvent = freezed,}) { return _then(_self.copyWith( latestHeartbeats: null == latestHeartbeats ? _self.latestHeartbeats : latestHeartbeats // ignore: cast_nullable_to_non_nullable as List,latestOxygens: null == latestOxygens ? _self.latestOxygens : latestOxygens // ignore: cast_nullable_to_non_nullable @@ -342,8 +342,11 @@ as TimeRange,customStart: freezed == customStart ? _self.customStart : customSta as DateTime?,customEnd: freezed == customEnd ? _self.customEnd : customEnd // ignore: cast_nullable_to_non_nullable as DateTime?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable as bool,isLoadingMore: null == isLoadingMore ? _self.isLoadingMore : isLoadingMore // ignore: cast_nullable_to_non_nullable -as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable -as String, +as bool,isMeasuring: null == isMeasuring ? _self.isMeasuring : isMeasuring // ignore: cast_nullable_to_non_nullable +as bool,isMeasuringCountdown: null == isMeasuringCountdown ? _self.isMeasuringCountdown : isMeasuringCountdown // ignore: cast_nullable_to_non_nullable +as bool,measureRemainingSeconds: null == measureRemainingSeconds ? _self.measureRemainingSeconds : measureRemainingSeconds // ignore: cast_nullable_to_non_nullable +as int,errorEvent: freezed == errorEvent ? _self.errorEvent : errorEvent // ignore: cast_nullable_to_non_nullable +as HealthErrorEvent?, )); } /// Create a copy of HealthViewState @@ -446,10 +449,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( List latestHeartbeats, List latestOxygens, List chartHeartbeats, List chartOxygens, List historyHeartbeats, List historyOxygens, int currentHistoryPage, bool hasMoreHistory, HealthStats heartRateStats, HealthStats oxygenStats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( List latestHeartbeats, List latestOxygens, List chartHeartbeats, List chartOxygens, List historyHeartbeats, List historyOxygens, int currentHistoryPage, bool hasMoreHistory, HealthStats heartRateStats, HealthStats oxygenStats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, bool isMeasuring, bool isMeasuringCountdown, int measureRemainingSeconds, HealthErrorEvent? errorEvent)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _HealthViewState() when $default != null: -return $default(_that.latestHeartbeats,_that.latestOxygens,_that.chartHeartbeats,_that.chartOxygens,_that.historyHeartbeats,_that.historyOxygens,_that.currentHistoryPage,_that.hasMoreHistory,_that.heartRateStats,_that.oxygenStats,_that.timeRange,_that.customStart,_that.customEnd,_that.isLoading,_that.isLoadingMore,_that.errorMessage);case _: +return $default(_that.latestHeartbeats,_that.latestOxygens,_that.chartHeartbeats,_that.chartOxygens,_that.historyHeartbeats,_that.historyOxygens,_that.currentHistoryPage,_that.hasMoreHistory,_that.heartRateStats,_that.oxygenStats,_that.timeRange,_that.customStart,_that.customEnd,_that.isLoading,_that.isLoadingMore,_that.isMeasuring,_that.isMeasuringCountdown,_that.measureRemainingSeconds,_that.errorEvent);case _: return orElse(); } @@ -467,10 +470,10 @@ return $default(_that.latestHeartbeats,_that.latestOxygens,_that.chartHeartbeats /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( List latestHeartbeats, List latestOxygens, List chartHeartbeats, List chartOxygens, List historyHeartbeats, List historyOxygens, int currentHistoryPage, bool hasMoreHistory, HealthStats heartRateStats, HealthStats oxygenStats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, String errorMessage) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( List latestHeartbeats, List latestOxygens, List chartHeartbeats, List chartOxygens, List historyHeartbeats, List historyOxygens, int currentHistoryPage, bool hasMoreHistory, HealthStats heartRateStats, HealthStats oxygenStats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, bool isMeasuring, bool isMeasuringCountdown, int measureRemainingSeconds, HealthErrorEvent? errorEvent) $default,) {final _that = this; switch (_that) { case _HealthViewState(): -return $default(_that.latestHeartbeats,_that.latestOxygens,_that.chartHeartbeats,_that.chartOxygens,_that.historyHeartbeats,_that.historyOxygens,_that.currentHistoryPage,_that.hasMoreHistory,_that.heartRateStats,_that.oxygenStats,_that.timeRange,_that.customStart,_that.customEnd,_that.isLoading,_that.isLoadingMore,_that.errorMessage);case _: +return $default(_that.latestHeartbeats,_that.latestOxygens,_that.chartHeartbeats,_that.chartOxygens,_that.historyHeartbeats,_that.historyOxygens,_that.currentHistoryPage,_that.hasMoreHistory,_that.heartRateStats,_that.oxygenStats,_that.timeRange,_that.customStart,_that.customEnd,_that.isLoading,_that.isLoadingMore,_that.isMeasuring,_that.isMeasuringCountdown,_that.measureRemainingSeconds,_that.errorEvent);case _: throw StateError('Unexpected subclass'); } @@ -487,10 +490,10 @@ return $default(_that.latestHeartbeats,_that.latestOxygens,_that.chartHeartbeats /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( List latestHeartbeats, List latestOxygens, List chartHeartbeats, List chartOxygens, List historyHeartbeats, List historyOxygens, int currentHistoryPage, bool hasMoreHistory, HealthStats heartRateStats, HealthStats oxygenStats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, String errorMessage)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List latestHeartbeats, List latestOxygens, List chartHeartbeats, List chartOxygens, List historyHeartbeats, List historyOxygens, int currentHistoryPage, bool hasMoreHistory, HealthStats heartRateStats, HealthStats oxygenStats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, bool isMeasuring, bool isMeasuringCountdown, int measureRemainingSeconds, HealthErrorEvent? errorEvent)? $default,) {final _that = this; switch (_that) { case _HealthViewState() when $default != null: -return $default(_that.latestHeartbeats,_that.latestOxygens,_that.chartHeartbeats,_that.chartOxygens,_that.historyHeartbeats,_that.historyOxygens,_that.currentHistoryPage,_that.hasMoreHistory,_that.heartRateStats,_that.oxygenStats,_that.timeRange,_that.customStart,_that.customEnd,_that.isLoading,_that.isLoadingMore,_that.errorMessage);case _: +return $default(_that.latestHeartbeats,_that.latestOxygens,_that.chartHeartbeats,_that.chartOxygens,_that.historyHeartbeats,_that.historyOxygens,_that.currentHistoryPage,_that.hasMoreHistory,_that.heartRateStats,_that.oxygenStats,_that.timeRange,_that.customStart,_that.customEnd,_that.isLoading,_that.isLoadingMore,_that.isMeasuring,_that.isMeasuringCountdown,_that.measureRemainingSeconds,_that.errorEvent);case _: return null; } @@ -502,7 +505,7 @@ return $default(_that.latestHeartbeats,_that.latestOxygens,_that.chartHeartbeats class _HealthViewState implements HealthViewState { - const _HealthViewState({final List latestHeartbeats = const [], final List latestOxygens = const [], final List chartHeartbeats = const [], final List chartOxygens = const [], final List historyHeartbeats = const [], final List historyOxygens = const [], this.currentHistoryPage = 1, this.hasMoreHistory = false, this.heartRateStats = const HealthStats(), this.oxygenStats = const HealthStats(), this.timeRange = TimeRange.today, this.customStart = null, this.customEnd = null, this.isLoading = true, this.isLoadingMore = false, this.errorMessage = ''}): _latestHeartbeats = latestHeartbeats,_latestOxygens = latestOxygens,_chartHeartbeats = chartHeartbeats,_chartOxygens = chartOxygens,_historyHeartbeats = historyHeartbeats,_historyOxygens = historyOxygens; + const _HealthViewState({final List latestHeartbeats = const [], final List latestOxygens = const [], final List chartHeartbeats = const [], final List chartOxygens = const [], final List historyHeartbeats = const [], final List historyOxygens = const [], this.currentHistoryPage = 1, this.hasMoreHistory = false, this.heartRateStats = const HealthStats(), this.oxygenStats = const HealthStats(), this.timeRange = TimeRange.today, this.customStart = null, this.customEnd = null, this.isLoading = true, this.isLoadingMore = false, this.isMeasuring = false, this.isMeasuringCountdown = false, this.measureRemainingSeconds = 0, this.errorEvent}): _latestHeartbeats = latestHeartbeats,_latestOxygens = latestOxygens,_chartHeartbeats = chartHeartbeats,_chartOxygens = chartOxygens,_historyHeartbeats = historyHeartbeats,_historyOxygens = historyOxygens; final List _latestHeartbeats; @@ -556,7 +559,10 @@ class _HealthViewState implements HealthViewState { @override@JsonKey() final DateTime? customEnd; @override@JsonKey() final bool isLoading; @override@JsonKey() final bool isLoadingMore; -@override@JsonKey() final String errorMessage; +@override@JsonKey() final bool isMeasuring; +@override@JsonKey() final bool isMeasuringCountdown; +@override@JsonKey() final int measureRemainingSeconds; +@override final HealthErrorEvent? errorEvent; /// Create a copy of HealthViewState /// with the given fields replaced by the non-null parameter values. @@ -568,16 +574,16 @@ _$HealthViewStateCopyWith<_HealthViewState> get copyWith => __$HealthViewStateCo @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _HealthViewState&&const DeepCollectionEquality().equals(other._latestHeartbeats, _latestHeartbeats)&&const DeepCollectionEquality().equals(other._latestOxygens, _latestOxygens)&&const DeepCollectionEquality().equals(other._chartHeartbeats, _chartHeartbeats)&&const DeepCollectionEquality().equals(other._chartOxygens, _chartOxygens)&&const DeepCollectionEquality().equals(other._historyHeartbeats, _historyHeartbeats)&&const DeepCollectionEquality().equals(other._historyOxygens, _historyOxygens)&&(identical(other.currentHistoryPage, currentHistoryPage) || other.currentHistoryPage == currentHistoryPage)&&(identical(other.hasMoreHistory, hasMoreHistory) || other.hasMoreHistory == hasMoreHistory)&&(identical(other.heartRateStats, heartRateStats) || other.heartRateStats == heartRateStats)&&(identical(other.oxygenStats, oxygenStats) || other.oxygenStats == oxygenStats)&&(identical(other.timeRange, timeRange) || other.timeRange == timeRange)&&(identical(other.customStart, customStart) || other.customStart == customStart)&&(identical(other.customEnd, customEnd) || other.customEnd == customEnd)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _HealthViewState&&const DeepCollectionEquality().equals(other._latestHeartbeats, _latestHeartbeats)&&const DeepCollectionEquality().equals(other._latestOxygens, _latestOxygens)&&const DeepCollectionEquality().equals(other._chartHeartbeats, _chartHeartbeats)&&const DeepCollectionEquality().equals(other._chartOxygens, _chartOxygens)&&const DeepCollectionEquality().equals(other._historyHeartbeats, _historyHeartbeats)&&const DeepCollectionEquality().equals(other._historyOxygens, _historyOxygens)&&(identical(other.currentHistoryPage, currentHistoryPage) || other.currentHistoryPage == currentHistoryPage)&&(identical(other.hasMoreHistory, hasMoreHistory) || other.hasMoreHistory == hasMoreHistory)&&(identical(other.heartRateStats, heartRateStats) || other.heartRateStats == heartRateStats)&&(identical(other.oxygenStats, oxygenStats) || other.oxygenStats == oxygenStats)&&(identical(other.timeRange, timeRange) || other.timeRange == timeRange)&&(identical(other.customStart, customStart) || other.customStart == customStart)&&(identical(other.customEnd, customEnd) || other.customEnd == customEnd)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.isMeasuring, isMeasuring) || other.isMeasuring == isMeasuring)&&(identical(other.isMeasuringCountdown, isMeasuringCountdown) || other.isMeasuringCountdown == isMeasuringCountdown)&&(identical(other.measureRemainingSeconds, measureRemainingSeconds) || other.measureRemainingSeconds == measureRemainingSeconds)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)); } @override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_latestHeartbeats),const DeepCollectionEquality().hash(_latestOxygens),const DeepCollectionEquality().hash(_chartHeartbeats),const DeepCollectionEquality().hash(_chartOxygens),const DeepCollectionEquality().hash(_historyHeartbeats),const DeepCollectionEquality().hash(_historyOxygens),currentHistoryPage,hasMoreHistory,heartRateStats,oxygenStats,timeRange,customStart,customEnd,isLoading,isLoadingMore,errorMessage); +int get hashCode => Object.hashAll([runtimeType,const DeepCollectionEquality().hash(_latestHeartbeats),const DeepCollectionEquality().hash(_latestOxygens),const DeepCollectionEquality().hash(_chartHeartbeats),const DeepCollectionEquality().hash(_chartOxygens),const DeepCollectionEquality().hash(_historyHeartbeats),const DeepCollectionEquality().hash(_historyOxygens),currentHistoryPage,hasMoreHistory,heartRateStats,oxygenStats,timeRange,customStart,customEnd,isLoading,isLoadingMore,isMeasuring,isMeasuringCountdown,measureRemainingSeconds,errorEvent]); @override String toString() { - return 'HealthViewState(latestHeartbeats: $latestHeartbeats, latestOxygens: $latestOxygens, chartHeartbeats: $chartHeartbeats, chartOxygens: $chartOxygens, historyHeartbeats: $historyHeartbeats, historyOxygens: $historyOxygens, currentHistoryPage: $currentHistoryPage, hasMoreHistory: $hasMoreHistory, heartRateStats: $heartRateStats, oxygenStats: $oxygenStats, timeRange: $timeRange, customStart: $customStart, customEnd: $customEnd, isLoading: $isLoading, isLoadingMore: $isLoadingMore, errorMessage: $errorMessage)'; + return 'HealthViewState(latestHeartbeats: $latestHeartbeats, latestOxygens: $latestOxygens, chartHeartbeats: $chartHeartbeats, chartOxygens: $chartOxygens, historyHeartbeats: $historyHeartbeats, historyOxygens: $historyOxygens, currentHistoryPage: $currentHistoryPage, hasMoreHistory: $hasMoreHistory, heartRateStats: $heartRateStats, oxygenStats: $oxygenStats, timeRange: $timeRange, customStart: $customStart, customEnd: $customEnd, isLoading: $isLoading, isLoadingMore: $isLoadingMore, isMeasuring: $isMeasuring, isMeasuringCountdown: $isMeasuringCountdown, measureRemainingSeconds: $measureRemainingSeconds, errorEvent: $errorEvent)'; } @@ -588,7 +594,7 @@ abstract mixin class _$HealthViewStateCopyWith<$Res> implements $HealthViewState factory _$HealthViewStateCopyWith(_HealthViewState value, $Res Function(_HealthViewState) _then) = __$HealthViewStateCopyWithImpl; @override @useResult $Res call({ - List latestHeartbeats, List latestOxygens, List chartHeartbeats, List chartOxygens, List historyHeartbeats, List historyOxygens, int currentHistoryPage, bool hasMoreHistory, HealthStats heartRateStats, HealthStats oxygenStats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, String errorMessage + List latestHeartbeats, List latestOxygens, List chartHeartbeats, List chartOxygens, List historyHeartbeats, List historyOxygens, int currentHistoryPage, bool hasMoreHistory, HealthStats heartRateStats, HealthStats oxygenStats, TimeRange timeRange, DateTime? customStart, DateTime? customEnd, bool isLoading, bool isLoadingMore, bool isMeasuring, bool isMeasuringCountdown, int measureRemainingSeconds, HealthErrorEvent? errorEvent }); @@ -605,7 +611,7 @@ class __$HealthViewStateCopyWithImpl<$Res> /// Create a copy of HealthViewState /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? latestHeartbeats = null,Object? latestOxygens = null,Object? chartHeartbeats = null,Object? chartOxygens = null,Object? historyHeartbeats = null,Object? historyOxygens = null,Object? currentHistoryPage = null,Object? hasMoreHistory = null,Object? heartRateStats = null,Object? oxygenStats = null,Object? timeRange = null,Object? customStart = freezed,Object? customEnd = freezed,Object? isLoading = null,Object? isLoadingMore = null,Object? errorMessage = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? latestHeartbeats = null,Object? latestOxygens = null,Object? chartHeartbeats = null,Object? chartOxygens = null,Object? historyHeartbeats = null,Object? historyOxygens = null,Object? currentHistoryPage = null,Object? hasMoreHistory = null,Object? heartRateStats = null,Object? oxygenStats = null,Object? timeRange = null,Object? customStart = freezed,Object? customEnd = freezed,Object? isLoading = null,Object? isLoadingMore = null,Object? isMeasuring = null,Object? isMeasuringCountdown = null,Object? measureRemainingSeconds = null,Object? errorEvent = freezed,}) { return _then(_HealthViewState( latestHeartbeats: null == latestHeartbeats ? _self._latestHeartbeats : latestHeartbeats // ignore: cast_nullable_to_non_nullable as List,latestOxygens: null == latestOxygens ? _self._latestOxygens : latestOxygens // ignore: cast_nullable_to_non_nullable @@ -622,8 +628,11 @@ as TimeRange,customStart: freezed == customStart ? _self.customStart : customSta as DateTime?,customEnd: freezed == customEnd ? _self.customEnd : customEnd // ignore: cast_nullable_to_non_nullable as DateTime?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable as bool,isLoadingMore: null == isLoadingMore ? _self.isLoadingMore : isLoadingMore // ignore: cast_nullable_to_non_nullable -as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable -as String, +as bool,isMeasuring: null == isMeasuring ? _self.isMeasuring : isMeasuring // ignore: cast_nullable_to_non_nullable +as bool,isMeasuringCountdown: null == isMeasuringCountdown ? _self.isMeasuringCountdown : isMeasuringCountdown // ignore: cast_nullable_to_non_nullable +as bool,measureRemainingSeconds: null == measureRemainingSeconds ? _self.measureRemainingSeconds : measureRemainingSeconds // ignore: cast_nullable_to_non_nullable +as int,errorEvent: freezed == errorEvent ? _self.errorEvent : errorEvent // ignore: cast_nullable_to_non_nullable +as HealthErrorEvent?, )); } diff --git a/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/state/locate_device_view_model.dart b/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/state/locate_device_view_model.dart index 3d3609df..9353c223 100644 --- a/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/state/locate_device_view_model.dart +++ b/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/state/locate_device_view_model.dart @@ -46,7 +46,11 @@ class LocateDeviceViewModel extends Notifier { } } - void resetError() { - state = state.copyWith(errorMessage: ''); + void reset() { + state = state.copyWith( + isLoading: false, + isComplete: false, + errorMessage: '', + ); } } diff --git a/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/widgets/locate_device_dialog.dart b/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/widgets/locate_device_dialog.dart index d43d7239..e7569dfe 100644 --- a/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/widgets/locate_device_dialog.dart +++ b/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/widgets/locate_device_dialog.dart @@ -15,6 +15,20 @@ class LocateDeviceDialog extends ConsumerWidget { final state = ref.watch(locateDeviceViewModelProvider); final vm = ref.read(locateDeviceViewModelProvider.notifier); + ref.listen( + locateDeviceViewModelProvider.select((s) => s.isComplete), + (previous, next) { + if (next && !(previous ?? false)) { + Future.delayed(const Duration(seconds: 1), () { + if (context.mounted) { + Navigator.pop(context); + vm.reset(); + } + }); + } + }, + ); + return Container( padding: EdgeInsets.symmetric( horizontal: SizeUtils.getByScreen(small: 32, big: 30), @@ -44,7 +58,7 @@ class LocateDeviceDialog extends ConsumerWidget { PrimaryButton( onPressed: () { Navigator.pop(context); - vm.resetError(); + vm.reset(); }, text: context.translate(I18n.ok), color: theme.getColorFor(ThemeCode.legacyPrimary), diff --git a/modules/legacy/modules/device_management/lib/src/features/volume_control/data/device_update_datasource_provider.dart b/modules/legacy/modules/device_management/lib/src/features/volume_control/data/device_update_datasource_provider.dart deleted file mode 100644 index d2c8cdec..00000000 --- a/modules/legacy/modules/device_management/lib/src/features/volume_control/data/device_update_datasource_provider.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:get_it/get_it.dart'; -import 'package:sf_infrastructure/sf_infrastructure.dart'; - -import 'device_update_datasource.dart'; - -final deviceUpdateDatasourceProvider = Provider((ref) { - return DeviceUpdateDatasource(GetIt.I()); -}); diff --git a/modules/legacy/modules/device_management/lib/src/features/volume_control/presentation/state/volume_control_view_model.dart b/modules/legacy/modules/device_management/lib/src/features/volume_control/presentation/state/volume_control_view_model.dart index 1a2ccfbb..86d73db7 100644 --- a/modules/legacy/modules/device_management/lib/src/features/volume_control/presentation/state/volume_control_view_model.dart +++ b/modules/legacy/modules/device_management/lib/src/features/volume_control/presentation/state/volume_control_view_model.dart @@ -1,8 +1,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; +import 'package:sf_shared/sf_shared.dart'; -import '../../data/device_update_datasource.dart'; -import '../../data/device_update_datasource_provider.dart'; import 'volume_control_view_state.dart'; final volumeControlViewModelProvider = @@ -11,11 +10,11 @@ final volumeControlViewModelProvider = ); class VolumeControlViewModel extends Notifier { - late final DeviceUpdateDatasource _datasource; + late final DeviceSettingsUpdateDatasource _datasource; @override VolumeControlViewState build() { - _datasource = ref.read(deviceUpdateDatasourceProvider); + _datasource = ref.read(deviceSettingsUpdateProvider); Future.microtask(() => _load()); return const VolumeControlViewState(); } @@ -25,14 +24,14 @@ class VolumeControlViewModel extends Notifier { final device = ref.read(selectedDeviceProvider); if (device == null) return; - final volume = device.settings['volume'] as Map? ?? {}; + final volume = device.settings.volume; state = state.copyWith( isLoading: false, device: device, - media: (volume['media'] as num?)?.toInt() ?? 50, - ringtone: (volume['ringtone'] as num?)?.toInt() ?? 50, - alarm: (volume['alarm'] as num?)?.toInt() ?? 50, + media: volume.media, + ringtone: volume.ringtone, + alarm: volume.alarm, ); } catch (e) { if (!ref.mounted) return; @@ -51,16 +50,17 @@ class VolumeControlViewModel extends Notifier { try { state = state.copyWith(isLoading: true, isComplete: false, errorMessage: ''); - final settings = Map.from(device.settings); - settings['volume'] = { - 'media': state.media, - 'ringtone': state.ringtone, - 'alarm': state.alarm, - }; + final updatedSettings = device.settings.copyWith( + volume: DeviceVolumeEntity( + media: state.media, + ringtone: state.ringtone, + alarm: state.alarm, + ), + ); await _datasource.updateDeviceSettings( device: device, - updatedSettings: settings, + updatedSettings: updatedSettings, ); if (!ref.mounted) return; diff --git a/modules/legacy/modules/device_management/pubspec.lock b/modules/legacy/modules/device_management/pubspec.lock index 355eed13..fc3ffbbf 100644 --- a/modules/legacy/modules/device_management/pubspec.lock +++ b/modules/legacy/modules/device_management/pubspec.lock @@ -634,7 +634,7 @@ packages: source: hosted version: "1.3.0" lottie: - dependency: transitive + dependency: "direct main" description: name: lottie sha256: "8ae0be46dbd9e19641791dc12ee480d34e1fd3f84c749adc05f3ad9342b71b95" diff --git a/modules/legacy/modules/device_management/pubspec.yaml b/modules/legacy/modules/device_management/pubspec.yaml index febe3c21..3032df10 100644 --- a/modules/legacy/modules/device_management/pubspec.yaml +++ b/modules/legacy/modules/device_management/pubspec.yaml @@ -56,6 +56,7 @@ dependencies: uuid: ^4.5.1 flutter_contacts: ^1.1.9+2 fl_chart: ^1.1.1 + lottie: ^3.3.1 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. @@ -75,12 +76,6 @@ flutter: # the material Icons class. uses-material-design: true - # To add Flutter specific assets to your application, add an assets section, - # like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/to/resolution-aware-images diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/location_screen.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/location_screen.dart index b687e73c..71cee7dd 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/location_screen.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/location_screen.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; import 'package:location/src/features/location/presentation/state/location_view_model.dart'; +import 'package:location/src/features/location/presentation/state/location_view_state.dart'; import 'package:location/src/features/location/presentation/widgets/location_map.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -16,6 +17,55 @@ class LocationScreen extends ConsumerWidget { final controlPanelState = ref.watch(controlPanelViewModelProvider); final locationState = ref.watch(locationViewModelProvider); + ref.listen( + locationViewModelProvider.select((s) => s.errorEvent), + (previous, next) { + if (next != null) { + final message = switch (next) { + LocationErrorEvent.geofenceCreate => context.translate(I18n.errorGeofenceCreate), + LocationErrorEvent.geofenceUpdate => context.translate(I18n.errorGeofenceUpdate), + LocationErrorEvent.geofenceDelete => context.translate(I18n.errorGeofenceDelete), + LocationErrorEvent.frequentPlaceCreate => context.translate(I18n.errorFrequentPlaceCreate), + LocationErrorEvent.frequentPlaceUpdate => context.translate(I18n.errorFrequentPlaceUpdate), + LocationErrorEvent.frequentPlaceDelete => context.translate(I18n.errorFrequentPlaceDelete), + LocationErrorEvent.positionHistory => context.translate(I18n.errorPositionHistory), + LocationErrorEvent.locationFrequency => context.translate(I18n.errorLocationFrequency), + }; + showTopSnackbar(context, message: message, type: MessageType.error); + } + }, + ); + + ref.listen( + controlPanelViewModelProvider.select((s) => s.errorMessage), + (previous, next) { + if (next.isNotEmpty) { + showTopSnackbar( + context, + message: context.translate(I18n.errorGeneric), + type: MessageType.error, + ); + } + }, + ); + + ref.listen( + locationViewModelProvider.select((s) => s.successMessage), + (previous, next) { + if (next != null) { + final message = switch (next) { + LocationSuccessEvent.geofenceCreated => context.translate(I18n.geofenceCreated), + LocationSuccessEvent.geofenceUpdated => context.translate(I18n.geofenceUpdated), + LocationSuccessEvent.geofenceDeleted => context.translate(I18n.geofenceDeleted), + LocationSuccessEvent.frequentPlaceCreated => context.translate(I18n.frequentPlaceCreated), + LocationSuccessEvent.frequentPlaceUpdated => context.translate(I18n.frequentPlaceUpdated), + LocationSuccessEvent.frequentPlaceDeleted => context.translate(I18n.frequentPlaceDeleted), + }; + showTopSnackbar(context, message: message, type: MessageType.success); + } + }, + ); + if (controlPanelState.isLoading) { return LegacyPageLayout( theme: theme, diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_map_view_model.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_map_view_model.dart index a385bcc5..e644204b 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_map_view_model.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_map_view_model.dart @@ -119,6 +119,14 @@ class LocationMapViewModel extends Notifier { state = state.copyWith(actionsExpanded: !state.actionsExpanded); } + void toggleFrequencyExpanded() { + state = state.copyWith(frequencyExpanded: !state.frequencyExpanded); + } + + void collapseFrequency() { + state = state.copyWith(frequencyExpanded: false); + } + void updateMapZoom(double zoom) { state = state.copyWith(mapZoom: zoom); } diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_map_view_state.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_map_view_state.dart index 07bdda55..4ba695bf 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_map_view_state.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_map_view_state.dart @@ -25,6 +25,7 @@ abstract class LocationMapViewState with _$LocationMapViewState { PositionEntity? selectedHistoryPosition, @Default(false) bool isFollowing, @Default(false) bool actionsExpanded, + @Default(false) bool frequencyExpanded, @Default(_defaultZoom) double mapZoom, }) = _LocationMapViewState; } diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_map_view_state.freezed.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_map_view_state.freezed.dart index 189bcc9a..f7d5390e 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_map_view_state.freezed.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_map_view_state.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$LocationMapViewState { - bool get showGeofences; bool get showFrequentPlaces; PlacingMode get placingMode; bool get adjustingRadius; double get previewRadius; LatLng? get previewPoint; GeofenceEntity? get selectedGeofence; GeofenceEntity? get editingGeofence; FrequentPlaceEntity? get selectedFrequentPlace; PositionEntity? get selectedHistoryPosition; bool get isFollowing; bool get actionsExpanded; double get mapZoom; + bool get showGeofences; bool get showFrequentPlaces; PlacingMode get placingMode; bool get adjustingRadius; double get previewRadius; LatLng? get previewPoint; GeofenceEntity? get selectedGeofence; GeofenceEntity? get editingGeofence; FrequentPlaceEntity? get selectedFrequentPlace; PositionEntity? get selectedHistoryPosition; bool get isFollowing; bool get actionsExpanded; bool get frequencyExpanded; double get mapZoom; /// Create a copy of LocationMapViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $LocationMapViewStateCopyWith get copyWith => _$LocationMa @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is LocationMapViewState&&(identical(other.showGeofences, showGeofences) || other.showGeofences == showGeofences)&&(identical(other.showFrequentPlaces, showFrequentPlaces) || other.showFrequentPlaces == showFrequentPlaces)&&(identical(other.placingMode, placingMode) || other.placingMode == placingMode)&&(identical(other.adjustingRadius, adjustingRadius) || other.adjustingRadius == adjustingRadius)&&(identical(other.previewRadius, previewRadius) || other.previewRadius == previewRadius)&&(identical(other.previewPoint, previewPoint) || other.previewPoint == previewPoint)&&(identical(other.selectedGeofence, selectedGeofence) || other.selectedGeofence == selectedGeofence)&&(identical(other.editingGeofence, editingGeofence) || other.editingGeofence == editingGeofence)&&(identical(other.selectedFrequentPlace, selectedFrequentPlace) || other.selectedFrequentPlace == selectedFrequentPlace)&&(identical(other.selectedHistoryPosition, selectedHistoryPosition) || other.selectedHistoryPosition == selectedHistoryPosition)&&(identical(other.isFollowing, isFollowing) || other.isFollowing == isFollowing)&&(identical(other.actionsExpanded, actionsExpanded) || other.actionsExpanded == actionsExpanded)&&(identical(other.mapZoom, mapZoom) || other.mapZoom == mapZoom)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is LocationMapViewState&&(identical(other.showGeofences, showGeofences) || other.showGeofences == showGeofences)&&(identical(other.showFrequentPlaces, showFrequentPlaces) || other.showFrequentPlaces == showFrequentPlaces)&&(identical(other.placingMode, placingMode) || other.placingMode == placingMode)&&(identical(other.adjustingRadius, adjustingRadius) || other.adjustingRadius == adjustingRadius)&&(identical(other.previewRadius, previewRadius) || other.previewRadius == previewRadius)&&(identical(other.previewPoint, previewPoint) || other.previewPoint == previewPoint)&&(identical(other.selectedGeofence, selectedGeofence) || other.selectedGeofence == selectedGeofence)&&(identical(other.editingGeofence, editingGeofence) || other.editingGeofence == editingGeofence)&&(identical(other.selectedFrequentPlace, selectedFrequentPlace) || other.selectedFrequentPlace == selectedFrequentPlace)&&(identical(other.selectedHistoryPosition, selectedHistoryPosition) || other.selectedHistoryPosition == selectedHistoryPosition)&&(identical(other.isFollowing, isFollowing) || other.isFollowing == isFollowing)&&(identical(other.actionsExpanded, actionsExpanded) || other.actionsExpanded == actionsExpanded)&&(identical(other.frequencyExpanded, frequencyExpanded) || other.frequencyExpanded == frequencyExpanded)&&(identical(other.mapZoom, mapZoom) || other.mapZoom == mapZoom)); } @override -int get hashCode => Object.hash(runtimeType,showGeofences,showFrequentPlaces,placingMode,adjustingRadius,previewRadius,previewPoint,selectedGeofence,editingGeofence,selectedFrequentPlace,selectedHistoryPosition,isFollowing,actionsExpanded,mapZoom); +int get hashCode => Object.hash(runtimeType,showGeofences,showFrequentPlaces,placingMode,adjustingRadius,previewRadius,previewPoint,selectedGeofence,editingGeofence,selectedFrequentPlace,selectedHistoryPosition,isFollowing,actionsExpanded,frequencyExpanded,mapZoom); @override String toString() { - return 'LocationMapViewState(showGeofences: $showGeofences, showFrequentPlaces: $showFrequentPlaces, placingMode: $placingMode, adjustingRadius: $adjustingRadius, previewRadius: $previewRadius, previewPoint: $previewPoint, selectedGeofence: $selectedGeofence, editingGeofence: $editingGeofence, selectedFrequentPlace: $selectedFrequentPlace, selectedHistoryPosition: $selectedHistoryPosition, isFollowing: $isFollowing, actionsExpanded: $actionsExpanded, mapZoom: $mapZoom)'; + return 'LocationMapViewState(showGeofences: $showGeofences, showFrequentPlaces: $showFrequentPlaces, placingMode: $placingMode, adjustingRadius: $adjustingRadius, previewRadius: $previewRadius, previewPoint: $previewPoint, selectedGeofence: $selectedGeofence, editingGeofence: $editingGeofence, selectedFrequentPlace: $selectedFrequentPlace, selectedHistoryPosition: $selectedHistoryPosition, isFollowing: $isFollowing, actionsExpanded: $actionsExpanded, frequencyExpanded: $frequencyExpanded, mapZoom: $mapZoom)'; } @@ -45,7 +45,7 @@ abstract mixin class $LocationMapViewStateCopyWith<$Res> { factory $LocationMapViewStateCopyWith(LocationMapViewState value, $Res Function(LocationMapViewState) _then) = _$LocationMapViewStateCopyWithImpl; @useResult $Res call({ - bool showGeofences, bool showFrequentPlaces, PlacingMode placingMode, bool adjustingRadius, double previewRadius, LatLng? previewPoint, GeofenceEntity? selectedGeofence, GeofenceEntity? editingGeofence, FrequentPlaceEntity? selectedFrequentPlace, PositionEntity? selectedHistoryPosition, bool isFollowing, bool actionsExpanded, double mapZoom + bool showGeofences, bool showFrequentPlaces, PlacingMode placingMode, bool adjustingRadius, double previewRadius, LatLng? previewPoint, GeofenceEntity? selectedGeofence, GeofenceEntity? editingGeofence, FrequentPlaceEntity? selectedFrequentPlace, PositionEntity? selectedHistoryPosition, bool isFollowing, bool actionsExpanded, bool frequencyExpanded, double mapZoom }); @@ -62,7 +62,7 @@ class _$LocationMapViewStateCopyWithImpl<$Res> /// Create a copy of LocationMapViewState /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? showGeofences = null,Object? showFrequentPlaces = null,Object? placingMode = null,Object? adjustingRadius = null,Object? previewRadius = null,Object? previewPoint = freezed,Object? selectedGeofence = freezed,Object? editingGeofence = freezed,Object? selectedFrequentPlace = freezed,Object? selectedHistoryPosition = freezed,Object? isFollowing = null,Object? actionsExpanded = null,Object? mapZoom = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? showGeofences = null,Object? showFrequentPlaces = null,Object? placingMode = null,Object? adjustingRadius = null,Object? previewRadius = null,Object? previewPoint = freezed,Object? selectedGeofence = freezed,Object? editingGeofence = freezed,Object? selectedFrequentPlace = freezed,Object? selectedHistoryPosition = freezed,Object? isFollowing = null,Object? actionsExpanded = null,Object? frequencyExpanded = null,Object? mapZoom = null,}) { return _then(_self.copyWith( showGeofences: null == showGeofences ? _self.showGeofences : showGeofences // ignore: cast_nullable_to_non_nullable as bool,showFrequentPlaces: null == showFrequentPlaces ? _self.showFrequentPlaces : showFrequentPlaces // ignore: cast_nullable_to_non_nullable @@ -76,6 +76,7 @@ as GeofenceEntity?,selectedFrequentPlace: freezed == selectedFrequentPlace ? _se as FrequentPlaceEntity?,selectedHistoryPosition: freezed == selectedHistoryPosition ? _self.selectedHistoryPosition : selectedHistoryPosition // ignore: cast_nullable_to_non_nullable as PositionEntity?,isFollowing: null == isFollowing ? _self.isFollowing : isFollowing // ignore: cast_nullable_to_non_nullable as bool,actionsExpanded: null == actionsExpanded ? _self.actionsExpanded : actionsExpanded // ignore: cast_nullable_to_non_nullable +as bool,frequencyExpanded: null == frequencyExpanded ? _self.frequencyExpanded : frequencyExpanded // ignore: cast_nullable_to_non_nullable as bool,mapZoom: null == mapZoom ? _self.mapZoom : mapZoom // ignore: cast_nullable_to_non_nullable as double, )); @@ -210,10 +211,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( bool showGeofences, bool showFrequentPlaces, PlacingMode placingMode, bool adjustingRadius, double previewRadius, LatLng? previewPoint, GeofenceEntity? selectedGeofence, GeofenceEntity? editingGeofence, FrequentPlaceEntity? selectedFrequentPlace, PositionEntity? selectedHistoryPosition, bool isFollowing, bool actionsExpanded, double mapZoom)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( bool showGeofences, bool showFrequentPlaces, PlacingMode placingMode, bool adjustingRadius, double previewRadius, LatLng? previewPoint, GeofenceEntity? selectedGeofence, GeofenceEntity? editingGeofence, FrequentPlaceEntity? selectedFrequentPlace, PositionEntity? selectedHistoryPosition, bool isFollowing, bool actionsExpanded, bool frequencyExpanded, double mapZoom)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _LocationMapViewState() when $default != null: -return $default(_that.showGeofences,_that.showFrequentPlaces,_that.placingMode,_that.adjustingRadius,_that.previewRadius,_that.previewPoint,_that.selectedGeofence,_that.editingGeofence,_that.selectedFrequentPlace,_that.selectedHistoryPosition,_that.isFollowing,_that.actionsExpanded,_that.mapZoom);case _: +return $default(_that.showGeofences,_that.showFrequentPlaces,_that.placingMode,_that.adjustingRadius,_that.previewRadius,_that.previewPoint,_that.selectedGeofence,_that.editingGeofence,_that.selectedFrequentPlace,_that.selectedHistoryPosition,_that.isFollowing,_that.actionsExpanded,_that.frequencyExpanded,_that.mapZoom);case _: return orElse(); } @@ -231,10 +232,10 @@ return $default(_that.showGeofences,_that.showFrequentPlaces,_that.placingMode,_ /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( bool showGeofences, bool showFrequentPlaces, PlacingMode placingMode, bool adjustingRadius, double previewRadius, LatLng? previewPoint, GeofenceEntity? selectedGeofence, GeofenceEntity? editingGeofence, FrequentPlaceEntity? selectedFrequentPlace, PositionEntity? selectedHistoryPosition, bool isFollowing, bool actionsExpanded, double mapZoom) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( bool showGeofences, bool showFrequentPlaces, PlacingMode placingMode, bool adjustingRadius, double previewRadius, LatLng? previewPoint, GeofenceEntity? selectedGeofence, GeofenceEntity? editingGeofence, FrequentPlaceEntity? selectedFrequentPlace, PositionEntity? selectedHistoryPosition, bool isFollowing, bool actionsExpanded, bool frequencyExpanded, double mapZoom) $default,) {final _that = this; switch (_that) { case _LocationMapViewState(): -return $default(_that.showGeofences,_that.showFrequentPlaces,_that.placingMode,_that.adjustingRadius,_that.previewRadius,_that.previewPoint,_that.selectedGeofence,_that.editingGeofence,_that.selectedFrequentPlace,_that.selectedHistoryPosition,_that.isFollowing,_that.actionsExpanded,_that.mapZoom);case _: +return $default(_that.showGeofences,_that.showFrequentPlaces,_that.placingMode,_that.adjustingRadius,_that.previewRadius,_that.previewPoint,_that.selectedGeofence,_that.editingGeofence,_that.selectedFrequentPlace,_that.selectedHistoryPosition,_that.isFollowing,_that.actionsExpanded,_that.frequencyExpanded,_that.mapZoom);case _: throw StateError('Unexpected subclass'); } @@ -251,10 +252,10 @@ return $default(_that.showGeofences,_that.showFrequentPlaces,_that.placingMode,_ /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool showGeofences, bool showFrequentPlaces, PlacingMode placingMode, bool adjustingRadius, double previewRadius, LatLng? previewPoint, GeofenceEntity? selectedGeofence, GeofenceEntity? editingGeofence, FrequentPlaceEntity? selectedFrequentPlace, PositionEntity? selectedHistoryPosition, bool isFollowing, bool actionsExpanded, double mapZoom)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool showGeofences, bool showFrequentPlaces, PlacingMode placingMode, bool adjustingRadius, double previewRadius, LatLng? previewPoint, GeofenceEntity? selectedGeofence, GeofenceEntity? editingGeofence, FrequentPlaceEntity? selectedFrequentPlace, PositionEntity? selectedHistoryPosition, bool isFollowing, bool actionsExpanded, bool frequencyExpanded, double mapZoom)? $default,) {final _that = this; switch (_that) { case _LocationMapViewState() when $default != null: -return $default(_that.showGeofences,_that.showFrequentPlaces,_that.placingMode,_that.adjustingRadius,_that.previewRadius,_that.previewPoint,_that.selectedGeofence,_that.editingGeofence,_that.selectedFrequentPlace,_that.selectedHistoryPosition,_that.isFollowing,_that.actionsExpanded,_that.mapZoom);case _: +return $default(_that.showGeofences,_that.showFrequentPlaces,_that.placingMode,_that.adjustingRadius,_that.previewRadius,_that.previewPoint,_that.selectedGeofence,_that.editingGeofence,_that.selectedFrequentPlace,_that.selectedHistoryPosition,_that.isFollowing,_that.actionsExpanded,_that.frequencyExpanded,_that.mapZoom);case _: return null; } @@ -266,7 +267,7 @@ return $default(_that.showGeofences,_that.showFrequentPlaces,_that.placingMode,_ class _LocationMapViewState implements LocationMapViewState { - const _LocationMapViewState({this.showGeofences = true, this.showFrequentPlaces = true, this.placingMode = PlacingMode.none, this.adjustingRadius = false, this.previewRadius = 200.0, this.previewPoint, this.selectedGeofence, this.editingGeofence, this.selectedFrequentPlace, this.selectedHistoryPosition, this.isFollowing = false, this.actionsExpanded = false, this.mapZoom = _defaultZoom}); + const _LocationMapViewState({this.showGeofences = true, this.showFrequentPlaces = true, this.placingMode = PlacingMode.none, this.adjustingRadius = false, this.previewRadius = 200.0, this.previewPoint, this.selectedGeofence, this.editingGeofence, this.selectedFrequentPlace, this.selectedHistoryPosition, this.isFollowing = false, this.actionsExpanded = false, this.frequencyExpanded = false, this.mapZoom = _defaultZoom}); @override@JsonKey() final bool showGeofences; @@ -281,6 +282,7 @@ class _LocationMapViewState implements LocationMapViewState { @override final PositionEntity? selectedHistoryPosition; @override@JsonKey() final bool isFollowing; @override@JsonKey() final bool actionsExpanded; +@override@JsonKey() final bool frequencyExpanded; @override@JsonKey() final double mapZoom; /// Create a copy of LocationMapViewState @@ -293,16 +295,16 @@ _$LocationMapViewStateCopyWith<_LocationMapViewState> get copyWith => __$Locatio @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _LocationMapViewState&&(identical(other.showGeofences, showGeofences) || other.showGeofences == showGeofences)&&(identical(other.showFrequentPlaces, showFrequentPlaces) || other.showFrequentPlaces == showFrequentPlaces)&&(identical(other.placingMode, placingMode) || other.placingMode == placingMode)&&(identical(other.adjustingRadius, adjustingRadius) || other.adjustingRadius == adjustingRadius)&&(identical(other.previewRadius, previewRadius) || other.previewRadius == previewRadius)&&(identical(other.previewPoint, previewPoint) || other.previewPoint == previewPoint)&&(identical(other.selectedGeofence, selectedGeofence) || other.selectedGeofence == selectedGeofence)&&(identical(other.editingGeofence, editingGeofence) || other.editingGeofence == editingGeofence)&&(identical(other.selectedFrequentPlace, selectedFrequentPlace) || other.selectedFrequentPlace == selectedFrequentPlace)&&(identical(other.selectedHistoryPosition, selectedHistoryPosition) || other.selectedHistoryPosition == selectedHistoryPosition)&&(identical(other.isFollowing, isFollowing) || other.isFollowing == isFollowing)&&(identical(other.actionsExpanded, actionsExpanded) || other.actionsExpanded == actionsExpanded)&&(identical(other.mapZoom, mapZoom) || other.mapZoom == mapZoom)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LocationMapViewState&&(identical(other.showGeofences, showGeofences) || other.showGeofences == showGeofences)&&(identical(other.showFrequentPlaces, showFrequentPlaces) || other.showFrequentPlaces == showFrequentPlaces)&&(identical(other.placingMode, placingMode) || other.placingMode == placingMode)&&(identical(other.adjustingRadius, adjustingRadius) || other.adjustingRadius == adjustingRadius)&&(identical(other.previewRadius, previewRadius) || other.previewRadius == previewRadius)&&(identical(other.previewPoint, previewPoint) || other.previewPoint == previewPoint)&&(identical(other.selectedGeofence, selectedGeofence) || other.selectedGeofence == selectedGeofence)&&(identical(other.editingGeofence, editingGeofence) || other.editingGeofence == editingGeofence)&&(identical(other.selectedFrequentPlace, selectedFrequentPlace) || other.selectedFrequentPlace == selectedFrequentPlace)&&(identical(other.selectedHistoryPosition, selectedHistoryPosition) || other.selectedHistoryPosition == selectedHistoryPosition)&&(identical(other.isFollowing, isFollowing) || other.isFollowing == isFollowing)&&(identical(other.actionsExpanded, actionsExpanded) || other.actionsExpanded == actionsExpanded)&&(identical(other.frequencyExpanded, frequencyExpanded) || other.frequencyExpanded == frequencyExpanded)&&(identical(other.mapZoom, mapZoom) || other.mapZoom == mapZoom)); } @override -int get hashCode => Object.hash(runtimeType,showGeofences,showFrequentPlaces,placingMode,adjustingRadius,previewRadius,previewPoint,selectedGeofence,editingGeofence,selectedFrequentPlace,selectedHistoryPosition,isFollowing,actionsExpanded,mapZoom); +int get hashCode => Object.hash(runtimeType,showGeofences,showFrequentPlaces,placingMode,adjustingRadius,previewRadius,previewPoint,selectedGeofence,editingGeofence,selectedFrequentPlace,selectedHistoryPosition,isFollowing,actionsExpanded,frequencyExpanded,mapZoom); @override String toString() { - return 'LocationMapViewState(showGeofences: $showGeofences, showFrequentPlaces: $showFrequentPlaces, placingMode: $placingMode, adjustingRadius: $adjustingRadius, previewRadius: $previewRadius, previewPoint: $previewPoint, selectedGeofence: $selectedGeofence, editingGeofence: $editingGeofence, selectedFrequentPlace: $selectedFrequentPlace, selectedHistoryPosition: $selectedHistoryPosition, isFollowing: $isFollowing, actionsExpanded: $actionsExpanded, mapZoom: $mapZoom)'; + return 'LocationMapViewState(showGeofences: $showGeofences, showFrequentPlaces: $showFrequentPlaces, placingMode: $placingMode, adjustingRadius: $adjustingRadius, previewRadius: $previewRadius, previewPoint: $previewPoint, selectedGeofence: $selectedGeofence, editingGeofence: $editingGeofence, selectedFrequentPlace: $selectedFrequentPlace, selectedHistoryPosition: $selectedHistoryPosition, isFollowing: $isFollowing, actionsExpanded: $actionsExpanded, frequencyExpanded: $frequencyExpanded, mapZoom: $mapZoom)'; } @@ -313,7 +315,7 @@ abstract mixin class _$LocationMapViewStateCopyWith<$Res> implements $LocationMa factory _$LocationMapViewStateCopyWith(_LocationMapViewState value, $Res Function(_LocationMapViewState) _then) = __$LocationMapViewStateCopyWithImpl; @override @useResult $Res call({ - bool showGeofences, bool showFrequentPlaces, PlacingMode placingMode, bool adjustingRadius, double previewRadius, LatLng? previewPoint, GeofenceEntity? selectedGeofence, GeofenceEntity? editingGeofence, FrequentPlaceEntity? selectedFrequentPlace, PositionEntity? selectedHistoryPosition, bool isFollowing, bool actionsExpanded, double mapZoom + bool showGeofences, bool showFrequentPlaces, PlacingMode placingMode, bool adjustingRadius, double previewRadius, LatLng? previewPoint, GeofenceEntity? selectedGeofence, GeofenceEntity? editingGeofence, FrequentPlaceEntity? selectedFrequentPlace, PositionEntity? selectedHistoryPosition, bool isFollowing, bool actionsExpanded, bool frequencyExpanded, double mapZoom }); @@ -330,7 +332,7 @@ class __$LocationMapViewStateCopyWithImpl<$Res> /// Create a copy of LocationMapViewState /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? showGeofences = null,Object? showFrequentPlaces = null,Object? placingMode = null,Object? adjustingRadius = null,Object? previewRadius = null,Object? previewPoint = freezed,Object? selectedGeofence = freezed,Object? editingGeofence = freezed,Object? selectedFrequentPlace = freezed,Object? selectedHistoryPosition = freezed,Object? isFollowing = null,Object? actionsExpanded = null,Object? mapZoom = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? showGeofences = null,Object? showFrequentPlaces = null,Object? placingMode = null,Object? adjustingRadius = null,Object? previewRadius = null,Object? previewPoint = freezed,Object? selectedGeofence = freezed,Object? editingGeofence = freezed,Object? selectedFrequentPlace = freezed,Object? selectedHistoryPosition = freezed,Object? isFollowing = null,Object? actionsExpanded = null,Object? frequencyExpanded = null,Object? mapZoom = null,}) { return _then(_LocationMapViewState( showGeofences: null == showGeofences ? _self.showGeofences : showGeofences // ignore: cast_nullable_to_non_nullable as bool,showFrequentPlaces: null == showFrequentPlaces ? _self.showFrequentPlaces : showFrequentPlaces // ignore: cast_nullable_to_non_nullable @@ -344,6 +346,7 @@ as GeofenceEntity?,selectedFrequentPlace: freezed == selectedFrequentPlace ? _se as FrequentPlaceEntity?,selectedHistoryPosition: freezed == selectedHistoryPosition ? _self.selectedHistoryPosition : selectedHistoryPosition // ignore: cast_nullable_to_non_nullable as PositionEntity?,isFollowing: null == isFollowing ? _self.isFollowing : isFollowing // ignore: cast_nullable_to_non_nullable as bool,actionsExpanded: null == actionsExpanded ? _self.actionsExpanded : actionsExpanded // ignore: cast_nullable_to_non_nullable +as bool,frequencyExpanded: null == frequencyExpanded ? _self.frequencyExpanded : frequencyExpanded // ignore: cast_nullable_to_non_nullable as bool,mapZoom: null == mapZoom ? _self.mapZoom : mapZoom // ignore: cast_nullable_to_non_nullable as double, )); diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_view_model.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_view_model.dart index 177f90cd..e9ee650b 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_view_model.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_view_model.dart @@ -45,7 +45,7 @@ class LocationViewModel extends Notifier { ); } catch (e) { if (!ref.mounted) return; - state = state.copyWith(isLoading: false, errorMessage: _formatError(e)); + state = state.copyWith(isLoading: false); } } @@ -56,7 +56,7 @@ class LocationViewModel extends Notifier { required double longitude, required double radius, }) async { - state = state.copyWith(isSubmitting: true, errorMessage: ''); + state = state.copyWith(isSubmitting: true, errorEvent: null, successMessage: null); try { final user = await ref.read(userInfoProvider.future); final device = ref.read(selectedDeviceProvider); @@ -78,10 +78,11 @@ class LocationViewModel extends Notifier { state = state.copyWith( geofences: [...state.geofences, created], isSubmitting: false, + successMessage: LocationSuccessEvent.geofenceCreated, ); return true; } catch (e) { - return _handleError(e); + return _handleErrorEvent(LocationErrorEvent.geofenceCreate); } } @@ -93,7 +94,7 @@ class LocationViewModel extends Notifier { required double longitude, required double radius, }) async { - state = state.copyWith(isSubmitting: true, errorMessage: ''); + state = state.copyWith(isSubmitting: true, errorEvent: null, successMessage: null); try { final request = UpdateGeofenceRequestModel( id: id, @@ -110,24 +111,26 @@ class LocationViewModel extends Notifier { geofences: state.geofences.map((g) => g.id == id ? updated : g).toList(), isSubmitting: false, + successMessage: LocationSuccessEvent.geofenceUpdated, ); return true; } catch (e) { - return _handleError(e); + return _handleErrorEvent(LocationErrorEvent.geofenceUpdate); } } Future deleteGeofence({required String id}) async { - state = state.copyWith(errorMessage: ''); + state = state.copyWith(errorEvent: null, successMessage: null); try { await _locationRepository.deleteGeofence(geofenceId: id); if (!ref.mounted) return false; state = state.copyWith( geofences: state.geofences.where((g) => g.id != id).toList(), + successMessage: LocationSuccessEvent.geofenceDeleted, ); return true; } catch (e) { - return _handleError(e); + return _handleErrorEvent(LocationErrorEvent.geofenceDelete); } } @@ -137,7 +140,7 @@ class LocationViewModel extends Notifier { required double lng, List wifiList = const [], }) async { - state = state.copyWith(isSubmitting: true, errorMessage: ''); + state = state.copyWith(isSubmitting: true, errorEvent: null, successMessage: null); try { final user = await ref.read(userInfoProvider.future); final device = ref.read(selectedDeviceProvider); @@ -164,10 +167,11 @@ class LocationViewModel extends Notifier { state = state.copyWith( frequentPlaces: [...state.frequentPlaces, created], isSubmitting: false, + successMessage: LocationSuccessEvent.frequentPlaceCreated, ); return true; } catch (e) { - return _handleError(e); + return _handleErrorEvent(LocationErrorEvent.frequentPlaceCreate); } } @@ -178,7 +182,7 @@ class LocationViewModel extends Notifier { required double lng, List wifiList = const [], }) async { - state = state.copyWith(isSubmitting: true, errorMessage: ''); + state = state.copyWith(isSubmitting: true, errorEvent: null, successMessage: null); try { final request = UpdateFrequentPlaceRequestModel( id: id, @@ -200,25 +204,27 @@ class LocationViewModel extends Notifier { frequentPlaces: state.frequentPlaces.map((f) => f.id == id ? updated : f).toList(), isSubmitting: false, + successMessage: LocationSuccessEvent.frequentPlaceUpdated, ); return true; } catch (e) { - return _handleError(e); + return _handleErrorEvent(LocationErrorEvent.frequentPlaceUpdate); } } Future deleteFrequentPlace({required String id}) async { - state = state.copyWith(errorMessage: ''); + state = state.copyWith(errorEvent: null, successMessage: null); try { await _locationRepository.deleteFrequentPlace(frequentPlaceId: id); if (!ref.mounted) return false; state = state.copyWith( frequentPlaces: state.frequentPlaces.where((f) => f.id != id).toList(), + successMessage: LocationSuccessEvent.frequentPlaceDeleted, ); return true; } catch (e) { - return _handleError(e); + return _handleErrorEvent(LocationErrorEvent.frequentPlaceDelete); } } @@ -229,7 +235,7 @@ class LocationViewModel extends Notifier { final device = ref.read(selectedDeviceProvider); if (device == null) return; - state = state.copyWith(isLoadingHistory: true, errorMessage: ''); + state = state.copyWith(isLoadingHistory: true, errorEvent: null); try { final positions = await _locationRepository.getPositionHistory( deviceIdentificator: device.identificator, @@ -246,7 +252,7 @@ class LocationViewModel extends Notifier { if (!ref.mounted) return; state = state.copyWith( isLoadingHistory: false, - errorMessage: _formatError(e), + errorEvent: LocationErrorEvent.positionHistory, ); } } @@ -262,17 +268,33 @@ class LocationViewModel extends Notifier { state = state.copyWith(showRouteTrail: !state.showRouteTrail); } - bool _handleError(Object e) { + Future updateLocationFrequency({required int frequency}) async { + final device = ref.read(selectedDeviceProvider); + if (device == null) return false; + + state = state.copyWith(isSubmitting: true, errorEvent: null); + + try { + final updatedSettings = device.settings.copyWith(frequency: frequency); + await ref.read(deviceSettingsUpdateProvider).updateDeviceSettings( + device: device, + updatedSettings: updatedSettings, + ); + + if (!ref.mounted) return false; + state = state.copyWith(isSubmitting: false); + return true; + } catch (e) { + return _handleErrorEvent(LocationErrorEvent.locationFrequency); + } + } + + bool _handleErrorEvent(LocationErrorEvent event) { if (!ref.mounted) return false; state = state.copyWith( isSubmitting: false, - errorMessage: _formatError(e), + errorEvent: event, ); return false; } - - String _formatError(Object e) { - final msg = e.toString(); - return msg.startsWith('Exception: ') ? msg.substring(11) : msg; - } } diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_view_state.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_view_state.dart index 1c1af06e..96bd8921 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_view_state.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_view_state.dart @@ -5,6 +5,26 @@ import 'package:location/src/core/domain/entities/frequent_place_entity.dart'; part 'location_view_state.freezed.dart'; +enum LocationSuccessEvent { + geofenceCreated, + geofenceUpdated, + geofenceDeleted, + frequentPlaceCreated, + frequentPlaceUpdated, + frequentPlaceDeleted, +} + +enum LocationErrorEvent { + geofenceCreate, + geofenceUpdate, + geofenceDelete, + frequentPlaceCreate, + frequentPlaceUpdate, + frequentPlaceDelete, + positionHistory, + locationFrequency, +} + @freezed abstract class LocationViewState with _$LocationViewState { const factory LocationViewState({ @@ -15,6 +35,7 @@ abstract class LocationViewState with _$LocationViewState { @Default(false) bool isLoadingHistory, @Default(false) bool isSubmitting, @Default(false) bool showRouteTrail, - @Default('') String errorMessage, + LocationErrorEvent? errorEvent, + LocationSuccessEvent? successMessage, }) = _LocationViewState; } diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_view_state.freezed.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_view_state.freezed.dart index 69c30530..2e248c8b 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_view_state.freezed.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/state/location_view_state.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$LocationViewState { - List get geofences; List get frequentPlaces; List get positionHistory; bool get isLoading; bool get isLoadingHistory; bool get isSubmitting; bool get showRouteTrail; String get errorMessage; + List get geofences; List get frequentPlaces; List get positionHistory; bool get isLoading; bool get isLoadingHistory; bool get isSubmitting; bool get showRouteTrail; LocationErrorEvent? get errorEvent; LocationSuccessEvent? get successMessage; /// Create a copy of LocationViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $LocationViewStateCopyWith get copyWith => _$LocationViewStat @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is LocationViewState&&const DeepCollectionEquality().equals(other.geofences, geofences)&&const DeepCollectionEquality().equals(other.frequentPlaces, frequentPlaces)&&const DeepCollectionEquality().equals(other.positionHistory, positionHistory)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingHistory, isLoadingHistory) || other.isLoadingHistory == isLoadingHistory)&&(identical(other.isSubmitting, isSubmitting) || other.isSubmitting == isSubmitting)&&(identical(other.showRouteTrail, showRouteTrail) || other.showRouteTrail == showRouteTrail)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is LocationViewState&&const DeepCollectionEquality().equals(other.geofences, geofences)&&const DeepCollectionEquality().equals(other.frequentPlaces, frequentPlaces)&&const DeepCollectionEquality().equals(other.positionHistory, positionHistory)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingHistory, isLoadingHistory) || other.isLoadingHistory == isLoadingHistory)&&(identical(other.isSubmitting, isSubmitting) || other.isSubmitting == isSubmitting)&&(identical(other.showRouteTrail, showRouteTrail) || other.showRouteTrail == showRouteTrail)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)&&(identical(other.successMessage, successMessage) || other.successMessage == successMessage)); } @override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(geofences),const DeepCollectionEquality().hash(frequentPlaces),const DeepCollectionEquality().hash(positionHistory),isLoading,isLoadingHistory,isSubmitting,showRouteTrail,errorMessage); +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(geofences),const DeepCollectionEquality().hash(frequentPlaces),const DeepCollectionEquality().hash(positionHistory),isLoading,isLoadingHistory,isSubmitting,showRouteTrail,errorEvent,successMessage); @override String toString() { - return 'LocationViewState(geofences: $geofences, frequentPlaces: $frequentPlaces, positionHistory: $positionHistory, isLoading: $isLoading, isLoadingHistory: $isLoadingHistory, isSubmitting: $isSubmitting, showRouteTrail: $showRouteTrail, errorMessage: $errorMessage)'; + return 'LocationViewState(geofences: $geofences, frequentPlaces: $frequentPlaces, positionHistory: $positionHistory, isLoading: $isLoading, isLoadingHistory: $isLoadingHistory, isSubmitting: $isSubmitting, showRouteTrail: $showRouteTrail, errorEvent: $errorEvent, successMessage: $successMessage)'; } @@ -45,7 +45,7 @@ abstract mixin class $LocationViewStateCopyWith<$Res> { factory $LocationViewStateCopyWith(LocationViewState value, $Res Function(LocationViewState) _then) = _$LocationViewStateCopyWithImpl; @useResult $Res call({ - List geofences, List frequentPlaces, List positionHistory, bool isLoading, bool isLoadingHistory, bool isSubmitting, bool showRouteTrail, String errorMessage + List geofences, List frequentPlaces, List positionHistory, bool isLoading, bool isLoadingHistory, bool isSubmitting, bool showRouteTrail, LocationErrorEvent? errorEvent, LocationSuccessEvent? successMessage }); @@ -62,7 +62,7 @@ class _$LocationViewStateCopyWithImpl<$Res> /// Create a copy of LocationViewState /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? geofences = null,Object? frequentPlaces = null,Object? positionHistory = null,Object? isLoading = null,Object? isLoadingHistory = null,Object? isSubmitting = null,Object? showRouteTrail = null,Object? errorMessage = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? geofences = null,Object? frequentPlaces = null,Object? positionHistory = null,Object? isLoading = null,Object? isLoadingHistory = null,Object? isSubmitting = null,Object? showRouteTrail = null,Object? errorEvent = freezed,Object? successMessage = freezed,}) { return _then(_self.copyWith( geofences: null == geofences ? _self.geofences : geofences // ignore: cast_nullable_to_non_nullable as List,frequentPlaces: null == frequentPlaces ? _self.frequentPlaces : frequentPlaces // ignore: cast_nullable_to_non_nullable @@ -71,8 +71,9 @@ as List,isLoading: null == isLoading ? _self.isLoading : isLoadi as bool,isLoadingHistory: null == isLoadingHistory ? _self.isLoadingHistory : isLoadingHistory // ignore: cast_nullable_to_non_nullable as bool,isSubmitting: null == isSubmitting ? _self.isSubmitting : isSubmitting // ignore: cast_nullable_to_non_nullable as bool,showRouteTrail: null == showRouteTrail ? _self.showRouteTrail : showRouteTrail // ignore: cast_nullable_to_non_nullable -as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable -as String, +as bool,errorEvent: freezed == errorEvent ? _self.errorEvent : errorEvent // ignore: cast_nullable_to_non_nullable +as LocationErrorEvent?,successMessage: freezed == successMessage ? _self.successMessage : successMessage // ignore: cast_nullable_to_non_nullable +as LocationSuccessEvent?, )); } @@ -157,10 +158,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( List geofences, List frequentPlaces, List positionHistory, bool isLoading, bool isLoadingHistory, bool isSubmitting, bool showRouteTrail, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( List geofences, List frequentPlaces, List positionHistory, bool isLoading, bool isLoadingHistory, bool isSubmitting, bool showRouteTrail, LocationErrorEvent? errorEvent, LocationSuccessEvent? successMessage)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _LocationViewState() when $default != null: -return $default(_that.geofences,_that.frequentPlaces,_that.positionHistory,_that.isLoading,_that.isLoadingHistory,_that.isSubmitting,_that.showRouteTrail,_that.errorMessage);case _: +return $default(_that.geofences,_that.frequentPlaces,_that.positionHistory,_that.isLoading,_that.isLoadingHistory,_that.isSubmitting,_that.showRouteTrail,_that.errorEvent,_that.successMessage);case _: return orElse(); } @@ -178,10 +179,10 @@ return $default(_that.geofences,_that.frequentPlaces,_that.positionHistory,_that /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( List geofences, List frequentPlaces, List positionHistory, bool isLoading, bool isLoadingHistory, bool isSubmitting, bool showRouteTrail, String errorMessage) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( List geofences, List frequentPlaces, List positionHistory, bool isLoading, bool isLoadingHistory, bool isSubmitting, bool showRouteTrail, LocationErrorEvent? errorEvent, LocationSuccessEvent? successMessage) $default,) {final _that = this; switch (_that) { case _LocationViewState(): -return $default(_that.geofences,_that.frequentPlaces,_that.positionHistory,_that.isLoading,_that.isLoadingHistory,_that.isSubmitting,_that.showRouteTrail,_that.errorMessage);case _: +return $default(_that.geofences,_that.frequentPlaces,_that.positionHistory,_that.isLoading,_that.isLoadingHistory,_that.isSubmitting,_that.showRouteTrail,_that.errorEvent,_that.successMessage);case _: throw StateError('Unexpected subclass'); } @@ -198,10 +199,10 @@ return $default(_that.geofences,_that.frequentPlaces,_that.positionHistory,_that /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( List geofences, List frequentPlaces, List positionHistory, bool isLoading, bool isLoadingHistory, bool isSubmitting, bool showRouteTrail, String errorMessage)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( List geofences, List frequentPlaces, List positionHistory, bool isLoading, bool isLoadingHistory, bool isSubmitting, bool showRouteTrail, LocationErrorEvent? errorEvent, LocationSuccessEvent? successMessage)? $default,) {final _that = this; switch (_that) { case _LocationViewState() when $default != null: -return $default(_that.geofences,_that.frequentPlaces,_that.positionHistory,_that.isLoading,_that.isLoadingHistory,_that.isSubmitting,_that.showRouteTrail,_that.errorMessage);case _: +return $default(_that.geofences,_that.frequentPlaces,_that.positionHistory,_that.isLoading,_that.isLoadingHistory,_that.isSubmitting,_that.showRouteTrail,_that.errorEvent,_that.successMessage);case _: return null; } @@ -213,7 +214,7 @@ return $default(_that.geofences,_that.frequentPlaces,_that.positionHistory,_that class _LocationViewState implements LocationViewState { - const _LocationViewState({final List geofences = const [], final List frequentPlaces = const [], final List positionHistory = const [], this.isLoading = true, this.isLoadingHistory = false, this.isSubmitting = false, this.showRouteTrail = false, this.errorMessage = ''}): _geofences = geofences,_frequentPlaces = frequentPlaces,_positionHistory = positionHistory; + const _LocationViewState({final List geofences = const [], final List frequentPlaces = const [], final List positionHistory = const [], this.isLoading = true, this.isLoadingHistory = false, this.isSubmitting = false, this.showRouteTrail = false, this.errorEvent, this.successMessage}): _geofences = geofences,_frequentPlaces = frequentPlaces,_positionHistory = positionHistory; final List _geofences; @@ -241,7 +242,8 @@ class _LocationViewState implements LocationViewState { @override@JsonKey() final bool isLoadingHistory; @override@JsonKey() final bool isSubmitting; @override@JsonKey() final bool showRouteTrail; -@override@JsonKey() final String errorMessage; +@override final LocationErrorEvent? errorEvent; +@override final LocationSuccessEvent? successMessage; /// Create a copy of LocationViewState /// with the given fields replaced by the non-null parameter values. @@ -253,16 +255,16 @@ _$LocationViewStateCopyWith<_LocationViewState> get copyWith => __$LocationViewS @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _LocationViewState&&const DeepCollectionEquality().equals(other._geofences, _geofences)&&const DeepCollectionEquality().equals(other._frequentPlaces, _frequentPlaces)&&const DeepCollectionEquality().equals(other._positionHistory, _positionHistory)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingHistory, isLoadingHistory) || other.isLoadingHistory == isLoadingHistory)&&(identical(other.isSubmitting, isSubmitting) || other.isSubmitting == isSubmitting)&&(identical(other.showRouteTrail, showRouteTrail) || other.showRouteTrail == showRouteTrail)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LocationViewState&&const DeepCollectionEquality().equals(other._geofences, _geofences)&&const DeepCollectionEquality().equals(other._frequentPlaces, _frequentPlaces)&&const DeepCollectionEquality().equals(other._positionHistory, _positionHistory)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingHistory, isLoadingHistory) || other.isLoadingHistory == isLoadingHistory)&&(identical(other.isSubmitting, isSubmitting) || other.isSubmitting == isSubmitting)&&(identical(other.showRouteTrail, showRouteTrail) || other.showRouteTrail == showRouteTrail)&&(identical(other.errorEvent, errorEvent) || other.errorEvent == errorEvent)&&(identical(other.successMessage, successMessage) || other.successMessage == successMessage)); } @override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_geofences),const DeepCollectionEquality().hash(_frequentPlaces),const DeepCollectionEquality().hash(_positionHistory),isLoading,isLoadingHistory,isSubmitting,showRouteTrail,errorMessage); +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_geofences),const DeepCollectionEquality().hash(_frequentPlaces),const DeepCollectionEquality().hash(_positionHistory),isLoading,isLoadingHistory,isSubmitting,showRouteTrail,errorEvent,successMessage); @override String toString() { - return 'LocationViewState(geofences: $geofences, frequentPlaces: $frequentPlaces, positionHistory: $positionHistory, isLoading: $isLoading, isLoadingHistory: $isLoadingHistory, isSubmitting: $isSubmitting, showRouteTrail: $showRouteTrail, errorMessage: $errorMessage)'; + return 'LocationViewState(geofences: $geofences, frequentPlaces: $frequentPlaces, positionHistory: $positionHistory, isLoading: $isLoading, isLoadingHistory: $isLoadingHistory, isSubmitting: $isSubmitting, showRouteTrail: $showRouteTrail, errorEvent: $errorEvent, successMessage: $successMessage)'; } @@ -273,7 +275,7 @@ abstract mixin class _$LocationViewStateCopyWith<$Res> implements $LocationViewS factory _$LocationViewStateCopyWith(_LocationViewState value, $Res Function(_LocationViewState) _then) = __$LocationViewStateCopyWithImpl; @override @useResult $Res call({ - List geofences, List frequentPlaces, List positionHistory, bool isLoading, bool isLoadingHistory, bool isSubmitting, bool showRouteTrail, String errorMessage + List geofences, List frequentPlaces, List positionHistory, bool isLoading, bool isLoadingHistory, bool isSubmitting, bool showRouteTrail, LocationErrorEvent? errorEvent, LocationSuccessEvent? successMessage }); @@ -290,7 +292,7 @@ class __$LocationViewStateCopyWithImpl<$Res> /// Create a copy of LocationViewState /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? geofences = null,Object? frequentPlaces = null,Object? positionHistory = null,Object? isLoading = null,Object? isLoadingHistory = null,Object? isSubmitting = null,Object? showRouteTrail = null,Object? errorMessage = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? geofences = null,Object? frequentPlaces = null,Object? positionHistory = null,Object? isLoading = null,Object? isLoadingHistory = null,Object? isSubmitting = null,Object? showRouteTrail = null,Object? errorEvent = freezed,Object? successMessage = freezed,}) { return _then(_LocationViewState( geofences: null == geofences ? _self._geofences : geofences // ignore: cast_nullable_to_non_nullable as List,frequentPlaces: null == frequentPlaces ? _self._frequentPlaces : frequentPlaces // ignore: cast_nullable_to_non_nullable @@ -299,8 +301,9 @@ as List,isLoading: null == isLoading ? _self.isLoading : isLoadi as bool,isLoadingHistory: null == isLoadingHistory ? _self.isLoadingHistory : isLoadingHistory // ignore: cast_nullable_to_non_nullable as bool,isSubmitting: null == isSubmitting ? _self.isSubmitting : isSubmitting // ignore: cast_nullable_to_non_nullable as bool,showRouteTrail: null == showRouteTrail ? _self.showRouteTrail : showRouteTrail // ignore: cast_nullable_to_non_nullable -as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable -as String, +as bool,errorEvent: freezed == errorEvent ? _self.errorEvent : errorEvent // ignore: cast_nullable_to_non_nullable +as LocationErrorEvent?,successMessage: freezed == successMessage ? _self.successMessage : successMessage // ignore: cast_nullable_to_non_nullable +as LocationSuccessEvent?, )); } diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_frequent_place_sheet.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_frequent_place_sheet.dart index 8f13c111..30b02d93 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_frequent_place_sheet.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_frequent_place_sheet.dart @@ -124,8 +124,8 @@ class _FrequentPlaceSheetState extends ConsumerState<_FrequentPlaceSheet> { final isSubmitting = ref.watch( locationViewModelProvider.select((s) => s.isSubmitting), ); - final errorMessage = ref.watch( - locationViewModelProvider.select((s) => s.errorMessage), + final errorEvent = ref.watch( + locationViewModelProvider.select((s) => s.errorEvent), ); return DraggableScrollableSheet( @@ -270,11 +270,11 @@ class _FrequentPlaceSheetState extends ConsumerState<_FrequentPlaceSheet> { ); }), ], - if (errorMessage.isNotEmpty) + if (errorEvent != null) Padding( padding: const EdgeInsets.only(top: 8), child: Text( - errorMessage, + context.translate(I18n.errorGeneric), style: const TextStyle(color: Colors.red, fontSize: 13), ), diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_geofence_sheet.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_geofence_sheet.dart index cec32ea7..317260ff 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_geofence_sheet.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_geofence_sheet.dart @@ -130,8 +130,8 @@ class _GeofenceSheetState extends ConsumerState<_GeofenceSheet> { final isSubmitting = ref.watch( locationViewModelProvider.select((s) => s.isSubmitting), ); - final errorMessage = ref.watch( - locationViewModelProvider.select((s) => s.errorMessage), + final errorEvent = ref.watch( + locationViewModelProvider.select((s) => s.errorEvent), ); return DraggableScrollableSheet( @@ -252,11 +252,11 @@ class _GeofenceSheetState extends ConsumerState<_GeofenceSheet> { primaryColor: primaryColor, ), ), - if (errorMessage.isNotEmpty) + if (errorEvent != null) Padding( padding: const EdgeInsets.only(top: 8), child: Text( - errorMessage, + context.translate(I18n.errorGeneric), style: const TextStyle(color: Colors.red, fontSize: 13), ), ), diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/location_map.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/location_map.dart index f2ef7a19..ab92d9f7 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/location_map.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/location_map.dart @@ -80,6 +80,15 @@ class _LocationMapState extends ConsumerState void initState() { super.initState(); _mapController = MapController(); + _startMonitoring(); + } + + void _startMonitoring() { + _followTimer?.cancel(); + final frequency = widget.selectedDevice?.settings.frequency ?? 60; + _followTimer = Timer.periodic(Duration(seconds: frequency), (_) { + widget.onRefreshPosition(); + }); } @override @@ -94,7 +103,7 @@ class _LocationMapState extends ConsumerState void didUpdateWidget(LocationMap oldWidget) { super.didUpdateWidget(oldWidget); if (widget.selectedDevice?.id != oldWidget.selectedDevice?.id) { - _stopFollowing(); + _startMonitoring(); } if (widget.selectedPosition != null && widget.selectedPosition != oldWidget.selectedPosition) { @@ -176,28 +185,6 @@ class _LocationMapState extends ConsumerState _animatedMove(target.center, target.zoom); } - - void _toggleFollowing() { - final wasFollowing = ref.read(locationMapViewModelProvider).isFollowing; - _vm.toggleFollowing(); - if (!wasFollowing) { - _centerOnDevice(); - widget.onRefreshPosition(); - _followTimer = Timer.periodic(const Duration(seconds: 30), (_) { - widget.onRefreshPosition(); - }); - } else { - _stopFollowing(); - } - } - - void _stopFollowing() { - _followTimer?.cancel(); - _followTimer = null; - _vm.stopFollowing(); - } - - void _shareLocation() { final position = widget.selectedPosition; if (position == null) return; @@ -220,6 +207,33 @@ class _LocationMapState extends ConsumerState Share.share(text.toString().trim()); } + Future _updateFrequency(int frequency) async { + final success = await ref + .read(locationViewModelProvider.notifier) + .updateLocationFrequency(frequency: frequency); + if (!mounted) return; + if (success) { + _followTimer?.cancel(); + _followTimer = Timer.periodic(Duration(seconds: frequency), (_) { + widget.onRefreshPosition(); + }); + showTopSnackbar( + context, + message: context.translate( + I18n.locationFrequencyUpdated, + args: {'minutes': '${frequency ~/ 60}'}, + ), + type: MessageType.success, + ); + } else { + showTopSnackbar( + context, + message: context.translate(I18n.errorLocationFrequency), + type: MessageType.error, + ); + } + } + void _confirmPlacement() { final center = _mapController.camera.center; final mapState = ref.read(locationMapViewModelProvider); @@ -540,7 +554,27 @@ class _LocationMapState extends ConsumerState } return [ - Positioned(top: 12, left: 12, child: const MapStyleSelector()), + Positioned( + top: 12, + left: 12, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const MapStyleSelector(), + if (widget.selectedDevice?.capabilities?.location != null && + widget.selectedDevice!.capabilities!.location!.options.isNotEmpty) ...[ + const SizedBox(height: 8), + FrequencySelector( + currentFrequency: + widget.selectedDevice!.settings.frequency, + options: + widget.selectedDevice!.capabilities!.location!.options, + onChanged: _updateFrequency, + ), + ], + ], + ), + ), Positioned( top: 12, right: 12, @@ -561,14 +595,12 @@ class _LocationMapState extends ConsumerState right: 12, child: MapActionsPanel( actionsExpanded: mapState.actionsExpanded, - isFollowing: mapState.isFollowing, hasPosition: widget.selectedPosition != null, onToggleExpanded: _vm.toggleActionsExpanded, onListTap: _showListSheet, onAddGeofence: () => _vm.startPlacing(PlacingMode.geofence), onAddFrequentPlace: () => _vm.startPlacing(PlacingMode.frequentPlace), onShareTap: _shareLocation, - onFollowTap: _toggleFollowing, onRefreshTap: widget.onRefreshPosition, onCenterTap: _centerOnDevice, ), diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/map_actions_panel.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/map_actions_panel.dart index a7d4aeab..44ef7d63 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/map_actions_panel.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/map_actions_panel.dart @@ -1,31 +1,28 @@ import 'package:flutter/material.dart'; -import 'package:location/src/features/location/presentation/state/location_map_view_state.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:location/src/features/location/presentation/state/location_map_view_model.dart'; import 'map_action_button.dart'; class MapActionsPanel extends StatelessWidget { final bool actionsExpanded; - final bool isFollowing; final bool hasPosition; final VoidCallback onToggleExpanded; final VoidCallback onListTap; final VoidCallback onAddGeofence; final VoidCallback onAddFrequentPlace; final VoidCallback onShareTap; - final VoidCallback onFollowTap; final VoidCallback onRefreshTap; final VoidCallback onCenterTap; const MapActionsPanel({ super.key, required this.actionsExpanded, - required this.isFollowing, required this.hasPosition, required this.onToggleExpanded, required this.onListTap, required this.onAddGeofence, required this.onAddFrequentPlace, required this.onShareTap, - required this.onFollowTap, required this.onRefreshTap, required this.onCenterTap, }); @@ -53,12 +50,6 @@ class MapActionsPanel extends StatelessWidget { const SizedBox(height: 8), MapActionButton(icon: Icons.share, onTap: onShareTap), const SizedBox(height: 8), - MapActionButton( - icon: isFollowing ? Icons.gps_fixed : Icons.gps_not_fixed, - onTap: onFollowTap, - isActive: isFollowing, - ), - const SizedBox(height: 8), ], ) : const SizedBox.shrink(), @@ -77,3 +68,96 @@ class MapActionsPanel extends StatelessWidget { ); } } + +class FrequencySelector extends ConsumerWidget { + final int currentFrequency; + final List options; + final ValueChanged onChanged; + + const FrequencySelector({ + super.key, + required this.currentFrequency, + required this.options, + required this.onChanged, + }); + + String _formatSeconds(int seconds) { + if (seconds >= 60) return '${seconds ~/ 60}m'; + return '${seconds}s'; + } + + @override + Widget build(BuildContext context, WidgetRef ref) { + final expanded = ref.watch( + locationMapViewModelProvider.select((s) => s.frequencyExpanded), + ); + final vm = ref.read(locationMapViewModelProvider.notifier); + + return AnimatedSize( + duration: const Duration(milliseconds: 200), + curve: Curves.easeInOut, + alignment: Alignment.topCenter, + child: expanded + ? _buildSegmented(context, vm) + : MapActionButton( + icon: Icons.timer_outlined, + onTap: vm.toggleFrequencyExpanded, + ), + ); + } + + Widget _buildSegmented(BuildContext context, LocationMapViewModel vm) { + return Material( + elevation: 2, + borderRadius: BorderRadius.circular(8), + color: Theme.of(context).colorScheme.surface, + child: Padding( + padding: const EdgeInsets.all(4), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ...options.map((opt) { + final selected = opt == currentFrequency; + return GestureDetector( + onTap: () { + onChanged(opt); + vm.collapseFrequency(); + }, + child: Container( + width: 40, + height: 32, + margin: const EdgeInsets.symmetric(vertical: 2), + decoration: BoxDecoration( + color: selected + ? Theme.of(context).primaryColor + : Colors.transparent, + borderRadius: BorderRadius.circular(6), + ), + child: Center( + child: Text( + _formatSeconds(opt), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: selected ? Theme.of(context).colorScheme.surface : Theme.of(context).colorScheme.onSurface, + ), + ), + ), + ), + ); + }), + const SizedBox(height: 2), + GestureDetector( + onTap: vm.collapseFrequency, + child: const SizedBox( + width: 40, + height: 24, + child: Icon(Icons.close, size: 16, color: Colors.black54), + ), + ), + ], + ), + ), + ); + } +} diff --git a/modules/legacy/modules/location/pubspec.lock b/modules/legacy/modules/location/pubspec.lock index 7e73791f..43c6ed77 100644 --- a/modules/legacy/modules/location/pubspec.lock +++ b/modules/legacy/modules/location/pubspec.lock @@ -450,7 +450,7 @@ packages: source: hosted version: "4.0.0" get_it: - dependency: transitive + dependency: "direct main" description: name: get_it sha256: "568d62f0e68666fb5d95519743b3c24a34c7f19d834b0658c46e26d778461f66" diff --git a/modules/legacy/modules/location/pubspec.yaml b/modules/legacy/modules/location/pubspec.yaml index 3156ae6d..00e7ef9a 100644 --- a/modules/legacy/modules/location/pubspec.yaml +++ b/modules/legacy/modules/location/pubspec.yaml @@ -24,6 +24,7 @@ dependencies: path: ../../../../packages/sf_shared utils: path: ../../../../packages/utils + get_it: ^9.0.5 flutter_riverpod: ^3.0.3 go_router: ^17.0.0 freezed_annotation: ^3.1.0 diff --git a/modules/legacy/modules/settings/lib/src/core/data/datasources/language_remote_datasource_impl.dart b/modules/legacy/modules/settings/lib/src/core/data/datasources/language_remote_datasource_impl.dart index d54ce92c..b8e50126 100644 --- a/modules/legacy/modules/settings/lib/src/core/data/datasources/language_remote_datasource_impl.dart +++ b/modules/legacy/modules/settings/lib/src/core/data/datasources/language_remote_datasource_impl.dart @@ -1,33 +1,22 @@ import 'package:legacy_shared/legacy_shared.dart'; -import 'package:sf_infrastructure/sf_infrastructure.dart'; import 'package:sf_shared/sf_shared.dart'; import 'language_remote_datasource.dart'; class LanguageRemoteDatasourceImpl implements LanguageRemoteDatasource { - LanguageRemoteDatasourceImpl(this._repository); + LanguageRemoteDatasourceImpl(this._datasource); - final QuestiaRepository _repository; + final DeviceSettingsUpdateDatasource _datasource; @override Future updateDeviceLanguage({ required DeviceEntity device, required String newLanguage, }) async { - final settings = Map.from(device.settings); - settings['language'] = newLanguage; - - final csvBase64 = DeviceCsvBuilder.buildBase64Csv( + final updatedSettings = device.settings.copyWith(language: newLanguage); + await _datasource.updateDeviceSettings( device: device, - settings: settings, - ); - - await safeCall( - () => _repository.put( - '/devices', - body: {'csv': csvBase64}, - ), - 'Error updating device language', + updatedSettings: updatedSettings, ); } } diff --git a/modules/legacy/modules/settings/lib/src/core/providers/language_remote_datasource_provider.dart b/modules/legacy/modules/settings/lib/src/core/providers/language_remote_datasource_provider.dart index 1a636862..f3b323c2 100644 --- a/modules/legacy/modules/settings/lib/src/core/providers/language_remote_datasource_provider.dart +++ b/modules/legacy/modules/settings/lib/src/core/providers/language_remote_datasource_provider.dart @@ -1,10 +1,10 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/legacy_shared.dart'; import 'package:settings/src/core/data/datasources/language_remote_datasource.dart'; import 'package:settings/src/core/data/datasources/language_remote_datasource_impl.dart'; -import 'package:sf_infrastructure/sf_infrastructure.dart'; final languageRemoteDatasourceProvider = Provider((ref) { - final questiaRepository = getIt(); - return LanguageRemoteDatasourceImpl(questiaRepository); + final datasource = ref.read(deviceSettingsUpdateProvider); + return LanguageRemoteDatasourceImpl(datasource); }); diff --git a/modules/legacy/modules/settings/lib/src/features/language/presentation/state/language_view_model.dart b/modules/legacy/modules/settings/lib/src/features/language/presentation/state/language_view_model.dart index d7da8801..689eb3ed 100644 --- a/modules/legacy/modules/settings/lib/src/features/language/presentation/state/language_view_model.dart +++ b/modules/legacy/modules/settings/lib/src/features/language/presentation/state/language_view_model.dart @@ -26,7 +26,7 @@ class LanguageViewModel extends Notifier { state = state.copyWith( isLoading: false, device: device, - language: device?.settings['language'] ?? 'es', + language: device?.settings.language ?? 'es', ); } catch (e) { if (!ref.mounted) return; @@ -43,7 +43,7 @@ class LanguageViewModel extends Notifier { final device = state.device; if (device == null) return; - if (state.language == device.settings['language']) { + if (state.language == device.settings.language) { state = state.copyWith(isComplete: true); return; } diff --git a/modules/legacy/modules/settings/lib/src/features/sound/presentation/state/sound_view_model.dart b/modules/legacy/modules/settings/lib/src/features/sound/presentation/state/sound_view_model.dart index d11a670e..f515d0d0 100644 --- a/modules/legacy/modules/settings/lib/src/features/sound/presentation/state/sound_view_model.dart +++ b/modules/legacy/modules/settings/lib/src/features/sound/presentation/state/sound_view_model.dart @@ -4,19 +4,17 @@ import 'package:legacy_shared/legacy_shared.dart'; import 'sound_view_state.dart'; final soundViewModelProvider = -NotifierProvider.autoDispose( + NotifierProvider.autoDispose( SoundViewModel.new, ); class SoundViewModel extends Notifier { - late final CommandsRepository _commandsRepository; + late final DeviceSettingsUpdateDatasource _datasource; @override SoundViewState build() { - _commandsRepository = ref.read(commandsRepositoryProvider); - + _datasource = ref.read(deviceSettingsUpdateProvider); Future.microtask(() => load()); - return const SoundViewState(); } @@ -25,43 +23,47 @@ class SoundViewModel extends Notifier { if (device == null) return; state = state.copyWith( - deviceId: device.identificator, - soundOption: device.settings['soundMode'] ?? 'VIBRATION', + device: device, + soundOption: device.settings.soundMode, isLoading: false, ); } - + void setSoundOption(String value) { if (state.soundOption == value) return; - - state = state.copyWith( - soundOption: value - ); + state = state.copyWith(soundOption: value); } Future submit() async { + final device = state.device; + if (device == null) return; + + if (state.soundOption == device.settings.soundMode) { + state = state.copyWith(isComplete: true); + return; + } + try { state = state.copyWith( isLoading: true, isComplete: false, + errorMessage: '', ); - final request = SendCommandRequestModel( - device: state.deviceId, - command: DeviceCommand.setSoundMode, - data: {'soundMode': state.soundOption} + final updatedSettings = device.settings.copyWith( + soundMode: state.soundOption, ); - await _commandsRepository.send(request: request); - state = state.copyWith( - isLoading: false, - isComplete: true, + await _datasource.updateDeviceSettings( + device: device, + updatedSettings: updatedSettings, ); + + if (!ref.mounted) return; + state = state.copyWith(isLoading: false, isComplete: true); } catch (e) { - state = state.copyWith( - isLoading: false, - errorMessage: e.toString() - ); + if (!ref.mounted) return; + state = state.copyWith(isLoading: false, errorMessage: e.toString()); } } } diff --git a/modules/legacy/modules/settings/lib/src/features/sound/presentation/state/sound_view_state.dart b/modules/legacy/modules/settings/lib/src/features/sound/presentation/state/sound_view_state.dart index 30824877..afdb8b66 100644 --- a/modules/legacy/modules/settings/lib/src/features/sound/presentation/state/sound_view_state.dart +++ b/modules/legacy/modules/settings/lib/src/features/sound/presentation/state/sound_view_state.dart @@ -1,12 +1,12 @@ -import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:sf_shared/sf_shared.dart'; part 'sound_view_state.freezed.dart'; @freezed abstract class SoundViewState with _$SoundViewState { const factory SoundViewState({ - @Default('') String deviceId, + DeviceEntity? device, String? soundOption, @Default(true) bool isLoading, @Default(false) bool isComplete, diff --git a/modules/legacy/modules/settings/lib/src/features/sound/presentation/state/sound_view_state.freezed.dart b/modules/legacy/modules/settings/lib/src/features/sound/presentation/state/sound_view_state.freezed.dart index 3754a4ab..5bd68301 100644 --- a/modules/legacy/modules/settings/lib/src/features/sound/presentation/state/sound_view_state.freezed.dart +++ b/modules/legacy/modules/settings/lib/src/features/sound/presentation/state/sound_view_state.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$SoundViewState { - String get deviceId; String? get soundOption; bool get isLoading; bool get isComplete; String get errorMessage; + DeviceEntity? get device; String? get soundOption; bool get isLoading; bool get isComplete; String get errorMessage; /// Create a copy of SoundViewState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,16 +25,16 @@ $SoundViewStateCopyWith get copyWith => _$SoundViewStateCopyWith @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is SoundViewState&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.soundOption, soundOption) || other.soundOption == soundOption)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is SoundViewState&&(identical(other.device, device) || other.device == device)&&(identical(other.soundOption, soundOption) || other.soundOption == soundOption)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override -int get hashCode => Object.hash(runtimeType,deviceId,soundOption,isLoading,isComplete,errorMessage); +int get hashCode => Object.hash(runtimeType,device,soundOption,isLoading,isComplete,errorMessage); @override String toString() { - return 'SoundViewState(deviceId: $deviceId, soundOption: $soundOption, isLoading: $isLoading, isComplete: $isComplete, errorMessage: $errorMessage)'; + return 'SoundViewState(device: $device, soundOption: $soundOption, isLoading: $isLoading, isComplete: $isComplete, errorMessage: $errorMessage)'; } @@ -45,11 +45,11 @@ abstract mixin class $SoundViewStateCopyWith<$Res> { factory $SoundViewStateCopyWith(SoundViewState value, $Res Function(SoundViewState) _then) = _$SoundViewStateCopyWithImpl; @useResult $Res call({ - String deviceId, String? soundOption, bool isLoading, bool isComplete, String errorMessage + DeviceEntity? device, String? soundOption, bool isLoading, bool isComplete, String errorMessage }); - +$DeviceEntityCopyWith<$Res>? get device; } /// @nodoc @@ -62,17 +62,29 @@ class _$SoundViewStateCopyWithImpl<$Res> /// Create a copy of SoundViewState /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? deviceId = null,Object? soundOption = freezed,Object? isLoading = null,Object? isComplete = null,Object? errorMessage = null,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? device = freezed,Object? soundOption = freezed,Object? isLoading = null,Object? isComplete = null,Object? errorMessage = null,}) { return _then(_self.copyWith( -deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable -as String,soundOption: freezed == soundOption ? _self.soundOption : soundOption // ignore: cast_nullable_to_non_nullable +device: freezed == device ? _self.device : device // ignore: cast_nullable_to_non_nullable +as DeviceEntity?,soundOption: freezed == soundOption ? _self.soundOption : soundOption // ignore: cast_nullable_to_non_nullable as String?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable as bool,isComplete: null == isComplete ? _self.isComplete : isComplete // ignore: cast_nullable_to_non_nullable as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable as String, )); } +/// Create a copy of SoundViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceEntityCopyWith<$Res>? get device { + if (_self.device == null) { + return null; + } + return $DeviceEntityCopyWith<$Res>(_self.device!, (value) { + return _then(_self.copyWith(device: value)); + }); +} } @@ -154,10 +166,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String deviceId, String? soundOption, bool isLoading, bool isComplete, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( DeviceEntity? device, String? soundOption, bool isLoading, bool isComplete, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _SoundViewState() when $default != null: -return $default(_that.deviceId,_that.soundOption,_that.isLoading,_that.isComplete,_that.errorMessage);case _: +return $default(_that.device,_that.soundOption,_that.isLoading,_that.isComplete,_that.errorMessage);case _: return orElse(); } @@ -175,10 +187,10 @@ return $default(_that.deviceId,_that.soundOption,_that.isLoading,_that.isComplet /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String deviceId, String? soundOption, bool isLoading, bool isComplete, String errorMessage) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( DeviceEntity? device, String? soundOption, bool isLoading, bool isComplete, String errorMessage) $default,) {final _that = this; switch (_that) { case _SoundViewState(): -return $default(_that.deviceId,_that.soundOption,_that.isLoading,_that.isComplete,_that.errorMessage);case _: +return $default(_that.device,_that.soundOption,_that.isLoading,_that.isComplete,_that.errorMessage);case _: throw StateError('Unexpected subclass'); } @@ -195,10 +207,10 @@ return $default(_that.deviceId,_that.soundOption,_that.isLoading,_that.isComplet /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String deviceId, String? soundOption, bool isLoading, bool isComplete, String errorMessage)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( DeviceEntity? device, String? soundOption, bool isLoading, bool isComplete, String errorMessage)? $default,) {final _that = this; switch (_that) { case _SoundViewState() when $default != null: -return $default(_that.deviceId,_that.soundOption,_that.isLoading,_that.isComplete,_that.errorMessage);case _: +return $default(_that.device,_that.soundOption,_that.isLoading,_that.isComplete,_that.errorMessage);case _: return null; } @@ -210,10 +222,10 @@ return $default(_that.deviceId,_that.soundOption,_that.isLoading,_that.isComplet class _SoundViewState implements SoundViewState { - const _SoundViewState({this.deviceId = '', this.soundOption, this.isLoading = true, this.isComplete = false, this.errorMessage = ''}); + const _SoundViewState({this.device, this.soundOption, this.isLoading = true, this.isComplete = false, this.errorMessage = ''}); -@override@JsonKey() final String deviceId; +@override final DeviceEntity? device; @override final String? soundOption; @override@JsonKey() final bool isLoading; @override@JsonKey() final bool isComplete; @@ -229,16 +241,16 @@ _$SoundViewStateCopyWith<_SoundViewState> get copyWith => __$SoundViewStateCopyW @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _SoundViewState&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.soundOption, soundOption) || other.soundOption == soundOption)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SoundViewState&&(identical(other.device, device) || other.device == device)&&(identical(other.soundOption, soundOption) || other.soundOption == soundOption)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)); } @override -int get hashCode => Object.hash(runtimeType,deviceId,soundOption,isLoading,isComplete,errorMessage); +int get hashCode => Object.hash(runtimeType,device,soundOption,isLoading,isComplete,errorMessage); @override String toString() { - return 'SoundViewState(deviceId: $deviceId, soundOption: $soundOption, isLoading: $isLoading, isComplete: $isComplete, errorMessage: $errorMessage)'; + return 'SoundViewState(device: $device, soundOption: $soundOption, isLoading: $isLoading, isComplete: $isComplete, errorMessage: $errorMessage)'; } @@ -249,11 +261,11 @@ abstract mixin class _$SoundViewStateCopyWith<$Res> implements $SoundViewStateCo factory _$SoundViewStateCopyWith(_SoundViewState value, $Res Function(_SoundViewState) _then) = __$SoundViewStateCopyWithImpl; @override @useResult $Res call({ - String deviceId, String? soundOption, bool isLoading, bool isComplete, String errorMessage + DeviceEntity? device, String? soundOption, bool isLoading, bool isComplete, String errorMessage }); - +@override $DeviceEntityCopyWith<$Res>? get device; } /// @nodoc @@ -266,10 +278,10 @@ class __$SoundViewStateCopyWithImpl<$Res> /// Create a copy of SoundViewState /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? deviceId = null,Object? soundOption = freezed,Object? isLoading = null,Object? isComplete = null,Object? errorMessage = null,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? device = freezed,Object? soundOption = freezed,Object? isLoading = null,Object? isComplete = null,Object? errorMessage = null,}) { return _then(_SoundViewState( -deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable -as String,soundOption: freezed == soundOption ? _self.soundOption : soundOption // ignore: cast_nullable_to_non_nullable +device: freezed == device ? _self.device : device // ignore: cast_nullable_to_non_nullable +as DeviceEntity?,soundOption: freezed == soundOption ? _self.soundOption : soundOption // ignore: cast_nullable_to_non_nullable as String?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable as bool,isComplete: null == isComplete ? _self.isComplete : isComplete // ignore: cast_nullable_to_non_nullable as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable @@ -277,7 +289,19 @@ as String, )); } +/// Create a copy of SoundViewState +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceEntityCopyWith<$Res>? get device { + if (_self.device == null) { + return null; + } + return $DeviceEntityCopyWith<$Res>(_self.device!, (value) { + return _then(_self.copyWith(device: value)); + }); +} } // dart format on diff --git a/modules/legacy/packages/legacy_shared/lib/legacy_shared.dart b/modules/legacy/packages/legacy_shared/lib/legacy_shared.dart index ef163a33..d0592ddf 100644 --- a/modules/legacy/packages/legacy_shared/lib/legacy_shared.dart +++ b/modules/legacy/packages/legacy_shared/lib/legacy_shared.dart @@ -15,4 +15,6 @@ export 'src/utils/device_csv_builder.dart'; export 'src/domain/repositories/command_repository.dart'; export 'src/providers/commands_repository_provider.dart'; export 'src/domain/repositories/devices_repository.dart'; -export 'src/providers/devices_repository_provider.dart'; \ No newline at end of file +export 'src/providers/devices_repository_provider.dart'; +export 'src/data/datasources/device_settings_update_datasource.dart'; +export 'src/providers/device_settings_update_provider.dart'; \ No newline at end of file diff --git a/modules/legacy/packages/legacy_shared/lib/src/data/datasources/commands_remote_datasource_impl.dart b/modules/legacy/packages/legacy_shared/lib/src/data/datasources/commands_remote_datasource_impl.dart index d1662657..bd5930b8 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/data/datasources/commands_remote_datasource_impl.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/data/datasources/commands_remote_datasource_impl.dart @@ -11,28 +11,14 @@ class CommandsRemoteDatasourceImpl implements CommandsRemoteDatasource { @override Future send({ - required SendCommandRequestModel request + required SendCommandRequestModel request, }) async { - try{ - final response = await safeCall( - () => _repository.post>( - '/commands', - body: request.toJson(), - ), - 'Error in command ${request.command}', - ); - - final data = response.data; - if (data == null || data.isEmpty) { - throw Exception('Empty response from command ${request.command}'); - } - if (response.statusCode == 500) { - throw Exception('Server error from command ${request.command}'); - } - - // return CommandsResponseModel.fromJson(data); - } catch(e) { - return; - } + await safeCall( + () => _repository.post>( + '/commands', + body: request.toJson(), + ), + 'Error in command ${request.command}', + ); } } diff --git a/modules/legacy/modules/device_management/lib/src/features/volume_control/data/device_update_datasource.dart b/modules/legacy/packages/legacy_shared/lib/src/data/datasources/device_settings_update_datasource.dart similarity index 69% rename from modules/legacy/modules/device_management/lib/src/features/volume_control/data/device_update_datasource.dart rename to modules/legacy/packages/legacy_shared/lib/src/data/datasources/device_settings_update_datasource.dart index 6e237c26..cff63716 100644 --- a/modules/legacy/modules/device_management/lib/src/features/volume_control/data/device_update_datasource.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/data/datasources/device_settings_update_datasource.dart @@ -1,15 +1,17 @@ -import 'package:legacy_shared/legacy_shared.dart'; import 'package:sf_infrastructure/sf_infrastructure.dart'; import 'package:sf_shared/sf_shared.dart'; -class DeviceUpdateDatasource { - DeviceUpdateDatasource(this._repository); +import '../../utils/device_csv_builder.dart'; +import '../../utils/dio_error_mapper.dart'; + +class DeviceSettingsUpdateDatasource { + DeviceSettingsUpdateDatasource(this._repository); final QuestiaRepository _repository; Future updateDeviceSettings({ required DeviceEntity device, - required Map updatedSettings, + required DeviceSettingsEntity updatedSettings, }) async { final csvBase64 = DeviceCsvBuilder.buildBase64Csv( device: device, diff --git a/modules/legacy/packages/legacy_shared/lib/src/data/models/get_devices_response_model.dart b/modules/legacy/packages/legacy_shared/lib/src/data/models/get_devices_response_model.dart index 00ed8f67..a2ce2b0d 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/data/models/get_devices_response_model.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/data/models/get_devices_response_model.dart @@ -75,11 +75,13 @@ extension GetDevicesResponseModelMapper on GetDevicesResponseModel { phone: item.phone, simId: item.simId, paymentOptions: item.paymentOptions, - settings: item.settings, + settings: DeviceSettingsModel.fromJson(item.settings).toEntity(), connectionServer: item.connectionServer, protocol: item.protocol, type: item.type, - capabilities: item.capabilities, + capabilities: item.capabilities != null + ? DeviceCapabilitiesModel.fromJson(item.capabilities!).toEntity() + : null, createdAt: item.createdAt.toString(), updatedAt: item.updatedAt?.toString(), ), diff --git a/modules/legacy/packages/legacy_shared/lib/src/providers/device_settings_update_provider.dart b/modules/legacy/packages/legacy_shared/lib/src/providers/device_settings_update_provider.dart new file mode 100644 index 00000000..46e835e5 --- /dev/null +++ b/modules/legacy/packages/legacy_shared/lib/src/providers/device_settings_update_provider.dart @@ -0,0 +1,10 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:get_it/get_it.dart'; +import 'package:sf_infrastructure/sf_infrastructure.dart'; + +import '../data/datasources/device_settings_update_datasource.dart'; + +final deviceSettingsUpdateProvider = + Provider((ref) { + return DeviceSettingsUpdateDatasource(GetIt.I()); +}); diff --git a/modules/legacy/packages/legacy_shared/lib/src/utils/device_csv_builder.dart b/modules/legacy/packages/legacy_shared/lib/src/utils/device_csv_builder.dart index 1aec9e81..980a8dca 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/utils/device_csv_builder.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/utils/device_csv_builder.dart @@ -7,7 +7,7 @@ class DeviceCsvBuilder { static String buildBase64Csv({ required DeviceEntity device, - required Map settings, + required DeviceSettingsEntity settings, }) { final csvHeader = 'id,carrierName,flags,settings,battery,carrierBirthday,' @@ -18,7 +18,7 @@ class DeviceCsvBuilder { device.id, device.carrierName ?? '', _csvEscape(device.flags), - _csvEscape(settings), + _csvEscape(settings.toMap()), device.battery ?? '', device.carrierBirthday ?? '', device.carrierWeight ?? '', diff --git a/packages/flutter_treezor_entrust_sdk_bridge/android/build/com/entrust/antelop/antelop/maven-metadata.xml b/packages/flutter_treezor_entrust_sdk_bridge/android/build/com/entrust/antelop/antelop/maven-metadata.xml index f63f6c43..e0a24889 100644 --- a/packages/flutter_treezor_entrust_sdk_bridge/android/build/com/entrust/antelop/antelop/maven-metadata.xml +++ b/packages/flutter_treezor_entrust_sdk_bridge/android/build/com/entrust/antelop/antelop/maven-metadata.xml @@ -7,6 +7,6 @@ 2.6.4 - 20260322000000 + 20260325000000 diff --git a/packages/flutter_treezor_entrust_sdk_bridge/android/build/com/entrust/antelop/antelop/maven-metadata.xml.md5 b/packages/flutter_treezor_entrust_sdk_bridge/android/build/com/entrust/antelop/antelop/maven-metadata.xml.md5 index 2db69971..05ef95d1 100644 --- a/packages/flutter_treezor_entrust_sdk_bridge/android/build/com/entrust/antelop/antelop/maven-metadata.xml.md5 +++ b/packages/flutter_treezor_entrust_sdk_bridge/android/build/com/entrust/antelop/antelop/maven-metadata.xml.md5 @@ -1 +1 @@ -ec3c2e29f6fe8ca84eadd369212dff2b \ No newline at end of file +afdf53af75a016d3a59635398d34f60d \ No newline at end of file diff --git a/packages/flutter_treezor_entrust_sdk_bridge/android/build/com/entrust/antelop/antelop/maven-metadata.xml.sha1 b/packages/flutter_treezor_entrust_sdk_bridge/android/build/com/entrust/antelop/antelop/maven-metadata.xml.sha1 index 32c87574..c4f0bac2 100644 --- a/packages/flutter_treezor_entrust_sdk_bridge/android/build/com/entrust/antelop/antelop/maven-metadata.xml.sha1 +++ b/packages/flutter_treezor_entrust_sdk_bridge/android/build/com/entrust/antelop/antelop/maven-metadata.xml.sha1 @@ -1 +1 @@ -df5c1d0c2331a0f608264e4d5f14b9492f5eb2aa \ No newline at end of file +bf02df387eb61f33404881f4a9a3c80dfa29e6d1 \ No newline at end of file diff --git a/packages/sf_localizations/assets/l10n/de.json b/packages/sf_localizations/assets/l10n/de.json index 1656a641..ac902b76 100644 --- a/packages/sf_localizations/assets/l10n/de.json +++ b/packages/sf_localizations/assets/l10n/de.json @@ -631,5 +631,35 @@ "callHistoryEmpty": "Keine Anrufe aufgezeichnet", "callIncoming": "Eingehend", "callOutgoing": "Ausgehend", - "callMissed": "Verpasst" + "callMissed": "Verpasst", + "healthFrequency": "Frequenz", + "healthMeasuring": "Messung läuft...", + "geofenceCreated": "Geofence erstellt", + "geofenceUpdated": "Geofence aktualisiert", + "geofenceDeleted": "Geofence gelöscht", + "frequentPlaceCreated": "Häufiger Ort erstellt", + "frequentPlaceUpdated": "Häufiger Ort aktualisiert", + "frequentPlaceDeleted": "Häufiger Ort gelöscht", + "errorGeneric": "Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.", + "errorGeofenceCreate": "Die Sicherheitszone konnte nicht erstellt werden", + "errorGeofenceUpdate": "Die Sicherheitszone konnte nicht aktualisiert werden", + "errorGeofenceDelete": "Die Sicherheitszone konnte nicht gelöscht werden", + "errorFrequentPlaceCreate": "Der häufige Ort konnte nicht erstellt werden", + "errorFrequentPlaceUpdate": "Der häufige Ort konnte nicht aktualisiert werden", + "errorFrequentPlaceDelete": "Der häufige Ort konnte nicht gelöscht werden", + "errorPositionHistory": "Der Positionsverlauf konnte nicht geladen werden", + "errorLocationFrequency": "Die Standortfrequenz konnte nicht aktualisiert werden", + "errorRefreshPosition": "Die Position konnte nicht aktualisiert werden", + "errorHealthData": "Die Gesundheitsdaten konnten nicht geladen werden", + "errorHealthMeasure": "Der Messbefehl konnte nicht gesendet werden", + "errorHeartRateFrequency": "Die Herzfrequenz konnte nicht aktualisiert werden", + "errorSoundMode": "Der Tonmodus konnte nicht aktualisiert werden", + "errorVolumeControl": "Die Lautstärke konnte nicht aktualisiert werden", + "errorLanguage": "Die Sprache konnte nicht aktualisiert werden", + "locationFrequencyUpdated": "Frequenz auf {minutes} Min. aktualisiert", + "activityMeterPedometer": "Schrittzähler", + "activityMeterPedometerEnabled": "Schrittzähler aktiviert", + "activityMeterPedometerDisabled": "Schrittzähler deaktiviert", + "errorActivityData": "Aktivitätsdaten konnten nicht geladen werden", + "errorPedometer": "Der Schrittzähler konnte nicht aktualisiert werden" } diff --git a/packages/sf_localizations/assets/l10n/en.json b/packages/sf_localizations/assets/l10n/en.json index c8ff1cee..95580aee 100755 --- a/packages/sf_localizations/assets/l10n/en.json +++ b/packages/sf_localizations/assets/l10n/en.json @@ -763,5 +763,35 @@ "callHistoryEmpty": "No calls recorded", "callIncoming": "Incoming", "callOutgoing": "Outgoing", - "callMissed": "Missed" + "callMissed": "Missed", + "healthFrequency": "Frequency", + "healthMeasuring": "Measuring...", + "geofenceCreated": "Geofence created", + "geofenceUpdated": "Geofence updated", + "geofenceDeleted": "Geofence deleted", + "frequentPlaceCreated": "Frequent place created", + "frequentPlaceUpdated": "Frequent place updated", + "frequentPlaceDeleted": "Frequent place deleted", + "errorGeneric": "Something went wrong. Please try again.", + "errorGeofenceCreate": "Could not create the safety zone", + "errorGeofenceUpdate": "Could not update the safety zone", + "errorGeofenceDelete": "Could not delete the safety zone", + "errorFrequentPlaceCreate": "Could not create the frequent place", + "errorFrequentPlaceUpdate": "Could not update the frequent place", + "errorFrequentPlaceDelete": "Could not delete the frequent place", + "errorPositionHistory": "Could not load position history", + "errorLocationFrequency": "Could not update location frequency", + "errorRefreshPosition": "Could not refresh position", + "errorHealthData": "Could not load health data", + "errorHealthMeasure": "Could not send measurement command", + "errorHeartRateFrequency": "Could not update heart rate frequency", + "errorSoundMode": "Could not update sound mode", + "errorVolumeControl": "Could not update volume", + "errorLanguage": "Could not update language", + "locationFrequencyUpdated": "Frequency updated to {minutes} min", + "activityMeterPedometer": "Pedometer", + "activityMeterPedometerEnabled": "Pedometer enabled", + "activityMeterPedometerDisabled": "Pedometer disabled", + "errorActivityData": "Could not load activity data", + "errorPedometer": "Could not update pedometer" } diff --git a/packages/sf_localizations/assets/l10n/es.json b/packages/sf_localizations/assets/l10n/es.json index 0a91e47e..3bd41bf3 100644 --- a/packages/sf_localizations/assets/l10n/es.json +++ b/packages/sf_localizations/assets/l10n/es.json @@ -761,5 +761,35 @@ "callHistoryEmpty": "No hay llamadas registradas", "callIncoming": "Entrantes", "callOutgoing": "Salientes", - "callMissed": "Perdidas" + "callMissed": "Perdidas", + "healthFrequency": "Frecuencia", + "healthMeasuring": "Midiendo...", + "geofenceCreated": "Zona de seguridad creada", + "geofenceUpdated": "Zona de seguridad actualizada", + "geofenceDeleted": "Zona de seguridad eliminada", + "frequentPlaceCreated": "Lugar frecuente creado", + "frequentPlaceUpdated": "Lugar frecuente actualizado", + "frequentPlaceDeleted": "Lugar frecuente eliminado", + "errorGeneric": "Algo salió mal. Inténtalo de nuevo.", + "errorGeofenceCreate": "No se pudo crear la zona de seguridad", + "errorGeofenceUpdate": "No se pudo actualizar la zona de seguridad", + "errorGeofenceDelete": "No se pudo eliminar la zona de seguridad", + "errorFrequentPlaceCreate": "No se pudo crear el lugar frecuente", + "errorFrequentPlaceUpdate": "No se pudo actualizar el lugar frecuente", + "errorFrequentPlaceDelete": "No se pudo eliminar el lugar frecuente", + "errorPositionHistory": "No se pudo cargar el historial de posiciones", + "errorLocationFrequency": "No se pudo actualizar la frecuencia de localización", + "errorRefreshPosition": "No se pudo actualizar la posición", + "errorHealthData": "No se pudieron cargar los datos de salud", + "errorHealthMeasure": "No se pudo enviar el comando de medición", + "errorHeartRateFrequency": "No se pudo actualizar la frecuencia cardíaca", + "errorSoundMode": "No se pudo actualizar el modo de sonido", + "errorVolumeControl": "No se pudo actualizar el volumen", + "errorLanguage": "No se pudo actualizar el idioma", + "locationFrequencyUpdated": "Frecuencia actualizada a {minutes} min", + "activityMeterPedometer": "Podómetro", + "activityMeterPedometerEnabled": "Podómetro activado", + "activityMeterPedometerDisabled": "Podómetro desactivado", + "errorActivityData": "No se pudieron cargar los datos de actividad", + "errorPedometer": "No se pudo actualizar el podómetro" } diff --git a/packages/sf_localizations/assets/l10n/fr.json b/packages/sf_localizations/assets/l10n/fr.json index 566140bb..0c7f7e96 100644 --- a/packages/sf_localizations/assets/l10n/fr.json +++ b/packages/sf_localizations/assets/l10n/fr.json @@ -631,5 +631,35 @@ "callHistoryEmpty": "Aucun appel enregistré", "callIncoming": "Entrants", "callOutgoing": "Sortants", - "callMissed": "Manqués" + "callMissed": "Manqués", + "healthFrequency": "Fréquence", + "healthMeasuring": "Mesure en cours...", + "geofenceCreated": "Géorepère créé", + "geofenceUpdated": "Géorepère mis à jour", + "geofenceDeleted": "Géorepère supprimé", + "frequentPlaceCreated": "Lieu fréquent créé", + "frequentPlaceUpdated": "Lieu fréquent mis à jour", + "frequentPlaceDeleted": "Lieu fréquent supprimé", + "errorGeneric": "Une erreur est survenue. Veuillez réessayer.", + "errorGeofenceCreate": "Impossible de créer la zone de sécurité", + "errorGeofenceUpdate": "Impossible de mettre à jour la zone de sécurité", + "errorGeofenceDelete": "Impossible de supprimer la zone de sécurité", + "errorFrequentPlaceCreate": "Impossible de créer le lieu fréquent", + "errorFrequentPlaceUpdate": "Impossible de mettre à jour le lieu fréquent", + "errorFrequentPlaceDelete": "Impossible de supprimer le lieu fréquent", + "errorPositionHistory": "Impossible de charger l'historique des positions", + "errorLocationFrequency": "Impossible de mettre à jour la fréquence de localisation", + "errorRefreshPosition": "Impossible de rafraîchir la position", + "errorHealthData": "Impossible de charger les données de santé", + "errorHealthMeasure": "Impossible d'envoyer la commande de mesure", + "errorHeartRateFrequency": "Impossible de mettre à jour la fréquence cardiaque", + "errorSoundMode": "Impossible de mettre à jour le mode sonore", + "errorVolumeControl": "Impossible de mettre à jour le volume", + "errorLanguage": "Impossible de mettre à jour la langue", + "locationFrequencyUpdated": "Fréquence mise à jour à {minutes} min", + "activityMeterPedometer": "Podomètre", + "activityMeterPedometerEnabled": "Podomètre activé", + "activityMeterPedometerDisabled": "Podomètre désactivé", + "errorActivityData": "Impossible de charger les données d'activité", + "errorPedometer": "Impossible de mettre à jour le podomètre" } diff --git a/packages/sf_localizations/assets/l10n/it.json b/packages/sf_localizations/assets/l10n/it.json index 78c3816f..67ab652b 100644 --- a/packages/sf_localizations/assets/l10n/it.json +++ b/packages/sf_localizations/assets/l10n/it.json @@ -631,5 +631,35 @@ "callHistoryEmpty": "Nessuna chiamata registrata", "callIncoming": "In arrivo", "callOutgoing": "In uscita", - "callMissed": "Perse" + "callMissed": "Perse", + "healthFrequency": "Frequenza", + "healthMeasuring": "Misurazione in corso...", + "geofenceCreated": "Geofence creato", + "geofenceUpdated": "Geofence aggiornato", + "geofenceDeleted": "Geofence eliminato", + "frequentPlaceCreated": "Luogo frequente creato", + "frequentPlaceUpdated": "Luogo frequente aggiornato", + "frequentPlaceDeleted": "Luogo frequente eliminato", + "errorGeneric": "Qualcosa è andato storto. Riprova.", + "errorGeofenceCreate": "Impossibile creare la zona di sicurezza", + "errorGeofenceUpdate": "Impossibile aggiornare la zona di sicurezza", + "errorGeofenceDelete": "Impossibile eliminare la zona di sicurezza", + "errorFrequentPlaceCreate": "Impossibile creare il luogo frequente", + "errorFrequentPlaceUpdate": "Impossibile aggiornare il luogo frequente", + "errorFrequentPlaceDelete": "Impossibile eliminare il luogo frequente", + "errorPositionHistory": "Impossibile caricare la cronologia delle posizioni", + "errorLocationFrequency": "Impossibile aggiornare la frequenza di localizzazione", + "errorRefreshPosition": "Impossibile aggiornare la posizione", + "errorHealthData": "Impossibile caricare i dati sanitari", + "errorHealthMeasure": "Impossibile inviare il comando di misurazione", + "errorHeartRateFrequency": "Impossibile aggiornare la frequenza cardiaca", + "errorSoundMode": "Impossibile aggiornare la modalità audio", + "errorVolumeControl": "Impossibile aggiornare il volume", + "errorLanguage": "Impossibile aggiornare la lingua", + "locationFrequencyUpdated": "Frequenza aggiornata a {minutes} min", + "activityMeterPedometer": "Contapassi", + "activityMeterPedometerEnabled": "Contapassi attivato", + "activityMeterPedometerDisabled": "Contapassi disattivato", + "errorActivityData": "Impossibile caricare i dati di attività", + "errorPedometer": "Impossibile aggiornare il contapassi" } diff --git a/packages/sf_localizations/assets/l10n/pt.json b/packages/sf_localizations/assets/l10n/pt.json index e79d957c..6f96c7a2 100644 --- a/packages/sf_localizations/assets/l10n/pt.json +++ b/packages/sf_localizations/assets/l10n/pt.json @@ -631,5 +631,35 @@ "callHistoryEmpty": "Nenhuma chamada registrada", "callIncoming": "Recebidas", "callOutgoing": "Efetuadas", - "callMissed": "Perdidas" + "callMissed": "Perdidas", + "healthFrequency": "Frequência", + "healthMeasuring": "Medindo...", + "geofenceCreated": "Geocerca criada", + "geofenceUpdated": "Geocerca atualizada", + "geofenceDeleted": "Geocerca eliminada", + "frequentPlaceCreated": "Local frequente criado", + "frequentPlaceUpdated": "Local frequente atualizado", + "frequentPlaceDeleted": "Local frequente eliminado", + "errorGeneric": "Algo correu mal. Tente novamente.", + "errorGeofenceCreate": "Não foi possível criar a zona de segurança", + "errorGeofenceUpdate": "Não foi possível atualizar a zona de segurança", + "errorGeofenceDelete": "Não foi possível eliminar a zona de segurança", + "errorFrequentPlaceCreate": "Não foi possível criar o local frequente", + "errorFrequentPlaceUpdate": "Não foi possível atualizar o local frequente", + "errorFrequentPlaceDelete": "Não foi possível eliminar o local frequente", + "errorPositionHistory": "Não foi possível carregar o histórico de posições", + "errorLocationFrequency": "Não foi possível atualizar a frequência de localização", + "errorRefreshPosition": "Não foi possível atualizar a posição", + "errorHealthData": "Não foi possível carregar os dados de saúde", + "errorHealthMeasure": "Não foi possível enviar o comando de medição", + "errorHeartRateFrequency": "Não foi possível atualizar a frequência cardíaca", + "errorSoundMode": "Não foi possível atualizar o modo de som", + "errorVolumeControl": "Não foi possível atualizar o volume", + "errorLanguage": "Não foi possível atualizar o idioma", + "locationFrequencyUpdated": "Frequência atualizada para {minutes} min", + "activityMeterPedometer": "Pedómetro", + "activityMeterPedometerEnabled": "Pedómetro ativado", + "activityMeterPedometerDisabled": "Pedómetro desativado", + "errorActivityData": "Não foi possível carregar os dados de atividade", + "errorPedometer": "Não foi possível atualizar o pedómetro" } diff --git a/packages/sf_localizations/lib/src/generated/i18n.dart b/packages/sf_localizations/lib/src/generated/i18n.dart index dba37fcb..39729d79 100755 --- a/packages/sf_localizations/lib/src/generated/i18n.dart +++ b/packages/sf_localizations/lib/src/generated/i18n.dart @@ -768,4 +768,34 @@ class I18n { static const String noPhotosAvailable = 'noPhotosAvailable'; static const String yesterday = 'yesterday'; static const String measure = 'measure'; + static const String healthFrequency = 'healthFrequency'; + static const String healthMeasuring = 'healthMeasuring'; + static const String geofenceCreated = 'geofenceCreated'; + static const String geofenceUpdated = 'geofenceUpdated'; + static const String geofenceDeleted = 'geofenceDeleted'; + static const String frequentPlaceCreated = 'frequentPlaceCreated'; + static const String frequentPlaceUpdated = 'frequentPlaceUpdated'; + static const String frequentPlaceDeleted = 'frequentPlaceDeleted'; + static const String errorGeneric = 'errorGeneric'; + static const String errorGeofenceCreate = 'errorGeofenceCreate'; + static const String errorGeofenceUpdate = 'errorGeofenceUpdate'; + static const String errorGeofenceDelete = 'errorGeofenceDelete'; + static const String errorFrequentPlaceCreate = 'errorFrequentPlaceCreate'; + static const String errorFrequentPlaceUpdate = 'errorFrequentPlaceUpdate'; + static const String errorFrequentPlaceDelete = 'errorFrequentPlaceDelete'; + static const String errorPositionHistory = 'errorPositionHistory'; + static const String errorLocationFrequency = 'errorLocationFrequency'; + static const String errorRefreshPosition = 'errorRefreshPosition'; + static const String errorHealthData = 'errorHealthData'; + static const String errorHealthMeasure = 'errorHealthMeasure'; + static const String errorHeartRateFrequency = 'errorHeartRateFrequency'; + static const String errorSoundMode = 'errorSoundMode'; + static const String errorVolumeControl = 'errorVolumeControl'; + static const String errorLanguage = 'errorLanguage'; + static const String locationFrequencyUpdated = 'locationFrequencyUpdated'; + static const String activityMeterPedometer = 'activityMeterPedometer'; + static const String activityMeterPedometerEnabled = 'activityMeterPedometerEnabled'; + static const String activityMeterPedometerDisabled = 'activityMeterPedometerDisabled'; + static const String errorActivityData = 'errorActivityData'; + static const String errorPedometer = 'errorPedometer'; } diff --git a/packages/sf_shared/lib/sf_shared.dart b/packages/sf_shared/lib/sf_shared.dart index 8f534c0b..2c70e3d8 100644 --- a/packages/sf_shared/lib/sf_shared.dart +++ b/packages/sf_shared/lib/sf_shared.dart @@ -34,7 +34,11 @@ export 'src/domain/entities/transaction_beneficiary_entity.dart'; export 'src/data/models/payout_beneficiary_model.dart'; export 'src/domain/entities/payout_beneficiary_entity.dart'; export 'src/data/models/device_model.dart'; +export 'src/data/models/device_settings_model.dart'; +export 'src/data/models/device_capabilities_model.dart'; export 'src/domain/entities/device_entity.dart'; +export 'src/domain/entities/device_settings_entity.dart'; +export 'src/domain/entities/device_capabilities_entity.dart'; export 'src/data/models/child_wallet_model.dart'; export 'src/domain/entities/child_wallet_entity.dart'; export 'src/providers/wallet_refresh_provider.dart'; diff --git a/packages/sf_shared/lib/src/data/models/device_capabilities_model.dart b/packages/sf_shared/lib/src/data/models/device_capabilities_model.dart new file mode 100644 index 00000000..57a9ed70 --- /dev/null +++ b/packages/sf_shared/lib/src/data/models/device_capabilities_model.dart @@ -0,0 +1,194 @@ +// ignore_for_file: invalid_annotation_target +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:sf_shared/src/domain/entities/device_capabilities_entity.dart'; + +part 'device_capabilities_model.freezed.dart'; +part 'device_capabilities_model.g.dart'; + +@freezed +abstract class DeviceCapabilitiesModel with _$DeviceCapabilitiesModel { + const factory DeviceCapabilitiesModel({ + DeviceCapabilityOptionModel? heartbeats, + DeviceCapabilityEnabledModel? bloodPressure, + DeviceCapabilityAlertsModel? alerts, + DeviceCapabilityEnabledModel? podometer, + DeviceCapabilityContactsModel? contacts, + DeviceCapabilitySettingsModel? settings, + DeviceCapabilityCommandsModel? commands, + DeviceCapabilityTakepillsModel? takepills, + DeviceCapabilityOptionModel? location, + DeviceCapabilityCameraModel? camera, + }) = _DeviceCapabilitiesModel; + + factory DeviceCapabilitiesModel.fromJson(Map json) => + _$DeviceCapabilitiesModelFromJson(json); +} + +@freezed +abstract class DeviceCapabilityEnabledModel with _$DeviceCapabilityEnabledModel { + const factory DeviceCapabilityEnabledModel({ + @Default(false) bool enabled, + }) = _DeviceCapabilityEnabledModel; + + factory DeviceCapabilityEnabledModel.fromJson(Map json) => + _$DeviceCapabilityEnabledModelFromJson(json); +} + +@freezed +abstract class DeviceCapabilityOptionModel with _$DeviceCapabilityOptionModel { + const factory DeviceCapabilityOptionModel({ + @JsonKey(name: 'default') @Default(0) int defaultValue, + @Default(false) bool enabled, + @Default([]) List options, + }) = _DeviceCapabilityOptionModel; + + factory DeviceCapabilityOptionModel.fromJson(Map json) => + _$DeviceCapabilityOptionModelFromJson(json); +} + +@freezed +abstract class DeviceCapabilityAlertsModel with _$DeviceCapabilityAlertsModel { + const factory DeviceCapabilityAlertsModel({ + @Default(false) bool enabled, + @Default([]) List types, + }) = _DeviceCapabilityAlertsModel; + + factory DeviceCapabilityAlertsModel.fromJson(Map json) => + _$DeviceCapabilityAlertsModelFromJson(json); +} + +@freezed +abstract class DeviceCapabilityContactsModel with _$DeviceCapabilityContactsModel { + const factory DeviceCapabilityContactsModel({ + @Default(false) bool enabled, + @Default([]) List types, + @Default(false) bool isPhonebookWithPhoto, + }) = _DeviceCapabilityContactsModel; + + factory DeviceCapabilityContactsModel.fromJson(Map json) => + _$DeviceCapabilityContactsModelFromJson(json); +} + +@freezed +abstract class DeviceCapabilityContactTypeModel with _$DeviceCapabilityContactTypeModel { + const factory DeviceCapabilityContactTypeModel({ + @Default('') String type, + @Default(0) int amount, + }) = _DeviceCapabilityContactTypeModel; + + factory DeviceCapabilityContactTypeModel.fromJson(Map json) => + _$DeviceCapabilityContactTypeModelFromJson(json); +} + +@freezed +abstract class DeviceCapabilitySettingsModel with _$DeviceCapabilitySettingsModel { + const factory DeviceCapabilitySettingsModel({ + @Default(false) bool language, + @Default(false) bool timezone, + @Default([]) List soundModes, + }) = _DeviceCapabilitySettingsModel; + + factory DeviceCapabilitySettingsModel.fromJson(Map json) => + _$DeviceCapabilitySettingsModelFromJson(json); +} + +@freezed +abstract class DeviceCapabilityCommandsModel with _$DeviceCapabilityCommandsModel { + const factory DeviceCapabilityCommandsModel({ + @Default(false) bool enabled, + @Default([]) List types, + }) = _DeviceCapabilityCommandsModel; + + factory DeviceCapabilityCommandsModel.fromJson(Map json) => + _$DeviceCapabilityCommandsModelFromJson(json); +} + +@freezed +abstract class DeviceCapabilityTakepillsModel with _$DeviceCapabilityTakepillsModel { + const factory DeviceCapabilityTakepillsModel({ + @Default(false) bool enabled, + @Default(0) int maxReminders, + }) = _DeviceCapabilityTakepillsModel; + + factory DeviceCapabilityTakepillsModel.fromJson(Map json) => + _$DeviceCapabilityTakepillsModelFromJson(json); +} + +@freezed +abstract class DeviceCapabilityCameraModel with _$DeviceCapabilityCameraModel { + const factory DeviceCapabilityCameraModel({ + @Default('') String format, + @Default(false) bool enabled, + }) = _DeviceCapabilityCameraModel; + + factory DeviceCapabilityCameraModel.fromJson(Map json) => + _$DeviceCapabilityCameraModelFromJson(json); +} + +extension DeviceCapabilitiesModelMapper on DeviceCapabilitiesModel { + DeviceCapabilitiesEntity toEntity() => DeviceCapabilitiesEntity( + heartbeats: heartbeats != null + ? DeviceCapabilityOptionEntity( + defaultValue: heartbeats!.defaultValue, + enabled: heartbeats!.enabled, + options: heartbeats!.options, + ) + : null, + bloodPressure: bloodPressure != null + ? DeviceCapabilityEnabledEntity(enabled: bloodPressure!.enabled) + : null, + alerts: alerts != null + ? DeviceCapabilityAlertsEntity( + enabled: alerts!.enabled, + types: alerts!.types, + ) + : null, + podometer: podometer != null + ? DeviceCapabilityEnabledEntity(enabled: podometer!.enabled) + : null, + contacts: contacts != null + ? DeviceCapabilityContactsEntity( + enabled: contacts!.enabled, + types: contacts!.types + .map((t) => DeviceCapabilityContactTypeEntity( + type: t.type, + amount: t.amount, + )) + .toList(), + isPhonebookWithPhoto: contacts!.isPhonebookWithPhoto, + ) + : null, + settings: settings != null + ? DeviceCapabilitySettingsEntity( + language: settings!.language, + timezone: settings!.timezone, + soundModes: settings!.soundModes, + ) + : null, + commands: commands != null + ? DeviceCapabilityCommandsEntity( + enabled: commands!.enabled, + types: commands!.types, + ) + : null, + takepills: takepills != null + ? DeviceCapabilityTakepillsEntity( + enabled: takepills!.enabled, + maxReminders: takepills!.maxReminders, + ) + : null, + location: location != null + ? DeviceCapabilityOptionEntity( + defaultValue: location!.defaultValue, + enabled: location!.enabled, + options: location!.options, + ) + : null, + camera: camera != null + ? DeviceCapabilityCameraEntity( + format: camera!.format, + enabled: camera!.enabled, + ) + : null, + ); +} diff --git a/packages/sf_shared/lib/src/data/models/device_capabilities_model.freezed.dart b/packages/sf_shared/lib/src/data/models/device_capabilities_model.freezed.dart new file mode 100644 index 00000000..1232378f --- /dev/null +++ b/packages/sf_shared/lib/src/data/models/device_capabilities_model.freezed.dart @@ -0,0 +1,2974 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'device_capabilities_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeviceCapabilitiesModel { + + DeviceCapabilityOptionModel? get heartbeats; DeviceCapabilityEnabledModel? get bloodPressure; DeviceCapabilityAlertsModel? get alerts; DeviceCapabilityEnabledModel? get podometer; DeviceCapabilityContactsModel? get contacts; DeviceCapabilitySettingsModel? get settings; DeviceCapabilityCommandsModel? get commands; DeviceCapabilityTakepillsModel? get takepills; DeviceCapabilityOptionModel? get location; DeviceCapabilityCameraModel? get camera; +/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilitiesModelCopyWith get copyWith => _$DeviceCapabilitiesModelCopyWithImpl(this as DeviceCapabilitiesModel, _$identity); + + /// Serializes this DeviceCapabilitiesModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilitiesModel&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.bloodPressure, bloodPressure) || other.bloodPressure == bloodPressure)&&(identical(other.alerts, alerts) || other.alerts == alerts)&&(identical(other.podometer, podometer) || other.podometer == podometer)&&(identical(other.contacts, contacts) || other.contacts == contacts)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.commands, commands) || other.commands == commands)&&(identical(other.takepills, takepills) || other.takepills == takepills)&&(identical(other.location, location) || other.location == location)&&(identical(other.camera, camera) || other.camera == camera)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,heartbeats,bloodPressure,alerts,podometer,contacts,settings,commands,takepills,location,camera); + +@override +String toString() { + return 'DeviceCapabilitiesModel(heartbeats: $heartbeats, bloodPressure: $bloodPressure, alerts: $alerts, podometer: $podometer, contacts: $contacts, settings: $settings, commands: $commands, takepills: $takepills, location: $location, camera: $camera)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilitiesModelCopyWith<$Res> { + factory $DeviceCapabilitiesModelCopyWith(DeviceCapabilitiesModel value, $Res Function(DeviceCapabilitiesModel) _then) = _$DeviceCapabilitiesModelCopyWithImpl; +@useResult +$Res call({ + DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera +}); + + +$DeviceCapabilityOptionModelCopyWith<$Res>? get heartbeats;$DeviceCapabilityEnabledModelCopyWith<$Res>? get bloodPressure;$DeviceCapabilityAlertsModelCopyWith<$Res>? get alerts;$DeviceCapabilityEnabledModelCopyWith<$Res>? get podometer;$DeviceCapabilityContactsModelCopyWith<$Res>? get contacts;$DeviceCapabilitySettingsModelCopyWith<$Res>? get settings;$DeviceCapabilityCommandsModelCopyWith<$Res>? get commands;$DeviceCapabilityTakepillsModelCopyWith<$Res>? get takepills;$DeviceCapabilityOptionModelCopyWith<$Res>? get location;$DeviceCapabilityCameraModelCopyWith<$Res>? get camera; + +} +/// @nodoc +class _$DeviceCapabilitiesModelCopyWithImpl<$Res> + implements $DeviceCapabilitiesModelCopyWith<$Res> { + _$DeviceCapabilitiesModelCopyWithImpl(this._self, this._then); + + final DeviceCapabilitiesModel _self; + final $Res Function(DeviceCapabilitiesModel) _then; + +/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? heartbeats = freezed,Object? bloodPressure = freezed,Object? alerts = freezed,Object? podometer = freezed,Object? contacts = freezed,Object? settings = freezed,Object? commands = freezed,Object? takepills = freezed,Object? location = freezed,Object? camera = freezed,}) { + return _then(_self.copyWith( +heartbeats: freezed == heartbeats ? _self.heartbeats : heartbeats // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityOptionModel?,bloodPressure: freezed == bloodPressure ? _self.bloodPressure : bloodPressure // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityEnabledModel?,alerts: freezed == alerts ? _self.alerts : alerts // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityAlertsModel?,podometer: freezed == podometer ? _self.podometer : podometer // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityEnabledModel?,contacts: freezed == contacts ? _self.contacts : contacts // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityContactsModel?,settings: freezed == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitySettingsModel?,commands: freezed == commands ? _self.commands : commands // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityCommandsModel?,takepills: freezed == takepills ? _self.takepills : takepills // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityTakepillsModel?,location: freezed == location ? _self.location : location // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityOptionModel?,camera: freezed == camera ? _self.camera : camera // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityCameraModel?, + )); +} +/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityOptionModelCopyWith<$Res>? get heartbeats { + if (_self.heartbeats == null) { + return null; + } + + return $DeviceCapabilityOptionModelCopyWith<$Res>(_self.heartbeats!, (value) { + return _then(_self.copyWith(heartbeats: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityEnabledModelCopyWith<$Res>? get bloodPressure { + if (_self.bloodPressure == null) { + return null; + } + + return $DeviceCapabilityEnabledModelCopyWith<$Res>(_self.bloodPressure!, (value) { + return _then(_self.copyWith(bloodPressure: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityAlertsModelCopyWith<$Res>? get alerts { + if (_self.alerts == null) { + return null; + } + + return $DeviceCapabilityAlertsModelCopyWith<$Res>(_self.alerts!, (value) { + return _then(_self.copyWith(alerts: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityEnabledModelCopyWith<$Res>? get podometer { + if (_self.podometer == null) { + return null; + } + + return $DeviceCapabilityEnabledModelCopyWith<$Res>(_self.podometer!, (value) { + return _then(_self.copyWith(podometer: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityContactsModelCopyWith<$Res>? get contacts { + if (_self.contacts == null) { + return null; + } + + return $DeviceCapabilityContactsModelCopyWith<$Res>(_self.contacts!, (value) { + return _then(_self.copyWith(contacts: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitySettingsModelCopyWith<$Res>? get settings { + if (_self.settings == null) { + return null; + } + + return $DeviceCapabilitySettingsModelCopyWith<$Res>(_self.settings!, (value) { + return _then(_self.copyWith(settings: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityCommandsModelCopyWith<$Res>? get commands { + if (_self.commands == null) { + return null; + } + + return $DeviceCapabilityCommandsModelCopyWith<$Res>(_self.commands!, (value) { + return _then(_self.copyWith(commands: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityTakepillsModelCopyWith<$Res>? get takepills { + if (_self.takepills == null) { + return null; + } + + return $DeviceCapabilityTakepillsModelCopyWith<$Res>(_self.takepills!, (value) { + return _then(_self.copyWith(takepills: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityOptionModelCopyWith<$Res>? get location { + if (_self.location == null) { + return null; + } + + return $DeviceCapabilityOptionModelCopyWith<$Res>(_self.location!, (value) { + return _then(_self.copyWith(location: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityCameraModelCopyWith<$Res>? get camera { + if (_self.camera == null) { + return null; + } + + return $DeviceCapabilityCameraModelCopyWith<$Res>(_self.camera!, (value) { + return _then(_self.copyWith(camera: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilitiesModel]. +extension DeviceCapabilitiesModelPatterns on DeviceCapabilitiesModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilitiesModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilitiesModel value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilitiesModel value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesModel() when $default != null: +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesModel(): +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesModel() when $default != null: +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _DeviceCapabilitiesModel implements DeviceCapabilitiesModel { + const _DeviceCapabilitiesModel({this.heartbeats, this.bloodPressure, this.alerts, this.podometer, this.contacts, this.settings, this.commands, this.takepills, this.location, this.camera}); + factory _DeviceCapabilitiesModel.fromJson(Map json) => _$DeviceCapabilitiesModelFromJson(json); + +@override final DeviceCapabilityOptionModel? heartbeats; +@override final DeviceCapabilityEnabledModel? bloodPressure; +@override final DeviceCapabilityAlertsModel? alerts; +@override final DeviceCapabilityEnabledModel? podometer; +@override final DeviceCapabilityContactsModel? contacts; +@override final DeviceCapabilitySettingsModel? settings; +@override final DeviceCapabilityCommandsModel? commands; +@override final DeviceCapabilityTakepillsModel? takepills; +@override final DeviceCapabilityOptionModel? location; +@override final DeviceCapabilityCameraModel? camera; + +/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilitiesModelCopyWith<_DeviceCapabilitiesModel> get copyWith => __$DeviceCapabilitiesModelCopyWithImpl<_DeviceCapabilitiesModel>(this, _$identity); + +@override +Map toJson() { + return _$DeviceCapabilitiesModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilitiesModel&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.bloodPressure, bloodPressure) || other.bloodPressure == bloodPressure)&&(identical(other.alerts, alerts) || other.alerts == alerts)&&(identical(other.podometer, podometer) || other.podometer == podometer)&&(identical(other.contacts, contacts) || other.contacts == contacts)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.commands, commands) || other.commands == commands)&&(identical(other.takepills, takepills) || other.takepills == takepills)&&(identical(other.location, location) || other.location == location)&&(identical(other.camera, camera) || other.camera == camera)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,heartbeats,bloodPressure,alerts,podometer,contacts,settings,commands,takepills,location,camera); + +@override +String toString() { + return 'DeviceCapabilitiesModel(heartbeats: $heartbeats, bloodPressure: $bloodPressure, alerts: $alerts, podometer: $podometer, contacts: $contacts, settings: $settings, commands: $commands, takepills: $takepills, location: $location, camera: $camera)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilitiesModelCopyWith<$Res> implements $DeviceCapabilitiesModelCopyWith<$Res> { + factory _$DeviceCapabilitiesModelCopyWith(_DeviceCapabilitiesModel value, $Res Function(_DeviceCapabilitiesModel) _then) = __$DeviceCapabilitiesModelCopyWithImpl; +@override @useResult +$Res call({ + DeviceCapabilityOptionModel? heartbeats, DeviceCapabilityEnabledModel? bloodPressure, DeviceCapabilityAlertsModel? alerts, DeviceCapabilityEnabledModel? podometer, DeviceCapabilityContactsModel? contacts, DeviceCapabilitySettingsModel? settings, DeviceCapabilityCommandsModel? commands, DeviceCapabilityTakepillsModel? takepills, DeviceCapabilityOptionModel? location, DeviceCapabilityCameraModel? camera +}); + + +@override $DeviceCapabilityOptionModelCopyWith<$Res>? get heartbeats;@override $DeviceCapabilityEnabledModelCopyWith<$Res>? get bloodPressure;@override $DeviceCapabilityAlertsModelCopyWith<$Res>? get alerts;@override $DeviceCapabilityEnabledModelCopyWith<$Res>? get podometer;@override $DeviceCapabilityContactsModelCopyWith<$Res>? get contacts;@override $DeviceCapabilitySettingsModelCopyWith<$Res>? get settings;@override $DeviceCapabilityCommandsModelCopyWith<$Res>? get commands;@override $DeviceCapabilityTakepillsModelCopyWith<$Res>? get takepills;@override $DeviceCapabilityOptionModelCopyWith<$Res>? get location;@override $DeviceCapabilityCameraModelCopyWith<$Res>? get camera; + +} +/// @nodoc +class __$DeviceCapabilitiesModelCopyWithImpl<$Res> + implements _$DeviceCapabilitiesModelCopyWith<$Res> { + __$DeviceCapabilitiesModelCopyWithImpl(this._self, this._then); + + final _DeviceCapabilitiesModel _self; + final $Res Function(_DeviceCapabilitiesModel) _then; + +/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? heartbeats = freezed,Object? bloodPressure = freezed,Object? alerts = freezed,Object? podometer = freezed,Object? contacts = freezed,Object? settings = freezed,Object? commands = freezed,Object? takepills = freezed,Object? location = freezed,Object? camera = freezed,}) { + return _then(_DeviceCapabilitiesModel( +heartbeats: freezed == heartbeats ? _self.heartbeats : heartbeats // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityOptionModel?,bloodPressure: freezed == bloodPressure ? _self.bloodPressure : bloodPressure // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityEnabledModel?,alerts: freezed == alerts ? _self.alerts : alerts // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityAlertsModel?,podometer: freezed == podometer ? _self.podometer : podometer // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityEnabledModel?,contacts: freezed == contacts ? _self.contacts : contacts // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityContactsModel?,settings: freezed == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitySettingsModel?,commands: freezed == commands ? _self.commands : commands // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityCommandsModel?,takepills: freezed == takepills ? _self.takepills : takepills // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityTakepillsModel?,location: freezed == location ? _self.location : location // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityOptionModel?,camera: freezed == camera ? _self.camera : camera // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityCameraModel?, + )); +} + +/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityOptionModelCopyWith<$Res>? get heartbeats { + if (_self.heartbeats == null) { + return null; + } + + return $DeviceCapabilityOptionModelCopyWith<$Res>(_self.heartbeats!, (value) { + return _then(_self.copyWith(heartbeats: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityEnabledModelCopyWith<$Res>? get bloodPressure { + if (_self.bloodPressure == null) { + return null; + } + + return $DeviceCapabilityEnabledModelCopyWith<$Res>(_self.bloodPressure!, (value) { + return _then(_self.copyWith(bloodPressure: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityAlertsModelCopyWith<$Res>? get alerts { + if (_self.alerts == null) { + return null; + } + + return $DeviceCapabilityAlertsModelCopyWith<$Res>(_self.alerts!, (value) { + return _then(_self.copyWith(alerts: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityEnabledModelCopyWith<$Res>? get podometer { + if (_self.podometer == null) { + return null; + } + + return $DeviceCapabilityEnabledModelCopyWith<$Res>(_self.podometer!, (value) { + return _then(_self.copyWith(podometer: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityContactsModelCopyWith<$Res>? get contacts { + if (_self.contacts == null) { + return null; + } + + return $DeviceCapabilityContactsModelCopyWith<$Res>(_self.contacts!, (value) { + return _then(_self.copyWith(contacts: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitySettingsModelCopyWith<$Res>? get settings { + if (_self.settings == null) { + return null; + } + + return $DeviceCapabilitySettingsModelCopyWith<$Res>(_self.settings!, (value) { + return _then(_self.copyWith(settings: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityCommandsModelCopyWith<$Res>? get commands { + if (_self.commands == null) { + return null; + } + + return $DeviceCapabilityCommandsModelCopyWith<$Res>(_self.commands!, (value) { + return _then(_self.copyWith(commands: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityTakepillsModelCopyWith<$Res>? get takepills { + if (_self.takepills == null) { + return null; + } + + return $DeviceCapabilityTakepillsModelCopyWith<$Res>(_self.takepills!, (value) { + return _then(_self.copyWith(takepills: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityOptionModelCopyWith<$Res>? get location { + if (_self.location == null) { + return null; + } + + return $DeviceCapabilityOptionModelCopyWith<$Res>(_self.location!, (value) { + return _then(_self.copyWith(location: value)); + }); +}/// Create a copy of DeviceCapabilitiesModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityCameraModelCopyWith<$Res>? get camera { + if (_self.camera == null) { + return null; + } + + return $DeviceCapabilityCameraModelCopyWith<$Res>(_self.camera!, (value) { + return _then(_self.copyWith(camera: value)); + }); +} +} + + +/// @nodoc +mixin _$DeviceCapabilityEnabledModel { + + bool get enabled; +/// Create a copy of DeviceCapabilityEnabledModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityEnabledModelCopyWith get copyWith => _$DeviceCapabilityEnabledModelCopyWithImpl(this as DeviceCapabilityEnabledModel, _$identity); + + /// Serializes this DeviceCapabilityEnabledModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityEnabledModel&&(identical(other.enabled, enabled) || other.enabled == enabled)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,enabled); + +@override +String toString() { + return 'DeviceCapabilityEnabledModel(enabled: $enabled)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityEnabledModelCopyWith<$Res> { + factory $DeviceCapabilityEnabledModelCopyWith(DeviceCapabilityEnabledModel value, $Res Function(DeviceCapabilityEnabledModel) _then) = _$DeviceCapabilityEnabledModelCopyWithImpl; +@useResult +$Res call({ + bool enabled +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityEnabledModelCopyWithImpl<$Res> + implements $DeviceCapabilityEnabledModelCopyWith<$Res> { + _$DeviceCapabilityEnabledModelCopyWithImpl(this._self, this._then); + + final DeviceCapabilityEnabledModel _self; + final $Res Function(DeviceCapabilityEnabledModel) _then; + +/// Create a copy of DeviceCapabilityEnabledModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? enabled = null,}) { + return _then(_self.copyWith( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityEnabledModel]. +extension DeviceCapabilityEnabledModelPatterns on DeviceCapabilityEnabledModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityEnabledModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityEnabledModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityEnabledModel value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityEnabledModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityEnabledModel value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityEnabledModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( bool enabled)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityEnabledModel() when $default != null: +return $default(_that.enabled);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( bool enabled) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityEnabledModel(): +return $default(_that.enabled);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool enabled)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityEnabledModel() when $default != null: +return $default(_that.enabled);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _DeviceCapabilityEnabledModel implements DeviceCapabilityEnabledModel { + const _DeviceCapabilityEnabledModel({this.enabled = false}); + factory _DeviceCapabilityEnabledModel.fromJson(Map json) => _$DeviceCapabilityEnabledModelFromJson(json); + +@override@JsonKey() final bool enabled; + +/// Create a copy of DeviceCapabilityEnabledModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityEnabledModelCopyWith<_DeviceCapabilityEnabledModel> get copyWith => __$DeviceCapabilityEnabledModelCopyWithImpl<_DeviceCapabilityEnabledModel>(this, _$identity); + +@override +Map toJson() { + return _$DeviceCapabilityEnabledModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityEnabledModel&&(identical(other.enabled, enabled) || other.enabled == enabled)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,enabled); + +@override +String toString() { + return 'DeviceCapabilityEnabledModel(enabled: $enabled)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityEnabledModelCopyWith<$Res> implements $DeviceCapabilityEnabledModelCopyWith<$Res> { + factory _$DeviceCapabilityEnabledModelCopyWith(_DeviceCapabilityEnabledModel value, $Res Function(_DeviceCapabilityEnabledModel) _then) = __$DeviceCapabilityEnabledModelCopyWithImpl; +@override @useResult +$Res call({ + bool enabled +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityEnabledModelCopyWithImpl<$Res> + implements _$DeviceCapabilityEnabledModelCopyWith<$Res> { + __$DeviceCapabilityEnabledModelCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityEnabledModel _self; + final $Res Function(_DeviceCapabilityEnabledModel) _then; + +/// Create a copy of DeviceCapabilityEnabledModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? enabled = null,}) { + return _then(_DeviceCapabilityEnabledModel( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + + +/// @nodoc +mixin _$DeviceCapabilityOptionModel { + +@JsonKey(name: 'default') int get defaultValue; bool get enabled; List get options; +/// Create a copy of DeviceCapabilityOptionModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityOptionModelCopyWith get copyWith => _$DeviceCapabilityOptionModelCopyWithImpl(this as DeviceCapabilityOptionModel, _$identity); + + /// Serializes this DeviceCapabilityOptionModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityOptionModel&&(identical(other.defaultValue, defaultValue) || other.defaultValue == defaultValue)&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other.options, options)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,defaultValue,enabled,const DeepCollectionEquality().hash(options)); + +@override +String toString() { + return 'DeviceCapabilityOptionModel(defaultValue: $defaultValue, enabled: $enabled, options: $options)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityOptionModelCopyWith<$Res> { + factory $DeviceCapabilityOptionModelCopyWith(DeviceCapabilityOptionModel value, $Res Function(DeviceCapabilityOptionModel) _then) = _$DeviceCapabilityOptionModelCopyWithImpl; +@useResult +$Res call({ +@JsonKey(name: 'default') int defaultValue, bool enabled, List options +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityOptionModelCopyWithImpl<$Res> + implements $DeviceCapabilityOptionModelCopyWith<$Res> { + _$DeviceCapabilityOptionModelCopyWithImpl(this._self, this._then); + + final DeviceCapabilityOptionModel _self; + final $Res Function(DeviceCapabilityOptionModel) _then; + +/// Create a copy of DeviceCapabilityOptionModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? defaultValue = null,Object? enabled = null,Object? options = null,}) { + return _then(_self.copyWith( +defaultValue: null == defaultValue ? _self.defaultValue : defaultValue // ignore: cast_nullable_to_non_nullable +as int,enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,options: null == options ? _self.options : options // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityOptionModel]. +extension DeviceCapabilityOptionModelPatterns on DeviceCapabilityOptionModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityOptionModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityOptionModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityOptionModel value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityOptionModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityOptionModel value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityOptionModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function(@JsonKey(name: 'default') int defaultValue, bool enabled, List options)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityOptionModel() when $default != null: +return $default(_that.defaultValue,_that.enabled,_that.options);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function(@JsonKey(name: 'default') int defaultValue, bool enabled, List options) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityOptionModel(): +return $default(_that.defaultValue,_that.enabled,_that.options);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function(@JsonKey(name: 'default') int defaultValue, bool enabled, List options)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityOptionModel() when $default != null: +return $default(_that.defaultValue,_that.enabled,_that.options);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _DeviceCapabilityOptionModel implements DeviceCapabilityOptionModel { + const _DeviceCapabilityOptionModel({@JsonKey(name: 'default') this.defaultValue = 0, this.enabled = false, final List options = const []}): _options = options; + factory _DeviceCapabilityOptionModel.fromJson(Map json) => _$DeviceCapabilityOptionModelFromJson(json); + +@override@JsonKey(name: 'default') final int defaultValue; +@override@JsonKey() final bool enabled; + final List _options; +@override@JsonKey() List get options { + if (_options is EqualUnmodifiableListView) return _options; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_options); +} + + +/// Create a copy of DeviceCapabilityOptionModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityOptionModelCopyWith<_DeviceCapabilityOptionModel> get copyWith => __$DeviceCapabilityOptionModelCopyWithImpl<_DeviceCapabilityOptionModel>(this, _$identity); + +@override +Map toJson() { + return _$DeviceCapabilityOptionModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityOptionModel&&(identical(other.defaultValue, defaultValue) || other.defaultValue == defaultValue)&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other._options, _options)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,defaultValue,enabled,const DeepCollectionEquality().hash(_options)); + +@override +String toString() { + return 'DeviceCapabilityOptionModel(defaultValue: $defaultValue, enabled: $enabled, options: $options)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityOptionModelCopyWith<$Res> implements $DeviceCapabilityOptionModelCopyWith<$Res> { + factory _$DeviceCapabilityOptionModelCopyWith(_DeviceCapabilityOptionModel value, $Res Function(_DeviceCapabilityOptionModel) _then) = __$DeviceCapabilityOptionModelCopyWithImpl; +@override @useResult +$Res call({ +@JsonKey(name: 'default') int defaultValue, bool enabled, List options +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityOptionModelCopyWithImpl<$Res> + implements _$DeviceCapabilityOptionModelCopyWith<$Res> { + __$DeviceCapabilityOptionModelCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityOptionModel _self; + final $Res Function(_DeviceCapabilityOptionModel) _then; + +/// Create a copy of DeviceCapabilityOptionModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? defaultValue = null,Object? enabled = null,Object? options = null,}) { + return _then(_DeviceCapabilityOptionModel( +defaultValue: null == defaultValue ? _self.defaultValue : defaultValue // ignore: cast_nullable_to_non_nullable +as int,enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,options: null == options ? _self._options : options // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + + +/// @nodoc +mixin _$DeviceCapabilityAlertsModel { + + bool get enabled; List get types; +/// Create a copy of DeviceCapabilityAlertsModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityAlertsModelCopyWith get copyWith => _$DeviceCapabilityAlertsModelCopyWithImpl(this as DeviceCapabilityAlertsModel, _$identity); + + /// Serializes this DeviceCapabilityAlertsModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityAlertsModel&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other.types, types)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(types)); + +@override +String toString() { + return 'DeviceCapabilityAlertsModel(enabled: $enabled, types: $types)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityAlertsModelCopyWith<$Res> { + factory $DeviceCapabilityAlertsModelCopyWith(DeviceCapabilityAlertsModel value, $Res Function(DeviceCapabilityAlertsModel) _then) = _$DeviceCapabilityAlertsModelCopyWithImpl; +@useResult +$Res call({ + bool enabled, List types +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityAlertsModelCopyWithImpl<$Res> + implements $DeviceCapabilityAlertsModelCopyWith<$Res> { + _$DeviceCapabilityAlertsModelCopyWithImpl(this._self, this._then); + + final DeviceCapabilityAlertsModel _self; + final $Res Function(DeviceCapabilityAlertsModel) _then; + +/// Create a copy of DeviceCapabilityAlertsModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? enabled = null,Object? types = null,}) { + return _then(_self.copyWith( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self.types : types // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityAlertsModel]. +extension DeviceCapabilityAlertsModelPatterns on DeviceCapabilityAlertsModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityAlertsModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityAlertsModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityAlertsModel value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityAlertsModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityAlertsModel value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityAlertsModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( bool enabled, List types)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityAlertsModel() when $default != null: +return $default(_that.enabled,_that.types);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( bool enabled, List types) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityAlertsModel(): +return $default(_that.enabled,_that.types);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool enabled, List types)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityAlertsModel() when $default != null: +return $default(_that.enabled,_that.types);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _DeviceCapabilityAlertsModel implements DeviceCapabilityAlertsModel { + const _DeviceCapabilityAlertsModel({this.enabled = false, final List types = const []}): _types = types; + factory _DeviceCapabilityAlertsModel.fromJson(Map json) => _$DeviceCapabilityAlertsModelFromJson(json); + +@override@JsonKey() final bool enabled; + final List _types; +@override@JsonKey() List get types { + if (_types is EqualUnmodifiableListView) return _types; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_types); +} + + +/// Create a copy of DeviceCapabilityAlertsModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityAlertsModelCopyWith<_DeviceCapabilityAlertsModel> get copyWith => __$DeviceCapabilityAlertsModelCopyWithImpl<_DeviceCapabilityAlertsModel>(this, _$identity); + +@override +Map toJson() { + return _$DeviceCapabilityAlertsModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityAlertsModel&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other._types, _types)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(_types)); + +@override +String toString() { + return 'DeviceCapabilityAlertsModel(enabled: $enabled, types: $types)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityAlertsModelCopyWith<$Res> implements $DeviceCapabilityAlertsModelCopyWith<$Res> { + factory _$DeviceCapabilityAlertsModelCopyWith(_DeviceCapabilityAlertsModel value, $Res Function(_DeviceCapabilityAlertsModel) _then) = __$DeviceCapabilityAlertsModelCopyWithImpl; +@override @useResult +$Res call({ + bool enabled, List types +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityAlertsModelCopyWithImpl<$Res> + implements _$DeviceCapabilityAlertsModelCopyWith<$Res> { + __$DeviceCapabilityAlertsModelCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityAlertsModel _self; + final $Res Function(_DeviceCapabilityAlertsModel) _then; + +/// Create a copy of DeviceCapabilityAlertsModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? enabled = null,Object? types = null,}) { + return _then(_DeviceCapabilityAlertsModel( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self._types : types // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + + +/// @nodoc +mixin _$DeviceCapabilityContactsModel { + + bool get enabled; List get types; bool get isPhonebookWithPhoto; +/// Create a copy of DeviceCapabilityContactsModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityContactsModelCopyWith get copyWith => _$DeviceCapabilityContactsModelCopyWithImpl(this as DeviceCapabilityContactsModel, _$identity); + + /// Serializes this DeviceCapabilityContactsModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityContactsModel&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other.types, types)&&(identical(other.isPhonebookWithPhoto, isPhonebookWithPhoto) || other.isPhonebookWithPhoto == isPhonebookWithPhoto)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(types),isPhonebookWithPhoto); + +@override +String toString() { + return 'DeviceCapabilityContactsModel(enabled: $enabled, types: $types, isPhonebookWithPhoto: $isPhonebookWithPhoto)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityContactsModelCopyWith<$Res> { + factory $DeviceCapabilityContactsModelCopyWith(DeviceCapabilityContactsModel value, $Res Function(DeviceCapabilityContactsModel) _then) = _$DeviceCapabilityContactsModelCopyWithImpl; +@useResult +$Res call({ + bool enabled, List types, bool isPhonebookWithPhoto +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityContactsModelCopyWithImpl<$Res> + implements $DeviceCapabilityContactsModelCopyWith<$Res> { + _$DeviceCapabilityContactsModelCopyWithImpl(this._self, this._then); + + final DeviceCapabilityContactsModel _self; + final $Res Function(DeviceCapabilityContactsModel) _then; + +/// Create a copy of DeviceCapabilityContactsModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? enabled = null,Object? types = null,Object? isPhonebookWithPhoto = null,}) { + return _then(_self.copyWith( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self.types : types // ignore: cast_nullable_to_non_nullable +as List,isPhonebookWithPhoto: null == isPhonebookWithPhoto ? _self.isPhonebookWithPhoto : isPhonebookWithPhoto // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityContactsModel]. +extension DeviceCapabilityContactsModelPatterns on DeviceCapabilityContactsModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityContactsModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityContactsModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityContactsModel value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityContactsModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityContactsModel value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityContactsModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( bool enabled, List types, bool isPhonebookWithPhoto)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityContactsModel() when $default != null: +return $default(_that.enabled,_that.types,_that.isPhonebookWithPhoto);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( bool enabled, List types, bool isPhonebookWithPhoto) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityContactsModel(): +return $default(_that.enabled,_that.types,_that.isPhonebookWithPhoto);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool enabled, List types, bool isPhonebookWithPhoto)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityContactsModel() when $default != null: +return $default(_that.enabled,_that.types,_that.isPhonebookWithPhoto);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _DeviceCapabilityContactsModel implements DeviceCapabilityContactsModel { + const _DeviceCapabilityContactsModel({this.enabled = false, final List types = const [], this.isPhonebookWithPhoto = false}): _types = types; + factory _DeviceCapabilityContactsModel.fromJson(Map json) => _$DeviceCapabilityContactsModelFromJson(json); + +@override@JsonKey() final bool enabled; + final List _types; +@override@JsonKey() List get types { + if (_types is EqualUnmodifiableListView) return _types; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_types); +} + +@override@JsonKey() final bool isPhonebookWithPhoto; + +/// Create a copy of DeviceCapabilityContactsModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityContactsModelCopyWith<_DeviceCapabilityContactsModel> get copyWith => __$DeviceCapabilityContactsModelCopyWithImpl<_DeviceCapabilityContactsModel>(this, _$identity); + +@override +Map toJson() { + return _$DeviceCapabilityContactsModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityContactsModel&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other._types, _types)&&(identical(other.isPhonebookWithPhoto, isPhonebookWithPhoto) || other.isPhonebookWithPhoto == isPhonebookWithPhoto)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(_types),isPhonebookWithPhoto); + +@override +String toString() { + return 'DeviceCapabilityContactsModel(enabled: $enabled, types: $types, isPhonebookWithPhoto: $isPhonebookWithPhoto)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityContactsModelCopyWith<$Res> implements $DeviceCapabilityContactsModelCopyWith<$Res> { + factory _$DeviceCapabilityContactsModelCopyWith(_DeviceCapabilityContactsModel value, $Res Function(_DeviceCapabilityContactsModel) _then) = __$DeviceCapabilityContactsModelCopyWithImpl; +@override @useResult +$Res call({ + bool enabled, List types, bool isPhonebookWithPhoto +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityContactsModelCopyWithImpl<$Res> + implements _$DeviceCapabilityContactsModelCopyWith<$Res> { + __$DeviceCapabilityContactsModelCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityContactsModel _self; + final $Res Function(_DeviceCapabilityContactsModel) _then; + +/// Create a copy of DeviceCapabilityContactsModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? enabled = null,Object? types = null,Object? isPhonebookWithPhoto = null,}) { + return _then(_DeviceCapabilityContactsModel( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self._types : types // ignore: cast_nullable_to_non_nullable +as List,isPhonebookWithPhoto: null == isPhonebookWithPhoto ? _self.isPhonebookWithPhoto : isPhonebookWithPhoto // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + + +/// @nodoc +mixin _$DeviceCapabilityContactTypeModel { + + String get type; int get amount; +/// Create a copy of DeviceCapabilityContactTypeModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityContactTypeModelCopyWith get copyWith => _$DeviceCapabilityContactTypeModelCopyWithImpl(this as DeviceCapabilityContactTypeModel, _$identity); + + /// Serializes this DeviceCapabilityContactTypeModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityContactTypeModel&&(identical(other.type, type) || other.type == type)&&(identical(other.amount, amount) || other.amount == amount)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,type,amount); + +@override +String toString() { + return 'DeviceCapabilityContactTypeModel(type: $type, amount: $amount)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityContactTypeModelCopyWith<$Res> { + factory $DeviceCapabilityContactTypeModelCopyWith(DeviceCapabilityContactTypeModel value, $Res Function(DeviceCapabilityContactTypeModel) _then) = _$DeviceCapabilityContactTypeModelCopyWithImpl; +@useResult +$Res call({ + String type, int amount +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityContactTypeModelCopyWithImpl<$Res> + implements $DeviceCapabilityContactTypeModelCopyWith<$Res> { + _$DeviceCapabilityContactTypeModelCopyWithImpl(this._self, this._then); + + final DeviceCapabilityContactTypeModel _self; + final $Res Function(DeviceCapabilityContactTypeModel) _then; + +/// Create a copy of DeviceCapabilityContactTypeModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? type = null,Object? amount = null,}) { + return _then(_self.copyWith( +type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String,amount: null == amount ? _self.amount : amount // ignore: cast_nullable_to_non_nullable +as int, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityContactTypeModel]. +extension DeviceCapabilityContactTypeModelPatterns on DeviceCapabilityContactTypeModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityContactTypeModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityContactTypeModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityContactTypeModel value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityContactTypeModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityContactTypeModel value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityContactTypeModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String type, int amount)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityContactTypeModel() when $default != null: +return $default(_that.type,_that.amount);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String type, int amount) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityContactTypeModel(): +return $default(_that.type,_that.amount);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String type, int amount)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityContactTypeModel() when $default != null: +return $default(_that.type,_that.amount);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _DeviceCapabilityContactTypeModel implements DeviceCapabilityContactTypeModel { + const _DeviceCapabilityContactTypeModel({this.type = '', this.amount = 0}); + factory _DeviceCapabilityContactTypeModel.fromJson(Map json) => _$DeviceCapabilityContactTypeModelFromJson(json); + +@override@JsonKey() final String type; +@override@JsonKey() final int amount; + +/// Create a copy of DeviceCapabilityContactTypeModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityContactTypeModelCopyWith<_DeviceCapabilityContactTypeModel> get copyWith => __$DeviceCapabilityContactTypeModelCopyWithImpl<_DeviceCapabilityContactTypeModel>(this, _$identity); + +@override +Map toJson() { + return _$DeviceCapabilityContactTypeModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityContactTypeModel&&(identical(other.type, type) || other.type == type)&&(identical(other.amount, amount) || other.amount == amount)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,type,amount); + +@override +String toString() { + return 'DeviceCapabilityContactTypeModel(type: $type, amount: $amount)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityContactTypeModelCopyWith<$Res> implements $DeviceCapabilityContactTypeModelCopyWith<$Res> { + factory _$DeviceCapabilityContactTypeModelCopyWith(_DeviceCapabilityContactTypeModel value, $Res Function(_DeviceCapabilityContactTypeModel) _then) = __$DeviceCapabilityContactTypeModelCopyWithImpl; +@override @useResult +$Res call({ + String type, int amount +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityContactTypeModelCopyWithImpl<$Res> + implements _$DeviceCapabilityContactTypeModelCopyWith<$Res> { + __$DeviceCapabilityContactTypeModelCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityContactTypeModel _self; + final $Res Function(_DeviceCapabilityContactTypeModel) _then; + +/// Create a copy of DeviceCapabilityContactTypeModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? type = null,Object? amount = null,}) { + return _then(_DeviceCapabilityContactTypeModel( +type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String,amount: null == amount ? _self.amount : amount // ignore: cast_nullable_to_non_nullable +as int, + )); +} + + +} + + +/// @nodoc +mixin _$DeviceCapabilitySettingsModel { + + bool get language; bool get timezone; List get soundModes; +/// Create a copy of DeviceCapabilitySettingsModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilitySettingsModelCopyWith get copyWith => _$DeviceCapabilitySettingsModelCopyWithImpl(this as DeviceCapabilitySettingsModel, _$identity); + + /// Serializes this DeviceCapabilitySettingsModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilitySettingsModel&&(identical(other.language, language) || other.language == language)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&const DeepCollectionEquality().equals(other.soundModes, soundModes)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,language,timezone,const DeepCollectionEquality().hash(soundModes)); + +@override +String toString() { + return 'DeviceCapabilitySettingsModel(language: $language, timezone: $timezone, soundModes: $soundModes)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilitySettingsModelCopyWith<$Res> { + factory $DeviceCapabilitySettingsModelCopyWith(DeviceCapabilitySettingsModel value, $Res Function(DeviceCapabilitySettingsModel) _then) = _$DeviceCapabilitySettingsModelCopyWithImpl; +@useResult +$Res call({ + bool language, bool timezone, List soundModes +}); + + + + +} +/// @nodoc +class _$DeviceCapabilitySettingsModelCopyWithImpl<$Res> + implements $DeviceCapabilitySettingsModelCopyWith<$Res> { + _$DeviceCapabilitySettingsModelCopyWithImpl(this._self, this._then); + + final DeviceCapabilitySettingsModel _self; + final $Res Function(DeviceCapabilitySettingsModel) _then; + +/// Create a copy of DeviceCapabilitySettingsModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? language = null,Object? timezone = null,Object? soundModes = null,}) { + return _then(_self.copyWith( +language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as bool,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as bool,soundModes: null == soundModes ? _self.soundModes : soundModes // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilitySettingsModel]. +extension DeviceCapabilitySettingsModelPatterns on DeviceCapabilitySettingsModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilitySettingsModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilitySettingsModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilitySettingsModel value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitySettingsModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilitySettingsModel value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitySettingsModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( bool language, bool timezone, List soundModes)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilitySettingsModel() when $default != null: +return $default(_that.language,_that.timezone,_that.soundModes);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( bool language, bool timezone, List soundModes) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitySettingsModel(): +return $default(_that.language,_that.timezone,_that.soundModes);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool language, bool timezone, List soundModes)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitySettingsModel() when $default != null: +return $default(_that.language,_that.timezone,_that.soundModes);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _DeviceCapabilitySettingsModel implements DeviceCapabilitySettingsModel { + const _DeviceCapabilitySettingsModel({this.language = false, this.timezone = false, final List soundModes = const []}): _soundModes = soundModes; + factory _DeviceCapabilitySettingsModel.fromJson(Map json) => _$DeviceCapabilitySettingsModelFromJson(json); + +@override@JsonKey() final bool language; +@override@JsonKey() final bool timezone; + final List _soundModes; +@override@JsonKey() List get soundModes { + if (_soundModes is EqualUnmodifiableListView) return _soundModes; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_soundModes); +} + + +/// Create a copy of DeviceCapabilitySettingsModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilitySettingsModelCopyWith<_DeviceCapabilitySettingsModel> get copyWith => __$DeviceCapabilitySettingsModelCopyWithImpl<_DeviceCapabilitySettingsModel>(this, _$identity); + +@override +Map toJson() { + return _$DeviceCapabilitySettingsModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilitySettingsModel&&(identical(other.language, language) || other.language == language)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&const DeepCollectionEquality().equals(other._soundModes, _soundModes)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,language,timezone,const DeepCollectionEquality().hash(_soundModes)); + +@override +String toString() { + return 'DeviceCapabilitySettingsModel(language: $language, timezone: $timezone, soundModes: $soundModes)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilitySettingsModelCopyWith<$Res> implements $DeviceCapabilitySettingsModelCopyWith<$Res> { + factory _$DeviceCapabilitySettingsModelCopyWith(_DeviceCapabilitySettingsModel value, $Res Function(_DeviceCapabilitySettingsModel) _then) = __$DeviceCapabilitySettingsModelCopyWithImpl; +@override @useResult +$Res call({ + bool language, bool timezone, List soundModes +}); + + + + +} +/// @nodoc +class __$DeviceCapabilitySettingsModelCopyWithImpl<$Res> + implements _$DeviceCapabilitySettingsModelCopyWith<$Res> { + __$DeviceCapabilitySettingsModelCopyWithImpl(this._self, this._then); + + final _DeviceCapabilitySettingsModel _self; + final $Res Function(_DeviceCapabilitySettingsModel) _then; + +/// Create a copy of DeviceCapabilitySettingsModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? language = null,Object? timezone = null,Object? soundModes = null,}) { + return _then(_DeviceCapabilitySettingsModel( +language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as bool,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as bool,soundModes: null == soundModes ? _self._soundModes : soundModes // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + + +/// @nodoc +mixin _$DeviceCapabilityCommandsModel { + + bool get enabled; List get types; +/// Create a copy of DeviceCapabilityCommandsModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityCommandsModelCopyWith get copyWith => _$DeviceCapabilityCommandsModelCopyWithImpl(this as DeviceCapabilityCommandsModel, _$identity); + + /// Serializes this DeviceCapabilityCommandsModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityCommandsModel&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other.types, types)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(types)); + +@override +String toString() { + return 'DeviceCapabilityCommandsModel(enabled: $enabled, types: $types)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityCommandsModelCopyWith<$Res> { + factory $DeviceCapabilityCommandsModelCopyWith(DeviceCapabilityCommandsModel value, $Res Function(DeviceCapabilityCommandsModel) _then) = _$DeviceCapabilityCommandsModelCopyWithImpl; +@useResult +$Res call({ + bool enabled, List types +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityCommandsModelCopyWithImpl<$Res> + implements $DeviceCapabilityCommandsModelCopyWith<$Res> { + _$DeviceCapabilityCommandsModelCopyWithImpl(this._self, this._then); + + final DeviceCapabilityCommandsModel _self; + final $Res Function(DeviceCapabilityCommandsModel) _then; + +/// Create a copy of DeviceCapabilityCommandsModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? enabled = null,Object? types = null,}) { + return _then(_self.copyWith( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self.types : types // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityCommandsModel]. +extension DeviceCapabilityCommandsModelPatterns on DeviceCapabilityCommandsModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityCommandsModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityCommandsModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityCommandsModel value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityCommandsModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityCommandsModel value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityCommandsModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( bool enabled, List types)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityCommandsModel() when $default != null: +return $default(_that.enabled,_that.types);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( bool enabled, List types) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityCommandsModel(): +return $default(_that.enabled,_that.types);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool enabled, List types)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityCommandsModel() when $default != null: +return $default(_that.enabled,_that.types);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _DeviceCapabilityCommandsModel implements DeviceCapabilityCommandsModel { + const _DeviceCapabilityCommandsModel({this.enabled = false, final List types = const []}): _types = types; + factory _DeviceCapabilityCommandsModel.fromJson(Map json) => _$DeviceCapabilityCommandsModelFromJson(json); + +@override@JsonKey() final bool enabled; + final List _types; +@override@JsonKey() List get types { + if (_types is EqualUnmodifiableListView) return _types; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_types); +} + + +/// Create a copy of DeviceCapabilityCommandsModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityCommandsModelCopyWith<_DeviceCapabilityCommandsModel> get copyWith => __$DeviceCapabilityCommandsModelCopyWithImpl<_DeviceCapabilityCommandsModel>(this, _$identity); + +@override +Map toJson() { + return _$DeviceCapabilityCommandsModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityCommandsModel&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other._types, _types)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(_types)); + +@override +String toString() { + return 'DeviceCapabilityCommandsModel(enabled: $enabled, types: $types)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityCommandsModelCopyWith<$Res> implements $DeviceCapabilityCommandsModelCopyWith<$Res> { + factory _$DeviceCapabilityCommandsModelCopyWith(_DeviceCapabilityCommandsModel value, $Res Function(_DeviceCapabilityCommandsModel) _then) = __$DeviceCapabilityCommandsModelCopyWithImpl; +@override @useResult +$Res call({ + bool enabled, List types +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityCommandsModelCopyWithImpl<$Res> + implements _$DeviceCapabilityCommandsModelCopyWith<$Res> { + __$DeviceCapabilityCommandsModelCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityCommandsModel _self; + final $Res Function(_DeviceCapabilityCommandsModel) _then; + +/// Create a copy of DeviceCapabilityCommandsModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? enabled = null,Object? types = null,}) { + return _then(_DeviceCapabilityCommandsModel( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self._types : types // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + + +/// @nodoc +mixin _$DeviceCapabilityTakepillsModel { + + bool get enabled; int get maxReminders; +/// Create a copy of DeviceCapabilityTakepillsModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityTakepillsModelCopyWith get copyWith => _$DeviceCapabilityTakepillsModelCopyWithImpl(this as DeviceCapabilityTakepillsModel, _$identity); + + /// Serializes this DeviceCapabilityTakepillsModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityTakepillsModel&&(identical(other.enabled, enabled) || other.enabled == enabled)&&(identical(other.maxReminders, maxReminders) || other.maxReminders == maxReminders)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,enabled,maxReminders); + +@override +String toString() { + return 'DeviceCapabilityTakepillsModel(enabled: $enabled, maxReminders: $maxReminders)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityTakepillsModelCopyWith<$Res> { + factory $DeviceCapabilityTakepillsModelCopyWith(DeviceCapabilityTakepillsModel value, $Res Function(DeviceCapabilityTakepillsModel) _then) = _$DeviceCapabilityTakepillsModelCopyWithImpl; +@useResult +$Res call({ + bool enabled, int maxReminders +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityTakepillsModelCopyWithImpl<$Res> + implements $DeviceCapabilityTakepillsModelCopyWith<$Res> { + _$DeviceCapabilityTakepillsModelCopyWithImpl(this._self, this._then); + + final DeviceCapabilityTakepillsModel _self; + final $Res Function(DeviceCapabilityTakepillsModel) _then; + +/// Create a copy of DeviceCapabilityTakepillsModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? enabled = null,Object? maxReminders = null,}) { + return _then(_self.copyWith( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,maxReminders: null == maxReminders ? _self.maxReminders : maxReminders // ignore: cast_nullable_to_non_nullable +as int, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityTakepillsModel]. +extension DeviceCapabilityTakepillsModelPatterns on DeviceCapabilityTakepillsModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityTakepillsModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityTakepillsModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityTakepillsModel value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityTakepillsModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityTakepillsModel value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityTakepillsModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( bool enabled, int maxReminders)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityTakepillsModel() when $default != null: +return $default(_that.enabled,_that.maxReminders);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( bool enabled, int maxReminders) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityTakepillsModel(): +return $default(_that.enabled,_that.maxReminders);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool enabled, int maxReminders)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityTakepillsModel() when $default != null: +return $default(_that.enabled,_that.maxReminders);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _DeviceCapabilityTakepillsModel implements DeviceCapabilityTakepillsModel { + const _DeviceCapabilityTakepillsModel({this.enabled = false, this.maxReminders = 0}); + factory _DeviceCapabilityTakepillsModel.fromJson(Map json) => _$DeviceCapabilityTakepillsModelFromJson(json); + +@override@JsonKey() final bool enabled; +@override@JsonKey() final int maxReminders; + +/// Create a copy of DeviceCapabilityTakepillsModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityTakepillsModelCopyWith<_DeviceCapabilityTakepillsModel> get copyWith => __$DeviceCapabilityTakepillsModelCopyWithImpl<_DeviceCapabilityTakepillsModel>(this, _$identity); + +@override +Map toJson() { + return _$DeviceCapabilityTakepillsModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityTakepillsModel&&(identical(other.enabled, enabled) || other.enabled == enabled)&&(identical(other.maxReminders, maxReminders) || other.maxReminders == maxReminders)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,enabled,maxReminders); + +@override +String toString() { + return 'DeviceCapabilityTakepillsModel(enabled: $enabled, maxReminders: $maxReminders)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityTakepillsModelCopyWith<$Res> implements $DeviceCapabilityTakepillsModelCopyWith<$Res> { + factory _$DeviceCapabilityTakepillsModelCopyWith(_DeviceCapabilityTakepillsModel value, $Res Function(_DeviceCapabilityTakepillsModel) _then) = __$DeviceCapabilityTakepillsModelCopyWithImpl; +@override @useResult +$Res call({ + bool enabled, int maxReminders +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityTakepillsModelCopyWithImpl<$Res> + implements _$DeviceCapabilityTakepillsModelCopyWith<$Res> { + __$DeviceCapabilityTakepillsModelCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityTakepillsModel _self; + final $Res Function(_DeviceCapabilityTakepillsModel) _then; + +/// Create a copy of DeviceCapabilityTakepillsModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? enabled = null,Object? maxReminders = null,}) { + return _then(_DeviceCapabilityTakepillsModel( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,maxReminders: null == maxReminders ? _self.maxReminders : maxReminders // ignore: cast_nullable_to_non_nullable +as int, + )); +} + + +} + + +/// @nodoc +mixin _$DeviceCapabilityCameraModel { + + String get format; bool get enabled; +/// Create a copy of DeviceCapabilityCameraModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityCameraModelCopyWith get copyWith => _$DeviceCapabilityCameraModelCopyWithImpl(this as DeviceCapabilityCameraModel, _$identity); + + /// Serializes this DeviceCapabilityCameraModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityCameraModel&&(identical(other.format, format) || other.format == format)&&(identical(other.enabled, enabled) || other.enabled == enabled)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,format,enabled); + +@override +String toString() { + return 'DeviceCapabilityCameraModel(format: $format, enabled: $enabled)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityCameraModelCopyWith<$Res> { + factory $DeviceCapabilityCameraModelCopyWith(DeviceCapabilityCameraModel value, $Res Function(DeviceCapabilityCameraModel) _then) = _$DeviceCapabilityCameraModelCopyWithImpl; +@useResult +$Res call({ + String format, bool enabled +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityCameraModelCopyWithImpl<$Res> + implements $DeviceCapabilityCameraModelCopyWith<$Res> { + _$DeviceCapabilityCameraModelCopyWithImpl(this._self, this._then); + + final DeviceCapabilityCameraModel _self; + final $Res Function(DeviceCapabilityCameraModel) _then; + +/// Create a copy of DeviceCapabilityCameraModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? format = null,Object? enabled = null,}) { + return _then(_self.copyWith( +format: null == format ? _self.format : format // ignore: cast_nullable_to_non_nullable +as String,enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityCameraModel]. +extension DeviceCapabilityCameraModelPatterns on DeviceCapabilityCameraModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityCameraModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityCameraModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityCameraModel value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityCameraModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityCameraModel value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityCameraModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String format, bool enabled)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityCameraModel() when $default != null: +return $default(_that.format,_that.enabled);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String format, bool enabled) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityCameraModel(): +return $default(_that.format,_that.enabled);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String format, bool enabled)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityCameraModel() when $default != null: +return $default(_that.format,_that.enabled);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _DeviceCapabilityCameraModel implements DeviceCapabilityCameraModel { + const _DeviceCapabilityCameraModel({this.format = '', this.enabled = false}); + factory _DeviceCapabilityCameraModel.fromJson(Map json) => _$DeviceCapabilityCameraModelFromJson(json); + +@override@JsonKey() final String format; +@override@JsonKey() final bool enabled; + +/// Create a copy of DeviceCapabilityCameraModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityCameraModelCopyWith<_DeviceCapabilityCameraModel> get copyWith => __$DeviceCapabilityCameraModelCopyWithImpl<_DeviceCapabilityCameraModel>(this, _$identity); + +@override +Map toJson() { + return _$DeviceCapabilityCameraModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityCameraModel&&(identical(other.format, format) || other.format == format)&&(identical(other.enabled, enabled) || other.enabled == enabled)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,format,enabled); + +@override +String toString() { + return 'DeviceCapabilityCameraModel(format: $format, enabled: $enabled)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityCameraModelCopyWith<$Res> implements $DeviceCapabilityCameraModelCopyWith<$Res> { + factory _$DeviceCapabilityCameraModelCopyWith(_DeviceCapabilityCameraModel value, $Res Function(_DeviceCapabilityCameraModel) _then) = __$DeviceCapabilityCameraModelCopyWithImpl; +@override @useResult +$Res call({ + String format, bool enabled +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityCameraModelCopyWithImpl<$Res> + implements _$DeviceCapabilityCameraModelCopyWith<$Res> { + __$DeviceCapabilityCameraModelCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityCameraModel _self; + final $Res Function(_DeviceCapabilityCameraModel) _then; + +/// Create a copy of DeviceCapabilityCameraModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? format = null,Object? enabled = null,}) { + return _then(_DeviceCapabilityCameraModel( +format: null == format ? _self.format : format // ignore: cast_nullable_to_non_nullable +as String,enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + +// dart format on diff --git a/packages/sf_shared/lib/src/data/models/device_capabilities_model.g.dart b/packages/sf_shared/lib/src/data/models/device_capabilities_model.g.dart new file mode 100644 index 00000000..9ce8a359 --- /dev/null +++ b/packages/sf_shared/lib/src/data/models/device_capabilities_model.g.dart @@ -0,0 +1,211 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'device_capabilities_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_DeviceCapabilitiesModel _$DeviceCapabilitiesModelFromJson( + Map json, +) => _DeviceCapabilitiesModel( + heartbeats: json['heartbeats'] == null + ? null + : DeviceCapabilityOptionModel.fromJson( + json['heartbeats'] as Map, + ), + bloodPressure: json['bloodPressure'] == null + ? null + : DeviceCapabilityEnabledModel.fromJson( + json['bloodPressure'] as Map, + ), + alerts: json['alerts'] == null + ? null + : DeviceCapabilityAlertsModel.fromJson( + json['alerts'] as Map, + ), + podometer: json['podometer'] == null + ? null + : DeviceCapabilityEnabledModel.fromJson( + json['podometer'] as Map, + ), + contacts: json['contacts'] == null + ? null + : DeviceCapabilityContactsModel.fromJson( + json['contacts'] as Map, + ), + settings: json['settings'] == null + ? null + : DeviceCapabilitySettingsModel.fromJson( + json['settings'] as Map, + ), + commands: json['commands'] == null + ? null + : DeviceCapabilityCommandsModel.fromJson( + json['commands'] as Map, + ), + takepills: json['takepills'] == null + ? null + : DeviceCapabilityTakepillsModel.fromJson( + json['takepills'] as Map, + ), + location: json['location'] == null + ? null + : DeviceCapabilityOptionModel.fromJson( + json['location'] as Map, + ), + camera: json['camera'] == null + ? null + : DeviceCapabilityCameraModel.fromJson( + json['camera'] as Map, + ), +); + +Map _$DeviceCapabilitiesModelToJson( + _DeviceCapabilitiesModel instance, +) => { + 'heartbeats': instance.heartbeats, + 'bloodPressure': instance.bloodPressure, + 'alerts': instance.alerts, + 'podometer': instance.podometer, + 'contacts': instance.contacts, + 'settings': instance.settings, + 'commands': instance.commands, + 'takepills': instance.takepills, + 'location': instance.location, + 'camera': instance.camera, +}; + +_DeviceCapabilityEnabledModel _$DeviceCapabilityEnabledModelFromJson( + Map json, +) => _DeviceCapabilityEnabledModel(enabled: json['enabled'] as bool? ?? false); + +Map _$DeviceCapabilityEnabledModelToJson( + _DeviceCapabilityEnabledModel instance, +) => {'enabled': instance.enabled}; + +_DeviceCapabilityOptionModel _$DeviceCapabilityOptionModelFromJson( + Map json, +) => _DeviceCapabilityOptionModel( + defaultValue: (json['default'] as num?)?.toInt() ?? 0, + enabled: json['enabled'] as bool? ?? false, + options: + (json['options'] as List?) + ?.map((e) => (e as num).toInt()) + .toList() ?? + const [], +); + +Map _$DeviceCapabilityOptionModelToJson( + _DeviceCapabilityOptionModel instance, +) => { + 'default': instance.defaultValue, + 'enabled': instance.enabled, + 'options': instance.options, +}; + +_DeviceCapabilityAlertsModel _$DeviceCapabilityAlertsModelFromJson( + Map json, +) => _DeviceCapabilityAlertsModel( + enabled: json['enabled'] as bool? ?? false, + types: + (json['types'] as List?)?.map((e) => e as String).toList() ?? + const [], +); + +Map _$DeviceCapabilityAlertsModelToJson( + _DeviceCapabilityAlertsModel instance, +) => {'enabled': instance.enabled, 'types': instance.types}; + +_DeviceCapabilityContactsModel _$DeviceCapabilityContactsModelFromJson( + Map json, +) => _DeviceCapabilityContactsModel( + enabled: json['enabled'] as bool? ?? false, + types: + (json['types'] as List?) + ?.map( + (e) => DeviceCapabilityContactTypeModel.fromJson( + e as Map, + ), + ) + .toList() ?? + const [], + isPhonebookWithPhoto: json['isPhonebookWithPhoto'] as bool? ?? false, +); + +Map _$DeviceCapabilityContactsModelToJson( + _DeviceCapabilityContactsModel instance, +) => { + 'enabled': instance.enabled, + 'types': instance.types, + 'isPhonebookWithPhoto': instance.isPhonebookWithPhoto, +}; + +_DeviceCapabilityContactTypeModel _$DeviceCapabilityContactTypeModelFromJson( + Map json, +) => _DeviceCapabilityContactTypeModel( + type: json['type'] as String? ?? '', + amount: (json['amount'] as num?)?.toInt() ?? 0, +); + +Map _$DeviceCapabilityContactTypeModelToJson( + _DeviceCapabilityContactTypeModel instance, +) => {'type': instance.type, 'amount': instance.amount}; + +_DeviceCapabilitySettingsModel _$DeviceCapabilitySettingsModelFromJson( + Map json, +) => _DeviceCapabilitySettingsModel( + language: json['language'] as bool? ?? false, + timezone: json['timezone'] as bool? ?? false, + soundModes: + (json['soundModes'] as List?) + ?.map((e) => e as String) + .toList() ?? + const [], +); + +Map _$DeviceCapabilitySettingsModelToJson( + _DeviceCapabilitySettingsModel instance, +) => { + 'language': instance.language, + 'timezone': instance.timezone, + 'soundModes': instance.soundModes, +}; + +_DeviceCapabilityCommandsModel _$DeviceCapabilityCommandsModelFromJson( + Map json, +) => _DeviceCapabilityCommandsModel( + enabled: json['enabled'] as bool? ?? false, + types: + (json['types'] as List?)?.map((e) => e as String).toList() ?? + const [], +); + +Map _$DeviceCapabilityCommandsModelToJson( + _DeviceCapabilityCommandsModel instance, +) => {'enabled': instance.enabled, 'types': instance.types}; + +_DeviceCapabilityTakepillsModel _$DeviceCapabilityTakepillsModelFromJson( + Map json, +) => _DeviceCapabilityTakepillsModel( + enabled: json['enabled'] as bool? ?? false, + maxReminders: (json['maxReminders'] as num?)?.toInt() ?? 0, +); + +Map _$DeviceCapabilityTakepillsModelToJson( + _DeviceCapabilityTakepillsModel instance, +) => { + 'enabled': instance.enabled, + 'maxReminders': instance.maxReminders, +}; + +_DeviceCapabilityCameraModel _$DeviceCapabilityCameraModelFromJson( + Map json, +) => _DeviceCapabilityCameraModel( + format: json['format'] as String? ?? '', + enabled: json['enabled'] as bool? ?? false, +); + +Map _$DeviceCapabilityCameraModelToJson( + _DeviceCapabilityCameraModel instance, +) => {'format': instance.format, 'enabled': instance.enabled}; diff --git a/packages/sf_shared/lib/src/data/models/device_model.dart b/packages/sf_shared/lib/src/data/models/device_model.dart index 56defb2a..134b4e48 100644 --- a/packages/sf_shared/lib/src/data/models/device_model.dart +++ b/packages/sf_shared/lib/src/data/models/device_model.dart @@ -2,6 +2,9 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:sf_shared/src/domain/entities/device_entity.dart'; +import 'device_capabilities_model.dart'; +import 'device_settings_model.dart'; + part 'device_model.freezed.dart'; part 'device_model.g.dart'; @@ -41,11 +44,11 @@ abstract class DeviceModel with _$DeviceModel { @Default(null) String? phone, @Default(null) String? simId, @Default(null) Map? paymentOptions, - @Default({}) Map settings, + @Default(DeviceSettingsModel()) DeviceSettingsModel settings, @Default('') String connectionServer, @Default('') String protocol, @Default('') String type, - @Default(null) Map? capabilities, + @Default(null) DeviceCapabilitiesModel? capabilities, @JsonKey(fromJson: _toString) @Default('') String createdAt, @JsonKey(fromJson: _toNullableString) @Default(null) String? updatedAt, }) = _DeviceModel; @@ -75,11 +78,11 @@ extension DeviceModelMapper on DeviceModel { phone: phone, simId: simId, paymentOptions: paymentOptions, - settings: settings, + settings: settings.toEntity(), connectionServer: connectionServer, protocol: protocol, type: type, - capabilities: capabilities, + capabilities: capabilities?.toEntity(), createdAt: createdAt, updatedAt: updatedAt, ); diff --git a/packages/sf_shared/lib/src/data/models/device_model.freezed.dart b/packages/sf_shared/lib/src/data/models/device_model.freezed.dart index 2373cfc4..769cdebb 100644 --- a/packages/sf_shared/lib/src/data/models/device_model.freezed.dart +++ b/packages/sf_shared/lib/src/data/models/device_model.freezed.dart @@ -296,7 +296,7 @@ $DeviceModelCopyWith<$Res> get item { /// @nodoc mixin _$DeviceModel { - String get id;@JsonKey(fromJson: _toString) String get identificator; int? get battery; String? get userId; String? get companyId; String? get delegationId; String? get groupId; Map get flags; List? get tags; String? get lastConnection; String? get carrierGenre;@JsonKey(fromJson: _toNullableString) String? get carrierBirthday; int? get carrierWeight; int? get carrierStepLength; String? get carrierName; String? get comment; String? get phone; String? get simId; Map? get paymentOptions; Map get settings; String get connectionServer; String get protocol; String get type; Map? get capabilities;@JsonKey(fromJson: _toString) String get createdAt;@JsonKey(fromJson: _toNullableString) String? get updatedAt; + String get id;@JsonKey(fromJson: _toString) String get identificator; int? get battery; String? get userId; String? get companyId; String? get delegationId; String? get groupId; Map get flags; List? get tags; String? get lastConnection; String? get carrierGenre;@JsonKey(fromJson: _toNullableString) String? get carrierBirthday; int? get carrierWeight; int? get carrierStepLength; String? get carrierName; String? get comment; String? get phone; String? get simId; Map? get paymentOptions; DeviceSettingsModel get settings; String get connectionServer; String get protocol; String get type; DeviceCapabilitiesModel? get capabilities;@JsonKey(fromJson: _toString) String get createdAt;@JsonKey(fromJson: _toNullableString) String? get updatedAt; /// Create a copy of DeviceModel /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -309,12 +309,12 @@ $DeviceModelCopyWith get copyWith => _$DeviceModelCopyWithImpl Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(flags),const DeepCollectionEquality().hash(tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,const DeepCollectionEquality().hash(paymentOptions),const DeepCollectionEquality().hash(settings),connectionServer,protocol,type,const DeepCollectionEquality().hash(capabilities),createdAt,updatedAt]); +int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(flags),const DeepCollectionEquality().hash(tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,const DeepCollectionEquality().hash(paymentOptions),settings,connectionServer,protocol,type,capabilities,createdAt,updatedAt]); @override String toString() { @@ -329,11 +329,11 @@ abstract mixin class $DeviceModelCopyWith<$Res> { factory $DeviceModelCopyWith(DeviceModel value, $Res Function(DeviceModel) _then) = _$DeviceModelCopyWithImpl; @useResult $Res call({ - String id,@JsonKey(fromJson: _toString) String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre,@JsonKey(fromJson: _toNullableString) String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, Map settings, String connectionServer, String protocol, String type, Map? capabilities,@JsonKey(fromJson: _toString) String createdAt,@JsonKey(fromJson: _toNullableString) String? updatedAt + String id,@JsonKey(fromJson: _toString) String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre,@JsonKey(fromJson: _toNullableString) String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsModel settings, String connectionServer, String protocol, String type, DeviceCapabilitiesModel? capabilities,@JsonKey(fromJson: _toString) String createdAt,@JsonKey(fromJson: _toNullableString) String? updatedAt }); - +$DeviceSettingsModelCopyWith<$Res> get settings;$DeviceCapabilitiesModelCopyWith<$Res>? get capabilities; } /// @nodoc @@ -368,16 +368,37 @@ as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullabl as String?,simId: freezed == simId ? _self.simId : simId // ignore: cast_nullable_to_non_nullable as String?,paymentOptions: freezed == paymentOptions ? _self.paymentOptions : paymentOptions // ignore: cast_nullable_to_non_nullable as Map?,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable -as Map,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable +as DeviceSettingsModel,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable as String,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable as String,capabilities: freezed == capabilities ? _self.capabilities : capabilities // ignore: cast_nullable_to_non_nullable -as Map?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitiesModel?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as String,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable as String?, )); } +/// Create a copy of DeviceModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceSettingsModelCopyWith<$Res> get settings { + + return $DeviceSettingsModelCopyWith<$Res>(_self.settings, (value) { + return _then(_self.copyWith(settings: value)); + }); +}/// Create a copy of DeviceModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitiesModelCopyWith<$Res>? get capabilities { + if (_self.capabilities == null) { + return null; + } + return $DeviceCapabilitiesModelCopyWith<$Res>(_self.capabilities!, (value) { + return _then(_self.copyWith(capabilities: value)); + }); +} } @@ -459,7 +480,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String id, @JsonKey(fromJson: _toString) String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, @JsonKey(fromJson: _toNullableString) String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, Map settings, String connectionServer, String protocol, String type, Map? capabilities, @JsonKey(fromJson: _toString) String createdAt, @JsonKey(fromJson: _toNullableString) String? updatedAt)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, @JsonKey(fromJson: _toString) String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, @JsonKey(fromJson: _toNullableString) String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsModel settings, String connectionServer, String protocol, String type, DeviceCapabilitiesModel? capabilities, @JsonKey(fromJson: _toString) String createdAt, @JsonKey(fromJson: _toNullableString) String? updatedAt)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _DeviceModel() when $default != null: return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.paymentOptions,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.capabilities,_that.createdAt,_that.updatedAt);case _: @@ -480,7 +501,7 @@ return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.co /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String id, @JsonKey(fromJson: _toString) String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, @JsonKey(fromJson: _toNullableString) String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, Map settings, String connectionServer, String protocol, String type, Map? capabilities, @JsonKey(fromJson: _toString) String createdAt, @JsonKey(fromJson: _toNullableString) String? updatedAt) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String id, @JsonKey(fromJson: _toString) String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, @JsonKey(fromJson: _toNullableString) String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsModel settings, String connectionServer, String protocol, String type, DeviceCapabilitiesModel? capabilities, @JsonKey(fromJson: _toString) String createdAt, @JsonKey(fromJson: _toNullableString) String? updatedAt) $default,) {final _that = this; switch (_that) { case _DeviceModel(): return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.paymentOptions,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.capabilities,_that.createdAt,_that.updatedAt);case _: @@ -500,7 +521,7 @@ return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.co /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, @JsonKey(fromJson: _toString) String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, @JsonKey(fromJson: _toNullableString) String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, Map settings, String connectionServer, String protocol, String type, Map? capabilities, @JsonKey(fromJson: _toString) String createdAt, @JsonKey(fromJson: _toNullableString) String? updatedAt)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, @JsonKey(fromJson: _toString) String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, @JsonKey(fromJson: _toNullableString) String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsModel settings, String connectionServer, String protocol, String type, DeviceCapabilitiesModel? capabilities, @JsonKey(fromJson: _toString) String createdAt, @JsonKey(fromJson: _toNullableString) String? updatedAt)? $default,) {final _that = this; switch (_that) { case _DeviceModel() when $default != null: return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.paymentOptions,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.capabilities,_that.createdAt,_that.updatedAt);case _: @@ -515,7 +536,7 @@ return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.co @JsonSerializable() class _DeviceModel extends DeviceModel { - const _DeviceModel({required this.id, @JsonKey(fromJson: _toString) required this.identificator, this.battery = null, this.userId = null, this.companyId = null, this.delegationId = null, this.groupId = null, final Map flags = const {}, final List? tags = null, this.lastConnection = null, this.carrierGenre = null, @JsonKey(fromJson: _toNullableString) this.carrierBirthday = null, this.carrierWeight = null, this.carrierStepLength = null, this.carrierName = null, this.comment = null, this.phone = null, this.simId = null, final Map? paymentOptions = null, final Map settings = const {}, this.connectionServer = '', this.protocol = '', this.type = '', final Map? capabilities = null, @JsonKey(fromJson: _toString) this.createdAt = '', @JsonKey(fromJson: _toNullableString) this.updatedAt = null}): _flags = flags,_tags = tags,_paymentOptions = paymentOptions,_settings = settings,_capabilities = capabilities,super._(); + const _DeviceModel({required this.id, @JsonKey(fromJson: _toString) required this.identificator, this.battery = null, this.userId = null, this.companyId = null, this.delegationId = null, this.groupId = null, final Map flags = const {}, final List? tags = null, this.lastConnection = null, this.carrierGenre = null, @JsonKey(fromJson: _toNullableString) this.carrierBirthday = null, this.carrierWeight = null, this.carrierStepLength = null, this.carrierName = null, this.comment = null, this.phone = null, this.simId = null, final Map? paymentOptions = null, this.settings = const DeviceSettingsModel(), this.connectionServer = '', this.protocol = '', this.type = '', this.capabilities = null, @JsonKey(fromJson: _toString) this.createdAt = '', @JsonKey(fromJson: _toNullableString) this.updatedAt = null}): _flags = flags,_tags = tags,_paymentOptions = paymentOptions,super._(); factory _DeviceModel.fromJson(Map json) => _$DeviceModelFromJson(json); @override final String id; @@ -559,25 +580,11 @@ class _DeviceModel extends DeviceModel { return EqualUnmodifiableMapView(value); } - final Map _settings; -@override@JsonKey() Map get settings { - if (_settings is EqualUnmodifiableMapView) return _settings; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_settings); -} - +@override@JsonKey() final DeviceSettingsModel settings; @override@JsonKey() final String connectionServer; @override@JsonKey() final String protocol; @override@JsonKey() final String type; - final Map? _capabilities; -@override@JsonKey() Map? get capabilities { - final value = _capabilities; - if (value == null) return null; - if (_capabilities is EqualUnmodifiableMapView) return _capabilities; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); -} - +@override@JsonKey() final DeviceCapabilitiesModel? capabilities; @override@JsonKey(fromJson: _toString) final String createdAt; @override@JsonKey(fromJson: _toNullableString) final String? updatedAt; @@ -594,12 +601,12 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceModel&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.battery, battery) || other.battery == battery)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&const DeepCollectionEquality().equals(other._flags, _flags)&&const DeepCollectionEquality().equals(other._tags, _tags)&&(identical(other.lastConnection, lastConnection) || other.lastConnection == lastConnection)&&(identical(other.carrierGenre, carrierGenre) || other.carrierGenre == carrierGenre)&&(identical(other.carrierBirthday, carrierBirthday) || other.carrierBirthday == carrierBirthday)&&(identical(other.carrierWeight, carrierWeight) || other.carrierWeight == carrierWeight)&&(identical(other.carrierStepLength, carrierStepLength) || other.carrierStepLength == carrierStepLength)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.simId, simId) || other.simId == simId)&&const DeepCollectionEquality().equals(other._paymentOptions, _paymentOptions)&&const DeepCollectionEquality().equals(other._settings, _settings)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&const DeepCollectionEquality().equals(other._capabilities, _capabilities)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceModel&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.battery, battery) || other.battery == battery)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&const DeepCollectionEquality().equals(other._flags, _flags)&&const DeepCollectionEquality().equals(other._tags, _tags)&&(identical(other.lastConnection, lastConnection) || other.lastConnection == lastConnection)&&(identical(other.carrierGenre, carrierGenre) || other.carrierGenre == carrierGenre)&&(identical(other.carrierBirthday, carrierBirthday) || other.carrierBirthday == carrierBirthday)&&(identical(other.carrierWeight, carrierWeight) || other.carrierWeight == carrierWeight)&&(identical(other.carrierStepLength, carrierStepLength) || other.carrierStepLength == carrierStepLength)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.simId, simId) || other.simId == simId)&&const DeepCollectionEquality().equals(other._paymentOptions, _paymentOptions)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.capabilities, capabilities) || other.capabilities == capabilities)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(_flags),const DeepCollectionEquality().hash(_tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,const DeepCollectionEquality().hash(_paymentOptions),const DeepCollectionEquality().hash(_settings),connectionServer,protocol,type,const DeepCollectionEquality().hash(_capabilities),createdAt,updatedAt]); +int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(_flags),const DeepCollectionEquality().hash(_tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,const DeepCollectionEquality().hash(_paymentOptions),settings,connectionServer,protocol,type,capabilities,createdAt,updatedAt]); @override String toString() { @@ -614,11 +621,11 @@ abstract mixin class _$DeviceModelCopyWith<$Res> implements $DeviceModelCopyWith factory _$DeviceModelCopyWith(_DeviceModel value, $Res Function(_DeviceModel) _then) = __$DeviceModelCopyWithImpl; @override @useResult $Res call({ - String id,@JsonKey(fromJson: _toString) String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre,@JsonKey(fromJson: _toNullableString) String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, Map settings, String connectionServer, String protocol, String type, Map? capabilities,@JsonKey(fromJson: _toString) String createdAt,@JsonKey(fromJson: _toNullableString) String? updatedAt + String id,@JsonKey(fromJson: _toString) String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre,@JsonKey(fromJson: _toNullableString) String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsModel settings, String connectionServer, String protocol, String type, DeviceCapabilitiesModel? capabilities,@JsonKey(fromJson: _toString) String createdAt,@JsonKey(fromJson: _toNullableString) String? updatedAt }); - +@override $DeviceSettingsModelCopyWith<$Res> get settings;@override $DeviceCapabilitiesModelCopyWith<$Res>? get capabilities; } /// @nodoc @@ -652,18 +659,39 @@ as String?,comment: freezed == comment ? _self.comment : comment // ignore: cast as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable as String?,simId: freezed == simId ? _self.simId : simId // ignore: cast_nullable_to_non_nullable as String?,paymentOptions: freezed == paymentOptions ? _self._paymentOptions : paymentOptions // ignore: cast_nullable_to_non_nullable -as Map?,settings: null == settings ? _self._settings : settings // ignore: cast_nullable_to_non_nullable -as Map,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable +as Map?,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable +as DeviceSettingsModel,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable as String,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable -as String,capabilities: freezed == capabilities ? _self._capabilities : capabilities // ignore: cast_nullable_to_non_nullable -as Map?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String,capabilities: freezed == capabilities ? _self.capabilities : capabilities // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitiesModel?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as String,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable as String?, )); } +/// Create a copy of DeviceModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceSettingsModelCopyWith<$Res> get settings { + + return $DeviceSettingsModelCopyWith<$Res>(_self.settings, (value) { + return _then(_self.copyWith(settings: value)); + }); +}/// Create a copy of DeviceModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitiesModelCopyWith<$Res>? get capabilities { + if (_self.capabilities == null) { + return null; + } + return $DeviceCapabilitiesModelCopyWith<$Res>(_self.capabilities!, (value) { + return _then(_self.copyWith(capabilities: value)); + }); +} } // dart format on diff --git a/packages/sf_shared/lib/src/data/models/device_model.g.dart b/packages/sf_shared/lib/src/data/models/device_model.g.dart index 9dbe99d2..b260af48 100644 --- a/packages/sf_shared/lib/src/data/models/device_model.g.dart +++ b/packages/sf_shared/lib/src/data/models/device_model.g.dart @@ -39,11 +39,17 @@ _DeviceModel _$DeviceModelFromJson(Map json) => _DeviceModel( phone: json['phone'] as String? ?? null, simId: json['simId'] as String? ?? null, paymentOptions: json['paymentOptions'] as Map? ?? null, - settings: json['settings'] as Map? ?? const {}, + settings: json['settings'] == null + ? const DeviceSettingsModel() + : DeviceSettingsModel.fromJson(json['settings'] as Map), connectionServer: json['connectionServer'] as String? ?? '', protocol: json['protocol'] as String? ?? '', type: json['type'] as String? ?? '', - capabilities: json['capabilities'] as Map? ?? null, + capabilities: json['capabilities'] == null + ? null + : DeviceCapabilitiesModel.fromJson( + json['capabilities'] as Map, + ), createdAt: json['createdAt'] == null ? '' : _toString(json['createdAt']), updatedAt: json['updatedAt'] == null ? null diff --git a/packages/sf_shared/lib/src/data/models/device_settings_model.dart b/packages/sf_shared/lib/src/data/models/device_settings_model.dart new file mode 100644 index 00000000..cbda94b5 --- /dev/null +++ b/packages/sf_shared/lib/src/data/models/device_settings_model.dart @@ -0,0 +1,68 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:sf_shared/src/domain/entities/device_settings_entity.dart'; + +part 'device_settings_model.freezed.dart'; +part 'device_settings_model.g.dart'; + +@freezed +abstract class DeviceSettingsModel with _$DeviceSettingsModel { + const factory DeviceSettingsModel({ + @Default(60) int frequency, + @Default(120) int frequencyHeartRate, + @Default(0) int timezone, + @Default(false) bool pedometer, + @Default('es') String language, + @Default([]) List alerts, + @Default(DeviceVolumeModel()) DeviceVolumeModel volume, + String? soundMode, + }) = _DeviceSettingsModel; + + factory DeviceSettingsModel.fromJson(Map json) => + _$DeviceSettingsModelFromJson(json); +} + +@freezed +abstract class DeviceVolumeModel with _$DeviceVolumeModel { + const factory DeviceVolumeModel({ + @Default(50) int media, + @Default(50) int ringtone, + @Default(50) int alarm, + }) = _DeviceVolumeModel; + + factory DeviceVolumeModel.fromJson(Map json) => + _$DeviceVolumeModelFromJson(json); +} + +extension DeviceSettingsModelMapper on DeviceSettingsModel { + DeviceSettingsEntity toEntity() => DeviceSettingsEntity( + frequency: frequency, + frequencyHeartRate: frequencyHeartRate, + timezone: timezone, + pedometer: pedometer, + language: language, + alerts: alerts, + volume: DeviceVolumeEntity( + media: volume.media, + ringtone: volume.ringtone, + alarm: volume.alarm, + ), + soundMode: soundMode, + ); +} + +extension DeviceSettingsEntityMapper on DeviceSettingsEntity { + Map toMap() => { + 'frequency': frequency, + 'frequencyHeartRate': frequencyHeartRate, + 'timezone': timezone, + 'pedometer': pedometer, + 'language': language, + 'alerts': alerts, + 'volume': { + 'media': volume.media, + 'ringtone': volume.ringtone, + 'alarm': volume.alarm, + }, + 'soundMode': soundMode ?? 'VIBRATION', + }; +} diff --git a/packages/sf_shared/lib/src/data/models/device_settings_model.freezed.dart b/packages/sf_shared/lib/src/data/models/device_settings_model.freezed.dart new file mode 100644 index 00000000..9682acf0 --- /dev/null +++ b/packages/sf_shared/lib/src/data/models/device_settings_model.freezed.dart @@ -0,0 +1,591 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'device_settings_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; + +/// @nodoc +mixin _$DeviceSettingsModel { + + int get frequency; int get frequencyHeartRate; int get timezone; bool get pedometer; String get language; List get alerts; DeviceVolumeModel get volume; String? get soundMode; +/// Create a copy of DeviceSettingsModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceSettingsModelCopyWith get copyWith => _$DeviceSettingsModelCopyWithImpl(this as DeviceSettingsModel, _$identity); + + /// Serializes this DeviceSettingsModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceSettingsModel&&(identical(other.frequency, frequency) || other.frequency == frequency)&&(identical(other.frequencyHeartRate, frequencyHeartRate) || other.frequencyHeartRate == frequencyHeartRate)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.pedometer, pedometer) || other.pedometer == pedometer)&&(identical(other.language, language) || other.language == language)&&const DeepCollectionEquality().equals(other.alerts, alerts)&&(identical(other.volume, volume) || other.volume == volume)&&(identical(other.soundMode, soundMode) || other.soundMode == soundMode)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,frequency,frequencyHeartRate,timezone,pedometer,language,const DeepCollectionEquality().hash(alerts),volume,soundMode); + +@override +String toString() { + return 'DeviceSettingsModel(frequency: $frequency, frequencyHeartRate: $frequencyHeartRate, timezone: $timezone, pedometer: $pedometer, language: $language, alerts: $alerts, volume: $volume, soundMode: $soundMode)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceSettingsModelCopyWith<$Res> { + factory $DeviceSettingsModelCopyWith(DeviceSettingsModel value, $Res Function(DeviceSettingsModel) _then) = _$DeviceSettingsModelCopyWithImpl; +@useResult +$Res call({ + int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts, DeviceVolumeModel volume, String? soundMode +}); + + +$DeviceVolumeModelCopyWith<$Res> get volume; + +} +/// @nodoc +class _$DeviceSettingsModelCopyWithImpl<$Res> + implements $DeviceSettingsModelCopyWith<$Res> { + _$DeviceSettingsModelCopyWithImpl(this._self, this._then); + + final DeviceSettingsModel _self; + final $Res Function(DeviceSettingsModel) _then; + +/// Create a copy of DeviceSettingsModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? frequency = null,Object? frequencyHeartRate = null,Object? timezone = null,Object? pedometer = null,Object? language = null,Object? alerts = null,Object? volume = null,Object? soundMode = freezed,}) { + return _then(_self.copyWith( +frequency: null == frequency ? _self.frequency : frequency // ignore: cast_nullable_to_non_nullable +as int,frequencyHeartRate: null == frequencyHeartRate ? _self.frequencyHeartRate : frequencyHeartRate // ignore: cast_nullable_to_non_nullable +as int,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as int,pedometer: null == pedometer ? _self.pedometer : pedometer // ignore: cast_nullable_to_non_nullable +as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,alerts: null == alerts ? _self.alerts : alerts // ignore: cast_nullable_to_non_nullable +as List,volume: null == volume ? _self.volume : volume // ignore: cast_nullable_to_non_nullable +as DeviceVolumeModel,soundMode: freezed == soundMode ? _self.soundMode : soundMode // ignore: cast_nullable_to_non_nullable +as String?, + )); +} +/// Create a copy of DeviceSettingsModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceVolumeModelCopyWith<$Res> get volume { + + return $DeviceVolumeModelCopyWith<$Res>(_self.volume, (value) { + return _then(_self.copyWith(volume: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [DeviceSettingsModel]. +extension DeviceSettingsModelPatterns on DeviceSettingsModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceSettingsModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceSettingsModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceSettingsModel value) $default,){ +final _that = this; +switch (_that) { +case _DeviceSettingsModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceSettingsModel value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceSettingsModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts, DeviceVolumeModel volume, String? soundMode)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceSettingsModel() when $default != null: +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts,_that.volume,_that.soundMode);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts, DeviceVolumeModel volume, String? soundMode) $default,) {final _that = this; +switch (_that) { +case _DeviceSettingsModel(): +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts,_that.volume,_that.soundMode);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts, DeviceVolumeModel volume, String? soundMode)? $default,) {final _that = this; +switch (_that) { +case _DeviceSettingsModel() when $default != null: +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts,_that.volume,_that.soundMode);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _DeviceSettingsModel implements DeviceSettingsModel { + const _DeviceSettingsModel({this.frequency = 60, this.frequencyHeartRate = 120, this.timezone = 0, this.pedometer = false, this.language = 'es', final List alerts = const [], this.volume = const DeviceVolumeModel(), this.soundMode}): _alerts = alerts; + factory _DeviceSettingsModel.fromJson(Map json) => _$DeviceSettingsModelFromJson(json); + +@override@JsonKey() final int frequency; +@override@JsonKey() final int frequencyHeartRate; +@override@JsonKey() final int timezone; +@override@JsonKey() final bool pedometer; +@override@JsonKey() final String language; + final List _alerts; +@override@JsonKey() List get alerts { + if (_alerts is EqualUnmodifiableListView) return _alerts; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_alerts); +} + +@override@JsonKey() final DeviceVolumeModel volume; +@override final String? soundMode; + +/// Create a copy of DeviceSettingsModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceSettingsModelCopyWith<_DeviceSettingsModel> get copyWith => __$DeviceSettingsModelCopyWithImpl<_DeviceSettingsModel>(this, _$identity); + +@override +Map toJson() { + return _$DeviceSettingsModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceSettingsModel&&(identical(other.frequency, frequency) || other.frequency == frequency)&&(identical(other.frequencyHeartRate, frequencyHeartRate) || other.frequencyHeartRate == frequencyHeartRate)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.pedometer, pedometer) || other.pedometer == pedometer)&&(identical(other.language, language) || other.language == language)&&const DeepCollectionEquality().equals(other._alerts, _alerts)&&(identical(other.volume, volume) || other.volume == volume)&&(identical(other.soundMode, soundMode) || other.soundMode == soundMode)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,frequency,frequencyHeartRate,timezone,pedometer,language,const DeepCollectionEquality().hash(_alerts),volume,soundMode); + +@override +String toString() { + return 'DeviceSettingsModel(frequency: $frequency, frequencyHeartRate: $frequencyHeartRate, timezone: $timezone, pedometer: $pedometer, language: $language, alerts: $alerts, volume: $volume, soundMode: $soundMode)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceSettingsModelCopyWith<$Res> implements $DeviceSettingsModelCopyWith<$Res> { + factory _$DeviceSettingsModelCopyWith(_DeviceSettingsModel value, $Res Function(_DeviceSettingsModel) _then) = __$DeviceSettingsModelCopyWithImpl; +@override @useResult +$Res call({ + int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts, DeviceVolumeModel volume, String? soundMode +}); + + +@override $DeviceVolumeModelCopyWith<$Res> get volume; + +} +/// @nodoc +class __$DeviceSettingsModelCopyWithImpl<$Res> + implements _$DeviceSettingsModelCopyWith<$Res> { + __$DeviceSettingsModelCopyWithImpl(this._self, this._then); + + final _DeviceSettingsModel _self; + final $Res Function(_DeviceSettingsModel) _then; + +/// Create a copy of DeviceSettingsModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? frequency = null,Object? frequencyHeartRate = null,Object? timezone = null,Object? pedometer = null,Object? language = null,Object? alerts = null,Object? volume = null,Object? soundMode = freezed,}) { + return _then(_DeviceSettingsModel( +frequency: null == frequency ? _self.frequency : frequency // ignore: cast_nullable_to_non_nullable +as int,frequencyHeartRate: null == frequencyHeartRate ? _self.frequencyHeartRate : frequencyHeartRate // ignore: cast_nullable_to_non_nullable +as int,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as int,pedometer: null == pedometer ? _self.pedometer : pedometer // ignore: cast_nullable_to_non_nullable +as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,alerts: null == alerts ? _self._alerts : alerts // ignore: cast_nullable_to_non_nullable +as List,volume: null == volume ? _self.volume : volume // ignore: cast_nullable_to_non_nullable +as DeviceVolumeModel,soundMode: freezed == soundMode ? _self.soundMode : soundMode // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + +/// Create a copy of DeviceSettingsModel +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceVolumeModelCopyWith<$Res> get volume { + + return $DeviceVolumeModelCopyWith<$Res>(_self.volume, (value) { + return _then(_self.copyWith(volume: value)); + }); +} +} + + +/// @nodoc +mixin _$DeviceVolumeModel { + + int get media; int get ringtone; int get alarm; +/// Create a copy of DeviceVolumeModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceVolumeModelCopyWith get copyWith => _$DeviceVolumeModelCopyWithImpl(this as DeviceVolumeModel, _$identity); + + /// Serializes this DeviceVolumeModel to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceVolumeModel&&(identical(other.media, media) || other.media == media)&&(identical(other.ringtone, ringtone) || other.ringtone == ringtone)&&(identical(other.alarm, alarm) || other.alarm == alarm)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,media,ringtone,alarm); + +@override +String toString() { + return 'DeviceVolumeModel(media: $media, ringtone: $ringtone, alarm: $alarm)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceVolumeModelCopyWith<$Res> { + factory $DeviceVolumeModelCopyWith(DeviceVolumeModel value, $Res Function(DeviceVolumeModel) _then) = _$DeviceVolumeModelCopyWithImpl; +@useResult +$Res call({ + int media, int ringtone, int alarm +}); + + + + +} +/// @nodoc +class _$DeviceVolumeModelCopyWithImpl<$Res> + implements $DeviceVolumeModelCopyWith<$Res> { + _$DeviceVolumeModelCopyWithImpl(this._self, this._then); + + final DeviceVolumeModel _self; + final $Res Function(DeviceVolumeModel) _then; + +/// Create a copy of DeviceVolumeModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? media = null,Object? ringtone = null,Object? alarm = null,}) { + return _then(_self.copyWith( +media: null == media ? _self.media : media // ignore: cast_nullable_to_non_nullable +as int,ringtone: null == ringtone ? _self.ringtone : ringtone // ignore: cast_nullable_to_non_nullable +as int,alarm: null == alarm ? _self.alarm : alarm // ignore: cast_nullable_to_non_nullable +as int, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceVolumeModel]. +extension DeviceVolumeModelPatterns on DeviceVolumeModel { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceVolumeModel value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceVolumeModel() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceVolumeModel value) $default,){ +final _that = this; +switch (_that) { +case _DeviceVolumeModel(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceVolumeModel value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceVolumeModel() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( int media, int ringtone, int alarm)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceVolumeModel() when $default != null: +return $default(_that.media,_that.ringtone,_that.alarm);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( int media, int ringtone, int alarm) $default,) {final _that = this; +switch (_that) { +case _DeviceVolumeModel(): +return $default(_that.media,_that.ringtone,_that.alarm);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( int media, int ringtone, int alarm)? $default,) {final _that = this; +switch (_that) { +case _DeviceVolumeModel() when $default != null: +return $default(_that.media,_that.ringtone,_that.alarm);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _DeviceVolumeModel implements DeviceVolumeModel { + const _DeviceVolumeModel({this.media = 50, this.ringtone = 50, this.alarm = 50}); + factory _DeviceVolumeModel.fromJson(Map json) => _$DeviceVolumeModelFromJson(json); + +@override@JsonKey() final int media; +@override@JsonKey() final int ringtone; +@override@JsonKey() final int alarm; + +/// Create a copy of DeviceVolumeModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceVolumeModelCopyWith<_DeviceVolumeModel> get copyWith => __$DeviceVolumeModelCopyWithImpl<_DeviceVolumeModel>(this, _$identity); + +@override +Map toJson() { + return _$DeviceVolumeModelToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceVolumeModel&&(identical(other.media, media) || other.media == media)&&(identical(other.ringtone, ringtone) || other.ringtone == ringtone)&&(identical(other.alarm, alarm) || other.alarm == alarm)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,media,ringtone,alarm); + +@override +String toString() { + return 'DeviceVolumeModel(media: $media, ringtone: $ringtone, alarm: $alarm)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceVolumeModelCopyWith<$Res> implements $DeviceVolumeModelCopyWith<$Res> { + factory _$DeviceVolumeModelCopyWith(_DeviceVolumeModel value, $Res Function(_DeviceVolumeModel) _then) = __$DeviceVolumeModelCopyWithImpl; +@override @useResult +$Res call({ + int media, int ringtone, int alarm +}); + + + + +} +/// @nodoc +class __$DeviceVolumeModelCopyWithImpl<$Res> + implements _$DeviceVolumeModelCopyWith<$Res> { + __$DeviceVolumeModelCopyWithImpl(this._self, this._then); + + final _DeviceVolumeModel _self; + final $Res Function(_DeviceVolumeModel) _then; + +/// Create a copy of DeviceVolumeModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? media = null,Object? ringtone = null,Object? alarm = null,}) { + return _then(_DeviceVolumeModel( +media: null == media ? _self.media : media // ignore: cast_nullable_to_non_nullable +as int,ringtone: null == ringtone ? _self.ringtone : ringtone // ignore: cast_nullable_to_non_nullable +as int,alarm: null == alarm ? _self.alarm : alarm // ignore: cast_nullable_to_non_nullable +as int, + )); +} + + +} + +// dart format on diff --git a/packages/sf_shared/lib/src/data/models/device_settings_model.g.dart b/packages/sf_shared/lib/src/data/models/device_settings_model.g.dart new file mode 100644 index 00000000..1bdfaf31 --- /dev/null +++ b/packages/sf_shared/lib/src/data/models/device_settings_model.g.dart @@ -0,0 +1,52 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'device_settings_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_DeviceSettingsModel _$DeviceSettingsModelFromJson(Map json) => + _DeviceSettingsModel( + frequency: (json['frequency'] as num?)?.toInt() ?? 60, + frequencyHeartRate: (json['frequencyHeartRate'] as num?)?.toInt() ?? 120, + timezone: (json['timezone'] as num?)?.toInt() ?? 0, + pedometer: json['pedometer'] as bool? ?? false, + language: json['language'] as String? ?? 'es', + alerts: + (json['alerts'] as List?) + ?.map((e) => e as String) + .toList() ?? + const [], + volume: json['volume'] == null + ? const DeviceVolumeModel() + : DeviceVolumeModel.fromJson(json['volume'] as Map), + soundMode: json['soundMode'] as String?, + ); + +Map _$DeviceSettingsModelToJson( + _DeviceSettingsModel instance, +) => { + 'frequency': instance.frequency, + 'frequencyHeartRate': instance.frequencyHeartRate, + 'timezone': instance.timezone, + 'pedometer': instance.pedometer, + 'language': instance.language, + 'alerts': instance.alerts, + 'volume': instance.volume, + 'soundMode': instance.soundMode, +}; + +_DeviceVolumeModel _$DeviceVolumeModelFromJson(Map json) => + _DeviceVolumeModel( + media: (json['media'] as num?)?.toInt() ?? 50, + ringtone: (json['ringtone'] as num?)?.toInt() ?? 50, + alarm: (json['alarm'] as num?)?.toInt() ?? 50, + ); + +Map _$DeviceVolumeModelToJson(_DeviceVolumeModel instance) => + { + 'media': instance.media, + 'ringtone': instance.ringtone, + 'alarm': instance.alarm, + }; diff --git a/packages/sf_shared/lib/src/domain/entities/device_capabilities_entity.dart b/packages/sf_shared/lib/src/domain/entities/device_capabilities_entity.dart new file mode 100644 index 00000000..03688c2a --- /dev/null +++ b/packages/sf_shared/lib/src/domain/entities/device_capabilities_entity.dart @@ -0,0 +1,93 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'device_capabilities_entity.freezed.dart'; + +@freezed +abstract class DeviceCapabilitiesEntity with _$DeviceCapabilitiesEntity { + const factory DeviceCapabilitiesEntity({ + DeviceCapabilityOptionEntity? heartbeats, + DeviceCapabilityEnabledEntity? bloodPressure, + DeviceCapabilityAlertsEntity? alerts, + DeviceCapabilityEnabledEntity? podometer, + DeviceCapabilityContactsEntity? contacts, + DeviceCapabilitySettingsEntity? settings, + DeviceCapabilityCommandsEntity? commands, + DeviceCapabilityTakepillsEntity? takepills, + DeviceCapabilityOptionEntity? location, + DeviceCapabilityCameraEntity? camera, + }) = _DeviceCapabilitiesEntity; +} + +@freezed +abstract class DeviceCapabilityEnabledEntity with _$DeviceCapabilityEnabledEntity { + const factory DeviceCapabilityEnabledEntity({ + @Default(false) bool enabled, + }) = _DeviceCapabilityEnabledEntity; +} + +@freezed +abstract class DeviceCapabilityOptionEntity with _$DeviceCapabilityOptionEntity { + const factory DeviceCapabilityOptionEntity({ + @Default(0) int defaultValue, + @Default(false) bool enabled, + @Default([]) List options, + }) = _DeviceCapabilityOptionEntity; +} + +@freezed +abstract class DeviceCapabilityAlertsEntity with _$DeviceCapabilityAlertsEntity { + const factory DeviceCapabilityAlertsEntity({ + @Default(false) bool enabled, + @Default([]) List types, + }) = _DeviceCapabilityAlertsEntity; +} + +@freezed +abstract class DeviceCapabilityContactsEntity with _$DeviceCapabilityContactsEntity { + const factory DeviceCapabilityContactsEntity({ + @Default(false) bool enabled, + @Default([]) List types, + @Default(false) bool isPhonebookWithPhoto, + }) = _DeviceCapabilityContactsEntity; +} + +@freezed +abstract class DeviceCapabilityContactTypeEntity with _$DeviceCapabilityContactTypeEntity { + const factory DeviceCapabilityContactTypeEntity({ + @Default('') String type, + @Default(0) int amount, + }) = _DeviceCapabilityContactTypeEntity; +} + +@freezed +abstract class DeviceCapabilitySettingsEntity with _$DeviceCapabilitySettingsEntity { + const factory DeviceCapabilitySettingsEntity({ + @Default(false) bool language, + @Default(false) bool timezone, + @Default([]) List soundModes, + }) = _DeviceCapabilitySettingsEntity; +} + +@freezed +abstract class DeviceCapabilityCommandsEntity with _$DeviceCapabilityCommandsEntity { + const factory DeviceCapabilityCommandsEntity({ + @Default(false) bool enabled, + @Default([]) List types, + }) = _DeviceCapabilityCommandsEntity; +} + +@freezed +abstract class DeviceCapabilityTakepillsEntity with _$DeviceCapabilityTakepillsEntity { + const factory DeviceCapabilityTakepillsEntity({ + @Default(false) bool enabled, + @Default(0) int maxReminders, + }) = _DeviceCapabilityTakepillsEntity; +} + +@freezed +abstract class DeviceCapabilityCameraEntity with _$DeviceCapabilityCameraEntity { + const factory DeviceCapabilityCameraEntity({ + @Default('') String format, + @Default(false) bool enabled, + }) = _DeviceCapabilityCameraEntity; +} diff --git a/packages/sf_shared/lib/src/domain/entities/device_capabilities_entity.freezed.dart b/packages/sf_shared/lib/src/domain/entities/device_capabilities_entity.freezed.dart new file mode 100644 index 00000000..d452f79b --- /dev/null +++ b/packages/sf_shared/lib/src/domain/entities/device_capabilities_entity.freezed.dart @@ -0,0 +1,2914 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'device_capabilities_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$DeviceCapabilitiesEntity { + + DeviceCapabilityOptionEntity? get heartbeats; DeviceCapabilityEnabledEntity? get bloodPressure; DeviceCapabilityAlertsEntity? get alerts; DeviceCapabilityEnabledEntity? get podometer; DeviceCapabilityContactsEntity? get contacts; DeviceCapabilitySettingsEntity? get settings; DeviceCapabilityCommandsEntity? get commands; DeviceCapabilityTakepillsEntity? get takepills; DeviceCapabilityOptionEntity? get location; DeviceCapabilityCameraEntity? get camera; +/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilitiesEntityCopyWith get copyWith => _$DeviceCapabilitiesEntityCopyWithImpl(this as DeviceCapabilitiesEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilitiesEntity&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.bloodPressure, bloodPressure) || other.bloodPressure == bloodPressure)&&(identical(other.alerts, alerts) || other.alerts == alerts)&&(identical(other.podometer, podometer) || other.podometer == podometer)&&(identical(other.contacts, contacts) || other.contacts == contacts)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.commands, commands) || other.commands == commands)&&(identical(other.takepills, takepills) || other.takepills == takepills)&&(identical(other.location, location) || other.location == location)&&(identical(other.camera, camera) || other.camera == camera)); +} + + +@override +int get hashCode => Object.hash(runtimeType,heartbeats,bloodPressure,alerts,podometer,contacts,settings,commands,takepills,location,camera); + +@override +String toString() { + return 'DeviceCapabilitiesEntity(heartbeats: $heartbeats, bloodPressure: $bloodPressure, alerts: $alerts, podometer: $podometer, contacts: $contacts, settings: $settings, commands: $commands, takepills: $takepills, location: $location, camera: $camera)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilitiesEntityCopyWith<$Res> { + factory $DeviceCapabilitiesEntityCopyWith(DeviceCapabilitiesEntity value, $Res Function(DeviceCapabilitiesEntity) _then) = _$DeviceCapabilitiesEntityCopyWithImpl; +@useResult +$Res call({ + DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera +}); + + +$DeviceCapabilityOptionEntityCopyWith<$Res>? get heartbeats;$DeviceCapabilityEnabledEntityCopyWith<$Res>? get bloodPressure;$DeviceCapabilityAlertsEntityCopyWith<$Res>? get alerts;$DeviceCapabilityEnabledEntityCopyWith<$Res>? get podometer;$DeviceCapabilityContactsEntityCopyWith<$Res>? get contacts;$DeviceCapabilitySettingsEntityCopyWith<$Res>? get settings;$DeviceCapabilityCommandsEntityCopyWith<$Res>? get commands;$DeviceCapabilityTakepillsEntityCopyWith<$Res>? get takepills;$DeviceCapabilityOptionEntityCopyWith<$Res>? get location;$DeviceCapabilityCameraEntityCopyWith<$Res>? get camera; + +} +/// @nodoc +class _$DeviceCapabilitiesEntityCopyWithImpl<$Res> + implements $DeviceCapabilitiesEntityCopyWith<$Res> { + _$DeviceCapabilitiesEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilitiesEntity _self; + final $Res Function(DeviceCapabilitiesEntity) _then; + +/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? heartbeats = freezed,Object? bloodPressure = freezed,Object? alerts = freezed,Object? podometer = freezed,Object? contacts = freezed,Object? settings = freezed,Object? commands = freezed,Object? takepills = freezed,Object? location = freezed,Object? camera = freezed,}) { + return _then(_self.copyWith( +heartbeats: freezed == heartbeats ? _self.heartbeats : heartbeats // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityOptionEntity?,bloodPressure: freezed == bloodPressure ? _self.bloodPressure : bloodPressure // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityEnabledEntity?,alerts: freezed == alerts ? _self.alerts : alerts // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityAlertsEntity?,podometer: freezed == podometer ? _self.podometer : podometer // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityEnabledEntity?,contacts: freezed == contacts ? _self.contacts : contacts // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityContactsEntity?,settings: freezed == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitySettingsEntity?,commands: freezed == commands ? _self.commands : commands // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityCommandsEntity?,takepills: freezed == takepills ? _self.takepills : takepills // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityTakepillsEntity?,location: freezed == location ? _self.location : location // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityOptionEntity?,camera: freezed == camera ? _self.camera : camera // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityCameraEntity?, + )); +} +/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityOptionEntityCopyWith<$Res>? get heartbeats { + if (_self.heartbeats == null) { + return null; + } + + return $DeviceCapabilityOptionEntityCopyWith<$Res>(_self.heartbeats!, (value) { + return _then(_self.copyWith(heartbeats: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityEnabledEntityCopyWith<$Res>? get bloodPressure { + if (_self.bloodPressure == null) { + return null; + } + + return $DeviceCapabilityEnabledEntityCopyWith<$Res>(_self.bloodPressure!, (value) { + return _then(_self.copyWith(bloodPressure: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityAlertsEntityCopyWith<$Res>? get alerts { + if (_self.alerts == null) { + return null; + } + + return $DeviceCapabilityAlertsEntityCopyWith<$Res>(_self.alerts!, (value) { + return _then(_self.copyWith(alerts: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityEnabledEntityCopyWith<$Res>? get podometer { + if (_self.podometer == null) { + return null; + } + + return $DeviceCapabilityEnabledEntityCopyWith<$Res>(_self.podometer!, (value) { + return _then(_self.copyWith(podometer: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityContactsEntityCopyWith<$Res>? get contacts { + if (_self.contacts == null) { + return null; + } + + return $DeviceCapabilityContactsEntityCopyWith<$Res>(_self.contacts!, (value) { + return _then(_self.copyWith(contacts: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitySettingsEntityCopyWith<$Res>? get settings { + if (_self.settings == null) { + return null; + } + + return $DeviceCapabilitySettingsEntityCopyWith<$Res>(_self.settings!, (value) { + return _then(_self.copyWith(settings: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityCommandsEntityCopyWith<$Res>? get commands { + if (_self.commands == null) { + return null; + } + + return $DeviceCapabilityCommandsEntityCopyWith<$Res>(_self.commands!, (value) { + return _then(_self.copyWith(commands: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityTakepillsEntityCopyWith<$Res>? get takepills { + if (_self.takepills == null) { + return null; + } + + return $DeviceCapabilityTakepillsEntityCopyWith<$Res>(_self.takepills!, (value) { + return _then(_self.copyWith(takepills: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityOptionEntityCopyWith<$Res>? get location { + if (_self.location == null) { + return null; + } + + return $DeviceCapabilityOptionEntityCopyWith<$Res>(_self.location!, (value) { + return _then(_self.copyWith(location: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityCameraEntityCopyWith<$Res>? get camera { + if (_self.camera == null) { + return null; + } + + return $DeviceCapabilityCameraEntityCopyWith<$Res>(_self.camera!, (value) { + return _then(_self.copyWith(camera: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilitiesEntity]. +extension DeviceCapabilitiesEntityPatterns on DeviceCapabilitiesEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilitiesEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilitiesEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilitiesEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitiesEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesEntity() when $default != null: +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesEntity(): +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitiesEntity() when $default != null: +return $default(_that.heartbeats,_that.bloodPressure,_that.alerts,_that.podometer,_that.contacts,_that.settings,_that.commands,_that.takepills,_that.location,_that.camera);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilitiesEntity implements DeviceCapabilitiesEntity { + const _DeviceCapabilitiesEntity({this.heartbeats, this.bloodPressure, this.alerts, this.podometer, this.contacts, this.settings, this.commands, this.takepills, this.location, this.camera}); + + +@override final DeviceCapabilityOptionEntity? heartbeats; +@override final DeviceCapabilityEnabledEntity? bloodPressure; +@override final DeviceCapabilityAlertsEntity? alerts; +@override final DeviceCapabilityEnabledEntity? podometer; +@override final DeviceCapabilityContactsEntity? contacts; +@override final DeviceCapabilitySettingsEntity? settings; +@override final DeviceCapabilityCommandsEntity? commands; +@override final DeviceCapabilityTakepillsEntity? takepills; +@override final DeviceCapabilityOptionEntity? location; +@override final DeviceCapabilityCameraEntity? camera; + +/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilitiesEntityCopyWith<_DeviceCapabilitiesEntity> get copyWith => __$DeviceCapabilitiesEntityCopyWithImpl<_DeviceCapabilitiesEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilitiesEntity&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.bloodPressure, bloodPressure) || other.bloodPressure == bloodPressure)&&(identical(other.alerts, alerts) || other.alerts == alerts)&&(identical(other.podometer, podometer) || other.podometer == podometer)&&(identical(other.contacts, contacts) || other.contacts == contacts)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.commands, commands) || other.commands == commands)&&(identical(other.takepills, takepills) || other.takepills == takepills)&&(identical(other.location, location) || other.location == location)&&(identical(other.camera, camera) || other.camera == camera)); +} + + +@override +int get hashCode => Object.hash(runtimeType,heartbeats,bloodPressure,alerts,podometer,contacts,settings,commands,takepills,location,camera); + +@override +String toString() { + return 'DeviceCapabilitiesEntity(heartbeats: $heartbeats, bloodPressure: $bloodPressure, alerts: $alerts, podometer: $podometer, contacts: $contacts, settings: $settings, commands: $commands, takepills: $takepills, location: $location, camera: $camera)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilitiesEntityCopyWith<$Res> implements $DeviceCapabilitiesEntityCopyWith<$Res> { + factory _$DeviceCapabilitiesEntityCopyWith(_DeviceCapabilitiesEntity value, $Res Function(_DeviceCapabilitiesEntity) _then) = __$DeviceCapabilitiesEntityCopyWithImpl; +@override @useResult +$Res call({ + DeviceCapabilityOptionEntity? heartbeats, DeviceCapabilityEnabledEntity? bloodPressure, DeviceCapabilityAlertsEntity? alerts, DeviceCapabilityEnabledEntity? podometer, DeviceCapabilityContactsEntity? contacts, DeviceCapabilitySettingsEntity? settings, DeviceCapabilityCommandsEntity? commands, DeviceCapabilityTakepillsEntity? takepills, DeviceCapabilityOptionEntity? location, DeviceCapabilityCameraEntity? camera +}); + + +@override $DeviceCapabilityOptionEntityCopyWith<$Res>? get heartbeats;@override $DeviceCapabilityEnabledEntityCopyWith<$Res>? get bloodPressure;@override $DeviceCapabilityAlertsEntityCopyWith<$Res>? get alerts;@override $DeviceCapabilityEnabledEntityCopyWith<$Res>? get podometer;@override $DeviceCapabilityContactsEntityCopyWith<$Res>? get contacts;@override $DeviceCapabilitySettingsEntityCopyWith<$Res>? get settings;@override $DeviceCapabilityCommandsEntityCopyWith<$Res>? get commands;@override $DeviceCapabilityTakepillsEntityCopyWith<$Res>? get takepills;@override $DeviceCapabilityOptionEntityCopyWith<$Res>? get location;@override $DeviceCapabilityCameraEntityCopyWith<$Res>? get camera; + +} +/// @nodoc +class __$DeviceCapabilitiesEntityCopyWithImpl<$Res> + implements _$DeviceCapabilitiesEntityCopyWith<$Res> { + __$DeviceCapabilitiesEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilitiesEntity _self; + final $Res Function(_DeviceCapabilitiesEntity) _then; + +/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? heartbeats = freezed,Object? bloodPressure = freezed,Object? alerts = freezed,Object? podometer = freezed,Object? contacts = freezed,Object? settings = freezed,Object? commands = freezed,Object? takepills = freezed,Object? location = freezed,Object? camera = freezed,}) { + return _then(_DeviceCapabilitiesEntity( +heartbeats: freezed == heartbeats ? _self.heartbeats : heartbeats // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityOptionEntity?,bloodPressure: freezed == bloodPressure ? _self.bloodPressure : bloodPressure // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityEnabledEntity?,alerts: freezed == alerts ? _self.alerts : alerts // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityAlertsEntity?,podometer: freezed == podometer ? _self.podometer : podometer // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityEnabledEntity?,contacts: freezed == contacts ? _self.contacts : contacts // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityContactsEntity?,settings: freezed == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitySettingsEntity?,commands: freezed == commands ? _self.commands : commands // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityCommandsEntity?,takepills: freezed == takepills ? _self.takepills : takepills // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityTakepillsEntity?,location: freezed == location ? _self.location : location // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityOptionEntity?,camera: freezed == camera ? _self.camera : camera // ignore: cast_nullable_to_non_nullable +as DeviceCapabilityCameraEntity?, + )); +} + +/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityOptionEntityCopyWith<$Res>? get heartbeats { + if (_self.heartbeats == null) { + return null; + } + + return $DeviceCapabilityOptionEntityCopyWith<$Res>(_self.heartbeats!, (value) { + return _then(_self.copyWith(heartbeats: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityEnabledEntityCopyWith<$Res>? get bloodPressure { + if (_self.bloodPressure == null) { + return null; + } + + return $DeviceCapabilityEnabledEntityCopyWith<$Res>(_self.bloodPressure!, (value) { + return _then(_self.copyWith(bloodPressure: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityAlertsEntityCopyWith<$Res>? get alerts { + if (_self.alerts == null) { + return null; + } + + return $DeviceCapabilityAlertsEntityCopyWith<$Res>(_self.alerts!, (value) { + return _then(_self.copyWith(alerts: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityEnabledEntityCopyWith<$Res>? get podometer { + if (_self.podometer == null) { + return null; + } + + return $DeviceCapabilityEnabledEntityCopyWith<$Res>(_self.podometer!, (value) { + return _then(_self.copyWith(podometer: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityContactsEntityCopyWith<$Res>? get contacts { + if (_self.contacts == null) { + return null; + } + + return $DeviceCapabilityContactsEntityCopyWith<$Res>(_self.contacts!, (value) { + return _then(_self.copyWith(contacts: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitySettingsEntityCopyWith<$Res>? get settings { + if (_self.settings == null) { + return null; + } + + return $DeviceCapabilitySettingsEntityCopyWith<$Res>(_self.settings!, (value) { + return _then(_self.copyWith(settings: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityCommandsEntityCopyWith<$Res>? get commands { + if (_self.commands == null) { + return null; + } + + return $DeviceCapabilityCommandsEntityCopyWith<$Res>(_self.commands!, (value) { + return _then(_self.copyWith(commands: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityTakepillsEntityCopyWith<$Res>? get takepills { + if (_self.takepills == null) { + return null; + } + + return $DeviceCapabilityTakepillsEntityCopyWith<$Res>(_self.takepills!, (value) { + return _then(_self.copyWith(takepills: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityOptionEntityCopyWith<$Res>? get location { + if (_self.location == null) { + return null; + } + + return $DeviceCapabilityOptionEntityCopyWith<$Res>(_self.location!, (value) { + return _then(_self.copyWith(location: value)); + }); +}/// Create a copy of DeviceCapabilitiesEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilityCameraEntityCopyWith<$Res>? get camera { + if (_self.camera == null) { + return null; + } + + return $DeviceCapabilityCameraEntityCopyWith<$Res>(_self.camera!, (value) { + return _then(_self.copyWith(camera: value)); + }); +} +} + +/// @nodoc +mixin _$DeviceCapabilityEnabledEntity { + + bool get enabled; +/// Create a copy of DeviceCapabilityEnabledEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityEnabledEntityCopyWith get copyWith => _$DeviceCapabilityEnabledEntityCopyWithImpl(this as DeviceCapabilityEnabledEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityEnabledEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled); + +@override +String toString() { + return 'DeviceCapabilityEnabledEntity(enabled: $enabled)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityEnabledEntityCopyWith<$Res> { + factory $DeviceCapabilityEnabledEntityCopyWith(DeviceCapabilityEnabledEntity value, $Res Function(DeviceCapabilityEnabledEntity) _then) = _$DeviceCapabilityEnabledEntityCopyWithImpl; +@useResult +$Res call({ + bool enabled +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityEnabledEntityCopyWithImpl<$Res> + implements $DeviceCapabilityEnabledEntityCopyWith<$Res> { + _$DeviceCapabilityEnabledEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilityEnabledEntity _self; + final $Res Function(DeviceCapabilityEnabledEntity) _then; + +/// Create a copy of DeviceCapabilityEnabledEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? enabled = null,}) { + return _then(_self.copyWith( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityEnabledEntity]. +extension DeviceCapabilityEnabledEntityPatterns on DeviceCapabilityEnabledEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityEnabledEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityEnabledEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityEnabledEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityEnabledEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityEnabledEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityEnabledEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( bool enabled)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityEnabledEntity() when $default != null: +return $default(_that.enabled);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( bool enabled) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityEnabledEntity(): +return $default(_that.enabled);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool enabled)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityEnabledEntity() when $default != null: +return $default(_that.enabled);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilityEnabledEntity implements DeviceCapabilityEnabledEntity { + const _DeviceCapabilityEnabledEntity({this.enabled = false}); + + +@override@JsonKey() final bool enabled; + +/// Create a copy of DeviceCapabilityEnabledEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityEnabledEntityCopyWith<_DeviceCapabilityEnabledEntity> get copyWith => __$DeviceCapabilityEnabledEntityCopyWithImpl<_DeviceCapabilityEnabledEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityEnabledEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled); + +@override +String toString() { + return 'DeviceCapabilityEnabledEntity(enabled: $enabled)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityEnabledEntityCopyWith<$Res> implements $DeviceCapabilityEnabledEntityCopyWith<$Res> { + factory _$DeviceCapabilityEnabledEntityCopyWith(_DeviceCapabilityEnabledEntity value, $Res Function(_DeviceCapabilityEnabledEntity) _then) = __$DeviceCapabilityEnabledEntityCopyWithImpl; +@override @useResult +$Res call({ + bool enabled +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityEnabledEntityCopyWithImpl<$Res> + implements _$DeviceCapabilityEnabledEntityCopyWith<$Res> { + __$DeviceCapabilityEnabledEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityEnabledEntity _self; + final $Res Function(_DeviceCapabilityEnabledEntity) _then; + +/// Create a copy of DeviceCapabilityEnabledEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? enabled = null,}) { + return _then(_DeviceCapabilityEnabledEntity( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + +/// @nodoc +mixin _$DeviceCapabilityOptionEntity { + + int get defaultValue; bool get enabled; List get options; +/// Create a copy of DeviceCapabilityOptionEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityOptionEntityCopyWith get copyWith => _$DeviceCapabilityOptionEntityCopyWithImpl(this as DeviceCapabilityOptionEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityOptionEntity&&(identical(other.defaultValue, defaultValue) || other.defaultValue == defaultValue)&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other.options, options)); +} + + +@override +int get hashCode => Object.hash(runtimeType,defaultValue,enabled,const DeepCollectionEquality().hash(options)); + +@override +String toString() { + return 'DeviceCapabilityOptionEntity(defaultValue: $defaultValue, enabled: $enabled, options: $options)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityOptionEntityCopyWith<$Res> { + factory $DeviceCapabilityOptionEntityCopyWith(DeviceCapabilityOptionEntity value, $Res Function(DeviceCapabilityOptionEntity) _then) = _$DeviceCapabilityOptionEntityCopyWithImpl; +@useResult +$Res call({ + int defaultValue, bool enabled, List options +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityOptionEntityCopyWithImpl<$Res> + implements $DeviceCapabilityOptionEntityCopyWith<$Res> { + _$DeviceCapabilityOptionEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilityOptionEntity _self; + final $Res Function(DeviceCapabilityOptionEntity) _then; + +/// Create a copy of DeviceCapabilityOptionEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? defaultValue = null,Object? enabled = null,Object? options = null,}) { + return _then(_self.copyWith( +defaultValue: null == defaultValue ? _self.defaultValue : defaultValue // ignore: cast_nullable_to_non_nullable +as int,enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,options: null == options ? _self.options : options // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityOptionEntity]. +extension DeviceCapabilityOptionEntityPatterns on DeviceCapabilityOptionEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityOptionEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityOptionEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityOptionEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityOptionEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityOptionEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityOptionEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( int defaultValue, bool enabled, List options)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityOptionEntity() when $default != null: +return $default(_that.defaultValue,_that.enabled,_that.options);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( int defaultValue, bool enabled, List options) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityOptionEntity(): +return $default(_that.defaultValue,_that.enabled,_that.options);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( int defaultValue, bool enabled, List options)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityOptionEntity() when $default != null: +return $default(_that.defaultValue,_that.enabled,_that.options);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilityOptionEntity implements DeviceCapabilityOptionEntity { + const _DeviceCapabilityOptionEntity({this.defaultValue = 0, this.enabled = false, final List options = const []}): _options = options; + + +@override@JsonKey() final int defaultValue; +@override@JsonKey() final bool enabled; + final List _options; +@override@JsonKey() List get options { + if (_options is EqualUnmodifiableListView) return _options; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_options); +} + + +/// Create a copy of DeviceCapabilityOptionEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityOptionEntityCopyWith<_DeviceCapabilityOptionEntity> get copyWith => __$DeviceCapabilityOptionEntityCopyWithImpl<_DeviceCapabilityOptionEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityOptionEntity&&(identical(other.defaultValue, defaultValue) || other.defaultValue == defaultValue)&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other._options, _options)); +} + + +@override +int get hashCode => Object.hash(runtimeType,defaultValue,enabled,const DeepCollectionEquality().hash(_options)); + +@override +String toString() { + return 'DeviceCapabilityOptionEntity(defaultValue: $defaultValue, enabled: $enabled, options: $options)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityOptionEntityCopyWith<$Res> implements $DeviceCapabilityOptionEntityCopyWith<$Res> { + factory _$DeviceCapabilityOptionEntityCopyWith(_DeviceCapabilityOptionEntity value, $Res Function(_DeviceCapabilityOptionEntity) _then) = __$DeviceCapabilityOptionEntityCopyWithImpl; +@override @useResult +$Res call({ + int defaultValue, bool enabled, List options +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityOptionEntityCopyWithImpl<$Res> + implements _$DeviceCapabilityOptionEntityCopyWith<$Res> { + __$DeviceCapabilityOptionEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityOptionEntity _self; + final $Res Function(_DeviceCapabilityOptionEntity) _then; + +/// Create a copy of DeviceCapabilityOptionEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? defaultValue = null,Object? enabled = null,Object? options = null,}) { + return _then(_DeviceCapabilityOptionEntity( +defaultValue: null == defaultValue ? _self.defaultValue : defaultValue // ignore: cast_nullable_to_non_nullable +as int,enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,options: null == options ? _self._options : options // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + +/// @nodoc +mixin _$DeviceCapabilityAlertsEntity { + + bool get enabled; List get types; +/// Create a copy of DeviceCapabilityAlertsEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityAlertsEntityCopyWith get copyWith => _$DeviceCapabilityAlertsEntityCopyWithImpl(this as DeviceCapabilityAlertsEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityAlertsEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other.types, types)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(types)); + +@override +String toString() { + return 'DeviceCapabilityAlertsEntity(enabled: $enabled, types: $types)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityAlertsEntityCopyWith<$Res> { + factory $DeviceCapabilityAlertsEntityCopyWith(DeviceCapabilityAlertsEntity value, $Res Function(DeviceCapabilityAlertsEntity) _then) = _$DeviceCapabilityAlertsEntityCopyWithImpl; +@useResult +$Res call({ + bool enabled, List types +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityAlertsEntityCopyWithImpl<$Res> + implements $DeviceCapabilityAlertsEntityCopyWith<$Res> { + _$DeviceCapabilityAlertsEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilityAlertsEntity _self; + final $Res Function(DeviceCapabilityAlertsEntity) _then; + +/// Create a copy of DeviceCapabilityAlertsEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? enabled = null,Object? types = null,}) { + return _then(_self.copyWith( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self.types : types // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityAlertsEntity]. +extension DeviceCapabilityAlertsEntityPatterns on DeviceCapabilityAlertsEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityAlertsEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityAlertsEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityAlertsEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityAlertsEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityAlertsEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityAlertsEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( bool enabled, List types)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityAlertsEntity() when $default != null: +return $default(_that.enabled,_that.types);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( bool enabled, List types) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityAlertsEntity(): +return $default(_that.enabled,_that.types);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool enabled, List types)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityAlertsEntity() when $default != null: +return $default(_that.enabled,_that.types);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilityAlertsEntity implements DeviceCapabilityAlertsEntity { + const _DeviceCapabilityAlertsEntity({this.enabled = false, final List types = const []}): _types = types; + + +@override@JsonKey() final bool enabled; + final List _types; +@override@JsonKey() List get types { + if (_types is EqualUnmodifiableListView) return _types; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_types); +} + + +/// Create a copy of DeviceCapabilityAlertsEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityAlertsEntityCopyWith<_DeviceCapabilityAlertsEntity> get copyWith => __$DeviceCapabilityAlertsEntityCopyWithImpl<_DeviceCapabilityAlertsEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityAlertsEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other._types, _types)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(_types)); + +@override +String toString() { + return 'DeviceCapabilityAlertsEntity(enabled: $enabled, types: $types)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityAlertsEntityCopyWith<$Res> implements $DeviceCapabilityAlertsEntityCopyWith<$Res> { + factory _$DeviceCapabilityAlertsEntityCopyWith(_DeviceCapabilityAlertsEntity value, $Res Function(_DeviceCapabilityAlertsEntity) _then) = __$DeviceCapabilityAlertsEntityCopyWithImpl; +@override @useResult +$Res call({ + bool enabled, List types +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityAlertsEntityCopyWithImpl<$Res> + implements _$DeviceCapabilityAlertsEntityCopyWith<$Res> { + __$DeviceCapabilityAlertsEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityAlertsEntity _self; + final $Res Function(_DeviceCapabilityAlertsEntity) _then; + +/// Create a copy of DeviceCapabilityAlertsEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? enabled = null,Object? types = null,}) { + return _then(_DeviceCapabilityAlertsEntity( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self._types : types // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + +/// @nodoc +mixin _$DeviceCapabilityContactsEntity { + + bool get enabled; List get types; bool get isPhonebookWithPhoto; +/// Create a copy of DeviceCapabilityContactsEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityContactsEntityCopyWith get copyWith => _$DeviceCapabilityContactsEntityCopyWithImpl(this as DeviceCapabilityContactsEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityContactsEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other.types, types)&&(identical(other.isPhonebookWithPhoto, isPhonebookWithPhoto) || other.isPhonebookWithPhoto == isPhonebookWithPhoto)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(types),isPhonebookWithPhoto); + +@override +String toString() { + return 'DeviceCapabilityContactsEntity(enabled: $enabled, types: $types, isPhonebookWithPhoto: $isPhonebookWithPhoto)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityContactsEntityCopyWith<$Res> { + factory $DeviceCapabilityContactsEntityCopyWith(DeviceCapabilityContactsEntity value, $Res Function(DeviceCapabilityContactsEntity) _then) = _$DeviceCapabilityContactsEntityCopyWithImpl; +@useResult +$Res call({ + bool enabled, List types, bool isPhonebookWithPhoto +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityContactsEntityCopyWithImpl<$Res> + implements $DeviceCapabilityContactsEntityCopyWith<$Res> { + _$DeviceCapabilityContactsEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilityContactsEntity _self; + final $Res Function(DeviceCapabilityContactsEntity) _then; + +/// Create a copy of DeviceCapabilityContactsEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? enabled = null,Object? types = null,Object? isPhonebookWithPhoto = null,}) { + return _then(_self.copyWith( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self.types : types // ignore: cast_nullable_to_non_nullable +as List,isPhonebookWithPhoto: null == isPhonebookWithPhoto ? _self.isPhonebookWithPhoto : isPhonebookWithPhoto // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityContactsEntity]. +extension DeviceCapabilityContactsEntityPatterns on DeviceCapabilityContactsEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityContactsEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityContactsEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityContactsEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityContactsEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityContactsEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityContactsEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( bool enabled, List types, bool isPhonebookWithPhoto)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityContactsEntity() when $default != null: +return $default(_that.enabled,_that.types,_that.isPhonebookWithPhoto);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( bool enabled, List types, bool isPhonebookWithPhoto) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityContactsEntity(): +return $default(_that.enabled,_that.types,_that.isPhonebookWithPhoto);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool enabled, List types, bool isPhonebookWithPhoto)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityContactsEntity() when $default != null: +return $default(_that.enabled,_that.types,_that.isPhonebookWithPhoto);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilityContactsEntity implements DeviceCapabilityContactsEntity { + const _DeviceCapabilityContactsEntity({this.enabled = false, final List types = const [], this.isPhonebookWithPhoto = false}): _types = types; + + +@override@JsonKey() final bool enabled; + final List _types; +@override@JsonKey() List get types { + if (_types is EqualUnmodifiableListView) return _types; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_types); +} + +@override@JsonKey() final bool isPhonebookWithPhoto; + +/// Create a copy of DeviceCapabilityContactsEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityContactsEntityCopyWith<_DeviceCapabilityContactsEntity> get copyWith => __$DeviceCapabilityContactsEntityCopyWithImpl<_DeviceCapabilityContactsEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityContactsEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other._types, _types)&&(identical(other.isPhonebookWithPhoto, isPhonebookWithPhoto) || other.isPhonebookWithPhoto == isPhonebookWithPhoto)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(_types),isPhonebookWithPhoto); + +@override +String toString() { + return 'DeviceCapabilityContactsEntity(enabled: $enabled, types: $types, isPhonebookWithPhoto: $isPhonebookWithPhoto)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityContactsEntityCopyWith<$Res> implements $DeviceCapabilityContactsEntityCopyWith<$Res> { + factory _$DeviceCapabilityContactsEntityCopyWith(_DeviceCapabilityContactsEntity value, $Res Function(_DeviceCapabilityContactsEntity) _then) = __$DeviceCapabilityContactsEntityCopyWithImpl; +@override @useResult +$Res call({ + bool enabled, List types, bool isPhonebookWithPhoto +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityContactsEntityCopyWithImpl<$Res> + implements _$DeviceCapabilityContactsEntityCopyWith<$Res> { + __$DeviceCapabilityContactsEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityContactsEntity _self; + final $Res Function(_DeviceCapabilityContactsEntity) _then; + +/// Create a copy of DeviceCapabilityContactsEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? enabled = null,Object? types = null,Object? isPhonebookWithPhoto = null,}) { + return _then(_DeviceCapabilityContactsEntity( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self._types : types // ignore: cast_nullable_to_non_nullable +as List,isPhonebookWithPhoto: null == isPhonebookWithPhoto ? _self.isPhonebookWithPhoto : isPhonebookWithPhoto // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + +/// @nodoc +mixin _$DeviceCapabilityContactTypeEntity { + + String get type; int get amount; +/// Create a copy of DeviceCapabilityContactTypeEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityContactTypeEntityCopyWith get copyWith => _$DeviceCapabilityContactTypeEntityCopyWithImpl(this as DeviceCapabilityContactTypeEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityContactTypeEntity&&(identical(other.type, type) || other.type == type)&&(identical(other.amount, amount) || other.amount == amount)); +} + + +@override +int get hashCode => Object.hash(runtimeType,type,amount); + +@override +String toString() { + return 'DeviceCapabilityContactTypeEntity(type: $type, amount: $amount)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityContactTypeEntityCopyWith<$Res> { + factory $DeviceCapabilityContactTypeEntityCopyWith(DeviceCapabilityContactTypeEntity value, $Res Function(DeviceCapabilityContactTypeEntity) _then) = _$DeviceCapabilityContactTypeEntityCopyWithImpl; +@useResult +$Res call({ + String type, int amount +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityContactTypeEntityCopyWithImpl<$Res> + implements $DeviceCapabilityContactTypeEntityCopyWith<$Res> { + _$DeviceCapabilityContactTypeEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilityContactTypeEntity _self; + final $Res Function(DeviceCapabilityContactTypeEntity) _then; + +/// Create a copy of DeviceCapabilityContactTypeEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? type = null,Object? amount = null,}) { + return _then(_self.copyWith( +type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String,amount: null == amount ? _self.amount : amount // ignore: cast_nullable_to_non_nullable +as int, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityContactTypeEntity]. +extension DeviceCapabilityContactTypeEntityPatterns on DeviceCapabilityContactTypeEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityContactTypeEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityContactTypeEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityContactTypeEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityContactTypeEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityContactTypeEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityContactTypeEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String type, int amount)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityContactTypeEntity() when $default != null: +return $default(_that.type,_that.amount);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String type, int amount) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityContactTypeEntity(): +return $default(_that.type,_that.amount);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String type, int amount)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityContactTypeEntity() when $default != null: +return $default(_that.type,_that.amount);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilityContactTypeEntity implements DeviceCapabilityContactTypeEntity { + const _DeviceCapabilityContactTypeEntity({this.type = '', this.amount = 0}); + + +@override@JsonKey() final String type; +@override@JsonKey() final int amount; + +/// Create a copy of DeviceCapabilityContactTypeEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityContactTypeEntityCopyWith<_DeviceCapabilityContactTypeEntity> get copyWith => __$DeviceCapabilityContactTypeEntityCopyWithImpl<_DeviceCapabilityContactTypeEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityContactTypeEntity&&(identical(other.type, type) || other.type == type)&&(identical(other.amount, amount) || other.amount == amount)); +} + + +@override +int get hashCode => Object.hash(runtimeType,type,amount); + +@override +String toString() { + return 'DeviceCapabilityContactTypeEntity(type: $type, amount: $amount)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityContactTypeEntityCopyWith<$Res> implements $DeviceCapabilityContactTypeEntityCopyWith<$Res> { + factory _$DeviceCapabilityContactTypeEntityCopyWith(_DeviceCapabilityContactTypeEntity value, $Res Function(_DeviceCapabilityContactTypeEntity) _then) = __$DeviceCapabilityContactTypeEntityCopyWithImpl; +@override @useResult +$Res call({ + String type, int amount +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityContactTypeEntityCopyWithImpl<$Res> + implements _$DeviceCapabilityContactTypeEntityCopyWith<$Res> { + __$DeviceCapabilityContactTypeEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityContactTypeEntity _self; + final $Res Function(_DeviceCapabilityContactTypeEntity) _then; + +/// Create a copy of DeviceCapabilityContactTypeEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? type = null,Object? amount = null,}) { + return _then(_DeviceCapabilityContactTypeEntity( +type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable +as String,amount: null == amount ? _self.amount : amount // ignore: cast_nullable_to_non_nullable +as int, + )); +} + + +} + +/// @nodoc +mixin _$DeviceCapabilitySettingsEntity { + + bool get language; bool get timezone; List get soundModes; +/// Create a copy of DeviceCapabilitySettingsEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilitySettingsEntityCopyWith get copyWith => _$DeviceCapabilitySettingsEntityCopyWithImpl(this as DeviceCapabilitySettingsEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilitySettingsEntity&&(identical(other.language, language) || other.language == language)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&const DeepCollectionEquality().equals(other.soundModes, soundModes)); +} + + +@override +int get hashCode => Object.hash(runtimeType,language,timezone,const DeepCollectionEquality().hash(soundModes)); + +@override +String toString() { + return 'DeviceCapabilitySettingsEntity(language: $language, timezone: $timezone, soundModes: $soundModes)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilitySettingsEntityCopyWith<$Res> { + factory $DeviceCapabilitySettingsEntityCopyWith(DeviceCapabilitySettingsEntity value, $Res Function(DeviceCapabilitySettingsEntity) _then) = _$DeviceCapabilitySettingsEntityCopyWithImpl; +@useResult +$Res call({ + bool language, bool timezone, List soundModes +}); + + + + +} +/// @nodoc +class _$DeviceCapabilitySettingsEntityCopyWithImpl<$Res> + implements $DeviceCapabilitySettingsEntityCopyWith<$Res> { + _$DeviceCapabilitySettingsEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilitySettingsEntity _self; + final $Res Function(DeviceCapabilitySettingsEntity) _then; + +/// Create a copy of DeviceCapabilitySettingsEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? language = null,Object? timezone = null,Object? soundModes = null,}) { + return _then(_self.copyWith( +language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as bool,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as bool,soundModes: null == soundModes ? _self.soundModes : soundModes // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilitySettingsEntity]. +extension DeviceCapabilitySettingsEntityPatterns on DeviceCapabilitySettingsEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilitySettingsEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilitySettingsEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilitySettingsEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitySettingsEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilitySettingsEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilitySettingsEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( bool language, bool timezone, List soundModes)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilitySettingsEntity() when $default != null: +return $default(_that.language,_that.timezone,_that.soundModes);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( bool language, bool timezone, List soundModes) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitySettingsEntity(): +return $default(_that.language,_that.timezone,_that.soundModes);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool language, bool timezone, List soundModes)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilitySettingsEntity() when $default != null: +return $default(_that.language,_that.timezone,_that.soundModes);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilitySettingsEntity implements DeviceCapabilitySettingsEntity { + const _DeviceCapabilitySettingsEntity({this.language = false, this.timezone = false, final List soundModes = const []}): _soundModes = soundModes; + + +@override@JsonKey() final bool language; +@override@JsonKey() final bool timezone; + final List _soundModes; +@override@JsonKey() List get soundModes { + if (_soundModes is EqualUnmodifiableListView) return _soundModes; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_soundModes); +} + + +/// Create a copy of DeviceCapabilitySettingsEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilitySettingsEntityCopyWith<_DeviceCapabilitySettingsEntity> get copyWith => __$DeviceCapabilitySettingsEntityCopyWithImpl<_DeviceCapabilitySettingsEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilitySettingsEntity&&(identical(other.language, language) || other.language == language)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&const DeepCollectionEquality().equals(other._soundModes, _soundModes)); +} + + +@override +int get hashCode => Object.hash(runtimeType,language,timezone,const DeepCollectionEquality().hash(_soundModes)); + +@override +String toString() { + return 'DeviceCapabilitySettingsEntity(language: $language, timezone: $timezone, soundModes: $soundModes)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilitySettingsEntityCopyWith<$Res> implements $DeviceCapabilitySettingsEntityCopyWith<$Res> { + factory _$DeviceCapabilitySettingsEntityCopyWith(_DeviceCapabilitySettingsEntity value, $Res Function(_DeviceCapabilitySettingsEntity) _then) = __$DeviceCapabilitySettingsEntityCopyWithImpl; +@override @useResult +$Res call({ + bool language, bool timezone, List soundModes +}); + + + + +} +/// @nodoc +class __$DeviceCapabilitySettingsEntityCopyWithImpl<$Res> + implements _$DeviceCapabilitySettingsEntityCopyWith<$Res> { + __$DeviceCapabilitySettingsEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilitySettingsEntity _self; + final $Res Function(_DeviceCapabilitySettingsEntity) _then; + +/// Create a copy of DeviceCapabilitySettingsEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? language = null,Object? timezone = null,Object? soundModes = null,}) { + return _then(_DeviceCapabilitySettingsEntity( +language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as bool,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as bool,soundModes: null == soundModes ? _self._soundModes : soundModes // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + +/// @nodoc +mixin _$DeviceCapabilityCommandsEntity { + + bool get enabled; List get types; +/// Create a copy of DeviceCapabilityCommandsEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityCommandsEntityCopyWith get copyWith => _$DeviceCapabilityCommandsEntityCopyWithImpl(this as DeviceCapabilityCommandsEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityCommandsEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other.types, types)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(types)); + +@override +String toString() { + return 'DeviceCapabilityCommandsEntity(enabled: $enabled, types: $types)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityCommandsEntityCopyWith<$Res> { + factory $DeviceCapabilityCommandsEntityCopyWith(DeviceCapabilityCommandsEntity value, $Res Function(DeviceCapabilityCommandsEntity) _then) = _$DeviceCapabilityCommandsEntityCopyWithImpl; +@useResult +$Res call({ + bool enabled, List types +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityCommandsEntityCopyWithImpl<$Res> + implements $DeviceCapabilityCommandsEntityCopyWith<$Res> { + _$DeviceCapabilityCommandsEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilityCommandsEntity _self; + final $Res Function(DeviceCapabilityCommandsEntity) _then; + +/// Create a copy of DeviceCapabilityCommandsEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? enabled = null,Object? types = null,}) { + return _then(_self.copyWith( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self.types : types // ignore: cast_nullable_to_non_nullable +as List, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityCommandsEntity]. +extension DeviceCapabilityCommandsEntityPatterns on DeviceCapabilityCommandsEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityCommandsEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityCommandsEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityCommandsEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityCommandsEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityCommandsEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityCommandsEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( bool enabled, List types)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityCommandsEntity() when $default != null: +return $default(_that.enabled,_that.types);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( bool enabled, List types) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityCommandsEntity(): +return $default(_that.enabled,_that.types);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool enabled, List types)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityCommandsEntity() when $default != null: +return $default(_that.enabled,_that.types);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilityCommandsEntity implements DeviceCapabilityCommandsEntity { + const _DeviceCapabilityCommandsEntity({this.enabled = false, final List types = const []}): _types = types; + + +@override@JsonKey() final bool enabled; + final List _types; +@override@JsonKey() List get types { + if (_types is EqualUnmodifiableListView) return _types; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_types); +} + + +/// Create a copy of DeviceCapabilityCommandsEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityCommandsEntityCopyWith<_DeviceCapabilityCommandsEntity> get copyWith => __$DeviceCapabilityCommandsEntityCopyWithImpl<_DeviceCapabilityCommandsEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityCommandsEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other._types, _types)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled,const DeepCollectionEquality().hash(_types)); + +@override +String toString() { + return 'DeviceCapabilityCommandsEntity(enabled: $enabled, types: $types)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityCommandsEntityCopyWith<$Res> implements $DeviceCapabilityCommandsEntityCopyWith<$Res> { + factory _$DeviceCapabilityCommandsEntityCopyWith(_DeviceCapabilityCommandsEntity value, $Res Function(_DeviceCapabilityCommandsEntity) _then) = __$DeviceCapabilityCommandsEntityCopyWithImpl; +@override @useResult +$Res call({ + bool enabled, List types +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityCommandsEntityCopyWithImpl<$Res> + implements _$DeviceCapabilityCommandsEntityCopyWith<$Res> { + __$DeviceCapabilityCommandsEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityCommandsEntity _self; + final $Res Function(_DeviceCapabilityCommandsEntity) _then; + +/// Create a copy of DeviceCapabilityCommandsEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? enabled = null,Object? types = null,}) { + return _then(_DeviceCapabilityCommandsEntity( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,types: null == types ? _self._types : types // ignore: cast_nullable_to_non_nullable +as List, + )); +} + + +} + +/// @nodoc +mixin _$DeviceCapabilityTakepillsEntity { + + bool get enabled; int get maxReminders; +/// Create a copy of DeviceCapabilityTakepillsEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityTakepillsEntityCopyWith get copyWith => _$DeviceCapabilityTakepillsEntityCopyWithImpl(this as DeviceCapabilityTakepillsEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityTakepillsEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)&&(identical(other.maxReminders, maxReminders) || other.maxReminders == maxReminders)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled,maxReminders); + +@override +String toString() { + return 'DeviceCapabilityTakepillsEntity(enabled: $enabled, maxReminders: $maxReminders)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityTakepillsEntityCopyWith<$Res> { + factory $DeviceCapabilityTakepillsEntityCopyWith(DeviceCapabilityTakepillsEntity value, $Res Function(DeviceCapabilityTakepillsEntity) _then) = _$DeviceCapabilityTakepillsEntityCopyWithImpl; +@useResult +$Res call({ + bool enabled, int maxReminders +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityTakepillsEntityCopyWithImpl<$Res> + implements $DeviceCapabilityTakepillsEntityCopyWith<$Res> { + _$DeviceCapabilityTakepillsEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilityTakepillsEntity _self; + final $Res Function(DeviceCapabilityTakepillsEntity) _then; + +/// Create a copy of DeviceCapabilityTakepillsEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? enabled = null,Object? maxReminders = null,}) { + return _then(_self.copyWith( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,maxReminders: null == maxReminders ? _self.maxReminders : maxReminders // ignore: cast_nullable_to_non_nullable +as int, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityTakepillsEntity]. +extension DeviceCapabilityTakepillsEntityPatterns on DeviceCapabilityTakepillsEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityTakepillsEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityTakepillsEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityTakepillsEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityTakepillsEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityTakepillsEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityTakepillsEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( bool enabled, int maxReminders)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityTakepillsEntity() when $default != null: +return $default(_that.enabled,_that.maxReminders);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( bool enabled, int maxReminders) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityTakepillsEntity(): +return $default(_that.enabled,_that.maxReminders);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool enabled, int maxReminders)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityTakepillsEntity() when $default != null: +return $default(_that.enabled,_that.maxReminders);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilityTakepillsEntity implements DeviceCapabilityTakepillsEntity { + const _DeviceCapabilityTakepillsEntity({this.enabled = false, this.maxReminders = 0}); + + +@override@JsonKey() final bool enabled; +@override@JsonKey() final int maxReminders; + +/// Create a copy of DeviceCapabilityTakepillsEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityTakepillsEntityCopyWith<_DeviceCapabilityTakepillsEntity> get copyWith => __$DeviceCapabilityTakepillsEntityCopyWithImpl<_DeviceCapabilityTakepillsEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityTakepillsEntity&&(identical(other.enabled, enabled) || other.enabled == enabled)&&(identical(other.maxReminders, maxReminders) || other.maxReminders == maxReminders)); +} + + +@override +int get hashCode => Object.hash(runtimeType,enabled,maxReminders); + +@override +String toString() { + return 'DeviceCapabilityTakepillsEntity(enabled: $enabled, maxReminders: $maxReminders)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityTakepillsEntityCopyWith<$Res> implements $DeviceCapabilityTakepillsEntityCopyWith<$Res> { + factory _$DeviceCapabilityTakepillsEntityCopyWith(_DeviceCapabilityTakepillsEntity value, $Res Function(_DeviceCapabilityTakepillsEntity) _then) = __$DeviceCapabilityTakepillsEntityCopyWithImpl; +@override @useResult +$Res call({ + bool enabled, int maxReminders +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityTakepillsEntityCopyWithImpl<$Res> + implements _$DeviceCapabilityTakepillsEntityCopyWith<$Res> { + __$DeviceCapabilityTakepillsEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityTakepillsEntity _self; + final $Res Function(_DeviceCapabilityTakepillsEntity) _then; + +/// Create a copy of DeviceCapabilityTakepillsEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? enabled = null,Object? maxReminders = null,}) { + return _then(_DeviceCapabilityTakepillsEntity( +enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool,maxReminders: null == maxReminders ? _self.maxReminders : maxReminders // ignore: cast_nullable_to_non_nullable +as int, + )); +} + + +} + +/// @nodoc +mixin _$DeviceCapabilityCameraEntity { + + String get format; bool get enabled; +/// Create a copy of DeviceCapabilityCameraEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceCapabilityCameraEntityCopyWith get copyWith => _$DeviceCapabilityCameraEntityCopyWithImpl(this as DeviceCapabilityCameraEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceCapabilityCameraEntity&&(identical(other.format, format) || other.format == format)&&(identical(other.enabled, enabled) || other.enabled == enabled)); +} + + +@override +int get hashCode => Object.hash(runtimeType,format,enabled); + +@override +String toString() { + return 'DeviceCapabilityCameraEntity(format: $format, enabled: $enabled)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceCapabilityCameraEntityCopyWith<$Res> { + factory $DeviceCapabilityCameraEntityCopyWith(DeviceCapabilityCameraEntity value, $Res Function(DeviceCapabilityCameraEntity) _then) = _$DeviceCapabilityCameraEntityCopyWithImpl; +@useResult +$Res call({ + String format, bool enabled +}); + + + + +} +/// @nodoc +class _$DeviceCapabilityCameraEntityCopyWithImpl<$Res> + implements $DeviceCapabilityCameraEntityCopyWith<$Res> { + _$DeviceCapabilityCameraEntityCopyWithImpl(this._self, this._then); + + final DeviceCapabilityCameraEntity _self; + final $Res Function(DeviceCapabilityCameraEntity) _then; + +/// Create a copy of DeviceCapabilityCameraEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? format = null,Object? enabled = null,}) { + return _then(_self.copyWith( +format: null == format ? _self.format : format // ignore: cast_nullable_to_non_nullable +as String,enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceCapabilityCameraEntity]. +extension DeviceCapabilityCameraEntityPatterns on DeviceCapabilityCameraEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceCapabilityCameraEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceCapabilityCameraEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceCapabilityCameraEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityCameraEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceCapabilityCameraEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceCapabilityCameraEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String format, bool enabled)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceCapabilityCameraEntity() when $default != null: +return $default(_that.format,_that.enabled);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String format, bool enabled) $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityCameraEntity(): +return $default(_that.format,_that.enabled);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String format, bool enabled)? $default,) {final _that = this; +switch (_that) { +case _DeviceCapabilityCameraEntity() when $default != null: +return $default(_that.format,_that.enabled);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceCapabilityCameraEntity implements DeviceCapabilityCameraEntity { + const _DeviceCapabilityCameraEntity({this.format = '', this.enabled = false}); + + +@override@JsonKey() final String format; +@override@JsonKey() final bool enabled; + +/// Create a copy of DeviceCapabilityCameraEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceCapabilityCameraEntityCopyWith<_DeviceCapabilityCameraEntity> get copyWith => __$DeviceCapabilityCameraEntityCopyWithImpl<_DeviceCapabilityCameraEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceCapabilityCameraEntity&&(identical(other.format, format) || other.format == format)&&(identical(other.enabled, enabled) || other.enabled == enabled)); +} + + +@override +int get hashCode => Object.hash(runtimeType,format,enabled); + +@override +String toString() { + return 'DeviceCapabilityCameraEntity(format: $format, enabled: $enabled)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceCapabilityCameraEntityCopyWith<$Res> implements $DeviceCapabilityCameraEntityCopyWith<$Res> { + factory _$DeviceCapabilityCameraEntityCopyWith(_DeviceCapabilityCameraEntity value, $Res Function(_DeviceCapabilityCameraEntity) _then) = __$DeviceCapabilityCameraEntityCopyWithImpl; +@override @useResult +$Res call({ + String format, bool enabled +}); + + + + +} +/// @nodoc +class __$DeviceCapabilityCameraEntityCopyWithImpl<$Res> + implements _$DeviceCapabilityCameraEntityCopyWith<$Res> { + __$DeviceCapabilityCameraEntityCopyWithImpl(this._self, this._then); + + final _DeviceCapabilityCameraEntity _self; + final $Res Function(_DeviceCapabilityCameraEntity) _then; + +/// Create a copy of DeviceCapabilityCameraEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? format = null,Object? enabled = null,}) { + return _then(_DeviceCapabilityCameraEntity( +format: null == format ? _self.format : format // ignore: cast_nullable_to_non_nullable +as String,enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + +// dart format on diff --git a/packages/sf_shared/lib/src/domain/entities/device_entity.dart b/packages/sf_shared/lib/src/domain/entities/device_entity.dart index 8045e523..bd19369c 100644 --- a/packages/sf_shared/lib/src/domain/entities/device_entity.dart +++ b/packages/sf_shared/lib/src/domain/entities/device_entity.dart @@ -1,5 +1,8 @@ import 'package:freezed_annotation/freezed_annotation.dart'; +import 'device_capabilities_entity.dart'; +import 'device_settings_entity.dart'; + part 'device_entity.freezed.dart'; @freezed @@ -24,11 +27,11 @@ abstract class DeviceEntity with _$DeviceEntity { String? phone, String? simId, Map? paymentOptions, - @Default({}) Map settings, + @Default(DeviceSettingsEntity()) DeviceSettingsEntity settings, @Default('') String connectionServer, @Default('') String protocol, @Default('') String type, - Map? capabilities, + DeviceCapabilitiesEntity? capabilities, @Default('') String createdAt, String? updatedAt, }) = _DeviceEntity; diff --git a/packages/sf_shared/lib/src/domain/entities/device_entity.freezed.dart b/packages/sf_shared/lib/src/domain/entities/device_entity.freezed.dart index bdab0682..c988a2f7 100644 --- a/packages/sf_shared/lib/src/domain/entities/device_entity.freezed.dart +++ b/packages/sf_shared/lib/src/domain/entities/device_entity.freezed.dart @@ -14,7 +14,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$DeviceEntity { - String get id; String get identificator; int? get battery; String? get userId; String? get companyId; String? get delegationId; String? get groupId; Map get flags; List? get tags; String? get lastConnection; String? get carrierGenre; String? get carrierBirthday; int? get carrierWeight; int? get carrierStepLength; String? get carrierName; String? get comment; String? get phone; String? get simId; Map? get paymentOptions; Map get settings; String get connectionServer; String get protocol; String get type; Map? get capabilities; String get createdAt; String? get updatedAt; + String get id; String get identificator; int? get battery; String? get userId; String? get companyId; String? get delegationId; String? get groupId; Map get flags; List? get tags; String? get lastConnection; String? get carrierGenre; String? get carrierBirthday; int? get carrierWeight; int? get carrierStepLength; String? get carrierName; String? get comment; String? get phone; String? get simId; Map? get paymentOptions; DeviceSettingsEntity get settings; String get connectionServer; String get protocol; String get type; DeviceCapabilitiesEntity? get capabilities; String get createdAt; String? get updatedAt; /// Create a copy of DeviceEntity /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -25,12 +25,12 @@ $DeviceEntityCopyWith get copyWith => _$DeviceEntityCopyWithImpl Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(flags),const DeepCollectionEquality().hash(tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,const DeepCollectionEquality().hash(paymentOptions),const DeepCollectionEquality().hash(settings),connectionServer,protocol,type,const DeepCollectionEquality().hash(capabilities),createdAt,updatedAt]); +int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(flags),const DeepCollectionEquality().hash(tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,const DeepCollectionEquality().hash(paymentOptions),settings,connectionServer,protocol,type,capabilities,createdAt,updatedAt]); @override String toString() { @@ -45,11 +45,11 @@ abstract mixin class $DeviceEntityCopyWith<$Res> { factory $DeviceEntityCopyWith(DeviceEntity value, $Res Function(DeviceEntity) _then) = _$DeviceEntityCopyWithImpl; @useResult $Res call({ - String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, Map settings, String connectionServer, String protocol, String type, Map? capabilities, String createdAt, String? updatedAt + String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, DeviceCapabilitiesEntity? capabilities, String createdAt, String? updatedAt }); - +$DeviceSettingsEntityCopyWith<$Res> get settings;$DeviceCapabilitiesEntityCopyWith<$Res>? get capabilities; } /// @nodoc @@ -84,16 +84,37 @@ as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullabl as String?,simId: freezed == simId ? _self.simId : simId // ignore: cast_nullable_to_non_nullable as String?,paymentOptions: freezed == paymentOptions ? _self.paymentOptions : paymentOptions // ignore: cast_nullable_to_non_nullable as Map?,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable -as Map,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable +as DeviceSettingsEntity,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable as String,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable as String,capabilities: freezed == capabilities ? _self.capabilities : capabilities // ignore: cast_nullable_to_non_nullable -as Map?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitiesEntity?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as String,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable as String?, )); } +/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceSettingsEntityCopyWith<$Res> get settings { + + return $DeviceSettingsEntityCopyWith<$Res>(_self.settings, (value) { + return _then(_self.copyWith(settings: value)); + }); +}/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitiesEntityCopyWith<$Res>? get capabilities { + if (_self.capabilities == null) { + return null; + } + return $DeviceCapabilitiesEntityCopyWith<$Res>(_self.capabilities!, (value) { + return _then(_self.copyWith(capabilities: value)); + }); +} } @@ -175,7 +196,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, Map settings, String connectionServer, String protocol, String type, Map? capabilities, String createdAt, String? updatedAt)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, DeviceCapabilitiesEntity? capabilities, String createdAt, String? updatedAt)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _DeviceEntity() when $default != null: return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.paymentOptions,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.capabilities,_that.createdAt,_that.updatedAt);case _: @@ -196,7 +217,7 @@ return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.co /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, Map settings, String connectionServer, String protocol, String type, Map? capabilities, String createdAt, String? updatedAt) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, DeviceCapabilitiesEntity? capabilities, String createdAt, String? updatedAt) $default,) {final _that = this; switch (_that) { case _DeviceEntity(): return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.paymentOptions,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.capabilities,_that.createdAt,_that.updatedAt);case _: @@ -216,7 +237,7 @@ return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.co /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, Map settings, String connectionServer, String protocol, String type, Map? capabilities, String createdAt, String? updatedAt)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, DeviceCapabilitiesEntity? capabilities, String createdAt, String? updatedAt)? $default,) {final _that = this; switch (_that) { case _DeviceEntity() when $default != null: return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.paymentOptions,_that.settings,_that.connectionServer,_that.protocol,_that.type,_that.capabilities,_that.createdAt,_that.updatedAt);case _: @@ -231,7 +252,7 @@ return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.co class _DeviceEntity implements DeviceEntity { - const _DeviceEntity({required this.id, required this.identificator, this.battery, this.userId, this.companyId, this.delegationId, this.groupId, final Map flags = const {}, final List? tags, this.lastConnection, this.carrierGenre, this.carrierBirthday, this.carrierWeight, this.carrierStepLength, this.carrierName, this.comment, this.phone, this.simId, final Map? paymentOptions, final Map settings = const {}, this.connectionServer = '', this.protocol = '', this.type = '', final Map? capabilities, this.createdAt = '', this.updatedAt}): _flags = flags,_tags = tags,_paymentOptions = paymentOptions,_settings = settings,_capabilities = capabilities; + const _DeviceEntity({required this.id, required this.identificator, this.battery, this.userId, this.companyId, this.delegationId, this.groupId, final Map flags = const {}, final List? tags, this.lastConnection, this.carrierGenre, this.carrierBirthday, this.carrierWeight, this.carrierStepLength, this.carrierName, this.comment, this.phone, this.simId, final Map? paymentOptions, this.settings = const DeviceSettingsEntity(), this.connectionServer = '', this.protocol = '', this.type = '', this.capabilities, this.createdAt = '', this.updatedAt}): _flags = flags,_tags = tags,_paymentOptions = paymentOptions; @override final String id; @@ -275,25 +296,11 @@ class _DeviceEntity implements DeviceEntity { return EqualUnmodifiableMapView(value); } - final Map _settings; -@override@JsonKey() Map get settings { - if (_settings is EqualUnmodifiableMapView) return _settings; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_settings); -} - +@override@JsonKey() final DeviceSettingsEntity settings; @override@JsonKey() final String connectionServer; @override@JsonKey() final String protocol; @override@JsonKey() final String type; - final Map? _capabilities; -@override Map? get capabilities { - final value = _capabilities; - if (value == null) return null; - if (_capabilities is EqualUnmodifiableMapView) return _capabilities; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); -} - +@override final DeviceCapabilitiesEntity? capabilities; @override@JsonKey() final String createdAt; @override final String? updatedAt; @@ -307,12 +314,12 @@ _$DeviceEntityCopyWith<_DeviceEntity> get copyWith => __$DeviceEntityCopyWithImp @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.battery, battery) || other.battery == battery)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&const DeepCollectionEquality().equals(other._flags, _flags)&&const DeepCollectionEquality().equals(other._tags, _tags)&&(identical(other.lastConnection, lastConnection) || other.lastConnection == lastConnection)&&(identical(other.carrierGenre, carrierGenre) || other.carrierGenre == carrierGenre)&&(identical(other.carrierBirthday, carrierBirthday) || other.carrierBirthday == carrierBirthday)&&(identical(other.carrierWeight, carrierWeight) || other.carrierWeight == carrierWeight)&&(identical(other.carrierStepLength, carrierStepLength) || other.carrierStepLength == carrierStepLength)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.simId, simId) || other.simId == simId)&&const DeepCollectionEquality().equals(other._paymentOptions, _paymentOptions)&&const DeepCollectionEquality().equals(other._settings, _settings)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&const DeepCollectionEquality().equals(other._capabilities, _capabilities)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.battery, battery) || other.battery == battery)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&const DeepCollectionEquality().equals(other._flags, _flags)&&const DeepCollectionEquality().equals(other._tags, _tags)&&(identical(other.lastConnection, lastConnection) || other.lastConnection == lastConnection)&&(identical(other.carrierGenre, carrierGenre) || other.carrierGenre == carrierGenre)&&(identical(other.carrierBirthday, carrierBirthday) || other.carrierBirthday == carrierBirthday)&&(identical(other.carrierWeight, carrierWeight) || other.carrierWeight == carrierWeight)&&(identical(other.carrierStepLength, carrierStepLength) || other.carrierStepLength == carrierStepLength)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.simId, simId) || other.simId == simId)&&const DeepCollectionEquality().equals(other._paymentOptions, _paymentOptions)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.capabilities, capabilities) || other.capabilities == capabilities)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)); } @override -int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(_flags),const DeepCollectionEquality().hash(_tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,const DeepCollectionEquality().hash(_paymentOptions),const DeepCollectionEquality().hash(_settings),connectionServer,protocol,type,const DeepCollectionEquality().hash(_capabilities),createdAt,updatedAt]); +int get hashCode => Object.hashAll([runtimeType,id,identificator,battery,userId,companyId,delegationId,groupId,const DeepCollectionEquality().hash(_flags),const DeepCollectionEquality().hash(_tags),lastConnection,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,carrierName,comment,phone,simId,const DeepCollectionEquality().hash(_paymentOptions),settings,connectionServer,protocol,type,capabilities,createdAt,updatedAt]); @override String toString() { @@ -327,11 +334,11 @@ abstract mixin class _$DeviceEntityCopyWith<$Res> implements $DeviceEntityCopyWi factory _$DeviceEntityCopyWith(_DeviceEntity value, $Res Function(_DeviceEntity) _then) = __$DeviceEntityCopyWithImpl; @override @useResult $Res call({ - String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, Map settings, String connectionServer, String protocol, String type, Map? capabilities, String createdAt, String? updatedAt + String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, Map flags, List? tags, String? lastConnection, String? carrierGenre, String? carrierBirthday, int? carrierWeight, int? carrierStepLength, String? carrierName, String? comment, String? phone, String? simId, Map? paymentOptions, DeviceSettingsEntity settings, String connectionServer, String protocol, String type, DeviceCapabilitiesEntity? capabilities, String createdAt, String? updatedAt }); - +@override $DeviceSettingsEntityCopyWith<$Res> get settings;@override $DeviceCapabilitiesEntityCopyWith<$Res>? get capabilities; } /// @nodoc @@ -365,18 +372,39 @@ as String?,comment: freezed == comment ? _self.comment : comment // ignore: cast as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable as String?,simId: freezed == simId ? _self.simId : simId // ignore: cast_nullable_to_non_nullable as String?,paymentOptions: freezed == paymentOptions ? _self._paymentOptions : paymentOptions // ignore: cast_nullable_to_non_nullable -as Map?,settings: null == settings ? _self._settings : settings // ignore: cast_nullable_to_non_nullable -as Map,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable +as Map?,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable +as DeviceSettingsEntity,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable as String,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable -as String,capabilities: freezed == capabilities ? _self._capabilities : capabilities // ignore: cast_nullable_to_non_nullable -as Map?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String,capabilities: freezed == capabilities ? _self.capabilities : capabilities // ignore: cast_nullable_to_non_nullable +as DeviceCapabilitiesEntity?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as String,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable as String?, )); } +/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceSettingsEntityCopyWith<$Res> get settings { + + return $DeviceSettingsEntityCopyWith<$Res>(_self.settings, (value) { + return _then(_self.copyWith(settings: value)); + }); +}/// Create a copy of DeviceEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceCapabilitiesEntityCopyWith<$Res>? get capabilities { + if (_self.capabilities == null) { + return null; + } + return $DeviceCapabilitiesEntityCopyWith<$Res>(_self.capabilities!, (value) { + return _then(_self.copyWith(capabilities: value)); + }); +} } // dart format on diff --git a/packages/sf_shared/lib/src/domain/entities/device_settings_entity.dart b/packages/sf_shared/lib/src/domain/entities/device_settings_entity.dart new file mode 100644 index 00000000..1ebaa87c --- /dev/null +++ b/packages/sf_shared/lib/src/domain/entities/device_settings_entity.dart @@ -0,0 +1,26 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'device_settings_entity.freezed.dart'; + +@freezed +abstract class DeviceSettingsEntity with _$DeviceSettingsEntity { + const factory DeviceSettingsEntity({ + @Default(60) int frequency, + @Default(120) int frequencyHeartRate, + @Default(0) int timezone, + @Default(false) bool pedometer, + @Default('es') String language, + @Default([]) List alerts, + @Default(DeviceVolumeEntity()) DeviceVolumeEntity volume, + String? soundMode, + }) = _DeviceSettingsEntity; +} + +@freezed +abstract class DeviceVolumeEntity with _$DeviceVolumeEntity { + const factory DeviceVolumeEntity({ + @Default(50) int media, + @Default(50) int ringtone, + @Default(50) int alarm, + }) = _DeviceVolumeEntity; +} diff --git a/packages/sf_shared/lib/src/domain/entities/device_settings_entity.freezed.dart b/packages/sf_shared/lib/src/domain/entities/device_settings_entity.freezed.dart new file mode 100644 index 00000000..4c4b8c2d --- /dev/null +++ b/packages/sf_shared/lib/src/domain/entities/device_settings_entity.freezed.dart @@ -0,0 +1,579 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'device_settings_entity.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$DeviceSettingsEntity { + + int get frequency; int get frequencyHeartRate; int get timezone; bool get pedometer; String get language; List get alerts; DeviceVolumeEntity get volume; String? get soundMode; +/// Create a copy of DeviceSettingsEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceSettingsEntityCopyWith get copyWith => _$DeviceSettingsEntityCopyWithImpl(this as DeviceSettingsEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceSettingsEntity&&(identical(other.frequency, frequency) || other.frequency == frequency)&&(identical(other.frequencyHeartRate, frequencyHeartRate) || other.frequencyHeartRate == frequencyHeartRate)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.pedometer, pedometer) || other.pedometer == pedometer)&&(identical(other.language, language) || other.language == language)&&const DeepCollectionEquality().equals(other.alerts, alerts)&&(identical(other.volume, volume) || other.volume == volume)&&(identical(other.soundMode, soundMode) || other.soundMode == soundMode)); +} + + +@override +int get hashCode => Object.hash(runtimeType,frequency,frequencyHeartRate,timezone,pedometer,language,const DeepCollectionEquality().hash(alerts),volume,soundMode); + +@override +String toString() { + return 'DeviceSettingsEntity(frequency: $frequency, frequencyHeartRate: $frequencyHeartRate, timezone: $timezone, pedometer: $pedometer, language: $language, alerts: $alerts, volume: $volume, soundMode: $soundMode)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceSettingsEntityCopyWith<$Res> { + factory $DeviceSettingsEntityCopyWith(DeviceSettingsEntity value, $Res Function(DeviceSettingsEntity) _then) = _$DeviceSettingsEntityCopyWithImpl; +@useResult +$Res call({ + int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts, DeviceVolumeEntity volume, String? soundMode +}); + + +$DeviceVolumeEntityCopyWith<$Res> get volume; + +} +/// @nodoc +class _$DeviceSettingsEntityCopyWithImpl<$Res> + implements $DeviceSettingsEntityCopyWith<$Res> { + _$DeviceSettingsEntityCopyWithImpl(this._self, this._then); + + final DeviceSettingsEntity _self; + final $Res Function(DeviceSettingsEntity) _then; + +/// Create a copy of DeviceSettingsEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? frequency = null,Object? frequencyHeartRate = null,Object? timezone = null,Object? pedometer = null,Object? language = null,Object? alerts = null,Object? volume = null,Object? soundMode = freezed,}) { + return _then(_self.copyWith( +frequency: null == frequency ? _self.frequency : frequency // ignore: cast_nullable_to_non_nullable +as int,frequencyHeartRate: null == frequencyHeartRate ? _self.frequencyHeartRate : frequencyHeartRate // ignore: cast_nullable_to_non_nullable +as int,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as int,pedometer: null == pedometer ? _self.pedometer : pedometer // ignore: cast_nullable_to_non_nullable +as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,alerts: null == alerts ? _self.alerts : alerts // ignore: cast_nullable_to_non_nullable +as List,volume: null == volume ? _self.volume : volume // ignore: cast_nullable_to_non_nullable +as DeviceVolumeEntity,soundMode: freezed == soundMode ? _self.soundMode : soundMode // ignore: cast_nullable_to_non_nullable +as String?, + )); +} +/// Create a copy of DeviceSettingsEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceVolumeEntityCopyWith<$Res> get volume { + + return $DeviceVolumeEntityCopyWith<$Res>(_self.volume, (value) { + return _then(_self.copyWith(volume: value)); + }); +} +} + + +/// Adds pattern-matching-related methods to [DeviceSettingsEntity]. +extension DeviceSettingsEntityPatterns on DeviceSettingsEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceSettingsEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceSettingsEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceSettingsEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceSettingsEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceSettingsEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceSettingsEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts, DeviceVolumeEntity volume, String? soundMode)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceSettingsEntity() when $default != null: +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts,_that.volume,_that.soundMode);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts, DeviceVolumeEntity volume, String? soundMode) $default,) {final _that = this; +switch (_that) { +case _DeviceSettingsEntity(): +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts,_that.volume,_that.soundMode);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts, DeviceVolumeEntity volume, String? soundMode)? $default,) {final _that = this; +switch (_that) { +case _DeviceSettingsEntity() when $default != null: +return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts,_that.volume,_that.soundMode);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceSettingsEntity implements DeviceSettingsEntity { + const _DeviceSettingsEntity({this.frequency = 60, this.frequencyHeartRate = 120, this.timezone = 0, this.pedometer = false, this.language = 'es', final List alerts = const [], this.volume = const DeviceVolumeEntity(), this.soundMode}): _alerts = alerts; + + +@override@JsonKey() final int frequency; +@override@JsonKey() final int frequencyHeartRate; +@override@JsonKey() final int timezone; +@override@JsonKey() final bool pedometer; +@override@JsonKey() final String language; + final List _alerts; +@override@JsonKey() List get alerts { + if (_alerts is EqualUnmodifiableListView) return _alerts; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_alerts); +} + +@override@JsonKey() final DeviceVolumeEntity volume; +@override final String? soundMode; + +/// Create a copy of DeviceSettingsEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceSettingsEntityCopyWith<_DeviceSettingsEntity> get copyWith => __$DeviceSettingsEntityCopyWithImpl<_DeviceSettingsEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceSettingsEntity&&(identical(other.frequency, frequency) || other.frequency == frequency)&&(identical(other.frequencyHeartRate, frequencyHeartRate) || other.frequencyHeartRate == frequencyHeartRate)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.pedometer, pedometer) || other.pedometer == pedometer)&&(identical(other.language, language) || other.language == language)&&const DeepCollectionEquality().equals(other._alerts, _alerts)&&(identical(other.volume, volume) || other.volume == volume)&&(identical(other.soundMode, soundMode) || other.soundMode == soundMode)); +} + + +@override +int get hashCode => Object.hash(runtimeType,frequency,frequencyHeartRate,timezone,pedometer,language,const DeepCollectionEquality().hash(_alerts),volume,soundMode); + +@override +String toString() { + return 'DeviceSettingsEntity(frequency: $frequency, frequencyHeartRate: $frequencyHeartRate, timezone: $timezone, pedometer: $pedometer, language: $language, alerts: $alerts, volume: $volume, soundMode: $soundMode)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceSettingsEntityCopyWith<$Res> implements $DeviceSettingsEntityCopyWith<$Res> { + factory _$DeviceSettingsEntityCopyWith(_DeviceSettingsEntity value, $Res Function(_DeviceSettingsEntity) _then) = __$DeviceSettingsEntityCopyWithImpl; +@override @useResult +$Res call({ + int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List alerts, DeviceVolumeEntity volume, String? soundMode +}); + + +@override $DeviceVolumeEntityCopyWith<$Res> get volume; + +} +/// @nodoc +class __$DeviceSettingsEntityCopyWithImpl<$Res> + implements _$DeviceSettingsEntityCopyWith<$Res> { + __$DeviceSettingsEntityCopyWithImpl(this._self, this._then); + + final _DeviceSettingsEntity _self; + final $Res Function(_DeviceSettingsEntity) _then; + +/// Create a copy of DeviceSettingsEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? frequency = null,Object? frequencyHeartRate = null,Object? timezone = null,Object? pedometer = null,Object? language = null,Object? alerts = null,Object? volume = null,Object? soundMode = freezed,}) { + return _then(_DeviceSettingsEntity( +frequency: null == frequency ? _self.frequency : frequency // ignore: cast_nullable_to_non_nullable +as int,frequencyHeartRate: null == frequencyHeartRate ? _self.frequencyHeartRate : frequencyHeartRate // ignore: cast_nullable_to_non_nullable +as int,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable +as int,pedometer: null == pedometer ? _self.pedometer : pedometer // ignore: cast_nullable_to_non_nullable +as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable +as String,alerts: null == alerts ? _self._alerts : alerts // ignore: cast_nullable_to_non_nullable +as List,volume: null == volume ? _self.volume : volume // ignore: cast_nullable_to_non_nullable +as DeviceVolumeEntity,soundMode: freezed == soundMode ? _self.soundMode : soundMode // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + +/// Create a copy of DeviceSettingsEntity +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeviceVolumeEntityCopyWith<$Res> get volume { + + return $DeviceVolumeEntityCopyWith<$Res>(_self.volume, (value) { + return _then(_self.copyWith(volume: value)); + }); +} +} + +/// @nodoc +mixin _$DeviceVolumeEntity { + + int get media; int get ringtone; int get alarm; +/// Create a copy of DeviceVolumeEntity +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DeviceVolumeEntityCopyWith get copyWith => _$DeviceVolumeEntityCopyWithImpl(this as DeviceVolumeEntity, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceVolumeEntity&&(identical(other.media, media) || other.media == media)&&(identical(other.ringtone, ringtone) || other.ringtone == ringtone)&&(identical(other.alarm, alarm) || other.alarm == alarm)); +} + + +@override +int get hashCode => Object.hash(runtimeType,media,ringtone,alarm); + +@override +String toString() { + return 'DeviceVolumeEntity(media: $media, ringtone: $ringtone, alarm: $alarm)'; +} + + +} + +/// @nodoc +abstract mixin class $DeviceVolumeEntityCopyWith<$Res> { + factory $DeviceVolumeEntityCopyWith(DeviceVolumeEntity value, $Res Function(DeviceVolumeEntity) _then) = _$DeviceVolumeEntityCopyWithImpl; +@useResult +$Res call({ + int media, int ringtone, int alarm +}); + + + + +} +/// @nodoc +class _$DeviceVolumeEntityCopyWithImpl<$Res> + implements $DeviceVolumeEntityCopyWith<$Res> { + _$DeviceVolumeEntityCopyWithImpl(this._self, this._then); + + final DeviceVolumeEntity _self; + final $Res Function(DeviceVolumeEntity) _then; + +/// Create a copy of DeviceVolumeEntity +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? media = null,Object? ringtone = null,Object? alarm = null,}) { + return _then(_self.copyWith( +media: null == media ? _self.media : media // ignore: cast_nullable_to_non_nullable +as int,ringtone: null == ringtone ? _self.ringtone : ringtone // ignore: cast_nullable_to_non_nullable +as int,alarm: null == alarm ? _self.alarm : alarm // ignore: cast_nullable_to_non_nullable +as int, + )); +} + +} + + +/// Adds pattern-matching-related methods to [DeviceVolumeEntity]. +extension DeviceVolumeEntityPatterns on DeviceVolumeEntity { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _DeviceVolumeEntity value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DeviceVolumeEntity() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _DeviceVolumeEntity value) $default,){ +final _that = this; +switch (_that) { +case _DeviceVolumeEntity(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DeviceVolumeEntity value)? $default,){ +final _that = this; +switch (_that) { +case _DeviceVolumeEntity() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( int media, int ringtone, int alarm)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DeviceVolumeEntity() when $default != null: +return $default(_that.media,_that.ringtone,_that.alarm);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( int media, int ringtone, int alarm) $default,) {final _that = this; +switch (_that) { +case _DeviceVolumeEntity(): +return $default(_that.media,_that.ringtone,_that.alarm);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( int media, int ringtone, int alarm)? $default,) {final _that = this; +switch (_that) { +case _DeviceVolumeEntity() when $default != null: +return $default(_that.media,_that.ringtone,_that.alarm);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _DeviceVolumeEntity implements DeviceVolumeEntity { + const _DeviceVolumeEntity({this.media = 50, this.ringtone = 50, this.alarm = 50}); + + +@override@JsonKey() final int media; +@override@JsonKey() final int ringtone; +@override@JsonKey() final int alarm; + +/// Create a copy of DeviceVolumeEntity +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DeviceVolumeEntityCopyWith<_DeviceVolumeEntity> get copyWith => __$DeviceVolumeEntityCopyWithImpl<_DeviceVolumeEntity>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceVolumeEntity&&(identical(other.media, media) || other.media == media)&&(identical(other.ringtone, ringtone) || other.ringtone == ringtone)&&(identical(other.alarm, alarm) || other.alarm == alarm)); +} + + +@override +int get hashCode => Object.hash(runtimeType,media,ringtone,alarm); + +@override +String toString() { + return 'DeviceVolumeEntity(media: $media, ringtone: $ringtone, alarm: $alarm)'; +} + + +} + +/// @nodoc +abstract mixin class _$DeviceVolumeEntityCopyWith<$Res> implements $DeviceVolumeEntityCopyWith<$Res> { + factory _$DeviceVolumeEntityCopyWith(_DeviceVolumeEntity value, $Res Function(_DeviceVolumeEntity) _then) = __$DeviceVolumeEntityCopyWithImpl; +@override @useResult +$Res call({ + int media, int ringtone, int alarm +}); + + + + +} +/// @nodoc +class __$DeviceVolumeEntityCopyWithImpl<$Res> + implements _$DeviceVolumeEntityCopyWith<$Res> { + __$DeviceVolumeEntityCopyWithImpl(this._self, this._then); + + final _DeviceVolumeEntity _self; + final $Res Function(_DeviceVolumeEntity) _then; + +/// Create a copy of DeviceVolumeEntity +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? media = null,Object? ringtone = null,Object? alarm = null,}) { + return _then(_DeviceVolumeEntity( +media: null == media ? _self.media : media // ignore: cast_nullable_to_non_nullable +as int,ringtone: null == ringtone ? _self.ringtone : ringtone // ignore: cast_nullable_to_non_nullable +as int,alarm: null == alarm ? _self.alarm : alarm // ignore: cast_nullable_to_non_nullable +as int, + )); +} + + +} + +// dart format on