trevordevore / levure

Application development framework for LiveCode
MIT License
32 stars 14 forks source link

Mobile preferences location #25

Closed spencerlearning closed 7 years ago

spencerlearning commented 7 years ago

We need to determine where the preferences file is stored on mobile. The function that sets this is _systemPreferencesFolder in preferences.livecodescript.

This way puts preferences in the root of Library on ios and Documents on android:

private function _systemPreferencesFolder
  switch the platform
    case "macos"
      return specialFolderPath("preferences")
    case "iphone"
      return specialFolderPath("library")
    case "android"
      return specialFolderPath("documents")
    case "win32"
    case "linux"
      return _systemAppDataFolder("user")
    default
      return empty
  end switch
end _systemPreferencesFolder

This way puts preferences in the root of the Application Support folder:

private function _systemPreferencesFolder
  switch the platform
    case "macos"
      return specialFolderPath("preferences")
    case "iphone"
      return specialFolderPath("library") & "/Application Support"
    case "android"
      return specialFolderPath("documents") & "/Application Support"
    case "win32"
    case "linux"
      return _systemAppDataFolder("user")
    default
      return empty
  end switch
end _systemPreferencesFolder

I prefer the Application Support location, but it doesn't really matter AFAIK.

Any thoughts? We need to decide on it to complete mobile preferences support and merge it in.

trevordevore commented 7 years ago

Let's go with Application Support. I found this Apple document which recommends using Application Data: https://developer.apple.com/library/content/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html

I created this brand with the changes:

https://github.com/trevordevore/levure/tree/tkd-mobile-pref-folder

and here is the commit:

https://github.com/trevordevore/levure/commit/c13bdf2d0707802c2e0d5cad5ba648bf7245b96a

Does that look right?

spencerlearning commented 7 years ago

In _systemAppDataFolder under if pUserOrShared is not "shared" the mobile cases should be:

case "iphone"
  return specialFolderPath("library") & "/Application Support"
case "android"
  return specialFolderPath("documents") & "/Application Support"

instead of:

case "iphone"
case "android"
   return specialFolderPath("library") & "/Application Support"
trevordevore commented 7 years ago

The location for Android has been fixed and mobile prefs have been merged in.