forked from mrbrl/PCLAppConfig
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
3,309 additions
and
3,174 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.pclapp.demo" android:installLocation="auto" android:versionCode="1" android:versionName="bobo"> | ||
<uses-sdk android:minSdkVersion="15" /> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.monovo.PCLAppDemo" android:installLocation="auto" android:versionCode="1"> | ||
<uses-sdk android:minSdkVersion="21" /> | ||
<application android:label="PclAppDemo"></application> | ||
</manifest> |
6,314 changes: 3,157 additions & 3,157 deletions
6,314
src/Host/PCLAppDemo.App.Droid/Resources/Resource.Designer.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
src/Host/PCLAppDemo.App.iOS/Infrastructure/iOSSettingsManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Foundation; | ||
|
||
namespace PCLAppConfig.App.iOS.Infrastructure | ||
{ | ||
public class iOSSettingsManagerpublic | ||
{ | ||
public static string ApiPath { get; private set; } | ||
|
||
const string API_PATH_KEY = "serverAddress"; //this needs to be the Identifier of the field in the Root.plist | ||
|
||
public static void SetUpByPreferences() | ||
{ | ||
var testVal = NSUserDefaults.StandardUserDefaults.StringForKey(API_PATH_KEY); | ||
|
||
if (testVal == null) | ||
LoadDefaultValues(); | ||
else | ||
LoadEditedValues(); | ||
|
||
SavePreferences(); | ||
} | ||
|
||
static void LoadDefaultValues() | ||
{ | ||
var settingsDict = new NSDictionary(NSBundle.MainBundle.PathForResource("Settings.bundle/Root.plist", null)); | ||
|
||
if (settingsDict != null) | ||
{ | ||
var prefSpecifierArray = settingsDict[(NSString) "PreferenceSpecifiers"] as NSArray; | ||
|
||
if (prefSpecifierArray != null) | ||
{ | ||
foreach (var prefItem in NSArray.FromArray<NSDictionary>(prefSpecifierArray)) | ||
{ | ||
var key = prefItem[(NSString) "Key"] as NSString; | ||
|
||
if (key == null) | ||
continue; | ||
|
||
var value = prefItem[(NSString) "DefaultValue"]; | ||
|
||
if (value == null) | ||
continue; | ||
|
||
switch (key.ToString()) | ||
{ | ||
case API_PATH_KEY: | ||
ApiPath = value.ToString(); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
static void LoadEditedValues() | ||
{ | ||
ApiPath = NSUserDefaults.StandardUserDefaults.StringForKey(API_PATH_KEY); | ||
} | ||
|
||
//Save new preferences to Settings | ||
static void SavePreferences() | ||
{ | ||
var appDefaults = NSDictionary.FromObjectsAndKeys(new object[] | ||
{ | ||
new NSString(ApiPath) | ||
}, new object[] | ||
{ | ||
API_PATH_KEY | ||
}); | ||
|
||
NSUserDefaults.StandardUserDefaults.RegisterDefaults(appDefaults); | ||
NSUserDefaults.StandardUserDefaults.Synchronize(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>PreferenceSpecifiers</key> | ||
<array> | ||
<dict> | ||
<key>Title</key> | ||
<string>Name</string> | ||
<key>Type</key> | ||
<string>PSGroupSpecifier</string> | ||
</dict> | ||
<dict> | ||
<key>DefaultValue</key> | ||
<string>Ben</string> | ||
<key>Key</key> | ||
<string>firstNameKey</string> | ||
<key>Title</key> | ||
<string>First</string> | ||
<key>Type</key> | ||
<string>PSTextFieldSpecifier</string> | ||
</dict> | ||
</array> | ||
<key>StringsTable</key> | ||
<string>Root</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters