Hotfix/cannon commons

This change is

Reviewed 35 of 35 files at r1.
Review status: all files reviewed at latest revision, 54 unresolved discussions.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 13 at r1 (raw file):

private let SECONDS_IN_WEEK = 604800 as Double

class CannonCommonsDatePickerViewController: ByuViewController2, UITableViewDataSource {

Could we use a ByuTableDataViewController here?

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 31 at r1 (raw file):

        datePicker.minimumDate = Date(timeIntervalSinceNow: SECONDS_IN_WEEK * -2)

        let defaults = UserDefaults.standard

inline

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 32 at r1 (raw file):

        let defaults = UserDefaults.standard
        if !defaults.bool(forKey: "hasSeenBYUDiningDisclaimer") {

Let's save this as a private let at the top (outside of the class). "DISCLAIMER_KEY"

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 47 at r1 (raw file):

    }

    @IBAction func datePickerValueChanged(_ sender: Any) {

Let's put this down in a //MARK Listeners at the bottom (right above custom functions)

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 62 at r1 (raw file):

            vc.selectedDate = datePicker.date
            vc.selectedMeal = meals[indexPath.row].mealName
            vc.mealId = meals[indexPath.row].mealID

Let's lower case mealID to be mealId

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 69 at r1 (raw file):

    func numberOfSections(in tableView: UITableView) -> Int {
        return 1

Is this not default? I think you might be able to remove this one... Maybe not. Give it a try though

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 83 at r1 (raw file):

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        if let cell = tableView.dequeueReusableCell(withIdentifier: "cell") {

Didn't we make something default to this? Is that only with TableData?

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 96 at r1 (raw file):

    private func getMenus() {
        tableView.isUserInteractionEnabled = false

I don't think you need this if the data load all happens at once. Are you aware of any time the table would reload?

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 103 at r1 (raw file):

        CannonCommonsClient.getMeals(serveDate: serveDate) { (meals, error) in
            self.tableView.isUserInteractionEnabled = true

Remove this as well?

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 106 at r1 (raw file):

            self.spinner.stopAnimating()

            if let tempMeals = meals {

Just call this meals instead of tempMeals

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 107 at r1 (raw file):

            if let tempMeals = meals {
                self.meals = self.sortMealsByMeal(meals: tempMeals)

Can't we use the sort function that's already built in rather than implementing our own sort function?

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 118 at r1 (raw file):

        var newMeals = [CannonCommonsMeal]()
        for currentMeal in meals {
            for newMeal in newMeals {

I'm not sure that this logic is doing what it was meant to... newMeals will always be empty the first time through, and then each time will gain the first meal from the previous iteration. This seems very convoluded. What is this supposed to be doing?

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 128 at r1 (raw file):

    }

    private func compareMeals(meal1: CannonCommonsMeal, meal2: CannonCommonsMeal) -> Int {

It feels like we could do this with a comparator rather than implementing our own compare function

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 19 at r1 (raw file):

    //MARK: Properties

    var allergens = [String]()

Can either of these be private? Who all needs the allergens and selectedAllergens?

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 27 at r1 (raw file):

        tableView.hideEmptyCells()
        tableView.variableHeightForRows()
        allergens = CannonCommonsAllergenFilter.getAllPossibleFilters()

Why are we setting these here? Shouldn't they be set when the service returns to the stations VC?

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 38 at r1 (raw file):

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        if let cell = tableView.dequeueReusableCell(withIdentifier: "cell") as? CannonCommonsFilterTableViewCell {

Didn't we make an extension so that "cell" was the default? If not, can we?

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 41 at r1 (raw file):

            cell.textLabel?.text = allergens[indexPath.row]
            //Indicate if the cell has been previously selected and add accessory
            cell.setFilterSelection(selected: selectedAllergens.contains(allergens[indexPath.row]))

We can probably just override the setSelected method

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 53 at r1 (raw file):

        //If the cell was previously selected, make it deselected and vice-versa
        cell?.toggleFilterSelection()

We can probably just call this toggleSelected and have it return a boolean of whether it is now selected. That would combine this line and the one beneath it

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 66 at r1 (raw file):

    @IBAction func done(_ sender: Any) {
        //Set filter options will change the static variables in teh AllergensFilter object and will return if anything actually updated

type o

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 67 at r1 (raw file):

    @IBAction func done(_ sender: Any) {
        //Set filter options will change the static variables in teh AllergensFilter object and will return if anything actually updated
        if CannonCommonsAllergenFilter.setFilters(allergens: selectedAllergens) {

rename function updateFilter(allergens:)

byuSuite/Apps/CannonCommons/controller/CannonCommonsFullMenuViewController.swift, line 11 at r1 (raw file):

import UIKit

class CannonCommonsFullMenuViewController: ByuSearchViewController, UITableViewDataSource {

Can we use TableDataSearchVC here?

byuSuite/Apps/CannonCommons/controller/CannonCommonsFullMenuViewController.swift, line 55 at r1 (raw file):

            let indexPath = tableView.indexPath(for: sender) {

            vc.recipe = allergenFilteredMenu[indexPath.section].1[indexPath.row]

What is this "1" here for?

byuSuite/Apps/CannonCommons/controller/CannonCommonsFullMenuViewController.swift, line 66 at r1 (raw file):

    func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
        return searchFilteredRecipes.count > 0 ? nil : " \(allergenFilteredMenu[section].0)"

What is this "0"? Is this a tuple that you're accessing? I thought it was "first" and "second".... Does ".0" and ".1" do the same thing?

byuSuite/Apps/CannonCommons/controller/CannonCommonsFullMenuViewController.swift, line 89 at r1 (raw file):

        searchFilteredRecipes.removeAll()
        if !searchText.isEmpty {
            for (_, station) in allergenFilteredMenu {

Rename station to recipes if that what it really is

byuSuite/Apps/CannonCommons/controller/CannonCommonsLegalViewController.swift, line 20 at r1 (raw file):

        super.viewDidLoad()

        navigationBar.isTranslucent = false

Didn't we make it so that we don't have to do this programmatically anymore?

byuSuite/Apps/CannonCommons/controller/CannonCommonsLegalViewController.swift, line 28 at r1 (raw file):

    @IBAction func continueButtonTapped(_ sender: Any) {
        let defaults = UserDefaults.standard
        defaults.set(true, forKey: "hasSeenBYUDiningDisclaimer")

Save this somewhere public and use in both cases

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 19 at r1 (raw file):

    //MARK: Properties

    var recipes: [CannonCommonsRecipe]!

Use () instead of !

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 27 at r1 (raw file):

        applyAllergyFilters()

        //In order to listen for the filter calling bac, must use a local notificaiton that will be called whenever filter is changed

type o

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 28 at r1 (raw file):

        //In order to listen for the filter calling bac, must use a local notificaiton that will be called whenever filter is changed
        NotificationCenter.default.addObserver(self, selector: #selector(self.allergenFilterUpdated), name: ALLERGEN_FILTER_NOTIFICATION, object: nil)

Is #selector preferred over Selector in Swift 3? Could you google that and checK?

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 60 at r1 (raw file):

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        if let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") {

Can we change this to "cell" (lower case)

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 71 at r1 (raw file):

    private func applyAllergyFilters() {
        filteredRecipes = CannonCommonsAllergenFilter.applyFilters(toStation: recipes)

Could we call this function applyFilters(toRecipes:) instead?

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 75 at r1 (raw file):

    }

    func allergenFilterUpdated() {

Put this in a //MARK called "Listeners"

byuSuite/Apps/CannonCommons/controller/CannonCommonsRecipeViewController.swift, line 11 at r1 (raw file):

import UIKit

private let ALLERGY_TITLE = " Allergy Information:"

Why are there spaces? Is this for the formatting? If so, I think we've used two spaces in the past... Check what we do in other features and make this consistent

byuSuite/Apps/CannonCommons/controller/CannonCommonsRecipeViewController.swift, line 24 at r1 (raw file):

    var recipe: CannonCommonsRecipe!
    var nutritionInfo = [(String, String)]()

I don't understand how nutritionInfo is being used. Could we get a comment here explaining what the key and value will be?

byuSuite/Apps/CannonCommons/controller/CannonCommonsRecipeViewController.swift, line 32 at r1 (raw file):

        tableView.variableHeightForRows()

        navigationItem.title = recipe.shortName

I think you can just say title = .... Try it and see

byuSuite/Apps/CannonCommons/controller/CannonCommonsRecipeViewController.swift, line 62 at r1 (raw file):

        }
        tableData?.add(section: Section(title: NUTRITION_TITLE, cellId: "NutritionInfoCell", rows: nutritionInfo.map{ Row(text: $0.0, detailText: $0.1) }))
        if recipe.ingredients != " " {

Comment here

byuSuite/Apps/CannonCommons/controller/CannonCommonsRecipeViewController.swift, line 68 at r1 (raw file):

    private func check(nutritionValue: String, against measurement:String, with key: String) {
        if !(nutritionValue == measurement) {

Comment here. Are we only adding things that have valid values?

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 36 at r1 (raw file):

    var selectedMeal: String!
    var mealId: String!
    var menu: [String: [CannonCommonsRecipe]]?

Could we make this non optional? [String: [CannonCommonsRecipe]]()

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 79 at r1 (raw file):

    func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
        if let tempMenu = menu, tempMenu.count != 0 {

Once menu is non-optional, this will change to
if menu.count != 0, let vc = viewController as? CCFMVC {
  vc.menu = menu
  return true
} else {
  //...
  return false
}

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 98 at r1 (raw file):

            self.spinner.stopAnimating()

            if let tempRecipes = recipes {

recipes = recipes. The less "temp" variables we have, the less confusing the code. Let's try to remove as many as possible. Anytime you have a function parameter or class level variable, you can reuse the name

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 101 at r1 (raw file):

                //Sort recipes by category
                var sortedRecipes = [String: [CannonCommonsRecipe]]()
                for recipe in tempRecipes {

Comments in here. It seems like what you're doing here is digging through the array and saving a dictionary with the category name as the key with all of the recipes in that category as the value. Is that correct? If so, I think the comment about Sort recipes by category is a little misleading. Maybe something like Group recipes by category?

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 111 at r1 (raw file):

                }

                self.menu = sortedRecipes

With menu already being a var, no need to create a sortedRecipes variable as well. Just use menu instead of sortedRecipes

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 114 at r1 (raw file):

                //Load Filters from Menu and enable button to access FilterVC. Use sortedRecipes to avoid force unwrapping self.menu
                CannonCommonsAllergenFilter.loadAllPossibleFilters(menu: sortedRecipes)

You pass in the whole dictionary? I think the loadAllPossibleFilters should only need the keys... Is that correct?

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 131 at r1 (raw file):

    func getKey(category: String) -> String {
        //TODO: Wall of Lettuce was put in by mistake and should be removed whenever the data has been cleaned (still has not been cleaned as of June '17)

Is this still the case? I believe this was supposed to be cleaned now. If it's not, that's okay. I'll have to contact Hans about it

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 132 at r1 (raw file):

    func getKey(category: String) -> String {
        //TODO: Wall of Lettuce was put in by mistake and should be removed whenever the data has been cleaned (still has not been cleaned as of June '17)
        let categoryMapping = [

Can we save this as a static variable at the top? Right now, it's recreating this list every time we call this function

byuSuite/Apps/CannonCommons/model/CannonCommonsAllergenFilter.swift, line 11 at r1 (raw file):

import UIKit

let ALLERGEN_FILTER_NOTIFICATION = NSNotification.Name("AllergenFilterCompleted")

Oh that's cool! Are we doing this for all notification names? We should be if we aren't yet :) Also, shouldn't this be AllergenFilterUpdated?

byuSuite/Apps/CannonCommons/model/CannonCommonsAllergenFilter.swift, line 15 at r1 (raw file):

class CannonCommonsAllergenFilter: NSObject {
    private static var allPossibileFilters = [String]()
    //Initialize selectedFilters to empty array. This is necesary because filterVC copies when loading in order to display previosuly selected allergens

type o

byuSuite/Apps/CannonCommons/model/CannonCommonsAllergenFilter.swift, line 44 at r1 (raw file):

    }

    static func getAllPossibleFilters() -> [String] {

Instead of creating getters, Swift will auto generate them for you. You just have to make the variables private(set), and it will give you a public getter. You variable at the top would look like this:
private(set) static var allPossibleFilters = [String]()

and you would access the getter just by calling CannonCommonsAllergenFilter.allPossibleFilters
However, now that I think about it, does anyone ever need to GET allPossibleFilters? It seems like it should only be set once, and then never looked at again outside of this class. I think the activeFilters is similar, but it wouldn't need a setter, just a getter.

byuSuite/Apps/CannonCommons/model/CannonCommonsAllergenFilter.swift, line 52 at r1 (raw file):

    }

    static func applyFilters(toStation station:[CannonCommonsRecipe]) -> [CannonCommonsRecipe] {

rename "toRecipes recipes"

byuSuite/Apps/CannonCommons/model/CannonCommonsClient.swift, line 12 at r1 (raw file):

private let BASE_URL = "https://api.byu.edu/domains/legacy/mobileapplications/cannoncommons/v1"
private let PATH_PARAM = "eatecexchange.ashx"

If we're only ever calling this one function, just put this into the BASE_URL and don't use any path params. Make sure that works

byuSuite/Apps/CannonCommons/model/CannonCommonsClient.swift, line 26 at r1 (raw file):

                let meals = mealsData.map{ CannonCommonsMeal(dict: $0) }
                callBack(meals, nil)

callback instead of callBack. Do the same thing below

byuSuite/Apps/CannonCommons/model/CannonCommonsMeal.swift, line 9 at r1 (raw file):

//

import UIKit

Remove. Also, check other files

byuSuite/Apps/CannonCommons/model/CannonCommonsRecipe.swift, line 9 at r1 (raw file):

//

import UIKit

Remove UIKit from all that aren't needed

byuSuite/Apps/CannonCommons/model/CannonCommonsRecipe.swift, line 28 at r1 (raw file):

        //Set allergens
        if let allAllergens = dict["allergens"] as? [String: Int] {
            //TODO: In Swift4 we should be able to use a filter and a map to do this

Could you check real quick and see when Swift 4 comes out for public use?

Comments from Reviewable

Review status: 23 of 36 files reviewed at latest revision, 54 unresolved discussions.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 31 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
inline

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 32 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Let's save this as a private let at the top (outside of the class). "DISCLAIMER_KEY"

If I make it public then I can use it in the LegalVC when we use the same key. Is that okay?

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 47 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Let's put this down in a //MARK Listeners at the bottom (right above custom functions)

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 62 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Let's lower case mealID to be mealId

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 69 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Is this not default? I think you might be able to remove this one... Maybe not. Give it a try though

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 83 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Didn't we make something default to this? Is that only with TableData?

Yeah it's only with TableData.  I'll look at using it if I can rewrite this with TableData

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 96 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
I don't think you need this if the data load all happens at once. Are you aware of any time the table would reload?

Every time they change the date it'll reload. We added this when I was working on this months ago because it would cause issues if they clicked on a meal during the data load because it was passing the old data with the new date which causes conflicting data to be passed to the service to load the menus.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 103 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Remove this as well?

See above comment.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 106 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Just call this meals instead of tempMeals

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 107 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Can't we use the sort function that's already built in rather than implementing our own sort function?

I don't think so. Because we're not sorting them alphabetically but ordering them in Breakfast, Lunch, Dinner sequence.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 118 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
I'm not sure that this logic is doing what it was meant to... newMeals will always be empty the first time through, and then each time will gain the first meal from the previous iteration. This seems very convoluded. What is this supposed to be doing?

I simply duplicated what was being done in the original objective-c code. The only difference is Swift no longer allows old c loops so I had to redo it with forin loops. But it's doing the exact same thing.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 19 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Can either of these be private? Who all needs the allergens and selectedAllergens?

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 27 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Why are we setting these here? Shouldn't they be set when the service returns to the stations VC?

We're not setting them. I'm just accessing them to use in this VC.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 38 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Didn't we make an extension so that "cell" was the default? If not, can we?

No. We tried but then you had me put it on TableData instead of as an extension.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 66 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
type o

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 67 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
rename function updateFilter(allergens:)

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFullMenuViewController.swift, line 55 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
What is this "1" here for?

Until I use TableData allergenFilteredMenu is an array of tuples.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFullMenuViewController.swift, line 66 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
What is this "0"? Is this a tuple that you're accessing? I thought it was "first" and "second".... Does ".0" and ".1" do the same thing?

In swift it's .0 and .1. There's no first or second that I can see.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFullMenuViewController.swift, line 89 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Rename station to recipes if that what it really is

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsLegalViewController.swift, line 20 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Didn't we make it so that we don't have to do this programmatically anymore?

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsLegalViewController.swift, line 28 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Save this somewhere public and use in both cases

What do you mean? This is the only place I'm doing it

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 19 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Use () instead of !

I use ! because the view cannot be opened without first setting recipes in the prepareForSegue and by using ! I won't have to force unwrap recipes each time I use it and I can use less code since I won't need to add all the if lets.

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 27 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
type o

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 28 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Is #selector preferred over Selector in Swift 3? Could you google that and checK?

From the cursory research I just did it seems like #selector is safer for whatever reason.

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 60 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Can we change this to "cell" (lower case)

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 71 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Could we call this function applyFilters(toRecipes:) instead?

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 75 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Put this in a //MARK called "Listeners"

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsRecipeViewController.swift, line 11 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Why are there spaces? Is this for the formatting? If so, I think we've used two spaces in the past... Check what we do in other features and make this consistent

We use one space in most features so that it's not perfectly level with the cell text.

byuSuite/Apps/CannonCommons/controller/CannonCommonsRecipeViewController.swift, line 32 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
I think you can just say title = .... Try it and see

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 36 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Could we make this non optional? [String: [CannonCommonsRecipe]]()

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 79 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Once menu is non-optional, this will change to
if menu.count != 0, let vc = viewController as? CCFMVC {
  vc.menu = menu
  return true
} else {
  //...
  return false
}

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 98 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
recipes = recipes. The less "temp" variables we have, the less confusing the code. Let's try to remove as many as possible. Anytime you have a function parameter or class level variable, you can reuse the name

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 111 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
With menu already being a var, no need to create a sortedRecipes variable as well. Just use menu instead of sortedRecipes

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 114 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
You pass in the whole dictionary? I think the loadAllPossibleFilters should only need the keys... Is that correct?

No. In fact it doesn't need the keys at all. It needs all the recipes. The keys here are just the station names.

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 131 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Is this still the case? I believe this was supposed to be cleaned now. If it's not, that's okay. I'll have to contact Hans about it

It is. I check specifically for it, hence the addition to the comment with the date.

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 132 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Can we save this as a static variable at the top? Right now, it's recreating this list every time we call this function

Done.

byuSuite/Apps/CannonCommons/model/CannonCommonsAllergenFilter.swift, line 11 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Oh that's cool! Are we doing this for all notification names? We should be if we aren't yet :) Also, shouldn't this be AllergenFilterUpdated?

Done.

byuSuite/Apps/CannonCommons/model/CannonCommonsAllergenFilter.swift, line 15 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
type o

Done.

byuSuite/Apps/CannonCommons/model/CannonCommonsAllergenFilter.swift, line 44 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Instead of creating getters, Swift will auto generate them for you. You just have to make the variables private(set), and it will give you a public getter. You variable at the top would look like this:
private(set) static var allPossibleFilters = [String]()

and you would access the getter just by calling CannonCommonsAllergenFilter.allPossibleFilters
However, now that I think about it, does anyone ever need to GET allPossibleFilters? It seems like it should only be set once, and then never looked at again outside of this class. I think the activeFilters is similar, but it wouldn't need a setter, just a getter.

The filterVC needs it to know which to set up already selected each time it loads.

byuSuite/Apps/CannonCommons/model/CannonCommonsAllergenFilter.swift, line 52 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
rename "toRecipes recipes"

Done.

byuSuite/Apps/CannonCommons/model/CannonCommonsClient.swift, line 12 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
If we're only ever calling this one function, just put this into the BASE_URL and don't use any path params. Make sure that works

It does.

byuSuite/Apps/CannonCommons/model/CannonCommonsClient.swift, line 26 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
callback instead of callBack. Do the same thing below

Done.

byuSuite/Apps/CannonCommons/model/CannonCommonsMeal.swift, line 9 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Remove. Also, check other files

Done.

byuSuite/Apps/CannonCommons/model/CannonCommonsRecipe.swift, line 9 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Remove UIKit from all that aren't needed

Done.

byuSuite/Apps/CannonCommons/model/CannonCommonsRecipe.swift, line 28 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Could you check real quick and see when Swift 4 comes out for public use?

Sometime in the Fall. I can't find an actual date though.

Comments from Reviewable

Reviewed 13 of 13 files at r2.
Review status: 35 of 36 files reviewed at latest revision, 19 unresolved discussions.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 32 at r1 (raw file):
Previously, ecbrady (Erik Brady) wrote…
If I make it public then I can use it in the LegalVC when we use the same key. Is that okay?

Absolutely. Just make it explicitly "public" so that nobody wonders if it was supposed to be private

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 83 at r1 (raw file):
Previously, ecbrady (Erik Brady) wrote…
Yeah it's only with TableData.  I'll look at using it if I can rewrite this with TableData

Great. Look into it :)

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 96 at r1 (raw file):
Previously, ecbrady (Erik Brady) wrote…
Every time they change the date it'll reload. We added this when I was working on this months ago because it would cause issues if they clicked on a meal during the data load because it was passing the old data with the new date which causes conflicting data to be passed to the service to load the menus.

Good call. Put a comment here about that

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 107 at r1 (raw file):
Previously, ecbrady (Erik Brady) wrote…
I don't think so. Because we're not sorting them alphabetically but ordering them in Breakfast, Lunch, Dinner sequence.

Is meals just a list of strings? Or are they objects? If they're objects, we can make the object comparable and make the B, F, D ordering work

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 118 at r1 (raw file):
Previously, ecbrady (Erik Brady) wrote…
I simply duplicated what was being done in the original objective-c code. The only difference is Swift no longer allows old c loops so I had to redo it with forin loops. But it's doing the exact same thing.

So is this ONLY sorting into Breakfast, Lunch, and Dinner? If so, I think we can come up with a much simpler way of doing it

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 63 at r2 (raw file):

    func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
        let title = " \(dayFormatter.string(from: datePicker.date))"

We really gotta figure out how we can make this default. Maybe we'll make the ByuViewController implement the viewForHeader and call this or something... Do you have any ideas to make the formatting consistent between all of our view controllers without adding a space or two every time?
If not, I think we use two spaces in most of the app. If that's so, add a space to this one

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 38 at r1 (raw file):
Previously, ecbrady (Erik Brady) wrote…
No. We tried but then you had me put it on TableData instead of as an extension.

That's right. Can we do that? It would be a really easy extension. We could even use it in the TableData extension that we wrote

byuSuite/Apps/CannonCommons/controller/CannonCommonsFullMenuViewController.swift, line 102 at r2 (raw file):

        allergenFilteredMenu.removeAll()
        //Check each station in the menu
        for (key, station) in menu {

Rename station to recipes

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 19 at r1 (raw file):
Previously, ecbrady (Erik Brady) wrote…
I use ! because the view cannot be opened without first setting recipes in the prepareForSegue and by using ! I won't have to force unwrap recipes each time I use it and I can use less code since I won't need to add all the if lets.

That makes sense. However, you wouldn't have to force unwrap if you use () either. Is there another benefit of ! over () that I'm not aware of?

byuSuite/Apps/CannonCommons/model/CannonCommonsAllergenFilter.swift, line 9 at r2 (raw file):

//

let ALLERGEN_FILTER_NOTIFICATION = NSNotification.Name("AllergenFilterUpdated")

Let's make this explicitly public

Comments from Reviewable

Reviewed 1 of 1 files at r3.
Review status: all files reviewed at latest revision, 19 unresolved discussions.

Comments from Reviewable

Reviewed 7 of 7 files at r4.
Review status: all files reviewed at latest revision, 8 unresolved discussions.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 38 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
That's right. Can we do that? It would be a really easy extension. We could even use it in the TableData extension that we wrote

Let's make sure to use this everywhere else that you can find dequeueReusableCell(withIdentifier: "cell"

Comments from Reviewable

Review status: 35 of 37 files reviewed at latest revision, 16 unresolved discussions.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 13 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Could we use a ByuTableDataViewController here?

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 32 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Absolutely. Just make it explicitly "public" so that nobody wonders if it was supposed to be private

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 83 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Great. Look into it :)

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 96 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Good call. Put a comment here about that

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 63 at r2 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
We really gotta figure out how we can make this default. Maybe we'll make the ByuViewController implement the viewForHeader and call this or something... Do you have any ideas to make the formatting consistent between all of our view controllers without adding a space or two every time?
If not, I think we use two spaces in most of the app. If that's so, add a space to this one

We definitely should find some way to make it consistent. I just did a survey of the app to see which features do which of all features that call titleForHeader. 3 apps use no spaces, 3 use 1 space, and 5 use 2. I'll use 2 here but that may be an idea for another branch to find a way to make it consistent or, at the very least, go through and make it consistent.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 38 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
That's right. Can we do that? It would be a really easy extension. We could even use it in the TableData extension that we wrote

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 53 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
We can probably just call this toggleSelected and have it return a boolean of whether it is now selected. That would combine this line and the one beneath it

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFullMenuViewController.swift, line 11 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Can we use TableDataSearchVC here?

We don't have a TAbleDataSearchVC.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFullMenuViewController.swift, line 102 at r2 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Rename station to recipes

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 19 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
That makes sense. However, you wouldn't have to force unwrap if you use () either. Is there another benefit of ! over () that I'm not aware of?

I'm not sure if it's a benefit of ! but when I change it to () it makes me force unwrap the station in the prepare for segue from stationsVC

byuSuite/Apps/CannonCommons/controller/CannonCommonsRecipeViewController.swift, line 24 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
I don't understand how nutritionInfo is being used. Could we get a comment here explaining what the key and value will be?

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsRecipeViewController.swift, line 62 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Comment here

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsRecipeViewController.swift, line 68 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Comment here. Are we only adding things that have valid values?

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsStationsViewController.swift, line 101 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Comments in here. It seems like what you're doing here is digging through the array and saving a dictionary with the category name as the key with all of the recipes in that category as the value. Is that correct? If so, I think the comment about Sort recipes by category is a little misleading. Maybe something like Group recipes by category?

Done.

byuSuite/Apps/CannonCommons/model/CannonCommonsAllergenFilter.swift, line 9 at r2 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Let's make this explicitly public

Done.

Comments from Reviewable

Reviewed 2 of 2 files at r5.
Review status: all files reviewed at latest revision, 7 unresolved discussions.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFullMenuViewController.swift, line 11 at r1 (raw file):
Previously, ecbrady (Erik Brady) wrote…
We don't have a TAbleDataSearchVC.

We don't? Could we make one? Would it be hard?

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 19 at r1 (raw file):
Previously, ecbrady (Erik Brady) wrote…
I'm not sure if it's a benefit of ! but when I change it to () it makes me force unwrap the station in the prepare for segue from stationsVC

Hmm... Show me this one. I think we can get around it

Comments from Reviewable

Review status: all files reviewed at latest revision, 8 unresolved discussions.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 63 at r2 (raw file):
Previously, ecbrady (Erik Brady) wrote…
We definitely should find some way to make it consistent. I just did a survey of the app to see which features do which of all features that call titleForHeader. 3 apps use no spaces, 3 use 1 space, and 5 use 2. I'll use 2 here but that may be an idea for another branch to find a way to make it consistent or, at the very least, go through and make it consistent.

Ouch. Let's look into this together as well. I think we can do it

Comments from Reviewable

Review status: all files reviewed at latest revision, 7 unresolved discussions.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 38 at r1 (raw file):
Previously, ecbrady (Erik Brady) wrote…
Done.

Done.

Comments from Reviewable

Review status: 30 of 47 files reviewed at latest revision, 6 unresolved discussions.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 107 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Is meals just a list of strings? Or are they objects? If they're objects, we can make the object comparable and make the B, F, D ordering work

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 118 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
So is this ONLY sorting into Breakfast, Lunch, and Dinner? If so, I think we can come up with a much simpler way of doing it

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 128 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
It feels like we could do this with a comparator rather than implementing our own compare function

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFilterViewController.swift, line 41 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
We can probably just override the setSelected method

Done.

byuSuite/Apps/CannonCommons/controller/CannonCommonsMenuViewController.swift, line 19 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Hmm... Show me this one. I think we can get around it

Done.

Comments from Reviewable

Review status: 30 of 47 files reviewed at latest revision, all discussions resolved.

byuSuite/Apps/CannonCommons/controller/CannonCommonsDatePickerViewController.swift, line 63 at r2 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
Ouch. Let's look into this together as well. I think we can do it

Later. It wouldn't work here.

byuSuite/Apps/CannonCommons/controller/CannonCommonsFullMenuViewController.swift, line 11 at r1 (raw file):
Previously, romrell4 (Eric Romrell) wrote…
We don't? Could we make one? Would it be hard?

Maybe later

Comments from Reviewable

Reviewed 17 of 17 files at r6, 1 of 1 files at r7.
Review status: all files reviewed at latest revision, all discussions resolved.

Comments from Reviewable


upgrade go mock prometheus common and prom

coverage: 58.917%. remained the same
when pulling f1946f0ab219c4cda7b263137fa837d747111d1d on lib_upgrade
into 4905816c63094aca5f8a44d17b8dd5daee858194 on master.


Fix SetFontFace method to be inline with LoadFontFace

I'd like to merge this but I need to be careful with changing API behavior. Thoughts?

No solution for the API but I just want to +1 the fix, I've been bitten by this recently.
I was loading each time the font using dc.LoadFontface(string, float64) when I needed to render in a given size (at this time performances were not in the scope).
Later, for performances improvements, I've added a font cache: caching the font with
gg.LoadFontFace(string, float64) and using the font with dc.SetFontFace(font.Face). I've been surprised that the rendering result was not quite the same.

Yes this is fixing/unifying the SetFontFace method. I'm also trying to do the same thing as @remeh did with different results. Thus we have a fork at the moment with this PR included and it seems to work fine.
However one thing I don't understand is what the hell are these numbers in LoadFontface supposed to mean? What's " * 72 / 96"? 72 of what? and 96 of what?
I had a similar issue with font sizing in the past. Working with a different library in a different langue but the root cause is the same I think. The issues was that the font description almost never has correct values for width and height of the font. What I had to do is to use glyphs to get a real text size just before "rendering" it. This is significantly slower because I had to basically render the whole text and get a real height after that but it works every time. You can remove these magic numbers doing that completely at the cost of speed tho.

iirc, 72 is Pixels per Inch and 96 is the assumed DPI for any monitor.

iirc, 72 is Pixels per Inch and 96 is the assumed DPI for any monitor.


Physics-based preconditioner

In particular MUMPS seems to sometimes have problems converging in certain scenarios. It is unclear exactly what the cause is, but a probable cause might be that the lack of normalizations in DREAM make the matrix ill-conditioned. One potential way of relieving this could be to simply rescale the matrix in order to make all matrix elements as close to unity as possible. This should be relatively straightforward to achieve via a transformation A' = PAP^-1 before inverting the matrix A, with P a (diagonal) rescaling matrix.

I wonder if you want to rescale rows and columns differently? Because the equation corresponding to a given unknown ID does not necessarily have the same scale as the unknown. For example, the equation for T_cold is in SI, so you would want to rescale it differently than how you would rescale T_cold.
Then, you could cast the equation
Ax = b
to
P A Q^-1 Qx = Pb
where the diagonal P contains scale factors for the equations, and Q for the unknowns.
I guess that we want to have constant default values for each unknown id, and not rescale each radius separately depending on parameters? Then, we could for example rescale unknowns by:

Densities (electrons, ions) and distribution functions: 1e20 (maybe n_re and f_re by something smaller, say 1e10?)
Current densities: 1e6 (1 MA/m^2)
Electric field, temperature, poloidal flux: 1

For the equations, we could scale by:

Temperature: 1e6 (1 MJ/m^3)
Ions: 1e26 (dn_i/dt with characteristic ionization times of 1e-6 seconds)
otherwise same as unknowns?

Of course, if we don't care about scale factors <1e10 we could just rescale densities and distributions by 1e20 and call it a day.

I tried this with a DREAM jacobian matrix in matlab. By tweaking the scalefactors a bit I could get the matrix to become well-conditioned, and the time to solve Ax=b for a test vector b went down to 40% of the previous time, using essentially the scalefactors given in the previous comment.

An alternative way of choosing scalefactors could be to take them from the norm (over all elements of the same ID) of the unknowns in the previous iteration and vector of the present, respectively. That may be more robust, and in a way also simpler.

The above solution has been implemented in the preconditioner branch. In this first implementation, unfortunately, it does not seem to have a big effect. As a matter of fact, in the below test script which is marginally stable with the MUMPS solver without a preconditioner (if the parameters are tweaked a little bit it will crash), the preconditioner actually makes it crash where it wouldn't otherwise. I have no idea what's going on there...
basicE_temperatureBug.txt
(rename to .py)

Solved by #104


Force a re-run even when there is no change in the git repository

Hello!

Vote on this issue by adding a 👍 reaction
If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details
Feedback from on of our customers:

It would be great if we can have a documented and reliable way to force a pulumi run even when a git change has not be made.

Customer is implementing currently continueResyncOnCommitMatch but would still love to see this feature in the future.

My understanding of this enhancement request is to provide a manual re-sync trigger, i.e. pulumi up on demand.   Good news is that the pulumi.com/reconciliation-request annotation is understood to have the semantic that it forced a re-sync, and was re-implemented in https://github.com/pulumi/pulumi-kubernetes-operator/pull/745.


Add fancier FOR macro replacing FOR1,FOR2,...

This allows doing simply FOR(i) or FOR(i,j), instead of specifying which one (FOR1, FOR2) you want.
It's a simple PR. Something I have been using that I think is really neat.

Hmm, I think I like it... I guess it makes the decision about the dimension a bit less conscious but the indices are still quite explicit. I have got compile errors quite a few times from typing FOR(i) instead of FOR1(i), so my brain seems to want it this way subconsciously. If no one objects I'd be happy to merge it.


iOS public logging

Change the implementation of native method darwin_log_with_type to use %{public}s rather than %s.
Resolves #400

@KevinSchildhorn I'm not sure that approach really makes sense in the context of Kermit. The reason is because when os_log is used directly, the default is for static strings to be displayed as public, and for dynamic strings to be private. In the context of Kermit, everything is considered dynamic by os_log because we're just delegating to it, so everything is logged as private.
With logging systems like Kermit, users don't expect that behavior. They would expect logs to be public, just as they are on other platforms, and would elide dynamic data that should not be logged before sending it to Kermit. Therefore, I think it makes sense to use %{public}s by default, as that would follow the principle of least surprise for users.
All that being said, I've done the implementation of opt-in public logging anyway. However, I can remove that second commit if you agree with my argument above.
Note also that this change will now conflict with https://github.com/touchlab/Kermit/pull/409. After that PR is merged, I can rebase this one.


cannot import package in python 3.12

I am getting the following error message when importing SBMLdiagrams in python versino 3.12. Is this something you could easily fix? The error I get when trying to import is "ImportError: cannot import name 'set_package' from 'importlib.util'".

If you don't get a response from the author, I recommend using the newer
package called sbmlnetwork. I'm not sure whether the author will
continue to maintain sbmldiagrams. We are therefore switching to using
sbmlnetwork instead. This was developed by another developer in the lab who
has fixed one of the main issues with sbmldiagrams where the autolayout
function wasn't very good. Note that the API has changed a little, and if
there is anything missing from the new API I recommend you contact the
author at:
@.***
sbmlnetwork can be obtained at
https://github.com/adelhpour/SBMLNetwork
https://pypi.org/project/sbmlnetwork/
The author is releasing a new version this week, which fixes some issues,
including an installation issue.
As with sbmldiagrams it is very easy to use:
import sbmlnetwork
network = sbmlnetwork.load('path/to/model.xml')
network.draw()
Herbert Sauro
On Sun, Aug 25, 2024 at 11:07 AM jwkruisselbrink @.***>
wrote:

I am getting the following error message when importing SBMLdiagrams in
python versino 3.12. Is this something you could easily fix? The error I
get when trying to import is "ImportError: cannot import name 'set_package'
from 'importlib.util'".
—
Reply to this email directly, view it on GitHub
https://urldefense.com/v3/__https://github.com/SunnyXu/SBMLDiagrams/issues/88__;!!K-Hz7m0Vt54!hccIi9GBXKKsCP56gTk4fQK-rhiLBx4hj08K6rosbUxb_w9UBVuK4SF5QkRXUpkVjtHm8bylHZjvm7FD17BFM-7eZR3FKw$,
or unsubscribe
https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AAIBSDQG5P6CPQABB5PVOPLZTIMNXAVCNFSM6AAAAABNCXUE52VHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ4DKNBQGE3DMOA__;!!K-Hz7m0Vt54!hccIi9GBXKKsCP56gTk4fQK-rhiLBx4hj08K6rosbUxb_w9UBVuK4SF5QkRXUpkVjtHm8bylHZjvm7FD17BFM-7wKATt6Q$
.
You are receiving this because you are subscribed to this thread.Message
ID: @.***>

--
Herbert Sauro, Professor
Director: NIH Center for model reproducibility
University of Washington, Bioengineering
206-685-2119, www.sys-bio.org, http://reproduciblebiomodels.org/
Mobile:<PHONE_NUMBER>
@.***
Books: http://books.analogmachine.org/

Perfect. I tried sbmlnetwork and it seems to be a good alternative, indeed with a better autolayout.


Wrapper logout

https://github.ibm.com/security-services/appid-project-management/issues/3235

Coverage decreased (-0.2%) to 73.975% when pulling 30842002a4251c8d3028b7c36eb955da5ce3e2b2 on wrapper_logout into 679b4a6d1c3c045c73b981f59635d9a4e4521ce0 on development.


fix(Accessibility): filter out key actions with no key combinations

Fixes #2058.
Ignore keyActions with empty keyCombinations. Fixes exception in RTL.

Warnings

:warning:
There are no updates provided to CHANGELOG. Ensure there are no publicly visible changes introduced by this PR.

  Generated by :no_entry_sign: dangerJS


Add support for declarative shadow dom composition given by the host view

We would like to provide a solution that addresses the use cases like https://github.com/Starcounter/RebelsLounge/issues/53
when an application developer would like to provide a default presentation for a list of UI elements provided by partials included in his/her view (host view).

Preferably this composition should be provided in a host view,
It should be still overwritable by the solution owner,
App devs that provide an inserted view should still be able to provide a declarative-shadow-dom - default presentation, for their own views, in case their apps are run in different solution or standalone.

As discussed on a meeting with @warpech yesterday (2018.06.14)

Scenario
Consider a solution of 3 apps: Timeline, Calendar, Notes, Zuber.
Every app, processes events in some sense. Calendar, Notes, and Zuber provides a views to create an event (<Event>, "/timeline/event-creation", ["menu", "create"])

Calendar:
Provides two native links with some default composition with paper-menuNew event
New recurring event
<template is="declarative-shadow-dom" >
	<paper-menu>
		<slot name="calendar/new"></slot>
		<slot name="calendar/newrec"></slot>
	</paper-menu>
</template>

Zuber:
Provides just a button, without slot name, nor composition<button onclick=""></button>

Notes:
Provides custom element with default composition with native ul<note-widget slot="notes/new"></note-widget>
<template is="declarative-shadow-dom" default>

			<slot name="notes/new"></slot>

</template>

Then Timeline app in a view for some subject wants to include this "create event menu" view aside to the list of all events.
timeline.NewEventActions = Self.GET<Event>("/timeline/event-creation", ["menu", "create"]);

<template>

Timeline

here is the list of events for {{model.Subject}}

	<timeline-custom-element></timeline-custom-element>
	<starcounter-include slot="timeline/new-events" view-model="{{model.NewEventActions}}"></starcounter-include>

	<template is="dom-repeat" items="{{model.Events}}">

				<starcounter-include view-model={{item.EventDetail}}></starcounter-include>

	</tempalte>

	<template is="declarative-shadow-dom">
		<slot name="timeline/new-events"></slot>

			<slot name="timeline/event"></slot>

	</template>
</template>

Now Timeline app developer would like to provide a proposed, default presentation for inserted list of "create event" elements, regardless of what was proposed as default presentation for individual ones, also without a need to act as a solution owner every time and ship custom composition to the database, crafted for predefined set of apps.
For example, to render all of them as child nodes of <paper-list> or <uni-xyz-menu>.
Usually this presentation should be capable of rendering lists, or menus of different elements but in consistent fashion.
Naturally, it should still leave the last word to the solution owner, so he/she could totally change it and handcraft profiled presentation.
@malx122, @jwillmer I would really appreciate you coment, if the above description fits any of your use cases.

Solution
Currently we have two types or ranks of shadow dom compositions (presentation layer of a view):

declarative, default one provided by application developer - template is="declarative-shadow-dom",
custom one, provided by solution owner and stored in the DB - <Starcounter.HTMLViewComposition>model.CompositionProvider_0.Composition$` - this one if given, overwrites the default.

We can introduce third type/rank of composition. Name is TO BE DECIDED, we can call it host's composition. This composition, provided by the host view, will ignore and overwrite default compositions provided by inserted views, but could still be overwritten, by the custom composition given by solution owner.  We can reason, that the solution is always a host to any view of any app, while an app's view is a host only to the view's it explicitely includes - via starcounter-include.
This new TBD "host's composition" will be provided in the host's view, in content part, as a content of <starcounter-include> in question.
Example:
<template>

Timeline

here is the list of events for {{model.Subject}}

	<timeline-custom-element></timeline-custom-element>
	<starcounter-include slot="timeline/new-events" view-model="{{model.NewEventActions}}">

		<template is="declarative-shadow-dom" TBD-host>
			<uni-magic-menu><slot slot="*"></slot></uni-magic-menu>
		</template>

	</starcounter-include>

	<template is="dom-repeat" items="{{model.Events}}">

				<starcounter-include view-model={{item.EventDetail}}></starcounter-include>

	</tempalte>

	<template is="declarative-shadow-dom">
		<slot name="timeline/new-events"></slot>

			<slot name="timeline/event"></slot>

	</template>
</template>

Rationale, We think content is a good place, as host's presentation layer should contain oln, well..., host's presentation, not the presentation of included views (not to break modularity). A the same time we would like to keep the presentation close to the source of including view. Also this states host's app developer opinion on other apps, and does not have to be changed outside of the app, as it is still overwrittable by solution one.

Proposed attribute sytnax makes it possible to still use this apprach without breaking our ideas to flattening blended pages to server-side render partials. As we can still load those different types of compositions into static markup, and let <starcounter-include> pick the right one.
Besides the implementation, we will also need to make sure the docs are clean and understandable.
How to explain to our customers when and where

App devs should say how their content should be displayed, - <template is="declarative-shadow-dom">
App devs should say how inserted content(other devs content) should be displayed, - <template is="declarative-shadow-dom" TBD-host>
Solution owner should say how any content should be displayed? - Blending Editor, Starcounter.HTMLViewComposition

Speaking of a "TBD-host" name, as we discussed at https://github.com/Starcounter/RebelsLounge/issues/369#issuecomment-399351628
We could eventually call it:

<template is="shadow-root" presentation="author|host|solution">, where "author" is a default
"mode" seems to colide with native mode=closed|open, but we could consider it just an extension mode=open(default, author)|host|solution|closed
<template is="shadow-dom-presentation" owner="author|host|solution>

(Renaming element itself is out of the scope of this issue, but we could decide on an attribute name that would last longer and not require renaming soon.)
//cc @warpech

Released in https://github.com/Starcounter/StarcounterClientFiles/pull/104


bundle vs bindgen env var override

It would be very nice for distributions, if there was an override to change the compilation mode of libsqlite3-sys, regardless of what feature is selected. Cross compilation of the bundled feature currently fails (at least in Void's infrastructure), and we'd prefer to dynamically link sqlite either way. However, currently, this decision is passed to the crate using libsqlite3-sys, not the distribution maintainers.
References:
https://github.com/launchbadge/sqlx/issues/191#issuecomment-649334666
https://github.com/void-linux/void-packages/pull/22534#issuecomment-649333178

It would be very nice for distributions, if there was an override to change the compilation mode of libsqlite3-sys, regardless of what feature is selected

This can be doable in some circumstances, but not others. Obviously if you want bindgen that has to be a compile time flag -- the whole point of that being optional is that it's a problematic dependency for some, and is slow to compile even if it wasn't a problem to depend (transitively) on LLVM.
Additionally, currently rusqlite itself wants the version of the bindings to match the version of sqlite. This should be relaxes some, however some WIP features, if enabled, would make it a memory safety issue to use a too-old version of sqlite. This is very unfortunate, but a fact of the sqlite API, and outside of our control.
See:

https://github.com/rusqlite/rusqlite/pull/639#issuecomment-620871847
https://github.com/rusqlite/rusqlite/pull/631#issuecomment-620874452

That said, I assume the idea would be to use a newer version of sqlite than what we compile with, which should of course, be fine. I also assume you won't need to enable buildtime-bindgen.

Cross compilation of the bundled feature currently fails (at least in Void's infrastructure),

I'd certainly accept patches to make this work. In https://github.com/mozilla/application-services we cross-compile libsqlite3-sys but we don't use bundled, and instead provide our own build of sqlite. This seems closest to what you want to do.
I've also definitely been able to make cc work with cross compilation as part of working on https://github.com/mozilla/rust-android-gradle/, however it was a bit annoying: https://github.com/mozilla/rust-android-gradle/blob/master/plugin/src/main/kotlin/com/nishtahir/CargoBuildTask.kt#L167-L185.

However, currently, this decision is passed to the crate using libsqlite3-sys, not the distribution maintainers.

For what it's worth, this is pretty standard in the Rust ecosystem...
That said, I'm pretty sympathetic to the desire to not statically link (to some extent I suspected a bug around this was going to be filed eventually), and certainly don't want the use of libsqlite3-sys to be problematic (I think fracturing the ecosystem here would be very unfortunate).
Unfortunately, I'm unsure when I'll have time to do anything around this myself. Probably not for another week or two. It should also maybe be firmed up a little bit more before someone takes a stab at it (at the moment I have low confidence I'd come up with something that solves all your problems), but if you have a concrete idea I'd certainly take a look at a patch.

This can be doable in some circumstances, but not others. Obviously if you want bindgen that has to be a compile time flag -- the whole point of that being optional is that it's a problematic dependency for some, and is slow to compile even if it wasn't a problem to depend (transitively) on LLVM.

It definitely has to be compile time, but the way the flag is passed doesn't have to be a feature flag. Having an environment variable during compile time that overrides the feature should work, no?

Additionally, currently rusqlite itself wants the version of the bindings to match the version of sqlite. This should be relaxes some, however some WIP features, if enabled, would make it a memory safety issue to use a too-old version of sqlite. This is very unfortunate, but a fact of the sqlite API, and outside of our control.
That said, I assume the idea would be to use a newer version of sqlite than what we compile with, which should of course, be fine. I also assume you won't need to enable buildtime-bindgen.

Yeah, in the case of void linux it would be sqlite-3.32.3, which should be fine.

I'd certainly accept patches to make this work, or at least filed issues. In https://github.com/mozilla/application-services we cross-compile libsqlite3-sys but we don't use bundled, and instead provide our own build of sqlite. This seems closest to what you want to do.

Yeah, this is close to what I'd want, but the problem is that sqlx requires the bundled feature, and disabling that as a distributor of software is hard. They require the bundled feature, because the default compilation mode, that doesn't run bindgen during buildtime, has a too old sqlite version, so it's missing some features.

I've also definitely been able to make cc work with cross compilation [...]

I personally don't know much about cross compilation of C libraries. Just that with rust, it's usually easy, until C comes in :D
If you care to take a look at the error the Void CI threw at me, it's available here: https://travis-ci.org/github/void-linux/void-packages/jobs/701745377#L772

That said, I'm pretty sympathetic to the desire to not statically link, [... but]  I'm unsure when I'll have time to do anything around this myself. Probably not for another week or two.

That's good to hear. This is not that terribly urgent, I've just set the package that prompted this to nocross, which means it won't get cross compiled by Void Linux. That's a bit unfortunate, but should be fine for now.

if you have a concrete idea I'd certainly take a look at a patch

The only problem with a (compile time) env var override would be that old versions might cause problems, right? The spike in compile times there is obviously to be expected, but for a distribution, that's a worthwhile trade off in my opinion.

It definitely has to be compile time, but the way the flag is passed doesn't have to be a feature flag. Having an environment variable during compile time that overrides the feature should work, no?

So long as you don't want to turn on buildtime-bindgen. For that it requires additional compile-time dependencies which cargo needs to know about, and the only way to tell cargo about additional deps is via features.
That said, it doesn't seem like you need this so should be doable.

If you care to take a look at the error the Void CI threw at me, it's available here: travis-ci.org/github/void-linux/void-packages/jobs/701745377#L772

Can I get back to you here? This looks like a bug on our part (which might just end up with me filing an issue, but it might be easy to fix -- Cross compiling to aarch64 should be totally doable).

This is not that terribly urgent... That's a bit unfortunate, but should be fine for now.

That's also good to hear on my part :). I agree it sounds unfortunate. I don't really want libsqlite3-sys to be a problematic dependency for devs or packagers (it's already a bit problematic for some, since I gather it doesn't work with things like https://github.com/google/cargo-raze, unfortunately).

The only problem with a (compile time) env var override would be that old versions might cause problems, right

Hmmm, I guess that's basically it. It also might require a bit of rejiggering of the way libsqlite3-sys's build.rs is configured, but might not. In a week or two when my schedule frees up a little I can take a stab at this I guess.

The spike in compile times there is obviously to be expected

If you're using a modern version of sqlite we could probably just let you use the pregenerated bindgen file and let you link against whatever, so there actually shouldn't be a compile time spike.

So long as you don't want to turn on buildtime-bindgen. For that it requires additional compile-time dependencies which cargo needs to know about, and the only way to tell cargo about additional deps is via features.

You can definitely change features in build.rs, but I'm not sure whether that might be after cargo determined the dependencies for that build. If so, that would be quite unfortunate.

Can I get back to you here? This looks like a bug on our part (which might just end up with me filing an issue, but it might be easy to fix -- Cross compiling to aarch64 should be totally doable).

Sure, I'll do my best to help. Also happy to hear that this helps with finding bugs.

If you're using a modern version of sqlite we could probably just let you use the pregenerated bindgen file and let you link against whatever, so there actually shouldn't be a compile time spike.

That wouldn't work for sqlx though, as they require a higher minimum version than what the pregenerated bindgen file offers, right?

You can definitely change features in build.rs, but I'm not sure whether that might be after cargo determined the dependencies for that build. If so, that would be quite unfortunate.

Yes, it's after -- we need bindgen to compile the build.rs, but at the point when the build.rs is run, it's already been compiled.
I also don't know that it's correct that you can change features from within a build.rs, are you sure about that?

That wouldn't work for sqlx though, as they require a higher minimum version than what the pregenerated bindgen file offers, right?

It would work. While we ship with bindings for a few old versions of sqlite, we also ship a binding file for the most recent version of sqlite: https://github.com/rusqlite/rusqlite/blob/master/libsqlite3-sys/sqlite3/bindgen_bundled_version.rs (well, I guess this is 3.32.2 now and there's been another patch release, but close enough).
Ideally there would be more middle ground here, or the old versions wouldn't be quite so old, but yeah, either way, you wouldn't need bindgen run at build time.

Yes, it's after -- we need bindgen to compile the build.rs, but at the point when the build.rs is run, it's already been compiled.

Okay, then that won't work :/

I also don't know that it's correct that you can change features from within a build.rs, are you sure about that?

You can set arbitrary cfg settings, so that should include features. It might break horribly if those features are used to gate dependencies though..

[...] we also ship a binding file for the most recent version of sqlite [...]
Ideally there would be more middle ground here, or the old versions wouldn't be quite so old, but yeah, either way, you wouldn't need bindgen run at build time.

That sounds good. @mehcode, would that work for sqlx?

That sounds good. @mehcode, would that work for sqlx?

To be clear, this would be used when the environment var is activated. It's the same binding file we use when bundled is used, which I believe is the current status for sqlx.

I personally don't know much about cross compilation of C libraries. Just that with rust, it's usually easy, until C comes in :D
If you care to take a look at the error the Void CI threw at me, it's available here: https://travis-ci.org/github/void-linux/void-packages/jobs/701745377#L772

These lines seem strange:

--- stdout
...
TARGET = Some("x86_64-unknown-linux-gnu")
...
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = Some("aarch64-linux-gnu-gcc")

If you're cross-compiling from x86_64 to aarch64, as your HOST and CC suggest, I'd expect you'd want TARGET to be "aarch64-unknown-linux-gnu". So instead of saying cargo BLAH BLAH you should be saying cargo BLAH BLAH --target=aarch64-unknown-linux-gnu.

Just in case this is relevant, note that TARGET and HOST in their Rust usage != them in their GCC/autotools usages.

I'm not sure what's going on there, the target should be set to aarch64-unknown-linux-gnu from what I've seen in the xbps-src scripts. Also: The package doesn't modify this, so it's behaving exactly as all the other rust packages in Void, and it works there, so I doubt this is just fundamentally wrong.

I think this is because of compiling the build.rs which happens on the host machine vs compiling the actual code, no?

Ah, right, so that should be correct then?

running: "aarch64-linux-gnu-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-fstack-clash-protection" "-D_FORTIFY_SOURCE=2" "-O2" "-pipe" "-march=armv8-a" "-I/usr/aarch64-linux-gnu/usr/include" "-DSQLITE_CORE" "-DSQLITE_DEFAULT_FOREIGN_KEYS=1" "-DSQLITE_ENABLE_API_ARMOR" "-DSQLITE_ENABLE_COLUMN_METADATA" "-DSQLITE_ENABLE_DBSTAT_VTAB" "-DSQLITE_ENABLE_FTS3" "-DSQLITE_ENABLE_FTS3_PARENTHESIS" "-DSQLITE_ENABLE_FTS5" "-DSQLITE_ENABLE_JSON1" "-DSQLITE_ENABLE_LOAD_EXTENSION=1" "-DSQLITE_ENABLE_MEMORY_MANAGEMENT" "-DSQLITE_ENABLE_RTREE" "-DSQLITE_ENABLE_STAT2" "-DSQLITE_ENABLE_STAT4" "-DSQLITE_SOUNDEX" "-DSQLITE_THREADSAFE=1" "-DSQLITE_USE_URI" "-DHAVE_USLEEP=1" "-DSQLITE_HAVE_ISNAN" "-o" "/builddir/rumatui-0.1.16/target/release/build/libsqlite3-sys-44b11efcd12476f6/out/sqlite3/sqlite3.o" "-c" "sqlite3/sqlite3.c"

cargo:warning=aarch64-linux-gnu-gcc: error: unrecognized command line option '-m64'

This looks like the actual problem to me, but I haven't had time to look really.

I had the error mentioned in previous message, but at least in my case it was due to misconfigured CC and CFLAGS environment variables. I think this is just because macros need to compile for HOST instead of TARGET.
I had
export CFLAGS="--sysroot=$SOME_SYSROOT"
export CC=$SOME_CROSS_CC

But I should have had specified TARGET variables instead:
export TARGET_CFLAGS="--sysroot=$SOME_SYSROOT"
export TARGET_CC=$SOME_CROSS_CC

as documented in cc crate documentation https://crates.io/crates/cc
In my case this helped, maybe this is helpful to someone.

Quick follow-up: Has anything happened on this here? I ran into this again, looked into it and seeing that I opened an issue about this years ago and that there's nothing happening is a bit frustrating, especially when seeing that this is also something others are running into as well (see https://github.com/launchbadge/sqlx/issues/191#issuecomment-1124962206)

Sorry, not really, although I have been working on it some. My current plan is to make Cargo build script overrides work https://doc.rust-lang.org/cargo/reference/build-scripts.html#overriding-build-scripts. This will require a significant change to how bundling works, since this disables the build.rs entirely -- so we have to function even if it is not run. That said, doing this correctly will fix a number of other issues too around versioning, and enable more use cases.
Notably, this will allow complete control of the version of SQLite that we link with, even if the bundled feature is enabled. I have most of the work done in a branch locally (it works but it also broke a number of things I need to fix). I hope to have slightly more time for this after I finish finding a job, which is what a lot of my time is currently spent on this month.

This has been implemented in https://github.com/rusqlite/rusqlite/pull/1317 a while ago. Setting LIBSQLITE3_SYS_USE_PKG_CONFIG=1 does the trick now.


Update MainPage.xaml.cs

removed an antipattern

Hi @increddibelly, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. Real humans will now evaluate your PR.

TTYL, MSBOT;


UserDetaultWrapper.swift -> public var wrappedValue: T {... never sets value

UserDetaultWrapper.swift -> public var wrappedValue: T {... never sets value
the get { return ...} is called but never the set {...} so the value stored in the UserDefault never changes

My breakpoint is shown, so the code is called. Are you sure you touch save on the settings form?

Yes you are correct, my bad but that lead me to the solution I wanted to have so I have some code to come back to you as I am building a TabView app also and wanted to save the state of the selected index (seams like a easy problem but as it turns out it ended up being a lot of screwing around), anyways if you want to merge these changes to you project you app now  saved the last tab item selected, see all changes below in bold, Alan
In AppUserDefaults.swift add the tabViewIndex variable
struct AppUserDefaults {
@UserDefault("user_region", defaultValue: Locale.current.regionCode ?? "US")
static var region: String
@UserDefault("original_title", defaultValue: false)
static var alwaysOriginalTitle: Bool

@UserDefault("tab_view_index", defaultValue: Tab.movies.rawValue)
static var tabViewIndex: Int

}
In HomeView.swift move the enum out side of the struct TabbarView: View
enum Tab: Int {
case movies, discover, fanClub, myLists
}
And in struct TabbarView: View change the selectedTab assignment variable
@State var selectedTab = Tab(rawValue: AppUserDefaults.tabViewIndex)!
Then in MoviesHome.swift add . onAppear
var body: some View {
NavigationView {
Group {
if selectedMenu.menu == .genres {
GenresList(headerView: AnyView(segmentedView))
} else {
MoviesHomeList(menu: $selectedMenu.menu,
pageListener: selectedMenu.pageListener,
headerView: AnyView(segmentedView))
}
}
.navigationBarItems(trailing:
Button(action: {
self.isSettingPresented = true
}) {
HStack {
Image(systemName: "wrench").imageScale(.medium)
}.frame(width: 30, height: 30)
}
).sheet(isPresented: $isSettingPresented,
content: { SettingsForm() })
.onAppear {
AppUserDefaults.tabViewIndex = Tab.movies.rawValue
}
}
}
}
Then in DiscoverView.swift  change . onAppear
func body(props: Props) -> some View {
    ZStack(alignment: .center) {
        draggableMovies(props: props)
        GeometryReader { reader in
            self.filterView(props: props)
                .position(x: reader.frame(in: .local).midX,
                          y: reader.frame(in: .local).minY + reader.safeAreaInsets.top + 10)
                .frame(height: 50)
                .sheet(isPresented: self.$isFilterFormPresented, content: { DiscoverFilterForm().environmentObject(store) })
            self.actionsButtons(props: props)
                .position(x: reader.frame(in: .local).midX,
                          y: reader.frame(in: .local).maxY - reader.safeAreaInsets.bottom - self.bottomSafeInsetFix)
        }
    }
    .background(FullscreenMoviePosterImage(imageLoader: ImageLoaderCache.shared.loaderFor(path: props.currentMovie?.poster_path,
                                                                                size: .original))
        .allowsHitTesting(false)
        .transition(.opacity)
        .animation(.easeInOut))
    .onAppear {
        self.hapticFeedback.prepare()
        self.fetchRandomMovies(props: props, force: false, filter: props.filter)
        props.dispatch(MoviesActions.FetchGenres())
        AppUserDefaults.tabViewIndex = Tab.discover.rawValue
    }
}

Then in FanClubHome.swift change . onAppear
func body(props: Props) -> some View {
    NavigationView {
        List {
            Section {
                ForEach(props.peoples, id: \.self) { people in
                    NavigationLink(destination: PeopleDetail(peopleId: people)) {
                        PeopleRow(peopleId: people)
                    }
                }.onDelete(perform: { index in
                    props.dispatch(PeopleActions.RemoveFromFanClub(people: props.peoples[index.first!]))
                })
            }

            Section(header: Text("Popular people to add to your Fan Club")) {
                ForEach(props.popular, id: \.self) { people in
                    NavigationLink(destination: PeopleDetail(peopleId: people)) {
                        PeopleRow(peopleId: people)
                    }
                }
            }

            if !props.popular.isEmpty {
                Rectangle()
                    .foregroundColor(.clear)
                    .onAppear {
                        self.currentPage += 1
                        props.dispatch(PeopleActions.FetchPopular(page: self.currentPage))
                }
            }
        }
        .navigationBarTitle("Fan Club")
    }
    .onAppear {
        props.dispatch(PeopleActions.FetchPopular(page: self.currentPage))
        AppUserDefaults.tabViewIndex = Tab.fanClub.rawValue
    }
}

}
Then in MyList.swift  add . onAppear
func body(props: Props) -> some View {
    NavigationView {
        List {
            customListsSection(props: props)

            Picker(selection: $selectedList, label: Text("")) {
                Text("Wishlist").tag(0)
                Text("Seenlist").tag(1)
            }.pickerStyle(SegmentedPickerStyle())

            if selectedList == 0 {
                wishlistSection(props: props)
            } else if selectedList == 1 {
                seenSection(props: props)
            }
        }
        .actionSheet(isPresented: $isSortActionSheetPresented, content: { sortActionSheet })
            .navigationBarTitle(Text("My Lists"))
            .navigationBarItems(trailing: Button(action: {
                self.isSortActionSheetPresented.toggle()
            }, label: {
                Image(systemName: "line.horizontal.3.decrease.circle")
                    .resizable()
                    .frame(width: 25, height: 25)
            }))
    }
    .sheet(isPresented: $isEditingFormPresented) {
            CustomListForm(editingListId: nil).environmentObject(self.store)
    }
    .onAppear {
        AppUserDefaults.tabViewIndex = Tab.myLists.rawValue
    }
}

Alan Cook
Senior Programmer
CodeFab
<EMAIL_ADDRESS>www.codefab.com

On Sep 10, 2019, at 1:46 PM, Thomas Ricouard<EMAIL_ADDRESS>wrote:
My breakpoint is shown, so the code is called. Are you sure you touch save on the settings form?
https://user-images.githubusercontent.com/535509/64587283-165d8800-d39f-11e9-97a4-00822bc7a003.png
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/Dimillian/MovieSwiftUI/issues/28?email_source=notifications&email_token=AAGIO2S3IYGMWXUOVRFHUF3QI4YDVA5CNFSM4IVBZ3W2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6J44QQ#issuecomment-529780290, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGIO2WK75GZI362TYA6JK3QI4YDVANCNFSM4IVBZ3WQ.

If it works you could do a proper pull request, It's nice that the app will open back on the last used tab.
Note; It could also be backed in a UIState in the redux app state, like the movies and peoples state, it could be saved on app quit, and restored on launch.

Add support for UserState var (mainTabSelected,alwaysOriginalTitle,region) remove AppuserDefaults values which are now saved with the userData in the App documents directory
https://github.com/alancook/MovieSwiftUI https://github.com/alancook/MovieSwiftUI
Alan Cook
Senior Programmer
CodeFab
<EMAIL_ADDRESS>www.codefab.com

On Sep 10, 2019, at 5:00 PM, Thomas Ricouard<EMAIL_ADDRESS>wrote:
If it works you could do a proper pull request, It's nice that the app will open back on the last used tab.
Note; It could also be backed in a UIState in the redux app state, like the movies and peoples state, it could be saved on app quit, and restored on launch.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/Dimillian/MovieSwiftUI/issues/28?email_source=notifications&email_token=AAGIO2QPXQTFWGCQ3EHYO5TQI5O33A5CNFSM4IVBZ3W2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6KME2I#issuecomment-529842793, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGIO2WSSJ2O3AT5UG7W67TQI5O33ANCNFSM4IVBZ3WQ.

@Dimillian love how you use UserDefaults, implemented in my app, so much cleaner!

Attachment available until Dec 30, 2019
Your welcome, been working on my new guide app you can have quick peak, please do not distribute the video, hope to have it out early next year, Alan
Click to Download
https://www.icloud.com/attachment/?u=https%3A%2F%2Fcvws.icloud-content.com%2FB%2FAZ07h-8QqyDeBC6wXUh8OMgl3NP2AWguOqVFqU7YZFMbhoeEYqmk7SOb%2F%24{f}%3Fo%3DAnIdDQf3ASkGxOxzvdcoT0HrrP83L4vA4xZmhIfk41Lf%26v%3D1%26x%3D3%26a%3DCAogGKoFRoaNKBXhvM4-8E6Gk2J1d8q2r8RKOg2X6w6i1uoSJxCskaDd6y0YrKGbsfUtIgEAKggByAD_J2REw1IEJdzT9loEpO0jmw%26e%3D1577698381%26k%3D%24{uk}%26fl%3D%26r%3DF5DE7F3F-8493-4B42-B1F8-B0D908EC3447-1%26ckc%3Dcom.apple.largeattachment%26ckz%3D3C8C69AD-ED50-4D1E-8783-E59708BAAE83%26p%3D65%26s%3Ds-15sDj_c99HcC9PU7M7V5jyORk&uk=V1yonQfWVRHTRk_HNo8ucA&f=SwiftUI-AlonaBeachGuideDemo.mp4&sz=284055395SwiftUI-AlonaBeachGuideDemo.mp4
284.1 MB
Alan Cook
Senior Programmer
CodeFab
<EMAIL_ADDRESS><EMAIL_ADDRESS>www.codefab.com

On Sep 11, 2019, at 3:06 PM, Alan Cook<EMAIL_ADDRESS><EMAIL_ADDRESS>wrote:
Add support for UserState var (mainTabSelected,alwaysOriginalTitle,region) remove AppuserDefaults values which are now saved with the userData in the App documents directory
https://github.com/alancook/MovieSwiftUI https://github.com/alancook/MovieSwiftUI
Alan Cook
Senior Programmer
CodeFab
<EMAIL_ADDRESS><EMAIL_ADDRESS>www.codefab.com http://www.codefab.com/

On Sep 10, 2019, at 5:00 PM, Thomas Ricouard<EMAIL_ADDRESS><EMAIL_ADDRESS>wrote:
If it works you could do a proper pull request, It's nice that the app will open back on the last used tab.
Note; It could also be backed in a UIState in the redux app state, like the movies and peoples state, it could be saved on app quit, and restored on launch.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/Dimillian/MovieSwiftUI/issues/28?email_source=notifications&email_token=AAGIO2QPXQTFWGCQ3EHYO5TQI5O33A5CNFSM4IVBZ3W2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6KME2I#issuecomment-529842793, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGIO2WSSJ2O3AT5UG7W67TQI5O33ANCNFSM4IVBZ3WQ.


Regarding image upload in toolbar

Hello,
Requirement is that like hideImgLink option, add option to hide only imgUpload and show imgLink with name hideImgUpload to hide only imgUpload

Is this what you need? <v-editor :config="{uploadImgUrl:null}"></v-editor>

if your need hide link image

 editorConfig: {
    hideLinkImg:true,
    uploadImgUrl:'http://localhost:2233/api/upload',
}

if you need hide upload component

editorConfig: {
   hideLinkImg:false,
   uploadImgUrl:null
}

Thanks @yimogit

It worked.


Don't break middleware with internal dispatch.

Fixes #3019

https://github.com/reduxjs/redux/issues/3019#issuecomment-394908156


Don't duplicate create_hashtable code in grow_hashtable

The only time the special case of a null HashTable will happen is on the very first call. No need to optimize for it. The new behavior with get_hashtable should behave basically identical anyway.
An improvement is that it now only has to load HASHTABLE once before starting the work in the first loop.

bors r+