Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions .idea/workspace.xml

This file was deleted.

14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,25 @@ Provides a method and a stream which calls on managed app configuration changes.

## Additional Information

### Android:

https://developer.android.com/work/managed-configurations

### Test on Android:
#### How to Test
It could be that you need to factory reset your android device before installing TestDPC for testing.
* https://github.com/googlesamples/android-testdpc
* https://developer.android.com/work/guide#testing

### iOS/macOS
https://developer.apple.com/documentation/foundation/nsuserdefaults#2926901

#### How to Test

Apple does not provide a dev environment to test managed app configuration so you will need to use one of the available
MDM provider. This package was created to work with [Relution](https://relution.io).
You can create a free Account and enroll up to 5 devices to test your implementation.

For more information check out the documentation of the used MDM provider how to add managed app configuration to your app.

## How to use

Expand Down
14 changes: 7 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ group 'io.mway.managed_configurations'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.9.21'
ext.kotlin_version = '2.0.20'
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.android.tools.build:gradle:8.7.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

rootProject.allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand All @@ -28,12 +28,13 @@ android {
if (project.android.hasProperty('namespace')) {
namespace 'io.mway.managed_configurations'
}
compileSdkVersion 31

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
compileSdk 31
minSdkVersion 21
}

Expand All @@ -44,7 +45,6 @@ android {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.google.code.gson:gson:2.11.0'
implementation 'androidx.enterprise:enterprise-feedback:1.1.0'
}
7 changes: 3 additions & 4 deletions darwin/Classes/ManagedConfigurationsPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class ManagedConfigurationsPlugin: NSObject, FlutterPlugin {
}

/**
Handles the getManagedConfiguration method ivoked by flutter side.
Handles the getManagedConfiguration method invoked by flutter side.
Writes the managed configuration in the result as json converted to String
If something fails returns empty json string ("{}")
*/
Expand All @@ -63,7 +63,7 @@ public class ManagedConfigurationsPlugin: NSObject, FlutterPlugin {
Used to handle the Event channel
On Flutter stream subscribe creates an observer on UsersDefault.
Calls on changes the mdConfigChange method
Its not necassary to remove this observer as it will anyway removed if not used
Its not necessary to remove this observer as it will anyway removed if not used
*/
class SwiftStreamHandler: NSObject, FlutterStreamHandler {
/// save the sink as we need it to put the changes in it
Expand All @@ -81,7 +81,7 @@ class SwiftStreamHandler: NSObject, FlutterStreamHandler {
}

/**
handles the notification if something happend on UserDefaults
handles the notification if something happened on UserDefaults
Extracts the managed configuration and converts them to json String. Checks if something changed.
If so, puts in the sink (Flutter side will be notified)
*/
Expand All @@ -90,7 +90,6 @@ class SwiftStreamHandler: NSObject, FlutterStreamHandler {
let jsonData = try? JSONSerialization.data(withJSONObject: managedConf, options: .prettyPrinted),
let jsonString = String(data: jsonData, encoding: .utf8),
let events = eventsVariable{
print("calling dies das")
if lastJsonString == nil {
lastJsonString = jsonString
events(jsonString)
Expand Down
26 changes: 26 additions & 0 deletions darwin/Resources/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyTrackingDomains</key>
<array>
</array>
<key>NSPrivacyCollectedDataTypes</key>
<array>
</array>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>AC6B.1</string>
</array>
</dict>
</array>
</dict>
</plist>

1 change: 1 addition & 0 deletions darwin/managed_configurations.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ A new flutter plugin project.
s.author = { 'Your Company' => 'email@example.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.resource_bundles = {'package_name_privacy' => ['Resources/PrivacyInfo.xcprivacy']}

s.platform = :ios, '9.0'
s.platform = :osx, '10.11'
Expand Down