-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new callback interfaces split from DeployGateCallback #95
Merged
Merged
Changes from 15 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b5ac092
chore: separate each method in DeloyGateCallback to interface class
satsukies c75248c
feat: Add method for set each callbacks to DeployGateSdkConfiguration…
satsukies 36e88dc
chore: add new callback interfaces to sdkMock module
satsukies 3d46edb
feat: add register/unregister method for new callback interfaces
satsukies 5d6efe5
chore: refactoring sample codes
satsukies 9774b93
chore: add methods to DeployGateSdkConfiguration at sdkMock module
satsukies f7d85ba
test: add testcase of new interfaces
satsukies 69bd4fc
test: add new testcase about public methods definition on DeployGateS…
satsukies 7a6f81d
fix: remove class body
satsukies 6bee4f7
fix: mark deprecated in sdkMock module
satsukies bcd6b86
fix: delete member of deprecated interface
satsukies 41bdd9c
fix: remove 'refreshImmediately' argument
satsukies c361d01
chore: update sample code
satsukies 3954e1c
chore: add javadoc
satsukies 4062288
fix: forgot semi-colon
satsukies 1d45993
test: add testcase of register/unregister callbacks
satsukies ee6bd30
fix: use deprecated callback directly when register/unregister
satsukies 0ff07a4
chore: separate unregister logic to 'unregisterXXXInternal' private m…
satsukies 083c8f9
fix: improve comments
satsukies 190ef4c
fix: treat DeployGateCallback as fine-grained callbacks
satsukies 6af347c
chore: add comment to package-private static methods
satsukies 12883ac
chore: add no-op comment
satsukies 7d5d76b
fix: deprecated DeployGateSdkConfiguration.Builder#setCallback in sdk…
satsukies File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
|
||
import com.deploygate.sdk.CustomAttributes; | ||
import com.deploygate.sdk.DeployGate; | ||
import com.deploygate.sdk.DeployGateCallback; | ||
import com.deploygate.sdk.DeployGateSdkConfiguration; | ||
|
||
import java.util.Locale; | ||
|
||
|
@@ -27,12 +27,10 @@ public void onCreate() { | |
// Note that you also need to edit your AndroidManifest.xml to activate customized initializer. | ||
// Refer the comment on stableReal/AndroidManifest.xml included in this sample. | ||
|
||
DeployGate.install(this, new DeployGateCallback() { | ||
// Please note that this callback is called iff you have removed the content provider. | ||
// For those who wanna use the content provider, SDK provides DeployGate#registerCallback for your use-case. | ||
|
||
@Override | ||
public void onInitialized(boolean isServiceAvailable) { | ||
DeployGateSdkConfiguration configuration = new DeployGateSdkConfiguration.Builder() | ||
// Please note that these callback is called if you have removed the content provider. | ||
// For those who wanna use the content provider, SDK provides DeployGate#registerXXXCallback for your use-case. | ||
.setInitializeCallback(isServiceAvailable -> { | ||
if (isServiceAvailable) { | ||
Log.i(TAG, "SDK is available"); | ||
DeployGate.logInfo("SDK is available"); | ||
|
@@ -44,49 +42,39 @@ public void onInitialized(boolean isServiceAvailable) { | |
Log.i(TAG, "SDK is unavailable"); | ||
DeployGate.logInfo("SDK is unavailable"); // this fails silently | ||
} | ||
} | ||
|
||
@Override | ||
public void onStatusChanged( | ||
boolean isManaged, | ||
boolean isAuthorized, | ||
String loginUsername, | ||
boolean isStopped | ||
) { | ||
}) | ||
.setStatusChangeCallback((isManaged, isAuthorized, loginUsername, isStopped) -> { | ||
Bundle bundle = new Bundle(); | ||
bundle.putBoolean("isManaged", isManaged); | ||
bundle.putBoolean("isAuthorized", isAuthorized); | ||
bundle.putString("loginUsername", loginUsername); | ||
bundle.putBoolean("isStopped", isStopped); | ||
|
||
String message = String.format(Locale.US, "onStatusChanged(%s)", bundle.toString()); | ||
String message = String.format(Locale.US, "onStatusChanged(%s)", bundle); | ||
|
||
Log.i(TAG, message); | ||
DeployGate.logInfo(message); | ||
} | ||
|
||
@Override | ||
public void onUpdateAvailable( | ||
int revision, | ||
String versionName, | ||
int versionCode | ||
) { | ||
}) | ||
.setUpdateAvailableCallback((revision, versionName, versionCode) -> { | ||
Bundle bundle = new Bundle(); | ||
bundle.putInt("revision", revision); | ||
bundle.putString("versionName", versionName); | ||
bundle.putInt("versionCode", versionCode); | ||
|
||
String message = String.format(Locale.US, "onUpdateAvailable(%s)", bundle.toString()); | ||
String message = String.format(Locale.US, "onUpdateAvailable(%s)", bundle); | ||
|
||
Log.i(TAG, message); | ||
DeployGate.logInfo(message); | ||
} | ||
}, true); | ||
}) | ||
.setEnabledOnNonDebuggableBuild(true) | ||
.build(); | ||
|
||
DeployGate.install(this, configuration); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
|
||
// If you want to prevent the app distributed by someone else, specify your username on DeployGate | ||
// as a second argument of DeployGate.install, like: | ||
// with setAuthor method when creating DeployGate SdkConfiguration. like: | ||
// | ||
// DeployGate.install(this, "YOURUSERNAME"); | ||
// builder.setAuthor("YOURUSERNAME"); | ||
// | ||
// You can use DeployGate.isAuthorized() later to check the installation is valid or not. | ||
} | ||
|
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iff
is not a typo by the way. It's an abbreviation ofif and only if
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh.. reverted this change.