From fd107d9f4b605ee0020016acf09ed3c3b1c1f058 Mon Sep 17 00:00:00 2001 From: Deni Date: Mon, 9 Jan 2023 16:52:35 +0300 Subject: [PATCH] Fix bug with multivalue best PB ties --- android/app/build.gradle | 2 +- android/app/src/main/assets/index.android.bundle | 2 +- app/components/Entry.tsx | 15 +++++++++------ ios/Stat_Tracker.xcodeproj/project.pbxproj | 4 ++-- ios/Stat_Tracker/Info.plist | 2 +- ios/Stat_TrackerTests/Info.plist | 2 +- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index e735ac6..6429a2b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -139,7 +139,7 @@ android { applicationId "com.stat_tracker" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 16 + versionCode 17 versionName "0.5.2" buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() diff --git a/android/app/src/main/assets/index.android.bundle b/android/app/src/main/assets/index.android.bundle index f1229f6..3e4ce78 100644 --- a/android/app/src/main/assets/index.android.bundle +++ b/android/app/src/main/assets/index.android.bundle @@ -553,7 +553,7 @@ __d(function(g,r,i,a,m,e,d){},546,[]); __d(function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){var o=t.useContext(r(d[3]).NavigationHelpersContext),f=t.useContext(n.default);return t.useCallback(function(t,n){var l=f.options;if(!1!==(null==l?void 0:l.enabled)){var c=o?u(o,{index:0,routes:[{name:t,params:n}]}):{index:0,routes:[{name:t,params:n}]},s=null!=l&&l.getPathFromState?l.getPathFromState(c,null==l?void 0:l.config):(0,r(d[3]).getPathFromState)(c,null==l?void 0:l.config);return s}},[f,o])};var t=(function(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=o(n);if(u&&u.has(t))return u.get(t);var f={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var s=l?Object.getOwnPropertyDescriptor(t,c):null;s&&(s.get||s.set)?Object.defineProperty(f,c,s):f[c]=t[c]}f.default=t,u&&u.set(t,f);return f})(r(d[0])),n=r(d[1])(r(d[2]));function o(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(o=function(t){return t?u:n})(t)}var u=function t(n,o){var u=n.getParent();if(u){var f=u.getState();return t(u,{index:0,routes:[Object.assign({},f.routes[f.index],{state:o})]})}return o}},547,[124,3,457,459]); __d(function(g,r,i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.default=function(t){var o=(0,r(d[1]).useNavigation)(),u=(0,r(d[1]).useRoute)();e.useEffect(function(){for(var e=[],c=o;c;)'tab'===c.getState().type&&e.push(c),c=c.getParent();if(0!==e.length){var l=e.map(function(c){return c.addListener('tabPress',function(c){var l=o.isFocused(),f=e.includes(o)||o.getState().routes[0].key===u.key;requestAnimationFrame(function(){var e=n(t);l&&f&&e&&!c.defaultPrevented&&('scrollToTop'in e?e.scrollToTop():'scrollTo'in e?e.scrollTo({y:0,animated:!0}):'scrollToOffset'in e?e.scrollToOffset({offset:0,animated:!0}):'scrollResponderScrollTo'in e&&e.scrollResponderScrollTo({y:0,animated:!0}))})})});return function(){l.forEach(function(e){return e()})}}},[o,t,u.key])};var e=(function(e,n){if(!n&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var o=t(n);if(o&&o.has(e))return o.get(e);var u={},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if("default"!==l&&Object.prototype.hasOwnProperty.call(e,l)){var f=c?Object.getOwnPropertyDescriptor(e,l):null;f&&(f.get||f.set)?Object.defineProperty(u,l,f):u[l]=e[l]}u.default=e,o&&o.set(e,u);return u})(r(d[0]));function t(e){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(t=function(e){return e?o:n})(e)}function n(e){return null==e.current?null:'scrollToTop'in e.current||'scrollTo'in e.current||'scrollToOffset'in e.current||'scrollResponderScrollTo'in e.current?e.current:'getScrollResponder'in e.current?e.current.getScrollResponder():'getNode'in e.current?e.current.getNode():e.current}},548,[124,459]); __d(function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=c(r(d[0])),n=r(d[1]),o=r(d[2])(r(d[3])),u=c(r(d[4])),l=r(d[2])(r(d[5]));function s(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(s=function(t){return t?o:n})(t)}function c(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=s(n);if(o&&o.has(t))return o.get(t);var u={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var f=l?Object.getOwnPropertyDescriptor(t,c):null;f&&(f.get||f.set)?Object.defineProperty(u,c,f):u[c]=t[c]}return u.default=t,o&&o.set(t,u),u}var f=n.StyleSheet.create({addButton:Object.assign({position:'absolute',display:'flex',justifyContent:'center',alignItems:'center',bottom:24,right:20,height:60,width:60,borderRadius:50,backgroundColor:'red'},u.largeShadow)}),y=function(s){var c=s.navigation,y=(0,r(d[6]).useDispatch)(),p=(0,r(d[6]).useSelector)(function(t){return t.main}),h=p.statCategory,j=p.entries;(0,t.useEffect)(function(){c.setOptions({title:h.name})},[c]);var v=function(t){c.navigate('AddEditEntry',{entry:t})},b=function(t){n.Alert.alert('Confirmation','Are you sure you want to delete the entry?',[{text:'Cancel'},{text:'Ok',onPress:function(){return y((0,r(d[7]).deleteEntry)(t))}}])};return(0,r(d[8]).jsxs)(n.View,{style:u.default.scrollContainer,children:[j.length>0?(0,r(d[8]).jsx)(n.FlatList,{numColumns:1,keyExtractor:function(t){return String(t.id)},data:j,renderItem:function(t){var n=t.item;return(0,r(d[8]).jsx)(l.default,{entry:n,onDeleteEntry:b,onEditEntry:v})},ListFooterComponent:(0,r(d[8]).jsx)(n.View,{style:{height:95}})}):(0,r(d[8]).jsx)(n.Text,{style:u.default.infoText,children:"Press + to add a stat entry"}),(0,r(d[8]).jsx)(n.TouchableOpacity,{style:f.addButton,onPress:function(){return c.navigate('AddEditEntry')},children:(0,r(d[8]).jsx)(o.default,{name:"plus",size:22,color:"white"})})]})};e.default=y},549,[124,1,3,405,402,550,419,379,177]); -__d(function(g,r,_i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;r(d[0])(r(d[1]));var t=r(d[2]),l=(function(t,l){if(!l&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=s(l);if(n&&n.has(t))return n.get(t);var i={},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if("default"!==o&&Object.prototype.hasOwnProperty.call(t,o)){var c=u?Object.getOwnPropertyDescriptor(t,o):null;c&&(c.get||c.set)?Object.defineProperty(i,o,c):i[o]=t[o]}i.default=t,n&&n.set(t,i);return i})(r(d[3])),n=r(d[0])(r(d[4]));function s(t){if("function"!=typeof WeakMap)return null;var l=new WeakMap,n=new WeakMap;return(s=function(t){return t?n:l})(t)}var i=t.StyleSheet.create({PBStyle:{color:l.blue,fontWeight:'bold'},yearPBStyle:{color:l.lightBlue,fontWeight:'bold'},monthPBStyle:{color:l.green,fontWeight:'bold'}}),u=function(s){var u=s.entry,o=s.onDeleteEntry,c=s.onEditEntry,y=(0,r(d[5]).useSelector)(function(t){return t.main}).statTypes,f=function(t,l,n){return n.val?{}:null!=l&&l.trackPBs&&l.pbs.allTime.entryId.best===u.id&&l.pbs.allTime.result.best===t?i.PBStyle:null!=l&&l.trackYearPBs&&l.pbs.year.entryId.best===u.id&&l.pbs.year.result.best===t?i.yearPBStyle:null!=l&&l.trackMonthPBs&&l.pbs.month.entryId.best===u.id&&l.pbs.month.result.best===t?i.monthPBStyle:{}},h=function(l,n,s){var o,c,y,f,h,v,b,p;return b=null!=n&&n.trackPBs&&(null==(o=n.pbs)?void 0:null==(c=o.allTime)?void 0:c.entryId[s])===u.id?i.PBStyle:null!=n&&n.trackYearPBs&&(null==(y=n.pbs)?void 0:null==(f=y.year)?void 0:f.entryId[s])===u.id?i.yearPBStyle:null!=n&&n.trackMonthPBs&&(null==(h=n.pbs)?void 0:null==(v=h.month)?void 0:v.entryId[s])===u.id?i.monthPBStyle:{},p='best'===s?n.higherIsBetter?l.multiValueStats.high:l.multiValueStats.low:l.multiValueStats[s],(0,r(d[6]).jsx)(t.Text,{style:b,children:p})};return(0,r(d[6]).jsxs)(t.TouchableOpacity,{onPress:function(){return c(u)},style:l.default.bigCard,children:[(0,r(d[7]).sortStats)(u.stats,y).map(function(n){var s,i,o=y.find(function(t){return t.id===n.type}),c=(null==o?void 0:o.showBest)&&n.values.length>1,v=(null==o?void 0:o.showAvg)&&(n.values.length>1||(null==(s=o.pbs)?void 0:s.allTime.entryId.avg)===u.id),b=(null==o?void 0:o.showSum)&&(n.values.length>1||(null==(i=o.pbs)?void 0:i.allTime.entryId.sum)===u.id),p={val:!1};return(0,r(d[6]).jsxs)(t.View,{children:[(0,r(d[6]).jsxs)(t.Text,{style:l.default.textMar,children:[(0,r(d[6]).jsxs)(t.Text,{style:l.default.darkGrayText,children:[(null==o?void 0:o.name)||'(Deleted)',": "]}),n.values.map(function(l,s){return(0,r(d[6]).jsxs)(t.Text,{children:[(0,r(d[6]).jsx)(t.Text,{style:f(l,o,p),children:(null==o?void 0:o.variant)!==r(d[8]).StatTypeVariant.MULTIPLE_CHOICE?l:o.choices.find(function(t){return t.id===l}).label}),(null==o?void 0:o.unit)&&" "+(null==o?void 0:o.unit),s!==n.values.length-1&&', ']},s)})]}),(c||v||b)&&(0,r(d[6]).jsxs)(t.Text,{style:Object.assign({},l.default.darkGrayText,{marginLeft:14,marginBottom:8,fontSize:16}),children:[c&&(0,r(d[6]).jsxs)(r(d[6]).Fragment,{children:["Best: ",h(n,o,'best'),"\u2002"]}),v&&(0,r(d[6]).jsxs)(r(d[6]).Fragment,{children:["Avg: ",h(n,o,'avg'),"\u2002"]}),b&&(0,r(d[6]).jsxs)(r(d[6]).Fragment,{children:["Sum: ",h(n,o,'sum')]})]})]},n.id)}),''!==u.comment&&(0,r(d[6]).jsx)(t.Text,{style:Object.assign({},l.default.commentText,{color:u.stats.length>=1?'#555':'black'}),children:u.comment}),u.date&&(0,r(d[6]).jsx)(t.Text,{style:l.default.smallGrayText,children:(0,r(d[7]).formatIDate)(u.date)}),(0,r(d[6]).jsx)(t.View,{style:l.default.cardButtons,children:(0,r(d[6]).jsx)(n.default,{onPress:function(){return o(u)}})})]})};e.default=u},550,[3,124,1,402,404,419,177,389,388]); +__d(function(g,r,_i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;r(d[0])(r(d[1]));var t=r(d[2]),l=(function(t,l){if(!l&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=s(l);if(n&&n.has(t))return n.get(t);var i={},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if("default"!==o&&Object.prototype.hasOwnProperty.call(t,o)){var c=u?Object.getOwnPropertyDescriptor(t,o):null;c&&(c.get||c.set)?Object.defineProperty(i,o,c):i[o]=t[o]}i.default=t,n&&n.set(t,i);return i})(r(d[3])),n=r(d[0])(r(d[4]));function s(t){if("function"!=typeof WeakMap)return null;var l=new WeakMap,n=new WeakMap;return(s=function(t){return t?n:l})(t)}var i=t.StyleSheet.create({PBStyle:{color:l.blue,fontWeight:'bold'},yearPBStyle:{color:l.lightBlue,fontWeight:'bold'},monthPBStyle:{color:l.green,fontWeight:'bold'}}),u=function(s){var u=s.entry,o=s.onDeleteEntry,c=s.onEditEntry,y=(0,r(d[5]).useSelector)(function(t){return t.main}).statTypes,f=function(t,l,n){return n.val?{}:null!=l&&l.trackPBs&&l.pbs.allTime.entryId.best===u.id&&l.pbs.allTime.result.best===t?(n.val=!0,i.PBStyle):null!=l&&l.trackYearPBs&&l.pbs.year.entryId.best===u.id&&l.pbs.year.result.best===t?(n.val=!0,i.yearPBStyle):null!=l&&l.trackMonthPBs&&l.pbs.month.entryId.best===u.id&&l.pbs.month.result.best===t?(n.val=!0,i.monthPBStyle):{}},h=function(l,n,s){var o,c,y,f,h,v,b,p;return b=null!=n&&n.trackPBs&&(null==(o=n.pbs)?void 0:null==(c=o.allTime)?void 0:c.entryId[s])===u.id?i.PBStyle:null!=n&&n.trackYearPBs&&(null==(y=n.pbs)?void 0:null==(f=y.year)?void 0:f.entryId[s])===u.id?i.yearPBStyle:null!=n&&n.trackMonthPBs&&(null==(h=n.pbs)?void 0:null==(v=h.month)?void 0:v.entryId[s])===u.id?i.monthPBStyle:{},p='best'===s?n.higherIsBetter?l.multiValueStats.high:l.multiValueStats.low:l.multiValueStats[s],(0,r(d[6]).jsx)(t.Text,{style:b,children:p})};return(0,r(d[6]).jsxs)(t.TouchableOpacity,{onPress:function(){return c(u)},style:l.default.bigCard,children:[(0,r(d[7]).sortStats)(u.stats,y).map(function(n){var s,i,o=y.find(function(t){return t.id===n.type}),c=(null==o?void 0:o.showBest)&&n.values.length>1,v=(null==o?void 0:o.showAvg)&&(n.values.length>1||(null==(s=o.pbs)?void 0:s.allTime.entryId.avg)===u.id),b=(null==o?void 0:o.showSum)&&(n.values.length>1||(null==(i=o.pbs)?void 0:i.allTime.entryId.sum)===u.id),p={val:!1};return(0,r(d[6]).jsxs)(t.View,{children:[(0,r(d[6]).jsxs)(t.Text,{style:l.default.textMar,children:[(0,r(d[6]).jsxs)(t.Text,{style:l.default.darkGrayText,children:[(null==o?void 0:o.name)||'(Deleted)',": "]}),n.values.map(function(l,s){return(0,r(d[6]).jsxs)(t.Text,{children:[(0,r(d[6]).jsx)(t.Text,{style:f(l,o,p),children:(null==o?void 0:o.variant)!==r(d[8]).StatTypeVariant.MULTIPLE_CHOICE?l:o.choices.find(function(t){return t.id===l}).label}),(null==o?void 0:o.unit)&&" "+(null==o?void 0:o.unit),s!==n.values.length-1&&', ']},s)})]}),(c||v||b)&&(0,r(d[6]).jsxs)(t.Text,{style:Object.assign({},l.default.darkGrayText,{marginLeft:14,marginBottom:8,fontSize:16}),children:[c&&(0,r(d[6]).jsxs)(r(d[6]).Fragment,{children:["Best: ",h(n,o,'best'),"\u2002"]}),v&&(0,r(d[6]).jsxs)(r(d[6]).Fragment,{children:["Avg: ",h(n,o,'avg'),"\u2002"]}),b&&(0,r(d[6]).jsxs)(r(d[6]).Fragment,{children:["Sum: ",h(n,o,'sum')]})]})]},n.id)}),''!==u.comment&&(0,r(d[6]).jsx)(t.Text,{style:Object.assign({},l.default.commentText,{color:u.stats.length>=1?'#555':'black'}),children:u.comment}),u.date&&(0,r(d[6]).jsx)(t.Text,{style:l.default.smallGrayText,children:(0,r(d[7]).formatIDate)(u.date)}),(0,r(d[6]).jsx)(t.View,{style:l.default.cardButtons,children:(0,r(d[6]).jsx)(n.default,{onPress:function(){return o(u)}})})]})};e.default=u},550,[3,124,1,402,404,419,177,389,388]); __d(function(g,r,_i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=r(d[0])(r(d[1])),n=r(d[0])(r(d[2])),l=h(r(d[3])),u=r(d[4]),i=r(d[0])(r(d[5])),o=h(r(d[6])),s=r(d[0])(r(d[7])),f=r(d[0])(r(d[8])),c=r(d[0])(r(d[9])),p=r(d[0])(r(d[10])),y=r(d[0])(r(d[11]));function v(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,l=new WeakMap;return(v=function(t){return t?l:n})(t)}function h(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var l=v(n);if(l&&l.has(t))return l.get(t);var u={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if("default"!==o&&Object.prototype.hasOwnProperty.call(t,o)){var s=i?Object.getOwnPropertyDescriptor(t,o):null;s&&(s.get||s.set)?Object.defineProperty(u,o,s):u[o]=t[o]}return u.default=t,l&&l.set(t,u),u}var x=u.StyleSheet.create({nameView:{flexDirection:'row',justifyContent:'space-between',alignItems:'center',marginVertical:o.mdGap,padding:o.xxsGap,borderWidth:1,borderColor:'grey'},date:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',marginBottom:o.mdGap}}),j=function(v){var h=v.navigation,j=v.route,S=(0,r(d[12]).useDispatch)(),b=(0,r(d[12]).useSelector)(function(t){return t.main}),w=b.statCategory,E=b.statTypes,T=(0,l.useState)(null),V=(0,n.default)(T,2),O=V[0],P=V[1],C=(0,l.useState)([]),M=(0,n.default)(C,2),k=M[0],A=M[1],D=(0,l.useState)([]),I=(0,n.default)(D,2),N=I[0],B=I[1],_=(0,l.useState)(E[0]||null),L=(0,n.default)(_,2),U=L[0],W=L[1],Y=(0,l.useState)(['']),F=(0,n.default)(Y,2),G=F[0],H=F[1],R=(0,l.useState)(''),z=(0,n.default)(R,2),q=z[0],J=z[1],K=(0,l.useState)(new Date),Q=(0,n.default)(K,2),X=Q[0],Z=Q[1],$=(0,l.useState)(!1),tt=(0,n.default)($,2),et=tt[0],nt=tt[1],rt=(0,l.useState)(!1),at=(0,n.default)(rt,2),lt=at[0],ut=at[1],it=j.params;(0,l.useEffect)(function(){if(null!=it&&it.entry||O?h.setOptions({title:'Edit Entry'}):(h.setOptions({title:'Add Entry'}),null!=it&&it.statType||E.forEach(function(t){t.defaultValue&&ft(t)})),null!=it&&it.entry){var t=it.entry;P(t.id),A(t.stats),J(t.comment),t.date?Z(new Date(t.date.year,t.date.month-1,t.date.day)):Z(null)}else null!=it&&it.statType&&(it.statType.defaultValue&&!G.find(function(t){return''!==t})?ft(it.statType):pt(it.statType,it.newStatType?'added':'edited'))},[it]),(0,l.useEffect)(function(){vt()},[E,k]);var ot=function(t){if(0===t.stats.length&&0===t.comment.length)return u.Alert.alert('Error','Please create a stat or write a comment',[{text:'Ok'}]),!1;var n=function(t){if(!E.find(function(n){return n.id===t.type}))return u.Alert.alert('Error','Please make sure all stats have a stat type',[{text:'Ok'}]),{v:!1}};for(var l of t.stats){var i=n(l);if("object"==typeof i)return i.v}return!0},st=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(!U)return t&&u.Alert.alert('Error','Please choose a stat type',[{text:'Ok'}]),!1;if(!U.multipleValues&&G.filter(function(t){return''!==t}).length>1)return t&&u.Alert.alert('Error','This stat type does not allow multiple values. Please select a different stat type or enter just one value.',[{text:'Ok'}]),!1;if(!G.find(function(t){return''!==t}))return t&&u.Alert.alert('Error','Please enter a stat value',[{text:'Ok'}]),!1;if(U.variant===r(d[13]).StatTypeVariant.NUMBER&&G.find(function(t){return isNaN(Number(t))})){if(t){var n=U.multipleValues?'All values must be numeric for this stat type':'The value must be numeric for this stat type';u.Alert.alert('Error',n,[{text:'Ok'}])}return!1}return!0},ft=function(n){var l={id:n.id,type:n.id,values:[n.defaultValue]};A(function(n){return[].concat((0,t.default)(n),[l])})},dt=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:k,l=G.filter(function(t){return''!==t}),u={};U.variant===r(d[13]).StatTypeVariant.NUMBER&&(l=l.map(function(t){return Number(t)}),U.multipleValues&&(u.sum=l.reduce(function(t,n){return t+n},0),u.low=Math.min.apply(Math,(0,t.default)(l)),u.high=Math.max.apply(Math,(0,t.default)(l)),u.avg=Math.round(100*(u.sum/l.length+Number.EPSILON))/100));var i={id:U.id,type:U.id,values:l};return Object.keys(u).length>0&&(i.multiValueStats=u),[].concat((0,t.default)(n),[i])},ct=function(){return G.filter(function(t){return''!==t}).length>1?'values':'value'},pt=function(n){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'select';if(n.variant!==r(d[13]).StatTypeVariant.MULTIPLE_CHOICE){var i=G.filter(function(t){return''!==t});if(i.length>1&&!n.multipleValues){var o="The stat you just "+l+" does not allow multiple values, so it's not possible to switch to it automatically.";u.Alert.alert('Notice','select'===l?'You cannot select this stat type, because you have multiple values entered and this stat type does not allow that':o,[{text:'Ok'}])}else n.multipleValues&&G.length===i.length?H(function(n){return[].concat((0,t.default)(n),[''])}):n.multipleValues||H(1===i.length?i:['']),W(n)}else if(G.find(function(t){return''!==t})){var s="This is a multiple choice stat type. If you proceed, the "+ct()+" you have entered will be lost. Proceed?",f="You have created a multiple choice stat type. If you switch to it, the "+ct()+" you have entered will be lost. Switch to the new stat type?";u.Alert.alert('select'===l?'Warning':'Notice','select'===l?s:f,[{text:'Cancel'},{text:'Yes',onPress:function(){H(['']),W(n)}}])}else H(['']),W(n)},yt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;ut(!1);var n=t?{statType:t}:void 0;h.navigate('AddEditStatType',n)},vt=function(){var t=E.filter(function(t){return!k.find(function(n){return n.type===t.id})});if(0===t.length)W(null);else if(U&&!t.find(function(t){return t.id===U.id})){var n=null,l=function(l){if(l.order>=U.order&&t.find(function(t){return t.id===l.id}))return n=l,"break"};for(var u of E)if("break"===l(u))break;null===n&&(n=t[0]),W(n)}B(t)};return(0,r(d[15]).jsx)(u.View,{style:o.default.scrollContainer,children:(0,r(d[15]).jsxs)(u.ScrollView,{keyboardShouldPersistTaps:"always",style:o.default.scrollableArea,children:[k.length>0&&(0,r(d[15]).jsx)(y.default,{stats:k,deleteEditStat:function(n){var l=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(l&&G.find(function(t){return''!==t}))u.Alert.alert('Notice','Please enter your current stat or clear it',[{text:'Ok'}]);else if(A(function(t){return t.filter(function(t){return t.id!==n.id})}),l){var i=E.find(function(t){return t.id===n.type});if((null==i?void 0:i.variant)!==r(d[13]).StatTypeVariant.MULTIPLE_CHOICE){var o=null!=i&&i.multipleValues?[].concat((0,t.default)(n.values),['']):n.values;H(o.map(function(t){return String(t)}))}else H(['']);W(E.find(function(t){return t.id===n.type})||null)}}}),(0,r(d[15]).jsx)(p.default,{modalOpen:lt,setStatModalOpen:ut,filteredStatTypes:N,selectStatType:pt,onAddEditStatType:yt}),(0,r(d[15]).jsxs)(u.View,{style:x.nameView,children:[U?(0,r(d[15]).jsxs)(u.Text,{style:Object.assign({},o.default.text,{flex:1,marginVertical:6}),children:[U.name,U.unit?" ("+U.unit+")":'']}):(0,r(d[15]).jsx)(u.Text,{style:Object.assign({},o.default.text,{flex:1,marginVertical:6}),children:"Stat"}),0===N.length?(0,r(d[15]).jsx)(u.Button,{onPress:function(){return yt()},title:"Create Stat",color:"green"}):(0,r(d[15]).jsx)(u.Button,{onPress:function(){return ut(!0)},title:"Change Stat",color:"blue"})]}),(null==U?void 0:U.variant)!==r(d[13]).StatTypeVariant.MULTIPLE_CHOICE?(0,r(d[15]).jsxs)(r(d[15]).Fragment,{children:[(0,r(d[15]).jsx)(f.default,{values:G,setValues:H,placeholder:"Value",numeric:(null==U?void 0:U.variant)===r(d[13]).StatTypeVariant.NUMBER,allowMultiple:null==U?void 0:U.multipleValues}),(0,r(d[15]).jsx)(u.Button,{color:st(!1)?'green':'grey',title:"Add Stat",onPress:function(){st()&&(A(function(t){return dt(t)}),H(['']))}})]}):(0,r(d[15]).jsx)(c.default,{options:U.choices.map(function(t){return{label:t.label,value:t.id}}),selected:U.defaultValue||0,onSelect:function(n){A(function(l){return[].concat((0,t.default)(l),[{id:U.id,type:U.id,values:[n]}])})}}),(0,r(d[15]).jsx)(s.default,{}),(0,r(d[15]).jsx)(u.TextInput,{style:o.default.input,placeholder:"Comment",placeholderTextColor:"grey",multiline:!0,value:q,onChangeText:function(t){t!==q&&J(t)}}),(0,r(d[15]).jsxs)(u.View,{style:x.date,children:[(0,r(d[15]).jsx)(u.Text,{style:o.default.text,children:X?(0,r(d[16]).formatDate)(X):'No date'}),X?(0,r(d[15]).jsxs)(r(d[15]).Fragment,{children:[(0,r(d[15]).jsxs)(u.View,{style:{flexDirection:'row'},children:[(0,r(d[15]).jsx)(u.Button,{onPress:function(){return nt(!0)},title:"Edit",color:"blue"}),(0,r(d[15]).jsx)(s.default,{}),(0,r(d[15]).jsx)(u.Button,{onPress:function(){return Z(null)},title:"Delete",color:"red"})]}),(0,r(d[15]).jsx)(i.default,{modal:!0,mode:"date",open:et,date:X,onConfirm:function(t){nt(!1),Z(t)},onCancel:function(){return nt(!1)}})]}):(0,r(d[15]).jsx)(u.Button,{onPress:function(){return Z(new Date)},title:"Add Date",color:"green"})]}),(0,r(d[15]).jsx)(u.Button,{onPress:function(){var t=!!G.find(function(t){return''!==t});if(!t||st()){var n={id:O||w.lastEntryId+1,stats:t?dt():k,comment:q};X&&(n.date={day:X.getDate(),month:X.getMonth()+1,year:X.getFullYear()}),ot(n)&&(S(O?(0,r(d[14]).editEntry)(n):(0,r(d[14]).addEntry)(n)),h.goBack())}},title:O?'Edit Entry':'Add Entry',color:O?'blue':'red'}),(0,r(d[15]).jsx)(s.default,{size:"lg"})]})})};e.default=j},551,[3,6,22,124,1,552,402,557,558,559,560,561,419,388,379,177,389]); __d(function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=r(d[0])(r(d[1])),o=r(d[2]),n=r(d[0])(r(d[3])),l=r(d[0])(r(d[4])),c=r(d[0])(r(d[5])),u=o.Platform.select({android:l.default,ios:n.default});u.propTypes=c.default;var f=function(t){return t.theme?t.theme:o.Appearance?o.Appearance.getColorScheme():'auto'},x=function(t){return t.textColor?t.textColor:'dark'===f(t)?'white':void 0},v=function(t){var o=t.modal,n=t.androidVariant;return n||(o?'nativeAndroid':'iosClone')},T=function(t){var o=t.title,n=t.mode;return null===o?'':o||('time'===n?'Select time':'Select date')},C=t.default.memo(function(t){return(0,r(d[6]).jsx)(u,Object.assign({ref:t.innerRef},t,{textColor:(0,r(d[7]).colorToHex)(x(t)),theme:f(t),fadeToColor:(0,r(d[7]).colorToHex)(t.fadeToColor),title:T(t),confirmText:t.confirmText?t.confirmText:'Confirm',cancelText:t.cancelText?t.cancelText:'Cancel',androidVariant:v(t),minuteInterval:t.minuteInterval?t.minuteInterval:1,mode:t.mode?t.mode:'datetime'}))});e.default=C},552,[3,124,1,553,554,555,177,556]); __d(function(g,r,i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.default=void 0;var e=r(d[0])(r(d[1])),t=r(d[0])(r(d[2])),n=r(d[0])(r(d[3])),o=r(d[0])(r(d[4])),u=r(d[0])(r(d[5])),s=r(d[0])(r(d[6])),c=r(d[7]);function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}var f=(0,c.requireNativeComponent)('RNDatePicker'),p=(function(s){(0,n.default)(C,s);var p,v,y=(p=C,v=l(),function(){var e,t=(0,u.default)(p);if(v){var n=(0,u.default)(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return(0,o.default)(this,e)});function C(){var t;(0,e.default)(this,C);for(var n=arguments.length,o=new Array(n),u=0;u { diff --git a/ios/Stat_Tracker.xcodeproj/project.pbxproj b/ios/Stat_Tracker.xcodeproj/project.pbxproj index 42d450e..ea7c8b1 100644 --- a/ios/Stat_Tracker.xcodeproj/project.pbxproj +++ b/ios/Stat_Tracker.xcodeproj/project.pbxproj @@ -485,7 +485,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 16; + CURRENT_PROJECT_VERSION = 17; ENABLE_BITCODE = NO; INFOPLIST_FILE = Stat_Tracker/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -511,7 +511,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 16; + CURRENT_PROJECT_VERSION = 17; INFOPLIST_FILE = Stat_Tracker/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/ios/Stat_Tracker/Info.plist b/ios/Stat_Tracker/Info.plist index 9430400..ef94126 100644 --- a/ios/Stat_Tracker/Info.plist +++ b/ios/Stat_Tracker/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 16 + 17 LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/ios/Stat_TrackerTests/Info.plist b/ios/Stat_TrackerTests/Info.plist index f50a510..facb7d0 100644 --- a/ios/Stat_TrackerTests/Info.plist +++ b/ios/Stat_TrackerTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 16 + 17